From 61b11467741335f2c4f76a3916544846858d6afd Mon Sep 17 00:00:00 2001 From: Katalina Okano Date: Sun, 1 Aug 2021 16:59:47 -0400 Subject: [PATCH] fix(interactions): deployment + handler --- packages/interactions/handlers/interaction.ts | 6 ++--- packages/interactions/index.ts | 2 +- packages/interactions/utils/interactions.ts | 10 +++++---- terraform/.terraform.lock.hcl | 18 ++++++++++++--- terraform/interactions.tf | 2 +- terraform/worker-dist/api.js | 22 +++++++++++++++++++ terraform/worker-dist/interactions.js | 10 +++++++++ 7 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 terraform/worker-dist/api.js create mode 100644 terraform/worker-dist/interactions.js diff --git a/packages/interactions/handlers/interaction.ts b/packages/interactions/handlers/interaction.ts index adf1aac..70da95b 100644 --- a/packages/interactions/handlers/interaction.ts +++ b/packages/interactions/handlers/interaction.ts @@ -17,12 +17,12 @@ const commands: Record< }; export const interactionHandler = async (request: Request): Promise => { - if (!(await verifyRequest(request))) { + const interaction = (await request.json()) as InteractionRequest; + + if (!verifyRequest(request, interaction)) { return new Response('invalid request signature', { status: 401 }); } - const interaction = (await request.json()) as InteractionRequest; - if (interaction.type === InteractionType.PING) { return respond({ type: 1 }); } diff --git a/packages/interactions/index.ts b/packages/interactions/index.ts index 997ecb4..2fedfb2 100644 --- a/packages/interactions/index.ts +++ b/packages/interactions/index.ts @@ -7,7 +7,7 @@ import { uiPublicURI } from './utils/config'; const router = new Router(); router.add('GET', '_healthz', healthz); -router.add('POST', 'interaction', interactionHandler); +router.add('POST', 'interactions', interactionHandler); // Root Zen <3 router.addFallback('root', () => { diff --git a/packages/interactions/utils/interactions.ts b/packages/interactions/utils/interactions.ts index 4c94f01..ba982d1 100644 --- a/packages/interactions/utils/interactions.ts +++ b/packages/interactions/utils/interactions.ts @@ -1,7 +1,11 @@ import { publicKey } from '@roleypoly/interactions/utils/config'; +import { InteractionRequest } from '@roleypoly/types'; import nacl from 'tweetnacl'; -export const verifyRequest = async (request: Request): Promise => { +export const verifyRequest = ( + request: Request, + interaction: InteractionRequest +): boolean => { const timestamp = request.headers.get('x-signature-timestamp'); const signature = request.headers.get('x-signature-ed25519'); @@ -9,11 +13,9 @@ export const verifyRequest = async (request: Request): Promise => { return false; } - const body = await request.json(); - if ( !nacl.sign.detached.verify( - Buffer.from(timestamp + JSON.stringify(body)), + Buffer.from(timestamp + JSON.stringify(interaction)), Buffer.from(signature, 'hex'), Buffer.from(publicKey, 'hex') ) diff --git a/terraform/.terraform.lock.hcl b/terraform/.terraform.lock.hcl index c61a381..cb8e26b 100644 --- a/terraform/.terraform.lock.hcl +++ b/terraform/.terraform.lock.hcl @@ -99,9 +99,21 @@ provider "registry.terraform.io/hashicorp/tls" { } provider "registry.terraform.io/roleypoly/discord-interactions" { - version = "0.0.1" - constraints = "~> 0.0" + version = "0.0.2" + constraints = ">= 0.0.1" hashes = [ - "h1:LwNmNIZRaLn7b3uCY2znFKGvncDS9GirjiC2LTw5jHw=", + "h1:YjCqc/W26R2UX/7MOD542QKhqadtGJLddDkqNPz/bR4=", + "zh:0321498537de78f8e56ce201bf35f442ca16ad704a49c6540674603e932ad72b", + "zh:0d27a0fb3387ccf5ca36980015a0d18515e59dd0433265c2e6541e7578b1c197", + "zh:23308a7402a3fc0fd39bf3f77fc94236c11cef177c6d3d162da246a6fd3bc107", + "zh:3aaac8a98375f195e313bdb61956c01846cb6d63e6fbd6833a8e0dcd269d94e6", + "zh:40182705dabf1c1c4581a5a485b61b897695b7d046a5b576611c0559d1dedc74", + "zh:649183c25b6ce5a5683b2e3088c5ffa163bf36fcb8243326fd38beabe2f2ec9e", + "zh:69f74ae5fe75f045c1b0c9df63e306b049e3cdd437e73fadd6292e0d517c97db", + "zh:9c5c6f73d8d08fefdb3342b3da6ec8a8d3e2c3732a684bd4c6fe47123ab328ab", + "zh:b0803665993565705a732f787949f5e4c095300761c207325225ce6bcc1dcaa2", + "zh:d54ff5a38e252719934ad836b369135e7300675575369e07a39313b08a14aeab", + "zh:d583722f547c37a5ba8750ccc5ecd7c010c444965bac9716f052ffb445a96cb8", + "zh:e20aebc9cb94e513396d6b94881952b0761fca4bb73e51f19fb856cd395e91a7", ] } diff --git a/terraform/interactions.tf b/terraform/interactions.tf index 89b37b5..de791aa 100644 --- a/terraform/interactions.tf +++ b/terraform/interactions.tf @@ -4,7 +4,7 @@ locals { ]) } -resource "discord-interactions_guild_command" { +resource "discord-interactions_guild_command" "hello-world" { for_each = local.internalTestingGuilds guild_id = each.value diff --git a/terraform/worker-dist/api.js b/terraform/worker-dist/api.js new file mode 100644 index 0000000..3c69f5c --- /dev/null +++ b/terraform/worker-dist/api.js @@ -0,0 +1,22 @@ +!function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=139)}([function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e,r){var i=r(3),n=i.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(o(i,e),e.Buffer=s),o(n,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var i=r(150),n=r(151),o=r(74);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){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 r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(i)return q(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return x(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function g(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function v(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:b(t,e,r,i,n);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,i,n){var o,s=1,a=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){var f=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var l=!0,c=0;cn&&(i=n):i=n;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function A(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+l<=r)switch(l){case 1:h<128&&(f=h);break;case 2:128==(192&(o=t[n+1]))&&(u=(31&h)<<6|63&o)>127&&(f=u);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(u=(15&h)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,i.push(f>>>10&1023|55296),f=56320|1023&f),i.push(f),n+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,i,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),h=this.slice(i,n),f=t.slice(e,r),l=0;ln)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return y(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return M(this,t,e,r);case"latin1":case"binary":return _(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function R(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,i,n,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function T(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-r,2);n>>8*(i?n:1-n)}function P(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-r,4);n>>8*(i?n:3-n)&255}function L(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,i,o){return o||L(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function D(t,e,r,i,o){return o||L(t,0,r,8),n.write(t,e,r,i,52,8),r+8}u.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)i+=this[t+--e]*n;return i},u.prototype.readUInt8=function(t,e){return e||j(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||j(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||j(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||j(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||j(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||j(t,e,this.length);for(var i=this[t],n=1,o=0;++o=(n*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||j(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||j(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||j(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||j(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||j(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||j(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||j(t,4,this.length),n.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||j(t,4,this.length),n.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||j(t,8,this.length),n.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||j(t,8,this.length),n.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||B(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+n]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):T(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):T(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):P(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):P(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):T(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):T(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):P(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):P(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--n)t[n+e]=this[n+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function z(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(2))},function(t,e){var r,i,n=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var u,h=[],f=!1,l=-1;function c(){f&&u&&(f=!1,u.length?h=u.concat(h):l=-1,h.length&&d())}function d(){if(!f){var t=a(c);f=!0;for(var e=h.length;e;){for(u=h,h=[];++l1)for(var r=1;r(n>>1)-1?(n>>1)-u:u,o.isubn(a)):a=0,i[s]=a,o.iushrn(1)}return i},i.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,o=0;t.cmpn(-n)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+n&3,h=e.andln(3)+o&3;3===u&&(u=-1),3===h&&(h=-1),s=0==(1&u)?0:3!==(i=t.andln(7)+n&7)&&5!==i||2!==h?u:-u,r[0].push(s),a=0==(1&h)?0:3!==(i=e.andln(7)+o&7)&&5!==i||2!==u?h:-h,r[1].push(a),2*n===s+1&&(n=1-n),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},i.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(t){return"string"==typeof t?i.toArray(t,"hex"):t},i.intFromLE=function(t){return new n(t,"hex","le")}},function(t,e,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),n=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||i(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(r(72),e),n(r(142),e),n(r(143),e),n(r(71),e)},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.importSharedKey=e.allowedCallbackHosts=e.rootUsers=e.apiPublicURI=e.uiPublicURI=e.botToken=e.botClientSecret=e.botClientID=void 0;const r=t,i=t=>{var e;return null!==(e=r[t])&&void 0!==e?e:""},n=t=>t.replace(/\/$/,""),o=t=>t.split(",");e.botClientID=i("BOT_CLIENT_ID"),e.botClientSecret=i("BOT_CLIENT_SECRET"),e.botToken=i("BOT_TOKEN"),e.uiPublicURI=n(i("UI_PUBLIC_URI")),e.apiPublicURI=n(i("API_PUBLIC_URI")),e.rootUsers=o(i("ROOT_USERS")),e.allowedCallbackHosts=o(i("ALLOWED_CALLBACK_HOSTS")),e.importSharedKey=i("BOT_IMPORT_TOKEN")}).call(this,r(2))},function(t,e,r){"use strict";var i=r(5),n=r(0);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=n,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>6|192,r[i++]=63&s|128):o(t,n)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++n)),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=63&s|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=63&s|128)}else for(n=0;n>>0}return s},e.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},e.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},e.sum64=function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,s=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},e.sum64_lo=function(t,e,r,i){return e+i>>>0},e.sum64_4_hi=function(t,e,r,i,n,o,s,a){var u=0,h=e;return u+=(h=h+i>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,i,n,o,s,a){return e+i+o+a>>>0},e.sum64_5_hi=function(t,e,r,i,n,o,s,a,u,h){var f=0,l=e;return f+=(l=l+i>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,i,n,o,s,a,u,h){return e+i+o+a+h>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.isAllowedCallbackHost=e.onlyRootUsers=e.isRoot=e.getStateSession=e.setupStateSession=e.withSession=e.cacheLayer=e.getSessionID=e.parsePermissions=e.resolveFailures=e.respond=e.formData=void 0;const n=r(73),o=r(15),s=i(r(44)),a=r(8),u=r(28);e.formData=t=>Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&");e.respond=(t,e={})=>new Response(JSON.stringify(t),e);e.resolveFailures=(t,r)=>async i=>{try{return r(i)}catch(r){return console.error(r),t()||e.respond({error:"internal server error"},{status:500})}};e.parsePermissions=(t,e=!1)=>e||n.evaluatePermission(t,n.permissions.ADMINISTRATOR)?o.UserGuildPermissions.Admin:n.evaluatePermission(t,n.permissions.MANAGE_ROLES)?o.UserGuildPermissions.Manager:o.UserGuildPermissions.User;e.getSessionID=t=>{const e=t.headers.get("authorization");if(!e)return null;const[r,i]=e.split(" ");return"Bearer"!==r?null:{type:r,id:i}};e.cacheLayer=(t,e,r,i)=>async(n,o={})=>{const s=e(n);if(!o.skipCachePull){const e=await t.get(s);if(e)return e}const a=await r(n);return a?(await t.put(s,a,i),a):null};const h=t=>e.respond({error:t||"not authenticated"},{status:403});e.withSession=t=>async r=>{const i=e.getSessionID(r);if(!i)return h("missing authentication");const n=await u.Sessions.get(i.id);return n?await t(n)(r):h("authentication expired or not found")};e.setupStateSession=async t=>{const e=(await s.default.random()).string;return await u.Sessions.put("state_"+e,{data:t},300),e};e.getStateSession=async t=>{const e=await u.Sessions.get("state_"+t);return null==e?void 0:e.data};e.isRoot=t=>a.rootUsers.includes(t);e.onlyRootUsers=t=>e.withSession(r=>i=>e.isRoot(r.user.id)?t(i):e.respond({error:"not_found"},{status:404}));e.isAllowedCallbackHost=t=>t===a.apiPublicURI||a.allowedCallbackHosts.includes(t)||null!==a.allowedCallbackHosts.filter(t=>t.includes("*")).find(e=>new RegExp(e.replace("*","[a-z0-9-]+")).test(t))},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(214).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}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,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=u(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,f=r;f1&&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?""};var f=["","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],c=[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 d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!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&&i(!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,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,h=new t(o),f=this.clone();if(u){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.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 e;e=this.length>t.length?t:this;for(var r=0;rt.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 e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.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){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,b=g>>>13,y=0|s[3],w=8191&y,M=y>>>13,_=0|s[4],S=8191&_,k=_>>>13,A=0|s[5],E=8191&A,R=A>>>13,x=0|s[6],I=8191&x,O=x>>>13,j=0|s[7],B=8191&j,T=j>>>13,P=0|s[8],L=8191&P,C=P>>>13,D=0|s[9],N=8191&D,U=D>>>13,q=0|a[0],z=8191&q,F=q>>>13,W=0|a[1],Z=8191&W,H=W>>>13,K=0|a[2],G=8191&K,V=K>>>13,$=0|a[3],Y=8191&$,J=$>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(i=Math.imul(l,z))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,z)|0))<<13)|0;h=((o=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var vt=(h+(i=i+Math.imul(l,Z)|0)|0)+((8191&(n=(n=n+Math.imul(l,H)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,z),n=(n=Math.imul(v,F))+Math.imul(b,z)|0,o=Math.imul(b,F),i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,H)|0;var bt=(h+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,G)|0))<<13)|0;h=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,z),n=(n=Math.imul(w,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,V)|0;var yt=(h+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;h=((o=o+Math.imul(c,J)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(S,z),n=(n=Math.imul(S,F))+Math.imul(k,z)|0,o=Math.imul(k,F),i=i+Math.imul(w,Z)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,H)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var wt=(h+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,z),n=(n=Math.imul(E,F))+Math.imul(R,z)|0,o=Math.imul(R,F),i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(v,Y)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Mt=(h+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,z),n=(n=Math.imul(I,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(E,Z)|0,n=(n=n+Math.imul(E,H)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var _t=(h+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,z),n=(n=Math.imul(B,F))+Math.imul(T,z)|0,o=Math.imul(T,F),i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,H)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,J)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(h+(i=i+Math.imul(l,ut)|0)|0)+((8191&(n=(n=n+Math.imul(l,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(C,z)|0,o=Math.imul(C,F),i=i+Math.imul(B,Z)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(E,Y)|0,n=(n=n+Math.imul(E,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var kt=(h+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,z),n=(n=Math.imul(N,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(L,Z)|0,n=(n=n+Math.imul(L,H)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,V)|0,i=i+Math.imul(I,Y)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var At=(h+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(N,Z),n=(n=Math.imul(N,H))+Math.imul(U,Z)|0,o=Math.imul(U,H),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,V)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,V)|0,i=i+Math.imul(B,Y)|0,n=(n=n+Math.imul(B,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,i=i+Math.imul(v,lt)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var Et=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,V))+Math.imul(U,G)|0,o=Math.imul(U,V),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,J)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ht)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ct)|0;var Rt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(N,Y),n=(n=Math.imul(N,J))+Math.imul(U,Y)|0,o=Math.imul(U,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(E,ut)|0,n=(n=n+Math.imul(E,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,ct)|0;var xt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(N,Q),n=(n=Math.imul(N,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,it)|0,i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,i=i+Math.imul(E,lt)|0,n=(n=n+Math.imul(E,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var It=(h+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((o=o+Math.imul(k,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(N,rt),n=(n=Math.imul(N,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(L,ot)|0,n=(n=n+Math.imul(L,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var Ot=(h+(i=i+Math.imul(E,pt)|0)|0)+((8191&(n=(n=n+Math.imul(E,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(N,ot),n=(n=Math.imul(N,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ct)|0;var jt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(N,ut),n=(n=Math.imul(N,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ct)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(N,lt),n=(n=Math.imul(N,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Tt=(h+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var Pt=(h+(i=Math.imul(N,pt))|0)+((8191&(n=(n=Math.imul(N,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=bt,u[3]=yt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=St,u[8]=kt,u[9]=At,u[10]=Et,u[11]=Rt,u[12]=xt,u[13]=It,u[14]=Ot,u[15]=jt,u[16]=Bt,u[17]=Tt,u[18]=Pt,0!==h&&(u[19]=h,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,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 e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==f||h>=n);h--){var l=0|this.words[h];this.words[h]=f<<26-o|l>>>o,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},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){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(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 e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,u=i.length-n.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{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,e);var n,s,a},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 e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(u)):(r.isub(e),a.isub(n),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).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 e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},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){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}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 e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},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 S(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(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 i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(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 b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){S.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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(y,b),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var l=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}u=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(14)(t))},function(t,e,r){"use strict";var i=r(29),n=r(41),o=n(i("String.prototype.indexOf"));t.exports=function(t,e){var r=i(t,!!e);return"function"==typeof r&&o(t,".prototype.")>-1?n(r):r}},function(t,e,r){var i=r(1).Buffer,n=r(166).Transform,o=r(17).StringDecoder;function s(t){n.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(0)(s,n),s.prototype.update=function(t,e,r){"string"==typeof t&&(t=i.from(t,e));var n=this._update(t);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(t,e,r){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{r(i)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||i.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var i=this._decoder.write(t);return r&&(i+=this._decoder.end()),i},t.exports=s},function(t,e){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,e,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),n=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||i(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(r(144),e),n(r(145),e),n(r(146),e),n(r(147),e),n(r(148),e),n(r(149),e)},function(t,e,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,o=n&&"function"==typeof n.apply?n.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(t,e){return new Promise((function(r,i){function n(r){t.removeListener(e,o),i(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",n),r([].slice.call(arguments))}v(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,r)}(t,n,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function h(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function l(t,e,r,i){var n,o,s,a;if(h(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=f(t))>0&&s.length>n&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=c.bind(i);return n.listener=r,i.wrapFn=n,n}function p(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=n[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var h=u.length,f=g(u,h);for(r=0;r=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){"use strict";var i=r(1).Buffer,n=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=h,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=f,this.end=l,e=3;break;default:return this.write=c,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function f(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){"use strict";var i=r(36),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=l;var o=Object.create(r(31));o.inherits=r(0);var s=r(84),a=r(51);o.inherits(l,s);for(var u=n(a.prototype),h=0;h2?arguments[2]:{},o=i(e);n&&(o=s.call(o,Object.getOwnPropertySymbols(e)));for(var a=0;a"guilds/"+t,async t=>{const r=await s.discordFetch("/guilds/"+t,u.botToken,s.AuthType.Bot);if(!r)return null;const i=(await e.getGuildMemberRoles({serverID:t,userID:u.botClientID})||[]).reduce((t,e)=>{const i=r.roles.find(t=>t.id===e);return i?t>i.position?t:i.position:t},0),n=await e.getGuildData(t),o=r.roles.map(t=>({id:t.id,name:t.name,color:t.color,managed:t.managed,position:t.position,permissions:t.permissions,safety:l(t,i,n)}));return{id:r.id,name:r.name,icon:r.icon,roles:o,highestRolePosition:i}},7200);e.getGuildMemberRoles=async({serverID:t,userID:r},i)=>{var n;return null===(n=await e.getGuildMember({serverID:t,userID:r},i))||void 0===n?void 0:n.roles};e.getGuildMember=a.cacheLayer(h.Guilds,({serverID:t,userID:e})=>`guilds/${t}/members/${e}`,async({serverID:t,userID:e})=>{const r=await s.discordFetch(`/guilds/${t}/members/${e}`,u.botToken,s.AuthType.Bot);return r?{roles:r.roles,pending:r.pending}:null},300);e.updateGuildMember=async t=>{await e.getGuildMember(t,{skipCachePull:!0})};e.getGuildData=async t=>{const e=await h.GuildData.get(t),r={id:t,message:"",categories:[],features:o.Features.None,auditLogWebhook:null,accessControl:{allowList:[],blockList:[],blockPending:!0}};return e?{...r,...e}:r};const l=(t,e,r)=>{let i=o.RoleSafety.Safe;t.managed&&(i|=o.RoleSafety.ManagedRole),t.position>e&&(i|=o.RoleSafety.HigherThanBot);const s=BigInt(t.permissions);return(n.evaluatePermission(s,n.permissions.ADMINISTRATOR)||n.evaluatePermission(s,n.permissions.MANAGE_ROLES))&&(i|=o.RoleSafety.DangerousPermissions),(r.accessControl.allowList.includes(t.id)||r.accessControl.blockList.includes(t.id))&&(i|=o.RoleSafety.AccessControl),i};!function(t){t.legacyImport="legacyImport",t.cacheClear="cacheClear"}(e.GuildRateLimiterKey||(e.GuildRateLimiterKey={}));e.useGuildRateLimiter=(t,e,r)=>f.useRateLimiter(h.Guilds,`guilds/${t}/rate-limit/${e}`,r);e.asEditor=(t={},r)=>a.withSession(n=>async s=>{const{rateLimitKey:u,rateLimitTimeoutSeconds:h}=t,f=new URL(s.url),[,,l]=f.pathname.split("/");if(!l)return i.missingParameters();let c=null;u&&(c=await e.useGuildRateLimiter(l,u,h||60));const d=a.isRoot(n.user.id);let p=n.guilds.find(t=>t.id===l);if(!p){if(!d)return i.notFound();const t=await e.getGuild(l);if(!t)return i.notFound();p={id:t.id,name:t.name,icon:t.icon,permissionLevel:o.UserGuildPermissions.Admin}}const m=p.permissionLevel===o.UserGuildPermissions.Manager;return p.permissionLevel===o.UserGuildPermissions.Admin||m?!d&&c&&await c()?i.rateLimited():await r(n,{guildID:l,guild:p,url:f})(s):i.lowPermissions()})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.invalid=e.rateLimited=e.conflict=e.notFound=e.accessControlViolation=e.lowPermissions=e.missingParameters=e.ok=void 0;const i=r(7);e.ok=()=>i.respond({ok:!0});e.missingParameters=()=>i.respond({error:"missing parameters"},{status:400});e.lowPermissions=()=>i.respond({error:"no permissions for this action"},{status:403});e.accessControlViolation=()=>i.respond({error:"member fails access control requirements"},{status:403});e.notFound=()=>i.respond({error:"not found"},{status:404});e.conflict=()=>i.respond({error:"conflict"},{status:409});e.rateLimited=()=>i.respond({error:"rate limit hit, enhance your calm"},{status:429});e.invalid=(t={})=>i.respond({err:"client sent something invalid",data:t},{status:400})},function(t,e,r){"use strict";(function(e,i){var n=r(1).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var r=n.allocUnsafe(t);if(t>0)if(t>65536)for(var s=0;s2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,s,a;if("string"==typeof e&&(n="not ",e.substr(!s||s<0?0:+s,n.length)===n)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a="The ".concat(t," ").concat(i," ").concat(o(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(u," ").concat(i," ").concat(o(e,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,r){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var n=r(76),o=r(80);r(0)(h,n);for(var s=i(o.prototype),a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n},function(t,e,r){"use strict";var i={};function n(t,e,r){r||(r=Error);var n=function(t){var r,i;function n(r,i,n){return t.call(this,function(t,r,i){return"string"==typeof e?e:e(t,r,i)}(r,i,n))||this}return i=t,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);n.prototype.name=r.name,n.prototype.code=t,i[t]=n}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,s,a;if("string"==typeof e&&(n="not ",e.substr(!s||s<0?0:+s,n.length)===n)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a="The ".concat(t," ").concat(i," ").concat(o(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(u," ").concat(i," ").concat(o(e,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,r){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var n=r(106),o=r(110);r(0)(h,n);for(var s=i(o.prototype),a=0;a1&&"boolean"!=typeof e)throw new o('"allowMissing" argument must be a boolean');var r=k(t),n=r.length>0?r[0]:"",s=A("%"+n+"%",e),u=s.name,h=s.value,f=!1,l=s.alias;l&&(n=l[0],y(r,b([0,1],l)));for(var c=1,d=!0;c=r.length){var _=a(h,m);h=(d=!!_)&&"get"in _&&!("originalValue"in _.get)?_.get:h[m]}else d=v(h,m),h=h[m];d&&!f&&(p[u]=h)}}return h}},function(t,e,r){"use strict";var i=r(0),n=r(45),o=r(48),s=r(49),a=r(13);function u(t){a.call(this,"digest"),this._hash=t}i(u,a),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new n:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},function(t,e,r){(function(t){function r(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===r(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===r(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===r(t)},e.isError=function(t){return"[object Error]"===r(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,r(3).Buffer)},function(t,e,r){(function(e){t.exports=function(t,r){for(var i=Math.min(t.length,r.length),n=new e(i),o=0;o=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o>>24]^f[p>>>16&255]^l[m>>>8&255]^c[255&g]^e[v++],s=h[p>>>24]^f[m>>>16&255]^l[g>>>8&255]^c[255&d]^e[v++],a=h[m>>>24]^f[g>>>16&255]^l[d>>>8&255]^c[255&p]^e[v++],u=h[g>>>24]^f[d>>>16&255]^l[p>>>8&255]^c[255&m]^e[v++],d=o,p=s,m=a,g=u;return o=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&g])^e[v++],s=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[g>>>8&255]<<8|i[255&d])^e[v++],a=(i[m>>>24]<<24|i[g>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[v++],u=(i[g>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[v++],[o>>>=0,s>>>=0,a>>>=0,u>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var h=a^a<<1^a<<2^a<<3^a<<4;h=h>>>8^255&h^99,r[s]=h,i[h]=s;var f=t[s],l=t[f],c=t[l],d=257*t[h]^16843008*h;n[0][s]=d<<24|d>>>8,n[1][s]=d<<16|d>>>16,n[2][s]=d<<8|d>>>24,n[3][s]=d,d=16843009*c^65537*l^257*f^16843008*s,o[0][h]=d<<24|d>>>8,o[1][h]=d<<16|d>>>16,o[2][h]=d<<8|d>>>24,o[3][h]=d,0===s?s=a=1:(s=f^t[t[t[c^f]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:o}}();function h(t){this._key=n(t),this._reset()}h.blockSize=16,h.keySize=32,h.prototype.blockSize=h.blockSize,h.prototype.keySize=h.keySize,h.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],o=0;o>>24,s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s],s^=a[o/e|0]<<24):e>6&&o%e==4&&(s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s]),n[o]=n[o-e]^s}for(var h=[],f=0;f>>24]]^u.INV_SUB_MIX[1][u.SBOX[c>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[c>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&c]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=h},h.prototype.encryptBlockRaw=function(t){return s(t=n(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},h.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=i.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},h.prototype.decryptBlock=function(t){var e=(t=n(t))[1];t[1]=t[3],t[3]=e;var r=s(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=i.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},h.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=h},function(t,e,r){var i=r(1).Buffer,n=r(45);t.exports=function(t,e,r,o){if(i.isBuffer(t)||(t=i.from(t,"binary")),e&&(i.isBuffer(e)||(e=i.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var s=r/8,a=i.alloc(s),u=i.alloc(o||0),h=i.alloc(0);s>0||o>0;){var f=new n;f.update(h),f.update(t),e&&f.update(e),h=f.digest();var l=0;if(s>0){var c=a.length-s;l=Math.min(s,h.length),h.copy(a,c,0,l),s-=l}if(l0){var d=u.length-o,p=Math.min(o,h.length-l);h.copy(u,d,l,l+p),o-=p}}return h.fill(0),{key:a,iv:u}}},function(t,e,r){"use strict";var i=r(11),n=r(6),o=n.getNAF,s=n.getJSF,a=n.assert;function u(t,e){this.type=t,this.p=new i(e.p,16),this.red=e.prime?i.red(e.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=e.n&&new i(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function h(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),i=o(e,1,this._bitLength),n=(1<=s;f--)u=(u<<1)+i[f];h.push(u)}for(var l=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=n;d>0;d--){for(s=0;s=0;h--){for(var f=0;h>=0&&0===s[h];h--)f++;if(h>=0&&f++,u=u.dblp(f),h<0)break;var l=s[h];a(0!==l),u="affine"===t.type?l>0?u.mixedAdd(n[l-1>>1]):u.mixedAdd(n[-l-1>>1].neg()):l>0?u.add(n[l-1>>1]):u.add(n[-l-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,i,n){var a,u,h,f=this._wnafT1,l=this._wnafT2,c=this._wnafT3,d=0;for(a=0;a=1;a-=2){var m=a-1,g=a;if(1===f[m]&&1===f[g]){var v=[e[m],null,null,e[g]];0===e[m].y.cmp(e[g].y)?(v[1]=e[m].add(e[g]),v[2]=e[m].toJ().mixedAdd(e[g].neg())):0===e[m].y.cmp(e[g].y.redNeg())?(v[1]=e[m].toJ().mixedAdd(e[g]),v[2]=e[m].add(e[g].neg())):(v[1]=e[m].toJ().mixedAdd(e[g]),v[2]=e[m].toJ().mixedAdd(e[g].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],y=s(r[m],r[g]);for(d=Math.max(y[0].length,d),c[m]=new Array(d),c[g]=new Array(d),u=0;u=0;a--){for(var k=0;a>=0;){var A=!0;for(u=0;u=0&&k++,_=_.dblp(k),a<0)break;for(u=0;u0?h=l[u][E-1>>1]:E<0&&(h=l[u][-E-1>>1].neg()),_="affine"===h.type?_.mixedAdd(h):_.add(h))}}for(a=0;a=Math.ceil((t.bitLength()+1)/e.step)},h.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;nnew Response(null,{status:303,headers:{location:t}})},function(t,e,r){"use strict";(function(e){const{randomBytes:i}=r(152),{inspect:{custom:n},promisify:o}=r(251),s=r(254),a=o(i),u=`Valid KSUID timestamps must be in milliseconds since ${new Date(0).toISOString()},\n no earlier than ${new Date(14e11).toISOString()} and no later than ${new Date(5694967295e3).toISOString()}\n`.trim().replace(/(\n|\s)+/g," ").replace(/\.000Z/g,"Z");function h(t,r){const i=Math.floor((t-14e11)/1e3),n=e.allocUnsafe(4);return n.writeUInt32BE(i,0),e.concat([n,r],20)}const f=new WeakMap;class l{constructor(t){if(!l.isValid(t))throw new TypeError("Valid KSUID buffers are 20 bytes");f.set(this,t),Object.defineProperty(this,"buffer",{enumerable:!0,get:()=>e.from(t)})}get raw(){return e.from(f.get(this).slice(0))}get date(){return new Date(1e3*this.timestamp+14e11)}get timestamp(){return f.get(this).readUInt32BE(0)}get payload(){const t=f.get(this).slice(4,20);return e.from(t)}get string(){return s.encode(f.get(this),27).padStart(27,"0")}compare(t){return f.has(t)?f.get(this).compare(f.get(t),0,20):0}equals(t){return this===t||f.has(t)&&0===this.compare(t)}toString(){return`${this[Symbol.toStringTag]} { ${this.string} }`}[n](){return this.toString()}static async random(t=Date.now()){const e=await a(16);return new l(h(Number(t),e))}static randomSync(t=Date.now()){const e=i(16);return new l(h(Number(t),e))}static fromParts(t,r){if(!Number.isInteger(t)||t<14e11||t>5694967295e3)throw new TypeError(u);if(!e.isBuffer(r)||16!==r.byteLength)throw new TypeError("Valid KSUID payloads are 16 bytes");return new l(h(t,r))}static isValid(t){return e.isBuffer(t)&&20===t.byteLength}static parse(t){if(27!==t.length)throw new TypeError("Valid encoded KSUIDs are 27 characters");const r=s.decode(t,20);if(20===r.byteLength)return new l(r);const i=e.allocUnsafe(20),n=20-r.byteLength;return i.fill(0,0,n),r.copy(i,n),new l(i)}}Object.defineProperty(l.prototype,Symbol.toStringTag,{value:"KSUID"}),Object.defineProperty(l,"MAX_STRING_ENCODED",{value:"aWgEPTl1tmebfsQzFP4bxwgy80V"}),Object.defineProperty(l,"MIN_STRING_ENCODED",{value:"000000000000000000000000000"}),t.exports=l}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var i=r(0),n=r(75),o=r(1).Buffer,s=new Array(16);function a(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<>>32-e}function h(t,e,r,i,n,o,s){return u(t+(e&r|~e&i)+n+o|0,s)+e|0}function f(t,e,r,i,n,o,s){return u(t+(e&i|r&~i)+n+o|0,s)+e|0}function l(t,e,r,i,n,o,s){return u(t+(e^r^i)+n+o|0,s)+e|0}function c(t,e,r,i,n,o,s){return u(t+(r^(e|~i))+n+o|0,s)+e|0}i(a,n),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,i=this._b,n=this._c,o=this._d;r=h(r,i,n,o,t[0],3614090360,7),o=h(o,r,i,n,t[1],3905402710,12),n=h(n,o,r,i,t[2],606105819,17),i=h(i,n,o,r,t[3],3250441966,22),r=h(r,i,n,o,t[4],4118548399,7),o=h(o,r,i,n,t[5],1200080426,12),n=h(n,o,r,i,t[6],2821735955,17),i=h(i,n,o,r,t[7],4249261313,22),r=h(r,i,n,o,t[8],1770035416,7),o=h(o,r,i,n,t[9],2336552879,12),n=h(n,o,r,i,t[10],4294925233,17),i=h(i,n,o,r,t[11],2304563134,22),r=h(r,i,n,o,t[12],1804603682,7),o=h(o,r,i,n,t[13],4254626195,12),n=h(n,o,r,i,t[14],2792965006,17),r=f(r,i=h(i,n,o,r,t[15],1236535329,22),n,o,t[1],4129170786,5),o=f(o,r,i,n,t[6],3225465664,9),n=f(n,o,r,i,t[11],643717713,14),i=f(i,n,o,r,t[0],3921069994,20),r=f(r,i,n,o,t[5],3593408605,5),o=f(o,r,i,n,t[10],38016083,9),n=f(n,o,r,i,t[15],3634488961,14),i=f(i,n,o,r,t[4],3889429448,20),r=f(r,i,n,o,t[9],568446438,5),o=f(o,r,i,n,t[14],3275163606,9),n=f(n,o,r,i,t[3],4107603335,14),i=f(i,n,o,r,t[8],1163531501,20),r=f(r,i,n,o,t[13],2850285829,5),o=f(o,r,i,n,t[2],4243563512,9),n=f(n,o,r,i,t[7],1735328473,14),r=l(r,i=f(i,n,o,r,t[12],2368359562,20),n,o,t[5],4294588738,4),o=l(o,r,i,n,t[8],2272392833,11),n=l(n,o,r,i,t[11],1839030562,16),i=l(i,n,o,r,t[14],4259657740,23),r=l(r,i,n,o,t[1],2763975236,4),o=l(o,r,i,n,t[4],1272893353,11),n=l(n,o,r,i,t[7],4139469664,16),i=l(i,n,o,r,t[10],3200236656,23),r=l(r,i,n,o,t[13],681279174,4),o=l(o,r,i,n,t[0],3936430074,11),n=l(n,o,r,i,t[3],3572445317,16),i=l(i,n,o,r,t[6],76029189,23),r=l(r,i,n,o,t[9],3654602809,4),o=l(o,r,i,n,t[12],3873151461,11),n=l(n,o,r,i,t[15],530742520,16),r=c(r,i=l(i,n,o,r,t[2],3299628645,23),n,o,t[0],4096336452,6),o=c(o,r,i,n,t[7],1126891415,10),n=c(n,o,r,i,t[14],2878612391,15),i=c(i,n,o,r,t[5],4237533241,21),r=c(r,i,n,o,t[12],1700485571,6),o=c(o,r,i,n,t[3],2399980690,10),n=c(n,o,r,i,t[10],4293915773,15),i=c(i,n,o,r,t[1],2240044497,21),r=c(r,i,n,o,t[8],1873313359,6),o=c(o,r,i,n,t[15],4264355552,10),n=c(n,o,r,i,t[6],2734768916,15),i=c(i,n,o,r,t[13],1309151649,21),r=c(r,i,n,o,t[4],4149444226,6),o=c(o,r,i,n,t[11],3174756917,10),n=c(n,o,r,i,t[2],718787259,15),i=c(i,n,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var i=!1;return function(){if(!i){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}}}).call(this,r(2))},function(t,e,r){"use strict";var i=r(23).codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n>>32-e}function m(t,e,r,i,n,o,s,a){return p(t+(e^r^i)+o+s|0,a)+n|0}function g(t,e,r,i,n,o,s,a){return p(t+(e&r|~e&i)+o+s|0,a)+n|0}function v(t,e,r,i,n,o,s,a){return p(t+((e|~r)^i)+o+s|0,a)+n|0}function b(t,e,r,i,n,o,s,a){return p(t+(e&i|r&~i)+o+s|0,a)+n|0}function y(t,e,r,i,n,o,s,a){return p(t+(e^(r|~i))+o+s|0,a)+n|0}n(d,o),d.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,i=0|this._b,n=0|this._c,o=0|this._d,d=0|this._e,w=0|this._a,M=0|this._b,_=0|this._c,S=0|this._d,k=0|this._e,A=0;A<80;A+=1){var E,R;A<16?(E=m(r,i,n,o,d,t[a[A]],l[0],h[A]),R=y(w,M,_,S,k,t[u[A]],c[0],f[A])):A<32?(E=g(r,i,n,o,d,t[a[A]],l[1],h[A]),R=b(w,M,_,S,k,t[u[A]],c[1],f[A])):A<48?(E=v(r,i,n,o,d,t[a[A]],l[2],h[A]),R=v(w,M,_,S,k,t[u[A]],c[2],f[A])):A<64?(E=b(r,i,n,o,d,t[a[A]],l[3],h[A]),R=g(w,M,_,S,k,t[u[A]],c[3],f[A])):(E=y(r,i,n,o,d,t[a[A]],l[4],h[A]),R=m(w,M,_,S,k,t[u[A]],c[4],f[A])),r=d,d=o,o=p(n,10),n=i,i=E,w=k,k=S,S=p(_,10),_=M,M=R}var x=this._b+n+S|0;this._b=this._c+o+k|0,this._c=this._d+d+w|0,this._d=this._e+r+M|0,this._e=this._a+i+_|0,this._a=x},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=i.alloc?i.alloc(20):new i(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},function(t,e,r){(e=t.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r}).sha=r(162),e.sha1=r(163),e.sha224=r(164),e.sha256=r(82),e.sha384=r(165),e.sha512=r(83)},function(t,e,r){(e=t.exports=r(84)).Stream=e,e.Readable=e,e.Writable=r(51),e.Duplex=r(18),e.Transform=r(87),e.PassThrough=r(172)},function(t,e,r){"use strict";(function(e,i,n){var o=r(36);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=b;var a,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:o.nextTick;b.WritableState=v;var h=Object.create(r(31));h.inherits=r(0);var f={deprecate:r(46)},l=r(85),c=r(1).Buffer,d=n.Uint8Array||function(){};var p,m=r(86);function g(){}function v(t,e){a=a||r(18),t=t||{};var i=e instanceof a;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,h=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(h||0===h)?h:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(o.nextTick(n,i),o.nextTick(k,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),k(t,e))}(t,r,i,e,n);else{var s=_(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||M(t,r),i?u(w,t,r,s,n):w(t,r,s,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function b(t){if(a=a||r(18),!(p.call(b,this)||this instanceof a))return new b(t);this._writableState=new v(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),l.call(this)}function y(t,e,r,i,n,o,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function w(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),k(t,e)}function M(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),o=e.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)n[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;n.allBuffers=u,y(t,e,!0,e.length,n,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,f=r.encoding,l=r.callback;if(y(t,e,!1,e.objectMode?1:h.length,h,f,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),k(t,e)}))}function k(t,e){var r=_(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}h.inherits(b,l),v.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(v.prototype,"buffer",{get:f.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===b&&(t&&t._writableState instanceof v)}})):p=function(t){return t instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(t,e,r){var i,n=this._writableState,s=!1,a=!n.objectMode&&(i=t,c.isBuffer(i)||i instanceof d);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=g),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var n=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),o.nextTick(i,s),n=!1),n}(this,n,t,r))&&(n.pendingcb++,s=function(t,e,r,i,n,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,r));return e}(e,i,n);i!==s&&(r=!0,n="buffer",i=s)}var a=e.objectMode?1:i.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(t,e,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,r){e.ending=!0,k(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),b.prototype.destroy=m.destroy,b.prototype._undestroy=m.undestroy,b.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(4),r(170).setImmediate,r(2))},function(t,e,r){"use strict";var i=r(5);function n(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=n,n.prototype._init=function(){},n.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},n.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),i=0;i0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(n,r);return e+=this._buffer(t,e),n},n.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},n.prototype._pad=function(t,e){if(0===e)return!1;for(;e */ +var i=r(3),n=i.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(o(i,e),e.Buffer=s),s.prototype=Object.create(n.prototype),o(n,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,r){"use strict";var i=r(26).codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function s(t,r){var n=function(t){var e=o(t);return{blinder:e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(r),s=r.modulus.byteLength(),a=new i(t).mul(n.blinder).umod(r.modulus),u=a.toRed(i.mont(r.prime1)),h=a.toRed(i.mont(r.prime2)),f=r.coefficient,l=r.prime1,c=r.prime2,d=u.redPow(r.exponent1).fromRed(),p=h.redPow(r.exponent2).fromRed(),m=d.isub(p).imul(f).umod(l).imul(c);return p.iadd(m).imul(n.unblinder).umod(r.modulus).toArrayLike(e,"be",s)}s.getr=o,t.exports=s}).call(this,r(3).Buffer)},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(212).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+t)}function u(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,r,n){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?h-49+10:h>=17?h-17+10:h,i(h>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=u(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,f=r;f1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){o.prototype.inspect=l}else o.prototype.inspect=l;function l(){return(this.red?""}var c=["","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"],d=[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],p=[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];o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=d[t],f=p[t];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(f).toString(t);r=(l=l.idivn(f)).isZero()?m+r:c[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!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&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,n),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.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 e;e=this.length>t.length?t:this;for(var r=0;rt.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 e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.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){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,b=g>>>13,y=0|s[3],w=8191&y,M=y>>>13,_=0|s[4],S=8191&_,k=_>>>13,A=0|s[5],E=8191&A,R=A>>>13,x=0|s[6],I=8191&x,O=x>>>13,j=0|s[7],B=8191&j,T=j>>>13,P=0|s[8],L=8191&P,C=P>>>13,D=0|s[9],N=8191&D,U=D>>>13,q=0|a[0],z=8191&q,F=q>>>13,W=0|a[1],Z=8191&W,H=W>>>13,K=0|a[2],G=8191&K,V=K>>>13,$=0|a[3],Y=8191&$,J=$>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(i=Math.imul(l,z))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,z)|0))<<13)|0;h=((o=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var vt=(h+(i=i+Math.imul(l,Z)|0)|0)+((8191&(n=(n=n+Math.imul(l,H)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,z),n=(n=Math.imul(v,F))+Math.imul(b,z)|0,o=Math.imul(b,F),i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,H)|0;var bt=(h+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,G)|0))<<13)|0;h=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,z),n=(n=Math.imul(w,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,V)|0;var yt=(h+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;h=((o=o+Math.imul(c,J)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(S,z),n=(n=Math.imul(S,F))+Math.imul(k,z)|0,o=Math.imul(k,F),i=i+Math.imul(w,Z)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,H)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var wt=(h+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,z),n=(n=Math.imul(E,F))+Math.imul(R,z)|0,o=Math.imul(R,F),i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(v,Y)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Mt=(h+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,z),n=(n=Math.imul(I,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(E,Z)|0,n=(n=n+Math.imul(E,H)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var _t=(h+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,z),n=(n=Math.imul(B,F))+Math.imul(T,z)|0,o=Math.imul(T,F),i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,H)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,J)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(h+(i=i+Math.imul(l,ut)|0)|0)+((8191&(n=(n=n+Math.imul(l,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(C,z)|0,o=Math.imul(C,F),i=i+Math.imul(B,Z)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(E,Y)|0,n=(n=n+Math.imul(E,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var kt=(h+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,z),n=(n=Math.imul(N,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(L,Z)|0,n=(n=n+Math.imul(L,H)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,V)|0,i=i+Math.imul(I,Y)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var At=(h+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(N,Z),n=(n=Math.imul(N,H))+Math.imul(U,Z)|0,o=Math.imul(U,H),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,V)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,V)|0,i=i+Math.imul(B,Y)|0,n=(n=n+Math.imul(B,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,i=i+Math.imul(v,lt)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var Et=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,V))+Math.imul(U,G)|0,o=Math.imul(U,V),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,J)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ht)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ct)|0;var Rt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(N,Y),n=(n=Math.imul(N,J))+Math.imul(U,Y)|0,o=Math.imul(U,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(E,ut)|0,n=(n=n+Math.imul(E,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,ct)|0;var xt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(N,Q),n=(n=Math.imul(N,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,it)|0,i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,i=i+Math.imul(E,lt)|0,n=(n=n+Math.imul(E,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var It=(h+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((o=o+Math.imul(k,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(N,rt),n=(n=Math.imul(N,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(L,ot)|0,n=(n=n+Math.imul(L,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var Ot=(h+(i=i+Math.imul(E,pt)|0)|0)+((8191&(n=(n=n+Math.imul(E,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(N,ot),n=(n=Math.imul(N,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ct)|0;var jt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(N,ut),n=(n=Math.imul(N,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ct)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(N,lt),n=(n=Math.imul(N,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Tt=(h+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var Pt=(h+(i=Math.imul(N,pt))|0)+((8191&(n=(n=Math.imul(N,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=bt,u[3]=yt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=St,u[8]=kt,u[9]=At,u[10]=Et,u[11]=Rt,u[12]=xt,u[13]=It,u[14]=Ot,u[15]=jt,u[16]=Bt,u[17]=Tt,u[18]=Pt,0!==h&&(u[19]=h,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function b(t,e,r){return v(t,e,r)}function y(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):b(this,t,e)},y.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},y.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[n]=67108863&s}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():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 e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==f||h>=n);h--){var l=0|this.words[h];this.words[h]=f<<26-o|l>>>o,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},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){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(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 e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this._strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,u=i.length-n.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var n,s,a},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 e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(r*n+(0|this.words[o]))%t;return e?-n:n},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*r;this.words[n]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(u)):(r.isub(e),a.isub(n),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).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 e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},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){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}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 e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},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 E(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(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 i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function M(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){M.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){M.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){M.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){M.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function R(t){E.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)}M.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},M.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},M.prototype.split=function(t,e){t.iushrn(this.n,0,e)},M.prototype.imulK=function(t){return t.imul(this.k)},n(_,M),_.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new S;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return w[t]=e,e},E.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(f(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var l=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}u=26}return n},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new R(t)},n(R,E),R.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},R.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},R.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},R.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},R.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(14)(t))},function(t,e,r){"use strict";var i=e;i.version=r(213).version,i.utils=r(6),i.rand=r(55),i.curve=r(113),i.curves=r(61),i.ec=r(225),i.eddsa=r(229)},function(t,e,r){"use strict";var i,n=e,o=r(62),s=r(113),a=r(6).assert;function u(t){"short"===t.type?this.curve=new s.short(t):"edwards"===t.type?this.curve=new s.edwards(t):this.curve=new s.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function h(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,h("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),h("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),h("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(224)}catch(t){i=void 0}h("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},function(t,e,r){var i=e;i.utils=r(9),i.common=r(33),i.sha=r(218),i.ripemd=r(222),i.hmac=r(223),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(t,e,r){"use strict";(function(e){var i,n=r(3),o=n.Buffer,s={};for(i in n)n.hasOwnProperty(i)&&"SlowBuffer"!==i&&"Buffer"!==i&&(s[i]=n[i]);var a=s.Buffer={};for(i in o)o.hasOwnProperty(i)&&"allocUnsafe"!==i&&"allocUnsafeSlow"!==i&&(a[i]=o[i]);if(s.Buffer.prototype=o.prototype,a.from&&a.from!==Uint8Array.from||(a.from=function(t,e,r){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return o(t,e,r)}),a.alloc||(a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var i=o(t);return e&&0!==e.length?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i}),!s.kStringMaxLength)try{s.kStringMaxLength=e.binding("buffer").kStringMaxLength}catch(t){}s.constants||(s.constants={MAX_LENGTH:s.kMaxLength},s.kStringMaxLength&&(s.constants.MAX_STRING_LENGTH=s.kStringMaxLength)),t.exports=s}).call(this,r(4))},function(t,e,r){"use strict";const i=r(65).Reporter,n=r(34).EncoderBuffer,o=r(34).DecoderBuffer,s=r(5),a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a);function h(t,e,r){const i={};this._baseState=i,i.name=r,i.enc=t,i.parent=e||null,i.children=null,i.tag=null,i.args=null,i.reverseArgs=null,i.choice=null,i.optional=!1,i.any=!1,i.obj=!1,i.use=null,i.useDecoder=null,i.key=null,i.default=null,i.explicit=null,i.implicit=null,i.contains=null,i.parent||(i.children=[],this._wrap())}t.exports=h;const f=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];h.prototype.clone=function(){const t=this._baseState,e={};f.forEach((function(r){e[r]=t[r]}));const r=new this.constructor(e.parent);return r._baseState=e,r},h.prototype._wrap=function(){const t=this._baseState;u.forEach((function(e){this[e]=function(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},h.prototype._init=function(t){const e=this._baseState;s(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),s.equal(e.children.length,1,"Root node can have only one child")},h.prototype._useArgs=function(t){const e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(s(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(s(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);const i=t[r];e[i]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){h.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),a.forEach((function(t){h.prototype[t]=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===e.tag),e.tag=t,this._useArgs(r),this}})),h.prototype.use=function(t){s(t);const e=this._baseState;return s(null===e.use),e.use=t,this},h.prototype.optional=function(){return this._baseState.optional=!0,this},h.prototype.def=function(t){const e=this._baseState;return s(null===e.default),e.default=t,e.optional=!0,this},h.prototype.explicit=function(t){const e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.explicit=t,this},h.prototype.implicit=function(t){const e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.implicit=t,this},h.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},h.prototype.key=function(t){const e=this._baseState;return s(null===e.key),e.key=t,this},h.prototype.any=function(){return this._baseState.any=!0,this},h.prototype.choice=function(t){const e=this._baseState;return s(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},h.prototype.contains=function(t){const e=this._baseState;return s(null===e.use),e.contains=t,this},h.prototype._decode=function(t,e){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));let i,n=r.default,s=!0,a=null;if(null!==r.key&&(a=t.enterKey(r.key)),r.optional){let i=null;if(null!==r.explicit?i=r.explicit:null!==r.implicit?i=r.implicit:null!==r.tag&&(i=r.tag),null!==i||r.any){if(s=this._peekTag(t,i,r.any),t.isError(s))return s}else{const i=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),s=!0}catch(t){s=!1}t.restore(i)}}if(r.obj&&s&&(i=t.enterObject()),s){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const i=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const i=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(i))return i;r.any?n=t.raw(e):t=i}if(e&&e.track&&null!==r.tag&&e.track(t.path(),i,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(n=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const i=new o(n);n=this._getUse(r.contains,t._reporterState.obj)._decode(i,e)}}return r.obj&&s&&(n=t.leaveObject(i)),null===r.key||null===n&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,r.key,n),n},h.prototype._decodeGeneric=function(t,e,r){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,i.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&i.args?this._decodeObjid(e,i.args[0],i.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},h.prototype._getUse=function(t,e){const r=this._baseState;return r.useDecoder=this._use(t,e),s(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},h.prototype._decodeChoice=function(t,e){const r=this._baseState;let i=null,n=!1;return Object.keys(r.choice).some((function(o){const s=t.save(),a=r.choice[o];try{const r=a._decode(t,e);if(t.isError(r))return!1;i={type:o,value:r},n=!0}catch(e){return t.restore(s),!1}return!0}),this),n?i:t.error("Choice not matched")},h.prototype._createEncoderBuffer=function(t){return new n(t,this.reporter)},h.prototype._encode=function(t,e,r){const i=this._baseState;if(null!==i.default&&i.default===t)return;const n=this._encodeValue(t,e,r);return void 0===n||this._skipDefault(n,e,r)?void 0:n},h.prototype._encodeValue=function(t,e,r){const n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new i);let o=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}let s=null,a=!1;if(n.any)o=this._createEncoderBuffer(t);else if(n.choice)o=this._encodeChoice(t,e);else if(n.contains)s=this._getUse(n.contains,r)._encode(t,e),a=!0;else if(n.children)s=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");const i=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const n=r._encode(t[r._baseState.key],e,t);return e.leaveKey(i),n}),this).filter((function(t){return t})),s=this._createEncoderBuffer(s);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,s=this._createEncoderBuffer(t.map((function(r){const i=this._baseState;return this._getUse(i.args[0],t)._encode(r,e)}),r))}else null!==n.use?o=this._getUse(n.use,r)._encode(t,e):(s=this._encodePrimitive(n.tag,t),a=!0);if(!n.any&&null===n.choice){const t=null!==n.implicit?n.implicit:n.tag,r=null===n.implicit?"universal":"context";null===t?null===n.use&&e.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(t,a,r,s))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},h.prototype._encodeChoice=function(t,e){const r=this._baseState,i=r.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,e)},h.prototype._encodePrimitive=function(t,e){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},h.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},h.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(t,e,r){"use strict";const i=r(0);function n(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.Reporter=n,n.prototype.isError=function(t){return t instanceof o},n.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},n.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},n.prototype.enterKey=function(t){return this._reporterState.path.push(t)},n.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},n.prototype.leaveKey=function(t,e,r){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},n.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},n.prototype.error=function(t){let e;const r=this._reporterState,i=t instanceof o;if(e=i?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return i||r.errors.push(e),e},n.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},i(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},function(t,e,r){"use strict";function i(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const i=t[r];e[i]=r})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=i(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=i(e.tag)},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(248).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}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,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=u(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,f=r;f1&&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?""};var f=["","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],c=[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 d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!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&&i(!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,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,h=new t(o),f=this.clone();if(u){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.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 e;e=this.length>t.length?t:this;for(var r=0;rt.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 e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.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){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,b=g>>>13,y=0|s[3],w=8191&y,M=y>>>13,_=0|s[4],S=8191&_,k=_>>>13,A=0|s[5],E=8191&A,R=A>>>13,x=0|s[6],I=8191&x,O=x>>>13,j=0|s[7],B=8191&j,T=j>>>13,P=0|s[8],L=8191&P,C=P>>>13,D=0|s[9],N=8191&D,U=D>>>13,q=0|a[0],z=8191&q,F=q>>>13,W=0|a[1],Z=8191&W,H=W>>>13,K=0|a[2],G=8191&K,V=K>>>13,$=0|a[3],Y=8191&$,J=$>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(i=Math.imul(l,z))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,z)|0))<<13)|0;h=((o=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var vt=(h+(i=i+Math.imul(l,Z)|0)|0)+((8191&(n=(n=n+Math.imul(l,H)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,z),n=(n=Math.imul(v,F))+Math.imul(b,z)|0,o=Math.imul(b,F),i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,H)|0;var bt=(h+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,G)|0))<<13)|0;h=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,z),n=(n=Math.imul(w,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,V)|0;var yt=(h+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;h=((o=o+Math.imul(c,J)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(S,z),n=(n=Math.imul(S,F))+Math.imul(k,z)|0,o=Math.imul(k,F),i=i+Math.imul(w,Z)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,H)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var wt=(h+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,z),n=(n=Math.imul(E,F))+Math.imul(R,z)|0,o=Math.imul(R,F),i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(v,Y)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Mt=(h+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,z),n=(n=Math.imul(I,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(E,Z)|0,n=(n=n+Math.imul(E,H)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var _t=(h+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,z),n=(n=Math.imul(B,F))+Math.imul(T,z)|0,o=Math.imul(T,F),i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,H)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,J)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(h+(i=i+Math.imul(l,ut)|0)|0)+((8191&(n=(n=n+Math.imul(l,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(C,z)|0,o=Math.imul(C,F),i=i+Math.imul(B,Z)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(E,Y)|0,n=(n=n+Math.imul(E,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var kt=(h+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,z),n=(n=Math.imul(N,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(L,Z)|0,n=(n=n+Math.imul(L,H)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,V)|0,i=i+Math.imul(I,Y)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var At=(h+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(N,Z),n=(n=Math.imul(N,H))+Math.imul(U,Z)|0,o=Math.imul(U,H),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,V)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,V)|0,i=i+Math.imul(B,Y)|0,n=(n=n+Math.imul(B,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,i=i+Math.imul(v,lt)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var Et=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,V))+Math.imul(U,G)|0,o=Math.imul(U,V),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,J)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ht)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ct)|0;var Rt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(N,Y),n=(n=Math.imul(N,J))+Math.imul(U,Y)|0,o=Math.imul(U,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(E,ut)|0,n=(n=n+Math.imul(E,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,ct)|0;var xt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(N,Q),n=(n=Math.imul(N,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,it)|0,i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,i=i+Math.imul(E,lt)|0,n=(n=n+Math.imul(E,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var It=(h+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((o=o+Math.imul(k,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(N,rt),n=(n=Math.imul(N,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(L,ot)|0,n=(n=n+Math.imul(L,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var Ot=(h+(i=i+Math.imul(E,pt)|0)|0)+((8191&(n=(n=n+Math.imul(E,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(N,ot),n=(n=Math.imul(N,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ct)|0;var jt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(N,ut),n=(n=Math.imul(N,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ct)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(N,lt),n=(n=Math.imul(N,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Tt=(h+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var Pt=(h+(i=Math.imul(N,pt))|0)+((8191&(n=(n=Math.imul(N,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=bt,u[3]=yt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=St,u[8]=kt,u[9]=At,u[10]=Et,u[11]=Rt,u[12]=xt,u[13]=It,u[14]=Ot,u[15]=jt,u[16]=Bt,u[17]=Tt,u[18]=Pt,0!==h&&(u[19]=h,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,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 e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==f||h>=n);h--){var l=0|this.words[h];this.words[h]=f<<26-o|l>>>o,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},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){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(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 e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,u=i.length-n.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{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,e);var n,s,a},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 e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(u)):(r.isub(e),a.isub(n),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).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 e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},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){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}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 e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},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 S(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(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 i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(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 b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){S.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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(y,b),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var l=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}u=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(14)(t))},function(t,e,r){(function(t,i){var n; +/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */(function(){var o="Expected a function",s="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],u="[object Arguments]",h="[object Array]",f="[object Boolean]",l="[object Date]",c="[object Error]",d="[object Function]",p="[object GeneratorFunction]",m="[object Map]",g="[object Number]",v="[object Object]",b="[object RegExp]",y="[object Set]",w="[object String]",M="[object Symbol]",_="[object WeakMap]",S="[object ArrayBuffer]",k="[object DataView]",A="[object Float32Array]",E="[object Float64Array]",R="[object Int8Array]",x="[object Int16Array]",I="[object Int32Array]",O="[object Uint8Array]",j="[object Uint16Array]",B="[object Uint32Array]",T=/\b__p \+= '';/g,P=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,C=/&(?:amp|lt|gt|quot|#39);/g,D=/[&<>"']/g,N=RegExp(C.source),U=RegExp(D.source),q=/<%-([\s\S]+?)%>/g,z=/<%([\s\S]+?)%>/g,F=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,H=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,G=RegExp(K.source),V=/^\s+/,$=/\s/,Y=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,J=/\{\n\/\* \[wrapped with (.+)\] \*/,X=/,? & /,Q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,tt=/[()=,{}\[\]\/\s]/,et=/\\(\\)?/g,rt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,it=/\w*$/,nt=/^[-+]0x[0-9a-f]+$/i,ot=/^0b[01]+$/i,st=/^\[object .+?Constructor\]$/,at=/^0o[0-7]+$/i,ut=/^(?:0|[1-9]\d*)$/,ht=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ft=/($^)/,lt=/['\n\r\u2028\u2029\\]/g,ct="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",dt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",pt="[\\ud800-\\udfff]",mt="["+dt+"]",gt="["+ct+"]",vt="\\d+",bt="[\\u2700-\\u27bf]",yt="[a-z\\xdf-\\xf6\\xf8-\\xff]",wt="[^\\ud800-\\udfff"+dt+vt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",Mt="\\ud83c[\\udffb-\\udfff]",_t="[^\\ud800-\\udfff]",St="(?:\\ud83c[\\udde6-\\uddff]){2}",kt="[\\ud800-\\udbff][\\udc00-\\udfff]",At="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Et="(?:"+yt+"|"+wt+")",Rt="(?:"+At+"|"+wt+")",xt="(?:"+gt+"|"+Mt+")"+"?",It="[\\ufe0e\\ufe0f]?"+xt+("(?:\\u200d(?:"+[_t,St,kt].join("|")+")[\\ufe0e\\ufe0f]?"+xt+")*"),Ot="(?:"+[bt,St,kt].join("|")+")"+It,jt="(?:"+[_t+gt+"?",gt,St,kt,pt].join("|")+")",Bt=RegExp("['’]","g"),Tt=RegExp(gt,"g"),Pt=RegExp(Mt+"(?="+Mt+")|"+jt+It,"g"),Lt=RegExp([At+"?"+yt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[mt,At,"$"].join("|")+")",Rt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[mt,At+Et,"$"].join("|")+")",At+"?"+Et+"+(?:['’](?:d|ll|m|re|s|t|ve))?",At+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",vt,Ot].join("|"),"g"),Ct=RegExp("[\\u200d\\ud800-\\udfff"+ct+"\\ufe0e\\ufe0f]"),Dt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ut=-1,qt={};qt[A]=qt[E]=qt[R]=qt[x]=qt[I]=qt[O]=qt["[object Uint8ClampedArray]"]=qt[j]=qt[B]=!0,qt[u]=qt[h]=qt[S]=qt[f]=qt[k]=qt[l]=qt[c]=qt[d]=qt[m]=qt[g]=qt[v]=qt[b]=qt[y]=qt[w]=qt[_]=!1;var zt={};zt[u]=zt[h]=zt[S]=zt[k]=zt[f]=zt[l]=zt[A]=zt[E]=zt[R]=zt[x]=zt[I]=zt[m]=zt[g]=zt[v]=zt[b]=zt[y]=zt[w]=zt[M]=zt[O]=zt["[object Uint8ClampedArray]"]=zt[j]=zt[B]=!0,zt[c]=zt[d]=zt[_]=!1;var Ft={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Wt=parseFloat,Zt=parseInt,Ht="object"==typeof t&&t&&t.Object===Object&&t,Kt="object"==typeof self&&self&&self.Object===Object&&self,Gt=Ht||Kt||Function("return this")(),Vt=e&&!e.nodeType&&e,$t=Vt&&"object"==typeof i&&i&&!i.nodeType&&i,Yt=$t&&$t.exports===Vt,Jt=Yt&&Ht.process,Xt=function(){try{var t=$t&&$t.require&&$t.require("util").types;return t||Jt&&Jt.binding&&Jt.binding("util")}catch(t){}}(),Qt=Xt&&Xt.isArrayBuffer,te=Xt&&Xt.isDate,ee=Xt&&Xt.isMap,re=Xt&&Xt.isRegExp,ie=Xt&&Xt.isSet,ne=Xt&&Xt.isTypedArray;function oe(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function se(t,e,r,i){for(var n=-1,o=null==t?0:t.length;++n-1}function ce(t,e,r){for(var i=-1,n=null==t?0:t.length;++i-1;);return r}function Le(t,e){for(var r=t.length;r--&&Me(e,t[r],0)>-1;);return r}function Ce(t,e){for(var r=t.length,i=0;r--;)t[r]===e&&++i;return i}var De=Ee({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Ne=Ee({"&":"&","<":"<",">":">",'"':""","'":"'"});function Ue(t){return"\\"+Ft[t]}function qe(t){return Ct.test(t)}function ze(t){var e=-1,r=Array(t.size);return t.forEach((function(t,i){r[++e]=[i,t]})),r}function Fe(t,e){return function(r){return t(e(r))}}function We(t,e){for(var r=-1,i=t.length,n=0,o=[];++r",""":'"',"'":"'"});var Ye=function t(e){var r,i=(e=null==e?Gt:Ye.defaults(Gt.Object(),e,Ye.pick(Gt,Nt))).Array,n=e.Date,$=e.Error,ct=e.Function,dt=e.Math,pt=e.Object,mt=e.RegExp,gt=e.String,vt=e.TypeError,bt=i.prototype,yt=ct.prototype,wt=pt.prototype,Mt=e["__core-js_shared__"],_t=yt.toString,St=wt.hasOwnProperty,kt=0,At=(r=/[^.]+$/.exec(Mt&&Mt.keys&&Mt.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",Et=wt.toString,Rt=_t.call(pt),xt=Gt._,It=mt("^"+_t.call(St).replace(K,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ot=Yt?e.Buffer:void 0,jt=e.Symbol,Pt=e.Uint8Array,Ct=Ot?Ot.allocUnsafe:void 0,Ft=Fe(pt.getPrototypeOf,pt),Ht=pt.create,Kt=wt.propertyIsEnumerable,Vt=bt.splice,$t=jt?jt.isConcatSpreadable:void 0,Jt=jt?jt.iterator:void 0,Xt=jt?jt.toStringTag:void 0,be=function(){try{var t=to(pt,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ee=e.clearTimeout!==Gt.clearTimeout&&e.clearTimeout,Je=n&&n.now!==Gt.Date.now&&n.now,Xe=e.setTimeout!==Gt.setTimeout&&e.setTimeout,Qe=dt.ceil,tr=dt.floor,er=pt.getOwnPropertySymbols,rr=Ot?Ot.isBuffer:void 0,ir=e.isFinite,nr=bt.join,or=Fe(pt.keys,pt),sr=dt.max,ar=dt.min,ur=n.now,hr=e.parseInt,fr=dt.random,lr=bt.reverse,cr=to(e,"DataView"),dr=to(e,"Map"),pr=to(e,"Promise"),mr=to(e,"Set"),gr=to(e,"WeakMap"),vr=to(pt,"create"),br=gr&&new gr,yr={},wr=xo(cr),Mr=xo(dr),_r=xo(pr),Sr=xo(mr),kr=xo(gr),Ar=jt?jt.prototype:void 0,Er=Ar?Ar.valueOf:void 0,Rr=Ar?Ar.toString:void 0;function xr(t){if(Hs(t)&&!Ps(t)&&!(t instanceof Br)){if(t instanceof jr)return t;if(St.call(t,"__wrapped__"))return Io(t)}return new jr(t)}var Ir=function(){function t(){}return function(e){if(!Zs(e))return{};if(Ht)return Ht(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Or(){}function jr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function Br(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Tr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function Yr(t,e,r,i,n,o){var s,a=1&e,h=2&e,c=4&e;if(r&&(s=n?r(t,i,n,o):r(t)),void 0!==s)return s;if(!Zs(t))return t;var _=Ps(t);if(_){if(s=function(t){var e=t.length,r=new t.constructor(e);e&&"string"==typeof t[0]&&St.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!a)return bn(t,s)}else{var T=io(t),P=T==d||T==p;if(Ns(t))return cn(t,a);if(T==v||T==u||P&&!n){if(s=h||P?{}:oo(t),!a)return h?function(t,e){return yn(t,ro(t),e)}(t,function(t,e){return t&&yn(e,_a(e),t)}(s,t)):function(t,e){return yn(t,eo(t),e)}(t,Kr(s,t))}else{if(!zt[T])return n?t:{};s=function(t,e,r){var i=t.constructor;switch(e){case S:return dn(t);case f:case l:return new i(+t);case k:return function(t,e){var r=e?dn(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case A:case E:case R:case x:case I:case O:case"[object Uint8ClampedArray]":case j:case B:return pn(t,r);case m:return new i;case g:case w:return new i(t);case b:return function(t){var e=new t.constructor(t.source,it.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return new i;case M:return n=t,Er?pt(Er.call(n)):{}}var n}(t,T,a)}}o||(o=new Dr);var L=o.get(t);if(L)return L;o.set(t,s),Ys(t)?t.forEach((function(i){s.add(Yr(i,e,r,i,t,o))})):Ks(t)&&t.forEach((function(i,n){s.set(n,Yr(i,e,r,n,t,o))}));var C=_?void 0:(c?h?Gn:Kn:h?_a:Ma)(t);return ae(C||t,(function(i,n){C&&(i=t[n=i]),Wr(s,n,Yr(i,e,r,n,t,o))})),s}function Jr(t,e,r){var i=r.length;if(null==t)return!i;for(t=pt(t);i--;){var n=r[i],o=e[n],s=t[n];if(void 0===s&&!(n in t)||!o(s))return!1}return!0}function Xr(t,e,r){if("function"!=typeof t)throw new vt(o);return Mo((function(){t.apply(void 0,r)}),e)}function Qr(t,e,r,i){var n=-1,o=le,s=!0,a=t.length,u=[],h=e.length;if(!a)return u;r&&(e=de(e,je(r))),i?(o=ce,s=!1):e.length>=200&&(o=Te,s=!1,e=new Cr(e));t:for(;++n-1},Pr.prototype.set=function(t,e){var r=this.__data__,i=Zr(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this},Lr.prototype.clear=function(){this.size=0,this.__data__={hash:new Tr,map:new(dr||Pr),string:new Tr}},Lr.prototype.delete=function(t){var e=Xn(this,t).delete(t);return this.size-=e?1:0,e},Lr.prototype.get=function(t){return Xn(this,t).get(t)},Lr.prototype.has=function(t){return Xn(this,t).has(t)},Lr.prototype.set=function(t,e){var r=Xn(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this},Cr.prototype.add=Cr.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Cr.prototype.has=function(t){return this.__data__.has(t)},Dr.prototype.clear=function(){this.__data__=new Pr,this.size=0},Dr.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Dr.prototype.get=function(t){return this.__data__.get(t)},Dr.prototype.has=function(t){return this.__data__.has(t)},Dr.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Pr){var i=r.__data__;if(!dr||i.length<199)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new Lr(i)}return r.set(t,e),this.size=r.size,this};var ti=_n(ui),ei=_n(hi,!0);function ri(t,e){var r=!0;return ti(t,(function(t,i,n){return r=!!e(t,i,n)})),r}function ii(t,e,r){for(var i=-1,n=t.length;++i0&&r(a)?e>1?oi(a,e-1,r,i,n):pe(n,a):i||(n[n.length]=a)}return n}var si=Sn(),ai=Sn(!0);function ui(t,e){return t&&si(t,e,Ma)}function hi(t,e){return t&&ai(t,e,Ma)}function fi(t,e){return fe(e,(function(e){return zs(t[e])}))}function li(t,e){for(var r=0,i=(e=un(e,t)).length;null!=t&&re}function mi(t,e){return null!=t&&St.call(t,e)}function gi(t,e){return null!=t&&e in pt(t)}function vi(t,e,r){for(var n=r?ce:le,o=t[0].length,s=t.length,a=s,u=i(s),h=1/0,f=[];a--;){var l=t[a];a&&e&&(l=de(l,je(e))),h=ar(l.length,h),u[a]=!r&&(e||o>=120&&l.length>=120)?new Cr(a&&l):void 0}l=t[0];var c=-1,d=u[0];t:for(;++c=a)return u;var h=r[i];return u*("desc"==h?-1:1)}}return t.index-e.index}(t,e,r)}))}function Ti(t,e,r){for(var i=-1,n=e.length,o={};++i-1;)a!==t&&Vt.call(a,u,1),Vt.call(t,u,1);return t}function Li(t,e){for(var r=t?e.length:0,i=r-1;r--;){var n=e[r];if(r==i||n!==o){var o=n;ao(n)?Vt.call(t,n,1):Qi(t,n)}}return t}function Ci(t,e){return t+tr(fr()*(e-t+1))}function Di(t,e){var r="";if(!t||e<1||e>9007199254740991)return r;do{e%2&&(r+=t),(e=tr(e/2))&&(t+=t)}while(e);return r}function Ni(t,e){return _o(go(t,e,Ga),t+"")}function Ui(t){return Ur(Oa(t))}function qi(t,e){var r=Oa(t);return Ao(r,$r(e,0,r.length))}function zi(t,e,r,i){if(!Zs(t))return t;for(var n=-1,o=(e=un(e,t)).length,s=o-1,a=t;null!=a&&++no?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var s=i(o);++n>>1,s=t[o];null!==s&&!Xs(s)&&(r?s<=e:s=200){var h=e?null:Nn(t);if(h)return Ze(h);s=!1,n=Te,u=new Cr}else u=e?[]:a;t:for(;++i=i?t:Hi(t,e,r)}var ln=Ee||function(t){return Gt.clearTimeout(t)};function cn(t,e){if(e)return t.slice();var r=t.length,i=Ct?Ct(r):new t.constructor(r);return t.copy(i),i}function dn(t){var e=new t.constructor(t.byteLength);return new Pt(e).set(new Pt(t)),e}function pn(t,e){var r=e?dn(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function mn(t,e){if(t!==e){var r=void 0!==t,i=null===t,n=t==t,o=Xs(t),s=void 0!==e,a=null===e,u=e==e,h=Xs(e);if(!a&&!h&&!o&&t>e||o&&s&&u&&!a&&!h||i&&s&&u||!r&&u||!n)return 1;if(!i&&!o&&!h&&t1?r[n-1]:void 0,s=n>2?r[2]:void 0;for(o=t.length>3&&"function"==typeof o?(n--,o):void 0,s&&uo(r[0],r[1],s)&&(o=n<3?void 0:o,n=1),e=pt(e);++i-1?n[o?e[s]:s]:void 0}}function xn(t){return Hn((function(e){var r=e.length,i=r,n=jr.prototype.thru;for(t&&e.reverse();i--;){var s=e[i];if("function"!=typeof s)throw new vt(o);if(n&&!a&&"wrapper"==$n(s))var a=new jr([],!0)}for(i=a?i:r;++i1&&y.reverse(),l&&ha))return!1;var h=o.get(t),f=o.get(e);if(h&&f)return h==e&&f==t;var l=-1,c=!0,d=2&r?new Cr:void 0;for(o.set(t,e),o.set(e,t);++l-1&&t%1==0&&t1?"& ":"")+e[i],e=e.join(r>2?", ":" "),t.replace(Y,"{\n/* [wrapped with "+e+"] */\n")}(i,function(t,e){return ae(a,(function(r){var i="_."+r[0];e&r[1]&&!le(t,i)&&t.push(i)})),t.sort()}(function(t){var e=t.match(J);return e?e[1].split(X):[]}(i),r)))}function ko(t){var e=0,r=0;return function(){var i=ur(),n=16-(i-r);if(r=i,n>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Ao(t,e){var r=-1,i=t.length,n=i-1;for(e=void 0===e?i:e;++r1?t[e-1]:void 0;return r="function"==typeof r?(t.pop(),r):void 0,$o(t,r)}));function rs(t){var e=xr(t);return e.__chain__=!0,e}function is(t,e){return e(t)}var ns=Hn((function(t){var e=t.length,r=e?t[0]:0,i=this.__wrapped__,n=function(e){return Vr(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Br&&ao(r)?((i=i.slice(r,+r+(e?1:0))).__actions__.push({func:is,args:[n],thisArg:void 0}),new jr(i,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(n)}));var os=wn((function(t,e,r){St.call(t,r)?++t[r]:Gr(t,r,1)}));var ss=Rn(To),as=Rn(Po);function us(t,e){return(Ps(t)?ae:ti)(t,Jn(e,3))}function hs(t,e){return(Ps(t)?ue:ei)(t,Jn(e,3))}var fs=wn((function(t,e,r){St.call(t,r)?t[r].push(e):Gr(t,r,[e])}));var ls=Ni((function(t,e,r){var n=-1,o="function"==typeof e,s=Cs(t)?i(t.length):[];return ti(t,(function(t){s[++n]=o?oe(e,t,r):bi(t,e,r)})),s})),cs=wn((function(t,e,r){Gr(t,r,e)}));function ds(t,e){return(Ps(t)?de:Ri)(t,Jn(e,3))}var ps=wn((function(t,e,r){t[r?0:1].push(e)}),(function(){return[[],[]]}));var ms=Ni((function(t,e){if(null==t)return[];var r=e.length;return r>1&&uo(t,e[0],e[1])?e=[]:r>2&&uo(e[0],e[1],e[2])&&(e=[e[0]]),Bi(t,oi(e,1),[])})),gs=Je||function(){return Gt.Date.now()};function vs(t,e,r){return e=r?void 0:e,qn(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function bs(t,e){var r;if("function"!=typeof e)throw new vt(o);return t=na(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=void 0),r}}var ys=Ni((function(t,e,r){var i=1;if(r.length){var n=We(r,Yn(ys));i|=32}return qn(t,i,e,r,n)})),ws=Ni((function(t,e,r){var i=3;if(r.length){var n=We(r,Yn(ws));i|=32}return qn(e,i,t,r,n)}));function Ms(t,e,r){var i,n,s,a,u,h,f=0,l=!1,c=!1,d=!0;if("function"!=typeof t)throw new vt(o);function p(e){var r=i,o=n;return i=n=void 0,f=e,a=t.apply(o,r)}function m(t){return f=t,u=Mo(v,e),l?p(t):a}function g(t){var r=t-h;return void 0===h||r>=e||r<0||c&&t-f>=s}function v(){var t=gs();if(g(t))return b(t);u=Mo(v,function(t){var r=e-(t-h);return c?ar(r,s-(t-f)):r}(t))}function b(t){return u=void 0,d&&i?p(t):(i=n=void 0,a)}function y(){var t=gs(),r=g(t);if(i=arguments,n=this,h=t,r){if(void 0===u)return m(h);if(c)return ln(u),u=Mo(v,e),p(h)}return void 0===u&&(u=Mo(v,e)),a}return e=sa(e)||0,Zs(r)&&(l=!!r.leading,s=(c="maxWait"in r)?sr(sa(r.maxWait)||0,e):s,d="trailing"in r?!!r.trailing:d),y.cancel=function(){void 0!==u&&ln(u),f=0,i=h=n=u=void 0},y.flush=function(){return void 0===u?a:b(gs())},y}var _s=Ni((function(t,e){return Xr(t,1,e)})),Ss=Ni((function(t,e,r){return Xr(t,sa(e)||0,r)}));function ks(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new vt(o);var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=t.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(ks.Cache||Lr),r}function As(t){if("function"!=typeof t)throw new vt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ks.Cache=Lr;var Es=hn((function(t,e){var r=(e=1==e.length&&Ps(e[0])?de(e[0],je(Jn())):de(oi(e,1),je(Jn()))).length;return Ni((function(i){for(var n=-1,o=ar(i.length,r);++n=e})),Ts=yi(function(){return arguments}())?yi:function(t){return Hs(t)&&St.call(t,"callee")&&!Kt.call(t,"callee")},Ps=i.isArray,Ls=Qt?je(Qt):function(t){return Hs(t)&&di(t)==S};function Cs(t){return null!=t&&Ws(t.length)&&!zs(t)}function Ds(t){return Hs(t)&&Cs(t)}var Ns=rr||su,Us=te?je(te):function(t){return Hs(t)&&di(t)==l};function qs(t){if(!Hs(t))return!1;var e=di(t);return e==c||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Vs(t)}function zs(t){if(!Zs(t))return!1;var e=di(t);return e==d||e==p||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Fs(t){return"number"==typeof t&&t==na(t)}function Ws(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Zs(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Hs(t){return null!=t&&"object"==typeof t}var Ks=ee?je(ee):function(t){return Hs(t)&&io(t)==m};function Gs(t){return"number"==typeof t||Hs(t)&&di(t)==g}function Vs(t){if(!Hs(t)||di(t)!=v)return!1;var e=Ft(t);if(null===e)return!0;var r=St.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&_t.call(r)==Rt}var $s=re?je(re):function(t){return Hs(t)&&di(t)==b};var Ys=ie?je(ie):function(t){return Hs(t)&&io(t)==y};function Js(t){return"string"==typeof t||!Ps(t)&&Hs(t)&&di(t)==w}function Xs(t){return"symbol"==typeof t||Hs(t)&&di(t)==M}var Qs=ne?je(ne):function(t){return Hs(t)&&Ws(t.length)&&!!qt[di(t)]};var ta=Ln(Ei),ea=Ln((function(t,e){return t<=e}));function ra(t){if(!t)return[];if(Cs(t))return Js(t)?Ge(t):bn(t);if(Jt&&t[Jt])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[Jt]());var e=io(t);return(e==m?ze:e==y?Ze:Oa)(t)}function ia(t){return t?(t=sa(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function na(t){var e=ia(t),r=e%1;return e==e?r?e-r:e:0}function oa(t){return t?$r(na(t),0,4294967295):0}function sa(t){if("number"==typeof t)return t;if(Xs(t))return NaN;if(Zs(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Zs(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Oe(t);var r=ot.test(t);return r||at.test(t)?Zt(t.slice(2),r?2:8):nt.test(t)?NaN:+t}function aa(t){return yn(t,_a(t))}function ua(t){return null==t?"":Ji(t)}var ha=Mn((function(t,e){if(co(e)||Cs(e))yn(e,Ma(e),t);else for(var r in e)St.call(e,r)&&Wr(t,r,e[r])})),fa=Mn((function(t,e){yn(e,_a(e),t)})),la=Mn((function(t,e,r,i){yn(e,_a(e),t,i)})),ca=Mn((function(t,e,r,i){yn(e,Ma(e),t,i)})),da=Hn(Vr);var pa=Ni((function(t,e){t=pt(t);var r=-1,i=e.length,n=i>2?e[2]:void 0;for(n&&uo(e[0],e[1],n)&&(i=1);++r1),e})),yn(t,Gn(t),r),i&&(r=Yr(r,7,Wn));for(var n=e.length;n--;)Qi(r,e[n]);return r}));var Ea=Hn((function(t,e){return null==t?{}:function(t,e){return Ti(t,e,(function(e,r){return va(t,r)}))}(t,e)}));function Ra(t,e){if(null==t)return{};var r=de(Gn(t),(function(t){return[t]}));return e=Jn(e),Ti(t,r,(function(t,r){return e(t,r[0])}))}var xa=Un(Ma),Ia=Un(_a);function Oa(t){return null==t?[]:Be(t,Ma(t))}var ja=An((function(t,e,r){return e=e.toLowerCase(),t+(r?Ba(e):e)}));function Ba(t){return qa(ua(t).toLowerCase())}function Ta(t){return(t=ua(t))&&t.replace(ht,De).replace(Tt,"")}var Pa=An((function(t,e,r){return t+(r?"-":"")+e.toLowerCase()})),La=An((function(t,e,r){return t+(r?" ":"")+e.toLowerCase()})),Ca=kn("toLowerCase");var Da=An((function(t,e,r){return t+(r?"_":"")+e.toLowerCase()}));var Na=An((function(t,e,r){return t+(r?" ":"")+qa(e)}));var Ua=An((function(t,e,r){return t+(r?" ":"")+e.toUpperCase()})),qa=kn("toUpperCase");function za(t,e,r){return t=ua(t),void 0===(e=r?void 0:e)?function(t){return Dt.test(t)}(t)?function(t){return t.match(Lt)||[]}(t):function(t){return t.match(Q)||[]}(t):t.match(e)||[]}var Fa=Ni((function(t,e){try{return oe(t,void 0,e)}catch(t){return qs(t)?t:new $(t)}})),Wa=Hn((function(t,e){return ae(e,(function(e){e=Ro(e),Gr(t,e,ys(t[e],t))})),t}));function Za(t){return function(){return t}}var Ha=xn(),Ka=xn(!0);function Ga(t){return t}function Va(t){return Si("function"==typeof t?t:Yr(t,1))}var $a=Ni((function(t,e){return function(r){return bi(r,t,e)}})),Ya=Ni((function(t,e){return function(r){return bi(t,r,e)}}));function Ja(t,e,r){var i=Ma(e),n=fi(e,i);null!=r||Zs(e)&&(n.length||!i.length)||(r=e,e=t,t=this,n=fi(e,Ma(e)));var o=!(Zs(r)&&"chain"in r&&!r.chain),s=zs(t);return ae(n,(function(r){var i=e[r];t[r]=i,s&&(t.prototype[r]=function(){var e=this.__chain__;if(o||e){var r=t(this.__wrapped__),n=r.__actions__=bn(this.__actions__);return n.push({func:i,args:arguments,thisArg:t}),r.__chain__=e,r}return i.apply(t,pe([this.value()],arguments))})})),t}function Xa(){}var Qa=Bn(de),tu=Bn(he),eu=Bn(ve);function ru(t){return ho(t)?Ae(Ro(t)):function(t){return function(e){return li(e,t)}}(t)}var iu=Pn(),nu=Pn(!0);function ou(){return[]}function su(){return!1}var au=jn((function(t,e){return t+e}),0),uu=Dn("ceil"),hu=jn((function(t,e){return t/e}),1),fu=Dn("floor");var lu,cu=jn((function(t,e){return t*e}),1),du=Dn("round"),pu=jn((function(t,e){return t-e}),0);return xr.after=function(t,e){if("function"!=typeof e)throw new vt(o);return t=na(t),function(){if(--t<1)return e.apply(this,arguments)}},xr.ary=vs,xr.assign=ha,xr.assignIn=fa,xr.assignInWith=la,xr.assignWith=ca,xr.at=da,xr.before=bs,xr.bind=ys,xr.bindAll=Wa,xr.bindKey=ws,xr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ps(t)?t:[t]},xr.chain=rs,xr.chunk=function(t,e,r){e=(r?uo(t,e,r):void 0===e)?1:sr(na(e),0);var n=null==t?0:t.length;if(!n||e<1)return[];for(var o=0,s=0,a=i(Qe(n/e));on?0:n+r),(i=void 0===i||i>n?n:na(i))<0&&(i+=n),i=r>i?0:oa(i);r>>0)?(t=ua(t))&&("string"==typeof e||null!=e&&!$s(e))&&!(e=Ji(e))&&qe(t)?fn(Ge(t),0,r):t.split(e,r):[]},xr.spread=function(t,e){if("function"!=typeof t)throw new vt(o);return e=null==e?0:sr(na(e),0),Ni((function(r){var i=r[e],n=fn(r,0,e);return i&&pe(n,i),oe(t,this,n)}))},xr.tail=function(t){var e=null==t?0:t.length;return e?Hi(t,1,e):[]},xr.take=function(t,e,r){return t&&t.length?Hi(t,0,(e=r||void 0===e?1:na(e))<0?0:e):[]},xr.takeRight=function(t,e,r){var i=null==t?0:t.length;return i?Hi(t,(e=i-(e=r||void 0===e?1:na(e)))<0?0:e,i):[]},xr.takeRightWhile=function(t,e){return t&&t.length?en(t,Jn(e,3),!1,!0):[]},xr.takeWhile=function(t,e){return t&&t.length?en(t,Jn(e,3)):[]},xr.tap=function(t,e){return e(t),t},xr.throttle=function(t,e,r){var i=!0,n=!0;if("function"!=typeof t)throw new vt(o);return Zs(r)&&(i="leading"in r?!!r.leading:i,n="trailing"in r?!!r.trailing:n),Ms(t,e,{leading:i,maxWait:e,trailing:n})},xr.thru=is,xr.toArray=ra,xr.toPairs=xa,xr.toPairsIn=Ia,xr.toPath=function(t){return Ps(t)?de(t,Ro):Xs(t)?[t]:bn(Eo(ua(t)))},xr.toPlainObject=aa,xr.transform=function(t,e,r){var i=Ps(t),n=i||Ns(t)||Qs(t);if(e=Jn(e,4),null==r){var o=t&&t.constructor;r=n?i?new o:[]:Zs(t)&&zs(o)?Ir(Ft(t)):{}}return(n?ae:ui)(t,(function(t,i,n){return e(r,t,i,n)})),r},xr.unary=function(t){return vs(t,1)},xr.union=Ho,xr.unionBy=Ko,xr.unionWith=Go,xr.uniq=function(t){return t&&t.length?Xi(t):[]},xr.uniqBy=function(t,e){return t&&t.length?Xi(t,Jn(e,2)):[]},xr.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Xi(t,void 0,e):[]},xr.unset=function(t,e){return null==t||Qi(t,e)},xr.unzip=Vo,xr.unzipWith=$o,xr.update=function(t,e,r){return null==t?t:tn(t,e,an(r))},xr.updateWith=function(t,e,r,i){return i="function"==typeof i?i:void 0,null==t?t:tn(t,e,an(r),i)},xr.values=Oa,xr.valuesIn=function(t){return null==t?[]:Be(t,_a(t))},xr.without=Yo,xr.words=za,xr.wrap=function(t,e){return Rs(an(e),t)},xr.xor=Jo,xr.xorBy=Xo,xr.xorWith=Qo,xr.zip=ts,xr.zipObject=function(t,e){return on(t||[],e||[],Wr)},xr.zipObjectDeep=function(t,e){return on(t||[],e||[],zi)},xr.zipWith=es,xr.entries=xa,xr.entriesIn=Ia,xr.extend=fa,xr.extendWith=la,Ja(xr,xr),xr.add=au,xr.attempt=Fa,xr.camelCase=ja,xr.capitalize=Ba,xr.ceil=uu,xr.clamp=function(t,e,r){return void 0===r&&(r=e,e=void 0),void 0!==r&&(r=(r=sa(r))==r?r:0),void 0!==e&&(e=(e=sa(e))==e?e:0),$r(sa(t),e,r)},xr.clone=function(t){return Yr(t,4)},xr.cloneDeep=function(t){return Yr(t,5)},xr.cloneDeepWith=function(t,e){return Yr(t,5,e="function"==typeof e?e:void 0)},xr.cloneWith=function(t,e){return Yr(t,4,e="function"==typeof e?e:void 0)},xr.conformsTo=function(t,e){return null==e||Jr(t,e,Ma(e))},xr.deburr=Ta,xr.defaultTo=function(t,e){return null==t||t!=t?e:t},xr.divide=hu,xr.endsWith=function(t,e,r){t=ua(t),e=Ji(e);var i=t.length,n=r=void 0===r?i:$r(na(r),0,i);return(r-=e.length)>=0&&t.slice(r,n)==e},xr.eq=Os,xr.escape=function(t){return(t=ua(t))&&U.test(t)?t.replace(D,Ne):t},xr.escapeRegExp=function(t){return(t=ua(t))&&G.test(t)?t.replace(K,"\\$&"):t},xr.every=function(t,e,r){var i=Ps(t)?he:ri;return r&&uo(t,e,r)&&(e=void 0),i(t,Jn(e,3))},xr.find=ss,xr.findIndex=To,xr.findKey=function(t,e){return ye(t,Jn(e,3),ui)},xr.findLast=as,xr.findLastIndex=Po,xr.findLastKey=function(t,e){return ye(t,Jn(e,3),hi)},xr.floor=fu,xr.forEach=us,xr.forEachRight=hs,xr.forIn=function(t,e){return null==t?t:si(t,Jn(e,3),_a)},xr.forInRight=function(t,e){return null==t?t:ai(t,Jn(e,3),_a)},xr.forOwn=function(t,e){return t&&ui(t,Jn(e,3))},xr.forOwnRight=function(t,e){return t&&hi(t,Jn(e,3))},xr.get=ga,xr.gt=js,xr.gte=Bs,xr.has=function(t,e){return null!=t&&no(t,e,mi)},xr.hasIn=va,xr.head=Co,xr.identity=Ga,xr.includes=function(t,e,r,i){t=Cs(t)?t:Oa(t),r=r&&!i?na(r):0;var n=t.length;return r<0&&(r=sr(n+r,0)),Js(t)?r<=n&&t.indexOf(e,r)>-1:!!n&&Me(t,e,r)>-1},xr.indexOf=function(t,e,r){var i=null==t?0:t.length;if(!i)return-1;var n=null==r?0:na(r);return n<0&&(n=sr(i+n,0)),Me(t,e,n)},xr.inRange=function(t,e,r){return e=ia(e),void 0===r?(r=e,e=0):r=ia(r),function(t,e,r){return t>=ar(e,r)&&t=-9007199254740991&&t<=9007199254740991},xr.isSet=Ys,xr.isString=Js,xr.isSymbol=Xs,xr.isTypedArray=Qs,xr.isUndefined=function(t){return void 0===t},xr.isWeakMap=function(t){return Hs(t)&&io(t)==_},xr.isWeakSet=function(t){return Hs(t)&&"[object WeakSet]"==di(t)},xr.join=function(t,e){return null==t?"":nr.call(t,e)},xr.kebabCase=Pa,xr.last=qo,xr.lastIndexOf=function(t,e,r){var i=null==t?0:t.length;if(!i)return-1;var n=i;return void 0!==r&&(n=(n=na(r))<0?sr(i+n,0):ar(n,i-1)),e==e?function(t,e,r){for(var i=r+1;i--;)if(t[i]===e)return i;return i}(t,e,n):we(t,Se,n,!0)},xr.lowerCase=La,xr.lowerFirst=Ca,xr.lt=ta,xr.lte=ea,xr.max=function(t){return t&&t.length?ii(t,Ga,pi):void 0},xr.maxBy=function(t,e){return t&&t.length?ii(t,Jn(e,2),pi):void 0},xr.mean=function(t){return ke(t,Ga)},xr.meanBy=function(t,e){return ke(t,Jn(e,2))},xr.min=function(t){return t&&t.length?ii(t,Ga,Ei):void 0},xr.minBy=function(t,e){return t&&t.length?ii(t,Jn(e,2),Ei):void 0},xr.stubArray=ou,xr.stubFalse=su,xr.stubObject=function(){return{}},xr.stubString=function(){return""},xr.stubTrue=function(){return!0},xr.multiply=cu,xr.nth=function(t,e){return t&&t.length?ji(t,na(e)):void 0},xr.noConflict=function(){return Gt._===this&&(Gt._=xt),this},xr.noop=Xa,xr.now=gs,xr.pad=function(t,e,r){t=ua(t);var i=(e=na(e))?Ke(t):0;if(!e||i>=e)return t;var n=(e-i)/2;return Tn(tr(n),r)+t+Tn(Qe(n),r)},xr.padEnd=function(t,e,r){t=ua(t);var i=(e=na(e))?Ke(t):0;return e&&ie){var i=t;t=e,e=i}if(r||t%1||e%1){var n=fr();return ar(t+n*(e-t+Wt("1e-"+((n+"").length-1))),e)}return Ci(t,e)},xr.reduce=function(t,e,r){var i=Ps(t)?me:Re,n=arguments.length<3;return i(t,Jn(e,4),r,n,ti)},xr.reduceRight=function(t,e,r){var i=Ps(t)?ge:Re,n=arguments.length<3;return i(t,Jn(e,4),r,n,ei)},xr.repeat=function(t,e,r){return e=(r?uo(t,e,r):void 0===e)?1:na(e),Di(ua(t),e)},xr.replace=function(){var t=arguments,e=ua(t[0]);return t.length<3?e:e.replace(t[1],t[2])},xr.result=function(t,e,r){var i=-1,n=(e=un(e,t)).length;for(n||(n=1,t=void 0);++i9007199254740991)return[];var r=4294967295,i=ar(t,4294967295);t-=4294967295;for(var n=Ie(i,e=Jn(e));++r=o)return t;var a=r-Ke(i);if(a<1)return i;var u=s?fn(s,0,a).join(""):t.slice(0,a);if(void 0===n)return u+i;if(s&&(a+=u.length-a),$s(n)){if(t.slice(a).search(n)){var h,f=u;for(n.global||(n=mt(n.source,ua(it.exec(n))+"g")),n.lastIndex=0;h=n.exec(f);)var l=h.index;u=u.slice(0,void 0===l?a:l)}}else if(t.indexOf(Ji(n),a)!=a){var c=u.lastIndexOf(n);c>-1&&(u=u.slice(0,c))}return u+i},xr.unescape=function(t){return(t=ua(t))&&N.test(t)?t.replace(C,$e):t},xr.uniqueId=function(t){var e=++kt;return ua(t)+e},xr.upperCase=Ua,xr.upperFirst=qa,xr.each=us,xr.eachRight=hs,xr.first=Co,Ja(xr,(lu={},ui(xr,(function(t,e){St.call(xr.prototype,e)||(lu[e]=t)})),lu),{chain:!1}),xr.VERSION="4.17.21",ae(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){xr[t].placeholder=xr})),ae(["drop","take"],(function(t,e){Br.prototype[t]=function(r){r=void 0===r?1:sr(na(r),0);var i=this.__filtered__&&!e?new Br(this):this.clone();return i.__filtered__?i.__takeCount__=ar(r,i.__takeCount__):i.__views__.push({size:ar(r,4294967295),type:t+(i.__dir__<0?"Right":"")}),i},Br.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ae(["filter","map","takeWhile"],(function(t,e){var r=e+1,i=1==r||3==r;Br.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Jn(t,3),type:r}),e.__filtered__=e.__filtered__||i,e}})),ae(["head","last"],(function(t,e){var r="take"+(e?"Right":"");Br.prototype[t]=function(){return this[r](1).value()[0]}})),ae(["initial","tail"],(function(t,e){var r="drop"+(e?"":"Right");Br.prototype[t]=function(){return this.__filtered__?new Br(this):this[r](1)}})),Br.prototype.compact=function(){return this.filter(Ga)},Br.prototype.find=function(t){return this.filter(t).head()},Br.prototype.findLast=function(t){return this.reverse().find(t)},Br.prototype.invokeMap=Ni((function(t,e){return"function"==typeof t?new Br(this):this.map((function(r){return bi(r,t,e)}))})),Br.prototype.reject=function(t){return this.filter(As(Jn(t)))},Br.prototype.slice=function(t,e){t=na(t);var r=this;return r.__filtered__&&(t>0||e<0)?new Br(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),void 0!==e&&(r=(e=na(e))<0?r.dropRight(-e):r.take(e-t)),r)},Br.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Br.prototype.toArray=function(){return this.take(4294967295)},ui(Br.prototype,(function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),n=xr[i?"take"+("last"==e?"Right":""):e],o=i||/^find/.test(e);n&&(xr.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,a=e instanceof Br,u=s[0],h=a||Ps(e),f=function(t){var e=n.apply(xr,pe([t],s));return i&&l?e[0]:e};h&&r&&"function"==typeof u&&1!=u.length&&(a=h=!1);var l=this.__chain__,c=!!this.__actions__.length,d=o&&!l,p=a&&!c;if(!o&&h){e=p?e:new Br(this);var m=t.apply(e,s);return m.__actions__.push({func:is,args:[f],thisArg:void 0}),new jr(m,l)}return d&&p?t.apply(this,s):(m=this.thru(f),d?i?m.value()[0]:m.value():m)})})),ae(["pop","push","shift","sort","splice","unshift"],(function(t){var e=bt[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);xr.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var n=this.value();return e.apply(Ps(n)?n:[],t)}return this[r]((function(r){return e.apply(Ps(r)?r:[],t)}))}})),ui(Br.prototype,(function(t,e){var r=xr[e];if(r){var i=r.name+"";St.call(yr,i)||(yr[i]=[]),yr[i].push({name:e,func:r})}})),yr[In(void 0,2).name]=[{name:"wrapper",func:void 0}],Br.prototype.clone=function(){var t=new Br(this.__wrapped__);return t.__actions__=bn(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=bn(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=bn(this.__views__),t},Br.prototype.reverse=function(){if(this.__filtered__){var t=new Br(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Br.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=Ps(t),i=e<0,n=r?t.length:0,o=function(t,e,r){var i=-1,n=r.length;for(;++i=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},xr.prototype.plant=function(t){for(var e,r=this;r instanceof Or;){var i=Io(r);i.__index__=0,i.__values__=void 0,e?n.__wrapped__=i:e=i;var n=i;r=r.__wrapped__}return n.__wrapped__=t,e},xr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Br){var e=t;return this.__actions__.length&&(e=new Br(this)),(e=e.reverse()).__actions__.push({func:is,args:[Zo],thisArg:void 0}),new jr(e,this.__chain__)}return this.thru(Zo)},xr.prototype.toJSON=xr.prototype.valueOf=xr.prototype.value=function(){return rn(this.__wrapped__,this.__actions__)},xr.prototype.first=xr.prototype.head,Jt&&(xr.prototype[Jt]=function(){return this}),xr}();Gt._=Ye,void 0===(n=function(){return Ye}.call(e,r,e,i))||(i.exports=n)}).call(this)}).call(this,r(2),r(14)(t))},function(t,e,r){"use strict";var i=Array.prototype.slice,n=r(128),o=Object.keys,s=o?function(t){return o(t)}:r(269),a=Object.keys;s.shim=function(){Object.keys?function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2)||(Object.keys=function(t){return n(t)?a(i.call(t)):a(t)}):Object.keys=s;return Object.keys||s},t.exports=s},function(t,e,r){"use strict";var i=r(272);t.exports=Function.prototype.bind||i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Router=void 0;e.Router=class{constructor(){this.routingTree={},this.fallbacks={root:this.respondToRoot,404:this.notFound,500:this.serverError},this.corsOrigins=[]}addCORSOrigins(t){this.corsOrigins=[...this.corsOrigins,...t]}addFallback(t,e){this.fallbacks[t]=e}add(t,e,r){const i=t.toLowerCase();this.routingTree[i]||(this.routingTree[i]={}),this.routingTree[i][e]=r}async handle(t){const e=await this.processRequest(t);return this.injectCORSHeaders(t,e.headers),e}async processRequest(t){var e;const r=new URL(t.url);if("/"===r.pathname||""===r.pathname)return this.fallbacks.root(t);const i=t.method.toLowerCase(),n=r.pathname.split("/")[1],o=null===(e=this.routingTree[i])||void 0===e?void 0:e[n];if(o)try{return await o(t)}catch(e){return console.error(e),this.fallbacks[500](t)}return"options"===i?new Response(null,{}):this.fallbacks[404](t)}respondToRoot(){return new Response("Hi there!")}notFound(){return new Response(JSON.stringify({error:"not_found"}),{status:404})}serverError(){return new Response(JSON.stringify({error:"internal_server_error"}),{status:500})}injectCORSHeaders(t,e){if(e.set("access-control-allow-methods","*"),e.set("access-control-allow-headers","*"),0===this.corsOrigins.length)return void e.set("access-control-allow-origin","*");const r=t.headers.get("origin");if(!r)return;const i=new URL(r).hostname;this.corsOrigins.includes(i)&&e.set("access-control-allow-origin",i)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getQuery=e.userAgent=e.respond=void 0;e.respond=(t,e={})=>new Response(JSON.stringify(t),{...e,headers:{...e.headers||{},"content-type":"application/json"}}),e.userAgent="DiscordBot (https://github.com/roleypoly/roleypoly, git-main) (+https://roleypoly.com)";e.getQuery=t=>{const e={};for(let[r,i]of new URL(t.url).searchParams.entries())e[r]=i;return e}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.permissions=e.hasPermissionOrAdmin=e.hasPermission=e.evaluatePermission=void 0;e.evaluatePermission=(t,e)=>(t&e)===e;e.hasPermission=(t,r)=>{const i=t.reduce((t,e)=>t|BigInt(e.permissions),BigInt(0));return e.evaluatePermission(i,r)};e.hasPermissionOrAdmin=(t,r)=>e.hasPermission(t,r|e.permissions.ADMINISTRATOR),e.permissions={ADMINISTRATOR:BigInt(8),MANAGE_ROLES:BigInt(268435456)}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var i=r(153).Buffer,n=r(154).Transform;function o(t){n.call(this),this._block=i.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(0)(o,n),o.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(t){i=t}r(i)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!i.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");i.isBuffer(t)||(t=i.from(t,e));for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},function(t,e,r){"use strict";(function(e,i){var n;t.exports=A,A.ReadableState=k;r(16).EventEmitter;var o=function(t,e){return t.listeners(e).length},s=r(77),a=r(3).Buffer,u=e.Uint8Array||function(){};var h,f=r(155);h=f&&f.debuglog?f.debuglog("stream"):function(){};var l,c,d,p=r(156),m=r(78),g=r(79).getHighWaterMark,v=r(23).codes,b=v.ERR_INVALID_ARG_TYPE,y=v.ERR_STREAM_PUSH_AFTER_EOF,w=v.ERR_METHOD_NOT_IMPLEMENTED,M=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(0)(A,s);var _=m.errorOrDestroy,S=["error","close","destroy","pause","resume"];function k(t,e,i){n=n||r(24),t=t||{},"boolean"!=typeof i&&(i=e instanceof n),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=r(17).StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function A(t){if(n=n||r(24),!(this instanceof A))return new A(t);var e=this instanceof n;this._readableState=new k(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),s.call(this)}function E(t,e,r,i,n){h("readableAddChunk",e);var o,s=t._readableState;if(null===e)s.reading=!1,function(t,e){if(h("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?I(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,O(t)))}(t,s);else if(n||(o=function(t,e){var r;i=e,a.isBuffer(i)||i instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e));var i;return r}(s,e)),o)_(t,o);else if(s.objectMode||e&&e.length>0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)s.endEmitted?_(t,new M):R(t,s,e,!0);else if(s.ended)_(t,new y);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?R(t,s,e,!1):j(t,s)):R(t,s,e,!1)}else i||(s.reading=!1,j(t,s));return!s.ended&&(s.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;h("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(h("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(O,t))}function O(t){var e=t._readableState;h("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,C(t)}function j(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(B,t,e))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function P(t){h("readable nexttick read 0"),t.read(0)}function L(t,e){h("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(h("flow",e.flowing);e.flowing&&null!==t.read(););}function D(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function N(t){var e=t._readableState;h("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(U,e,t))}function U(t,e){if(h("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function q(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return h("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?N(this):I(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&N(this),null;var i,n=e.needReadable;return h("need readable",n),(0===e.length||e.length-t0?D(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&N(this)),null!==i&&this.emit("data",i),i},A.prototype._read=function(t){_(this,new w("_read()"))},A.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,h("pipe count=%d opts=%j",n.pipesCount,e);var s=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?u:g;function a(e,i){h("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,h("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",a),r.removeListener("end",u),r.removeListener("end",g),r.removeListener("data",c),l=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){h("onend"),t.end()}n.endEmitted?i.nextTick(s):r.once("end",s),t.on("unpipe",a);var f=function(t){return function(){var e=t._readableState;h("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,C(t))}}(r);t.on("drain",f);var l=!1;function c(e){h("ondata");var i=t.write(e);h("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==q(n.pipes,t))&&!l&&(h("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function d(e){h("onerror",e),g(),t.removeListener("error",d),0===o(t,"error")&&_(t,e)}function p(){t.removeListener("finish",m),g()}function m(){h("onfinish"),t.removeListener("close",p),g()}function g(){h("unpipe"),r.unpipe(t)}return r.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),n.flowing||(h("pipe resume"),r.resume()),t},A.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,h("on readable",n.length,n.reading),n.length?I(this):n.reading||i.nextTick(P,this))),r},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(t,e){var r=s.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(T,this),r},A.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(T,this),e},A.prototype.resume=function(){var t=this._readableState;return t.flowing||(h("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(L,t,e))}(this,t)),t.paused=!1,this},A.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(h("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var o=0;o-1))throw new M(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(t,e,r){r(new m("_write()"))},A.prototype._writev=null,A.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,j(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),A.prototype.destroy=l.destroy,A.prototype._undestroy=l.undestroy,A.prototype._destroy=function(t,e){e(t)}}).call(this,r(2),r(4))},function(t,e,r){"use strict";t.exports=f;var i=r(23).codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,o=i.ERR_MULTIPLE_CALLBACK,s=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=i.ERR_TRANSFORM_WITH_LENGTH_0,u=r(24);function h(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function c(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}i(u,n),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,p=0|this._f,m=0|this._g,g=0|this._h,v=0;v<16;++v)r[v]=t.readInt32BE(4*v);for(;v<64;++v)r[v]=0|(((e=r[v-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[v-7]+d(r[v-15])+r[v-16];for(var b=0;b<64;++b){var y=g+c(u)+h(u,p,m)+s[b]+r[b]|0,w=l(i)+f(i,n,o)|0;g=m,m=p,p=u,u=a+y|0,a=o,o=n,n=i,i=y+w|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},function(t,e,r){var i=r(0),n=r(25),o=r(1).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function u(){this.init(),this._w=a,n.call(this,128,112)}function h(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function l(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function c(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function g(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function v(t,e){return t>>>0>>0?1:0}i(u,n),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,o=0|this._dh,a=0|this._eh,u=0|this._fh,b=0|this._gh,y=0|this._hh,w=0|this._al,M=0|this._bl,_=0|this._cl,S=0|this._dl,k=0|this._el,A=0|this._fl,E=0|this._gl,R=0|this._hl,x=0;x<32;x+=2)e[x]=t.readInt32BE(4*x),e[x+1]=t.readInt32BE(4*x+4);for(;x<160;x+=2){var I=e[x-30],O=e[x-30+1],j=d(I,O),B=p(O,I),T=m(I=e[x-4],O=e[x-4+1]),P=g(O,I),L=e[x-14],C=e[x-14+1],D=e[x-32],N=e[x-32+1],U=B+C|0,q=j+L+v(U,B)|0;q=(q=q+T+v(U=U+P|0,P)|0)+D+v(U=U+N|0,N)|0,e[x]=q,e[x+1]=U}for(var z=0;z<160;z+=2){q=e[z],U=e[z+1];var F=f(r,i,n),W=f(w,M,_),Z=l(r,w),H=l(w,r),K=c(a,k),G=c(k,a),V=s[z],$=s[z+1],Y=h(a,u,b),J=h(k,A,E),X=R+G|0,Q=y+K+v(X,R)|0;Q=(Q=(Q=Q+Y+v(X=X+J|0,J)|0)+V+v(X=X+$|0,$)|0)+q+v(X=X+U|0,U)|0;var tt=H+W|0,et=Z+F+v(tt,H)|0;y=b,R=E,b=u,E=A,u=a,A=k,a=o+Q+v(k=S+X|0,S)|0,o=n,S=_,n=i,_=M,i=r,M=w,r=Q+et+v(w=X+tt|0,X)|0}this._al=this._al+w|0,this._bl=this._bl+M|0,this._cl=this._cl+_|0,this._dl=this._dl+S|0,this._el=this._el+k|0,this._fl=this._fl+A|0,this._gl=this._gl+E|0,this._hl=this._hl+R|0,this._ah=this._ah+r+v(this._al,w)|0,this._bh=this._bh+i+v(this._bl,M)|0,this._ch=this._ch+n+v(this._cl,_)|0,this._dh=this._dh+o+v(this._dl,S)|0,this._eh=this._eh+a+v(this._el,k)|0,this._fh=this._fh+u+v(this._fl,A)|0,this._gh=this._gh+b+v(this._gl,E)|0,this._hh=this._hh+y+v(this._hl,R)|0},u.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},function(t,e,r){"use strict";(function(e,i){var n=r(36);t.exports=y;var o,s=r(74);y.ReadableState=b;r(16).EventEmitter;var a=function(t,e){return t.listeners(e).length},u=r(85),h=r(1).Buffer,f=e.Uint8Array||function(){};var l=Object.create(r(31));l.inherits=r(0);var c=r(167),d=void 0;d=c&&c.debuglog?c.debuglog("stream"):function(){};var p,m=r(168),g=r(86);l.inherits(y,u);var v=["error","close","destroy","pause","resume"];function b(t,e){t=t||{};var i=e instanceof(o=o||r(18));this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,s=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(17).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function y(t){if(o=o||r(18),!(this instanceof y))return new y(t);this._readableState=new b(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function w(t,e,r,i,n){var o,s=t._readableState;null===e?(s.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,S(t)}(t,s)):(n||(o=function(t,e){var r;i=e,h.isBuffer(i)||i instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(s,e)),o?t.emit("error",o):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),i?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):M(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?M(t,s,e,!1):A(t,s)):M(t,s,e,!1))):i||(s.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(k,t):k(t))}function k(t){d("emit readable"),t.emit("readable"),I(t)}function A(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(E,t,e))}function E(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;to.length?o.length:t;if(s===o.length?n+=o:n+=o.slice(0,t),0===(t-=s)){s===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=h.allocUnsafe(t),i=e.head,n=1;i.data.copy(r),t-=i.data.length;for(;i=i.next;){var o=i.data,s=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,s),0===(t-=s)){s===o.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=o.slice(s));break}++n}return e.length-=n,r}(t,e);return i}(t,e.buffer,e.decoder),r);var r}function j(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(B,e,t))}function B(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function T(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return d("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?j(this):S(this),null;if(0===(t=_(t,e))&&e.ended)return 0===e.length&&j(this),null;var i,n=e.needReadable;return d("need readable",n),(0===e.length||e.length-t0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&j(this)),null!==i&&this.emit("data",i),i},y.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(t,e){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,d("pipe count=%d opts=%j",o.pipesCount,e);var u=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?f:y;function h(e,i){d("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),t.removeListener("close",v),t.removeListener("finish",b),t.removeListener("drain",l),t.removeListener("error",g),t.removeListener("unpipe",h),r.removeListener("end",f),r.removeListener("end",y),r.removeListener("data",m),c=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function f(){d("onend"),t.end()}o.endEmitted?n.nextTick(u):r.once("end",u),t.on("unpipe",h);var l=function(t){return function(){var e=t._readableState;d("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,I(t))}}(r);t.on("drain",l);var c=!1;var p=!1;function m(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==T(o.pipes,t))&&!c&&(d("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function g(e){d("onerror",e),y(),t.removeListener("error",g),0===a(t,"error")&&t.emit("error",e)}function v(){t.removeListener("finish",b),y()}function b(){d("onfinish"),t.removeListener("close",v),y()}function y(){d("unpipe"),r.unpipe(t)}return r.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",g),t.once("close",v),t.once("finish",b),t.emit("pipe",r),o.flowing||(d("pipe resume"),r.resume()),t},y.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;or)?e=("rmd160"===t?new u:h(t)).update(e).digest():e.lengthr||e!=e)throw new TypeError("Bad key length")}},function(t,e,r){(function(e,r){var i;if(e.process&&e.process.browser)i="utf-8";else if(e.process&&e.process.version){i=parseInt(r.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else i="utf-8";t.exports=i}).call(this,r(2),r(4))},function(t,e,r){var i=r(89),n=r(48),o=r(49),s=r(1).Buffer,a=r(92),u=r(93),h=r(95),f=s.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function c(t,e,r){var a=function(t){function e(e){return o(t).update(e).digest()}return"rmd160"===t||"ripemd160"===t?function(t){return(new n).update(t).digest()}:"md5"===t?i:e}(t),u="sha512"===t||"sha384"===t?128:64;e.length>u?e=a(e):e.length>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,i){for(var n=0,o=0,s=6;s>=0;s-=2){for(var a=0;a<=24;a+=8)n<<=1,n|=e>>>a+s&1;for(a=0;a<=24;a+=8)n<<=1,n|=t>>>a+s&1}for(s=6;s>=0;s-=2){for(a=1;a<=25;a+=8)o<<=1,o|=e>>>a+s&1;for(a=1;a<=25;a+=8)o<<=1,o|=t>>>a+s&1}r[i+0]=n>>>0,r[i+1]=o>>>0},e.rip=function(t,e,r,i){for(var n=0,o=0,s=0;s<4;s++)for(var a=24;a>=0;a-=8)n<<=1,n|=e>>>a+s&1,n<<=1,n|=t>>>a+s&1;for(s=4;s<8;s++)for(a=24;a>=0;a-=8)o<<=1,o|=e>>>a+s&1,o<<=1,o|=t>>>a+s&1;r[i+0]=n>>>0,r[i+1]=o>>>0},e.pc1=function(t,e,r,i){for(var n=0,o=0,s=7;s>=5;s--){for(var a=0;a<=24;a+=8)n<<=1,n|=e>>a+s&1;for(a=0;a<=24;a+=8)n<<=1,n|=t>>a+s&1}for(a=0;a<=24;a+=8)n<<=1,n|=e>>a+s&1;for(s=1;s<=3;s++){for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1;for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1}for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1;r[i+0]=n>>>0,r[i+1]=o>>>0},e.r28shl=function(t,e){return t<>>28-e};var i=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,r,n){for(var o=0,s=0,a=i.length>>>1,u=0;u>>i[u]&1;for(u=a;u>>i[u]&1;r[n+0]=o>>>0,r[n+1]=s>>>0},e.expand=function(t,e,r){var i=0,n=0;i=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)i<<=6,i|=t>>>o&63;for(o=11;o>=3;o-=4)n|=t>>>o&63,n<<=6;n|=(31&t)<<1|t>>>31,e[r+0]=i>>>0,e[r+1]=n>>>0};var n=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var r=0,i=0;i<4;i++){r<<=4,r|=n[64*i+(t>>>18-6*i&63)]}for(i=0;i<4;i++){r<<=4,r|=n[256+64*i+(e>>>18-6*i&63)]}return r>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,r=0;r>>o[r]&1;return e>>>0},e.padSplit=function(t,e,r){for(var i=t.toString(2);i.length>>1];r=o.r28shl(r,a),n=o.r28shl(n,a),o.pc2(r,n,t.keys,s)}},u.prototype._update=function(t,e,r,i){var n=this._desState,s=o.readUInt32BE(t,e),a=o.readUInt32BE(t,e+4);o.ip(s,a,n.tmp,0),s=n.tmp[0],a=n.tmp[1],"encrypt"===this.type?this._encrypt(n,s,a,n.tmp,0):this._decrypt(n,s,a,n.tmp,0),s=n.tmp[0],a=n.tmp[1],o.writeUInt32BE(r,s,i),o.writeUInt32BE(r,a,i+4)},u.prototype._pad=function(t,e){for(var r=t.length-e,i=e;i>>0,s=c}o.rip(a,s,i,n)},u.prototype._decrypt=function(t,e,r,i,n){for(var s=r,a=e,u=t.keys.length-2;u>=0;u-=2){var h=t.keys[u],f=t.keys[u+1];o.expand(s,t.tmp,0),h^=t.tmp[0],f^=t.tmp[1];var l=o.substitute(h,f),c=s;s=(a^o.permute(l))>>>0,a=c}o.rip(s,a,i,n)}},function(t,e,r){var i=r(32),n=r(1).Buffer,o=r(99);function s(t){var e=t._cipher.encryptBlockRaw(t._prev);return o(t._prev),e}e.encrypt=function(t,e){var r=Math.ceil(e.length/16),o=t._cache.length;t._cache=n.concat([t._cache,n.allocUnsafe(16*r)]);for(var a=0;at;)r.ishrn(1);if(r.isEven()&&r.iadd(a),r.testn(1)||r.iadd(u),e.cmp(u)){if(!e.cmp(h))for(;r.mod(f).cmp(l);)r.iadd(d)}else for(;r.mod(o).cmp(c);)r.iadd(d);if(g(p=r.shrn(1))&&g(r)&&v(p)&&v(r)&&s.test(p)&&s.test(r))return r}}},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(196).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}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,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=u(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,f=r;f1&&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?""};var f=["","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],c=[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 d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!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&&i(!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,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,h=new t(o),f=this.clone();if(u){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.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 e;e=this.length>t.length?t:this;for(var r=0;rt.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 e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.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){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,b=g>>>13,y=0|s[3],w=8191&y,M=y>>>13,_=0|s[4],S=8191&_,k=_>>>13,A=0|s[5],E=8191&A,R=A>>>13,x=0|s[6],I=8191&x,O=x>>>13,j=0|s[7],B=8191&j,T=j>>>13,P=0|s[8],L=8191&P,C=P>>>13,D=0|s[9],N=8191&D,U=D>>>13,q=0|a[0],z=8191&q,F=q>>>13,W=0|a[1],Z=8191&W,H=W>>>13,K=0|a[2],G=8191&K,V=K>>>13,$=0|a[3],Y=8191&$,J=$>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(i=Math.imul(l,z))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,z)|0))<<13)|0;h=((o=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var vt=(h+(i=i+Math.imul(l,Z)|0)|0)+((8191&(n=(n=n+Math.imul(l,H)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,z),n=(n=Math.imul(v,F))+Math.imul(b,z)|0,o=Math.imul(b,F),i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,H)|0;var bt=(h+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,G)|0))<<13)|0;h=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,z),n=(n=Math.imul(w,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,V)|0;var yt=(h+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;h=((o=o+Math.imul(c,J)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(S,z),n=(n=Math.imul(S,F))+Math.imul(k,z)|0,o=Math.imul(k,F),i=i+Math.imul(w,Z)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,H)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var wt=(h+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,z),n=(n=Math.imul(E,F))+Math.imul(R,z)|0,o=Math.imul(R,F),i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(v,Y)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Mt=(h+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,z),n=(n=Math.imul(I,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(E,Z)|0,n=(n=n+Math.imul(E,H)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var _t=(h+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,z),n=(n=Math.imul(B,F))+Math.imul(T,z)|0,o=Math.imul(T,F),i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,H)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,J)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(h+(i=i+Math.imul(l,ut)|0)|0)+((8191&(n=(n=n+Math.imul(l,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(C,z)|0,o=Math.imul(C,F),i=i+Math.imul(B,Z)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(E,Y)|0,n=(n=n+Math.imul(E,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var kt=(h+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,z),n=(n=Math.imul(N,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(L,Z)|0,n=(n=n+Math.imul(L,H)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,V)|0,i=i+Math.imul(I,Y)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var At=(h+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(N,Z),n=(n=Math.imul(N,H))+Math.imul(U,Z)|0,o=Math.imul(U,H),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,V)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,V)|0,i=i+Math.imul(B,Y)|0,n=(n=n+Math.imul(B,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,i=i+Math.imul(v,lt)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var Et=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,V))+Math.imul(U,G)|0,o=Math.imul(U,V),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,J)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ht)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ct)|0;var Rt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(N,Y),n=(n=Math.imul(N,J))+Math.imul(U,Y)|0,o=Math.imul(U,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(E,ut)|0,n=(n=n+Math.imul(E,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,ct)|0;var xt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(N,Q),n=(n=Math.imul(N,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,it)|0,i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,i=i+Math.imul(E,lt)|0,n=(n=n+Math.imul(E,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var It=(h+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((o=o+Math.imul(k,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(N,rt),n=(n=Math.imul(N,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(L,ot)|0,n=(n=n+Math.imul(L,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var Ot=(h+(i=i+Math.imul(E,pt)|0)|0)+((8191&(n=(n=n+Math.imul(E,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(N,ot),n=(n=Math.imul(N,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ct)|0;var jt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(N,ut),n=(n=Math.imul(N,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ct)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(N,lt),n=(n=Math.imul(N,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Tt=(h+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var Pt=(h+(i=Math.imul(N,pt))|0)+((8191&(n=(n=Math.imul(N,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=bt,u[3]=yt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=St,u[8]=kt,u[9]=At,u[10]=Et,u[11]=Rt,u[12]=xt,u[13]=It,u[14]=Ot,u[15]=jt,u[16]=Bt,u[17]=Tt,u[18]=Pt,0!==h&&(u[19]=h,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,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 e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==f||h>=n);h--){var l=0|this.words[h];this.words[h]=f<<26-o|l>>>o,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},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){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(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 e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,u=i.length-n.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{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,e);var n,s,a},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 e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(u)):(r.isub(e),a.isub(n),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).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 e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},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){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}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 e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},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 S(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(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 i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(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 b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){S.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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(y,b),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var l=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}u=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(14)(t))},function(t,e,r){var i=r(197),n=r(55);function o(t){this.rand=t||new n.Rand}t.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var n=new i(this.rand.generate(r))}while(n.cmp(t)>=0);return n},o.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},o.prototype.test=function(t,e,r){var n=t.bitLength(),o=i.mont(t),s=new i(1).toRed(o);e||(e=Math.max(1,n/48|0));for(var a=t.subn(1),u=0;!a.testn(u);u++);for(var h=t.shrn(u),f=a.toRed(o);e>0;e--){var l=this._randrange(new i(2),a);r&&r(l);var c=l.toRed(o).redPow(h);if(0!==c.cmp(s)&&0!==c.cmp(f)){for(var d=1;d0;e--){var f=this._randrange(new i(2),s),l=t.gcd(f);if(0!==l.cmpn(1))return l;var c=f.toRed(n).redPow(u);if(0!==c.cmp(o)&&0!==c.cmp(h)){for(var d=1;d0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)s.endEmitted?_(t,new M):R(t,s,e,!0);else if(s.ended)_(t,new y);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?R(t,s,e,!1):j(t,s)):R(t,s,e,!1)}else i||(s.reading=!1,j(t,s));return!s.ended&&(s.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;h("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(h("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(O,t))}function O(t){var e=t._readableState;h("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,C(t)}function j(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(B,t,e))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function P(t){h("readable nexttick read 0"),t.read(0)}function L(t,e){h("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(h("flow",e.flowing);e.flowing&&null!==t.read(););}function D(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function N(t){var e=t._readableState;h("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(U,e,t))}function U(t,e){if(h("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function q(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return h("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?N(this):I(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&N(this),null;var i,n=e.needReadable;return h("need readable",n),(0===e.length||e.length-t0?D(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&N(this)),null!==i&&this.emit("data",i),i},A.prototype._read=function(t){_(this,new w("_read()"))},A.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,h("pipe count=%d opts=%j",n.pipesCount,e);var s=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?u:g;function a(e,i){h("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,h("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",a),r.removeListener("end",u),r.removeListener("end",g),r.removeListener("data",c),l=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){h("onend"),t.end()}n.endEmitted?i.nextTick(s):r.once("end",s),t.on("unpipe",a);var f=function(t){return function(){var e=t._readableState;h("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,C(t))}}(r);t.on("drain",f);var l=!1;function c(e){h("ondata");var i=t.write(e);h("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==q(n.pipes,t))&&!l&&(h("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function d(e){h("onerror",e),g(),t.removeListener("error",d),0===o(t,"error")&&_(t,e)}function p(){t.removeListener("finish",m),g()}function m(){h("onfinish"),t.removeListener("close",p),g()}function g(){h("unpipe"),r.unpipe(t)}return r.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),n.flowing||(h("pipe resume"),r.resume()),t},A.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,h("on readable",n.length,n.reading),n.length?I(this):n.reading||i.nextTick(P,this))),r},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(t,e){var r=s.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(T,this),r},A.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(T,this),e},A.prototype.resume=function(){var t=this._readableState;return t.flowing||(h("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(L,t,e))}(this,t)),t.paused=!1,this},A.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(h("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var o=0;o-1))throw new M(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(t,e,r){r(new m("_write()"))},A.prototype._writev=null,A.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,j(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),A.prototype.destroy=l.destroy,A.prototype._undestroy=l.undestroy,A.prototype._destroy=function(t,e){e(t)}}).call(this,r(2),r(4))},function(t,e,r){"use strict";t.exports=f;var i=r(26).codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,o=i.ERR_MULTIPLE_CALLBACK,s=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=i.ERR_TRANSFORM_WITH_LENGTH_0,u=r(27);function h(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length>8,s=255&n;o?r.push(o,s):r.push(s)}return r},i.zero2=n,i.toHex=o,i.encode=function(t,e){return"hex"===e?o(t):t}},function(t,e,r){"use strict";var i=e;i.base=r(39),i.short=r(215),i.mont=r(216),i.edwards=r(217)},function(t,e,r){"use strict";var i=r(9).rotr32;function n(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function s(t,e,r){return t^e^r}e.ft_1=function(t,e,r,i){return 0===t?n(e,r,i):1===t||3===t?s(e,r,i):2===t?o(e,r,i):void 0},e.ch32=n,e.maj32=o,e.p32=s,e.s0_256=function(t){return i(t,2)^i(t,13)^i(t,22)},e.s1_256=function(t){return i(t,6)^i(t,11)^i(t,25)},e.g0_256=function(t){return i(t,7)^i(t,18)^t>>>3},e.g1_256=function(t){return i(t,17)^i(t,19)^t>>>10}},function(t,e,r){"use strict";var i=r(9),n=r(33),o=r(114),s=r(5),a=i.sum32,u=i.sum32_4,h=i.sum32_5,f=o.ch32,l=o.maj32,c=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,g=n.BlockHash,v=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=v,this.W=new Array(64)}i.inherits(b,g),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}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,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=u(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,f=r;f1&&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?""};var f=["","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],c=[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 d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!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&&i(!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,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,h=new t(o),f=this.clone();if(u){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.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 e;e=this.length>t.length?t:this;for(var r=0;rt.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 e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.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){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,b=g>>>13,y=0|s[3],w=8191&y,M=y>>>13,_=0|s[4],S=8191&_,k=_>>>13,A=0|s[5],E=8191&A,R=A>>>13,x=0|s[6],I=8191&x,O=x>>>13,j=0|s[7],B=8191&j,T=j>>>13,P=0|s[8],L=8191&P,C=P>>>13,D=0|s[9],N=8191&D,U=D>>>13,q=0|a[0],z=8191&q,F=q>>>13,W=0|a[1],Z=8191&W,H=W>>>13,K=0|a[2],G=8191&K,V=K>>>13,$=0|a[3],Y=8191&$,J=$>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(i=Math.imul(l,z))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,z)|0))<<13)|0;h=((o=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var vt=(h+(i=i+Math.imul(l,Z)|0)|0)+((8191&(n=(n=n+Math.imul(l,H)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,z),n=(n=Math.imul(v,F))+Math.imul(b,z)|0,o=Math.imul(b,F),i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,H)|0;var bt=(h+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,G)|0))<<13)|0;h=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,z),n=(n=Math.imul(w,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,V)|0;var yt=(h+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;h=((o=o+Math.imul(c,J)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(S,z),n=(n=Math.imul(S,F))+Math.imul(k,z)|0,o=Math.imul(k,F),i=i+Math.imul(w,Z)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,H)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var wt=(h+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,z),n=(n=Math.imul(E,F))+Math.imul(R,z)|0,o=Math.imul(R,F),i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(v,Y)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Mt=(h+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,z),n=(n=Math.imul(I,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(E,Z)|0,n=(n=n+Math.imul(E,H)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var _t=(h+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,z),n=(n=Math.imul(B,F))+Math.imul(T,z)|0,o=Math.imul(T,F),i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,H)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,J)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(h+(i=i+Math.imul(l,ut)|0)|0)+((8191&(n=(n=n+Math.imul(l,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(C,z)|0,o=Math.imul(C,F),i=i+Math.imul(B,Z)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(E,Y)|0,n=(n=n+Math.imul(E,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var kt=(h+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,z),n=(n=Math.imul(N,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(L,Z)|0,n=(n=n+Math.imul(L,H)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,V)|0,i=i+Math.imul(I,Y)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var At=(h+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(N,Z),n=(n=Math.imul(N,H))+Math.imul(U,Z)|0,o=Math.imul(U,H),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,V)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,V)|0,i=i+Math.imul(B,Y)|0,n=(n=n+Math.imul(B,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,i=i+Math.imul(v,lt)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var Et=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,V))+Math.imul(U,G)|0,o=Math.imul(U,V),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,J)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ht)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ct)|0;var Rt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(N,Y),n=(n=Math.imul(N,J))+Math.imul(U,Y)|0,o=Math.imul(U,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(E,ut)|0,n=(n=n+Math.imul(E,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,ct)|0;var xt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(N,Q),n=(n=Math.imul(N,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,it)|0,i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,i=i+Math.imul(E,lt)|0,n=(n=n+Math.imul(E,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var It=(h+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((o=o+Math.imul(k,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(N,rt),n=(n=Math.imul(N,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(L,ot)|0,n=(n=n+Math.imul(L,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var Ot=(h+(i=i+Math.imul(E,pt)|0)|0)+((8191&(n=(n=n+Math.imul(E,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(N,ot),n=(n=Math.imul(N,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ct)|0;var jt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(N,ut),n=(n=Math.imul(N,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ct)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(N,lt),n=(n=Math.imul(N,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Tt=(h+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var Pt=(h+(i=Math.imul(N,pt))|0)+((8191&(n=(n=Math.imul(N,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=bt,u[3]=yt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=St,u[8]=kt,u[9]=At,u[10]=Et,u[11]=Rt,u[12]=xt,u[13]=It,u[14]=Ot,u[15]=jt,u[16]=Bt,u[17]=Tt,u[18]=Pt,0!==h&&(u[19]=h,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,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 e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==f||h>=n);h--){var l=0|this.words[h];this.words[h]=f<<26-o|l>>>o,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},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){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(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 e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,u=i.length-n.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{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,e);var n,s,a},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 e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(u)):(r.isub(e),a.isub(n),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).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 e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},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){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}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 e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},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 S(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(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 i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(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 b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){S.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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(y,b),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var l=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}u=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(14)(t))},function(t,e,r){"use strict";const i=e;i.der=r(120),i.pem=r(235)},function(t,e,r){"use strict";const i=r(0),n=r(63).Buffer,o=r(64),s=r(66);function a(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){o.call(this,"der",t)}function h(t){return t<10?"0"+t:t}t.exports=a,a.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},i(u,o),u.prototype._encodeComposite=function(t,e,r,i){const o=function(t,e,r,i){let n;"seqof"===t?t="seq":"setof"===t&&(t="set");if(s.tagByName.hasOwnProperty(t))n=s.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return i.error("Unknown tag: "+t);n=t}if(n>=31)return i.error("Multi-octet tag encoding unsupported");e||(n|=32);return n|=s.tagClassByName[r||"universal"]<<6,n}(t,e,r,this.reporter);if(i.length<128){const t=n.alloc(2);return t[0]=o,t[1]=i.length,this._createEncoderBuffer([t,i])}let a=1;for(let t=i.length;t>=256;t>>=8)a++;const u=n.alloc(2+a);u[0]=o,u[1]=128|a;for(let t=1+a,e=i.length;e>0;t--,e>>=8)u[t]=255&e;return this._createEncoderBuffer([u,i])},u.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=n.alloc(2*t.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let i=0;for(let e=0;e=128;r>>=7)i++}const o=n.alloc(i);let s=o.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(o[s--]=127&r;(r>>=7)>0;)o[s--]=128|127&r}return this._createEncoderBuffer(o)},u.prototype._encodeTime=function(t,e){let r;const i=new Date(t);return"gentime"===e?r=[h(i.getUTCFullYear()),h(i.getUTCMonth()+1),h(i.getUTCDate()),h(i.getUTCHours()),h(i.getUTCMinutes()),h(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[h(i.getUTCFullYear()%100),h(i.getUTCMonth()+1),h(i.getUTCDate()),h(i.getUTCHours()),h(i.getUTCMinutes()),h(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!n.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=n.from(e)}if(n.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=n.alloc(e);return t.copy(r),0===t.length&&(r[0]=0),this._createEncoderBuffer(r)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const i=new Array(r);for(let e=i.length-1;e>=0;e--)i[e]=255&t,t>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(n.from(i))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},u.prototype._skipDefault=function(t,e,r){const i=this._baseState;let n;if(null===i.default)return!1;const o=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,e,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n>6],n=0==(32&r);if(31==(31&r)){let i=r;for(r=0;128==(128&i);){if(i=t.readUInt8(e),t.isError(i))return i;r<<=7,r|=127&i}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:a.tag[r]}}function l(t,e,r){let i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;const n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(let e=0;e{var s;return!!i.isRoot((null===(s=e.user)||void 0===s?void 0:s.id)||"")||(t.permissionLevel!==n.UserGuildPermissions.User||(!r.blockPending||!e.pending)&&((!r.blockList||0===o.xor(e.roles,r.blockList).length)&&(!r.allowList||0!==o.xor(e.roles,r.allowList).length)))}},function(t,e,r){"use strict";var i=Object.prototype.toString;t.exports=function(t){var e=i.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===i.call(t.callee)),r}},function(t,e,r){"use strict";var i=function(t){return t!=t};t.exports=function(t,e){return 0===t&&0===e?1/t==1/e:t===e||!(!i(t)||!i(e))}},function(t,e,r){"use strict";var i=r(129);t.exports=function(){return"function"==typeof Object.is?Object.is:i}},function(t,e,r){"use strict";var i=Object,n=TypeError;t.exports=function(){if(null!=this&&this!==i(this))throw new n("RegExp.prototype.flags getter called on non-object");var t="";return this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.sticky&&(t+="y"),t}},function(t,e,r){"use strict";var i=r(131),n=r(19).supportsDescriptors,o=Object.getOwnPropertyDescriptor,s=TypeError;t.exports=function(){if(!n)throw new s("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");if("gim"===/a/gim.flags){var t=o(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof/a/.dotAll)return t.get}return i}},function(t,e,r){"use strict";var i=String.prototype.valueOf,n=Object.prototype.toString,o="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"string"==typeof t||"object"==typeof t&&(o?function(t){try{return i.call(t),!0}catch(t){return!1}}(t):"[object String]"===n.call(t))}},function(t,e){var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString;t.exports=function(t,e,n){if("[object Function]"!==i.call(e))throw new TypeError("iterator must be a function");var o=t.length;if(o===+o)for(var s=0;s{const e={};for(let[r,i]of t.headers.entries())e[r]=i;return new Response(JSON.stringify(e))}),v.addFallback("root",()=>m.respond({__warning:"🦊",this:"is",a:"fox-based",web:"application",please:"be",mindful:"of",your:"surroundings",warning__:"🦊",meta:g.uiPublicURI})),addEventListener("fetch",t=>{t.respondWith(v.handle(t.request))})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BotJoin=void 0;const i=r(43),n=r(8),o=/^[0-9]+$/;e.BotJoin=t=>{let e=new URL(t.url).searchParams.get("guild")||"";return e&&!o.test(e)&&(e=""),i.Bounce((t=>{let e=`https://discord.com/api/oauth2/authorize?client_id=${t.clientID}&scope=${t.scopes.join("%20")}&permissions=${t.permissions}`;return t.guildID&&(e+=`&guild_id=${t.guildID}&disable_guild_select=true`),e})({clientID:n.botClientID,permissions:268435456,guildID:e,scopes:["bot","application.commands"]}))}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ClearGuildCache=void 0;const i=r(20),n=r(21);e.ClearGuildCache=i.asEditor({rateLimitKey:i.GuildRateLimiterKey.cacheClear,rateLimitTimeoutSeconds:300},(t,{guildID:e})=>async t=>await i.getGuild(e,{skipCachePull:!0})?n.ok():n.notFound())},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.discordFetch=e.AuthType=e.discordAPIBase=void 0;const i=r(72);var n;e.discordAPIBase="https://discordapp.com/api/v9",function(t){t.Bearer="Bearer",t.Bot="Bot"}(n=e.AuthType||(e.AuthType={}));e.discordFetch=async(t,r,o=n.Bearer,s)=>{const a=await fetch(e.discordAPIBase+t,{...s||{},headers:{...(null==s?void 0:s.headers)||{},authorization:`${n[o]} ${r}`,"user-agent":i.userAgent}});return a.status>=400&&console.error("discordFetch failed",{url:t,authType:o,payload:await a.text()}),a.ok?await a.json():null}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.kvOrLocal=e.WrappedKVNamespace=void 0;e.WrappedKVNamespace=class{constructor(t){this.kvNamespace=t,this.list=this.kvNamespace.list,this.getWithMetadata=this.kvNamespace.getWithMetadata,this.delete=this.kvNamespace.delete}async get(t){const e=await this.kvNamespace.get(t,"text");return e?JSON.parse(e):null}async put(t,e,r){await this.kvNamespace.put(t,JSON.stringify(e),{expirationTtl:r})}};class i{constructor(){this.data=new Map,console.warn("EmulatedKV used. Data will be lost.")}async get(t){return this.data.has(t)?this.data.get(t):null}async getWithMetadata(t){return{value:await this.get(t),metadata:{}}}async put(t,e){this.data.set(t,e)}async delete(t){this.data.delete(t)}async list(t){let e=[];for(let r of this.data.keys())(null==t?void 0:t.prefix)&&!r.startsWith(t.prefix)||e.push({name:r});return{keys:e,cursor:"0",list_complete:!0}}}e.kvOrLocal=t=>t||new i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CategoryType=void 0,function(t){t[t.Multi=0]="Multi",t[t.Single=1]="Single"}(e.CategoryType||(e.CategoryType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebhookValidationStatus=e.UserGuildPermissions=e.Features=void 0,function(t){t[t.None=0]="None",t[t.Preview=0]="Preview",t[t.LegacyGuild=2]="LegacyGuild",t[t.AccessControl=4]="AccessControl",t[t.AuditLogging=8]="AuditLogging"}(e.Features||(e.Features={})),function(t){t[t.User=0]="User",t[t.Manager=2]="Manager",t[t.Admin=4]="Admin"}(e.UserGuildPermissions||(e.UserGuildPermissions={})),function(t){t[t.Ok=0]="Ok",t[t.NoneSet=1]="NoneSet",t[t.DoesNotExist=2]="DoesNotExist",t[t.NotSameGuild=3]="NotSameGuild",t[t.NotDiscordURL=4]="NotDiscordURL"}(e.WebhookValidationStatus||(e.WebhookValidationStatus={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InteractionCallbackType=e.InteractionType=void 0,function(t){t[t.PING=1]="PING",t[t.APPLICATION_COMMAND=2]="APPLICATION_COMMAND",t[t.MESSAGE_COMPONENT=3]="MESSAGE_COMPONENT"}(e.InteractionType||(e.InteractionType={})),function(t){t[t.PONG=1]="PONG",t[t.CHANNEL_MESSAGE_WITH_SOURCE=4]="CHANNEL_MESSAGE_WITH_SOURCE",t[t.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE=5]="DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE",t[t.DEFERRED_UPDATE_MESSAGE=6]="DEFERRED_UPDATE_MESSAGE",t[t.UPDATE_MESSAGE=7]="UPDATE_MESSAGE"}(e.InteractionCallbackType||(e.InteractionCallbackType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TransactionType=e.RoleSafety=void 0,function(t){t[t.Safe=0]="Safe",t[t.HigherThanBot=2]="HigherThanBot",t[t.DangerousPermissions=4]="DangerousPermissions",t[t.ManagedRole=8]="ManagedRole",t[t.AccessControl=16]="AccessControl"}(e.RoleSafety||(e.RoleSafety={})),function(t){t[t.None=0]="None",t[t.Remove=2]="Remove",t[t.Add=4]="Add"}(e.TransactionType||(e.TransactionType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";e.byteLength=function(t){var e=h(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){var e,r,i=h(t),s=i[0],a=i[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),f=0,l=a>0?s-4:s;for(r=0;r>16&255,u[f++]=e>>8&255,u[f++]=255&e;2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[f++]=255&e);1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,o=[],s=0,a=r-n;sa?a:s+16383));1===n?(e=t[r-1],o.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return o.join("")};for(var i=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,r){for(var n,o,s=[],a=e;a>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,e){ +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ +e.read=function(t,e,r,i,n){var o,s,a=8*n-i-1,u=(1<>1,f=-7,l=r?n-1:0,c=r?-1:1,d=t[e+l];for(l+=c,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+t[e+l],l+=c,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=i;f>0;s=256*s+t[e+l],l+=c,f-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=h}return(d?-1:1)*s*Math.pow(2,o-i)},e.write=function(t,e,r,i,n,o){var s,a,u,h=8*o-n-1,f=(1<>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?c/u:c*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*u-1)*Math.pow(2,n),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,n),s=0));n>=8;t[r+d]=255&a,d+=p,a/=256,n-=8);for(s=s<0;t[r+d]=255&s,d+=p,s/=256,h-=8);t[r+d-p]|=128*m}},function(t,e,r){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=r(22),e.createHash=e.Hash=r(30),e.createHmac=e.Hmac=r(88);var i=r(178),n=Object.keys(i),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(n);e.getHashes=function(){return o};var s=r(91);e.pbkdf2=s.pbkdf2,e.pbkdf2Sync=s.pbkdf2Sync;var a=r(180);e.Cipher=a.Cipher,e.createCipher=a.createCipher,e.Cipheriv=a.Cipheriv,e.createCipheriv=a.createCipheriv,e.Decipher=a.Decipher,e.createDecipher=a.createDecipher,e.Decipheriv=a.Decipheriv,e.createDecipheriv=a.createDecipheriv,e.getCiphers=a.getCiphers,e.listCiphers=a.listCiphers;var u=r(195);e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var h=r(202);e.createSign=h.createSign,e.Sign=h.Sign,e.createVerify=h.createVerify,e.Verify=h.Verify,e.createECDH=r(243);var f=r(246);e.publicEncrypt=f.publicEncrypt,e.privateEncrypt=f.privateEncrypt,e.publicDecrypt=f.publicDecrypt,e.privateDecrypt=f.privateDecrypt;var l=r(250);e.randomFill=l.randomFill,e.randomFillSync=l.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(t,e,r){ +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +var i=r(3),n=i.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(o(i,e),e.Buffer=s),s.prototype=Object.create(n.prototype),o(n,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,r){(e=t.exports=r(76)).Stream=e,e.Readable=e,e.Writable=r(80),e.Duplex=r(24),e.Transform=r(81),e.PassThrough=r(160),e.finished=r(47),e.pipeline=r(161)},function(t,e){},function(t,e,r){"use strict";function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,r,i,n=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=n,i=a,s.prototype.copy.call(e,r,i),a+=o.data.length,o=o.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0==(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:u,value:function(t,e){return a(this,function(t){for(var e=1;e0,(function(t){i||(i=t),t&&s.forEach(h),o||(s.forEach(h),n(i))}))}));return e.reduce(f)}},function(t,e,r){var i=r(0),n=r(25),o=r(1).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,n.call(this,64,56)}function h(t){return t<<30|t>>>2}function f(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=r[l-3]^r[l-8]^r[l-14]^r[l-16];for(var c=0;c<80;++c){var d=~~(c/20),p=0|((e=i)<<5|e>>>27)+f(d,n,o,a)+u+r[c]+s[d];u=a,a=o,o=h(n),n=i,i=p}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var i=r(0),n=r(25),o=r(1).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,n.call(this,64,56)}function h(t){return t<<5|t>>>27}function f(t){return t<<30|t>>>2}function l(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=(e=r[c-3]^r[c-8]^r[c-14]^r[c-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),m=h(i)+l(p,n,o,a)+u+r[d]+s[p]|0;u=a,a=o,o=f(n),n=i,i=m}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var i=r(0),n=r(82),o=r(25),s=r(1).Buffer,a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}i(u,n),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=s.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},function(t,e,r){var i=r(0),n=r(83),o=r(25),s=r(1).Buffer,a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}i(u,n),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=s.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=u},function(t,e,r){t.exports=n;var i=r(16).EventEmitter;function n(){i.call(this)}r(0)(n,i),n.Readable=r(50),n.Writable=r(173),n.Duplex=r(174),n.Transform=r(175),n.PassThrough=r(176),n.Stream=n,n.prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var s=!1;function a(){s||(s=!0,t.end())}function u(){s||(s=!0,"function"==typeof t.destroy&&t.destroy())}function h(t){if(f(),0===i.listenerCount(this,"error"))throw t}function f(){r.removeListener("data",n),t.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",h),t.removeListener("error",h),r.removeListener("end",f),r.removeListener("close",f),t.removeListener("close",f)}return r.on("error",h),t.on("error",h),r.on("end",f),r.on("close",f),t.on("close",f),t.emit("pipe",r),t}},function(t,e){},function(t,e,r){"use strict";var i=r(1).Buffer,n=r(169);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var e,r,n,o=i.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,r=o,n=a,e.copy(r,n),a+=s.data.length,s=s.next;return o},t}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var t=n.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,r){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(n.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new o(n.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(171),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(2))},function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var i,n,o,s,a,u=1,h={},f=!1,l=t.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(t);c=c&&c.setTimeout?c:t,"[object process]"==={}.toString.call(t.process)?i=function(t){e.nextTick((function(){p(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){p(t.data)},i=function(t){o.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(n=l.documentElement,i=function(t){var e=l.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,n.removeChild(e),e=null},n.appendChild(e)}):i=function(t){setTimeout(p,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),i=function(e){t.postMessage(s+e,"*")}),c.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r64?e=t(e):e.length<64&&(e=n.concat([e,s],64));for(var r=this._ipad=n.allocUnsafe(64),i=this._opad=n.allocUnsafe(64),a=0;a<64;a++)r[a]=54^e[a],i[a]=92^e[a];this._hash=[r]}i(a,o),a.prototype._update=function(t){this._hash.push(t)},a.prototype._final=function(){var t=this._alg(n.concat(this._hash));return this._alg(n.concat([this._opad,t]))},t.exports=a},function(t,e,r){t.exports=r(90)},function(t,e,r){(function(e){var i,n,o=r(1).Buffer,s=r(92),a=r(93),u=r(94),h=r(95),f=e.crypto&&e.crypto.subtle,l={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},c=[];function d(){return n||(n=e.process&&e.process.nextTick?e.process.nextTick:e.queueMicrotask?e.queueMicrotask:e.setImmediate?e.setImmediate:e.setTimeout)}function p(t,e,r,i,n){return f.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return f.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:n}},t,i<<3)})).then((function(t){return o.from(t)}))}t.exports=function(t,r,n,m,g,v){"function"==typeof g&&(v=g,g=void 0);var b=l[(g=g||"sha1").toLowerCase()];if(b&&"function"==typeof e.Promise){if(s(n,m),t=h(t,a,"Password"),r=h(r,a,"Salt"),"function"!=typeof v)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){d()((function(){e(null,t)}))}),(function(t){d()((function(){e(t)}))}))}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!f||!f.importKey||!f.deriveBits)return Promise.resolve(!1);if(void 0!==c[t])return c[t];var r=p(i=i||o.alloc(8),i,10,128,t).then((function(){return!0})).catch((function(){return!1}));return c[t]=r,r}(b).then((function(e){return e?p(t,r,n,m,b):u(t,r,n,m,g)})),v)}else d()((function(){var e;try{e=u(t,r,n,m,g)}catch(t){return v(t)}v(null,e)}))}}).call(this,r(2))},function(t,e,r){var i=r(181),n=r(53),o=r(54),s=r(194),a=r(38);function u(t,e,r){if(t=t.toLowerCase(),o[t])return n.createCipheriv(t,e,r);if(s[t])return new i({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function h(t,e,r){if(t=t.toLowerCase(),o[t])return n.createDecipheriv(t,e,r);if(s[t])return new i({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var r,i;if(t=t.toLowerCase(),o[t])r=o[t].key,i=o[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");r=8*s[t].key,i=s[t].iv}var n=a(e,!1,r,i);return u(t,n.key,n.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var r,i;if(t=t.toLowerCase(),o[t])r=o[t].key,i=o[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");r=8*s[t].key,i=s[t].iv}var n=a(e,!1,r,i);return h(t,n.key,n.iv)},e.createDecipheriv=e.Decipheriv=h,e.listCiphers=e.getCiphers=function(){return Object.keys(s).concat(n.getCiphers())}},function(t,e,r){var i=r(13),n=r(182),o=r(0),s=r(1).Buffer,a={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function u(t){i.call(this);var e,r=t.mode.toLowerCase(),n=a[r];e=t.decrypt?"decrypt":"encrypt";var o=t.key;s.isBuffer(o)||(o=s.from(o)),"des-ede"!==r&&"des-ede-cbc"!==r||(o=s.concat([o,o.slice(0,8)]));var u=t.iv;s.isBuffer(u)||(u=s.from(u)),this._des=n.create({key:o,iv:u,type:e})}a.des=a["des-cbc"],a.des3=a["des-ede3-cbc"],t.exports=u,o(u,i),u.prototype._update=function(t){return s.from(this._des.update(t))},u.prototype._final=function(){return s.from(this._des.final())}},function(t,e,r){"use strict";e.utils=r(96),e.Cipher=r(52),e.DES=r(97),e.CBC=r(183),e.EDE=r(184)},function(t,e,r){"use strict";var i=r(5),n=r(0),o={};function s(t){i.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},c.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),r=-1;++r>s%8,t._prev=o(t._prev,r?i:n);return a}function o(t,e){var r=t.length,n=-1,o=i.allocUnsafe(t.length);for(t=i.concat([t,i.from([e])]);++n>7;return o}e.encrypt=function(t,e,r){for(var o=e.length,s=i.allocUnsafe(o),a=-1;++a>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function s(t){this.h=t,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}s.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=o(n)},s.prototype.update=function(t){var e;for(this.cache=i.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},s.prototype.final=function(t,e){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=s},function(t,e,r){var i=r(101),n=r(1).Buffer,o=r(54),s=r(102),a=r(13),u=r(37),h=r(38);function f(t,e,r){a.call(this),this._cache=new l,this._last=void 0,this._cipher=new u.AES(e),this._prev=n.from(r),this._mode=t,this._autopadding=!0}function l(){this.cache=n.allocUnsafe(0)}function c(t,e,r){var a=o[t.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=n.from(e)),e.length!==a.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===a.type?new s(a.module,e,r,!0):"auth"===a.type?new i(a.module,e,r,!0):new f(a.module,e,r)}r(0)(f,a),f.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),i.push(r);return n.concat(i)},f.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");var r=-1;for(;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var r=o[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=h(e,!1,r.key,r.iv);return c(t,i.key,i.iv)},e.createDecipheriv=c},function(t,e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},function(t,e,r){(function(t){var i=r(103),n=r(200),o=r(201);var s={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var r=new t(n[e].prime,"hex"),i=new t(n[e].gen,"hex");return new o(r,i)},e.createDiffieHellman=e.DiffieHellman=function e(r,n,a,u){return t.isBuffer(n)||void 0===s[n]?e(r,"binary",n,a):(n=n||"binary",u=u||"binary",a=a||new t([2]),t.isBuffer(a)||(a=new t(a,u)),"number"==typeof r?new o(i(r,a),a,!0):(t.isBuffer(r)||(r=new t(r,n)),new o(r,a,!0)))}}).call(this,r(3).Buffer)},function(t,e){},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(198).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}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,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=u(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,f=r;f1&&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?""};var f=["","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],c=[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 d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!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&&i(!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,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,h=new t(o),f=this.clone();if(u){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.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 e;e=this.length>t.length?t:this;for(var r=0;rt.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 e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.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){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,b=g>>>13,y=0|s[3],w=8191&y,M=y>>>13,_=0|s[4],S=8191&_,k=_>>>13,A=0|s[5],E=8191&A,R=A>>>13,x=0|s[6],I=8191&x,O=x>>>13,j=0|s[7],B=8191&j,T=j>>>13,P=0|s[8],L=8191&P,C=P>>>13,D=0|s[9],N=8191&D,U=D>>>13,q=0|a[0],z=8191&q,F=q>>>13,W=0|a[1],Z=8191&W,H=W>>>13,K=0|a[2],G=8191&K,V=K>>>13,$=0|a[3],Y=8191&$,J=$>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(i=Math.imul(l,z))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,z)|0))<<13)|0;h=((o=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var vt=(h+(i=i+Math.imul(l,Z)|0)|0)+((8191&(n=(n=n+Math.imul(l,H)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,z),n=(n=Math.imul(v,F))+Math.imul(b,z)|0,o=Math.imul(b,F),i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,H)|0;var bt=(h+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,G)|0))<<13)|0;h=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,z),n=(n=Math.imul(w,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,V)|0;var yt=(h+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;h=((o=o+Math.imul(c,J)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(S,z),n=(n=Math.imul(S,F))+Math.imul(k,z)|0,o=Math.imul(k,F),i=i+Math.imul(w,Z)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,H)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var wt=(h+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,z),n=(n=Math.imul(E,F))+Math.imul(R,z)|0,o=Math.imul(R,F),i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(v,Y)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Mt=(h+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,z),n=(n=Math.imul(I,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(E,Z)|0,n=(n=n+Math.imul(E,H)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var _t=(h+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,z),n=(n=Math.imul(B,F))+Math.imul(T,z)|0,o=Math.imul(T,F),i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,H)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,J)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(h+(i=i+Math.imul(l,ut)|0)|0)+((8191&(n=(n=n+Math.imul(l,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(C,z)|0,o=Math.imul(C,F),i=i+Math.imul(B,Z)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(E,Y)|0,n=(n=n+Math.imul(E,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var kt=(h+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,z),n=(n=Math.imul(N,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(L,Z)|0,n=(n=n+Math.imul(L,H)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,V)|0,i=i+Math.imul(I,Y)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var At=(h+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(N,Z),n=(n=Math.imul(N,H))+Math.imul(U,Z)|0,o=Math.imul(U,H),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,V)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,V)|0,i=i+Math.imul(B,Y)|0,n=(n=n+Math.imul(B,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,i=i+Math.imul(v,lt)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var Et=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,V))+Math.imul(U,G)|0,o=Math.imul(U,V),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,J)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ht)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ct)|0;var Rt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(N,Y),n=(n=Math.imul(N,J))+Math.imul(U,Y)|0,o=Math.imul(U,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(E,ut)|0,n=(n=n+Math.imul(E,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,ct)|0;var xt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(N,Q),n=(n=Math.imul(N,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,it)|0,i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,i=i+Math.imul(E,lt)|0,n=(n=n+Math.imul(E,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var It=(h+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((o=o+Math.imul(k,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(N,rt),n=(n=Math.imul(N,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(L,ot)|0,n=(n=n+Math.imul(L,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var Ot=(h+(i=i+Math.imul(E,pt)|0)|0)+((8191&(n=(n=n+Math.imul(E,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(N,ot),n=(n=Math.imul(N,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ct)|0;var jt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(N,ut),n=(n=Math.imul(N,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ct)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(N,lt),n=(n=Math.imul(N,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Tt=(h+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var Pt=(h+(i=Math.imul(N,pt))|0)+((8191&(n=(n=Math.imul(N,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=bt,u[3]=yt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=St,u[8]=kt,u[9]=At,u[10]=Et,u[11]=Rt,u[12]=xt,u[13]=It,u[14]=Ot,u[15]=jt,u[16]=Bt,u[17]=Tt,u[18]=Pt,0!==h&&(u[19]=h,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,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 e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==f||h>=n);h--){var l=0|this.words[h];this.words[h]=f<<26-o|l>>>o,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},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){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(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 e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,u=i.length-n.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{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,e);var n,s,a},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 e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(u)):(r.isub(e),a.isub(n),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).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 e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},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){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}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 e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},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 S(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(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 i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(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 b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){S.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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(y,b),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var l=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}u=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(14)(t))},function(t,e){},function(t,e){},function(t){t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},function(t,e,r){(function(e){var i=r(104),n=new(r(105)),o=new i(24),s=new i(11),a=new i(10),u=new i(3),h=new i(7),f=r(103),l=r(22);function c(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._pub=new i(t),this}function d(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._priv=new i(t),this}t.exports=m;var p={};function m(t,e,r){this.setGenerator(e),this.__prime=new i(t),this._prime=i.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=c,this.setPrivateKey=d):this._primeCode=8}function g(t,r){var i=new e(t.toArray());return r?i.toString(r):i}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString("hex"),i=[r,t.toString(16)].join("_");if(i in p)return p[i];var l,c=0;if(t.isEven()||!f.simpleSieve||!f.fermatTest(t)||!n.test(t))return c+=1,c+="02"===r||"05"===r?8:4,p[i]=c,c;switch(n.test(t.shrn(1))||(c+=2),r){case"02":t.mod(o).cmp(s)&&(c+=8);break;case"05":(l=t.mod(a)).cmp(u)&&l.cmp(h)&&(c+=8);break;default:c+=4}return p[i]=c,c}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new i(l(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(t){var r=(t=(t=new i(t)).toRed(this._prime)).redPow(this._priv).fromRed(),n=new e(r.toArray()),o=this.getPrime();if(n.length0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,r,i,n=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=n,i=a,s.prototype.copy.call(e,r,i),a+=o.data.length,o=o.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0==(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:u,value:function(t,e){return a(this,function(t){for(var e=1;e0,(function(t){i||(i=t),t&&s.forEach(h),o||(s.forEach(h),n(i))}))}));return e.reduce(f)}},function(t,e,r){var i=r(56).Buffer,n=r(88),o=r(58),s=r(60).ec,a=r(59),u=r(40),h=r(123);function f(t,e,r,o){if((t=i.from(t.toArray())).length0&&r.ishrn(i),r}function c(t,e,r){var o,s;do{for(o=i.alloc(0);8*o.length=0&&(s=e,a=r),i.negative&&(i=i.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:i,b:o},{a:s,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=n.mul(r.a),a=o.mul(i.a),u=n.mul(r.b),h=o.mul(i.b);return{k1:t.sub(s).sub(a),k2:u.add(h).neg()}},u.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=i.fromRed().isOdd();return(e&&!o||!e&&o)&&(i=i.redNeg()),this.point(t,i)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o":""},h.prototype.isInfinity=function(){return this.inf},h.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},h.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),s=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},h.prototype.getX=function(){return this.x.fromRed()},h.prototype.getY=function(){return this.y.fromRed()},h.prototype.mul=function(t){return t=new n(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},h.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},h.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},h.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},h.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(f,s.BasePoint),u.prototype.jpoint=function(t,e,r){return new f(this,t,e,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=i.redSub(n),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),f=h.redMul(a),l=i.redMul(h),c=u.redSqr().redIAdd(f).redISub(l).redISub(l),d=u.redMul(l.redISub(c)).redISub(o.redMul(f)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(c,d,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(i),a=n.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),h=u.redMul(s),f=r.redMul(u),l=a.redSqr().redIAdd(h).redISub(f).redISub(f),c=a.redMul(f.redISub(l)).redISub(n.redMul(h)),d=this.z.redMul(s);return this.curve.jpoint(l,c,d)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,r){"use strict";var i=r(11),n=r(0),o=r(39),s=r(6);function a(t){o.call(this,"mont",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(a,o),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},n(u,o.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},a.prototype.point=function(t,e){return new u(this,t,e)},a.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),s=n.redMul(i),a=e.z.redMul(o.redAdd(s).redSqr()),u=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var o=n.length-1;o>=0;o--)0===n[o]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,r){"use strict";var i=r(6),n=r(11),o=r(0),s=r(39),a=i.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,s.call(this,"edwards",t),this.a=new n(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function h(t,e,r,i,o){s.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(e,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=o&&new n(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(u,s),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},u.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=i.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(e&&!u||!e&&u)&&(a=a.redNeg()),this.point(t,a)},u.prototype.pointFromY=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=i.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},o(h,s.BasePoint),u.prototype.pointFromJSON=function(t){return h.fromJSON(this,t)},u.prototype.point=function(t,e,r,i){return new h(this,t,e,r,i)},h.fromJSON=function(t,e){return new h(t,e[0],e[1],e[2])},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},h.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=i.redAdd(e),s=o.redSub(r),a=i.redSub(e),u=n.redMul(s),h=o.redMul(a),f=n.redMul(a),l=s.redMul(o);return this.curve.point(u,h,l,f)},h.prototype._projDbl=function(){var t,e,r,i,n,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var h=(i=this.curve._mulA(a)).redAdd(u);this.zOne?(t=s.redSub(a).redSub(u).redMul(h.redSub(this.curve.two)),e=h.redMul(i.redSub(u)),r=h.redSqr().redSub(h).redSub(h)):(n=this.z.redSqr(),o=h.redSub(n).redISub(n),t=s.redSub(a).redISub(u).redMul(o),e=h.redMul(i.redSub(u)),r=h.redMul(o))}else i=a.redAdd(u),n=this.curve._mulC(this.z).redSqr(),o=i.redSub(n).redSub(n),t=this.curve._mulC(s.redISub(i)).redMul(o),e=this.curve._mulC(i).redMul(a.redISub(u)),r=i.redMul(o);return this.curve.point(t,e,r)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},h.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),s=n.redSub(i),a=n.redAdd(i),u=r.redAdd(e),h=o.redMul(s),f=a.redMul(u),l=o.redMul(u),c=s.redMul(a);return this.curve.point(h,f,c,l)},h.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),u=n.redSub(a),h=n.redAdd(a),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),l=i.redMul(u).redMul(f);return this.curve.twisted?(e=i.redMul(h).redMul(s.redSub(this.curve._mulA(o))),r=u.redMul(h)):(e=i.redMul(h).redMul(s.redSub(o)),r=this.curve._mulC(u).redMul(h)),this.curve.point(l,e,r)},h.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},h.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},h.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},h.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},h.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},h.prototype.getX=function(){return this.normalize(),this.x.fromRed()},h.prototype.getY=function(){return this.normalize(),this.y.fromRed()},h.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},h.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},h.prototype.toP=h.prototype.normalize,h.prototype.mixedAdd=h.prototype.add},function(t,e,r){"use strict";e.sha1=r(219),e.sha224=r(220),e.sha256=r(115),e.sha384=r(221),e.sha512=r(116)},function(t,e,r){"use strict";var i=r(9),n=r(33),o=r(114),s=i.rotl32,a=i.sum32,u=i.sum32_5,h=o.ft_1,f=n.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function c(){if(!(this instanceof c))return new c;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(c,f),t.exports=c,c.blockSize=512,c.outSize=160,c.hmacStrength=80,c.padLength=64,c.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest()),n(t.length<=this.blockSize);for(var e=t.length;e0))return s.iaddn(1),this.keyFromPrivate(s)}},l.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},l.prototype.sign=function(t,e,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new i(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),u=t.toArray("be",s),h=new n({hash:this.hash,entropy:a,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),l=this.n.sub(new i(1)),c=0;;c++){var d=o.k?o.k(c):new i(h.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(l)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var v=d.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(0!==(v=v.umod(this.n)).cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),b^=1),new f({r:g,s:v,recoveryParam:b})}}}}}},l.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n);var o=(e=new f(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),h=u.mul(t).umod(this.n),l=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(h,r.getPublic(),l)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(h,r.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},l.prototype.recoverPubKey=function(t,e,r,n){u((3&r)===r,"The recovery param is more than two bits"),e=new f(e,n);var o=this.n,s=new i(t),a=e.r,h=e.s,l=1&r,c=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var d=e.r.invm(o),p=o.sub(s).mul(d).umod(o),m=h.mul(d).umod(o);return this.g.mulAdd(p,a,m)},l.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new f(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},function(t,e,r){"use strict";var i=r(62),n=r(112),o=r(5);function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=n.toArray(t.entropy,t.entropyEnc||"hex"),r=n.toArray(t.nonce,t.nonceEnc||"hex"),i=n.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}t.exports=s,s.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},s.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var o=[];o.length"}},function(t,e,r){"use strict";var i=r(11),n=r(6),o=n.assert;function s(t,e){if(t instanceof s)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new i(t.r,16),this.s=new i(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,o=0,s=e.place;o>>=0;return!(n<=127)&&(e.place=s,n)}function h(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=s,s.prototype._importDER=function(t,e){t=n.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var s=u(t,r);if(!1===s)return!1;var h=t.slice(r.place,s+r.place);if(r.place+=s,2!==t[r.place++])return!1;var f=u(t,r);if(!1===f)return!1;if(t.length!==f+r.place)return!1;var l=t.slice(r.place,f+r.place);if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new i(h),this.s=new i(l),this.recoveryParam=null,!0},s.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=h(e),r=h(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];f(i,e.length),(i=i.concat(e)).push(2),f(i,r.length);var o=i.concat(r),s=[48];return f(s,o.length),s=s.concat(o),n.encode(s,t)}},function(t,e,r){"use strict";var i=r(62),n=r(61),o=r(6),s=o.assert,a=o.parseBytes,u=r(230),h=r(231);function f(t){if(s("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof f))return new f(t);t=n[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}t.exports=f,f.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),o=this.encodePoint(n),s=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),u=i.add(s).umod(this.curve.n);return this.makeSignature({R:n,S:u,Rencoded:o})},f.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(o)},f.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=e)throw new Error("invalid sig")}t.exports=function(t,e,r,h,f){var l=s(r);if("ec"===l.type){if("ecdsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong public key type");return function(t,e,r){var i=a[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new o(i),s=r.data.subjectPrivateKey.data;return n.verify(e,t,s)}(t,e,l)}if("dsa"===l.type){if("dsa"!==h)throw new Error("wrong public key type");return function(t,e,r){var i=r.data.p,o=r.data.q,a=r.data.g,h=r.data.pub_key,f=s.signature.decode(t,"der"),l=f.s,c=f.r;u(l,o),u(c,o);var d=n.mont(i),p=l.invm(o);return 0===a.toRed(d).redPow(new n(e).mul(p).mod(o)).fromRed().mul(h.toRed(d).redPow(c.mul(p).mod(o)).fromRed()).mod(i).mod(o).cmp(c)}(t,e,l)}if("rsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong public key type");e=i.concat([f,e]);for(var c=l.modulus.byteLength(),d=[1],p=0;e.length+d.length+2=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}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,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=u(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,f=r;f1&&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?""};var f=["","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],c=[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 d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s>>24-n&16777215)||s!==this.length-1?f[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!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&&i(!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,e){return i(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,h=new t(o),f=this.clone();if(u){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.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 e;e=this.length>t.length?t:this;for(var r=0;rt.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 e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.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){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,b=g>>>13,y=0|s[3],w=8191&y,M=y>>>13,_=0|s[4],S=8191&_,k=_>>>13,A=0|s[5],E=8191&A,R=A>>>13,x=0|s[6],I=8191&x,O=x>>>13,j=0|s[7],B=8191&j,T=j>>>13,P=0|s[8],L=8191&P,C=P>>>13,D=0|s[9],N=8191&D,U=D>>>13,q=0|a[0],z=8191&q,F=q>>>13,W=0|a[1],Z=8191&W,H=W>>>13,K=0|a[2],G=8191&K,V=K>>>13,$=0|a[3],Y=8191&$,J=$>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ft=0|a[8],lt=8191&ft,ct=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(i=Math.imul(l,z))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(c,z)|0))<<13)|0;h=((o=Math.imul(c,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var vt=(h+(i=i+Math.imul(l,Z)|0)|0)+((8191&(n=(n=n+Math.imul(l,H)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,z),n=(n=Math.imul(v,F))+Math.imul(b,z)|0,o=Math.imul(b,F),i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,H)|0;var bt=(h+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,G)|0))<<13)|0;h=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,z),n=(n=Math.imul(w,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,V)|0;var yt=(h+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(c,Y)|0))<<13)|0;h=((o=o+Math.imul(c,J)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(S,z),n=(n=Math.imul(S,F))+Math.imul(k,z)|0,o=Math.imul(k,F),i=i+Math.imul(w,Z)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,H)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var wt=(h+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,z),n=(n=Math.imul(E,F))+Math.imul(R,z)|0,o=Math.imul(R,F),i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(v,Y)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Mt=(h+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,z),n=(n=Math.imul(I,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(E,Z)|0,n=(n=n+Math.imul(E,H)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var _t=(h+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(B,z),n=(n=Math.imul(B,F))+Math.imul(T,z)|0,o=Math.imul(T,F),i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,H)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,J)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(h+(i=i+Math.imul(l,ut)|0)|0)+((8191&(n=(n=n+Math.imul(l,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(C,z)|0,o=Math.imul(C,F),i=i+Math.imul(B,Z)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,H)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(E,Y)|0,n=(n=n+Math.imul(E,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var kt=(h+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,z),n=(n=Math.imul(N,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(L,Z)|0,n=(n=n+Math.imul(L,H)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,H)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,V)|0,i=i+Math.imul(I,Y)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var At=(h+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(N,Z),n=(n=Math.imul(N,H))+Math.imul(U,Z)|0,o=Math.imul(U,H),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,V)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,V)|0,i=i+Math.imul(B,Y)|0,n=(n=n+Math.imul(B,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,i=i+Math.imul(v,lt)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var Et=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,V))+Math.imul(U,G)|0,o=Math.imul(U,V),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,J)|0,i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ht)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ct)|0;var Rt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(N,Y),n=(n=Math.imul(N,J))+Math.imul(U,Y)|0,o=Math.imul(U,J),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(E,ut)|0,n=(n=n+Math.imul(E,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,ct)|0;var xt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(N,Q),n=(n=Math.imul(N,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,it)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,it)|0,i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,i=i+Math.imul(E,lt)|0,n=(n=n+Math.imul(E,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var It=(h+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((o=o+Math.imul(k,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(N,rt),n=(n=Math.imul(N,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(L,ot)|0,n=(n=n+Math.imul(L,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var Ot=(h+(i=i+Math.imul(E,pt)|0)|0)+((8191&(n=(n=n+Math.imul(E,mt)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(N,ot),n=(n=Math.imul(N,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ct)|0;var jt=(h+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(N,ut),n=(n=Math.imul(N,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(L,lt)|0,n=(n=n+Math.imul(L,ct)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ct)|0;var Bt=(h+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(N,lt),n=(n=Math.imul(N,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var Tt=(h+(i=i+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var Pt=(h+(i=Math.imul(N,pt))|0)+((8191&(n=(n=Math.imul(N,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=bt,u[3]=yt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=St,u[8]=kt,u[9]=At,u[10]=Et,u[11]=Rt,u[12]=xt,u[13]=It,u[14]=Ot,u[15]=jt,u[16]=Bt,u[17]=Tt,u[18]=Pt,0!==h&&(u[19]=h,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,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 e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==f||h>=n);h--){var l=0|this.words[h];this.words[h]=f<<26-o|l>>>o,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},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){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(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 e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var a,u=i.length-n.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{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,e);var n,s,a},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 e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(f),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),s.isub(u)):(r.isub(e),a.isub(n),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(n=0===e.cmpn(1)?s:a).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 e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},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){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,a&=67108863,this.words[s]=a}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 e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},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 S(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(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 i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(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 b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){S.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)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(y,b),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();i(g=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var l=h>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===i&&0===f)&&(n=this.mul(n,r[s]),a=0,s=0)):a=0}u=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(14)(t))},function(t,e){},function(t,e,r){e.publicEncrypt=r(247),e.privateDecrypt=r(249),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}},function(t,e,r){var i=r(40),n=r(22),o=r(30),s=r(124),a=r(125),u=r(67),h=r(126),f=r(58),l=r(1).Buffer;t.exports=function(t,e,r){var c;c=t.padding?t.padding:r?1:4;var d,p=i(t);if(4===c)d=function(t,e){var r=t.modulus.byteLength(),i=e.length,h=o("sha1").update(l.alloc(0)).digest(),f=h.length,c=2*f;if(i>r-c-2)throw new Error("message too long");var d=l.alloc(r-i-c-2),p=r-f-1,m=n(f),g=a(l.concat([h,d,l.alloc(1,1),e],p),s(m,p)),v=a(m,s(g,f));return new u(l.concat([l.alloc(1),v,g],r))}(p,e);else if(1===c)d=function(t,e,r){var i,o=e.length,s=t.modulus.byteLength();if(o>s-11)throw new Error("message too long");i=r?l.alloc(s-o-3,255):function(t){var e,r=l.allocUnsafe(t),i=0,o=n(2*t),s=0;for(;i=0)throw new Error("data too long for modulus")}return r?f(d,p):h(d,p)}},function(t,e){},function(t,e,r){var i=r(40),n=r(124),o=r(125),s=r(67),a=r(58),u=r(30),h=r(126),f=r(1).Buffer;t.exports=function(t,e,r){var l;l=t.padding?t.padding:r?1:4;var c,d=i(t),p=d.modulus.byteLength();if(e.length>p||new s(e).cmp(d.modulus)>=0)throw new Error("decryption error");c=r?h(new s(e),d):a(e,d);var m=f.alloc(p-c.length);if(c=f.concat([m,c],p),4===l)return function(t,e){var r=t.modulus.byteLength(),i=u("sha1").update(f.alloc(0)).digest(),s=i.length;if(0!==e[0])throw new Error("decryption error");var a=e.slice(1,s+1),h=e.slice(s+1),l=o(a,n(h,s)),c=o(h,n(l,r-s-1));if(function(t,e){t=f.from(t),e=f.from(e);var r=0,i=t.length;t.length!==e.length&&(r++,i=Math.min(t.length,e.length));var n=-1;for(;++n=e.length){o++;break}var s=e.slice(2,n-1);("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&o++;s.length<8&&o++;if(o)throw new Error("decryption error");return e.slice(n)}(0,c,r);if(3===l)return c;throw new Error("unknown padding")}},function(t,e,r){"use strict";(function(t,i){function n(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=r(1),s=r(22),a=o.Buffer,u=o.kMaxLength,h=t.crypto||t.msCrypto,f=Math.pow(2,32)-1;function l(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>f||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function c(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>f||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>u)throw new RangeError("buffer too small")}function d(t,e,r,n){if(i.browser){var o=t.buffer,a=new Uint8Array(o,e,r);return h.getRandomValues(a),n?void i.nextTick((function(){n(null,t)})):t}if(!n)return s(r).copy(t,e),t;s(r,(function(r,i){if(r)return n(r);i.copy(t,e),n(null,t)}))}h&&h.getRandomValues||!i.browser?(e.randomFill=function(e,r,i,n){if(!(a.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)n=r,r=0,i=e.length;else if("function"==typeof i)n=i,i=e.length-r;else if("function"!=typeof n)throw new TypeError('"cb" argument must be a function');return l(r,e.length),c(i,r,e.length),d(e,r,i,n)},e.randomFillSync=function(e,r,i){void 0===r&&(r=0);if(!(a.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');l(r,e.length),void 0===i&&(i=e.length-r);return c(i,r,e.length),d(e,r,i)}):(e.randomFill=n,e.randomFillSync=n)}).call(this,r(2),r(4))},function(t,e,r){(function(t){var i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i=o)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&e._extend(i,r),b(i.showHidden)&&(i.showHidden=!1),b(i.depth)&&(i.depth=2),b(i.colors)&&(i.colors=!1),b(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),f(i,t,i.depth)}function u(t,e){var r=a.styles[e];return r?"["+a.colors[r][0]+"m"+t+"["+a.colors[r][1]+"m":t}function h(t,e){return t}function f(t,r,i){if(t.customInspect&&r&&S(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return v(n)||(n=f(t,n,i)),n}var o=function(t,e){if(b(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(g(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(o)return o;var s=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(r)),_(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(r);if(0===s.length){if(S(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(y(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(M(r))return t.stylize(Date.prototype.toString.call(r),"date");if(_(r))return l(r)}var h,w="",k=!1,A=["{","}"];(d(r)&&(k=!0,A=["[","]"]),S(r))&&(w=" [Function"+(r.name?": "+r.name:"")+"]");return y(r)&&(w=" "+RegExp.prototype.toString.call(r)),M(r)&&(w=" "+Date.prototype.toUTCString.call(r)),_(r)&&(w=" "+l(r)),0!==s.length||k&&0!=r.length?i<0?y(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),h=k?function(t,e,r,i,n){for(var o=[],s=0,a=e.length;s=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,w,A)):A[0]+w+A[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function c(t,e,r,i,n,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),x(i,n)||(s="["+n+"]"),a||(t.seen.indexOf(u.value)<0?(a=m(r)?f(t,u.value,null):f(t,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),b(s)){if(o&&n.match(/^\d+$/))return a;(s=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function d(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function g(t){return"number"==typeof t}function v(t){return"string"==typeof t}function b(t){return void 0===t}function y(t){return w(t)&&"[object RegExp]"===k(t)}function w(t){return"object"==typeof t&&null!==t}function M(t){return w(t)&&"[object Date]"===k(t)}function _(t){return w(t)&&("[object Error]"===k(t)||t instanceof Error)}function S(t){return"function"==typeof t}function k(t){return Object.prototype.toString.call(t)}function A(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(b(o)&&(o=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!s[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var i=t.pid;s[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,i,t)}}else s[r]=function(){};return s[r]},e.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=g,e.isString=v,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=b,e.isRegExp=y,e.isObject=w,e.isDate=M,e.isError=_,e.isFunction=S,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(252);var E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(){var t=new Date,e=[A(t.getHours()),A(t.getMinutes()),A(t.getSeconds())].join(":");return[t.getDate(),E[t.getMonth()],e].join(" ")}function x(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",R(),e.format.apply(e,arguments))},e.inherits=r(253),e._extend=function(t,e){if(!e||!w(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var I="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function O(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(I&&t[I]){var e;if("function"!=typeof(e=t[I]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,I,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],o=0;o"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[t]).join("")},e.decode=function(e,r){const n=Array.from(e,t=>{const e=t.charCodeAt(0);return e<58?e-48:e<91?e-55:e-61});return t.from(i(n,{from:62,to:256,fixedLength:r}))}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";const i=(t,e,r)=>Math.ceil(t.length*Math.log2(e)/Math.log2(r));t.exports=function(t,{from:e,to:r,fixedLength:n=null}){const o=null===n?i(t,e,r):n,s=new Array(o);let a=o,u=t;for(;u.length>0;){if(0===a)throw new RangeError(`Fixed length of ${n} is too small, expected at least ${i(t,e,r)}`);const o=[];let h=0;for(const t of u){const i=t+h*e,n=Math.floor(i/r);h=i%r,(o.length>0||n>0)&&o.push(n)}s[--a]=h,u=o}if(null===n)return a>0?s.slice(a):s;for(;a>0;)s[--a]=0;return s}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.useRateLimiter=void 0;e.useRateLimiter=(t,e,r)=>async()=>!!await t.get(e)||(await t.put(e,!0,r),!1)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GetPickerData=void 0;const i=r(127),n=r(21),o=r(7),s=r(10),a=r(20),u=()=>o.respond({error:"guild not found"},{status:404});e.GetPickerData=s.withSession(t=>async e=>{const r=new URL(e.url),[,,s]=r.pathname.split("/");if(!s)return o.respond({error:"missing guild id"},{status:400});const{id:h}=t.user,f=t.guilds.find(t=>t.id===s);if(!f)return u();const l=await a.getGuild(s,{skipCachePull:r.searchParams.has("__no_cache")});if(!l)return u();const c=a.getGuildMember({serverID:s,userID:h}),d=a.getGuildData(s),[p,m]=await Promise.all([d,c]);if(!m)return u();if(!i.memberPassesAccessControl(f,m,p.accessControl))return n.accessControlViolation();const g={id:s,guild:f,roles:l.roles,member:{roles:m.roles},data:p};return o.respond(g)})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GetSession=void 0;const i=r(7),n=r(10);e.GetSession=n.withSession(t=>()=>{const{user:e,guilds:r,sessionID:n}=t||{};return i.respond({user:e,guilds:r,sessionID:n})})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GetSlug=void 0;const i=r(7),n=r(20);e.GetSlug=async t=>{const e=new URL(t.url),[,,r]=e.pathname.split("/");if(!r)return i.respond({error:"missing server ID"},{status:400});const o=await n.getGuild(r);if(!o)return i.respond({error:"guild not found"},{status:404});const{id:s,name:a,icon:u}=o,h={id:s,name:a,icon:u,permissionLevel:0};return i.respond(h)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LoginBounce=void 0;const i=r(7),n=r(10),o=r(43),s=r(8);e.LoginBounce=async t=>{const e={},{cbh:r}=i.getQuery(t);r&&n.isAllowedCallbackHost(r)&&(e.callbackHost=r);const a=await n.setupStateSession(e),u=s.apiPublicURI+"/login-callback",h=s.botClientID;return o.Bounce(`https://discord.com/api/oauth2/authorize?client_id=${(f={state:a,redirectURI:u,clientID:h}).clientID}&response_type=code&scope=identify%20guilds&prompt=none&redirect_uri=${encodeURIComponent(f.redirectURI)}&state=${f.state}`);var f}},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.LoginCallback=void 0;const n=r(7),o=i(r(44)),s=r(10),a=r(43),u=r(8),h=r(28),f=t=>a.Bounce(u.uiPublicURI+"/machinery/error?error_code=authFailure"+(t?"&extra="+t:""));e.LoginCallback=s.resolveFailures(f,async t=>{let e=u.uiPublicURI;const r=new URL(t.url).searchParams,i=r.get("state");if(null===i)return f("state missing");try{const t=o.default.parse(i),r=t.date.getTime()+3e5;if(Date.now()>r)return f("state expired");const n=await s.getStateSession(t.string);(null==n?void 0:n.callbackHost)&&s.isAllowedCallbackHost(n.callbackHost)&&(e=n.callbackHost)}catch(t){return f("state invalid")}const d=r.get("code");if(!d)return f("code missing");const p={client_id:u.botClientID,client_secret:u.botClientSecret,grant_type:"authorization_code",redirect_uri:u.apiPublicURI+"/login-callback",scope:"identify guilds",code:d},m=await fetch(n.discordAPIBase+"/oauth2/token",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded","user-agent":n.userAgent},body:s.formData(p)}),g=await m.json();if(!g.access_token)return f("token response invalid");const[v,b,y]=await Promise.all([o.default.random(),l(g.access_token),c(g.access_token)]);if(!b)return f("failed to fetch user");const w={tokens:g,sessionID:v.string,user:b,guilds:y};return await h.Sessions.put(v.string,w,21600),a.Bounce(e+"machinery/new-session/"+v.string)});const l=async t=>{const e=await n.discordFetch("/users/@me",t,n.AuthType.Bearer);if(!e)return null;const{id:r,username:i,discriminator:o,bot:s,avatar:a}=e;return{id:r,username:i,discriminator:o,bot:s,avatar:a}},c=async t=>{const e=await n.discordFetch("/users/@me/guilds",t,n.AuthType.Bearer);if(!e)return[];return e.map(t=>({id:t.id,name:t.name,icon:t.icon,permissionLevel:s.parsePermissions(BigInt(t.permissions),t.owner)}))}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RevokeSession=void 0;const i=r(7),n=r(10),o=r(8),s=r(28);e.RevokeSession=n.withSession(t=>async e=>{const r={token:t.tokens.access_token,client_id:o.botClientID,client_secret:o.botClientSecret};return await fetch(i.discordAPIBase+"/oauth2/token/revoke",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded","user-agent":i.userAgent},body:n.formData(r)}),await s.Sessions.delete(t.sessionID),i.respond({ok:!0})})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SyncFromLegacy=void 0;const i=r(20),n=r(264),o=r(28),s=r(21);e.SyncFromLegacy=i.asEditor({rateLimitKey:i.GuildRateLimiterKey.legacyImport,rateLimitTimeoutSeconds:1200},(t,{guildID:e})=>async t=>{const r=await n.fetchLegacyServer(e);if(!r)return s.notFound();const i=n.transformLegacyGuild(r);return await o.GuildData.put(e,i),s.ok()})},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.transformLegacyGuild=e.fetchLegacyServer=void 0;const n=r(265),o=r(15),s=i(r(44)),a=r(8);e.fetchLegacyServer=async t=>{const e=await fetch("https://beta.roleypoly.com/x/import-to-next/"+t,{headers:{authorization:"Shared "+a.importSharedKey}});if(404===e.status)return null;if(200!==e.status)throw new Error("Guild data fetch failed");return await e.json()};e.transformLegacyGuild=t=>({id:t.id,message:t.message,features:o.Features.LegacyGuild,auditLogWebhook:null,accessControl:{allowList:[],blockList:[],blockPending:!0},categories:n.sortBy(Object.values(t.categories),"position").map((t,e)=>({...t,id:s.default.randomSync().string,position:e,type:"multi"===t.type?o.CategoryType.Multi:o.CategoryType.Single}))})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sortBy=void 0;e.sortBy=(t,e,r)=>t.sort((t,i)=>r?r(t[e],i[e]):t[e]===i[e]?0:t[e]>i[e]?1:-1)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UpdateGuild=void 0;const i=r(267),n=r(15),o=r(20),s=r(28),a=r(21);e.UpdateGuild=o.asEditor({},(t,{guildID:e,guild:r})=>async u=>{const h=await u.json(),f=await o.getGuildData(e),l={...f,...h};if(f.auditLogWebhook!==l.auditLogWebhook)try{const t=await i.validateAuditLogWebhook(r,l.auditLogWebhook);if(t!==n.WebhookValidationStatus.Ok){if(t!==n.WebhookValidationStatus.NoneSet)return a.invalid({what:"webhookValidationStatus",webhookValidationStatus:t});l.auditLogWebhook=null}}catch(t){a.invalid()}await s.GuildData.put(e,l);try{await i.sendAuditLog(f,h,t.user)}catch(t){}return a.ok()})},function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.validateAuditLogWebhook=e.sendAuditLog=void 0;const n=r(8),o=r(15),s=r(7),a=i(r(268)),u=r(68),h={message:(t,e)=>[{timestamp:(new Date).toISOString(),color:4537917,fields:[{name:"Old Message",value:t,inline:!1},{name:"New Message",value:e,inline:!1}],title:"Server message was updated..."}],auditLogWebhook:(t,e)=>[{timestamp:(new Date).toISOString(),color:6116178,fields:[{name:"Old Webhook ID",value:t?t.split("/")[5]:"*unset*",inline:!1},{name:"New Webhook ID",value:e?e.split("/")[5]:"*unset*",inline:!1}],title:"Audit Log webhook URL was changed..."}],categories:(t,e)=>[{timestamp:(new Date).toISOString(),color:11246490,fields:[{name:"Changed Categories",value:f(t,e).join("\n"),inline:!1}],title:"Categories were changed..."}],accessControl:(t,e)=>[{timestamp:(new Date).toISOString(),color:11246490,fields:[{name:"Changed Access Control",value:l(t,e).join("\n"),inline:!1}],title:"Access Control was changed..."}]};e.sendAuditLog=async(t,e,r)=>{const i=u.uniq([t.auditLogWebhook||"",e.auditLogWebhook||""]).filter(t=>""!==t);if(0===i.length)return;const o=Object.keys(e),f={username:"Roleypoly (Audit Log)",avatar_url:"https://next.roleypoly.com/logo192.png",embeds:[{fields:[],timestamp:(new Date).toISOString(),title:`${r.username}#${r.discriminator} has edited Roleypoly settings`,color:3353901,author:{name:r.username,icon_url:`https://cdn.discordapp.com/avatars/${r.id}/${r.avatar}.png`}}],provider:{name:"Roleypoly",url:n.uiPublicURI}};for(let r of o){if(a.default(e[r],t[r]))continue;const i=h[r];if(!i)continue;const n=i(t[r],e[r]);f.embeds.push(...n)}if(1===f.embeds.length)return;f.embeds=u.sortBy(f.embeds,"color");await Promise.all(i.map(t=>(t=>fetch(t,{method:"POST",body:JSON.stringify(f),headers:{"content-type":"application/json","user-agent":s.userAgent}}))(t)))};e.validateAuditLogWebhook=async(t,e)=>{if(!e)return o.WebhookValidationStatus.NoneSet;const r=new URL(e);if("discord.com"!==r.hostname||"https:"!==r.protocol||r.pathname.startsWith("api/webhooks/"))return o.WebhookValidationStatus.NotDiscordURL;const i=await fetch(e,{method:"GET"});if(200!==i.status)return o.WebhookValidationStatus.DoesNotExist;return(await i.json()).guild_id!==t.id?o.WebhookValidationStatus.NotSameGuild:o.WebhookValidationStatus.Ok};const f=(t,e)=>{const r=e.filter(e=>!t.find(t=>t.id===e.id)),i=t.filter(t=>!e.find(e=>e.id===t.id)),n=e.filter(r=>t.find(t=>t.id===r.id)&&!a.default(t.find(t=>t.id===r.id),e.find(t=>t.id===r.id)));return[...r.map(t=>"➕ **Added** "+t.name),...i.map(t=>"➖ **Removed** "+t.name),...n.map(t=>"🔧 **Changed** "+t.name)]},l=(t,e)=>{const r=e.blockPending!==t.blockPending;return["✅ Allowed roles: "+(e.allowList.map(t=>`<@&${t}>`).join(", ")||"*all roles*"),"❌ Blocked roles: "+(e.blockList.map(t=>`<@&${t}>`).join(", ")||"*no roles*"),...r?["🔧 Pending/Welcome Screening users are "+(e.blockPending?"blocked ❌":"allowed ✔")]:[]]}},function(t,e,r){"use strict";var i=r(69),n=r(270),o=r(271),s=r(275),a=r(276),u=r(278),h=r(279),f=r(280),l=r(29),c=r(12),d=r(285),p=r(290),m=r(295),g=r(300),v=r(302),b=c("Date.prototype.getTime"),y=Object.getPrototypeOf,w=c("Object.prototype.toString"),M=l("%Set%",!0),_=c("Map.prototype.has",!0),S=c("Map.prototype.get",!0),k=c("Map.prototype.size",!0),A=c("Set.prototype.add",!0),E=c("Set.prototype.delete",!0),R=c("Set.prototype.has",!0),x=c("Set.prototype.size",!0);function I(t,e,r,i){for(var n,o=p(t);(n=o.next())&&!n.done;)if(P(e,n.value,r,i))return E(t,n.value),!0;return!1}function O(t){return void 0===t?null:"object"!=typeof t?"symbol"!=typeof t&&("string"!=typeof t&&"number"!=typeof t||+t==+t):void 0}function j(t,e,r,i,n,o){var s=O(r);if(null!=s)return s;var a=S(e,s),u=v({},n,{strict:!1});return!(void 0===a&&!_(e,s)||!P(i,a,u,o))&&(!_(t,s)&&P(i,a,u,o))}function B(t,e,r){var i=O(r);return null!=i?i:R(e,i)&&!R(t,i)}function T(t,e,r,i,n,o){for(var s,a,u=p(t);(s=u.next())&&!s.done;)if(P(r,a=s.value,n,o)&&P(i,S(e,a),n,o))return E(t,a),!0;return!1}function P(t,e,r,l){var c=r||{};if(c.strict?o(t,e):t===e)return!0;if(f(t)!==f(e))return!1;if(!t||!e||"object"!=typeof t&&"object"!=typeof e)return c.strict?o(t,e):t==e;var m,E=l.has(t),O=l.has(e);if(E&&O){if(l.get(t)===l.get(e))return!0}else m={};return E||l.set(t,m),O||l.set(e,m),function(t,e,r,o){var f,l;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(w(t)!==w(e))return!1;if(n(t)!==n(e))return!1;var c=u(t),m=u(e);if(c!==m)return!1;var E=t instanceof Error,O=e instanceof Error;if(E!==O)return!1;if((E||O)&&(t.name!==e.name||t.message!==e.message))return!1;var C=s(t),D=s(e);if(C!==D)return!1;if((C||D)&&(t.source!==e.source||a(t)!==a(e)))return!1;var N=h(t),U=h(e);if(N!==U)return!1;if((N||U)&&b(t)!==b(e))return!1;if(r.strict&&y&&y(t)!==y(e))return!1;if(g(t)!==g(e))return!1;var q=L(t),z=L(e);if(q!==z)return!1;if(q||z){if(t.length!==e.length)return!1;for(f=0;f=0;f--)if(F[f]!=W[f])return!1;for(f=F.length-1;f>=0;f--)if(l=F[f],!P(t[l],e[l],r,o))return!1;var Z=d(t),H=d(e);if(Z!==H)return!1;if("Set"===Z||"Set"===H)return function(t,e,r,i){if(x(t)!==x(e))return!1;var n,o,s,a=p(t),u=p(e);for(;(n=a.next())&&!n.done;)if(n.value&&"object"==typeof n.value)s||(s=new M),A(s,n.value);else if(!R(e,n.value)){if(r.strict)return!1;if(!B(t,e,n.value))return!1;s||(s=new M),A(s,n.value)}if(s){for(;(o=u.next())&&!o.done;)if(o.value&&"object"==typeof o.value){if(!I(s,o.value,r.strict,i))return!1}else if(!r.strict&&!R(t,o.value)&&!I(s,o.value,r.strict,i))return!1;return 0===x(s)}return!0}(t,e,r,o);if("Map"===Z)return function(t,e,r,i){if(k(t)!==k(e))return!1;var n,o,s,a,u,h,f=p(t),l=p(e);for(;(n=f.next())&&!n.done;)if(a=n.value[0],u=n.value[1],a&&"object"==typeof a)s||(s=new M),A(s,a);else if(void 0===(h=S(e,a))&&!_(e,a)||!P(u,h,r,i)){if(r.strict)return!1;if(!j(t,e,a,u,r,i))return!1;s||(s=new M),A(s,a)}if(s){for(;(o=l.next())&&!o.done;)if(a=o.value[0],h=o.value[1],a&&"object"==typeof a){if(!T(s,t,a,h,r,i))return!1}else if(!(r.strict||t.has(a)&&P(S(t,a),h,r,i)||T(s,t,a,h,v({},r,{strict:!1}),i)))return!1;return 0===x(s)}return!0}(t,e,r,o);return!0}(t,e,c,l)}function L(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length)&&("function"==typeof t.copy&&"function"==typeof t.slice&&(!(t.length>0&&"number"!=typeof t[0])&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))))}t.exports=function(t,e,r){return P(t,e,r,m())}},function(t,e,r){"use strict";var i;if(!Object.keys){var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,s=r(128),a=Object.prototype.propertyIsEnumerable,u=!a.call({toString:null},"toString"),h=a.call((function(){}),"prototype"),f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=t.constructor;return e&&e.prototype===t},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!c["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{l(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();i=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),i=s(t),a=e&&"[object String]"===o.call(t),c=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var p=h&&r;if(a&&t.length>0&&!n.call(t,0))for(var m=0;m0)for(var g=0;g=0&&"[object Array]"!==n.call(t)&&"[object Function]"===n.call(t.callee)},a=function(){return o(arguments)}();o.isLegacyArguments=s,t.exports=a?o:s},function(t,e,r){"use strict";var i=r(19),n=r(41),o=r(129),s=r(130),a=r(274),u=n(s(),Object);i(u,{getPolyfill:s,implementation:o,shim:a}),t.exports=u},function(t,e,r){"use strict";var i="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,o=Object.prototype.toString;t.exports=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==o.call(e))throw new TypeError(i+e);for(var r,s=n.call(arguments,1),a=function(){if(this instanceof r){var i=e.apply(this,s.concat(n.call(arguments)));return Object(i)===i?i:this}return e.apply(t,s.concat(n.call(arguments)))},u=Math.max(0,e.length-s.length),h=[],f=0;f=t.length;return i||(r=t[e],e+=1),{done:i,value:r}}}},m=function(t,e){if(o(t)||i(t))return p(t);if(s(t)){var r=0;return{next:function(){var e=function(t,e){if(e+1>=t.length)return e+1;var r=c(t,e);if(r<55296||r>56319)return e+1;var i=c(t,e+1);return i<56320||i>57343?e+1:e+2}(t,r),i=d(t,r,e);return r=e,{done:e>t.length,value:i}}}}return e&&void 0!==t["_es6-shim iterator_"]?t["_es6-shim iterator_"]():void 0};if(u||h){var g=r(293),v=r(294),b=f("Map.prototype.forEach",!0),y=f("Set.prototype.forEach",!0);if(void 0===e||!e.versions||!e.versions.node)var w=f("Map.prototype.iterator",!0),M=f("Set.prototype.iterator",!0),_=function(t){var e=!1;return{next:function(){try{return{done:e,value:e?void 0:t.next()}}catch(t){return e=!0,{done:!0,value:void 0}}}}};var S=f("Map.prototype.@@iterator",!0)||f("Map.prototype._es6-shim iterator_",!0),k=f("Set.prototype.@@iterator",!0)||f("Set.prototype._es6-shim iterator_",!0);t.exports=function(t){return function(t){if(g(t)){if(w)return _(w(t));if(S)return S(t);if(b){var e=[];return b(t,(function(t,r){l(e,[r,t])})),p(e)}}if(v(t)){if(M)return _(M(t));if(k)return k(t);if(y){var r=[];return y(t,(function(t){l(r,t)})),p(r)}}}(t)||m(t)}}else t.exports=function(t){if(null!=t)return m(t,!0)}}}).call(this,r(4))},function(t,e,r){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,n=r(12)("Object.prototype.toString"),o=function(t){return!(i&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===n(t)},s=function(t){return!!o(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==n(t)&&"[object Function]"===n(t.callee)},a=function(){return o(arguments)}();o.isLegacyArguments=s,t.exports=a?o:s},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var i,n="function"==typeof Map&&Map.prototype?Map:null,o="function"==typeof Set&&Set.prototype?Set:null;n||(i=function(t){return!1});var s=n?Map.prototype.has:null,a=o?Set.prototype.has:null;i||s||(i=function(t){return!1}),t.exports=i||function(t){if(!t||"object"!=typeof t)return!1;try{if(s.call(t),a)try{a.call(t)}catch(t){return!0}return t instanceof n}catch(t){}return!1}},function(t,e,r){"use strict";var i,n="function"==typeof Map&&Map.prototype?Map:null,o="function"==typeof Set&&Set.prototype?Set:null;o||(i=function(t){return!1});var s=n?Map.prototype.has:null,a=o?Set.prototype.has:null;i||a||(i=function(t){return!1}),t.exports=i||function(t){if(!t||"object"!=typeof t)return!1;try{if(a.call(t),s)try{s.call(t)}catch(t){return!0}return t instanceof o}catch(t){}return!1}},function(t,e,r){"use strict";var i=r(296),n=r(297),o=r(298),s=i("%TypeError%"),a=i("%WeakMap%",!0),u=i("%Map%",!0),h=n("Array.prototype.push"),f=n("WeakMap.prototype.get",!0),l=n("WeakMap.prototype.set",!0),c=n("WeakMap.prototype.has",!0),d=n("Map.prototype.get",!0),p=n("Map.prototype.set",!0),m=n("Map.prototype.has",!0);t.exports=function(){var t,e,r,i={assert:function(t){if(!i.has(t))throw new s("Side channel does not contain "+o(t))},get:function(i){if(a&&i&&("object"==typeof i||"function"==typeof i)){if(t)return f(t,i)}else if(u){if(e)return d(e,i)}else if(r)return function(t,e){for(var r=0;r0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return function t(e,r){if(e.length>r.maxStringLength){var i=e.length-r.maxStringLength,n="... "+i+" more character"+(i>1?"s":"");return t(e.slice(0,r.maxStringLength),r)+n}return S(e.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,j),"single",r)}(e,a);if("number"==typeof e)return 0===e?1/0/e>0?"0":"-0":String(e);if("bigint"==typeof e)return String(e)+"n";var p=void 0===a.depth?5:a.depth;if(void 0===i&&(i=0),i>=p&&p>0&&"object"==typeof e)return A(e)?"[Array]":"[Object]";var b=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=Array(t.indent+1).join(" ")}return{base:r,prev:Array(e+1).join(r)}}(a,i);if(void 0===n)n=[];else if(O(n,e)>=0)return"[Circular]";function w(e,r,o){if(r&&(n=n.slice()).push(r),o){var s={depth:a.depth};return x(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),t(e,s,i+1,n)}return t(e,a,i+1,n)}if("function"==typeof e){var M=function(t){if(t.name)return t.name;var e=g.call(m.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(e),R=C(e,w);return"[Function"+(M?": "+M:" (anonymous)")+"]"+(R.length>0?" { "+R.join(", ")+" }":"")}if(E(e)){var D=y.call(e);return"object"==typeof e?B(D):D}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(e)){for(var N="<"+String(e.nodeName).toLowerCase(),U=e.attributes||[],q=0;q"}if(A(e)){if(0===e.length)return"[]";var z=C(e,w);return b&&!function(t){for(var e=0;e=0)return!1;return!0}(z)?"["+L(z,b)+"]":"[ "+z.join(", ")+" ]"}if(function(t){return"[object Error]"===I(t)}(e)){var F=C(e,w);return 0===F.length?"["+String(e)+"]":"{ ["+String(e)+"] "+F.join(", ")+" }"}if("object"==typeof e&&u){if(_&&"function"==typeof e[_])return e[_]();if("function"==typeof e.inspect)return e.inspect()}if(function(t){if(!o||!t||"object"!=typeof t)return!1;try{o.call(t);try{h.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var W=[];return s.call(e,(function(t,r){W.push(w(r,e,!0)+" => "+w(t,e))})),P("Map",o.call(e),W,b)}if(function(t){if(!h||!t||"object"!=typeof t)return!1;try{h.call(t);try{o.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var Z=[];return f.call(e,(function(t){Z.push(w(t,e))})),P("Set",h.call(e),Z,b)}if(function(t){if(!l||!t||"object"!=typeof t)return!1;try{l.call(t,l);try{c.call(t,c)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return T("WeakMap");if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t,c);try{l.call(t,l)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return T("WeakSet");if(function(t){return"[object Number]"===I(t)}(e))return B(w(Number(e)));if(function(t){return"[object BigInt]"===I(t)}(e))return B(w(v.call(e)));if(function(t){return"[object Boolean]"===I(t)}(e))return B(d.call(e));if(function(t){return"[object String]"===I(t)}(e))return B(w(String(e)));if(!function(t){return"[object Date]"===I(t)}(e)&&!function(t){return"[object RegExp]"===I(t)}(e)){var H=C(e,w);return 0===H.length?"{}":b?"{"+L(H,b)+"}":"{ "+H.join(", ")+" }"}return String(e)};var R=Object.prototype.hasOwnProperty||function(t){return t in this};function x(t,e){return R.call(t,e)}function I(t){return p.call(t)}function O(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,i=t.length;r-1}return!!c&&function(t){var e=!1;return i(l,(function(r,i){if(!e)try{e=r.call(t)===i}catch(t){}})),e}(t)}}).call(this,r(2))},function(t,e,r){"use strict";var i=r(19),n=r(41),o=r(137),s=r(138),a=r(303),u=n.apply(s()),h=function(t,e){return u(Object,arguments)};i(h,{getPolyfill:s,implementation:o,shim:a}),t.exports=h},function(t,e,r){"use strict";var i=r(19),n=r(138);t.exports=function(){var t=n();return i(Object,{assign:t},{assign:function(){return Object.assign!==t}}),t}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UpdateRoles=void 0;const i=r(127),n=r(21),o=r(15),s=r(7),a=r(68),u=r(10),h=r(8),f=r(20),l=()=>s.respond({error:"guild not found"},{status:404});e.UpdateRoles=u.withSession(({guilds:t,user:{id:e,username:r,discriminator:o}})=>async a=>{const u=await a.json(),d=new URL(a.url),[,,p]=d.pathname.split("/");if(!p)return s.respond({error:"guild ID missing from URL"},{status:400});if(0===u.transactions.length)return s.respond({error:"must have as least one transaction"},{status:400});const m=t.find(t=>t.id===p);if(!m)return l();const g=await f.getGuild(p);if(!g)return l();const v=await f.getGuildMember({serverID:p,userID:e},{skipCachePull:!0});if(!v)return l();const b=await f.getGuildData(p);if(!i.memberPassesAccessControl(m,v,b.accessControl))return n.accessControlViolation();const y=c({currentRoles:v.roles,guildRoles:g.roles,guildData:b,updateRequest:u}),w=await s.discordFetch(`/guilds/${p}/members/${e}`,h.botToken,s.AuthType.Bot,{method:"PATCH",headers:{"content-type":"application/json","x-audit-log-reason":`${r}#${o} changes their roles via ${d.hostname}`},body:JSON.stringify({roles:y})});if(!w)return s.respond({error:"discord rejected the request"},{status:500});const M={roles:w.roles};return await f.updateGuildMember({serverID:p,userID:e}),s.respond(M)});const c=({currentRoles:t,guildData:e,guildRoles:r,updateRequest:i})=>{var n,s;const u=a.keyBy(r,"id"),h=e.categories.reduce((t,e)=>e.hidden?t:[...t,...e.roles.filter(t=>{var e;return(null===(e=u[t])||void 0===e?void 0:e.safety)===o.RoleSafety.Safe})],[]),f=i.transactions.filter(t=>h.includes(t.id)),l=a.groupBy(f,"action"),c=(null!==(n=l[o.TransactionType.Add])&&void 0!==n?n:[]).map(t=>t.id),d=(null!==(s=l[o.TransactionType.Remove])&&void 0!==s?s:[]).map(t=>t.id);return a.union(a.difference(t,d),c)}}]); \ No newline at end of file diff --git a/terraform/worker-dist/interactions.js b/terraform/worker-dist/interactions.js new file mode 100644 index 0000000..dfd8891 --- /dev/null +++ b/terraform/worker-dist/interactions.js @@ -0,0 +1,10 @@ +!function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=6)}([function(t,r,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,r,e,n){void 0===n&&(n=e),Object.defineProperty(t,n,{enumerable:!0,get:function(){return r[e]}})}:function(t,r,e,n){void 0===n&&(n=e),t[n]=r[e]}),o=this&&this.__exportStar||function(t,r){for(var e in t)"default"===e||Object.prototype.hasOwnProperty.call(r,e)||n(r,t,e)};Object.defineProperty(r,"__esModule",{value:!0}),o(e(4),r),o(e(22),r),o(e(23),r),o(e(5),r)},function(t,r,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,r,e,n){void 0===n&&(n=e),Object.defineProperty(t,n,{enumerable:!0,get:function(){return r[e]}})}:function(t,r,e,n){void 0===n&&(n=e),t[n]=r[e]}),o=this&&this.__exportStar||function(t,r){for(var e in t)"default"===e||Object.prototype.hasOwnProperty.call(r,e)||n(r,t,e)};Object.defineProperty(r,"__esModule",{value:!0}),o(e(9),r),o(e(10),r),o(e(11),r),o(e(12),r),o(e(13),r),o(e(14),r)},function(t,r){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r,e){"use strict";(function(t){Object.defineProperty(r,"__esModule",{value:!0}),r.publicKey=r.apiPublicURI=r.uiPublicURI=void 0;const e=t,n=t=>{var r;return null!==(r=e[t])&&void 0!==r?r:""},o=t=>t.replace(/\/$/,"");r.uiPublicURI=o(n("UI_PUBLIC_URI")),r.apiPublicURI=o(n("API_PUBLIC_URI")),r.publicKey=o(n("DISCORD_PUBLIC_KEY"))}).call(this,e(2))},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getQuery=r.userAgent=r.respond=void 0;r.respond=(t,r={})=>new Response(JSON.stringify(t),{...r,headers:{...r.headers||{},"content-type":"application/json"}}),r.userAgent="DiscordBot (https://github.com/roleypoly/roleypoly, git-main) (+https://roleypoly.com)";r.getQuery=t=>{const r={};for(let[e,n]of new URL(t.url).searchParams.entries())r[e]=n;return r}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Router=void 0;r.Router=class{constructor(){this.routingTree={},this.fallbacks={root:this.respondToRoot,404:this.notFound,500:this.serverError},this.corsOrigins=[]}addCORSOrigins(t){this.corsOrigins=[...this.corsOrigins,...t]}addFallback(t,r){this.fallbacks[t]=r}add(t,r,e){const n=t.toLowerCase();this.routingTree[n]||(this.routingTree[n]={}),this.routingTree[n][r]=e}async handle(t){const r=await this.processRequest(t);return this.injectCORSHeaders(t,r.headers),r}async processRequest(t){var r;const e=new URL(t.url);if("/"===e.pathname||""===e.pathname)return this.fallbacks.root(t);const n=t.method.toLowerCase(),o=e.pathname.split("/")[1],i=null===(r=this.routingTree[n])||void 0===r?void 0:r[o];if(i)try{return await i(t)}catch(r){return console.error(r),this.fallbacks[500](t)}return"options"===n?new Response(null,{}):this.fallbacks[404](t)}respondToRoot(){return new Response("Hi there!")}notFound(){return new Response(JSON.stringify({error:"not_found"}),{status:404})}serverError(){return new Response(JSON.stringify({error:"internal_server_error"}),{status:500})}injectCORSHeaders(t,r){if(r.set("access-control-allow-methods","*"),r.set("access-control-allow-headers","*"),0===this.corsOrigins.length)return void r.set("access-control-allow-origin","*");const e=t.headers.get("origin");if(!e)return;const n=new URL(e).hostname;this.corsOrigins.includes(n)&&r.set("access-control-allow-origin",n)}}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e(7),o=e(0),i=e(5),s=e(24),a=e(3),u=new i.Router;u.add("GET","_healthz",s.healthz),u.add("POST","interaction",n.interactionHandler),u.addFallback("root",()=>o.respond({__warning:"🦊",this:"is",a:"fox-based",web:"application",please:"be",mindful:"of",your:"surroundings",warning__:"🦊",meta:a.uiPublicURI})),addEventListener("fetch",t=>{t.respondWith(u.handle(t.request))})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.interactionHandler=void 0;const n=e(8),o=e(15),i=e(1),s=e(0),a={"hello-world":n.helloWorld};r.interactionHandler=async t=>{if(!await o.verifyRequest(t))return new Response("invalid request signature",{status:401});const r=await t.json();if(r.type===i.InteractionType.PING)return s.respond({type:1});if(r.type!==i.InteractionType.APPLICATION_COMMAND)return s.respond({err:"not implemented"},{status:400});if(!r.data)return s.respond({err:"data missing"},{status:400});const e=a[r.data.name];if(!e)return s.respond({err:"not implemented"},{status:400});try{const t=await e(r);return s.respond(t)}catch(t){return s.respond({err:"command errored"},{status:500})}}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.helloWorld=void 0;const n=e(1);r.helloWorld=async t=>{var r,e;return{type:n.InteractionCallbackType.CHANNEL_MESSAGE_WITH_SOURCE,data:{content:"Hey there, "+((null===(r=t.member)||void 0===r?void 0:r.nick)||(null===(e=t.user)||void 0===e?void 0:e.username))}}}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.CategoryType=void 0,function(t){t[t.Multi=0]="Multi",t[t.Single=1]="Single"}(r.CategoryType||(r.CategoryType={}))},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WebhookValidationStatus=r.UserGuildPermissions=r.Features=void 0,function(t){t[t.None=0]="None",t[t.Preview=0]="Preview",t[t.LegacyGuild=2]="LegacyGuild",t[t.AccessControl=4]="AccessControl",t[t.AuditLogging=8]="AuditLogging"}(r.Features||(r.Features={})),function(t){t[t.User=0]="User",t[t.Manager=2]="Manager",t[t.Admin=4]="Admin"}(r.UserGuildPermissions||(r.UserGuildPermissions={})),function(t){t[t.Ok=0]="Ok",t[t.NoneSet=1]="NoneSet",t[t.DoesNotExist=2]="DoesNotExist",t[t.NotSameGuild=3]="NotSameGuild",t[t.NotDiscordURL=4]="NotDiscordURL"}(r.WebhookValidationStatus||(r.WebhookValidationStatus={}))},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.InteractionCallbackType=r.InteractionType=void 0,function(t){t[t.PING=1]="PING",t[t.APPLICATION_COMMAND=2]="APPLICATION_COMMAND",t[t.MESSAGE_COMPONENT=3]="MESSAGE_COMPONENT"}(r.InteractionType||(r.InteractionType={})),function(t){t[t.PONG=1]="PONG",t[t.CHANNEL_MESSAGE_WITH_SOURCE=4]="CHANNEL_MESSAGE_WITH_SOURCE",t[t.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE=5]="DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE",t[t.DEFERRED_UPDATE_MESSAGE=6]="DEFERRED_UPDATE_MESSAGE",t[t.UPDATE_MESSAGE=7]="UPDATE_MESSAGE"}(r.InteractionCallbackType||(r.InteractionCallbackType={}))},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.TransactionType=r.RoleSafety=void 0,function(t){t[t.Safe=0]="Safe",t[t.HigherThanBot=2]="HigherThanBot",t[t.DangerousPermissions=4]="DangerousPermissions",t[t.ManagedRole=8]="ManagedRole",t[t.AccessControl=16]="AccessControl"}(r.RoleSafety||(r.RoleSafety={})),function(t){t[t.None=0]="None",t[t.Remove=2]="Remove",t[t.Add=4]="Add"}(r.TransactionType||(r.TransactionType={}))},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";(function(t){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.verifyRequest=void 0;const o=e(3),i=n(e(20));r.verifyRequest=async r=>{const e=r.headers.get("x-signature-timestamp"),n=r.headers.get("x-signature-ed25519");if(!e||!n)return!1;const s=await r.json();return!!i.default.sign.detached.verify(t.from(e+JSON.stringify(s)),t.from(n,"hex"),t.from(o.publicKey,"hex"))}}).call(this,e(16).Buffer)},function(t,r,e){"use strict";(function(t){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var n=e(17),o=e(18),i=e(19);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,r){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function y(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 e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return K(t).length;default:if(n)return j(t).length;r=(""+r).toLowerCase(),n=!0}}function d(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return M(this,r,e);case"utf8":case"utf-8":return P(this,r,e);case"ascii":return S(this,r,e);case"latin1":case"binary":return T(this,r,e);case"base64":return U(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function v(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=u.from(r,n)),u.isBuffer(r))return 0===r.length?-1:w(t,r,e,n,o);if("number"==typeof r)return r&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):w(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function w(t,r,e,n,o){var i,s=1,a=t.length,u=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;s=2,a/=2,u/=2,e/=2}function f(t,r){return 1===s?t[r]:t.readUInt16BE(r*s)}if(o){var h=-1;for(i=e;ia&&(e=a-u),i=e;i>=0;i--){for(var c=!0,l=0;lo&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function U(t,r,e){return 0===r&&e===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(r,e))}function P(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o239?4:f>223?3:f>191?2:1;if(o+c<=e)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(h=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(u=(15&f)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},u.prototype.compare=function(t,r,e,n,o){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(e>>>=0)-(r>>>=0),a=Math.min(i,s),f=this.slice(n,o),h=t.slice(r,e),c=0;co)&&(e=o),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return _(this,t,r,e);case"utf8":case"utf-8":return b(this,t,r,e);case"ascii":return A(this,t,r,e);case"latin1":case"binary":return E(this,t,r,e);case"base64":return m(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r,e);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function S(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;on)&&(e=n);for(var o="",i=r;ie)throw new RangeError("Trying to access beyond buffer length")}function x(t,r,e,n,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function I(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o>>8*(n?o:1-o)}function C(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o>>8*(n?o:3-o)&255}function L(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function N(t,r,e,n,i){return i||L(t,0,e,4),o.write(t,r,e,n,23,4),e+4}function Y(t,r,e,n,i){return i||L(t,0,e,8),o.write(t,r,e,n,52,8),e+8}u.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r0&&(o*=256);)n+=this[t+--r]*o;return n},u.prototype.readUInt8=function(t,r){return r||B(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,r){return r||B(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,r){return r||B(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,r){return r||B(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||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||B(t,r,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*r)),n},u.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||B(t,r,this.length);for(var n=r,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},u.prototype.readInt8=function(t,r){return r||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,r){r||B(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},u.prototype.readInt16BE=function(t,r){r||B(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},u.prototype.readInt32LE=function(t,r){return r||B(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||B(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||B(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,r){return r||B(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,r){return r||B(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,r){return r||B(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||x(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i=0&&(i*=256);)this[r+o]=t/i&255;return r+e},u.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||x(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,e){return t=+t,r|=0,e||x(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,e){return t=+t,r|=0,e||x(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,e){return t=+t,r|=0,e||x(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):C(this,t,r,!0),r+4},u.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||x(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):C(this,t,r,!1),r+4},u.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);x(this,t,r,e,o-1,-o)}var i=0,s=1,a=0;for(this[r]=255&t;++i>0)-a&255;return r+e},u.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);x(this,t,r,e,o-1,-o)}var i=e-1,s=1,a=0;for(this[r+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[r+i+1]&&(a=1),this[r+i]=(t/s>>0)-a&255;return r+e},u.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||x(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,e){return t=+t,r|=0,e||x(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,e){return t=+t,r|=0,e||x(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,e){return t=+t,r|=0,e||x(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):C(this,t,r,!0),r+4},u.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||x(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):C(this,t,r,!1),r+4},u.prototype.writeFloatLE=function(t,r,e){return N(this,t,r,!0,e)},u.prototype.writeFloatBE=function(t,r,e){return N(this,t,r,!1,e)},u.prototype.writeDoubleLE=function(t,r,e){return Y(this,t,r,!0,e)},u.prototype.writeDoubleBE=function(t,r,e){return Y(this,t,r,!1,e)},u.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r=0;--o)t[o+r]=this[o+e];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function K(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(k,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,r,e,n){for(var o=0;o=r.length||o>=t.length);++o)r[o+e]=t[o];return o}}).call(this,e(2))},function(t,r,e){"use strict";r.byteLength=function(t){var r=f(t),e=r[0],n=r[1];return 3*(e+n)/4-n},r.toByteArray=function(t){var r,e,n=f(t),s=n[0],a=n[1],u=new i(function(t,r,e){return 3*(r+e)/4-e}(0,s,a)),h=0,c=a>0?s-4:s;for(e=0;e>16&255,u[h++]=r>>8&255,u[h++]=255&r;2===a&&(r=o[t.charCodeAt(e)]<<2|o[t.charCodeAt(e+1)]>>4,u[h++]=255&r);1===a&&(r=o[t.charCodeAt(e)]<<10|o[t.charCodeAt(e+1)]<<4|o[t.charCodeAt(e+2)]>>2,u[h++]=r>>8&255,u[h++]=255&r);return u},r.fromByteArray=function(t){for(var r,e=t.length,o=e%3,i=[],s=0,a=e-o;sa?a:s+16383));1===o?(r=t[e-1],i.push(n[r>>2]+n[r<<4&63]+"==")):2===o&&(r=(t[e-2]<<8)+t[e-1],i.push(n[r>>10]+n[r>>4&63]+n[r<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function h(t,r,e){for(var o,i,s=[],a=r;a>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,r){ +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ +r.read=function(t,r,e,n,o){var i,s,a=8*o-n-1,u=(1<>1,h=-7,c=e?o-1:0,l=e?-1:1,p=t[r+c];for(c+=l,i=p&(1<<-h)-1,p>>=-h,h+=a;h>0;i=256*i+t[r+c],c+=l,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[r+c],c+=l,h-=8);if(0===i)i=1-f;else{if(i===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=f}return(p?-1:1)*s*Math.pow(2,i-n)},r.write=function(t,r,e,n,o,i){var s,a,u,f=8*i-o-1,h=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,y=n?1:-1,d=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,s=h):(s=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-s))<1&&(s--,u*=2),(r+=s+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(r*u-1)*Math.pow(2,o),s+=c):(a=r*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;t[e+p]=255&a,p+=y,a/=256,o-=8);for(s=s<0;t[e+p]=255&s,p+=y,s/=256,f-=8);t[e+p-y]|=128*d}},function(t,r){var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},function(t,r,e){!function(t){"use strict";var r=function(t){var r,e=new Float64Array(16);if(t)for(r=0;r>24&255,t[r+1]=e>>16&255,t[r+2]=e>>8&255,t[r+3]=255&e,t[r+4]=n>>24&255,t[r+5]=n>>16&255,t[r+6]=n>>8&255,t[r+7]=255&n}function d(t,r,e,n,o){var i,s=0;for(i=0;i>>8)-1}function g(t,r,e,n){return d(t,r,e,n,16)}function v(t,r,e,n){return d(t,r,e,n,32)}function w(t,r,e,n){!function(t,r,e,n){for(var o,i=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,a=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,u=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,f=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,c=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,p=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,y=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,d=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&e[16]|(255&e[17])<<8|(255&e[18])<<16|(255&e[19])<<24,v=255&e[20]|(255&e[21])<<8|(255&e[22])<<16|(255&e[23])<<24,w=255&e[24]|(255&e[25])<<8|(255&e[26])<<16|(255&e[27])<<24,_=255&e[28]|(255&e[29])<<8|(255&e[30])<<16|(255&e[31])<<24,b=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,A=i,E=s,m=a,R=u,U=f,P=h,S=c,T=l,M=p,O=y,B=d,x=g,I=v,C=w,L=_,N=b,Y=0;Y<20;Y+=2)A^=(o=(I^=(o=(M^=(o=(U^=(o=A+I|0)<<7|o>>>25)+A|0)<<9|o>>>23)+U|0)<<13|o>>>19)+M|0)<<18|o>>>14,P^=(o=(E^=(o=(C^=(o=(O^=(o=P+E|0)<<7|o>>>25)+P|0)<<9|o>>>23)+O|0)<<13|o>>>19)+C|0)<<18|o>>>14,B^=(o=(S^=(o=(m^=(o=(L^=(o=B+S|0)<<7|o>>>25)+B|0)<<9|o>>>23)+L|0)<<13|o>>>19)+m|0)<<18|o>>>14,N^=(o=(x^=(o=(T^=(o=(R^=(o=N+x|0)<<7|o>>>25)+N|0)<<9|o>>>23)+R|0)<<13|o>>>19)+T|0)<<18|o>>>14,A^=(o=(R^=(o=(m^=(o=(E^=(o=A+R|0)<<7|o>>>25)+A|0)<<9|o>>>23)+E|0)<<13|o>>>19)+m|0)<<18|o>>>14,P^=(o=(U^=(o=(T^=(o=(S^=(o=P+U|0)<<7|o>>>25)+P|0)<<9|o>>>23)+S|0)<<13|o>>>19)+T|0)<<18|o>>>14,B^=(o=(O^=(o=(M^=(o=(x^=(o=B+O|0)<<7|o>>>25)+B|0)<<9|o>>>23)+x|0)<<13|o>>>19)+M|0)<<18|o>>>14,N^=(o=(L^=(o=(C^=(o=(I^=(o=N+L|0)<<7|o>>>25)+N|0)<<9|o>>>23)+I|0)<<13|o>>>19)+C|0)<<18|o>>>14;A=A+i|0,E=E+s|0,m=m+a|0,R=R+u|0,U=U+f|0,P=P+h|0,S=S+c|0,T=T+l|0,M=M+p|0,O=O+y|0,B=B+d|0,x=x+g|0,I=I+v|0,C=C+w|0,L=L+_|0,N=N+b|0,t[0]=A>>>0&255,t[1]=A>>>8&255,t[2]=A>>>16&255,t[3]=A>>>24&255,t[4]=E>>>0&255,t[5]=E>>>8&255,t[6]=E>>>16&255,t[7]=E>>>24&255,t[8]=m>>>0&255,t[9]=m>>>8&255,t[10]=m>>>16&255,t[11]=m>>>24&255,t[12]=R>>>0&255,t[13]=R>>>8&255,t[14]=R>>>16&255,t[15]=R>>>24&255,t[16]=U>>>0&255,t[17]=U>>>8&255,t[18]=U>>>16&255,t[19]=U>>>24&255,t[20]=P>>>0&255,t[21]=P>>>8&255,t[22]=P>>>16&255,t[23]=P>>>24&255,t[24]=S>>>0&255,t[25]=S>>>8&255,t[26]=S>>>16&255,t[27]=S>>>24&255,t[28]=T>>>0&255,t[29]=T>>>8&255,t[30]=T>>>16&255,t[31]=T>>>24&255,t[32]=M>>>0&255,t[33]=M>>>8&255,t[34]=M>>>16&255,t[35]=M>>>24&255,t[36]=O>>>0&255,t[37]=O>>>8&255,t[38]=O>>>16&255,t[39]=O>>>24&255,t[40]=B>>>0&255,t[41]=B>>>8&255,t[42]=B>>>16&255,t[43]=B>>>24&255,t[44]=x>>>0&255,t[45]=x>>>8&255,t[46]=x>>>16&255,t[47]=x>>>24&255,t[48]=I>>>0&255,t[49]=I>>>8&255,t[50]=I>>>16&255,t[51]=I>>>24&255,t[52]=C>>>0&255,t[53]=C>>>8&255,t[54]=C>>>16&255,t[55]=C>>>24&255,t[56]=L>>>0&255,t[57]=L>>>8&255,t[58]=L>>>16&255,t[59]=L>>>24&255,t[60]=N>>>0&255,t[61]=N>>>8&255,t[62]=N>>>16&255,t[63]=N>>>24&255}(t,r,e,n)}function _(t,r,e,n){!function(t,r,e,n){for(var o,i=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,a=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,u=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,f=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,c=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,p=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,y=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,d=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&e[16]|(255&e[17])<<8|(255&e[18])<<16|(255&e[19])<<24,v=255&e[20]|(255&e[21])<<8|(255&e[22])<<16|(255&e[23])<<24,w=255&e[24]|(255&e[25])<<8|(255&e[26])<<16|(255&e[27])<<24,_=255&e[28]|(255&e[29])<<8|(255&e[30])<<16|(255&e[31])<<24,b=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,A=0;A<20;A+=2)i^=(o=(v^=(o=(p^=(o=(f^=(o=i+v|0)<<7|o>>>25)+i|0)<<9|o>>>23)+f|0)<<13|o>>>19)+p|0)<<18|o>>>14,h^=(o=(s^=(o=(w^=(o=(y^=(o=h+s|0)<<7|o>>>25)+h|0)<<9|o>>>23)+y|0)<<13|o>>>19)+w|0)<<18|o>>>14,d^=(o=(c^=(o=(a^=(o=(_^=(o=d+c|0)<<7|o>>>25)+d|0)<<9|o>>>23)+_|0)<<13|o>>>19)+a|0)<<18|o>>>14,b^=(o=(g^=(o=(l^=(o=(u^=(o=b+g|0)<<7|o>>>25)+b|0)<<9|o>>>23)+u|0)<<13|o>>>19)+l|0)<<18|o>>>14,i^=(o=(u^=(o=(a^=(o=(s^=(o=i+u|0)<<7|o>>>25)+i|0)<<9|o>>>23)+s|0)<<13|o>>>19)+a|0)<<18|o>>>14,h^=(o=(f^=(o=(l^=(o=(c^=(o=h+f|0)<<7|o>>>25)+h|0)<<9|o>>>23)+c|0)<<13|o>>>19)+l|0)<<18|o>>>14,d^=(o=(y^=(o=(p^=(o=(g^=(o=d+y|0)<<7|o>>>25)+d|0)<<9|o>>>23)+g|0)<<13|o>>>19)+p|0)<<18|o>>>14,b^=(o=(_^=(o=(w^=(o=(v^=(o=b+_|0)<<7|o>>>25)+b|0)<<9|o>>>23)+v|0)<<13|o>>>19)+w|0)<<18|o>>>14;t[0]=i>>>0&255,t[1]=i>>>8&255,t[2]=i>>>16&255,t[3]=i>>>24&255,t[4]=h>>>0&255,t[5]=h>>>8&255,t[6]=h>>>16&255,t[7]=h>>>24&255,t[8]=d>>>0&255,t[9]=d>>>8&255,t[10]=d>>>16&255,t[11]=d>>>24&255,t[12]=b>>>0&255,t[13]=b>>>8&255,t[14]=b>>>16&255,t[15]=b>>>24&255,t[16]=c>>>0&255,t[17]=c>>>8&255,t[18]=c>>>16&255,t[19]=c>>>24&255,t[20]=l>>>0&255,t[21]=l>>>8&255,t[22]=l>>>16&255,t[23]=l>>>24&255,t[24]=p>>>0&255,t[25]=p>>>8&255,t[26]=p>>>16&255,t[27]=p>>>24&255,t[28]=y>>>0&255,t[29]=y>>>8&255,t[30]=y>>>16&255,t[31]=y>>>24&255}(t,r,e,n)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function A(t,r,e,n,o,i,s){var a,u,f=new Uint8Array(16),h=new Uint8Array(64);for(u=0;u<16;u++)f[u]=0;for(u=0;u<8;u++)f[u]=i[u];for(;o>=64;){for(w(h,f,s,b),u=0;u<64;u++)t[r+u]=e[n+u]^h[u];for(a=1,u=8;u<16;u++)a=a+(255&f[u])|0,f[u]=255&a,a>>>=8;o-=64,r+=64,n+=64}if(o>0)for(w(h,f,s,b),u=0;u=64;){for(w(u,a,o,b),s=0;s<64;s++)t[r+s]=u[s];for(i=1,s=8;s<16;s++)i=i+(255&a[s])|0,a[s]=255&i,i>>>=8;e-=64,r+=64}if(e>0)for(w(u,a,o,b),s=0;s>>13|e<<3),n=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(e>>>10|n<<6),o=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(n>>>7|o<<9),i=255&t[8]|(255&t[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,s=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(i>>>14|s<<2),a=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(s>>>11|a<<5),u=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(a>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function P(t,r,e,n,o,i){var s=new U(i);return s.update(e,n,o),s.finish(t,r),0}function S(t,r,e,n,o,i){var s=new Uint8Array(16);return P(s,0,e,n,o,i),g(t,r,s,0)}function T(t,r,e,n,o){var i;if(e<32)return-1;for(R(t,0,r,0,e,n,o),P(t,16,t,32,e-32,t),i=0;i<16;i++)t[i]=0;return 0}function M(t,r,e,n,o){var i,s=new Uint8Array(32);if(e<32)return-1;if(m(s,0,32,n,o),0!==S(r,16,r,32,e-32,s))return-1;for(R(t,0,r,0,e,n,o),i=0;i<32;i++)t[i]=0;return 0}function O(t,r){var e;for(e=0;e<16;e++)t[e]=0|r[e]}function B(t){var r,e,n=1;for(r=0;r<16;r++)e=t[r]+n+65535,n=Math.floor(e/65536),t[r]=e-65536*n;t[0]+=n-1+37*(n-1)}function x(t,r,e){for(var n,o=~(e-1),i=0;i<16;i++)n=o&(t[i]^r[i]),t[i]^=n,r[i]^=n}function I(t,e){var n,o,i,s=r(),a=r();for(n=0;n<16;n++)a[n]=e[n];for(B(a),B(a),B(a),o=0;o<2;o++){for(s[0]=a[0]-65517,n=1;n<15;n++)s[n]=a[n]-65535-(s[n-1]>>16&1),s[n-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,x(a,s,1-i)}for(n=0;n<16;n++)t[2*n]=255&a[n],t[2*n+1]=a[n]>>8}function C(t,r){var e=new Uint8Array(32),n=new Uint8Array(32);return I(e,t),I(n,r),v(e,0,n,0)}function L(t){var r=new Uint8Array(32);return I(r,t),1&r[0]}function N(t,r){var e;for(e=0;e<16;e++)t[e]=r[2*e]+(r[2*e+1]<<8);t[15]&=32767}function Y(t,r,e){for(var n=0;n<16;n++)t[n]=r[n]+e[n]}function k(t,r,e){for(var n=0;n<16;n++)t[n]=r[n]-e[n]}function D(t,r,e){var n,o,i=0,s=0,a=0,u=0,f=0,h=0,c=0,l=0,p=0,y=0,d=0,g=0,v=0,w=0,_=0,b=0,A=0,E=0,m=0,R=0,U=0,P=0,S=0,T=0,M=0,O=0,B=0,x=0,I=0,C=0,L=0,N=e[0],Y=e[1],k=e[2],D=e[3],j=e[4],K=e[5],F=e[6],G=e[7],z=e[8],H=e[9],W=e[10],V=e[11],q=e[12],J=e[13],Z=e[14],X=e[15];i+=(n=r[0])*N,s+=n*Y,a+=n*k,u+=n*D,f+=n*j,h+=n*K,c+=n*F,l+=n*G,p+=n*z,y+=n*H,d+=n*W,g+=n*V,v+=n*q,w+=n*J,_+=n*Z,b+=n*X,s+=(n=r[1])*N,a+=n*Y,u+=n*k,f+=n*D,h+=n*j,c+=n*K,l+=n*F,p+=n*G,y+=n*z,d+=n*H,g+=n*W,v+=n*V,w+=n*q,_+=n*J,b+=n*Z,A+=n*X,a+=(n=r[2])*N,u+=n*Y,f+=n*k,h+=n*D,c+=n*j,l+=n*K,p+=n*F,y+=n*G,d+=n*z,g+=n*H,v+=n*W,w+=n*V,_+=n*q,b+=n*J,A+=n*Z,E+=n*X,u+=(n=r[3])*N,f+=n*Y,h+=n*k,c+=n*D,l+=n*j,p+=n*K,y+=n*F,d+=n*G,g+=n*z,v+=n*H,w+=n*W,_+=n*V,b+=n*q,A+=n*J,E+=n*Z,m+=n*X,f+=(n=r[4])*N,h+=n*Y,c+=n*k,l+=n*D,p+=n*j,y+=n*K,d+=n*F,g+=n*G,v+=n*z,w+=n*H,_+=n*W,b+=n*V,A+=n*q,E+=n*J,m+=n*Z,R+=n*X,h+=(n=r[5])*N,c+=n*Y,l+=n*k,p+=n*D,y+=n*j,d+=n*K,g+=n*F,v+=n*G,w+=n*z,_+=n*H,b+=n*W,A+=n*V,E+=n*q,m+=n*J,R+=n*Z,U+=n*X,c+=(n=r[6])*N,l+=n*Y,p+=n*k,y+=n*D,d+=n*j,g+=n*K,v+=n*F,w+=n*G,_+=n*z,b+=n*H,A+=n*W,E+=n*V,m+=n*q,R+=n*J,U+=n*Z,P+=n*X,l+=(n=r[7])*N,p+=n*Y,y+=n*k,d+=n*D,g+=n*j,v+=n*K,w+=n*F,_+=n*G,b+=n*z,A+=n*H,E+=n*W,m+=n*V,R+=n*q,U+=n*J,P+=n*Z,S+=n*X,p+=(n=r[8])*N,y+=n*Y,d+=n*k,g+=n*D,v+=n*j,w+=n*K,_+=n*F,b+=n*G,A+=n*z,E+=n*H,m+=n*W,R+=n*V,U+=n*q,P+=n*J,S+=n*Z,T+=n*X,y+=(n=r[9])*N,d+=n*Y,g+=n*k,v+=n*D,w+=n*j,_+=n*K,b+=n*F,A+=n*G,E+=n*z,m+=n*H,R+=n*W,U+=n*V,P+=n*q,S+=n*J,T+=n*Z,M+=n*X,d+=(n=r[10])*N,g+=n*Y,v+=n*k,w+=n*D,_+=n*j,b+=n*K,A+=n*F,E+=n*G,m+=n*z,R+=n*H,U+=n*W,P+=n*V,S+=n*q,T+=n*J,M+=n*Z,O+=n*X,g+=(n=r[11])*N,v+=n*Y,w+=n*k,_+=n*D,b+=n*j,A+=n*K,E+=n*F,m+=n*G,R+=n*z,U+=n*H,P+=n*W,S+=n*V,T+=n*q,M+=n*J,O+=n*Z,B+=n*X,v+=(n=r[12])*N,w+=n*Y,_+=n*k,b+=n*D,A+=n*j,E+=n*K,m+=n*F,R+=n*G,U+=n*z,P+=n*H,S+=n*W,T+=n*V,M+=n*q,O+=n*J,B+=n*Z,x+=n*X,w+=(n=r[13])*N,_+=n*Y,b+=n*k,A+=n*D,E+=n*j,m+=n*K,R+=n*F,U+=n*G,P+=n*z,S+=n*H,T+=n*W,M+=n*V,O+=n*q,B+=n*J,x+=n*Z,I+=n*X,_+=(n=r[14])*N,b+=n*Y,A+=n*k,E+=n*D,m+=n*j,R+=n*K,U+=n*F,P+=n*G,S+=n*z,T+=n*H,M+=n*W,O+=n*V,B+=n*q,x+=n*J,I+=n*Z,C+=n*X,b+=(n=r[15])*N,s+=38*(E+=n*k),a+=38*(m+=n*D),u+=38*(R+=n*j),f+=38*(U+=n*K),h+=38*(P+=n*F),c+=38*(S+=n*G),l+=38*(T+=n*z),p+=38*(M+=n*H),y+=38*(O+=n*W),d+=38*(B+=n*V),g+=38*(x+=n*q),v+=38*(I+=n*J),w+=38*(C+=n*Z),_+=38*(L+=n*X),i=(n=(i+=38*(A+=n*Y))+(o=1)+65535)-65536*(o=Math.floor(n/65536)),s=(n=s+o+65535)-65536*(o=Math.floor(n/65536)),a=(n=a+o+65535)-65536*(o=Math.floor(n/65536)),u=(n=u+o+65535)-65536*(o=Math.floor(n/65536)),f=(n=f+o+65535)-65536*(o=Math.floor(n/65536)),h=(n=h+o+65535)-65536*(o=Math.floor(n/65536)),c=(n=c+o+65535)-65536*(o=Math.floor(n/65536)),l=(n=l+o+65535)-65536*(o=Math.floor(n/65536)),p=(n=p+o+65535)-65536*(o=Math.floor(n/65536)),y=(n=y+o+65535)-65536*(o=Math.floor(n/65536)),d=(n=d+o+65535)-65536*(o=Math.floor(n/65536)),g=(n=g+o+65535)-65536*(o=Math.floor(n/65536)),v=(n=v+o+65535)-65536*(o=Math.floor(n/65536)),w=(n=w+o+65535)-65536*(o=Math.floor(n/65536)),_=(n=_+o+65535)-65536*(o=Math.floor(n/65536)),b=(n=b+o+65535)-65536*(o=Math.floor(n/65536)),i=(n=(i+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(n/65536)),s=(n=s+o+65535)-65536*(o=Math.floor(n/65536)),a=(n=a+o+65535)-65536*(o=Math.floor(n/65536)),u=(n=u+o+65535)-65536*(o=Math.floor(n/65536)),f=(n=f+o+65535)-65536*(o=Math.floor(n/65536)),h=(n=h+o+65535)-65536*(o=Math.floor(n/65536)),c=(n=c+o+65535)-65536*(o=Math.floor(n/65536)),l=(n=l+o+65535)-65536*(o=Math.floor(n/65536)),p=(n=p+o+65535)-65536*(o=Math.floor(n/65536)),y=(n=y+o+65535)-65536*(o=Math.floor(n/65536)),d=(n=d+o+65535)-65536*(o=Math.floor(n/65536)),g=(n=g+o+65535)-65536*(o=Math.floor(n/65536)),v=(n=v+o+65535)-65536*(o=Math.floor(n/65536)),w=(n=w+o+65535)-65536*(o=Math.floor(n/65536)),_=(n=_+o+65535)-65536*(o=Math.floor(n/65536)),b=(n=b+o+65535)-65536*(o=Math.floor(n/65536)),i+=o-1+37*(o-1),t[0]=i,t[1]=s,t[2]=a,t[3]=u,t[4]=f,t[5]=h,t[6]=c,t[7]=l,t[8]=p,t[9]=y,t[10]=d,t[11]=g,t[12]=v,t[13]=w,t[14]=_,t[15]=b}function j(t,r){D(t,r,r)}function K(t,e){var n,o=r();for(n=0;n<16;n++)o[n]=e[n];for(n=253;n>=0;n--)j(o,o),2!==n&&4!==n&&D(o,o,e);for(n=0;n<16;n++)t[n]=o[n]}function F(t,e){var n,o=r();for(n=0;n<16;n++)o[n]=e[n];for(n=250;n>=0;n--)j(o,o),1!==n&&D(o,o,e);for(n=0;n<16;n++)t[n]=o[n]}function G(t,e,n){var o,i,s=new Uint8Array(32),a=new Float64Array(80),f=r(),h=r(),c=r(),l=r(),p=r(),y=r();for(i=0;i<31;i++)s[i]=e[i];for(s[31]=127&e[31]|64,s[0]&=248,N(a,n),i=0;i<16;i++)h[i]=a[i],l[i]=f[i]=c[i]=0;for(f[0]=l[0]=1,i=254;i>=0;--i)x(f,h,o=s[i>>>3]>>>(7&i)&1),x(c,l,o),Y(p,f,c),k(f,f,c),Y(c,h,l),k(h,h,l),j(l,p),j(y,f),D(f,c,f),D(c,h,p),Y(p,f,c),k(f,f,c),j(h,f),k(c,l,y),D(f,c,u),Y(f,f,l),D(c,c,f),D(f,l,y),D(l,h,a),j(h,p),x(f,h,o),x(c,l,o);for(i=0;i<16;i++)a[i+16]=f[i],a[i+32]=c[i],a[i+48]=h[i],a[i+64]=l[i];var d=a.subarray(32),g=a.subarray(16);return K(d,d),D(g,g,d),I(t,g),0}function z(t,r){return G(t,r,i)}function H(t,r){return n(r,32),z(t,r)}function W(t,r,e){var n=new Uint8Array(32);return G(n,e,r),_(t,o,n,b)}U.prototype.blocks=function(t,r,e){for(var n,o,i,s,a,u,f,h,c,l,p,y,d,g,v,w,_,b,A,E=this.fin?0:2048,m=this.h[0],R=this.h[1],U=this.h[2],P=this.h[3],S=this.h[4],T=this.h[5],M=this.h[6],O=this.h[7],B=this.h[8],x=this.h[9],I=this.r[0],C=this.r[1],L=this.r[2],N=this.r[3],Y=this.r[4],k=this.r[5],D=this.r[6],j=this.r[7],K=this.r[8],F=this.r[9];e>=16;)l=c=0,l+=(m+=8191&(n=255&t[r+0]|(255&t[r+1])<<8))*I,l+=(R+=8191&(n>>>13|(o=255&t[r+2]|(255&t[r+3])<<8)<<3))*(5*F),l+=(U+=8191&(o>>>10|(i=255&t[r+4]|(255&t[r+5])<<8)<<6))*(5*K),l+=(P+=8191&(i>>>7|(s=255&t[r+6]|(255&t[r+7])<<8)<<9))*(5*j),c=(l+=(S+=8191&(s>>>4|(a=255&t[r+8]|(255&t[r+9])<<8)<<12))*(5*D))>>>13,l&=8191,l+=(T+=a>>>1&8191)*(5*k),l+=(M+=8191&(a>>>14|(u=255&t[r+10]|(255&t[r+11])<<8)<<2))*(5*Y),l+=(O+=8191&(u>>>11|(f=255&t[r+12]|(255&t[r+13])<<8)<<5))*(5*N),l+=(B+=8191&(f>>>8|(h=255&t[r+14]|(255&t[r+15])<<8)<<8))*(5*L),p=c+=(l+=(x+=h>>>5|E)*(5*C))>>>13,p+=m*C,p+=R*I,p+=U*(5*F),p+=P*(5*K),c=(p+=S*(5*j))>>>13,p&=8191,p+=T*(5*D),p+=M*(5*k),p+=O*(5*Y),p+=B*(5*N),c+=(p+=x*(5*L))>>>13,p&=8191,y=c,y+=m*L,y+=R*C,y+=U*I,y+=P*(5*F),c=(y+=S*(5*K))>>>13,y&=8191,y+=T*(5*j),y+=M*(5*D),y+=O*(5*k),y+=B*(5*Y),d=c+=(y+=x*(5*N))>>>13,d+=m*N,d+=R*L,d+=U*C,d+=P*I,c=(d+=S*(5*F))>>>13,d&=8191,d+=T*(5*K),d+=M*(5*j),d+=O*(5*D),d+=B*(5*k),g=c+=(d+=x*(5*Y))>>>13,g+=m*Y,g+=R*N,g+=U*L,g+=P*C,c=(g+=S*I)>>>13,g&=8191,g+=T*(5*F),g+=M*(5*K),g+=O*(5*j),g+=B*(5*D),v=c+=(g+=x*(5*k))>>>13,v+=m*k,v+=R*Y,v+=U*N,v+=P*L,c=(v+=S*C)>>>13,v&=8191,v+=T*I,v+=M*(5*F),v+=O*(5*K),v+=B*(5*j),w=c+=(v+=x*(5*D))>>>13,w+=m*D,w+=R*k,w+=U*Y,w+=P*N,c=(w+=S*L)>>>13,w&=8191,w+=T*C,w+=M*I,w+=O*(5*F),w+=B*(5*K),_=c+=(w+=x*(5*j))>>>13,_+=m*j,_+=R*D,_+=U*k,_+=P*Y,c=(_+=S*N)>>>13,_&=8191,_+=T*L,_+=M*C,_+=O*I,_+=B*(5*F),b=c+=(_+=x*(5*K))>>>13,b+=m*K,b+=R*j,b+=U*D,b+=P*k,c=(b+=S*Y)>>>13,b&=8191,b+=T*N,b+=M*L,b+=O*C,b+=B*I,A=c+=(b+=x*(5*F))>>>13,A+=m*F,A+=R*K,A+=U*j,A+=P*D,c=(A+=S*k)>>>13,A&=8191,A+=T*Y,A+=M*N,A+=O*L,A+=B*C,m=l=8191&(c=(c=((c+=(A+=x*I)>>>13)<<2)+c|0)+(l&=8191)|0),R=p+=c>>>=13,U=y&=8191,P=d&=8191,S=g&=8191,T=v&=8191,M=w&=8191,O=_&=8191,B=b&=8191,x=A&=8191,r+=16,e-=16;this.h[0]=m,this.h[1]=R,this.h[2]=U,this.h[3]=P,this.h[4]=S,this.h[5]=T,this.h[6]=M,this.h[7]=O,this.h[8]=B,this.h[9]=x},U.prototype.finish=function(t,r){var e,n,o,i,s=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(e=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=e,e=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*e,e=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=e,e=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=e,s[0]=this.h[0]+5,e=s[0]>>>13,s[0]&=8191,i=1;i<10;i++)s[i]=this.h[i]+e,e=s[i]>>>13,s[i]&=8191;for(s[9]-=8192,n=(1^e)-1,i=0;i<10;i++)s[i]&=n;for(n=~n,i=0;i<10;i++)this.h[i]=this.h[i]&n|s[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;i<8;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;t[r+0]=this.h[0]>>>0&255,t[r+1]=this.h[0]>>>8&255,t[r+2]=this.h[1]>>>0&255,t[r+3]=this.h[1]>>>8&255,t[r+4]=this.h[2]>>>0&255,t[r+5]=this.h[2]>>>8&255,t[r+6]=this.h[3]>>>0&255,t[r+7]=this.h[3]>>>8&255,t[r+8]=this.h[4]>>>0&255,t[r+9]=this.h[4]>>>8&255,t[r+10]=this.h[5]>>>0&255,t[r+11]=this.h[5]>>>8&255,t[r+12]=this.h[6]>>>0&255,t[r+13]=this.h[6]>>>8&255,t[r+14]=this.h[7]>>>0&255,t[r+15]=this.h[7]>>>8&255},U.prototype.update=function(t,r,e){var n,o;if(this.leftover){for((o=16-this.leftover)>e&&(o=e),n=0;n=16&&(o=e-e%16,this.blocks(t,r,o),r+=o,e-=o),e){for(n=0;n=128;){for(E=0;E<16;E++)m=8*E+q,O[E]=e[m+0]<<24|e[m+1]<<16|e[m+2]<<8|e[m+3],B[E]=e[m+4]<<24|e[m+5]<<16|e[m+6]<<8|e[m+7];for(E=0;E<80;E++)if(o=x,i=I,s=C,a=L,u=N,f=Y,h=k,D,l=j,p=K,y=F,d=G,g=z,v=H,w=W,V,P=65535&(U=V),S=U>>>16,T=65535&(R=D),M=R>>>16,P+=65535&(U=(z>>>14|N<<18)^(z>>>18|N<<14)^(N>>>9|z<<23)),S+=U>>>16,T+=65535&(R=(N>>>14|z<<18)^(N>>>18|z<<14)^(z>>>9|N<<23)),M+=R>>>16,P+=65535&(U=z&H^~z&W),S+=U>>>16,T+=65535&(R=N&Y^~N&k),M+=R>>>16,P+=65535&(U=J[2*E+1]),S+=U>>>16,T+=65535&(R=J[2*E]),M+=R>>>16,R=O[E%16],S+=(U=B[E%16])>>>16,T+=65535&R,M+=R>>>16,T+=(S+=(P+=65535&U)>>>16)>>>16,P=65535&(U=A=65535&P|S<<16),S=U>>>16,T=65535&(R=b=65535&T|(M+=T>>>16)<<16),M=R>>>16,P+=65535&(U=(j>>>28|x<<4)^(x>>>2|j<<30)^(x>>>7|j<<25)),S+=U>>>16,T+=65535&(R=(x>>>28|j<<4)^(j>>>2|x<<30)^(j>>>7|x<<25)),M+=R>>>16,S+=(U=j&K^j&F^K&F)>>>16,T+=65535&(R=x&I^x&C^I&C),M+=R>>>16,c=65535&(T+=(S+=(P+=65535&U)>>>16)>>>16)|(M+=T>>>16)<<16,_=65535&P|S<<16,P=65535&(U=d),S=U>>>16,T=65535&(R=a),M=R>>>16,S+=(U=A)>>>16,T+=65535&(R=b),M+=R>>>16,I=o,C=i,L=s,N=a=65535&(T+=(S+=(P+=65535&U)>>>16)>>>16)|(M+=T>>>16)<<16,Y=u,k=f,D=h,x=c,K=l,F=p,G=y,z=d=65535&P|S<<16,H=g,W=v,V=w,j=_,E%16==15)for(m=0;m<16;m++)R=O[m],P=65535&(U=B[m]),S=U>>>16,T=65535&R,M=R>>>16,R=O[(m+9)%16],P+=65535&(U=B[(m+9)%16]),S+=U>>>16,T+=65535&R,M+=R>>>16,b=O[(m+1)%16],P+=65535&(U=((A=B[(m+1)%16])>>>1|b<<31)^(A>>>8|b<<24)^(A>>>7|b<<25)),S+=U>>>16,T+=65535&(R=(b>>>1|A<<31)^(b>>>8|A<<24)^b>>>7),M+=R>>>16,b=O[(m+14)%16],S+=(U=((A=B[(m+14)%16])>>>19|b<<13)^(b>>>29|A<<3)^(A>>>6|b<<26))>>>16,T+=65535&(R=(b>>>19|A<<13)^(A>>>29|b<<3)^b>>>6),M+=R>>>16,M+=(T+=(S+=(P+=65535&U)>>>16)>>>16)>>>16,O[m]=65535&T|M<<16,B[m]=65535&P|S<<16;P=65535&(U=j),S=U>>>16,T=65535&(R=x),M=R>>>16,R=t[0],S+=(U=r[0])>>>16,T+=65535&R,M+=R>>>16,M+=(T+=(S+=(P+=65535&U)>>>16)>>>16)>>>16,t[0]=x=65535&T|M<<16,r[0]=j=65535&P|S<<16,P=65535&(U=K),S=U>>>16,T=65535&(R=I),M=R>>>16,R=t[1],S+=(U=r[1])>>>16,T+=65535&R,M+=R>>>16,M+=(T+=(S+=(P+=65535&U)>>>16)>>>16)>>>16,t[1]=I=65535&T|M<<16,r[1]=K=65535&P|S<<16,P=65535&(U=F),S=U>>>16,T=65535&(R=C),M=R>>>16,R=t[2],S+=(U=r[2])>>>16,T+=65535&R,M+=R>>>16,M+=(T+=(S+=(P+=65535&U)>>>16)>>>16)>>>16,t[2]=C=65535&T|M<<16,r[2]=F=65535&P|S<<16,P=65535&(U=G),S=U>>>16,T=65535&(R=L),M=R>>>16,R=t[3],S+=(U=r[3])>>>16,T+=65535&R,M+=R>>>16,M+=(T+=(S+=(P+=65535&U)>>>16)>>>16)>>>16,t[3]=L=65535&T|M<<16,r[3]=G=65535&P|S<<16,P=65535&(U=z),S=U>>>16,T=65535&(R=N),M=R>>>16,R=t[4],S+=(U=r[4])>>>16,T+=65535&R,M+=R>>>16,M+=(T+=(S+=(P+=65535&U)>>>16)>>>16)>>>16,t[4]=N=65535&T|M<<16,r[4]=z=65535&P|S<<16,P=65535&(U=H),S=U>>>16,T=65535&(R=Y),M=R>>>16,R=t[5],S+=(U=r[5])>>>16,T+=65535&R,M+=R>>>16,M+=(T+=(S+=(P+=65535&U)>>>16)>>>16)>>>16,t[5]=Y=65535&T|M<<16,r[5]=H=65535&P|S<<16,P=65535&(U=W),S=U>>>16,T=65535&(R=k),M=R>>>16,R=t[6],S+=(U=r[6])>>>16,T+=65535&R,M+=R>>>16,M+=(T+=(S+=(P+=65535&U)>>>16)>>>16)>>>16,t[6]=k=65535&T|M<<16,r[6]=W=65535&P|S<<16,P=65535&(U=V),S=U>>>16,T=65535&(R=D),M=R>>>16,R=t[7],S+=(U=r[7])>>>16,T+=65535&R,M+=R>>>16,M+=(T+=(S+=(P+=65535&U)>>>16)>>>16)>>>16,t[7]=D=65535&T|M<<16,r[7]=V=65535&P|S<<16,q+=128,n-=128}return n}function X(t,r,e){var n,o=new Int32Array(8),i=new Int32Array(8),s=new Uint8Array(256),a=e;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,Z(o,i,r,e),e%=128,n=0;n=0;--o)Q(t,r,n=e[o/8|0]>>(7&o)&1),$(r,t),$(t,t),Q(t,r,n)}function et(t,e){var n=[r(),r(),r(),r()];O(n[0],c),O(n[1],l),O(n[2],a),D(n[3],c,l),rt(t,n,e)}function nt(t,e,o){var i,s=new Uint8Array(64),a=[r(),r(),r(),r()];for(o||n(e,32),X(s,e,32),s[0]&=248,s[31]&=127,s[31]|=64,et(a,s),tt(t,a),i=0;i<32;i++)e[i+32]=t[i];return 0}var ot=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function it(t,r){var e,n,o,i;for(n=63;n>=32;--n){for(e=0,o=n-32,i=n-12;o>4)*ot[o],e=r[o]>>8,r[o]&=255;for(o=0;o<32;o++)r[o]-=e*ot[o];for(n=0;n<32;n++)r[n+1]+=r[n]>>8,t[n]=255&r[n]}function st(t){var r,e=new Float64Array(64);for(r=0;r<64;r++)e[r]=t[r];for(r=0;r<64;r++)t[r]=0;it(t,e)}function at(t,e,n,o){var i,s,a=new Uint8Array(64),u=new Uint8Array(64),f=new Uint8Array(64),h=new Float64Array(64),c=[r(),r(),r(),r()];X(a,o,32),a[0]&=248,a[31]&=127,a[31]|=64;var l=n+64;for(i=0;i>7&&k(t[0],s,t[0]),D(t[3],t[0],t[1]),0)}(l,o))return-1;for(i=0;i=0},t.sign.keyPair=function(){var t=new Uint8Array(32),r=new Uint8Array(64);return nt(t,r),{publicKey:t,secretKey:r}},t.sign.keyPair.fromSecretKey=function(t){if(ht(t),64!==t.length)throw new Error("bad secret key size");for(var r=new Uint8Array(32),e=0;e{const a=await fetch(r.discordAPIBase+t,{...s||{},headers:{...(null==s?void 0:s.headers)||{},authorization:`${o[i]} ${e}`,"user-agent":n.userAgent}});return a.status>=400&&console.error("discordFetch failed",{url:t,authType:i,payload:await a.text()}),a.ok?await a.json():null}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.kvOrLocal=r.WrappedKVNamespace=void 0;r.WrappedKVNamespace=class{constructor(t){this.kvNamespace=t,this.list=this.kvNamespace.list,this.getWithMetadata=this.kvNamespace.getWithMetadata,this.delete=this.kvNamespace.delete}async get(t){const r=await this.kvNamespace.get(t,"text");return r?JSON.parse(r):null}async put(t,r,e){await this.kvNamespace.put(t,JSON.stringify(r),{expirationTtl:e})}};class n{constructor(){this.data=new Map,console.warn("EmulatedKV used. Data will be lost.")}async get(t){return this.data.has(t)?this.data.get(t):null}async getWithMetadata(t){return{value:await this.get(t),metadata:{}}}async put(t,r){this.data.set(t,r)}async delete(t){this.data.delete(t)}async list(t){let r=[];for(let e of this.data.keys())(null==t?void 0:t.prefix)&&!e.startsWith(t.prefix)||r.push({name:e});return{keys:r,cursor:"0",list_complete:!0}}}r.kvOrLocal=t=>t||new n},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.healthz=void 0;const n=e(0);r.healthz=async t=>n.respond({ok:!0})}]); \ No newline at end of file