@soonspacejs/plugin-cps-soonmanager 2.9.11 → 2.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
- import t from"soonspacejs";import{Vector4 as e,TextureLoader as r,Object3D as i,Vector2 as n,OrthographicCamera as o,MeshBasicMaterial as s,Mesh as a,PlaneGeometry as h,RepeatWrapping as u,Box3 as f,Vector3 as l,Matrix4 as c}from"three";var d=function(t,e){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},d(t,e)};function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var m=function(){return m=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},m.apply(this,arguments)};function g(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}function y(t,e,r,i){var n,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,r,s):n(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}function b(t,e){return function(r,i){e(r,i,t)}}function v(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function w(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof r?t:new r((function(e){e(t)}))}(t.value).then(s,a)}h((i=i.apply(t,e||[])).next())}))}function _(t,e){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(h){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,h])}}}var M=Object.create?function(t,e,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]};function S(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||M(e,t,r)}function E(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function k(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s}function A(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(k(arguments[e]));return t}function O(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var i=Array(t),n=0;for(e=0;e<r;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,n++)i[n]=o[s];return i}function T(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function I(t){return this instanceof I?(this.v=t,this):new I(t)}function R(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(t,e||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(t){n[t]&&(i[t]=function(e){return new Promise((function(r,i){o.push([t,e,r,i])>1||a(t,e)}))})}function a(t,e){try{!function(t){t.value instanceof I?Promise.resolve(t.value.v).then(h,u):f(o[0][2],t)}(n[t](e))}catch(t){f(o[0][3],t)}}function h(t){a("next",t)}function u(t){a("throw",t)}function f(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}function C(t){var e,r;return e={},i("next"),i("throw",(function(t){throw t})),i("return"),e[Symbol.iterator]=function(){return this},e;function i(i,n){e[i]=t[i]?function(e){return(r=!r)?{value:I(t[i](e)),done:!1}:n?n(e):e}:n}}function P(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=E(t),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(r){e[r]=t[r]&&function(e){return new Promise((function(i,n){(function(t,e,r,i){Promise.resolve(i).then((function(e){t({value:e,done:r})}),e)})(i,n,(e=t[r](e)).done,e.value)}))}}}function x(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var N=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function B(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&M(e,t,r);return N(e,t),e}function L(t){return t&&t.__esModule?t:{default:t}}function D(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)}function j(t,e,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r}function U(t,e){if(null===e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof t?e===t:t.has(e)}function q(t,e,r){if(null!=e){if("object"!=typeof e&&"function"!=typeof e)throw new TypeError("Object expected.");var i;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=e[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=e[Symbol.dispose]}if("function"!=typeof i)throw new TypeError("Object not disposable.");t.stack.push({value:e,dispose:i,async:r})}else r&&t.stack.push({async:!0});return e}var F="function"==typeof SuppressedError?SuppressedError:function(t,e,r){var i=new Error(r);return i.name="SuppressedError",i.error=t,i.suppressed=e,i};function z(t){function e(e){t.error=t.hasError?new F(e,t.error,"An error was suppressed during disposal."):e,t.hasError=!0}return function r(){for(;t.stack.length;){var i=t.stack.pop();try{var n=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(n).then(r,(function(t){return e(t),r()}))}catch(t){e(t)}}if(t.hasError)throw t.error}()}var H={__extends:p,__assign:m,__rest:g,__decorate:y,__param:b,__metadata:v,__awaiter:w,__generator:_,__createBinding:M,__exportStar:S,__values:E,__read:k,__spread:A,__spreadArrays:O,__spreadArray:T,__await:I,__asyncGenerator:R,__asyncDelegator:C,__asyncValues:P,__makeTemplateObject:x,__importStar:B,__importDefault:L,__classPrivateFieldGet:D,__classPrivateFieldSet:j,__classPrivateFieldIn:U,__addDisposableResource:q,__disposeResources:z},K=Object.freeze({__proto__:null,__addDisposableResource:q,get __assign(){return m},__asyncDelegator:C,__asyncGenerator:R,__asyncValues:P,__await:I,__awaiter:w,__classPrivateFieldGet:D,__classPrivateFieldIn:U,__classPrivateFieldSet:j,__createBinding:M,__decorate:y,__disposeResources:z,__esDecorate:function(t,e,r,i,n,o){function s(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var a,h=i.kind,u="getter"===h?"get":"setter"===h?"set":"value",f=!e&&t?i.static?t:t.prototype:null,l=e||(f?Object.getOwnPropertyDescriptor(f,i.name):{}),c=!1,d=r.length-1;d>=0;d--){var p={};for(var m in i)p[m]="access"===m?{}:i[m];for(var m in i.access)p.access[m]=i.access[m];p.addInitializer=function(t){if(c)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(t||null))};var g=(0,r[d])("accessor"===h?{get:l.get,set:l.set}:l[u],p);if("accessor"===h){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=s(g.get))&&(l.get=a),(a=s(g.set))&&(l.set=a),(a=s(g.init))&&n.unshift(a)}else(a=s(g))&&("field"===h?n.unshift(a):l[u]=a)}f&&Object.defineProperty(f,i.name,l),c=!0},__exportStar:S,__extends:p,__generator:_,__importDefault:L,__importStar:B,__makeTemplateObject:x,__metadata:v,__param:b,__propKey:function(t){return"symbol"==typeof t?t:"".concat(t)},__read:k,__rest:g,__runInitializers:function(t,e,r){for(var i=arguments.length>2,n=0;n<e.length;n++)r=i?e[n].call(t,r):e[n].call(t);return i?r:void 0},__setFunctionName:function(t,e,r){return"symbol"==typeof e&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})},__spread:A,__spreadArray:T,__spreadArrays:O,__values:E,default:H});const V={width:"400px",height:"300px",backgroundColor:"black"};var G;!function(t){t.PANEL="PANEL",t.VIDEO="VIDEO",t.VIDEO_STREAM="VIDEO_STREAM"}(G||(G={}));class W{constructor(t){this.ssp=t}resetStyleName(t){const e=[...t];for(const t in e)e[t]!==e[t].toLowerCase()&&(e[t]=`-${e[t].toLowerCase()}`);return e.join("")}mergeElementStyle(t){let e="";for(const r in t)e+=`${this.resetStyleName(r)}: ${t[r]};`;return e}renderCustom(t){const{tagName:e,style:r=V,innerHTML:i}=t,n=document.createElement(e);return n.style.cssText=this.mergeElementStyle(r),i&&(n.innerHTML=i),this.ssp.createPoiNode(Object.assign(Object.assign({},t),{element:n}))}renderVideo(t){const{src:e,style:r=V,isLoop:i=!0,autoPlay:n=!0}=t,o=document.createElement("video");return o.style.cssText=this.mergeElementStyle(r),o.controls=!0,o.muted=!0,o.loop=i,o.autoplay=n,e&&(o.src=e),this.ssp.createPoiNode(Object.assign(Object.assign({},t),{element:o}))}renderPanel(t){const{dataSource:e,rowStyle:r,labelStyle:i,valueStyle:n}=t,o=e.map((t=>`<div style="${this.mergeElementStyle(r||{})}">\n<span style="${this.mergeElementStyle(i||{})}">${t.label}</span>\n<span style="${this.mergeElementStyle(n||{})}">${t.value}</span>\n</div>`)).join("");return this.renderCustom(Object.assign(Object.assign({tagName:"div"},t),{innerHTML:o}))}batchRender(t){const{dataSource:e}=t,r=t=>{const{id:e,pid:r,width:i,height:n,dataSource:o,fileUrl:s,style:a,visible:h}=t;let u=this.ssp.getObjectById(e),f=h;if(u&&(f=u.visible,this.ssp.removeObjectById(e)),t.contentType===G.VIDEO)u=this.renderVideo(Object.assign(Object.assign({},t),{src:s,visible:f,style:{width:i+"px",height:n+"px"}}));else if(t.contentType===G.PANEL){const{panel:{bodyStyle:e,rowStyle:r,labelStyle:h,valueStyle:l}}=JSON.parse(a);u=this.renderPanel(Object.assign(Object.assign({},t),{visible:f,style:Object.assign(Object.assign({width:i+"px",height:n+"px",backgroundImage:`url(${s})`,overflow:"auto"},e),{padding:e.padding+"px"}),rowStyle:Object.assign(Object.assign({},r),{gap:r.gap+"px"}),labelStyle:Object.assign(Object.assign({},h),{fontSize:h.fontSize+"px"}),valueStyle:Object.assign(Object.assign({},l),{fontSize:l.fontSize+"px"}),dataSource:o}))}if(u&&r){const t=this.ssp.getObjectById(r);t&&this.ssp.addObject(u,t)}};e.forEach((t=>{r(t)}))}}var Y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Z(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function X(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){if(this instanceof t){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(e,r))}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),r}var Q={},J={},$=X(K),tt={},et={},rt={},it={};Object.defineProperty(it,"__esModule",{value:!0}),it.Slot=void 0;var nt=function(){function t(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=t,this._once=r,this._signal=e,this._priority=i,this.verifyListener(t)}return t.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},t.prototype.execute1=function(t){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[t].concat(this._params)):this._listener(t))},t.prototype.execute=function(t){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(t=t.concat(this._params));var e=t.length;0===e?this._listener():1===e?this._listener(t[0]):2===e?this._listener(t[0],t[1]):3===e?this._listener(t[0],t[1],t[2]):this._listener.apply(null,t)}},Object.defineProperty(t.prototype,"listener",{get:function(){return this._listener},set:function(t){if(null==t)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(t),this._listener=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"once",{get:function(){return this._once},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return this._priority},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"params",{get:function(){return this._params},set:function(t){this._params=t},enumerable:!1,configurable:!0}),t.prototype.remove=function(){this._signal.remove(this._listener)},t.prototype.verifyListener=function(t){if(null==t)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},t}();it.Slot=nt;var ot={};Object.defineProperty(ot,"__esModule",{value:!0}),ot.SlotList=void 0;var st=function(){function t(e,r){if(void 0===r&&(r=null),this.nonEmpty=!1,e||r){if(!e)throw new Error("Parameter head cannot be null.");this.head=e,this.tail=r||t.NIL,this.nonEmpty=!0}else{if(t.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(t.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===t.NIL)return 1;for(var e=0,r=this;r.nonEmpty;)++e,r=r.tail;return e},enumerable:!1,configurable:!0}),t.prototype.prepend=function(e){return new t(e,this)},t.prototype.append=function(e){if(!e)return this;if(!this.nonEmpty)return new t(e);if(this.tail===t.NIL)return new t(e).prepend(this.head);for(var r=new t(this.head),i=r,n=this.tail;n.nonEmpty;)i=i.tail=new t(n.head),n=n.tail;return i.tail=new t(e),r},t.prototype.insertWithPriority=function(e){if(!this.nonEmpty)return new t(e);var r=e.priority;if(r>this.head.priority)return this.prepend(e);for(var i=new t(this.head),n=i,o=this.tail;o.nonEmpty;){if(r>o.head.priority)return n.tail=o.prepend(e),i;n=n.tail=new t(o.head),o=o.tail}return n.tail=new t(e),i},t.prototype.filterNot=function(e){if(!this.nonEmpty||null==e)return this;if(e===this.head.listener)return this.tail;for(var r=new t(this.head),i=r,n=this.tail;n.nonEmpty;){if(n.head.listener===e)return i.tail=n.tail,r;i=i.tail=new t(n.head),n=n.tail}return this},t.prototype.contains=function(t){if(!this.nonEmpty)return!1;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return!0;e=e.tail}return!1},t.prototype.find=function(t){if(!this.nonEmpty)return null;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return e.head;e=e.tail}return null},t.prototype.toString=function(){for(var t="",e=this;e.nonEmpty;)t+=e.head+" -> ",e=e.tail;return"[List "+(t+="NIL")+"]"},t.NIL=new t(null,null),t}();ot.SlotList=st,Object.defineProperty(rt,"__esModule",{value:!0}),rt.OnceSignal=void 0;var at=it,ht=ot,ut=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.slots=ht.SlotList.NIL,this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if(!(this._valueClasses[e]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+">."+this._valueClasses[e])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!1,configurable:!0}),t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){var e=this.slots.find(t);return e?(this.slots=this.slots.filterNot(t),e):null},t.prototype.removeAll=function(){this.slots=ht.SlotList.NIL},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(!(null===t[n]||t[n]instanceof this._valueClasses[n]||t[n].constructor===this._valueClasses[n]))throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(t),o=o.tail},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.registrationPossible(t,e)){var r=new at.Slot(t,this,e);return this.slots=this.slots.prepend(r),r}return this.slots.find(t)},t.prototype.registrationPossible=function(t,e){if(!this.slots.nonEmpty)return!0;var r=this.slots.find(t);if(!r)return!0;if(r.once!==e)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},t}();rt.OnceSignal=ut,Object.defineProperty(et,"__esModule",{value:!0}),et.Signal=void 0;var ft=$,lt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ft.__extends(e,t),e.prototype.add=function(t){return this.registerListener(t)},e}(rt.OnceSignal);et.Signal=lt,Object.defineProperty(tt,"__esModule",{value:!0}),tt.PrioritySignal=void 0;var ct=$,dt=it,pt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ct.__extends(e,t),e.prototype.addWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!1,e)},e.prototype.addOnceWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!0,e)},e.prototype.registerListener=function(t,e){return void 0===e&&(e=!1),this.registerListenerWithPriority(t,e)},e.prototype.registerListenerWithPriority=function(t,e,r){if(void 0===r&&(r=0),this.registrationPossible(t,e)){var i=new dt.Slot(t,this,e,r);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(t)},e}(et.Signal);tt.PrioritySignal=pt,Object.defineProperty(J,"__esModule",{value:!0}),J.DeluxeSignal=void 0;var mt=$,gt=function(t){function e(e){void 0===e&&(e=null);for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=this;return r=1===r.length&&r[0]instanceof Array?r[0]:r,(n=t.call(this,r)||this)._target=e,n}return mt.__extends(e,t),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(t){t!==this._target&&(this.removeAll(),this._target=t)},enumerable:!1,configurable:!0}),e.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(null!==t[n]&&t[n].constructor!==this._valueClasses[n])throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");var o=t[0];o&&(o.target&&(o=o.clone(),t[0]=o),o.target=this.target,o.currentTarget=this.target,o.signal=this);for(var s=this.slots;s.nonEmpty;)s.head.execute(t),s=s.tail;if(o&&o.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(null===(a=a.parent).onEventBubbled||(o.currentTarget=a,a.onEventBubbled(o))););},e}(tt.PrioritySignal);J.DeluxeSignal=gt;var yt={};Object.defineProperty(yt,"__esModule",{value:!0}),yt.GenericEvent=void 0;var bt=function(){function t(t){void 0===t&&(t=!1),this._bubbles=t}return Object.defineProperty(t.prototype,"signal",{get:function(){return this._signal},set:function(t){this._signal=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(t){this._target=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(t){this._currentTarget=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bubbles",{get:function(){return this._bubbles},set:function(t){this._bubbles=t},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return new t(this._bubbles)},t}();yt.GenericEvent=bt;var vt={};Object.defineProperty(vt,"__esModule",{value:!0}),vt.IOnceSignal=void 0,vt.IOnceSignal=Symbol("IOnceSignal");var wt={};Object.defineProperty(wt,"__esModule",{value:!0}),wt.IPrioritySignal=void 0,wt.IPrioritySignal=Symbol("IPrioritySignal");var _t={};Object.defineProperty(_t,"__esModule",{value:!0}),_t.ISignal=void 0,_t.ISignal=Symbol("ISignal");var Mt={};Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.ISlot=void 0,Mt.ISlot=Symbol("ISlot");var St={};Object.defineProperty(St,"__esModule",{value:!0}),St.MonoSignal=void 0;var Et=it,kt=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if("function"!=typeof this._valueClasses[e])throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+"'>."+this._valueClasses[e])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!1,configurable:!0}),t.prototype.add=function(t){return this.registerListener(t)},t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){if(this.slot&&this.slot.listener===t){var e=this.slot;return this.slot=null,e}return null},t.prototype.removeAll=function(){this.slot&&this.slot.remove()},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(!(null===t[n]||t[n]instanceof this._valueClasses[n]||t[n].constructor===this._valueClasses[n]))throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");this.slot&&this.slot.execute(t)},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new Et.Slot(t,this,e)},t}();St.MonoSignal=kt;var At={};Object.defineProperty(At,"__esModule",{value:!0}),At.Promise=void 0;var Ot=$,Tt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ot.__extends(e,t),e.prototype.addOnce=function(e){var r=t.prototype.addOnce.call(this,e);return this._isDispatched&&(r.execute(this._valueObjects),r.remove()),r},e.prototype.dispatch=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(this._isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this._isDispatched=!0,this._valueObjects=e,t.prototype.dispatch.apply(this,e)},e}(rt.OnceSignal);function It(t,e){return this.edges.filter((r=>r.sourceNodeId===t&&r.sourceNodeHandleId===e))}At.Promise=Tt,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SlotList=t.Slot=t.Signal=t.Promise=t.PrioritySignal=t.OnceSignal=t.MonoSignal=t.ISlot=t.ISignal=t.IPrioritySignal=t.IOnceSignal=t.GenericEvent=t.DeluxeSignal=void 0;var e=J;Object.defineProperty(t,"DeluxeSignal",{enumerable:!0,get:function(){return e.DeluxeSignal}});var r=yt;Object.defineProperty(t,"GenericEvent",{enumerable:!0,get:function(){return r.GenericEvent}});var i=vt;Object.defineProperty(t,"IOnceSignal",{enumerable:!0,get:function(){return i.IOnceSignal}});var n=wt;Object.defineProperty(t,"IPrioritySignal",{enumerable:!0,get:function(){return n.IPrioritySignal}});var o=_t;Object.defineProperty(t,"ISignal",{enumerable:!0,get:function(){return o.ISignal}});var s=Mt;Object.defineProperty(t,"ISlot",{enumerable:!0,get:function(){return s.ISlot}});var a=St;Object.defineProperty(t,"MonoSignal",{enumerable:!0,get:function(){return a.MonoSignal}});var h=rt;Object.defineProperty(t,"OnceSignal",{enumerable:!0,get:function(){return h.OnceSignal}});var u=tt;Object.defineProperty(t,"PrioritySignal",{enumerable:!0,get:function(){return u.PrioritySignal}});var f=At;Object.defineProperty(t,"Promise",{enumerable:!0,get:function(){return f.Promise}});var l=et;Object.defineProperty(t,"Signal",{enumerable:!0,get:function(){return l.Signal}});var c=it;Object.defineProperty(t,"Slot",{enumerable:!0,get:function(){return c.Slot}});var d=ot;Object.defineProperty(t,"SlotList",{enumerable:!0,get:function(){return d.SlotList}})}(Q);let Rt=class{async _runFlowHandler(t){const e=this.nodes.filter((({isStartNode:t})=>t));if(0===e.length)return Promise.reject("In SoonFlow: CommonHandler _runFlowHandler not find startNode");for(let r=0;r<e.length;r++)for(let i=0;i<e[r].outputs.length;i++)await t.call(this,e[r],e[r].outputs[i])}async _operateFlowNode(t,e,r){const i=It.call(this,e.id,r.id);if(0===i.length)return;const n=i.map((t=>t.targetNodeId));for(let i=0;i<n.length;i++){const o=n[i],s=this.nodes.find((t=>t.id===o));if(!s)return Promise.reject("In SoonFlow: CommonHandler _operateFlowNode not find nextNode");const{type:a}=s,h=this.nodeTypeMethods[a];if(!h)return Promise.reject("In SoonFlow: CommonHandler _operateFlowNode not find nodeTypeMethod");await(h[t]?.call(this,{prevNode:e,node:s,inputData:r.data}))}}},Ct=class extends Rt{nodes;edges;nodeTypeMethods;outInstances;#t=new Map;constructor(t,e,r,i){super(),this.nodes=t,this.edges=e,this.nodeTypeMethods=r,this.outInstances=i}getOutInstance(t){return this.outInstances[t]}getPrevNodeList(t){const e=this.edges.filter((e=>e.targetNodeHandleId===t)),r=[];return e.forEach((t=>{this.nodes.forEach((e=>{e.outputs.some((e=>e.id===t.sourceNodeHandleId))&&(r.find((t=>t.id===e.id))||r.push(e))}))})),r}async runParse(){return this._runFlowHandler(this.parseFlowNode)}async parseFlowNode(t,e){return this._operateFlowNode("parse",t,e)}addSignal(t,e){const r=new Q.Signal;r.add(e),this.#t.set(t,r)}dispatchSignal(t){this.#t.get(t)?.dispatch()}},Pt=class extends Rt{nodes;edges;nodeTypeMethods;outInstances;constructor(t,e,r,i){super(),this.nodes=t,this.edges=e,this.nodeTypeMethods=r,this.outInstances=i,this.#e()}#e(){this._runFlowHandler(this.unregisterFlowNode)}async unregisterFlowNode(t,e){return this._operateFlowNode("unregister",t,e)}};class xt{path;constructor(t){this.path=t}setPath(t){this.path=t}async getFlowData(){return{flowList:(await(await this.fetchFileData("/db/flows.json")).json()).map((t=>{const{nodeData:e}=t,{nodeList:r,lineList:i}=e;return{...t,nodes:r.map((t=>({...t,inputs:t.handlerList.filter((({type:t})=>"target"===t)),outputs:t.handlerList.filter((({type:t})=>"source"===t)),isStartNode:"start"===t.type}))),edges:i.map((t=>({...t,sourceNodeHandleId:t.sourceHandlerId,targetNodeHandleId:t.targetHandlerId})))}}))}}fetchFileData(t){return fetch(`${this.path}${t}`)}}var Nt={},Bt={},Lt={},Dt={},jt={};Object.defineProperty(jt,"__esModule",{value:!0}),jt.Slot=void 0;var Ut=function(){function t(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=t,this._once=r,this._signal=e,this._priority=i,this.verifyListener(t)}return t.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},t.prototype.execute1=function(t){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[t].concat(this._params)):this._listener(t))},t.prototype.execute=function(t){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(t=t.concat(this._params));var e=t.length;0===e?this._listener():1===e?this._listener(t[0]):2===e?this._listener(t[0],t[1]):3===e?this._listener(t[0],t[1],t[2]):this._listener.apply(null,t)}},Object.defineProperty(t.prototype,"listener",{get:function(){return this._listener},set:function(t){if(null==t)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(t),this._listener=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"once",{get:function(){return this._once},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return this._priority},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"params",{get:function(){return this._params},set:function(t){this._params=t},enumerable:!1,configurable:!0}),t.prototype.remove=function(){this._signal.remove(this._listener)},t.prototype.verifyListener=function(t){if(null==t)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},t}();jt.Slot=Ut;var qt={};Object.defineProperty(qt,"__esModule",{value:!0}),qt.SlotList=void 0;var Ft=function(){function t(e,r){if(void 0===r&&(r=null),this.nonEmpty=!1,e||r){if(!e)throw new Error("Parameter head cannot be null.");this.head=e,this.tail=r||t.NIL,this.nonEmpty=!0}else{if(t.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(t.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===t.NIL)return 1;for(var e=0,r=this;r.nonEmpty;)++e,r=r.tail;return e},enumerable:!1,configurable:!0}),t.prototype.prepend=function(e){return new t(e,this)},t.prototype.append=function(e){if(!e)return this;if(!this.nonEmpty)return new t(e);if(this.tail===t.NIL)return new t(e).prepend(this.head);for(var r=new t(this.head),i=r,n=this.tail;n.nonEmpty;)i=i.tail=new t(n.head),n=n.tail;return i.tail=new t(e),r},t.prototype.insertWithPriority=function(e){if(!this.nonEmpty)return new t(e);var r=e.priority;if(r>this.head.priority)return this.prepend(e);for(var i=new t(this.head),n=i,o=this.tail;o.nonEmpty;){if(r>o.head.priority)return n.tail=o.prepend(e),i;n=n.tail=new t(o.head),o=o.tail}return n.tail=new t(e),i},t.prototype.filterNot=function(e){if(!this.nonEmpty||null==e)return this;if(e===this.head.listener)return this.tail;for(var r=new t(this.head),i=r,n=this.tail;n.nonEmpty;){if(n.head.listener===e)return i.tail=n.tail,r;i=i.tail=new t(n.head),n=n.tail}return this},t.prototype.contains=function(t){if(!this.nonEmpty)return!1;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return!0;e=e.tail}return!1},t.prototype.find=function(t){if(!this.nonEmpty)return null;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return e.head;e=e.tail}return null},t.prototype.toString=function(){for(var t="",e=this;e.nonEmpty;)t+=e.head+" -> ",e=e.tail;return"[List "+(t+="NIL")+"]"},t.NIL=new t(null,null),t}();qt.SlotList=Ft,Object.defineProperty(Dt,"__esModule",{value:!0}),Dt.OnceSignal=void 0;var zt=jt,Ht=qt,Kt=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.slots=Ht.SlotList.NIL,this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if(!(this._valueClasses[e]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+">."+this._valueClasses[e])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!1,configurable:!0}),t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){var e=this.slots.find(t);return e?(this.slots=this.slots.filterNot(t),e):null},t.prototype.removeAll=function(){this.slots=Ht.SlotList.NIL},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(!(null===t[n]||t[n]instanceof this._valueClasses[n]||t[n].constructor===this._valueClasses[n]))throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(t),o=o.tail},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.registrationPossible(t,e)){var r=new zt.Slot(t,this,e);return this.slots=this.slots.prepend(r),r}return this.slots.find(t)},t.prototype.registrationPossible=function(t,e){if(!this.slots.nonEmpty)return!0;var r=this.slots.find(t);if(!r)return!0;if(r.once!==e)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},t}();Dt.OnceSignal=Kt,Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.Signal=void 0;var Vt=$,Gt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Vt.__extends(e,t),e.prototype.add=function(t){return this.registerListener(t)},e}(Dt.OnceSignal);Lt.Signal=Gt,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.PrioritySignal=void 0;var Wt=$,Yt=jt,Zt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Wt.__extends(e,t),e.prototype.addWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!1,e)},e.prototype.addOnceWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!0,e)},e.prototype.registerListener=function(t,e){return void 0===e&&(e=!1),this.registerListenerWithPriority(t,e)},e.prototype.registerListenerWithPriority=function(t,e,r){if(void 0===r&&(r=0),this.registrationPossible(t,e)){var i=new Yt.Slot(t,this,e,r);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(t)},e}(Lt.Signal);Bt.PrioritySignal=Zt,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.DeluxeSignal=void 0;var Xt=$,Qt=function(t){function e(e){void 0===e&&(e=null);for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=this;return r=1===r.length&&r[0]instanceof Array?r[0]:r,(n=t.call(this,r)||this)._target=e,n}return Xt.__extends(e,t),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(t){t!==this._target&&(this.removeAll(),this._target=t)},enumerable:!1,configurable:!0}),e.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(null!==t[n]&&t[n].constructor!==this._valueClasses[n])throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");var o=t[0];o&&(o.target&&(o=o.clone(),t[0]=o),o.target=this.target,o.currentTarget=this.target,o.signal=this);for(var s=this.slots;s.nonEmpty;)s.head.execute(t),s=s.tail;if(o&&o.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(null===(a=a.parent).onEventBubbled||(o.currentTarget=a,a.onEventBubbled(o))););},e}(Bt.PrioritySignal);Nt.DeluxeSignal=Qt;var Jt={};Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.GenericEvent=void 0;var $t=function(){function t(t){void 0===t&&(t=!1),this._bubbles=t}return Object.defineProperty(t.prototype,"signal",{get:function(){return this._signal},set:function(t){this._signal=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(t){this._target=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(t){this._currentTarget=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bubbles",{get:function(){return this._bubbles},set:function(t){this._bubbles=t},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return new t(this._bubbles)},t}();Jt.GenericEvent=$t;var te={};Object.defineProperty(te,"__esModule",{value:!0}),te.IOnceSignal=void 0,te.IOnceSignal=Symbol("IOnceSignal");var ee={};Object.defineProperty(ee,"__esModule",{value:!0}),ee.IPrioritySignal=void 0,ee.IPrioritySignal=Symbol("IPrioritySignal");var re={};Object.defineProperty(re,"__esModule",{value:!0}),re.ISignal=void 0,re.ISignal=Symbol("ISignal");var ie={};Object.defineProperty(ie,"__esModule",{value:!0}),ie.ISlot=void 0,ie.ISlot=Symbol("ISlot");var ne={};Object.defineProperty(ne,"__esModule",{value:!0}),ne.MonoSignal=void 0;var oe=jt,se=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if("function"!=typeof this._valueClasses[e])throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+"'>."+this._valueClasses[e])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!1,configurable:!0}),t.prototype.add=function(t){return this.registerListener(t)},t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){if(this.slot&&this.slot.listener===t){var e=this.slot;return this.slot=null,e}return null},t.prototype.removeAll=function(){this.slot&&this.slot.remove()},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(!(null===t[n]||t[n]instanceof this._valueClasses[n]||t[n].constructor===this._valueClasses[n]))throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");this.slot&&this.slot.execute(t)},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new oe.Slot(t,this,e)},t}();ne.MonoSignal=se;var ae={};Object.defineProperty(ae,"__esModule",{value:!0}),ae.Promise=void 0;var he=$,ue=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return he.__extends(e,t),e.prototype.addOnce=function(e){var r=t.prototype.addOnce.call(this,e);return this._isDispatched&&(r.execute(this._valueObjects),r.remove()),r},e.prototype.dispatch=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(this._isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this._isDispatched=!0,this._valueObjects=e,t.prototype.dispatch.apply(this,e)},e}(Dt.OnceSignal);ae.Promise=ue,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SlotList=t.Slot=t.Signal=t.Promise=t.PrioritySignal=t.OnceSignal=t.MonoSignal=t.ISlot=t.ISignal=t.IPrioritySignal=t.IOnceSignal=t.GenericEvent=t.DeluxeSignal=void 0;var e=Nt;Object.defineProperty(t,"DeluxeSignal",{enumerable:!0,get:function(){return e.DeluxeSignal}});var r=Jt;Object.defineProperty(t,"GenericEvent",{enumerable:!0,get:function(){return r.GenericEvent}});var i=te;Object.defineProperty(t,"IOnceSignal",{enumerable:!0,get:function(){return i.IOnceSignal}});var n=ee;Object.defineProperty(t,"IPrioritySignal",{enumerable:!0,get:function(){return n.IPrioritySignal}});var o=re;Object.defineProperty(t,"ISignal",{enumerable:!0,get:function(){return o.ISignal}});var s=ie;Object.defineProperty(t,"ISlot",{enumerable:!0,get:function(){return s.ISlot}});var a=ne;Object.defineProperty(t,"MonoSignal",{enumerable:!0,get:function(){return a.MonoSignal}});var h=Dt;Object.defineProperty(t,"OnceSignal",{enumerable:!0,get:function(){return h.OnceSignal}});var u=Bt;Object.defineProperty(t,"PrioritySignal",{enumerable:!0,get:function(){return u.PrioritySignal}});var f=ae;Object.defineProperty(t,"Promise",{enumerable:!0,get:function(){return f.Promise}});var l=Lt;Object.defineProperty(t,"Signal",{enumerable:!0,get:function(){return l.Signal}});var c=jt;Object.defineProperty(t,"Slot",{enumerable:!0,get:function(){return c.Slot}});var d=qt;Object.defineProperty(t,"SlotList",{enumerable:!0,get:function(){return d.SlotList}})}({});const fe=(t,...e)=>{console.error(`In SoonFlow: ${t}`,...e)};var le="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function ce(t,e){return function(){return t.apply(e,arguments)}}const{toString:de}=Object.prototype,{getPrototypeOf:pe}=Object,me=(t=>e=>{const r=de.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ge=t=>(t=t.toLowerCase(),e=>me(e)===t),ye=t=>e=>typeof e===t,{isArray:be}=Array,ve=ye("undefined");const we=ge("ArrayBuffer");const _e=ye("string"),Me=ye("function"),Se=ye("number"),Ee=t=>null!==t&&"object"==typeof t,ke=t=>{if("object"!==me(t))return!1;const e=pe(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},Ae=ge("Date"),Oe=ge("File"),Te=ge("Blob"),Ie=ge("FileList"),Re=ge("URLSearchParams");function Ce(t,e,{allOwnKeys:r=!1}={}){if(null==t)return;let i,n;if("object"!=typeof t&&(t=[t]),be(t))for(i=0,n=t.length;i<n;i++)e.call(null,t[i],i,t);else{const n=r?Object.getOwnPropertyNames(t):Object.keys(t),o=n.length;let s;for(i=0;i<o;i++)s=n[i],e.call(null,t[s],s,t)}}function Pe(t,e){e=e.toLowerCase();const r=Object.keys(t);let i,n=r.length;for(;n-- >0;)if(i=r[n],e===i.toLowerCase())return i;return null}const xe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:le,Ne=t=>!ve(t)&&t!==xe;const Be=(Le="undefined"!=typeof Uint8Array&&pe(Uint8Array),t=>Le&&t instanceof Le);var Le;const De=ge("HTMLFormElement"),je=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Ue=ge("RegExp"),qe=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),i={};Ce(r,((r,n)=>{!1!==e(r,n,t)&&(i[n]=r)})),Object.defineProperties(t,i)},Fe="abcdefghijklmnopqrstuvwxyz",ze="0123456789",He={DIGIT:ze,ALPHA:Fe,ALPHA_DIGIT:Fe+Fe.toUpperCase()+ze};const Ke=ge("AsyncFunction");var Ve={isArray:be,isArrayBuffer:we,isBuffer:function(t){return null!==t&&!ve(t)&&null!==t.constructor&&!ve(t.constructor)&&Me(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||Me(t.append)&&("formdata"===(e=me(t))||"object"===e&&Me(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&we(t.buffer),e},isString:_e,isNumber:Se,isBoolean:t=>!0===t||!1===t,isObject:Ee,isPlainObject:ke,isUndefined:ve,isDate:Ae,isFile:Oe,isBlob:Te,isRegExp:Ue,isFunction:Me,isStream:t=>Ee(t)&&Me(t.pipe),isURLSearchParams:Re,isTypedArray:Be,isFileList:Ie,forEach:Ce,merge:function t(){const{caseless:e}=Ne(this)&&this||{},r={},i=(i,n)=>{const o=e&&Pe(r,n)||n;ke(r[o])&&ke(i)?r[o]=t(r[o],i):ke(i)?r[o]=t({},i):be(i)?r[o]=i.slice():r[o]=i};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&Ce(arguments[t],i);return r},extend:(t,e,r,{allOwnKeys:i}={})=>(Ce(e,((e,i)=>{r&&Me(e)?t[i]=ce(e,r):t[i]=e}),{allOwnKeys:i}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,r,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject:(t,e,r,i)=>{let n,o,s;const a={};if(e=e||{},null==t)return e;do{for(n=Object.getOwnPropertyNames(t),o=n.length;o-- >0;)s=n[o],i&&!i(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==r&&pe(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:me,kindOfTest:ge,endsWith:(t,e,r)=>{t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;const i=t.indexOf(e,r);return-1!==i&&i===r},toArray:t=>{if(!t)return null;if(be(t))return t;let e=t.length;if(!Se(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=r.next())&&!i.done;){const r=i.value;e.call(t,r[0],r[1])}},matchAll:(t,e)=>{let r;const i=[];for(;null!==(r=t.exec(e));)i.push(r);return i},isHTMLForm:De,hasOwnProperty:je,hasOwnProp:je,reduceDescriptors:qe,freezeMethods:t=>{qe(t,((e,r)=>{if(Me(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const i=t[r];Me(i)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(t,e)=>{const r={},i=t=>{t.forEach((t=>{r[t]=!0}))};return be(t)?i(t):i(String(t).split(e)),r},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,r){return e.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(t,e)=>(t=+t,Number.isFinite(t)?t:e),findKey:Pe,global:xe,isContextDefined:Ne,ALPHABET:He,generateString:(t=16,e=He.ALPHA_DIGIT)=>{let r="";const{length:i}=e;for(;t--;)r+=e[Math.random()*i|0];return r},isSpecCompliantForm:function(t){return!!(t&&Me(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),r=(t,i)=>{if(Ee(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[i]=t;const n=be(t)?[]:{};return Ce(t,((t,e)=>{const o=r(t,i+1);!ve(o)&&(n[e]=o)})),e[i]=void 0,n}}return t};return r(t,0)},isAsyncFn:Ke,isThenable:t=>t&&(Ee(t)||Me(t))&&Me(t.then)&&Me(t.catch)},Ge=[],We=[],Ye="undefined"!=typeof Uint8Array?Uint8Array:Array,Ze=!1;function Xe(){Ze=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)Ge[e]=t[e],We[t.charCodeAt(e)]=e;We["-".charCodeAt(0)]=62,We["_".charCodeAt(0)]=63}function Qe(t,e,r){for(var i,n,o=[],s=e;s<r;s+=3)i=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(Ge[(n=i)>>18&63]+Ge[n>>12&63]+Ge[n>>6&63]+Ge[63&n]);return o.join("")}function Je(t){var e;Ze||Xe();for(var r=t.length,i=r%3,n="",o=[],s=16383,a=0,h=r-i;a<h;a+=s)o.push(Qe(t,a,a+s>h?h:a+s));return 1===i?(e=t[r-1],n+=Ge[e>>2],n+=Ge[e<<4&63],n+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],n+=Ge[e>>10],n+=Ge[e>>4&63],n+=Ge[e<<2&63],n+="="),o.push(n),o.join("")}function $e(t,e,r,i,n){var o,s,a=8*n-i-1,h=(1<<a)-1,u=h>>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-u;else{if(o===h)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=u}return(d?-1:1)*s*Math.pow(2,o-i)}function tr(t,e,r,i,n,o){var s,a,h,u=8*o-n-1,f=(1<<u)-1,l=f>>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*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+l>=1?c/h:c*Math.pow(2,1-l))*h>=2&&(s++,h/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*h-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<<n|a,u+=n;u>0;t[r+d]=255&s,d+=p,s/=256,u-=8);t[r+d-p]|=128*m}var er={}.toString,rr=Array.isArray||function(t){return"[object Array]"==er.call(t)};sr.TYPED_ARRAY_SUPPORT=void 0===le.TYPED_ARRAY_SUPPORT||le.TYPED_ARRAY_SUPPORT;var ir=nr();function nr(){return sr.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function or(t,e){if(nr()<e)throw new RangeError("Invalid typed array length");return sr.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=sr.prototype:(null===t&&(t=new sr(e)),t.length=e),t}function sr(t,e,r){if(!(sr.TYPED_ARRAY_SUPPORT||this instanceof sr))return new sr(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return ur(this,t)}return ar(this,t,e,r)}function ar(t,e,r,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,i){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,r):new Uint8Array(e,r,i);sr.TYPED_ARRAY_SUPPORT?(t=e).__proto__=sr.prototype:t=fr(t,e);return t}(t,e,r,i):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!sr.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|dr(e,r);t=or(t,i);var n=t.write(e,r);n!==i&&(t=t.slice(0,n));return t}(t,e,r):function(t,e){if(cr(e)){var r=0|lr(e.length);return 0===(t=or(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?or(t,0):fr(t,e);if("Buffer"===e.type&&rr(e.data))return fr(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function hr(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function ur(t,e){if(hr(e),t=or(t,e<0?0:0|lr(e)),!sr.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function fr(t,e){var r=e.length<0?0:0|lr(e.length);t=or(t,r);for(var i=0;i<r;i+=1)t[i]=255&e[i];return t}function lr(t){if(t>=nr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+nr().toString(16)+" bytes");return 0|t}function cr(t){return!(null==t||!t._isBuffer)}function dr(t,e){if(cr(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 qr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Fr(t).length;default:if(i)return qr(t).length;e=(""+e).toLowerCase(),i=!0}}function pr(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 Ir(this,e,r);case"utf8":case"utf-8":return kr(this,e,r);case"ascii":return Or(this,e,r);case"latin1":case"binary":return Tr(this,e,r);case"base64":return Er(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rr(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function mr(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function gr(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=sr.from(e,i)),cr(e))return 0===e.length?-1:yr(t,e,r,i,n);if("number"==typeof e)return e&=255,sr.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):yr(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function yr(t,e,r,i,n){var o,s=1,a=t.length,h=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,h/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){var f=-1;for(o=r;o<a;o++)if(u(t,o)===u(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===h)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+h>a&&(r=a-h),o=r;o>=0;o--){for(var l=!0,c=0;c<h;c++)if(u(t,o+c)!==u(e,c)){l=!1;break}if(l)return o}return-1}function br(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(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<i;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function vr(t,e,r,i){return zr(qr(e,t.length-r),t,r,i)}function wr(t,e,r,i){return zr(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,i)}function _r(t,e,r,i){return wr(t,e,r,i)}function Mr(t,e,r,i){return zr(Fr(e),t,r,i)}function Sr(t,e,r,i){return zr(function(t,e){for(var r,i,n,o=[],s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function Er(t,e,r){return 0===e&&r===t.length?Je(t):Je(t.slice(e,r))}function kr(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var o,s,a,h,u=t[n],f=null,l=u>239?4:u>223?3:u>191?2:1;if(n+l<=r)switch(l){case 1:u<128&&(f=u);break;case 2:128==(192&(o=t[n+1]))&&(h=(31&u)<<6|63&o)>127&&(f=h);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(h=(15&u)<<12|(63&o)<<6|63&s)>2047&&(h<55296||h>57343)&&(f=h);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(h=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&h<1114112&&(f=h)}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<=Ar)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=Ar));return r}(i)}sr.poolSize=8192,sr._augment=function(t){return t.__proto__=sr.prototype,t},sr.from=function(t,e,r){return ar(null,t,e,r)},sr.TYPED_ARRAY_SUPPORT&&(sr.prototype.__proto__=Uint8Array.prototype,sr.__proto__=Uint8Array),sr.alloc=function(t,e,r){return function(t,e,r,i){return hr(e),e<=0?or(t,e):void 0!==r?"string"==typeof i?or(t,e).fill(r,i):or(t,e).fill(r):or(t,e)}(null,t,e,r)},sr.allocUnsafe=function(t){return ur(null,t)},sr.allocUnsafeSlow=function(t){return ur(null,t)},sr.isBuffer=Hr,sr.compare=function(t,e){if(!cr(t)||!cr(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},sr.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},sr.concat=function(t,e){if(!rr(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return sr.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=sr.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var o=t[r];if(!cr(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length}return i},sr.byteLength=dr,sr.prototype._isBuffer=!0,sr.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)mr(this,e,e+1);return this},sr.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)mr(this,e,e+3),mr(this,e+1,e+2);return this},sr.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)mr(this,e,e+7),mr(this,e+1,e+6),mr(this,e+2,e+5),mr(this,e+3,e+4);return this},sr.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?kr(this,0,t):pr.apply(this,arguments)},sr.prototype.equals=function(t){if(!cr(t))throw new TypeError("Argument must be a Buffer");return this===t||0===sr.compare(this,t)},sr.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},sr.prototype.compare=function(t,e,r,i,n){if(!cr(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),u=t.slice(e,r),f=0;f<a;++f)if(h[f]!==u[f]){o=h[f],s=u[f];break}return o<s?-1:s<o?1:0},sr.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},sr.prototype.indexOf=function(t,e,r){return gr(this,t,e,r,!0)},sr.prototype.lastIndexOf=function(t,e,r){return gr(this,t,e,r,!1)},sr.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(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 br(this,t,e,r);case"utf8":case"utf-8":return vr(this,t,e,r);case"ascii":return wr(this,t,e,r);case"latin1":case"binary":return _r(this,t,e,r);case"base64":return Mr(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Sr(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},sr.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Ar=4096;function Or(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function Tr(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function Ir(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=e;o<r;++o)n+=Ur(t[o]);return n}function Rr(t,e,r){for(var i=t.slice(e,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function Cr(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function Pr(t,e,r,i,n,o){if(!cr(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function xr(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-r,2);n<o;++n)t[r+n]=(e&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function Nr(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-r,4);n<o;++n)t[r+n]=e>>>8*(i?n:3-n)&255}function Br(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 Lr(t,e,r,i,n){return n||Br(t,0,r,4),tr(t,e,r,i,23,4),r+4}function Dr(t,e,r,i,n){return n||Br(t,0,r,8),tr(t,e,r,i,52,8),r+8}sr.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),e<t&&(e=t),sr.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=sr.prototype;else{var n=e-t;r=new sr(n,void 0);for(var o=0;o<n;++o)r[o]=this[o+t]}return r},sr.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||Cr(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i},sr.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||Cr(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},sr.prototype.readUInt8=function(t,e){return e||Cr(t,1,this.length),this[t]},sr.prototype.readUInt16LE=function(t,e){return e||Cr(t,2,this.length),this[t]|this[t+1]<<8},sr.prototype.readUInt16BE=function(t,e){return e||Cr(t,2,this.length),this[t]<<8|this[t+1]},sr.prototype.readUInt32LE=function(t,e){return e||Cr(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},sr.prototype.readUInt32BE=function(t,e){return e||Cr(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},sr.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||Cr(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},sr.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||Cr(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},sr.prototype.readInt8=function(t,e){return e||Cr(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},sr.prototype.readInt16LE=function(t,e){e||Cr(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},sr.prototype.readInt16BE=function(t,e){e||Cr(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},sr.prototype.readInt32LE=function(t,e){return e||Cr(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},sr.prototype.readInt32BE=function(t,e){return e||Cr(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},sr.prototype.readFloatLE=function(t,e){return e||Cr(t,4,this.length),$e(this,t,!0,23,4)},sr.prototype.readFloatBE=function(t,e){return e||Cr(t,4,this.length),$e(this,t,!1,23,4)},sr.prototype.readDoubleLE=function(t,e){return e||Cr(t,8,this.length),$e(this,t,!0,52,8)},sr.prototype.readDoubleBE=function(t,e){return e||Cr(t,8,this.length),$e(this,t,!1,52,8)},sr.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||Pr(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o<r&&(n*=256);)this[e+o]=t/n&255;return e+r},sr.prototype.writeUIntBE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||Pr(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},sr.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,1,255,0),sr.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},sr.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,2,65535,0),sr.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):xr(this,t,e,!0),e+2},sr.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,2,65535,0),sr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):xr(this,t,e,!1),e+2},sr.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,4,4294967295,0),sr.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):Nr(this,t,e,!0),e+4},sr.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,4,4294967295,0),sr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Nr(this,t,e,!1),e+4},sr.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);Pr(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},sr.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);Pr(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},sr.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,1,127,-128),sr.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},sr.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,2,32767,-32768),sr.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):xr(this,t,e,!0),e+2},sr.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,2,32767,-32768),sr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):xr(this,t,e,!1),e+2},sr.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,4,2147483647,-2147483648),sr.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Nr(this,t,e,!0),e+4},sr.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),sr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Nr(this,t,e,!1),e+4},sr.prototype.writeFloatLE=function(t,e,r){return Lr(this,t,e,!0,r)},sr.prototype.writeFloatBE=function(t,e,r){return Lr(this,t,e,!1,r)},sr.prototype.writeDoubleLE=function(t,e,r){return Dr(this,t,e,!0,r)},sr.prototype.writeDoubleBE=function(t,e,r){return Dr(this,t,e,!1,r)},sr.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<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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<i-r&&(i=t.length-e+r);var n,o=i-r;if(this===t&&r<e&&e<i)for(n=o-1;n>=0;--n)t[n+e]=this[n+r];else if(o<1e3||!sr.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)t[n+e]=this[n+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},sr.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===t.length){var n=t.charCodeAt(0);n<256&&(t=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!sr.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=cr(t)?t:qr(new sr(t,i).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var jr=/[^+\/0-9A-Za-z-_]/g;function Ur(t){return t<16?"0"+t.toString(16):t.toString(16)}function qr(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],s=0;s<i;++s){if((r=t.charCodeAt(s))>55295&&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 Fr(t){return function(t){var e,r,i,n,o,s;Ze||Xe();var a=t.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,s=new Ye(3*a/4-o),i=o>0?a-4:a;var h=0;for(e=0,r=0;e<i;e+=4,r+=3)n=We[t.charCodeAt(e)]<<18|We[t.charCodeAt(e+1)]<<12|We[t.charCodeAt(e+2)]<<6|We[t.charCodeAt(e+3)],s[h++]=n>>16&255,s[h++]=n>>8&255,s[h++]=255&n;return 2===o?(n=We[t.charCodeAt(e)]<<2|We[t.charCodeAt(e+1)]>>4,s[h++]=255&n):1===o&&(n=We[t.charCodeAt(e)]<<10|We[t.charCodeAt(e+1)]<<4|We[t.charCodeAt(e+2)]>>2,s[h++]=n>>8&255,s[h++]=255&n),s}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(jr,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function zr(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Hr(t){return null!=t&&(!!t._isBuffer||Kr(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Kr(t.slice(0,0))}(t))}function Kr(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Vr=Object.freeze({__proto__:null,Buffer:sr,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),sr.alloc(+t)},isBuffer:Hr,kMaxLength:ir});function Gr(t,e,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n)}Ve.inherits(Gr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ve.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Wr=Gr.prototype,Yr={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{Yr[t]={value:t}})),Object.defineProperties(Gr,Yr),Object.defineProperty(Wr,"isAxiosError",{value:!0}),Gr.from=(t,e,r,i,n,o)=>{const s=Object.create(Wr);return Ve.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),Gr.call(s,t.message,e,r,i,n),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};function Zr(t){return Ve.isPlainObject(t)||Ve.isArray(t)}function Xr(t){return Ve.endsWith(t,"[]")?t.slice(0,-2):t}function Qr(t,e,r){return t?t.concat(e).map((function(t,e){return t=Xr(t),!r&&e?"["+t+"]":t})).join(r?".":""):e}const Jr=Ve.toFlatObject(Ve,{},null,(function(t){return/^is[A-Z]/.test(t)}));function $r(t,e,r){if(!Ve.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const i=(r=Ve.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!Ve.isUndefined(e[t])}))).metaTokens,n=r.visitor||u,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Ve.isSpecCompliantForm(e);if(!Ve.isFunction(n))throw new TypeError("visitor must be a function");function h(t){if(null===t)return"";if(Ve.isDate(t))return t.toISOString();if(!a&&Ve.isBlob(t))throw new Gr("Blob is not supported. Use a Buffer instead.");return Ve.isArrayBuffer(t)||Ve.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):sr.from(t):t}function u(t,r,n){let a=t;if(t&&!n&&"object"==typeof t)if(Ve.endsWith(r,"{}"))r=i?r:r.slice(0,-2),t=JSON.stringify(t);else if(Ve.isArray(t)&&function(t){return Ve.isArray(t)&&!t.some(Zr)}(t)||(Ve.isFileList(t)||Ve.endsWith(r,"[]"))&&(a=Ve.toArray(t)))return r=Xr(r),a.forEach((function(t,i){!Ve.isUndefined(t)&&null!==t&&e.append(!0===s?Qr([r],i,o):null===s?r:r+"[]",h(t))})),!1;return!!Zr(t)||(e.append(Qr(n,r,o),h(t)),!1)}const f=[],l=Object.assign(Jr,{defaultVisitor:u,convertValue:h,isVisitable:Zr});if(!Ve.isObject(t))throw new TypeError("data must be an object");return function t(r,i){if(!Ve.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+i.join("."));f.push(r),Ve.forEach(r,(function(r,o){!0===(!(Ve.isUndefined(r)||null===r)&&n.call(e,r,Ve.isString(o)?o.trim():o,i,l))&&t(r,i?i.concat(o):[o])})),f.pop()}}(t),e}function ti(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function ei(t,e){this._pairs=[],t&&$r(t,this,e)}const ri=ei.prototype;function ii(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ni(t,e,r){if(!e)return t;const i=r&&r.encode||ii,n=r&&r.serialize;let o;if(o=n?n(e,r):Ve.isURLSearchParams(e)?e.toString():new ei(e,r).toString(i),o){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}ri.append=function(t,e){this._pairs.push([t,e])},ri.toString=function(t){const e=t?function(e){return t.call(this,e,ti)}:ti;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};var oi=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Ve.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},si={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var ai={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ei,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let t;return("undefined"==typeof navigator||"ReactNative"!==(t=navigator.product)&&"NativeScript"!==t&&"NS"!==t)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function hi(t){function e(t,r,i,n){let o=t[n++];const s=Number.isFinite(+o),a=n>=t.length;if(o=!o&&Ve.isArray(i)?i.length:o,a)return Ve.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!s;i[o]&&Ve.isObject(i[o])||(i[o]=[]);return e(t,r,i[o],n)&&Ve.isArray(i[o])&&(i[o]=function(t){const e={},r=Object.keys(t);let i;const n=r.length;let o;for(i=0;i<n;i++)o=r[i],e[o]=t[o];return e}(i[o])),!s}if(Ve.isFormData(t)&&Ve.isFunction(t.entries)){const r={};return Ve.forEachEntry(t,((t,i)=>{e(function(t){return Ve.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),i,r,0)})),r}return null}const ui={"Content-Type":void 0};const fi={transitional:si,adapter:["xhr","http"],transformRequest:[function(t,e){const r=e.getContentType()||"",i=r.indexOf("application/json")>-1,n=Ve.isObject(t);n&&Ve.isHTMLForm(t)&&(t=new FormData(t));if(Ve.isFormData(t))return i&&i?JSON.stringify(hi(t)):t;if(Ve.isArrayBuffer(t)||Ve.isBuffer(t)||Ve.isStream(t)||Ve.isFile(t)||Ve.isBlob(t))return t;if(Ve.isArrayBufferView(t))return t.buffer;if(Ve.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(n){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return $r(t,new ai.classes.URLSearchParams,Object.assign({visitor:function(t,e,r,i){return ai.isNode&&Ve.isBuffer(t)?(this.append(e,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((o=Ve.isFileList(t))||r.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return $r(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return n||i?(e.setContentType("application/json",!1),function(t,e,r){if(Ve.isString(t))try{return(e||JSON.parse)(t),Ve.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||fi.transitional,r=e&&e.forcedJSONParsing,i="json"===this.responseType;if(t&&Ve.isString(t)&&(r&&!this.responseType||i)){const r=!(e&&e.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(t){if(r){if("SyntaxError"===t.name)throw Gr.from(t,Gr.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ai.classes.FormData,Blob:ai.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Ve.forEach(["delete","get","head"],(function(t){fi.headers[t]={}})),Ve.forEach(["post","put","patch"],(function(t){fi.headers[t]=Ve.merge(ui)}));var li=fi;const ci=Ve.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const di=Symbol("internals");function pi(t){return t&&String(t).trim().toLowerCase()}function mi(t){return!1===t||null==t?t:Ve.isArray(t)?t.map(mi):String(t)}function gi(t,e,r,i,n){return Ve.isFunction(i)?i.call(this,e,r):(n&&(e=r),Ve.isString(e)?Ve.isString(i)?-1!==e.indexOf(i):Ve.isRegExp(i)?i.test(e):void 0:void 0)}class yi{constructor(t){t&&this.set(t)}set(t,e,r){const i=this;function n(t,e,r){const n=pi(e);if(!n)throw new Error("header name must be a non-empty string");const o=Ve.findKey(i,n);(!o||void 0===i[o]||!0===r||void 0===r&&!1!==i[o])&&(i[o||e]=mi(t))}const o=(t,e)=>Ve.forEach(t,((t,r)=>n(t,r,e)));return Ve.isPlainObject(t)||t instanceof this.constructor?o(t,e):Ve.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim())?o((t=>{const e={};let r,i,n;return t&&t.split("\n").forEach((function(t){n=t.indexOf(":"),r=t.substring(0,n).trim().toLowerCase(),i=t.substring(n+1).trim(),!r||e[r]&&ci[r]||("set-cookie"===r?e[r]?e[r].push(i):e[r]=[i]:e[r]=e[r]?e[r]+", "+i:i)})),e})(t),e):null!=t&&n(e,t,r),this}get(t,e){if(t=pi(t)){const r=Ve.findKey(this,t);if(r){const t=this[r];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=r.exec(t);)e[i[1]]=i[2];return e}(t);if(Ve.isFunction(e))return e.call(this,t,r);if(Ve.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=pi(t)){const r=Ve.findKey(this,t);return!(!r||void 0===this[r]||e&&!gi(0,this[r],r,e))}return!1}delete(t,e){const r=this;let i=!1;function n(t){if(t=pi(t)){const n=Ve.findKey(r,t);!n||e&&!gi(0,r[n],n,e)||(delete r[n],i=!0)}}return Ve.isArray(t)?t.forEach(n):n(t),i}clear(t){const e=Object.keys(this);let r=e.length,i=!1;for(;r--;){const n=e[r];t&&!gi(0,this[n],n,t,!0)||(delete this[n],i=!0)}return i}normalize(t){const e=this,r={};return Ve.forEach(this,((i,n)=>{const o=Ve.findKey(r,n);if(o)return e[o]=mi(i),void delete e[n];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,r)=>e.toUpperCase()+r))}(n):String(n).trim();s!==n&&delete e[n],e[s]=mi(i),r[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Ve.forEach(this,((r,i)=>{null!=r&&!1!==r&&(e[i]=t&&Ve.isArray(r)?r.join(", "):r)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const r=new this(t);return e.forEach((t=>r.set(t))),r}static accessor(t){const e=(this[di]=this[di]={accessors:{}}).accessors,r=this.prototype;function i(t){const i=pi(t);e[i]||(!function(t,e){const r=Ve.toCamelCase(" "+e);["get","set","has"].forEach((i=>{Object.defineProperty(t,i+r,{value:function(t,r,n){return this[i].call(this,e,t,r,n)},configurable:!0})}))}(r,t),e[i]=!0)}return Ve.isArray(t)?t.forEach(i):i(t),this}}yi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ve.freezeMethods(yi.prototype),Ve.freezeMethods(yi);var bi=yi;function vi(t,e){const r=this||li,i=e||r,n=bi.from(i.headers);let o=i.data;return Ve.forEach(t,(function(t){o=t.call(r,o,n.normalize(),e?e.status:void 0)})),n.normalize(),o}function wi(t){return!(!t||!t.__CANCEL__)}function _i(t,e,r){Gr.call(this,null==t?"canceled":t,Gr.ERR_CANCELED,e,r),this.name="CanceledError"}Ve.inherits(_i,Gr,{__CANCEL__:!0});var Mi=ai.isStandardBrowserEnv?{write:function(t,e,r,i,n,o){const s=[];s.push(t+"="+encodeURIComponent(e)),Ve.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),Ve.isString(i)&&s.push("path="+i),Ve.isString(n)&&s.push("domain="+n),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read:function(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Si(t,e){return t&&!function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}(e)?function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}var Ei=ai.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let r;function i(r){let i=r;return t&&(e.setAttribute("href",i),i=e.href),e.setAttribute("href",i),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return r=i(window.location.href),function(t){const e=Ve.isString(t)?i(t):t;return e.protocol===r.protocol&&e.host===r.host}}():function(){return!0};function ki(t,e){let r=0;const i=function(t,e){t=t||10;const r=new Array(t),i=new Array(t);let n,o=0,s=0;return e=void 0!==e?e:1e3,function(a){const h=Date.now(),u=i[s];n||(n=h),r[o]=a,i[o]=h;let f=s,l=0;for(;f!==o;)l+=r[f++],f%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),h-n<e)return;const c=u&&h-u;return c?Math.round(1e3*l/c):void 0}}(50,250);return n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-r,h=i(a);r=o;const u={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:h||void 0,estimated:h&&s&&o<=s?(s-o)/h:void 0,event:n};u[e?"download":"upload"]=!0,t(u)}}var Ai="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,r){let i=t.data;const n=bi.from(t.headers).normalize(),o=t.responseType;let s;function a(){t.cancelToken&&t.cancelToken.unsubscribe(s),t.signal&&t.signal.removeEventListener("abort",s)}Ve.isFormData(i)&&(ai.isStandardBrowserEnv||ai.isStandardBrowserWebWorkerEnv?n.setContentType(!1):n.setContentType("multipart/form-data;",!1));let h=new XMLHttpRequest;if(t.auth){const e=t.auth.username||"",r=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";n.set("Authorization","Basic "+btoa(e+":"+r))}const u=Si(t.baseURL,t.url);function f(){if(!h)return;const i=bi.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());!function(t,e,r){const i=r.config.validateStatus;r.status&&i&&!i(r.status)?e(new Gr("Request failed with status code "+r.status,[Gr.ERR_BAD_REQUEST,Gr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):t(r)}((function(t){e(t),a()}),(function(t){r(t),a()}),{data:o&&"text"!==o&&"json"!==o?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:i,config:t,request:h}),h=null}if(h.open(t.method.toUpperCase(),ni(u,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,"onloadend"in h?h.onloadend=f:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(f)},h.onabort=function(){h&&(r(new Gr("Request aborted",Gr.ECONNABORTED,t,h)),h=null)},h.onerror=function(){r(new Gr("Network Error",Gr.ERR_NETWORK,t,h)),h=null},h.ontimeout=function(){let e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const i=t.transitional||si;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(new Gr(e,i.clarifyTimeoutError?Gr.ETIMEDOUT:Gr.ECONNABORTED,t,h)),h=null},ai.isStandardBrowserEnv){const e=(t.withCredentials||Ei(u))&&t.xsrfCookieName&&Mi.read(t.xsrfCookieName);e&&n.set(t.xsrfHeaderName,e)}void 0===i&&n.setContentType(null),"setRequestHeader"in h&&Ve.forEach(n.toJSON(),(function(t,e){h.setRequestHeader(e,t)})),Ve.isUndefined(t.withCredentials)||(h.withCredentials=!!t.withCredentials),o&&"json"!==o&&(h.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",ki(t.onDownloadProgress,!0)),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",ki(t.onUploadProgress)),(t.cancelToken||t.signal)&&(s=e=>{h&&(r(!e||e.type?new _i(null,t,h):e),h.abort(),h=null)},t.cancelToken&&t.cancelToken.subscribe(s),t.signal&&(t.signal.aborted?s():t.signal.addEventListener("abort",s)));const l=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(u);l&&-1===ai.protocols.indexOf(l)?r(new Gr("Unsupported protocol "+l+":",Gr.ERR_BAD_REQUEST,t)):h.send(i||null)}))};const Oi={http:null,xhr:Ai};Ve.forEach(Oi,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));var Ti=t=>{t=Ve.isArray(t)?t:[t];const{length:e}=t;let r,i;for(let n=0;n<e&&(r=t[n],!(i=Ve.isString(r)?Oi[r.toLowerCase()]:r));n++);if(!i){if(!1===i)throw new Gr(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Ve.hasOwnProp(Oi,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!Ve.isFunction(i))throw new TypeError("adapter is not a function");return i};function Ii(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _i(null,t)}function Ri(t){Ii(t),t.headers=bi.from(t.headers),t.data=vi.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Ti(t.adapter||li.adapter)(t).then((function(e){return Ii(t),e.data=vi.call(t,t.transformResponse,e),e.headers=bi.from(e.headers),e}),(function(e){return wi(e)||(Ii(t),e&&e.response&&(e.response.data=vi.call(t,t.transformResponse,e.response),e.response.headers=bi.from(e.response.headers))),Promise.reject(e)}))}const Ci=t=>t instanceof bi?t.toJSON():t;function Pi(t,e){e=e||{};const r={};function i(t,e,r){return Ve.isPlainObject(t)&&Ve.isPlainObject(e)?Ve.merge.call({caseless:r},t,e):Ve.isPlainObject(e)?Ve.merge({},e):Ve.isArray(e)?e.slice():e}function n(t,e,r){return Ve.isUndefined(e)?Ve.isUndefined(t)?void 0:i(void 0,t,r):i(t,e,r)}function o(t,e){if(!Ve.isUndefined(e))return i(void 0,e)}function s(t,e){return Ve.isUndefined(e)?Ve.isUndefined(t)?void 0:i(void 0,t):i(void 0,e)}function a(r,n,o){return o in e?i(r,n):o in t?i(void 0,r):void 0}const h={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(t,e)=>n(Ci(t),Ci(e),!0)};return Ve.forEach(Object.keys(Object.assign({},t,e)),(function(i){const o=h[i]||n,s=o(t[i],e[i],i);Ve.isUndefined(s)&&o!==a||(r[i]=s)})),r}const xi="1.4.0",Ni={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Ni[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));const Bi={};Ni.transitional=function(t,e,r){function i(t,e){return"[Axios v1.4.0] Transitional option '"+t+"'"+e+(r?". "+r:"")}return(r,n,o)=>{if(!1===t)throw new Gr(i(n," has been removed"+(e?" in "+e:"")),Gr.ERR_DEPRECATED);return e&&!Bi[n]&&(Bi[n]=!0,console.warn(i(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,n,o)}};var Li={assertOptions:function(t,e,r){if("object"!=typeof t)throw new Gr("options must be an object",Gr.ERR_BAD_OPTION_VALUE);const i=Object.keys(t);let n=i.length;for(;n-- >0;){const o=i[n],s=e[o];if(s){const e=t[o],r=void 0===e||s(e,o,t);if(!0!==r)throw new Gr("option "+o+" must be "+r,Gr.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new Gr("Unknown option "+o,Gr.ERR_BAD_OPTION)}},validators:Ni};const Di=Li.validators;class ji{constructor(t){this.defaults=t,this.interceptors={request:new oi,response:new oi}}request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Pi(this.defaults,e);const{transitional:r,paramsSerializer:i,headers:n}=e;let o;void 0!==r&&Li.assertOptions(r,{silentJSONParsing:Di.transitional(Di.boolean),forcedJSONParsing:Di.transitional(Di.boolean),clarifyTimeoutError:Di.transitional(Di.boolean)},!1),null!=i&&(Ve.isFunction(i)?e.paramsSerializer={serialize:i}:Li.assertOptions(i,{encode:Di.function,serialize:Di.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase(),o=n&&Ve.merge(n.common,n[e.method]),o&&Ve.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete n[t]})),e.headers=bi.concat(o,n);const s=[];let a=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));const h=[];let u;this.interceptors.response.forEach((function(t){h.push(t.fulfilled,t.rejected)}));let f,l=0;if(!a){const t=[Ri.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,h),f=t.length,u=Promise.resolve(e);l<f;)u=u.then(t[l++],t[l++]);return u}f=s.length;let c=e;for(l=0;l<f;){const t=s[l++],e=s[l++];try{c=t(c)}catch(t){e.call(this,t);break}}try{u=Ri.call(this,c)}catch(t){return Promise.reject(t)}for(l=0,f=h.length;l<f;)u=u.then(h[l++],h[l++]);return u}getUri(t){return ni(Si((t=Pi(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}Ve.forEach(["delete","get","head","options"],(function(t){ji.prototype[t]=function(e,r){return this.request(Pi(r||{},{method:t,url:e,data:(r||{}).data}))}})),Ve.forEach(["post","put","patch"],(function(t){function e(e){return function(r,i,n){return this.request(Pi(n||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}ji.prototype[t]=e(),ji.prototype[t+"Form"]=e(!0)}));var Ui=ji;class qi{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const r=this;this.promise.then((t=>{if(!r._listeners)return;let e=r._listeners.length;for(;e-- >0;)r._listeners[e](t);r._listeners=null})),this.promise.then=t=>{let e;const i=new Promise((t=>{r.subscribe(t),e=t})).then(t);return i.cancel=function(){r.unsubscribe(e)},i},t((function(t,i,n){r.reason||(r.reason=new _i(t,i,n),e(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}static source(){let t;const e=new qi((function(e){t=e}));return{token:e,cancel:t}}}var Fi=qi;const zi={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(zi).forEach((([t,e])=>{zi[e]=t}));var Hi=zi;const Ki=function t(e){const r=new Ui(e),i=ce(Ui.prototype.request,r);return Ve.extend(i,Ui.prototype,r,{allOwnKeys:!0}),Ve.extend(i,r,null,{allOwnKeys:!0}),i.create=function(r){return t(Pi(e,r))},i}(li);Ki.Axios=Ui,Ki.CanceledError=_i,Ki.CancelToken=Fi,Ki.isCancel=wi,Ki.VERSION=xi,Ki.toFormData=$r,Ki.AxiosError=Gr,Ki.Cancel=Ki.CanceledError,Ki.all=function(t){return Promise.all(t)},Ki.spread=function(t){return function(e){return t.apply(null,e)}},Ki.isAxiosError=function(t){return Ve.isObject(t)&&!0===t.isAxiosError},Ki.mergeConfig=Pi,Ki.AxiosHeaders=bi,Ki.formToJSON=t=>hi(Ve.isHTMLForm(t)?new FormData(t):t),Ki.HttpStatusCode=Hi,Ki.default=Ki;var Vi=Ki;const Gi={async parse({node:t}){const{refId:e}=t;for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:{type:"model",refId:e}})}},Wi={async parse({node:t}){const{refId:e}=t;for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:{type:"material",refId:e}})}},Yi={async parse({node:t}){t.outputs.forEach((e=>{this.parseFlowNode(t,e)}))}},Zi={async parse({node:t}){const e=this.getOutInstance("ssp");if(!e)return Promise.reject("In SoonFlow: path-element-node not have ssp!");const{config:r}=t,{pathData:i}=JSON.parse(r);e.createTopology({type:"network",...i,imgUrl:i.imgUri?.path??void 0,animation:{duration:i.animation?.duration??0}});for(let e=0;e<t.outputs.length;e++)await this.parseFlowNode(t,{...t.outputs[e],data:{}})}};var Xi,Qi;!function(t){t.CLIP="cilp",t.INNER="inner"}(Xi||(Xi={})),function(t){t.PLAY="play",t.STOP="stop"}(Qi||(Qi={}));const Ji=new Map,$i={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: object-animation-node not have ssp!");const i=JSON.parse(t.config),{refId:n}=e;if(!n)return Promise.reject("In SoonFlow: object-animation-node 未绑定模型数据!");const{animationType:o,innerAnimationIndex:s,animationPlayState:a,delay:h,duration:u}=i;await r.utils.sleep(h);switch(o){case Xi.INNER:await(async()=>{const t=r.getObjectById(n);if(!t)return Promise.reject(`In SoonFlow: object-animation-node 场景中未找到 modelId 为 "${n}" 的模型对象`);switch(a){case Qi.PLAY:r.playModelAnimation(t,s);break;case Qi.STOP:r.stopModelAnimation(t,s)}await r.utils.sleep(u)})();break;case Xi.CLIP:await(async()=>{switch(a){case Qi.PLAY:(async(t,e,r)=>{const{cilpAnimationKeyframes:i}=r,n=Ji.get(e),o=t.getObjectById(e);if(!o)return fe(`播放模型动画 -> 方法 playCilpAnimation 执行时 modelId 为 ${e} 场景对象未找到`);if(n){n.tween.stop();const{positionX:r,positionY:i,positionZ:s,rotationX:a,rotationY:h,rotationZ:u,scaleX:f,scaleY:l,scaleZ:c}=n.source;o.position.set(r,i,s),o.rotation.set(a,h,u),o.scale.set(f,l,c),t.render(),Ji.delete(e)}for(let r=0;r<i.length;r++){const n={positionX:o.position.x,positionY:o.position.y,positionZ:o.position.z,rotationX:o.rotation.x,rotationY:o.rotation.y,rotationZ:o.rotation.z,scaleX:o.scale.x,scaleY:o.scale.y,scaleZ:o.scale.z},s=i[r],{delay:a,duration:h,easing:u,repeat:f,yoyo:l}=s,c={positionX:s.position.x||0,positionY:s.position.y||0,positionZ:s.position.z||0,rotationX:s.rotation.x||0,rotationY:s.rotation.y||0,rotationZ:s.rotation.z||0,scaleX:s.scale.x||1,scaleY:s.scale.y||1,scaleZ:s.scale.z||1};await t.animation(n,c,{delay:a,duration:h,mode:u,repeat:-1===f?1/0:f,yoyo:l},(({positionX:t,positionY:e,positionZ:r,rotationX:i,rotationY:n,rotationZ:s,scaleX:a,scaleY:h,scaleZ:u})=>{o.position.set(t,e,r),o.rotation.set(i,n,s),o.scale.set(a,h,u)}),(t=>{Ji.set(e,{source:JSON.parse(JSON.stringify(n)),tween:t})})),Ji.delete(e)}})(r,n,i);break;case Qi.STOP:(async t=>{Ji.get(t)?.tween.stop(),Ji.delete(t)})(n)}await r.utils.sleep(u)})()}for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:e})}},tn={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: object-poi-node not have ssp!");const i=JSON.parse(t.config),{delay:n,duration:o,poiId:s,poiShow:a}=i;if(await r.utils.sleep(n),s){const t=r.getObjectById(s);if(!t)return Promise.reject(`In SoonFlow: object-animation-node 场景中未找到 Poi 为 "${s}" 的模型对象`);a?t.show():t.hide()}await r.utils.sleep(o);for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:e})}};var en;!function(t){t.CUSTOM="custom",t.FIXED="fixed"}(en||(en={}));const rn={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: object-viewpoint-node not have ssp!");const i=JSON.parse(t.config),{refId:n}=e;if(!n)return Promise.reject("In SoonFlow: object-viewpoint-node 未绑定模型数据!");const{viewpointType:o,customViewpointData:s,fixedViewpointValue:a,delay:h,duration:u}=i;switch(await r.utils.sleep(h),o){case en.CUSTOM:await(async()=>{if(!s)return Promise.reject("In SoonFlow: object-viewpoint-node 解析时缺少视角数据!");await r.flyTo(s.position,s.rotation,{duration:u})})();break;case en.FIXED:await(async()=>{const t=r.getObjectById(n);if(!t)return Promise.reject(`In SoonFlow: object-viewpoint-node 场景中未找到 modelId 为 "${n}" 的模型对象!`);await r.flyToObj(t,a,{duration:u})})()}for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:e})}},nn={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: object-animation-node not have ssp!");const{viewpointData:i}=JSON.parse(t.config),n=JSON.parse(i);await r.flyTo(n.position,n.rotation);for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:e})}};function on(t){const e={};return t.forEach((t=>{let r=t.defaultValue;switch(t.varType){case"boolean":r="boolean"==typeof t.defaultValue?t.defaultValue:"true"===t.defaultValue;break;case"number":r=Number(t.defaultValue)}e[t.parameterName]=r})),e}const sn={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: action-node not have ssp!");const{type:i,refId:n,fromInteraction:o,eventKey:s,nodeId:a}=e,{behaviorType:h,actionCode:u,customCode:f,behaviorVars:l,delay:c,duration:d}=JSON.parse(t.config);await r.utils.sleep(c);const p=[];switch(i){case"model":case"path":{const t=r.getObjectById(n);t&&p.push(t)}break;case"material":p.push(...r.getObjectByUserDataProperty("familyId",n))}if(o)if("SYS"===h||"CUS"===h){const t=on(l);p.forEach((e=>{this.addSignal(`${a}_${e.sid}_${s}`,(async()=>{const i=new Function("{ssp, vars, _this}",`(async () => { ${u} })()`);await i({ssp:r,vars:t,_this:e})}))}))}else"CUSTOM"===h&&p.forEach((t=>{this.addSignal(`${a}_${t.sid}_${s}`,(async()=>{const i=new Function("{ ssp, object, inputData }",`(async () => { ${f} })()`);await i({ssp:r,object:t,inputData:e})}))}));else if("SYS"===h||"CUS"===h){const t=on(l);for(let e=0;e<p.length;e++){const i=p[e],n=new Function("{ssp, vars, _this}",`(async () => { ${u} })()`);await n({ssp:r,vars:t,_this:i})}}else if("CUSTOM"===h)for(let t=0;t<p.length;t++){const i=p[t],n=new Function("{ ssp, object, inputData }",`(async () => { ${f} })()`);await n({ssp:r,object:i,inputData:e})}await r.utils.sleep(d);for(let e=0;e<t.outputs.length;e++)await this.parseFlowNode(t,t.outputs[e])}},an={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: interaction-node not have ssp!");const{type:i,refId:n}=e,{eventKey:o}=JSON.parse(t.config),s=(e,r)=>{if(!e)return;let i=null;switch(r){case"click":i=e.onClick,e.onClick=()=>{i?.(),this.dispatchSignal(`${t.id}_${e.sid}_${r}`)};break;case"dblClick":i=e.onDblClick,e.onDblClick=()=>{i?.(),this.dispatchSignal(`${t.id}_${e.sid}_${r}`)};break;case"rightClick":i=e.onRightClick,e.onRightClick=()=>{i?.(),this.dispatchSignal(`${t.id}_${e.sid}_${r}`)}}},a=[];switch(i){case"model":{const t=r.getObjectById(n);t&&a.push(t)}break;case"material":a.push(...r.getObjectByUserDataProperty("familyId",n))}a.forEach((t=>s(t,o)));for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:{...e,fromInteraction:!0,eventKey:o,nodeId:t.id}})}},hn={async parse({node:t}){const e=JSON.parse(t.config),r=JSON.parse(e.codeString);for(let e=0;e<t.outputs.length;e++)await this.parseFlowNode(t,{...t.outputs[e],data:r})}},un=t=>t.reduce(((t,e)=>(e.key&&(t[e.key]=e.value),t)),{}),fn={async parse({node:t}){const e=JSON.parse(t.config),{address:r,bodies:i,bodyType:n,headers:o,params:s,type:a}=e.requestInfo;let h,u,f;if(s.length>0&&(h=un(s)),i.length>0)if("multipart/form-data"===n){const t=new FormData;i.map((e=>{t.set(e.key,e.value)})),u=t}else u="application/x-www-form-urlencoded"===n?new URLSearchParams(i.map((t=>[t.key,t.value]))):un(i);o.length>0&&(f=un(o));try{const e=await Vi({method:a,url:r,params:h,data:u,headers:f});for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:e})}catch(e){return fe(`flow node "${t.name}" parse error`,e),Promise.reject(e)}}},ln={async parse({node:t,inputData:e}){if(!e)return Promise.reject("In SoonFlow: condition-node not have inputData!");for(let r=0;r<t.outputs.length;r++){const{config:i}=t.outputs[r],{codeString:n}=JSON.parse(i),o=new Function("sourceData",n)(e);o&&await this.parseFlowNode(t,{...t.outputs[r],data:o})}}},cn={async parse({node:t,inputData:e}){if(!e)return Promise.reject("In SoonFlow: condition-node not have inputData!");const{filterCode:r}=JSON.parse(t.config),i=new Function("sourceData",r)(e);for(let e=0;e<t.outputs.length;e++)await this.parseFlowNode(t,{...t.outputs[e],data:i})}};var dn;!function(t){t.START="start",t.MODEL="model",t.MATERIAL="material",t.PATH="path",t.FLOW="flow",t.OBJECT_ANIMATION="objectAnimation",t.OBJECT_POI="objectPoi",t.OBJECT_VIEWPOINT="objectViewpoint",t.SCENE_VIEWPOINT="sceneViewpoint",t.ACTION="action",t.INTERACTION="interaction",t.STATIC_DATA="staticData",t.INTERFACE_DATA="interfaceData",t.CONDITION="condition",t.FILTER="filter",t.VIEWPOINT="viewpoint"}(dn||(dn={}));const pn={model:Gi,material:Wi,path:Zi,flow:Yi,objectAnimation:$i,objectPoi:tn,objectViewpoint:rn,sceneViewpoint:nn,action:sn,interaction:an,staticData:hn,interfaceData:fn,condition:ln,filter:cn,viewpoint:nn};var mn=131072,gn=1048576,yn=4194304,bn=2097152,vn=269488175,wn=2147485780,_n=262144,Mn=4194304,Sn=2147483648,En=131072,kn=33554432,An=67108864,On=268435456,Tn=134217728,In=8388608,Rn="TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA",Cn="TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA",Pn={RTLD_LAZY:1,RTLD_NOW:2,RTLD_GLOBAL:8,RTLD_LOCAL:4,E2BIG:7,EACCES:13,EADDRINUSE:48,EADDRNOTAVAIL:49,EAFNOSUPPORT:47,EAGAIN:35,EALREADY:37,EBADF:9,EBADMSG:94,EBUSY:16,ECANCELED:89,ECHILD:10,ECONNABORTED:53,ECONNREFUSED:61,ECONNRESET:54,EDEADLK:11,EDESTADDRREQ:39,EDOM:33,EDQUOT:69,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:65,EIDRM:90,EILSEQ:92,EINPROGRESS:36,EINTR:4,EINVAL:22,EIO:5,EISCONN:56,EISDIR:21,ELOOP:62,EMFILE:24,EMLINK:31,EMSGSIZE:40,EMULTIHOP:95,ENAMETOOLONG:63,ENETDOWN:50,ENETRESET:52,ENETUNREACH:51,ENFILE:23,ENOBUFS:55,ENODATA:96,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:77,ENOLINK:97,ENOMEM:12,ENOMSG:91,ENOPROTOOPT:42,ENOSPC:28,ENOSR:98,ENOSTR:99,ENOSYS:78,ENOTCONN:57,ENOTDIR:20,ENOTEMPTY:66,ENOTSOCK:38,ENOTSUP:45,ENOTTY:25,ENXIO:6,EOPNOTSUPP:102,EOVERFLOW:84,EPERM:1,EPIPE:32,EPROTO:100,EPROTONOSUPPORT:43,EPROTOTYPE:41,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:70,ETIME:101,ETIMEDOUT:60,ETXTBSY:26,EWOULDBLOCK:35,EXDEV:18,PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20,SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:10,SIGFPE:8,SIGKILL:9,SIGUSR1:30,SIGSEGV:11,SIGUSR2:31,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGCHLD:20,SIGCONT:19,SIGSTOP:17,SIGTSTP:18,SIGTTIN:21,SIGTTOU:22,SIGURG:16,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:23,SIGINFO:29,SIGSYS:12,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,O_RDONLY:0,O_WRONLY:1,O_RDWR:2,UV_DIRENT_UNKNOWN:0,UV_DIRENT_FILE:1,UV_DIRENT_DIR:2,UV_DIRENT_LINK:3,UV_DIRENT_FIFO:4,UV_DIRENT_SOCKET:5,UV_DIRENT_CHAR:6,UV_DIRENT_BLOCK:7,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:512,O_EXCL:2048,O_NOCTTY:mn,O_TRUNC:1024,O_APPEND:8,O_DIRECTORY:gn,O_NOFOLLOW:256,O_SYNC:128,O_DSYNC:yn,O_SYMLINK:bn,O_NONBLOCK:4,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_COPYFILE_EXCL:1,COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_FICLONE_FORCE:4,OPENSSL_VERSION_NUMBER:vn,SSL_OP_ALL:wn,SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION:_n,SSL_OP_CIPHER_SERVER_PREFERENCE:Mn,SSL_OP_CISCO_ANYCONNECT:32768,SSL_OP_COOKIE_EXCHANGE:8192,SSL_OP_CRYPTOPRO_TLSEXT_BUG:Sn,SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:2048,SSL_OP_EPHEMERAL_RSA:0,SSL_OP_LEGACY_SERVER_CONNECT:4,SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:0,SSL_OP_MICROSOFT_SESS_ID_BUG:0,SSL_OP_MSIE_SSLV2_RSA_PADDING:0,SSL_OP_NETSCAPE_CA_DN_BUG:0,SSL_OP_NETSCAPE_CHALLENGE_BUG:0,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG:0,SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG:0,SSL_OP_NO_COMPRESSION:En,SSL_OP_NO_QUERY_MTU:4096,SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION:65536,SSL_OP_NO_SSLv2:0,SSL_OP_NO_SSLv3:kn,SSL_OP_NO_TICKET:16384,SSL_OP_NO_TLSv1:An,SSL_OP_NO_TLSv1_1:On,SSL_OP_NO_TLSv1_2:Tn,SSL_OP_PKCS1_CHECK_1:0,SSL_OP_PKCS1_CHECK_2:0,SSL_OP_SINGLE_DH_USE:0,SSL_OP_SINGLE_ECDH_USE:0,SSL_OP_SSLEAY_080_CLIENT_DH_BUG:0,SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG:0,SSL_OP_TLS_BLOCK_PADDING_BUG:0,SSL_OP_TLS_D5_BUG:0,SSL_OP_TLS_ROLLBACK_BUG:In,ENGINE_METHOD_RSA:1,ENGINE_METHOD_DSA:2,ENGINE_METHOD_DH:4,ENGINE_METHOD_RAND:8,ENGINE_METHOD_EC:2048,ENGINE_METHOD_CIPHERS:64,ENGINE_METHOD_DIGESTS:128,ENGINE_METHOD_PKEY_METHS:512,ENGINE_METHOD_PKEY_ASN1_METHS:1024,ENGINE_METHOD_ALL:65535,ENGINE_METHOD_NONE:0,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,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,RSA_PSS_SALTLEN_DIGEST:-1,RSA_PSS_SALTLEN_MAX_SIGN:-2,RSA_PSS_SALTLEN_AUTO:-2,defaultCoreCipherList:Rn,TLS1_VERSION:769,TLS1_1_VERSION:770,TLS1_2_VERSION:771,TLS1_3_VERSION:772,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6,defaultCipherList:Cn},xn=X(Object.freeze({__proto__:null,ALPN_ENABLED:1,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4,DH_CHECK_P_NOT_PRIME:1,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_NOT_SUITABLE_GENERATOR:8,DH_UNABLE_TO_CHECK_GENERATOR:4,E2BIG:7,EACCES:13,EADDRINUSE:48,EADDRNOTAVAIL:49,EAFNOSUPPORT:47,EAGAIN:35,EALREADY:37,EBADF:9,EBADMSG:94,EBUSY:16,ECANCELED:89,ECHILD:10,ECONNABORTED:53,ECONNREFUSED:61,ECONNRESET:54,EDEADLK:11,EDESTADDRREQ:39,EDOM:33,EDQUOT:69,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:65,EIDRM:90,EILSEQ:92,EINPROGRESS:36,EINTR:4,EINVAL:22,EIO:5,EISCONN:56,EISDIR:21,ELOOP:62,EMFILE:24,EMLINK:31,EMSGSIZE:40,EMULTIHOP:95,ENAMETOOLONG:63,ENETDOWN:50,ENETRESET:52,ENETUNREACH:51,ENFILE:23,ENGINE_METHOD_ALL:65535,ENGINE_METHOD_CIPHERS:64,ENGINE_METHOD_DH:4,ENGINE_METHOD_DIGESTS:128,ENGINE_METHOD_DSA:2,ENGINE_METHOD_EC:2048,ENGINE_METHOD_NONE:0,ENGINE_METHOD_PKEY_ASN1_METHS:1024,ENGINE_METHOD_PKEY_METHS:512,ENGINE_METHOD_RAND:8,ENGINE_METHOD_RSA:1,ENOBUFS:55,ENODATA:96,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:77,ENOLINK:97,ENOMEM:12,ENOMSG:91,ENOPROTOOPT:42,ENOSPC:28,ENOSR:98,ENOSTR:99,ENOSYS:78,ENOTCONN:57,ENOTDIR:20,ENOTEMPTY:66,ENOTSOCK:38,ENOTSUP:45,ENOTTY:25,ENXIO:6,EOPNOTSUPP:102,EOVERFLOW:84,EPERM:1,EPIPE:32,EPROTO:100,EPROTONOSUPPORT:43,EPROTOTYPE:41,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:70,ETIME:101,ETIMEDOUT:60,ETXTBSY:26,EWOULDBLOCK:35,EXDEV:18,F_OK:0,OPENSSL_VERSION_NUMBER:vn,O_APPEND:8,O_CREAT:512,O_DIRECTORY:gn,O_DSYNC:yn,O_EXCL:2048,O_NOCTTY:mn,O_NOFOLLOW:256,O_NONBLOCK:4,O_RDONLY:0,O_RDWR:2,O_SYMLINK:bn,O_SYNC:128,O_TRUNC:1024,O_WRONLY:1,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_HYBRID:6,POINT_CONVERSION_UNCOMPRESSED:4,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_BELOW_NORMAL:10,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20,PRIORITY_LOW:19,PRIORITY_NORMAL:0,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_PKCS1_PADDING:1,RSA_PKCS1_PSS_PADDING:6,RSA_PSS_SALTLEN_AUTO:-2,RSA_PSS_SALTLEN_DIGEST:-1,RSA_PSS_SALTLEN_MAX_SIGN:-2,RSA_SSLV23_PADDING:2,RSA_X931_PADDING:5,RTLD_GLOBAL:8,RTLD_LAZY:1,RTLD_LOCAL:4,RTLD_NOW:2,R_OK:4,SIGABRT:6,SIGALRM:14,SIGBUS:10,SIGCHLD:20,SIGCONT:19,SIGFPE:8,SIGHUP:1,SIGILL:4,SIGINFO:29,SIGINT:2,SIGIO:23,SIGIOT:6,SIGKILL:9,SIGPIPE:13,SIGPROF:27,SIGQUIT:3,SIGSEGV:11,SIGSTOP:17,SIGSYS:12,SIGTERM:15,SIGTRAP:5,SIGTSTP:18,SIGTTIN:21,SIGTTOU:22,SIGURG:16,SIGUSR1:30,SIGUSR2:31,SIGVTALRM:26,SIGWINCH:28,SIGXCPU:24,SIGXFSZ:25,SSL_OP_ALL:wn,SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION:_n,SSL_OP_CIPHER_SERVER_PREFERENCE:Mn,SSL_OP_CISCO_ANYCONNECT:32768,SSL_OP_COOKIE_EXCHANGE:8192,SSL_OP_CRYPTOPRO_TLSEXT_BUG:Sn,SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:2048,SSL_OP_EPHEMERAL_RSA:0,SSL_OP_LEGACY_SERVER_CONNECT:4,SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:0,SSL_OP_MICROSOFT_SESS_ID_BUG:0,SSL_OP_MSIE_SSLV2_RSA_PADDING:0,SSL_OP_NETSCAPE_CA_DN_BUG:0,SSL_OP_NETSCAPE_CHALLENGE_BUG:0,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG:0,SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG:0,SSL_OP_NO_COMPRESSION:En,SSL_OP_NO_QUERY_MTU:4096,SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION:65536,SSL_OP_NO_SSLv2:0,SSL_OP_NO_SSLv3:kn,SSL_OP_NO_TICKET:16384,SSL_OP_NO_TLSv1:An,SSL_OP_NO_TLSv1_1:On,SSL_OP_NO_TLSv1_2:Tn,SSL_OP_PKCS1_CHECK_1:0,SSL_OP_PKCS1_CHECK_2:0,SSL_OP_SINGLE_DH_USE:0,SSL_OP_SINGLE_ECDH_USE:0,SSL_OP_SSLEAY_080_CLIENT_DH_BUG:0,SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG:0,SSL_OP_TLS_BLOCK_PADDING_BUG:0,SSL_OP_TLS_D5_BUG:0,SSL_OP_TLS_ROLLBACK_BUG:In,S_IFBLK:24576,S_IFCHR:8192,S_IFDIR:16384,S_IFIFO:4096,S_IFLNK:40960,S_IFMT:61440,S_IFREG:32768,S_IFSOCK:49152,S_IRGRP:32,S_IROTH:4,S_IRUSR:256,S_IRWXG:56,S_IRWXO:7,S_IRWXU:448,S_IWGRP:16,S_IWOTH:2,S_IWUSR:128,S_IXGRP:8,S_IXOTH:1,S_IXUSR:64,TLS1_1_VERSION:770,TLS1_2_VERSION:771,TLS1_3_VERSION:772,TLS1_VERSION:769,UV_DIRENT_BLOCK:7,UV_DIRENT_CHAR:6,UV_DIRENT_DIR:2,UV_DIRENT_FIFO:4,UV_DIRENT_FILE:1,UV_DIRENT_LINK:3,UV_DIRENT_SOCKET:5,UV_DIRENT_UNKNOWN:0,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,W_OK:2,X_OK:1,default:Pn,defaultCipherList:Cn,defaultCoreCipherList:Rn})),Nn={};function Bn(){throw new Error("setTimeout has not been defined")}function Ln(){throw new Error("clearTimeout has not been defined")}var Dn=Bn,jn=Ln;function Un(t){if(Dn===setTimeout)return setTimeout(t,0);if((Dn===Bn||!Dn)&&setTimeout)return Dn=setTimeout,setTimeout(t,0);try{return Dn(t,0)}catch(e){try{return Dn.call(null,t,0)}catch(e){return Dn.call(this,t,0)}}}"function"==typeof le.setTimeout&&(Dn=setTimeout),"function"==typeof le.clearTimeout&&(jn=clearTimeout);var qn,Fn=[],zn=!1,Hn=-1;function Kn(){zn&&qn&&(zn=!1,qn.length?Fn=qn.concat(Fn):Hn=-1,Fn.length&&Vn())}function Vn(){if(!zn){var t=Un(Kn);zn=!0;for(var e=Fn.length;e;){for(qn=Fn,Fn=[];++Hn<e;)qn&&qn[Hn].run();Hn=-1,e=Fn.length}qn=null,zn=!1,function(t){if(jn===clearTimeout)return clearTimeout(t);if((jn===Ln||!jn)&&clearTimeout)return jn=clearTimeout,clearTimeout(t);try{return jn(t)}catch(e){try{return jn.call(null,t)}catch(e){return jn.call(this,t)}}}(t)}}function Gn(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Fn.push(new Wn(t,e)),1!==Fn.length||zn||Un(Vn)}function Wn(t,e){this.fun=t,this.array=e}Wn.prototype.run=function(){this.fun.apply(null,this.array)};function Yn(){}var Zn=Yn,Xn=Yn,Qn=Yn,Jn=Yn,$n=Yn,to=Yn,eo=Yn;var ro=le.performance||{},io=ro.now||ro.mozNow||ro.msNow||ro.oNow||ro.webkitNow||function(){return(new Date).getTime()};var no=new Date;var oo={nextTick:Gn,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Zn,addListener:Xn,once:Qn,off:Jn,removeListener:$n,removeAllListeners:to,emit:eo,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*io.call(ro),r=Math.floor(e),i=Math.floor(e%1*1e9);return t&&(r-=t[0],(i-=t[1])<0&&(r--,i+=1e9)),[r,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-no)/1e3}},so={},ao={},ho={},uo={get exports(){return ho},set exports(t){ho=t}},fo={},lo={get exports(){return fo},set exports(t){fo=t}},co=X(Vr);
1
+ import t from"soonspacejs";import{Vector4 as e,TextureLoader as r,Object3D as i,Vector2 as n,OrthographicCamera as o,MeshBasicMaterial as s,Mesh as a,PlaneGeometry as h,RepeatWrapping as u,Box3 as f,Vector3 as l,Matrix4 as c}from"three";var d=function(t,e){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},d(t,e)};function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var m=function(){return m=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},m.apply(this,arguments)};function g(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}function y(t,e,r,i){var n,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,r,s):n(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}function b(t,e){return function(r,i){e(r,i,t)}}function v(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function w(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof r?t:new r((function(e){e(t)}))}(t.value).then(s,a)}h((i=i.apply(t,e||[])).next())}))}function _(t,e){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(h){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,h])}}}var M=Object.create?function(t,e,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]};function S(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||M(e,t,r)}function E(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function k(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s}function A(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(k(arguments[e]));return t}function O(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var i=Array(t),n=0;for(e=0;e<r;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,n++)i[n]=o[s];return i}function T(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function I(t){return this instanceof I?(this.v=t,this):new I(t)}function R(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(t,e||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(t){n[t]&&(i[t]=function(e){return new Promise((function(r,i){o.push([t,e,r,i])>1||a(t,e)}))})}function a(t,e){try{!function(t){t.value instanceof I?Promise.resolve(t.value.v).then(h,u):f(o[0][2],t)}(n[t](e))}catch(t){f(o[0][3],t)}}function h(t){a("next",t)}function u(t){a("throw",t)}function f(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}function C(t){var e,r;return e={},i("next"),i("throw",(function(t){throw t})),i("return"),e[Symbol.iterator]=function(){return this},e;function i(i,n){e[i]=t[i]?function(e){return(r=!r)?{value:I(t[i](e)),done:!1}:n?n(e):e}:n}}function P(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=E(t),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(r){e[r]=t[r]&&function(e){return new Promise((function(i,n){(function(t,e,r,i){Promise.resolve(i).then((function(e){t({value:e,done:r})}),e)})(i,n,(e=t[r](e)).done,e.value)}))}}}function x(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var N=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function B(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&M(e,t,r);return N(e,t),e}function L(t){return t&&t.__esModule?t:{default:t}}function D(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)}function j(t,e,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r}function U(t,e){if(null===e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof t?e===t:t.has(e)}function q(t,e,r){if(null!=e){if("object"!=typeof e&&"function"!=typeof e)throw new TypeError("Object expected.");var i;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=e[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=e[Symbol.dispose]}if("function"!=typeof i)throw new TypeError("Object not disposable.");t.stack.push({value:e,dispose:i,async:r})}else r&&t.stack.push({async:!0});return e}var F="function"==typeof SuppressedError?SuppressedError:function(t,e,r){var i=new Error(r);return i.name="SuppressedError",i.error=t,i.suppressed=e,i};function z(t){function e(e){t.error=t.hasError?new F(e,t.error,"An error was suppressed during disposal."):e,t.hasError=!0}return function r(){for(;t.stack.length;){var i=t.stack.pop();try{var n=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(n).then(r,(function(t){return e(t),r()}))}catch(t){e(t)}}if(t.hasError)throw t.error}()}var H={__extends:p,__assign:m,__rest:g,__decorate:y,__param:b,__metadata:v,__awaiter:w,__generator:_,__createBinding:M,__exportStar:S,__values:E,__read:k,__spread:A,__spreadArrays:O,__spreadArray:T,__await:I,__asyncGenerator:R,__asyncDelegator:C,__asyncValues:P,__makeTemplateObject:x,__importStar:B,__importDefault:L,__classPrivateFieldGet:D,__classPrivateFieldSet:j,__classPrivateFieldIn:U,__addDisposableResource:q,__disposeResources:z},K=Object.freeze({__proto__:null,__addDisposableResource:q,get __assign(){return m},__asyncDelegator:C,__asyncGenerator:R,__asyncValues:P,__await:I,__awaiter:w,__classPrivateFieldGet:D,__classPrivateFieldIn:U,__classPrivateFieldSet:j,__createBinding:M,__decorate:y,__disposeResources:z,__esDecorate:function(t,e,r,i,n,o){function s(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var a,h=i.kind,u="getter"===h?"get":"setter"===h?"set":"value",f=!e&&t?i.static?t:t.prototype:null,l=e||(f?Object.getOwnPropertyDescriptor(f,i.name):{}),c=!1,d=r.length-1;d>=0;d--){var p={};for(var m in i)p[m]="access"===m?{}:i[m];for(var m in i.access)p.access[m]=i.access[m];p.addInitializer=function(t){if(c)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(t||null))};var g=(0,r[d])("accessor"===h?{get:l.get,set:l.set}:l[u],p);if("accessor"===h){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=s(g.get))&&(l.get=a),(a=s(g.set))&&(l.set=a),(a=s(g.init))&&n.unshift(a)}else(a=s(g))&&("field"===h?n.unshift(a):l[u]=a)}f&&Object.defineProperty(f,i.name,l),c=!0},__exportStar:S,__extends:p,__generator:_,__importDefault:L,__importStar:B,__makeTemplateObject:x,__metadata:v,__param:b,__propKey:function(t){return"symbol"==typeof t?t:"".concat(t)},__read:k,__rest:g,__runInitializers:function(t,e,r){for(var i=arguments.length>2,n=0;n<e.length;n++)r=i?e[n].call(t,r):e[n].call(t);return i?r:void 0},__setFunctionName:function(t,e,r){return"symbol"==typeof e&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})},__spread:A,__spreadArray:T,__spreadArrays:O,__values:E,default:H});const V={width:"400px",height:"300px",backgroundColor:"black"};var G;!function(t){t.PANEL="PANEL",t.VIDEO="VIDEO",t.VIDEO_STREAM="VIDEO_STREAM"}(G||(G={}));class W{constructor(t){this.ssp=t}resetStyleName(t){const e=[...t];for(const t in e)e[t]!==e[t].toLowerCase()&&(e[t]=`-${e[t].toLowerCase()}`);return e.join("")}mergeElementStyle(t){let e="";for(const r in t)e+=`${this.resetStyleName(r)}: ${t[r]};`;return e}renderCustom(t){const{tagName:e,style:r=V,innerHTML:i}=t,n=document.createElement(e);return n.style.cssText=this.mergeElementStyle(r),i&&(n.innerHTML=i),this.ssp.createPoiNode(Object.assign(Object.assign({},t),{element:n}))}renderVideo(t){const{src:e,style:r=V,isLoop:i=!0,autoPlay:n=!0}=t,o=document.createElement("video");return o.style.cssText=this.mergeElementStyle(r),o.controls=!0,o.muted=!0,o.loop=i,o.autoplay=n,e&&(o.src=e),this.ssp.createPoiNode(Object.assign(Object.assign({},t),{element:o}))}renderPanel(t){const{dataSource:e,rowStyle:r,labelStyle:i,valueStyle:n}=t,o=e.map((t=>`<div style="${this.mergeElementStyle(r||{})}">\n<span style="${this.mergeElementStyle(i||{})}">${t.label}</span>\n<span style="${this.mergeElementStyle(n||{})}">${t.value}</span>\n</div>`)).join("");return this.renderCustom(Object.assign(Object.assign({tagName:"div"},t),{innerHTML:o}))}batchRender(t){const{dataSource:e}=t,r=t=>{const{id:e,pid:r,width:i,height:n,dataSource:o,fileUrl:s,style:a,visible:h}=t;let u=this.ssp.getObjectById(e),f=h;if(u&&(f=u.visible,this.ssp.removeObjectById(e)),t.contentType===G.VIDEO)u=this.renderVideo(Object.assign(Object.assign({},t),{src:s,visible:f,style:{width:i+"px",height:n+"px"}}));else if(t.contentType===G.PANEL){const{panel:{bodyStyle:e,rowStyle:r,labelStyle:h,valueStyle:l}}=JSON.parse(a);u=this.renderPanel(Object.assign(Object.assign({},t),{visible:f,style:Object.assign(Object.assign({width:i+"px",height:n+"px",backgroundImage:`url(${s})`,overflow:"auto"},e),{padding:e.padding+"px"}),rowStyle:Object.assign(Object.assign({},r),{gap:r.gap+"px"}),labelStyle:Object.assign(Object.assign({},h),{fontSize:h.fontSize+"px"}),valueStyle:Object.assign(Object.assign({},l),{fontSize:l.fontSize+"px"}),dataSource:o}))}if(u&&r){const t=this.ssp.getObjectById(r);t&&this.ssp.addObject(u,t)}};e.forEach((t=>{r(t)}))}}var Y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Z(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function X(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){if(this instanceof t){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(e,r))}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),r}var Q={},J={},$=X(K),tt={},et={},rt={},it={};Object.defineProperty(it,"__esModule",{value:!0}),it.Slot=void 0;var nt=function(){function t(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=t,this._once=r,this._signal=e,this._priority=i,this.verifyListener(t)}return t.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},t.prototype.execute1=function(t){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[t].concat(this._params)):this._listener(t))},t.prototype.execute=function(t){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(t=t.concat(this._params));var e=t.length;0===e?this._listener():1===e?this._listener(t[0]):2===e?this._listener(t[0],t[1]):3===e?this._listener(t[0],t[1],t[2]):this._listener.apply(null,t)}},Object.defineProperty(t.prototype,"listener",{get:function(){return this._listener},set:function(t){if(null==t)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(t),this._listener=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"once",{get:function(){return this._once},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return this._priority},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"params",{get:function(){return this._params},set:function(t){this._params=t},enumerable:!1,configurable:!0}),t.prototype.remove=function(){this._signal.remove(this._listener)},t.prototype.verifyListener=function(t){if(null==t)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},t}();it.Slot=nt;var ot={};Object.defineProperty(ot,"__esModule",{value:!0}),ot.SlotList=void 0;var st=function(){function t(e,r){if(void 0===r&&(r=null),this.nonEmpty=!1,e||r){if(!e)throw new Error("Parameter head cannot be null.");this.head=e,this.tail=r||t.NIL,this.nonEmpty=!0}else{if(t.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(t.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===t.NIL)return 1;for(var e=0,r=this;r.nonEmpty;)++e,r=r.tail;return e},enumerable:!1,configurable:!0}),t.prototype.prepend=function(e){return new t(e,this)},t.prototype.append=function(e){if(!e)return this;if(!this.nonEmpty)return new t(e);if(this.tail===t.NIL)return new t(e).prepend(this.head);for(var r=new t(this.head),i=r,n=this.tail;n.nonEmpty;)i=i.tail=new t(n.head),n=n.tail;return i.tail=new t(e),r},t.prototype.insertWithPriority=function(e){if(!this.nonEmpty)return new t(e);var r=e.priority;if(r>this.head.priority)return this.prepend(e);for(var i=new t(this.head),n=i,o=this.tail;o.nonEmpty;){if(r>o.head.priority)return n.tail=o.prepend(e),i;n=n.tail=new t(o.head),o=o.tail}return n.tail=new t(e),i},t.prototype.filterNot=function(e){if(!this.nonEmpty||null==e)return this;if(e===this.head.listener)return this.tail;for(var r=new t(this.head),i=r,n=this.tail;n.nonEmpty;){if(n.head.listener===e)return i.tail=n.tail,r;i=i.tail=new t(n.head),n=n.tail}return this},t.prototype.contains=function(t){if(!this.nonEmpty)return!1;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return!0;e=e.tail}return!1},t.prototype.find=function(t){if(!this.nonEmpty)return null;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return e.head;e=e.tail}return null},t.prototype.toString=function(){for(var t="",e=this;e.nonEmpty;)t+=e.head+" -> ",e=e.tail;return"[List "+(t+="NIL")+"]"},t.NIL=new t(null,null),t}();ot.SlotList=st,Object.defineProperty(rt,"__esModule",{value:!0}),rt.OnceSignal=void 0;var at=it,ht=ot,ut=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.slots=ht.SlotList.NIL,this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if(!(this._valueClasses[e]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+">."+this._valueClasses[e])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!1,configurable:!0}),t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){var e=this.slots.find(t);return e?(this.slots=this.slots.filterNot(t),e):null},t.prototype.removeAll=function(){this.slots=ht.SlotList.NIL},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(!(null===t[n]||t[n]instanceof this._valueClasses[n]||t[n].constructor===this._valueClasses[n]))throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(t),o=o.tail},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.registrationPossible(t,e)){var r=new at.Slot(t,this,e);return this.slots=this.slots.prepend(r),r}return this.slots.find(t)},t.prototype.registrationPossible=function(t,e){if(!this.slots.nonEmpty)return!0;var r=this.slots.find(t);if(!r)return!0;if(r.once!==e)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},t}();rt.OnceSignal=ut,Object.defineProperty(et,"__esModule",{value:!0}),et.Signal=void 0;var ft=$,lt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ft.__extends(e,t),e.prototype.add=function(t){return this.registerListener(t)},e}(rt.OnceSignal);et.Signal=lt,Object.defineProperty(tt,"__esModule",{value:!0}),tt.PrioritySignal=void 0;var ct=$,dt=it,pt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ct.__extends(e,t),e.prototype.addWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!1,e)},e.prototype.addOnceWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!0,e)},e.prototype.registerListener=function(t,e){return void 0===e&&(e=!1),this.registerListenerWithPriority(t,e)},e.prototype.registerListenerWithPriority=function(t,e,r){if(void 0===r&&(r=0),this.registrationPossible(t,e)){var i=new dt.Slot(t,this,e,r);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(t)},e}(et.Signal);tt.PrioritySignal=pt,Object.defineProperty(J,"__esModule",{value:!0}),J.DeluxeSignal=void 0;var mt=$,gt=function(t){function e(e){void 0===e&&(e=null);for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=this;return r=1===r.length&&r[0]instanceof Array?r[0]:r,(n=t.call(this,r)||this)._target=e,n}return mt.__extends(e,t),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(t){t!==this._target&&(this.removeAll(),this._target=t)},enumerable:!1,configurable:!0}),e.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(null!==t[n]&&t[n].constructor!==this._valueClasses[n])throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");var o=t[0];o&&(o.target&&(o=o.clone(),t[0]=o),o.target=this.target,o.currentTarget=this.target,o.signal=this);for(var s=this.slots;s.nonEmpty;)s.head.execute(t),s=s.tail;if(o&&o.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(null===(a=a.parent).onEventBubbled||(o.currentTarget=a,a.onEventBubbled(o))););},e}(tt.PrioritySignal);J.DeluxeSignal=gt;var yt={};Object.defineProperty(yt,"__esModule",{value:!0}),yt.GenericEvent=void 0;var bt=function(){function t(t){void 0===t&&(t=!1),this._bubbles=t}return Object.defineProperty(t.prototype,"signal",{get:function(){return this._signal},set:function(t){this._signal=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(t){this._target=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(t){this._currentTarget=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bubbles",{get:function(){return this._bubbles},set:function(t){this._bubbles=t},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return new t(this._bubbles)},t}();yt.GenericEvent=bt;var vt={};Object.defineProperty(vt,"__esModule",{value:!0}),vt.IOnceSignal=void 0,vt.IOnceSignal=Symbol("IOnceSignal");var wt={};Object.defineProperty(wt,"__esModule",{value:!0}),wt.IPrioritySignal=void 0,wt.IPrioritySignal=Symbol("IPrioritySignal");var _t={};Object.defineProperty(_t,"__esModule",{value:!0}),_t.ISignal=void 0,_t.ISignal=Symbol("ISignal");var Mt={};Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.ISlot=void 0,Mt.ISlot=Symbol("ISlot");var St={};Object.defineProperty(St,"__esModule",{value:!0}),St.MonoSignal=void 0;var Et=it,kt=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if("function"!=typeof this._valueClasses[e])throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+"'>."+this._valueClasses[e])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!1,configurable:!0}),t.prototype.add=function(t){return this.registerListener(t)},t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){if(this.slot&&this.slot.listener===t){var e=this.slot;return this.slot=null,e}return null},t.prototype.removeAll=function(){this.slot&&this.slot.remove()},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(!(null===t[n]||t[n]instanceof this._valueClasses[n]||t[n].constructor===this._valueClasses[n]))throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");this.slot&&this.slot.execute(t)},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new Et.Slot(t,this,e)},t}();St.MonoSignal=kt;var At={};Object.defineProperty(At,"__esModule",{value:!0}),At.Promise=void 0;var Ot=$,Tt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ot.__extends(e,t),e.prototype.addOnce=function(e){var r=t.prototype.addOnce.call(this,e);return this._isDispatched&&(r.execute(this._valueObjects),r.remove()),r},e.prototype.dispatch=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(this._isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this._isDispatched=!0,this._valueObjects=e,t.prototype.dispatch.apply(this,e)},e}(rt.OnceSignal);function It(t,e){return this.edges.filter((r=>r.sourceNodeId===t&&r.sourceNodeHandleId===e))}At.Promise=Tt,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SlotList=t.Slot=t.Signal=t.Promise=t.PrioritySignal=t.OnceSignal=t.MonoSignal=t.ISlot=t.ISignal=t.IPrioritySignal=t.IOnceSignal=t.GenericEvent=t.DeluxeSignal=void 0;var e=J;Object.defineProperty(t,"DeluxeSignal",{enumerable:!0,get:function(){return e.DeluxeSignal}});var r=yt;Object.defineProperty(t,"GenericEvent",{enumerable:!0,get:function(){return r.GenericEvent}});var i=vt;Object.defineProperty(t,"IOnceSignal",{enumerable:!0,get:function(){return i.IOnceSignal}});var n=wt;Object.defineProperty(t,"IPrioritySignal",{enumerable:!0,get:function(){return n.IPrioritySignal}});var o=_t;Object.defineProperty(t,"ISignal",{enumerable:!0,get:function(){return o.ISignal}});var s=Mt;Object.defineProperty(t,"ISlot",{enumerable:!0,get:function(){return s.ISlot}});var a=St;Object.defineProperty(t,"MonoSignal",{enumerable:!0,get:function(){return a.MonoSignal}});var h=rt;Object.defineProperty(t,"OnceSignal",{enumerable:!0,get:function(){return h.OnceSignal}});var u=tt;Object.defineProperty(t,"PrioritySignal",{enumerable:!0,get:function(){return u.PrioritySignal}});var f=At;Object.defineProperty(t,"Promise",{enumerable:!0,get:function(){return f.Promise}});var l=et;Object.defineProperty(t,"Signal",{enumerable:!0,get:function(){return l.Signal}});var c=it;Object.defineProperty(t,"Slot",{enumerable:!0,get:function(){return c.Slot}});var d=ot;Object.defineProperty(t,"SlotList",{enumerable:!0,get:function(){return d.SlotList}})}(Q);let Rt=class{async _runFlowHandler(t){const e=this.nodes.filter((({isStartNode:t})=>t));if(0===e.length)return Promise.reject("In SoonFlow: CommonHandler _runFlowHandler not find startNode");for(let r=0;r<e.length;r++)for(let i=0;i<e[r].outputs.length;i++)await t.call(this,e[r],e[r].outputs[i])}async _operateFlowNode(t,e,r){const i=It.call(this,e.id,r.id);if(0===i.length)return;const n=i.map((t=>t.targetNodeId));for(let i=0;i<n.length;i++){const o=n[i],s=this.nodes.find((t=>t.id===o));if(!s)return Promise.reject("In SoonFlow: CommonHandler _operateFlowNode not find nextNode");const{type:a}=s,h=this.nodeTypeMethods[a];if(!h)return Promise.reject("In SoonFlow: CommonHandler _operateFlowNode not find nodeTypeMethod");await(h[t]?.call(this,{prevNode:e,node:s,inputData:r.data}))}}},Ct=class extends Rt{nodes;edges;nodeTypeMethods;outInstances;#t=new Map;constructor(t,e,r,i){super(),this.nodes=t,this.edges=e,this.nodeTypeMethods=r,this.outInstances=i}getOutInstance(t){return this.outInstances[t]}getPrevNodeList(t){const e=this.edges.filter((e=>e.targetNodeHandleId===t)),r=[];return e.forEach((t=>{this.nodes.forEach((e=>{e.outputs.some((e=>e.id===t.sourceNodeHandleId))&&(r.find((t=>t.id===e.id))||r.push(e))}))})),r}async runParse(){return this._runFlowHandler(this.parseFlowNode)}async parseFlowNode(t,e){return this._operateFlowNode("parse",t,e)}addSignal(t,e){const r=new Q.Signal;r.add(e),this.#t.set(t,r)}dispatchSignal(t){this.#t.get(t)?.dispatch()}},Pt=class extends Rt{nodes;edges;nodeTypeMethods;outInstances;constructor(t,e,r,i){super(),this.nodes=t,this.edges=e,this.nodeTypeMethods=r,this.outInstances=i,this.#e()}#e(){this._runFlowHandler(this.unregisterFlowNode)}async unregisterFlowNode(t,e){return this._operateFlowNode("unregister",t,e)}};class xt{path;constructor(t){this.path=t}setPath(t){this.path=t}async getFlowData(){return{flowList:(await(await this.fetchFileData("/db/flows.json")).json()).map((t=>{const{nodeData:e}=t,{nodeList:r,lineList:i}=e;return{...t,nodes:r.map((t=>({...t,inputs:t.handlerList.filter((({type:t})=>"target"===t)),outputs:t.handlerList.filter((({type:t})=>"source"===t)),isStartNode:"start"===t.type}))),edges:i.map((t=>({...t,sourceNodeHandleId:t.sourceHandlerId,targetNodeHandleId:t.targetHandlerId})))}}))}}fetchFileData(t){return fetch(`${this.path}${t}`)}}var Nt={},Bt={},Lt={},Dt={},jt={};Object.defineProperty(jt,"__esModule",{value:!0}),jt.Slot=void 0;var Ut=function(){function t(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=t,this._once=r,this._signal=e,this._priority=i,this.verifyListener(t)}return t.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},t.prototype.execute1=function(t){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[t].concat(this._params)):this._listener(t))},t.prototype.execute=function(t){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(t=t.concat(this._params));var e=t.length;0===e?this._listener():1===e?this._listener(t[0]):2===e?this._listener(t[0],t[1]):3===e?this._listener(t[0],t[1],t[2]):this._listener.apply(null,t)}},Object.defineProperty(t.prototype,"listener",{get:function(){return this._listener},set:function(t){if(null==t)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(t),this._listener=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"once",{get:function(){return this._once},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return this._priority},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"params",{get:function(){return this._params},set:function(t){this._params=t},enumerable:!1,configurable:!0}),t.prototype.remove=function(){this._signal.remove(this._listener)},t.prototype.verifyListener=function(t){if(null==t)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},t}();jt.Slot=Ut;var qt={};Object.defineProperty(qt,"__esModule",{value:!0}),qt.SlotList=void 0;var Ft=function(){function t(e,r){if(void 0===r&&(r=null),this.nonEmpty=!1,e||r){if(!e)throw new Error("Parameter head cannot be null.");this.head=e,this.tail=r||t.NIL,this.nonEmpty=!0}else{if(t.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(t.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===t.NIL)return 1;for(var e=0,r=this;r.nonEmpty;)++e,r=r.tail;return e},enumerable:!1,configurable:!0}),t.prototype.prepend=function(e){return new t(e,this)},t.prototype.append=function(e){if(!e)return this;if(!this.nonEmpty)return new t(e);if(this.tail===t.NIL)return new t(e).prepend(this.head);for(var r=new t(this.head),i=r,n=this.tail;n.nonEmpty;)i=i.tail=new t(n.head),n=n.tail;return i.tail=new t(e),r},t.prototype.insertWithPriority=function(e){if(!this.nonEmpty)return new t(e);var r=e.priority;if(r>this.head.priority)return this.prepend(e);for(var i=new t(this.head),n=i,o=this.tail;o.nonEmpty;){if(r>o.head.priority)return n.tail=o.prepend(e),i;n=n.tail=new t(o.head),o=o.tail}return n.tail=new t(e),i},t.prototype.filterNot=function(e){if(!this.nonEmpty||null==e)return this;if(e===this.head.listener)return this.tail;for(var r=new t(this.head),i=r,n=this.tail;n.nonEmpty;){if(n.head.listener===e)return i.tail=n.tail,r;i=i.tail=new t(n.head),n=n.tail}return this},t.prototype.contains=function(t){if(!this.nonEmpty)return!1;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return!0;e=e.tail}return!1},t.prototype.find=function(t){if(!this.nonEmpty)return null;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return e.head;e=e.tail}return null},t.prototype.toString=function(){for(var t="",e=this;e.nonEmpty;)t+=e.head+" -> ",e=e.tail;return"[List "+(t+="NIL")+"]"},t.NIL=new t(null,null),t}();qt.SlotList=Ft,Object.defineProperty(Dt,"__esModule",{value:!0}),Dt.OnceSignal=void 0;var zt=jt,Ht=qt,Kt=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.slots=Ht.SlotList.NIL,this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if(!(this._valueClasses[e]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+">."+this._valueClasses[e])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!1,configurable:!0}),t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){var e=this.slots.find(t);return e?(this.slots=this.slots.filterNot(t),e):null},t.prototype.removeAll=function(){this.slots=Ht.SlotList.NIL},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(!(null===t[n]||t[n]instanceof this._valueClasses[n]||t[n].constructor===this._valueClasses[n]))throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(t),o=o.tail},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.registrationPossible(t,e)){var r=new zt.Slot(t,this,e);return this.slots=this.slots.prepend(r),r}return this.slots.find(t)},t.prototype.registrationPossible=function(t,e){if(!this.slots.nonEmpty)return!0;var r=this.slots.find(t);if(!r)return!0;if(r.once!==e)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},t}();Dt.OnceSignal=Kt,Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.Signal=void 0;var Vt=$,Gt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Vt.__extends(e,t),e.prototype.add=function(t){return this.registerListener(t)},e}(Dt.OnceSignal);Lt.Signal=Gt,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.PrioritySignal=void 0;var Wt=$,Yt=jt,Zt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Wt.__extends(e,t),e.prototype.addWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!1,e)},e.prototype.addOnceWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!0,e)},e.prototype.registerListener=function(t,e){return void 0===e&&(e=!1),this.registerListenerWithPriority(t,e)},e.prototype.registerListenerWithPriority=function(t,e,r){if(void 0===r&&(r=0),this.registrationPossible(t,e)){var i=new Yt.Slot(t,this,e,r);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(t)},e}(Lt.Signal);Bt.PrioritySignal=Zt,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.DeluxeSignal=void 0;var Xt=$,Qt=function(t){function e(e){void 0===e&&(e=null);for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=this;return r=1===r.length&&r[0]instanceof Array?r[0]:r,(n=t.call(this,r)||this)._target=e,n}return Xt.__extends(e,t),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(t){t!==this._target&&(this.removeAll(),this._target=t)},enumerable:!1,configurable:!0}),e.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(null!==t[n]&&t[n].constructor!==this._valueClasses[n])throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");var o=t[0];o&&(o.target&&(o=o.clone(),t[0]=o),o.target=this.target,o.currentTarget=this.target,o.signal=this);for(var s=this.slots;s.nonEmpty;)s.head.execute(t),s=s.tail;if(o&&o.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(null===(a=a.parent).onEventBubbled||(o.currentTarget=a,a.onEventBubbled(o))););},e}(Bt.PrioritySignal);Nt.DeluxeSignal=Qt;var Jt={};Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.GenericEvent=void 0;var $t=function(){function t(t){void 0===t&&(t=!1),this._bubbles=t}return Object.defineProperty(t.prototype,"signal",{get:function(){return this._signal},set:function(t){this._signal=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(t){this._target=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(t){this._currentTarget=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bubbles",{get:function(){return this._bubbles},set:function(t){this._bubbles=t},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return new t(this._bubbles)},t}();Jt.GenericEvent=$t;var te={};Object.defineProperty(te,"__esModule",{value:!0}),te.IOnceSignal=void 0,te.IOnceSignal=Symbol("IOnceSignal");var ee={};Object.defineProperty(ee,"__esModule",{value:!0}),ee.IPrioritySignal=void 0,ee.IPrioritySignal=Symbol("IPrioritySignal");var re={};Object.defineProperty(re,"__esModule",{value:!0}),re.ISignal=void 0,re.ISignal=Symbol("ISignal");var ie={};Object.defineProperty(ie,"__esModule",{value:!0}),ie.ISlot=void 0,ie.ISlot=Symbol("ISlot");var ne={};Object.defineProperty(ne,"__esModule",{value:!0}),ne.MonoSignal=void 0;var oe=jt,se=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if("function"!=typeof this._valueClasses[e])throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+"'>."+this._valueClasses[e])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!1,configurable:!0}),t.prototype.add=function(t){return this.registerListener(t)},t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){if(this.slot&&this.slot.listener===t){var e=this.slot;return this.slot=null,e}return null},t.prototype.removeAll=function(){this.slot&&this.slot.remove()},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,i=t.length;if(i<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+i+".");for(var n=0;n<r;n++)if(!(null===t[n]||t[n]instanceof this._valueClasses[n]||t[n].constructor===this._valueClasses[n]))throw new Error("Value object <"+t[n]+"> is not an instance of <"+this._valueClasses[n]+">.");this.slot&&this.slot.execute(t)},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new oe.Slot(t,this,e)},t}();ne.MonoSignal=se;var ae={};Object.defineProperty(ae,"__esModule",{value:!0}),ae.Promise=void 0;var he=$,ue=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return he.__extends(e,t),e.prototype.addOnce=function(e){var r=t.prototype.addOnce.call(this,e);return this._isDispatched&&(r.execute(this._valueObjects),r.remove()),r},e.prototype.dispatch=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(this._isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this._isDispatched=!0,this._valueObjects=e,t.prototype.dispatch.apply(this,e)},e}(Dt.OnceSignal);ae.Promise=ue,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SlotList=t.Slot=t.Signal=t.Promise=t.PrioritySignal=t.OnceSignal=t.MonoSignal=t.ISlot=t.ISignal=t.IPrioritySignal=t.IOnceSignal=t.GenericEvent=t.DeluxeSignal=void 0;var e=Nt;Object.defineProperty(t,"DeluxeSignal",{enumerable:!0,get:function(){return e.DeluxeSignal}});var r=Jt;Object.defineProperty(t,"GenericEvent",{enumerable:!0,get:function(){return r.GenericEvent}});var i=te;Object.defineProperty(t,"IOnceSignal",{enumerable:!0,get:function(){return i.IOnceSignal}});var n=ee;Object.defineProperty(t,"IPrioritySignal",{enumerable:!0,get:function(){return n.IPrioritySignal}});var o=re;Object.defineProperty(t,"ISignal",{enumerable:!0,get:function(){return o.ISignal}});var s=ie;Object.defineProperty(t,"ISlot",{enumerable:!0,get:function(){return s.ISlot}});var a=ne;Object.defineProperty(t,"MonoSignal",{enumerable:!0,get:function(){return a.MonoSignal}});var h=Dt;Object.defineProperty(t,"OnceSignal",{enumerable:!0,get:function(){return h.OnceSignal}});var u=Bt;Object.defineProperty(t,"PrioritySignal",{enumerable:!0,get:function(){return u.PrioritySignal}});var f=ae;Object.defineProperty(t,"Promise",{enumerable:!0,get:function(){return f.Promise}});var l=Lt;Object.defineProperty(t,"Signal",{enumerable:!0,get:function(){return l.Signal}});var c=jt;Object.defineProperty(t,"Slot",{enumerable:!0,get:function(){return c.Slot}});var d=qt;Object.defineProperty(t,"SlotList",{enumerable:!0,get:function(){return d.SlotList}})}({});const fe=(t,...e)=>{console.error(`In SoonFlow: ${t}`,...e)};var le="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function ce(t,e){return function(){return t.apply(e,arguments)}}const{toString:de}=Object.prototype,{getPrototypeOf:pe}=Object,me=(t=>e=>{const r=de.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ge=t=>(t=t.toLowerCase(),e=>me(e)===t),ye=t=>e=>typeof e===t,{isArray:be}=Array,ve=ye("undefined");const we=ge("ArrayBuffer");const _e=ye("string"),Me=ye("function"),Se=ye("number"),Ee=t=>null!==t&&"object"==typeof t,ke=t=>{if("object"!==me(t))return!1;const e=pe(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},Ae=ge("Date"),Oe=ge("File"),Te=ge("Blob"),Ie=ge("FileList"),Re=ge("URLSearchParams");function Ce(t,e,{allOwnKeys:r=!1}={}){if(null==t)return;let i,n;if("object"!=typeof t&&(t=[t]),be(t))for(i=0,n=t.length;i<n;i++)e.call(null,t[i],i,t);else{const n=r?Object.getOwnPropertyNames(t):Object.keys(t),o=n.length;let s;for(i=0;i<o;i++)s=n[i],e.call(null,t[s],s,t)}}function Pe(t,e){e=e.toLowerCase();const r=Object.keys(t);let i,n=r.length;for(;n-- >0;)if(i=r[n],e===i.toLowerCase())return i;return null}const xe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:le,Ne=t=>!ve(t)&&t!==xe;const Be=(Le="undefined"!=typeof Uint8Array&&pe(Uint8Array),t=>Le&&t instanceof Le);var Le;const De=ge("HTMLFormElement"),je=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Ue=ge("RegExp"),qe=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),i={};Ce(r,((r,n)=>{!1!==e(r,n,t)&&(i[n]=r)})),Object.defineProperties(t,i)},Fe="abcdefghijklmnopqrstuvwxyz",ze="0123456789",He={DIGIT:ze,ALPHA:Fe,ALPHA_DIGIT:Fe+Fe.toUpperCase()+ze};const Ke=ge("AsyncFunction");var Ve={isArray:be,isArrayBuffer:we,isBuffer:function(t){return null!==t&&!ve(t)&&null!==t.constructor&&!ve(t.constructor)&&Me(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||Me(t.append)&&("formdata"===(e=me(t))||"object"===e&&Me(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&we(t.buffer),e},isString:_e,isNumber:Se,isBoolean:t=>!0===t||!1===t,isObject:Ee,isPlainObject:ke,isUndefined:ve,isDate:Ae,isFile:Oe,isBlob:Te,isRegExp:Ue,isFunction:Me,isStream:t=>Ee(t)&&Me(t.pipe),isURLSearchParams:Re,isTypedArray:Be,isFileList:Ie,forEach:Ce,merge:function t(){const{caseless:e}=Ne(this)&&this||{},r={},i=(i,n)=>{const o=e&&Pe(r,n)||n;ke(r[o])&&ke(i)?r[o]=t(r[o],i):ke(i)?r[o]=t({},i):be(i)?r[o]=i.slice():r[o]=i};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&Ce(arguments[t],i);return r},extend:(t,e,r,{allOwnKeys:i}={})=>(Ce(e,((e,i)=>{r&&Me(e)?t[i]=ce(e,r):t[i]=e}),{allOwnKeys:i}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,r,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject:(t,e,r,i)=>{let n,o,s;const a={};if(e=e||{},null==t)return e;do{for(n=Object.getOwnPropertyNames(t),o=n.length;o-- >0;)s=n[o],i&&!i(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==r&&pe(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:me,kindOfTest:ge,endsWith:(t,e,r)=>{t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;const i=t.indexOf(e,r);return-1!==i&&i===r},toArray:t=>{if(!t)return null;if(be(t))return t;let e=t.length;if(!Se(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=r.next())&&!i.done;){const r=i.value;e.call(t,r[0],r[1])}},matchAll:(t,e)=>{let r;const i=[];for(;null!==(r=t.exec(e));)i.push(r);return i},isHTMLForm:De,hasOwnProperty:je,hasOwnProp:je,reduceDescriptors:qe,freezeMethods:t=>{qe(t,((e,r)=>{if(Me(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const i=t[r];Me(i)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(t,e)=>{const r={},i=t=>{t.forEach((t=>{r[t]=!0}))};return be(t)?i(t):i(String(t).split(e)),r},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,r){return e.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(t,e)=>(t=+t,Number.isFinite(t)?t:e),findKey:Pe,global:xe,isContextDefined:Ne,ALPHABET:He,generateString:(t=16,e=He.ALPHA_DIGIT)=>{let r="";const{length:i}=e;for(;t--;)r+=e[Math.random()*i|0];return r},isSpecCompliantForm:function(t){return!!(t&&Me(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),r=(t,i)=>{if(Ee(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[i]=t;const n=be(t)?[]:{};return Ce(t,((t,e)=>{const o=r(t,i+1);!ve(o)&&(n[e]=o)})),e[i]=void 0,n}}return t};return r(t,0)},isAsyncFn:Ke,isThenable:t=>t&&(Ee(t)||Me(t))&&Me(t.then)&&Me(t.catch)},Ge=[],We=[],Ye="undefined"!=typeof Uint8Array?Uint8Array:Array,Ze=!1;function Xe(){Ze=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)Ge[e]=t[e],We[t.charCodeAt(e)]=e;We["-".charCodeAt(0)]=62,We["_".charCodeAt(0)]=63}function Qe(t,e,r){for(var i,n,o=[],s=e;s<r;s+=3)i=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(Ge[(n=i)>>18&63]+Ge[n>>12&63]+Ge[n>>6&63]+Ge[63&n]);return o.join("")}function Je(t){var e;Ze||Xe();for(var r=t.length,i=r%3,n="",o=[],s=16383,a=0,h=r-i;a<h;a+=s)o.push(Qe(t,a,a+s>h?h:a+s));return 1===i?(e=t[r-1],n+=Ge[e>>2],n+=Ge[e<<4&63],n+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],n+=Ge[e>>10],n+=Ge[e>>4&63],n+=Ge[e<<2&63],n+="="),o.push(n),o.join("")}function $e(t,e,r,i,n){var o,s,a=8*n-i-1,h=(1<<a)-1,u=h>>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-u;else{if(o===h)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=u}return(d?-1:1)*s*Math.pow(2,o-i)}function tr(t,e,r,i,n,o){var s,a,h,u=8*o-n-1,f=(1<<u)-1,l=f>>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*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+l>=1?c/h:c*Math.pow(2,1-l))*h>=2&&(s++,h/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*h-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<<n|a,u+=n;u>0;t[r+d]=255&s,d+=p,s/=256,u-=8);t[r+d-p]|=128*m}var er={}.toString,rr=Array.isArray||function(t){return"[object Array]"==er.call(t)};sr.TYPED_ARRAY_SUPPORT=void 0===le.TYPED_ARRAY_SUPPORT||le.TYPED_ARRAY_SUPPORT;var ir=nr();function nr(){return sr.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function or(t,e){if(nr()<e)throw new RangeError("Invalid typed array length");return sr.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=sr.prototype:(null===t&&(t=new sr(e)),t.length=e),t}function sr(t,e,r){if(!(sr.TYPED_ARRAY_SUPPORT||this instanceof sr))return new sr(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return ur(this,t)}return ar(this,t,e,r)}function ar(t,e,r,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,i){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,r):new Uint8Array(e,r,i);sr.TYPED_ARRAY_SUPPORT?(t=e).__proto__=sr.prototype:t=fr(t,e);return t}(t,e,r,i):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!sr.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|dr(e,r);t=or(t,i);var n=t.write(e,r);n!==i&&(t=t.slice(0,n));return t}(t,e,r):function(t,e){if(cr(e)){var r=0|lr(e.length);return 0===(t=or(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?or(t,0):fr(t,e);if("Buffer"===e.type&&rr(e.data))return fr(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function hr(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function ur(t,e){if(hr(e),t=or(t,e<0?0:0|lr(e)),!sr.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function fr(t,e){var r=e.length<0?0:0|lr(e.length);t=or(t,r);for(var i=0;i<r;i+=1)t[i]=255&e[i];return t}function lr(t){if(t>=nr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+nr().toString(16)+" bytes");return 0|t}function cr(t){return!(null==t||!t._isBuffer)}function dr(t,e){if(cr(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 qr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Fr(t).length;default:if(i)return qr(t).length;e=(""+e).toLowerCase(),i=!0}}function pr(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 Ir(this,e,r);case"utf8":case"utf-8":return kr(this,e,r);case"ascii":return Or(this,e,r);case"latin1":case"binary":return Tr(this,e,r);case"base64":return Er(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rr(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function mr(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function gr(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=sr.from(e,i)),cr(e))return 0===e.length?-1:yr(t,e,r,i,n);if("number"==typeof e)return e&=255,sr.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):yr(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function yr(t,e,r,i,n){var o,s=1,a=t.length,h=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,h/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){var f=-1;for(o=r;o<a;o++)if(u(t,o)===u(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===h)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+h>a&&(r=a-h),o=r;o>=0;o--){for(var l=!0,c=0;c<h;c++)if(u(t,o+c)!==u(e,c)){l=!1;break}if(l)return o}return-1}function br(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(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<i;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function vr(t,e,r,i){return zr(qr(e,t.length-r),t,r,i)}function wr(t,e,r,i){return zr(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,i)}function _r(t,e,r,i){return wr(t,e,r,i)}function Mr(t,e,r,i){return zr(Fr(e),t,r,i)}function Sr(t,e,r,i){return zr(function(t,e){for(var r,i,n,o=[],s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function Er(t,e,r){return 0===e&&r===t.length?Je(t):Je(t.slice(e,r))}function kr(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var o,s,a,h,u=t[n],f=null,l=u>239?4:u>223?3:u>191?2:1;if(n+l<=r)switch(l){case 1:u<128&&(f=u);break;case 2:128==(192&(o=t[n+1]))&&(h=(31&u)<<6|63&o)>127&&(f=h);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(h=(15&u)<<12|(63&o)<<6|63&s)>2047&&(h<55296||h>57343)&&(f=h);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(h=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&h<1114112&&(f=h)}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<=Ar)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=Ar));return r}(i)}sr.poolSize=8192,sr._augment=function(t){return t.__proto__=sr.prototype,t},sr.from=function(t,e,r){return ar(null,t,e,r)},sr.TYPED_ARRAY_SUPPORT&&(sr.prototype.__proto__=Uint8Array.prototype,sr.__proto__=Uint8Array),sr.alloc=function(t,e,r){return function(t,e,r,i){return hr(e),e<=0?or(t,e):void 0!==r?"string"==typeof i?or(t,e).fill(r,i):or(t,e).fill(r):or(t,e)}(null,t,e,r)},sr.allocUnsafe=function(t){return ur(null,t)},sr.allocUnsafeSlow=function(t){return ur(null,t)},sr.isBuffer=Hr,sr.compare=function(t,e){if(!cr(t)||!cr(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},sr.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},sr.concat=function(t,e){if(!rr(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return sr.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=sr.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var o=t[r];if(!cr(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length}return i},sr.byteLength=dr,sr.prototype._isBuffer=!0,sr.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)mr(this,e,e+1);return this},sr.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)mr(this,e,e+3),mr(this,e+1,e+2);return this},sr.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)mr(this,e,e+7),mr(this,e+1,e+6),mr(this,e+2,e+5),mr(this,e+3,e+4);return this},sr.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?kr(this,0,t):pr.apply(this,arguments)},sr.prototype.equals=function(t){if(!cr(t))throw new TypeError("Argument must be a Buffer");return this===t||0===sr.compare(this,t)},sr.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},sr.prototype.compare=function(t,e,r,i,n){if(!cr(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),u=t.slice(e,r),f=0;f<a;++f)if(h[f]!==u[f]){o=h[f],s=u[f];break}return o<s?-1:s<o?1:0},sr.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},sr.prototype.indexOf=function(t,e,r){return gr(this,t,e,r,!0)},sr.prototype.lastIndexOf=function(t,e,r){return gr(this,t,e,r,!1)},sr.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(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 br(this,t,e,r);case"utf8":case"utf-8":return vr(this,t,e,r);case"ascii":return wr(this,t,e,r);case"latin1":case"binary":return _r(this,t,e,r);case"base64":return Mr(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Sr(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},sr.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Ar=4096;function Or(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function Tr(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function Ir(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=e;o<r;++o)n+=Ur(t[o]);return n}function Rr(t,e,r){for(var i=t.slice(e,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function Cr(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function Pr(t,e,r,i,n,o){if(!cr(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function xr(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-r,2);n<o;++n)t[r+n]=(e&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function Nr(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-r,4);n<o;++n)t[r+n]=e>>>8*(i?n:3-n)&255}function Br(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 Lr(t,e,r,i,n){return n||Br(t,0,r,4),tr(t,e,r,i,23,4),r+4}function Dr(t,e,r,i,n){return n||Br(t,0,r,8),tr(t,e,r,i,52,8),r+8}sr.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),e<t&&(e=t),sr.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=sr.prototype;else{var n=e-t;r=new sr(n,void 0);for(var o=0;o<n;++o)r[o]=this[o+t]}return r},sr.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||Cr(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i},sr.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||Cr(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},sr.prototype.readUInt8=function(t,e){return e||Cr(t,1,this.length),this[t]},sr.prototype.readUInt16LE=function(t,e){return e||Cr(t,2,this.length),this[t]|this[t+1]<<8},sr.prototype.readUInt16BE=function(t,e){return e||Cr(t,2,this.length),this[t]<<8|this[t+1]},sr.prototype.readUInt32LE=function(t,e){return e||Cr(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},sr.prototype.readUInt32BE=function(t,e){return e||Cr(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},sr.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||Cr(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},sr.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||Cr(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},sr.prototype.readInt8=function(t,e){return e||Cr(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},sr.prototype.readInt16LE=function(t,e){e||Cr(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},sr.prototype.readInt16BE=function(t,e){e||Cr(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},sr.prototype.readInt32LE=function(t,e){return e||Cr(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},sr.prototype.readInt32BE=function(t,e){return e||Cr(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},sr.prototype.readFloatLE=function(t,e){return e||Cr(t,4,this.length),$e(this,t,!0,23,4)},sr.prototype.readFloatBE=function(t,e){return e||Cr(t,4,this.length),$e(this,t,!1,23,4)},sr.prototype.readDoubleLE=function(t,e){return e||Cr(t,8,this.length),$e(this,t,!0,52,8)},sr.prototype.readDoubleBE=function(t,e){return e||Cr(t,8,this.length),$e(this,t,!1,52,8)},sr.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||Pr(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o<r&&(n*=256);)this[e+o]=t/n&255;return e+r},sr.prototype.writeUIntBE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||Pr(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},sr.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,1,255,0),sr.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},sr.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,2,65535,0),sr.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):xr(this,t,e,!0),e+2},sr.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,2,65535,0),sr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):xr(this,t,e,!1),e+2},sr.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,4,4294967295,0),sr.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):Nr(this,t,e,!0),e+4},sr.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,4,4294967295,0),sr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Nr(this,t,e,!1),e+4},sr.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);Pr(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},sr.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);Pr(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},sr.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,1,127,-128),sr.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},sr.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,2,32767,-32768),sr.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):xr(this,t,e,!0),e+2},sr.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,2,32767,-32768),sr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):xr(this,t,e,!1),e+2},sr.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,4,2147483647,-2147483648),sr.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Nr(this,t,e,!0),e+4},sr.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||Pr(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),sr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Nr(this,t,e,!1),e+4},sr.prototype.writeFloatLE=function(t,e,r){return Lr(this,t,e,!0,r)},sr.prototype.writeFloatBE=function(t,e,r){return Lr(this,t,e,!1,r)},sr.prototype.writeDoubleLE=function(t,e,r){return Dr(this,t,e,!0,r)},sr.prototype.writeDoubleBE=function(t,e,r){return Dr(this,t,e,!1,r)},sr.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<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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<i-r&&(i=t.length-e+r);var n,o=i-r;if(this===t&&r<e&&e<i)for(n=o-1;n>=0;--n)t[n+e]=this[n+r];else if(o<1e3||!sr.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)t[n+e]=this[n+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},sr.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===t.length){var n=t.charCodeAt(0);n<256&&(t=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!sr.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=cr(t)?t:qr(new sr(t,i).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var jr=/[^+\/0-9A-Za-z-_]/g;function Ur(t){return t<16?"0"+t.toString(16):t.toString(16)}function qr(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],s=0;s<i;++s){if((r=t.charCodeAt(s))>55295&&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 Fr(t){return function(t){var e,r,i,n,o,s;Ze||Xe();var a=t.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,s=new Ye(3*a/4-o),i=o>0?a-4:a;var h=0;for(e=0,r=0;e<i;e+=4,r+=3)n=We[t.charCodeAt(e)]<<18|We[t.charCodeAt(e+1)]<<12|We[t.charCodeAt(e+2)]<<6|We[t.charCodeAt(e+3)],s[h++]=n>>16&255,s[h++]=n>>8&255,s[h++]=255&n;return 2===o?(n=We[t.charCodeAt(e)]<<2|We[t.charCodeAt(e+1)]>>4,s[h++]=255&n):1===o&&(n=We[t.charCodeAt(e)]<<10|We[t.charCodeAt(e+1)]<<4|We[t.charCodeAt(e+2)]>>2,s[h++]=n>>8&255,s[h++]=255&n),s}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(jr,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function zr(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Hr(t){return null!=t&&(!!t._isBuffer||Kr(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Kr(t.slice(0,0))}(t))}function Kr(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Vr=Object.freeze({__proto__:null,Buffer:sr,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),sr.alloc(+t)},isBuffer:Hr,kMaxLength:ir});function Gr(t,e,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n)}Ve.inherits(Gr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ve.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Wr=Gr.prototype,Yr={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{Yr[t]={value:t}})),Object.defineProperties(Gr,Yr),Object.defineProperty(Wr,"isAxiosError",{value:!0}),Gr.from=(t,e,r,i,n,o)=>{const s=Object.create(Wr);return Ve.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),Gr.call(s,t.message,e,r,i,n),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};function Zr(t){return Ve.isPlainObject(t)||Ve.isArray(t)}function Xr(t){return Ve.endsWith(t,"[]")?t.slice(0,-2):t}function Qr(t,e,r){return t?t.concat(e).map((function(t,e){return t=Xr(t),!r&&e?"["+t+"]":t})).join(r?".":""):e}const Jr=Ve.toFlatObject(Ve,{},null,(function(t){return/^is[A-Z]/.test(t)}));function $r(t,e,r){if(!Ve.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const i=(r=Ve.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!Ve.isUndefined(e[t])}))).metaTokens,n=r.visitor||u,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Ve.isSpecCompliantForm(e);if(!Ve.isFunction(n))throw new TypeError("visitor must be a function");function h(t){if(null===t)return"";if(Ve.isDate(t))return t.toISOString();if(!a&&Ve.isBlob(t))throw new Gr("Blob is not supported. Use a Buffer instead.");return Ve.isArrayBuffer(t)||Ve.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):sr.from(t):t}function u(t,r,n){let a=t;if(t&&!n&&"object"==typeof t)if(Ve.endsWith(r,"{}"))r=i?r:r.slice(0,-2),t=JSON.stringify(t);else if(Ve.isArray(t)&&function(t){return Ve.isArray(t)&&!t.some(Zr)}(t)||(Ve.isFileList(t)||Ve.endsWith(r,"[]"))&&(a=Ve.toArray(t)))return r=Xr(r),a.forEach((function(t,i){!Ve.isUndefined(t)&&null!==t&&e.append(!0===s?Qr([r],i,o):null===s?r:r+"[]",h(t))})),!1;return!!Zr(t)||(e.append(Qr(n,r,o),h(t)),!1)}const f=[],l=Object.assign(Jr,{defaultVisitor:u,convertValue:h,isVisitable:Zr});if(!Ve.isObject(t))throw new TypeError("data must be an object");return function t(r,i){if(!Ve.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+i.join("."));f.push(r),Ve.forEach(r,(function(r,o){!0===(!(Ve.isUndefined(r)||null===r)&&n.call(e,r,Ve.isString(o)?o.trim():o,i,l))&&t(r,i?i.concat(o):[o])})),f.pop()}}(t),e}function ti(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function ei(t,e){this._pairs=[],t&&$r(t,this,e)}const ri=ei.prototype;function ii(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ni(t,e,r){if(!e)return t;const i=r&&r.encode||ii,n=r&&r.serialize;let o;if(o=n?n(e,r):Ve.isURLSearchParams(e)?e.toString():new ei(e,r).toString(i),o){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}ri.append=function(t,e){this._pairs.push([t,e])},ri.toString=function(t){const e=t?function(e){return t.call(this,e,ti)}:ti;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};var oi=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Ve.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},si={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var ai={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ei,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let t;return("undefined"==typeof navigator||"ReactNative"!==(t=navigator.product)&&"NativeScript"!==t&&"NS"!==t)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function hi(t){function e(t,r,i,n){let o=t[n++];const s=Number.isFinite(+o),a=n>=t.length;if(o=!o&&Ve.isArray(i)?i.length:o,a)return Ve.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!s;i[o]&&Ve.isObject(i[o])||(i[o]=[]);return e(t,r,i[o],n)&&Ve.isArray(i[o])&&(i[o]=function(t){const e={},r=Object.keys(t);let i;const n=r.length;let o;for(i=0;i<n;i++)o=r[i],e[o]=t[o];return e}(i[o])),!s}if(Ve.isFormData(t)&&Ve.isFunction(t.entries)){const r={};return Ve.forEachEntry(t,((t,i)=>{e(function(t){return Ve.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),i,r,0)})),r}return null}const ui={"Content-Type":void 0};const fi={transitional:si,adapter:["xhr","http"],transformRequest:[function(t,e){const r=e.getContentType()||"",i=r.indexOf("application/json")>-1,n=Ve.isObject(t);n&&Ve.isHTMLForm(t)&&(t=new FormData(t));if(Ve.isFormData(t))return i&&i?JSON.stringify(hi(t)):t;if(Ve.isArrayBuffer(t)||Ve.isBuffer(t)||Ve.isStream(t)||Ve.isFile(t)||Ve.isBlob(t))return t;if(Ve.isArrayBufferView(t))return t.buffer;if(Ve.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(n){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return $r(t,new ai.classes.URLSearchParams,Object.assign({visitor:function(t,e,r,i){return ai.isNode&&Ve.isBuffer(t)?(this.append(e,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((o=Ve.isFileList(t))||r.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return $r(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return n||i?(e.setContentType("application/json",!1),function(t,e,r){if(Ve.isString(t))try{return(e||JSON.parse)(t),Ve.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||fi.transitional,r=e&&e.forcedJSONParsing,i="json"===this.responseType;if(t&&Ve.isString(t)&&(r&&!this.responseType||i)){const r=!(e&&e.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(t){if(r){if("SyntaxError"===t.name)throw Gr.from(t,Gr.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ai.classes.FormData,Blob:ai.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Ve.forEach(["delete","get","head"],(function(t){fi.headers[t]={}})),Ve.forEach(["post","put","patch"],(function(t){fi.headers[t]=Ve.merge(ui)}));var li=fi;const ci=Ve.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const di=Symbol("internals");function pi(t){return t&&String(t).trim().toLowerCase()}function mi(t){return!1===t||null==t?t:Ve.isArray(t)?t.map(mi):String(t)}function gi(t,e,r,i,n){return Ve.isFunction(i)?i.call(this,e,r):(n&&(e=r),Ve.isString(e)?Ve.isString(i)?-1!==e.indexOf(i):Ve.isRegExp(i)?i.test(e):void 0:void 0)}class yi{constructor(t){t&&this.set(t)}set(t,e,r){const i=this;function n(t,e,r){const n=pi(e);if(!n)throw new Error("header name must be a non-empty string");const o=Ve.findKey(i,n);(!o||void 0===i[o]||!0===r||void 0===r&&!1!==i[o])&&(i[o||e]=mi(t))}const o=(t,e)=>Ve.forEach(t,((t,r)=>n(t,r,e)));return Ve.isPlainObject(t)||t instanceof this.constructor?o(t,e):Ve.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim())?o((t=>{const e={};let r,i,n;return t&&t.split("\n").forEach((function(t){n=t.indexOf(":"),r=t.substring(0,n).trim().toLowerCase(),i=t.substring(n+1).trim(),!r||e[r]&&ci[r]||("set-cookie"===r?e[r]?e[r].push(i):e[r]=[i]:e[r]=e[r]?e[r]+", "+i:i)})),e})(t),e):null!=t&&n(e,t,r),this}get(t,e){if(t=pi(t)){const r=Ve.findKey(this,t);if(r){const t=this[r];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=r.exec(t);)e[i[1]]=i[2];return e}(t);if(Ve.isFunction(e))return e.call(this,t,r);if(Ve.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=pi(t)){const r=Ve.findKey(this,t);return!(!r||void 0===this[r]||e&&!gi(0,this[r],r,e))}return!1}delete(t,e){const r=this;let i=!1;function n(t){if(t=pi(t)){const n=Ve.findKey(r,t);!n||e&&!gi(0,r[n],n,e)||(delete r[n],i=!0)}}return Ve.isArray(t)?t.forEach(n):n(t),i}clear(t){const e=Object.keys(this);let r=e.length,i=!1;for(;r--;){const n=e[r];t&&!gi(0,this[n],n,t,!0)||(delete this[n],i=!0)}return i}normalize(t){const e=this,r={};return Ve.forEach(this,((i,n)=>{const o=Ve.findKey(r,n);if(o)return e[o]=mi(i),void delete e[n];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,r)=>e.toUpperCase()+r))}(n):String(n).trim();s!==n&&delete e[n],e[s]=mi(i),r[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Ve.forEach(this,((r,i)=>{null!=r&&!1!==r&&(e[i]=t&&Ve.isArray(r)?r.join(", "):r)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const r=new this(t);return e.forEach((t=>r.set(t))),r}static accessor(t){const e=(this[di]=this[di]={accessors:{}}).accessors,r=this.prototype;function i(t){const i=pi(t);e[i]||(!function(t,e){const r=Ve.toCamelCase(" "+e);["get","set","has"].forEach((i=>{Object.defineProperty(t,i+r,{value:function(t,r,n){return this[i].call(this,e,t,r,n)},configurable:!0})}))}(r,t),e[i]=!0)}return Ve.isArray(t)?t.forEach(i):i(t),this}}yi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ve.freezeMethods(yi.prototype),Ve.freezeMethods(yi);var bi=yi;function vi(t,e){const r=this||li,i=e||r,n=bi.from(i.headers);let o=i.data;return Ve.forEach(t,(function(t){o=t.call(r,o,n.normalize(),e?e.status:void 0)})),n.normalize(),o}function wi(t){return!(!t||!t.__CANCEL__)}function _i(t,e,r){Gr.call(this,null==t?"canceled":t,Gr.ERR_CANCELED,e,r),this.name="CanceledError"}Ve.inherits(_i,Gr,{__CANCEL__:!0});var Mi=ai.isStandardBrowserEnv?{write:function(t,e,r,i,n,o){const s=[];s.push(t+"="+encodeURIComponent(e)),Ve.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),Ve.isString(i)&&s.push("path="+i),Ve.isString(n)&&s.push("domain="+n),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read:function(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Si(t,e){return t&&!function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}(e)?function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}var Ei=ai.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let r;function i(r){let i=r;return t&&(e.setAttribute("href",i),i=e.href),e.setAttribute("href",i),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return r=i(window.location.href),function(t){const e=Ve.isString(t)?i(t):t;return e.protocol===r.protocol&&e.host===r.host}}():function(){return!0};function ki(t,e){let r=0;const i=function(t,e){t=t||10;const r=new Array(t),i=new Array(t);let n,o=0,s=0;return e=void 0!==e?e:1e3,function(a){const h=Date.now(),u=i[s];n||(n=h),r[o]=a,i[o]=h;let f=s,l=0;for(;f!==o;)l+=r[f++],f%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),h-n<e)return;const c=u&&h-u;return c?Math.round(1e3*l/c):void 0}}(50,250);return n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-r,h=i(a);r=o;const u={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:h||void 0,estimated:h&&s&&o<=s?(s-o)/h:void 0,event:n};u[e?"download":"upload"]=!0,t(u)}}var Ai="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,r){let i=t.data;const n=bi.from(t.headers).normalize(),o=t.responseType;let s;function a(){t.cancelToken&&t.cancelToken.unsubscribe(s),t.signal&&t.signal.removeEventListener("abort",s)}Ve.isFormData(i)&&(ai.isStandardBrowserEnv||ai.isStandardBrowserWebWorkerEnv?n.setContentType(!1):n.setContentType("multipart/form-data;",!1));let h=new XMLHttpRequest;if(t.auth){const e=t.auth.username||"",r=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";n.set("Authorization","Basic "+btoa(e+":"+r))}const u=Si(t.baseURL,t.url);function f(){if(!h)return;const i=bi.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());!function(t,e,r){const i=r.config.validateStatus;r.status&&i&&!i(r.status)?e(new Gr("Request failed with status code "+r.status,[Gr.ERR_BAD_REQUEST,Gr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):t(r)}((function(t){e(t),a()}),(function(t){r(t),a()}),{data:o&&"text"!==o&&"json"!==o?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:i,config:t,request:h}),h=null}if(h.open(t.method.toUpperCase(),ni(u,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,"onloadend"in h?h.onloadend=f:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(f)},h.onabort=function(){h&&(r(new Gr("Request aborted",Gr.ECONNABORTED,t,h)),h=null)},h.onerror=function(){r(new Gr("Network Error",Gr.ERR_NETWORK,t,h)),h=null},h.ontimeout=function(){let e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const i=t.transitional||si;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(new Gr(e,i.clarifyTimeoutError?Gr.ETIMEDOUT:Gr.ECONNABORTED,t,h)),h=null},ai.isStandardBrowserEnv){const e=(t.withCredentials||Ei(u))&&t.xsrfCookieName&&Mi.read(t.xsrfCookieName);e&&n.set(t.xsrfHeaderName,e)}void 0===i&&n.setContentType(null),"setRequestHeader"in h&&Ve.forEach(n.toJSON(),(function(t,e){h.setRequestHeader(e,t)})),Ve.isUndefined(t.withCredentials)||(h.withCredentials=!!t.withCredentials),o&&"json"!==o&&(h.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",ki(t.onDownloadProgress,!0)),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",ki(t.onUploadProgress)),(t.cancelToken||t.signal)&&(s=e=>{h&&(r(!e||e.type?new _i(null,t,h):e),h.abort(),h=null)},t.cancelToken&&t.cancelToken.subscribe(s),t.signal&&(t.signal.aborted?s():t.signal.addEventListener("abort",s)));const l=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(u);l&&-1===ai.protocols.indexOf(l)?r(new Gr("Unsupported protocol "+l+":",Gr.ERR_BAD_REQUEST,t)):h.send(i||null)}))};const Oi={http:null,xhr:Ai};Ve.forEach(Oi,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));var Ti=t=>{t=Ve.isArray(t)?t:[t];const{length:e}=t;let r,i;for(let n=0;n<e&&(r=t[n],!(i=Ve.isString(r)?Oi[r.toLowerCase()]:r));n++);if(!i){if(!1===i)throw new Gr(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Ve.hasOwnProp(Oi,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!Ve.isFunction(i))throw new TypeError("adapter is not a function");return i};function Ii(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _i(null,t)}function Ri(t){Ii(t),t.headers=bi.from(t.headers),t.data=vi.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Ti(t.adapter||li.adapter)(t).then((function(e){return Ii(t),e.data=vi.call(t,t.transformResponse,e),e.headers=bi.from(e.headers),e}),(function(e){return wi(e)||(Ii(t),e&&e.response&&(e.response.data=vi.call(t,t.transformResponse,e.response),e.response.headers=bi.from(e.response.headers))),Promise.reject(e)}))}const Ci=t=>t instanceof bi?t.toJSON():t;function Pi(t,e){e=e||{};const r={};function i(t,e,r){return Ve.isPlainObject(t)&&Ve.isPlainObject(e)?Ve.merge.call({caseless:r},t,e):Ve.isPlainObject(e)?Ve.merge({},e):Ve.isArray(e)?e.slice():e}function n(t,e,r){return Ve.isUndefined(e)?Ve.isUndefined(t)?void 0:i(void 0,t,r):i(t,e,r)}function o(t,e){if(!Ve.isUndefined(e))return i(void 0,e)}function s(t,e){return Ve.isUndefined(e)?Ve.isUndefined(t)?void 0:i(void 0,t):i(void 0,e)}function a(r,n,o){return o in e?i(r,n):o in t?i(void 0,r):void 0}const h={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(t,e)=>n(Ci(t),Ci(e),!0)};return Ve.forEach(Object.keys(Object.assign({},t,e)),(function(i){const o=h[i]||n,s=o(t[i],e[i],i);Ve.isUndefined(s)&&o!==a||(r[i]=s)})),r}const xi="1.4.0",Ni={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Ni[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));const Bi={};Ni.transitional=function(t,e,r){function i(t,e){return"[Axios v1.4.0] Transitional option '"+t+"'"+e+(r?". "+r:"")}return(r,n,o)=>{if(!1===t)throw new Gr(i(n," has been removed"+(e?" in "+e:"")),Gr.ERR_DEPRECATED);return e&&!Bi[n]&&(Bi[n]=!0,console.warn(i(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,n,o)}};var Li={assertOptions:function(t,e,r){if("object"!=typeof t)throw new Gr("options must be an object",Gr.ERR_BAD_OPTION_VALUE);const i=Object.keys(t);let n=i.length;for(;n-- >0;){const o=i[n],s=e[o];if(s){const e=t[o],r=void 0===e||s(e,o,t);if(!0!==r)throw new Gr("option "+o+" must be "+r,Gr.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new Gr("Unknown option "+o,Gr.ERR_BAD_OPTION)}},validators:Ni};const Di=Li.validators;class ji{constructor(t){this.defaults=t,this.interceptors={request:new oi,response:new oi}}request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Pi(this.defaults,e);const{transitional:r,paramsSerializer:i,headers:n}=e;let o;void 0!==r&&Li.assertOptions(r,{silentJSONParsing:Di.transitional(Di.boolean),forcedJSONParsing:Di.transitional(Di.boolean),clarifyTimeoutError:Di.transitional(Di.boolean)},!1),null!=i&&(Ve.isFunction(i)?e.paramsSerializer={serialize:i}:Li.assertOptions(i,{encode:Di.function,serialize:Di.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase(),o=n&&Ve.merge(n.common,n[e.method]),o&&Ve.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete n[t]})),e.headers=bi.concat(o,n);const s=[];let a=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));const h=[];let u;this.interceptors.response.forEach((function(t){h.push(t.fulfilled,t.rejected)}));let f,l=0;if(!a){const t=[Ri.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,h),f=t.length,u=Promise.resolve(e);l<f;)u=u.then(t[l++],t[l++]);return u}f=s.length;let c=e;for(l=0;l<f;){const t=s[l++],e=s[l++];try{c=t(c)}catch(t){e.call(this,t);break}}try{u=Ri.call(this,c)}catch(t){return Promise.reject(t)}for(l=0,f=h.length;l<f;)u=u.then(h[l++],h[l++]);return u}getUri(t){return ni(Si((t=Pi(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}Ve.forEach(["delete","get","head","options"],(function(t){ji.prototype[t]=function(e,r){return this.request(Pi(r||{},{method:t,url:e,data:(r||{}).data}))}})),Ve.forEach(["post","put","patch"],(function(t){function e(e){return function(r,i,n){return this.request(Pi(n||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}ji.prototype[t]=e(),ji.prototype[t+"Form"]=e(!0)}));var Ui=ji;class qi{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const r=this;this.promise.then((t=>{if(!r._listeners)return;let e=r._listeners.length;for(;e-- >0;)r._listeners[e](t);r._listeners=null})),this.promise.then=t=>{let e;const i=new Promise((t=>{r.subscribe(t),e=t})).then(t);return i.cancel=function(){r.unsubscribe(e)},i},t((function(t,i,n){r.reason||(r.reason=new _i(t,i,n),e(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}static source(){let t;const e=new qi((function(e){t=e}));return{token:e,cancel:t}}}var Fi=qi;const zi={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(zi).forEach((([t,e])=>{zi[e]=t}));var Hi=zi;const Ki=function t(e){const r=new Ui(e),i=ce(Ui.prototype.request,r);return Ve.extend(i,Ui.prototype,r,{allOwnKeys:!0}),Ve.extend(i,r,null,{allOwnKeys:!0}),i.create=function(r){return t(Pi(e,r))},i}(li);Ki.Axios=Ui,Ki.CanceledError=_i,Ki.CancelToken=Fi,Ki.isCancel=wi,Ki.VERSION=xi,Ki.toFormData=$r,Ki.AxiosError=Gr,Ki.Cancel=Ki.CanceledError,Ki.all=function(t){return Promise.all(t)},Ki.spread=function(t){return function(e){return t.apply(null,e)}},Ki.isAxiosError=function(t){return Ve.isObject(t)&&!0===t.isAxiosError},Ki.mergeConfig=Pi,Ki.AxiosHeaders=bi,Ki.formToJSON=t=>hi(Ve.isHTMLForm(t)?new FormData(t):t),Ki.HttpStatusCode=Hi,Ki.default=Ki;var Vi=Ki;const Gi={async parse({node:t}){const{refId:e}=t;for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:{type:"model",refId:e}})}},Wi={async parse({node:t}){const{refId:e}=t;for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:{type:"material",refId:e}})}},Yi={async parse({node:t}){t.outputs.forEach((e=>{this.parseFlowNode(t,e)}))}},Zi={async parse({node:t}){const e=this.getOutInstance("ssp"),r=this.getOutInstance("cpsManager");if(!e||!r)return Promise.reject("In SoonFlow: path-element-node not have ssp!");const{config:i}=t,{pathData:n}=JSON.parse(i);e.createTopology({type:"network",...n,imgUrl:n.imgUri?`${r.path}/icons/${n.imgUri.fileId}/${n.imgUri.location}`:void 0,animation:{duration:n.animation?.duration??0}});for(let e=0;e<t.outputs.length;e++)await this.parseFlowNode(t,{...t.outputs[e],data:{}})}};var Xi,Qi;!function(t){t.CLIP="cilp",t.INNER="inner"}(Xi||(Xi={})),function(t){t.PLAY="play",t.STOP="stop"}(Qi||(Qi={}));const Ji=new Map,$i={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: object-animation-node not have ssp!");const i=JSON.parse(t.config),{refId:n}=e;if(!n)return Promise.reject("In SoonFlow: object-animation-node 未绑定模型数据!");const{animationType:o,innerAnimationIndex:s,animationPlayState:a,delay:h,duration:u}=i;await r.utils.sleep(h);switch(o){case Xi.INNER:await(async()=>{const t=r.getObjectById(n);if(!t)return Promise.reject(`In SoonFlow: object-animation-node 场景中未找到 modelId 为 "${n}" 的模型对象`);switch(a){case Qi.PLAY:r.playModelAnimation(t,s);break;case Qi.STOP:r.stopModelAnimation(t,s)}await r.utils.sleep(u)})();break;case Xi.CLIP:await(async()=>{switch(a){case Qi.PLAY:(async(t,e,r)=>{const{cilpAnimationKeyframes:i}=r,n=Ji.get(e),o=t.getObjectById(e);if(!o)return fe(`播放模型动画 -> 方法 playCilpAnimation 执行时 modelId 为 ${e} 场景对象未找到`);if(n){n.tween.stop();const{positionX:r,positionY:i,positionZ:s,rotationX:a,rotationY:h,rotationZ:u,scaleX:f,scaleY:l,scaleZ:c}=n.source;o.position.set(r,i,s),o.rotation.set(a,h,u),o.scale.set(f,l,c),t.render(),Ji.delete(e)}for(let r=0;r<i.length;r++){const n={positionX:o.position.x,positionY:o.position.y,positionZ:o.position.z,rotationX:o.rotation.x,rotationY:o.rotation.y,rotationZ:o.rotation.z,scaleX:o.scale.x,scaleY:o.scale.y,scaleZ:o.scale.z},s=i[r],{delay:a,duration:h,easing:u,repeat:f,yoyo:l}=s,c={positionX:s.position.x||0,positionY:s.position.y||0,positionZ:s.position.z||0,rotationX:s.rotation.x||0,rotationY:s.rotation.y||0,rotationZ:s.rotation.z||0,scaleX:s.scale.x||1,scaleY:s.scale.y||1,scaleZ:s.scale.z||1};await t.animation(n,c,{delay:a,duration:h,mode:u,repeat:-1===f?1/0:f,yoyo:l},(({positionX:t,positionY:e,positionZ:r,rotationX:i,rotationY:n,rotationZ:s,scaleX:a,scaleY:h,scaleZ:u})=>{o.position.set(t,e,r),o.rotation.set(i,n,s),o.scale.set(a,h,u)}),(t=>{Ji.set(e,{source:JSON.parse(JSON.stringify(n)),tween:t})})),Ji.delete(e)}})(r,n,i);break;case Qi.STOP:(async t=>{Ji.get(t)?.tween.stop(),Ji.delete(t)})(n)}await r.utils.sleep(u)})()}for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:e})}},tn={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: object-poi-node not have ssp!");const i=JSON.parse(t.config),{delay:n,duration:o,poiId:s,poiShow:a}=i;if(await r.utils.sleep(n),s){const t=r.getObjectById(s);if(!t)return Promise.reject(`In SoonFlow: object-animation-node 场景中未找到 Poi 为 "${s}" 的模型对象`);a?t.show():t.hide()}await r.utils.sleep(o);for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:e})}};var en;!function(t){t.CUSTOM="custom",t.FIXED="fixed"}(en||(en={}));const rn={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: object-viewpoint-node not have ssp!");const i=JSON.parse(t.config),{refId:n}=e;if(!n)return Promise.reject("In SoonFlow: object-viewpoint-node 未绑定模型数据!");const{viewpointType:o,customViewpointData:s,fixedViewpointValue:a,delay:h,duration:u}=i;switch(await r.utils.sleep(h),o){case en.CUSTOM:await(async()=>{if(!s)return Promise.reject("In SoonFlow: object-viewpoint-node 解析时缺少视角数据!");await r.flyTo(s.position,s.rotation,{duration:u})})();break;case en.FIXED:await(async()=>{const t=r.getObjectById(n);if(!t)return Promise.reject(`In SoonFlow: object-viewpoint-node 场景中未找到 modelId 为 "${n}" 的模型对象!`);await r.flyToObj(t,a,{duration:u})})()}for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:e})}},nn={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: object-animation-node not have ssp!");const{viewpointData:i}=JSON.parse(t.config),n=JSON.parse(i);await r.flyTo(n.position,n.rotation);for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:e})}};function on(t){const e={};return t.forEach((t=>{let r=t.defaultValue;switch(t.varType){case"boolean":r="boolean"==typeof t.defaultValue?t.defaultValue:"true"===t.defaultValue;break;case"number":r=Number(t.defaultValue)}e[t.parameterName]=r})),e}const sn={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: action-node not have ssp!");const{type:i,refId:n,fromInteraction:o,eventKey:s,nodeId:a}=e,{behaviorType:h,actionCode:u,customCode:f,behaviorVars:l,delay:c,duration:d}=JSON.parse(t.config);await r.utils.sleep(c);const p=[];switch(i){case"model":case"path":{const t=r.getObjectById(n);t&&p.push(t)}break;case"material":p.push(...r.getObjectByUserDataProperty("familyId",n))}if(o)if("SYS"===h||"CUS"===h){const t=on(l);p.forEach((e=>{this.addSignal(`${a}_${e.sid}_${s}`,(async()=>{const i=new Function("{ssp, vars, _this}",`(async () => { ${u} })()`);await i({ssp:r,vars:t,_this:e})}))}))}else"CUSTOM"===h&&p.forEach((t=>{this.addSignal(`${a}_${t.sid}_${s}`,(async()=>{const i=new Function("{ ssp, object, inputData }",`(async () => { ${f} })()`);await i({ssp:r,object:t,inputData:e})}))}));else if("SYS"===h||"CUS"===h){const t=on(l);for(let e=0;e<p.length;e++){const i=p[e],n=new Function("{ssp, vars, _this}",`(async () => { ${u} })()`);await n({ssp:r,vars:t,_this:i})}}else if("CUSTOM"===h)for(let t=0;t<p.length;t++){const i=p[t],n=new Function("{ ssp, object, inputData }",`(async () => { ${f} })()`);await n({ssp:r,object:i,inputData:e})}await r.utils.sleep(d);for(let e=0;e<t.outputs.length;e++)await this.parseFlowNode(t,t.outputs[e])}},an={async parse({node:t,inputData:e}){const r=this.getOutInstance("ssp");if(!r)return Promise.reject("In SoonFlow: interaction-node not have ssp!");const{type:i,refId:n}=e,{eventKey:o}=JSON.parse(t.config),s=(e,r)=>{if(!e)return;let i=null;switch(r){case"click":i=e.onClick,e.onClick=()=>{i?.(),this.dispatchSignal(`${t.id}_${e.sid}_${r}`)};break;case"dblClick":i=e.onDblClick,e.onDblClick=()=>{i?.(),this.dispatchSignal(`${t.id}_${e.sid}_${r}`)};break;case"rightClick":i=e.onRightClick,e.onRightClick=()=>{i?.(),this.dispatchSignal(`${t.id}_${e.sid}_${r}`)}}},a=[];switch(i){case"model":{const t=r.getObjectById(n);t&&a.push(t)}break;case"material":a.push(...r.getObjectByUserDataProperty("familyId",n))}a.forEach((t=>s(t,o)));for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:{...e,fromInteraction:!0,eventKey:o,nodeId:t.id}})}},hn={async parse({node:t}){const e=JSON.parse(t.config),r=JSON.parse(e.codeString);for(let e=0;e<t.outputs.length;e++)await this.parseFlowNode(t,{...t.outputs[e],data:r})}},un=t=>t.reduce(((t,e)=>(e.key&&(t[e.key]=e.value),t)),{}),fn={async parse({node:t}){const e=JSON.parse(t.config),{address:r,bodies:i,bodyType:n,headers:o,params:s,type:a}=e.requestInfo;let h,u,f;if(s.length>0&&(h=un(s)),i.length>0)if("multipart/form-data"===n){const t=new FormData;i.map((e=>{t.set(e.key,e.value)})),u=t}else u="application/x-www-form-urlencoded"===n?new URLSearchParams(i.map((t=>[t.key,t.value]))):un(i);o.length>0&&(f=un(o));try{const e=await Vi({method:a,url:r,params:h,data:u,headers:f});for(let r=0;r<t.outputs.length;r++)await this.parseFlowNode(t,{...t.outputs[r],data:e})}catch(e){return fe(`flow node "${t.name}" parse error`,e),Promise.reject(e)}}},ln={async parse({node:t,inputData:e}){if(!e)return Promise.reject("In SoonFlow: condition-node not have inputData!");for(let r=0;r<t.outputs.length;r++){const{config:i}=t.outputs[r],{codeString:n}=JSON.parse(i),o=new Function("sourceData",n)(e);o&&await this.parseFlowNode(t,{...t.outputs[r],data:o})}}},cn={async parse({node:t,inputData:e}){if(!e)return Promise.reject("In SoonFlow: condition-node not have inputData!");const{filterCode:r}=JSON.parse(t.config),i=new Function("sourceData",r)(e);for(let e=0;e<t.outputs.length;e++)await this.parseFlowNode(t,{...t.outputs[e],data:i})}};var dn;!function(t){t.START="start",t.MODEL="model",t.MATERIAL="material",t.PATH="path",t.FLOW="flow",t.OBJECT_ANIMATION="objectAnimation",t.OBJECT_POI="objectPoi",t.OBJECT_VIEWPOINT="objectViewpoint",t.SCENE_VIEWPOINT="sceneViewpoint",t.ACTION="action",t.INTERACTION="interaction",t.STATIC_DATA="staticData",t.INTERFACE_DATA="interfaceData",t.CONDITION="condition",t.FILTER="filter",t.VIEWPOINT="viewpoint"}(dn||(dn={}));const pn={model:Gi,material:Wi,path:Zi,flow:Yi,objectAnimation:$i,objectPoi:tn,objectViewpoint:rn,sceneViewpoint:nn,action:sn,interaction:an,staticData:hn,interfaceData:fn,condition:ln,filter:cn,viewpoint:nn};var mn=131072,gn=1048576,yn=4194304,bn=2097152,vn=269488175,wn=2147485780,_n=262144,Mn=4194304,Sn=2147483648,En=131072,kn=33554432,An=67108864,On=268435456,Tn=134217728,In=8388608,Rn="TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA",Cn="TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA",Pn={RTLD_LAZY:1,RTLD_NOW:2,RTLD_GLOBAL:8,RTLD_LOCAL:4,E2BIG:7,EACCES:13,EADDRINUSE:48,EADDRNOTAVAIL:49,EAFNOSUPPORT:47,EAGAIN:35,EALREADY:37,EBADF:9,EBADMSG:94,EBUSY:16,ECANCELED:89,ECHILD:10,ECONNABORTED:53,ECONNREFUSED:61,ECONNRESET:54,EDEADLK:11,EDESTADDRREQ:39,EDOM:33,EDQUOT:69,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:65,EIDRM:90,EILSEQ:92,EINPROGRESS:36,EINTR:4,EINVAL:22,EIO:5,EISCONN:56,EISDIR:21,ELOOP:62,EMFILE:24,EMLINK:31,EMSGSIZE:40,EMULTIHOP:95,ENAMETOOLONG:63,ENETDOWN:50,ENETRESET:52,ENETUNREACH:51,ENFILE:23,ENOBUFS:55,ENODATA:96,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:77,ENOLINK:97,ENOMEM:12,ENOMSG:91,ENOPROTOOPT:42,ENOSPC:28,ENOSR:98,ENOSTR:99,ENOSYS:78,ENOTCONN:57,ENOTDIR:20,ENOTEMPTY:66,ENOTSOCK:38,ENOTSUP:45,ENOTTY:25,ENXIO:6,EOPNOTSUPP:102,EOVERFLOW:84,EPERM:1,EPIPE:32,EPROTO:100,EPROTONOSUPPORT:43,EPROTOTYPE:41,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:70,ETIME:101,ETIMEDOUT:60,ETXTBSY:26,EWOULDBLOCK:35,EXDEV:18,PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20,SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:10,SIGFPE:8,SIGKILL:9,SIGUSR1:30,SIGSEGV:11,SIGUSR2:31,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGCHLD:20,SIGCONT:19,SIGSTOP:17,SIGTSTP:18,SIGTTIN:21,SIGTTOU:22,SIGURG:16,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:23,SIGINFO:29,SIGSYS:12,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,O_RDONLY:0,O_WRONLY:1,O_RDWR:2,UV_DIRENT_UNKNOWN:0,UV_DIRENT_FILE:1,UV_DIRENT_DIR:2,UV_DIRENT_LINK:3,UV_DIRENT_FIFO:4,UV_DIRENT_SOCKET:5,UV_DIRENT_CHAR:6,UV_DIRENT_BLOCK:7,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:512,O_EXCL:2048,O_NOCTTY:mn,O_TRUNC:1024,O_APPEND:8,O_DIRECTORY:gn,O_NOFOLLOW:256,O_SYNC:128,O_DSYNC:yn,O_SYMLINK:bn,O_NONBLOCK:4,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_COPYFILE_EXCL:1,COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_FICLONE_FORCE:4,OPENSSL_VERSION_NUMBER:vn,SSL_OP_ALL:wn,SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION:_n,SSL_OP_CIPHER_SERVER_PREFERENCE:Mn,SSL_OP_CISCO_ANYCONNECT:32768,SSL_OP_COOKIE_EXCHANGE:8192,SSL_OP_CRYPTOPRO_TLSEXT_BUG:Sn,SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:2048,SSL_OP_EPHEMERAL_RSA:0,SSL_OP_LEGACY_SERVER_CONNECT:4,SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:0,SSL_OP_MICROSOFT_SESS_ID_BUG:0,SSL_OP_MSIE_SSLV2_RSA_PADDING:0,SSL_OP_NETSCAPE_CA_DN_BUG:0,SSL_OP_NETSCAPE_CHALLENGE_BUG:0,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG:0,SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG:0,SSL_OP_NO_COMPRESSION:En,SSL_OP_NO_QUERY_MTU:4096,SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION:65536,SSL_OP_NO_SSLv2:0,SSL_OP_NO_SSLv3:kn,SSL_OP_NO_TICKET:16384,SSL_OP_NO_TLSv1:An,SSL_OP_NO_TLSv1_1:On,SSL_OP_NO_TLSv1_2:Tn,SSL_OP_PKCS1_CHECK_1:0,SSL_OP_PKCS1_CHECK_2:0,SSL_OP_SINGLE_DH_USE:0,SSL_OP_SINGLE_ECDH_USE:0,SSL_OP_SSLEAY_080_CLIENT_DH_BUG:0,SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG:0,SSL_OP_TLS_BLOCK_PADDING_BUG:0,SSL_OP_TLS_D5_BUG:0,SSL_OP_TLS_ROLLBACK_BUG:In,ENGINE_METHOD_RSA:1,ENGINE_METHOD_DSA:2,ENGINE_METHOD_DH:4,ENGINE_METHOD_RAND:8,ENGINE_METHOD_EC:2048,ENGINE_METHOD_CIPHERS:64,ENGINE_METHOD_DIGESTS:128,ENGINE_METHOD_PKEY_METHS:512,ENGINE_METHOD_PKEY_ASN1_METHS:1024,ENGINE_METHOD_ALL:65535,ENGINE_METHOD_NONE:0,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,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,RSA_PSS_SALTLEN_DIGEST:-1,RSA_PSS_SALTLEN_MAX_SIGN:-2,RSA_PSS_SALTLEN_AUTO:-2,defaultCoreCipherList:Rn,TLS1_VERSION:769,TLS1_1_VERSION:770,TLS1_2_VERSION:771,TLS1_3_VERSION:772,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6,defaultCipherList:Cn},xn=X(Object.freeze({__proto__:null,ALPN_ENABLED:1,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4,DH_CHECK_P_NOT_PRIME:1,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_NOT_SUITABLE_GENERATOR:8,DH_UNABLE_TO_CHECK_GENERATOR:4,E2BIG:7,EACCES:13,EADDRINUSE:48,EADDRNOTAVAIL:49,EAFNOSUPPORT:47,EAGAIN:35,EALREADY:37,EBADF:9,EBADMSG:94,EBUSY:16,ECANCELED:89,ECHILD:10,ECONNABORTED:53,ECONNREFUSED:61,ECONNRESET:54,EDEADLK:11,EDESTADDRREQ:39,EDOM:33,EDQUOT:69,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:65,EIDRM:90,EILSEQ:92,EINPROGRESS:36,EINTR:4,EINVAL:22,EIO:5,EISCONN:56,EISDIR:21,ELOOP:62,EMFILE:24,EMLINK:31,EMSGSIZE:40,EMULTIHOP:95,ENAMETOOLONG:63,ENETDOWN:50,ENETRESET:52,ENETUNREACH:51,ENFILE:23,ENGINE_METHOD_ALL:65535,ENGINE_METHOD_CIPHERS:64,ENGINE_METHOD_DH:4,ENGINE_METHOD_DIGESTS:128,ENGINE_METHOD_DSA:2,ENGINE_METHOD_EC:2048,ENGINE_METHOD_NONE:0,ENGINE_METHOD_PKEY_ASN1_METHS:1024,ENGINE_METHOD_PKEY_METHS:512,ENGINE_METHOD_RAND:8,ENGINE_METHOD_RSA:1,ENOBUFS:55,ENODATA:96,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:77,ENOLINK:97,ENOMEM:12,ENOMSG:91,ENOPROTOOPT:42,ENOSPC:28,ENOSR:98,ENOSTR:99,ENOSYS:78,ENOTCONN:57,ENOTDIR:20,ENOTEMPTY:66,ENOTSOCK:38,ENOTSUP:45,ENOTTY:25,ENXIO:6,EOPNOTSUPP:102,EOVERFLOW:84,EPERM:1,EPIPE:32,EPROTO:100,EPROTONOSUPPORT:43,EPROTOTYPE:41,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:70,ETIME:101,ETIMEDOUT:60,ETXTBSY:26,EWOULDBLOCK:35,EXDEV:18,F_OK:0,OPENSSL_VERSION_NUMBER:vn,O_APPEND:8,O_CREAT:512,O_DIRECTORY:gn,O_DSYNC:yn,O_EXCL:2048,O_NOCTTY:mn,O_NOFOLLOW:256,O_NONBLOCK:4,O_RDONLY:0,O_RDWR:2,O_SYMLINK:bn,O_SYNC:128,O_TRUNC:1024,O_WRONLY:1,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_HYBRID:6,POINT_CONVERSION_UNCOMPRESSED:4,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_BELOW_NORMAL:10,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20,PRIORITY_LOW:19,PRIORITY_NORMAL:0,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_PKCS1_PADDING:1,RSA_PKCS1_PSS_PADDING:6,RSA_PSS_SALTLEN_AUTO:-2,RSA_PSS_SALTLEN_DIGEST:-1,RSA_PSS_SALTLEN_MAX_SIGN:-2,RSA_SSLV23_PADDING:2,RSA_X931_PADDING:5,RTLD_GLOBAL:8,RTLD_LAZY:1,RTLD_LOCAL:4,RTLD_NOW:2,R_OK:4,SIGABRT:6,SIGALRM:14,SIGBUS:10,SIGCHLD:20,SIGCONT:19,SIGFPE:8,SIGHUP:1,SIGILL:4,SIGINFO:29,SIGINT:2,SIGIO:23,SIGIOT:6,SIGKILL:9,SIGPIPE:13,SIGPROF:27,SIGQUIT:3,SIGSEGV:11,SIGSTOP:17,SIGSYS:12,SIGTERM:15,SIGTRAP:5,SIGTSTP:18,SIGTTIN:21,SIGTTOU:22,SIGURG:16,SIGUSR1:30,SIGUSR2:31,SIGVTALRM:26,SIGWINCH:28,SIGXCPU:24,SIGXFSZ:25,SSL_OP_ALL:wn,SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION:_n,SSL_OP_CIPHER_SERVER_PREFERENCE:Mn,SSL_OP_CISCO_ANYCONNECT:32768,SSL_OP_COOKIE_EXCHANGE:8192,SSL_OP_CRYPTOPRO_TLSEXT_BUG:Sn,SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:2048,SSL_OP_EPHEMERAL_RSA:0,SSL_OP_LEGACY_SERVER_CONNECT:4,SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:0,SSL_OP_MICROSOFT_SESS_ID_BUG:0,SSL_OP_MSIE_SSLV2_RSA_PADDING:0,SSL_OP_NETSCAPE_CA_DN_BUG:0,SSL_OP_NETSCAPE_CHALLENGE_BUG:0,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG:0,SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG:0,SSL_OP_NO_COMPRESSION:En,SSL_OP_NO_QUERY_MTU:4096,SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION:65536,SSL_OP_NO_SSLv2:0,SSL_OP_NO_SSLv3:kn,SSL_OP_NO_TICKET:16384,SSL_OP_NO_TLSv1:An,SSL_OP_NO_TLSv1_1:On,SSL_OP_NO_TLSv1_2:Tn,SSL_OP_PKCS1_CHECK_1:0,SSL_OP_PKCS1_CHECK_2:0,SSL_OP_SINGLE_DH_USE:0,SSL_OP_SINGLE_ECDH_USE:0,SSL_OP_SSLEAY_080_CLIENT_DH_BUG:0,SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG:0,SSL_OP_TLS_BLOCK_PADDING_BUG:0,SSL_OP_TLS_D5_BUG:0,SSL_OP_TLS_ROLLBACK_BUG:In,S_IFBLK:24576,S_IFCHR:8192,S_IFDIR:16384,S_IFIFO:4096,S_IFLNK:40960,S_IFMT:61440,S_IFREG:32768,S_IFSOCK:49152,S_IRGRP:32,S_IROTH:4,S_IRUSR:256,S_IRWXG:56,S_IRWXO:7,S_IRWXU:448,S_IWGRP:16,S_IWOTH:2,S_IWUSR:128,S_IXGRP:8,S_IXOTH:1,S_IXUSR:64,TLS1_1_VERSION:770,TLS1_2_VERSION:771,TLS1_3_VERSION:772,TLS1_VERSION:769,UV_DIRENT_BLOCK:7,UV_DIRENT_CHAR:6,UV_DIRENT_DIR:2,UV_DIRENT_FIFO:4,UV_DIRENT_FILE:1,UV_DIRENT_LINK:3,UV_DIRENT_SOCKET:5,UV_DIRENT_UNKNOWN:0,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,W_OK:2,X_OK:1,default:Pn,defaultCipherList:Cn,defaultCoreCipherList:Rn})),Nn={};function Bn(){throw new Error("setTimeout has not been defined")}function Ln(){throw new Error("clearTimeout has not been defined")}var Dn=Bn,jn=Ln;function Un(t){if(Dn===setTimeout)return setTimeout(t,0);if((Dn===Bn||!Dn)&&setTimeout)return Dn=setTimeout,setTimeout(t,0);try{return Dn(t,0)}catch(e){try{return Dn.call(null,t,0)}catch(e){return Dn.call(this,t,0)}}}"function"==typeof le.setTimeout&&(Dn=setTimeout),"function"==typeof le.clearTimeout&&(jn=clearTimeout);var qn,Fn=[],zn=!1,Hn=-1;function Kn(){zn&&qn&&(zn=!1,qn.length?Fn=qn.concat(Fn):Hn=-1,Fn.length&&Vn())}function Vn(){if(!zn){var t=Un(Kn);zn=!0;for(var e=Fn.length;e;){for(qn=Fn,Fn=[];++Hn<e;)qn&&qn[Hn].run();Hn=-1,e=Fn.length}qn=null,zn=!1,function(t){if(jn===clearTimeout)return clearTimeout(t);if((jn===Ln||!jn)&&clearTimeout)return jn=clearTimeout,clearTimeout(t);try{return jn(t)}catch(e){try{return jn.call(null,t)}catch(e){return jn.call(this,t)}}}(t)}}function Gn(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Fn.push(new Wn(t,e)),1!==Fn.length||zn||Un(Vn)}function Wn(t,e){this.fun=t,this.array=e}Wn.prototype.run=function(){this.fun.apply(null,this.array)};function Yn(){}var Zn=Yn,Xn=Yn,Qn=Yn,Jn=Yn,$n=Yn,to=Yn,eo=Yn;var ro=le.performance||{},io=ro.now||ro.mozNow||ro.msNow||ro.oNow||ro.webkitNow||function(){return(new Date).getTime()};var no=new Date;var oo={nextTick:Gn,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Zn,addListener:Xn,once:Qn,off:Jn,removeListener:$n,removeAllListeners:to,emit:eo,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*io.call(ro),r=Math.floor(e),i=Math.floor(e%1*1e9);return t&&(r-=t[0],(i-=t[1])<0&&(r--,i+=1e9)),[r,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-no)/1e3}},so={},ao={},ho={},uo={get exports(){return ho},set exports(t){ho=t}},fo={},lo={get exports(){return fo},set exports(t){fo=t}},co=X(Vr);
2
2
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
3
3
  !function(t,e){var r=co,i=r.Buffer;function n(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(n(r,e),e.Buffer=o),o.prototype=Object.create(i.prototype),n(i,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(lo,fo);var po=65536,mo=4294967295;var go=fo.Buffer,yo=Y.crypto||Y.msCrypto;yo&&yo.getRandomValues?uo.exports=function(t,e){if(t>mo)throw new RangeError("requested too many random bytes");var r=go.allocUnsafe(t);if(t>0)if(t>po)for(var i=0;i<t;i+=po)yo.getRandomValues(r.slice(i,i+po));else yo.getRandomValues(r);if("function"==typeof e)return oo.nextTick((function(){e(null,r)}));return r}:uo.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};var bo={},vo={get exports(){return bo},set exports(t){bo=t}};"function"==typeof Object.create?vo.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:vo.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var wo={},_o={get exports(){return wo},set exports(t){wo=t}};function Mo(){}function So(){So.init.call(this)}function Eo(t){return void 0===t._maxListeners?So.defaultMaxListeners:t._maxListeners}function ko(t,e,r,i){var n,o,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]):(o=t._events=new Mo,t._eventsCount=0),s){if("function"==typeof s?s=o[e]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),!s.warned&&(n=Eo(t))&&n>0&&s.length>n){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,function(t){"function"==typeof console.warn?console.warn(t):console.log(t)}(a)}}else s=o[e]=r,++t._eventsCount;return t}function Ao(t,e,r){var i=!1;function n(){t.removeListener(e,n),i||(i=!0,r.apply(t,arguments))}return n.listener=r,n}function Oo(t){var e=this._events;if(e){var r=e[t];if("function"==typeof r)return 1;if(r)return r.length}return 0}function To(t,e){for(var r=new Array(e);e--;)r[e]=t[e];return r}Mo.prototype=Object.create(null),So.EventEmitter=So,So.usingDomains=!1,So.prototype.domain=void 0,So.prototype._events=void 0,So.prototype._maxListeners=void 0,So.defaultMaxListeners=10,So.init=function(){this.domain=null,So.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Mo,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},So.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},So.prototype.getMaxListeners=function(){return Eo(this)},So.prototype.emit=function(t){var e,r,i,n,o,s,a,h="error"===t;if(s=this._events)h=h&&null==s.error;else if(!h)return!1;if(a=this.domain,h){if(e=arguments[1],!a){if(e instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}return e||(e=new Error('Uncaught, unspecified "error" event')),e.domainEmitter=this,e.domain=a,e.domainThrown=!1,a.emit("error",e),!1}if(!(r=s[t]))return!1;var f="function"==typeof r;switch(i=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var i=t.length,n=To(t,i),o=0;o<i;++o)n[o].call(r)}(r,f,this);break;case 2:!function(t,e,r,i){if(e)t.call(r,i);else for(var n=t.length,o=To(t,n),s=0;s<n;++s)o[s].call(r,i)}(r,f,this,arguments[1]);break;case 3:!function(t,e,r,i,n){if(e)t.call(r,i,n);else for(var o=t.length,s=To(t,o),a=0;a<o;++a)s[a].call(r,i,n)}(r,f,this,arguments[1],arguments[2]);break;case 4:!function(t,e,r,i,n,o){if(e)t.call(r,i,n,o);else for(var s=t.length,a=To(t,s),h=0;h<s;++h)a[h].call(r,i,n,o)}(r,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(n=new Array(i-1),o=1;o<i;o++)n[o-1]=arguments[o];!function(t,e,r,i){if(e)t.apply(r,i);else for(var n=t.length,o=To(t,n),s=0;s<n;++s)o[s].apply(r,i)}(r,f,this,n)}return!0},So.prototype.addListener=function(t,e){return ko(this,t,e,!1)},So.prototype.on=So.prototype.addListener,So.prototype.prependListener=function(t,e){return ko(this,t,e,!0)},So.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.on(t,Ao(this,t,e)),this},So.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.prependListener(t,Ao(this,t,e)),this},So.prototype.removeListener=function(t,e){var r,i,n,o,s;if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(r=i[t]))return this;if(r===e||r.listener&&r.listener===e)0==--this._eventsCount?this._events=new Mo:(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(n=-1,o=r.length;o-- >0;)if(r[o]===e||r[o].listener&&r[o].listener===e){s=r[o].listener,n=o;break}if(n<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new Mo,this;delete i[t]}else!function(t,e){for(var r=e,i=r+1,n=t.length;i<n;r+=1,i+=1)t[r]=t[i];t.pop()}(r,n);i.removeListener&&this.emit("removeListener",t,s||e)}return this},So.prototype.removeAllListeners=function(t){var e,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new Mo,this._eventsCount=0):r[t]&&(0==--this._eventsCount?this._events=new Mo:delete r[t]),this;if(0===arguments.length){for(var i,n=Object.keys(r),o=0;o<n.length;++o)"removeListener"!==(i=n[o])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=new Mo,this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(e)do{this.removeListener(t,e[e.length-1])}while(e[0]);return this},So.prototype.listeners=function(t){var e,r,i=this._events;return r=i&&(e=i[t])?"function"==typeof e?[e.listener||e]:function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(e):[],r},So.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):Oo.call(t,e)},So.prototype.listenerCount=Oo,So.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Io=X(Object.freeze({__proto__:null,EventEmitter:So,default:So})),Ro=Io.EventEmitter,Co="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},Po=/%[sdj%]/g;function xo(t){if(!Zo(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(jo(arguments[r]));return e.join(" ")}r=1;for(var i=arguments,n=i.length,o=String(t).replace(Po,(function(t){if("%%"===t)return"%";if(r>=n)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}})),s=i[r];r<n;s=i[++r])Go(s)||!$o(s)?o+=" "+s:o+=" "+jo(s);return o}function No(t,e){if(Qo(le.process))return function(){return No(t,e).apply(this,arguments)};if(!0===oo.noDeprecation)return t;var r=!1;return function(){if(!r){if(oo.throwDeprecation)throw new Error(e);oo.traceDeprecation?console.trace(e):console.error(e),r=!0}return t.apply(this,arguments)}}var Bo,Lo={};function Do(t){if(Qo(Bo)&&(Bo=oo.env.NODE_DEBUG||""),t=t.toUpperCase(),!Lo[t])if(new RegExp("\\b"+t+"\\b","i").test(Bo)){Lo[t]=function(){var e=xo.apply(null,arguments);console.error("%s %d: %s",t,0,e)}}else Lo[t]=function(){};return Lo[t]}function jo(t,e){var r={seen:[],stylize:qo};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Vo(e)?r.showHidden=e:e&&us(r,e),Qo(r.showHidden)&&(r.showHidden=!1),Qo(r.depth)&&(r.depth=2),Qo(r.colors)&&(r.colors=!1),Qo(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Uo),Fo(r,t,r.depth)}function Uo(t,e){var r=jo.styles[e];return r?"["+jo.colors[r][0]+"m"+t+"["+jo.colors[r][1]+"m":t}function qo(t,e){return t}function Fo(t,e,r){if(t.customInspect&&e&&rs(e.inspect)&&e.inspect!==jo&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(r,t);return Zo(i)||(i=Fo(t,i,r)),i}var n=function(t,e){if(Qo(e))return t.stylize("undefined","undefined");if(Zo(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(Yo(e))return t.stylize(""+e,"number");if(Vo(e))return t.stylize(""+e,"boolean");if(Go(e))return t.stylize("null","null")}(t,e);if(n)return n;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),es(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return zo(e);if(0===o.length){if(rs(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(Jo(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(ts(e))return t.stylize(Date.prototype.toString.call(e),"date");if(es(e))return zo(e)}var h,u="",f=!1,l=["{","}"];(Ko(e)&&(f=!0,l=["[","]"]),rs(e))&&(u=" [Function"+(e.name?": "+e.name:"")+"]");return Jo(e)&&(u=" "+RegExp.prototype.toString.call(e)),ts(e)&&(u=" "+Date.prototype.toUTCString.call(e)),es(e)&&(u=" "+zo(e)),0!==o.length||f&&0!=e.length?r<0?Jo(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),h=f?function(t,e,r,i,n){for(var o=[],s=0,a=e.length;s<a;++s)fs(e,String(s))?o.push(Ho(t,e,r,i,String(s),!0)):o.push("");return n.forEach((function(n){n.match(/^\d+$/)||o.push(Ho(t,e,r,i,n,!0))})),o}(t,e,r,s,o):o.map((function(i){return Ho(t,e,r,s,i,f)})),t.seen.pop(),function(t,e,r){var i=t.reduce((function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(i>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,u,l)):l[0]+u+l[1]}function zo(t){return"["+Error.prototype.toString.call(t)+"]"}function Ho(t,e,r,i,n,o){var s,a,h;if((h=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?a=h.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):h.set&&(a=t.stylize("[Setter]","special")),fs(i,n)||(s="["+n+"]"),a||(t.seen.indexOf(h.value)<0?(a=Go(r)?Fo(t,h.value,null):Fo(t,h.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")),Qo(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 Ko(t){return Array.isArray(t)}function Vo(t){return"boolean"==typeof t}function Go(t){return null===t}function Wo(t){return null==t}function Yo(t){return"number"==typeof t}function Zo(t){return"string"==typeof t}function Xo(t){return"symbol"==typeof t}function Qo(t){return void 0===t}function Jo(t){return $o(t)&&"[object RegExp]"===os(t)}function $o(t){return"object"==typeof t&&null!==t}function ts(t){return $o(t)&&"[object Date]"===os(t)}function es(t){return $o(t)&&("[object Error]"===os(t)||t instanceof Error)}function rs(t){return"function"==typeof t}function is(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function ns(t){return sr.isBuffer(t)}function os(t){return Object.prototype.toString.call(t)}function ss(t){return t<10?"0"+t.toString(10):t.toString(10)}jo.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]},jo.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var as=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function hs(){console.log("%s - %s",function(){var t=new Date,e=[ss(t.getHours()),ss(t.getMinutes()),ss(t.getSeconds())].join(":");return[t.getDate(),as[t.getMonth()],e].join(" ")}(),xo.apply(null,arguments))}function us(t,e){if(!e||!$o(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t}function fs(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var ls,cs,ds={inherits:Co,_extend:us,log:hs,isBuffer:ns,isPrimitive:is,isFunction:rs,isError:es,isDate:ts,isObject:$o,isRegExp:Jo,isUndefined:Qo,isSymbol:Xo,isString:Zo,isNumber:Yo,isNullOrUndefined:Wo,isNull:Go,isBoolean:Vo,isArray:Ko,inspect:jo,deprecate:No,format:xo,debuglog:Do},ps=X(Object.freeze({__proto__:null,_extend:us,debuglog:Do,default:ds,deprecate:No,format:xo,inherits:Co,inspect:jo,isArray:Ko,isBoolean:Vo,isBuffer:ns,isDate:ts,isError:es,isFunction:rs,isNull:Go,isNullOrUndefined:Wo,isNumber:Yo,isObject:$o,isPrimitive:is,isRegExp:Jo,isString:Zo,isSymbol:Xo,isUndefined:Qo,log:hs}));function ms(){if(cs)return ls;function t(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 e(e){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?t(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(t,e,r){return(e=n(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}cs=1;var o=co.Buffer,s=ps.inspect,a=s&&s.custom||"inspect";return ls=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}var r,n,h;return r=t,n=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?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 o.alloc(0);for(var e,r,i,n=o.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,r=n,i=a,o.prototype.copy.call(e,r,i),a+=s.data.length,s=s.next;return n}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,i=e.data;for(t-=i.length;e=e.next;){var n=e.data,o=t>n.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=o.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,s=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,s),0==(t-=s)){s===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(s));break}++i}return this.length-=i,e}},{key:a,value:function(t,r){return s(this,e(e({},r),{},{depth:0,customInspect:!1}))}}],n&&i(r.prototype,n),h&&i(r,h),Object.defineProperty(r,"prototype",{writable:!1}),t}(),ls}function gs(t,e){bs(t,e),ys(t)}function ys(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function bs(t,e){t.emit("error",e)}var vs={destroy:function(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,oo.nextTick(bs,this,t)):oo.nextTick(bs,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted?oo.nextTick(ys,r):(r._writableState.errorEmitted=!0,oo.nextTick(gs,r,t)):oo.nextTick(gs,r,t):e?(oo.nextTick(ys,r),e(t)):oo.nextTick(ys,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}},ws={};var _s={};function Ms(t,e,r){r||(r=Error);var i=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);i.prototype.name=r.name,i.prototype.code=t,_s[t]=i}function Ss(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))}Ms("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),Ms("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,s;if("string"==typeof e&&(n="not ",e.substr(!o||o<0?0:+o,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"))s="The ".concat(t," ").concat(i," ").concat(Ss(e,"type"));else{var a=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(a," ").concat(i," ").concat(Ss(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),Ms("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Ms("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),Ms("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Ms("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),Ms("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Ms("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Ms("ERR_STREAM_WRITE_AFTER_END","write after end"),Ms("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Ms("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),Ms("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),ws.codes=_s;var Es=ws.codes.ERR_INVALID_OPT_VALUE;var ks,As,Os,Ts,Is={getHighWaterMark:function(t,e,r,i){var n=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new Es(i?r:"highWaterMark",n);return Math.floor(n)}return t.objectMode?16:16384}},Rs=function(t,e){if(Cs("noDeprecation"))return t;var r=!1;return function(){if(!r){if(Cs("throwDeprecation"))throw new Error(e);Cs("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}};function Cs(t){try{if(!Y.localStorage)return!1}catch(t){return!1}var e=Y.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}function Ps(){if(As)return ks;function t(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.next=t}(e,t)}}var e;As=1,ks=_,_.WritableState=w;var r={deprecate:Rs},i=Ro,n=co.Buffer,o=(void 0!==Y?Y:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var s,a=vs,h=Is.getHighWaterMark,u=ws.codes,f=u.ERR_INVALID_ARG_TYPE,l=u.ERR_METHOD_NOT_IMPLEMENTED,c=u.ERR_MULTIPLE_CALLBACK,d=u.ERR_STREAM_CANNOT_PIPE,p=u.ERR_STREAM_DESTROYED,m=u.ERR_STREAM_NULL_VALUES,g=u.ERR_STREAM_WRITE_AFTER_END,y=u.ERR_UNKNOWN_ENCODING,b=a.errorOrDestroy;function v(){}function w(r,i,n){e=e||xs(),r=r||{},"boolean"!=typeof n&&(n=i instanceof e),this.objectMode=!!r.objectMode,n&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=h(this,r,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===r.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=r.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"!=typeof n)throw new c;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?(oo.nextTick(n,i),oo.nextTick(O,t,e),t._writableState.errorEmitted=!0,b(t,i)):(n(i),t._writableState.errorEmitted=!0,b(t,i),O(t,e))}(t,r,i,e,n);else{var o=k(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||E(t,r),i?oo.nextTick(S,t,r,o,n):S(t,r,o,n)}}(i,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function _(t){var r=this instanceof(e=e||xs());if(!r&&!s.call(_,this))return new _(t);this._writableState=new w(t,this,r),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)),i.call(this)}function M(t,e,r,i,n,o,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new p("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function S(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),O(t,e)}function E(e,r){r.bufferProcessing=!0;var i=r.bufferedRequest;if(e._writev&&i&&i.next){var n=r.bufferedRequestCount,o=new Array(n),s=r.corkedRequestsFree;s.entry=i;for(var a=0,h=!0;i;)o[a]=i,i.isBuf||(h=!1),i=i.next,a+=1;o.allBuffers=h,M(e,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new t(r),r.bufferedRequestCount=0}else{for(;i;){var u=i.chunk,f=i.encoding,l=i.callback;if(M(e,r,!1,r.objectMode?1:u.length,u,f,l),i=i.next,r.bufferedRequestCount--,r.writing)break}null===i&&(r.lastBufferedRequest=null)}r.bufferedRequest=i,r.bufferProcessing=!1}function k(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function A(t,e){t._final((function(r){e.pendingcb--,r&&b(t,r),e.prefinished=!0,t.emit("prefinish"),O(t,e)}))}function O(t,e){var r=k(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,oo.nextTick(A,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}return bo(_,i),w.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.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]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===_&&(t&&t._writableState instanceof w)}})):s=function(t){return t instanceof this},_.prototype.pipe=function(){b(this,new d)},_.prototype.write=function(t,e,r){var i,s=this._writableState,a=!1,h=!s.objectMode&&(i=t,n.isBuffer(i)||i instanceof o);return h&&!n.isBuffer(t)&&(t=function(t){return n.from(t)}(t)),"function"==typeof e&&(r=e,e=null),h?e="buffer":e||(e=s.defaultEncoding),"function"!=typeof r&&(r=v),s.ending?function(t,e){var r=new g;b(t,r),oo.nextTick(e,r)}(this,r):(h||function(t,e,r,i){var n;return null===r?n=new m:"string"==typeof r||e.objectMode||(n=new f("chunk",["string","Buffer"],r)),!n||(b(t,n),oo.nextTick(i,n),!1)}(this,s,t,r))&&(s.pendingcb++,a=function(t,e,r,i,o,s){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=n.from(e,r));return e}(e,i,o);i!==a&&(r=!0,o="buffer",i=a)}var h=e.objectMode?1:i.length;e.length+=h;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var f=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:o,isBuf:r,callback:s,next:null},f?f.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else M(t,e,!1,h,i,o,s);return u}(this,s,h,t,e,r)),a},_.prototype.cork=function(){this._writableState.corked++},_.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||E(this,t))},_.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new y(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(t,e,r){r(new l("_write()"))},_.prototype._writev=null,_.prototype.end=function(t,e,r){var i=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),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,O(t,e),r&&(e.finished?oo.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(_.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(_.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),_.prototype.destroy=a.destroy,_.prototype._undestroy=a.undestroy,_.prototype._destroy=function(t,e){e(t)},ks}function xs(){if(Ts)return Os;Ts=1;var t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Os=s;var e=Ws(),r=Ps();bo(s,e);for(var i=t(r.prototype),n=0;n<i.length;n++){var o=i[n];s.prototype[o]||(s.prototype[o]=r.prototype[o])}function s(t){if(!(this instanceof s))return new s(t);e.call(this,t),r.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||oo.nextTick(h,this)}function h(t){t.end()}return Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),Os}var Ns,Bs={};function Ls(){if(Ns)return Bs;Ns=1;var t=fo.Buffer,e=t.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 r(r){var i;switch(this.encoding=function(r){var i=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}}(r);if("string"!=typeof i&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return i||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,i=4;break;case"utf8":this.fillLast=n,i=4;break;case"base64":this.text=a,this.end=h,i=3;break;default:return this.write=u,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(i)}function i(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function n(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 o(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 s(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 a(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 h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function u(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}return Bs.StringDecoder=r,r.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<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var o=i(e[n]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--n<r||-2===o)return 0;if(o=i(e[n]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--n<r||-2===o)return 0;if(o=i(e[n]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},r.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},Bs}var Ds=ws.codes.ERR_STREAM_PREMATURE_CLOSE;function js(){}var Us,qs,Fs,zs,Hs,Ks,Vs=function t(e,r,i){if("function"==typeof r)return t(e,null,r);r||(r={}),i=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}(i||js);var n=r.readable||!1!==r.readable&&e.readable,o=r.writable||!1!==r.writable&&e.writable,s=function(){e.writable||h()},a=e._writableState&&e._writableState.finished,h=function(){o=!1,a=!0,n||i.call(e)},u=e._readableState&&e._readableState.endEmitted,f=function(){n=!1,u=!0,o||i.call(e)},l=function(t){i.call(e,t)},c=function(){var t;return n&&!u?(e._readableState&&e._readableState.ended||(t=new Ds),i.call(e,t)):o&&!a?(e._writableState&&e._writableState.ended||(t=new Ds),i.call(e,t)):void 0},d=function(){e.req.on("finish",h)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?o&&!e._writableState&&(e.on("end",s),e.on("close",s)):(e.on("complete",h),e.on("abort",c),e.req?d():e.on("request",d)),e.on("end",f),e.on("finish",h),!1!==r.error&&e.on("error",l),e.on("close",c),function(){e.removeListener("complete",h),e.removeListener("abort",c),e.removeListener("request",d),e.req&&e.req.removeListener("finish",h),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",h),e.removeListener("end",f),e.removeListener("error",l),e.removeListener("close",c)}};function Gs(){if(qs)return Us;var t;function e(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}qs=1;var r=Vs,i=Symbol("lastResolve"),n=Symbol("lastReject"),o=Symbol("error"),s=Symbol("ended"),a=Symbol("lastPromise"),h=Symbol("handlePromise"),u=Symbol("stream");function f(t,e){return{value:t,done:e}}function l(t){var e=t[i];if(null!==e){var r=t[u].read();null!==r&&(t[a]=null,t[i]=null,t[n]=null,e(f(r,!1)))}}function c(t){oo.nextTick(l,t)}var d=Object.getPrototypeOf((function(){})),p=Object.setPrototypeOf((e(t={get stream(){return this[u]},next:function(){var t=this,e=this[o];if(null!==e)return Promise.reject(e);if(this[s])return Promise.resolve(f(void 0,!0));if(this[u].destroyed)return new Promise((function(e,r){oo.nextTick((function(){t[o]?r(t[o]):e(f(void 0,!0))}))}));var r,i=this[a];if(i)r=new Promise(function(t,e){return function(r,i){t.then((function(){e[s]?r(f(void 0,!0)):e[h](r,i)}),i)}}(i,this));else{var n=this[u].read();if(null!==n)return Promise.resolve(f(n,!1));r=new Promise(this[h])}return this[a]=r,r}},Symbol.asyncIterator,(function(){return this})),e(t,"return",(function(){var t=this;return new Promise((function(e,r){t[u].destroy(null,(function(t){t?r(t):e(f(void 0,!0))}))}))})),t),d);return Us=function(t){var l,d=Object.create(p,(e(l={},u,{value:t,writable:!0}),e(l,i,{value:null,writable:!0}),e(l,n,{value:null,writable:!0}),e(l,o,{value:null,writable:!0}),e(l,s,{value:t._readableState.endEmitted,writable:!0}),e(l,h,{value:function(t,e){var r=d[u].read();r?(d[a]=null,d[i]=null,d[n]=null,t(f(r,!1))):(d[i]=t,d[n]=e)},writable:!0}),l));return d[a]=null,r(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=d[n];return null!==e&&(d[a]=null,d[i]=null,d[n]=null,e(t)),void(d[o]=t)}var r=d[i];null!==r&&(d[a]=null,d[i]=null,d[n]=null,r(f(void 0,!0))),d[s]=!0})),t.on("readable",c.bind(null,d)),d},Us}function Ws(){if(Ks)return Hs;var t;Ks=1,Hs=_,_.ReadableState=w,Io.EventEmitter;var e=function(t,e){return t.listeners(e).length},r=Ro,i=co.Buffer,n=(void 0!==Y?Y:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var o,s=ps;o=s&&s.debuglog?s.debuglog("stream"):function(){};var a,h,u,f=ms(),l=vs,c=Is.getHighWaterMark,d=ws.codes,p=d.ERR_INVALID_ARG_TYPE,m=d.ERR_STREAM_PUSH_AFTER_EOF,g=d.ERR_METHOD_NOT_IMPLEMENTED,y=d.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;bo(_,r);var b=l.errorOrDestroy,v=["error","close","destroy","pause","resume"];function w(e,r,i){t=t||xs(),e=e||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=c(this,e,"readableHighWaterMark",i),this.buffer=new f,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!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(a||(a=Ls().StringDecoder),this.decoder=new a(e.encoding),this.encoding=e.encoding)}function _(e){if(t=t||xs(),!(this instanceof _))return new _(e);var i=this instanceof t;this._readableState=new w(e,this,i),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),r.call(this)}function M(t,e,r,s,a){o("readableAddChunk",e);var h,u=t._readableState;if(null===e)u.reading=!1,function(t,e){if(o("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?A(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,O(t)))}(t,u);else if(a||(h=function(t,e){var r;o=e,i.isBuffer(o)||o instanceof n||"string"==typeof e||void 0===e||t.objectMode||(r=new p("chunk",["string","Buffer","Uint8Array"],e));var o;return r}(u,e)),h)b(t,h);else if(u.objectMode||e&&e.length>0)if("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===i.prototype||(e=function(t){return i.from(t)}(e)),s)u.endEmitted?b(t,new y):S(t,u,e,!0);else if(u.ended)b(t,new m);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?S(t,u,e,!1):T(t,u)):S(t,u,e,!1)}else s||(u.reading=!1,T(t,u));return!u.ended&&(u.length<u.highWaterMark||0===u.length)}function S(t,e,r,i){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&A(t)),T(t,e)}Object.defineProperty(_.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),_.prototype.destroy=l.destroy,_.prototype._undestroy=l.undestroy,_.prototype._destroy=function(t,e){e(t)},_.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=i.from(t,e),e=""),r=!0),M(this,t,e,!1,r)},_.prototype.unshift=function(t){return M(this,t,null,!0,!1)},_.prototype.isPaused=function(){return!1===this._readableState.flowing},_.prototype.setEncoding=function(t){a||(a=Ls().StringDecoder);var e=new a(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var E=1073741824;function k(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(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 A(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,oo.nextTick(O,t))}function O(t){var e=t._readableState;o("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,x(t)}function T(t,e){e.readingMore||(e.readingMore=!0,oo.nextTick(I,t,e))}function I(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(o("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function R(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function C(t){o("readable nexttick read 0"),t.read(0)}function P(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),x(t),e.flowing&&!e.reading&&t.read(0)}function x(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function N(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 B(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,oo.nextTick(L,e,t))}function L(t,e){if(o("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 D(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}return _.prototype.read=function(t){o("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?B(this):A(this),null;if(0===(t=k(t,e))&&e.ended)return 0===e.length&&B(this),null;var i,n=e.needReadable;return o("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&o("length less than watermark",n=!0),e.ended||e.reading?o("reading or ended",n=!1):n&&(o("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=k(r,e))),null===(i=t>0?N(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&&B(this)),null!==i&&this.emit("data",i),i},_.prototype._read=function(t){b(this,new g("_read()"))},_.prototype.pipe=function(t,r){var i=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,o("pipe count=%d opts=%j",n.pipesCount,r);var s=(!r||!1!==r.end)&&t!==oo.stdout&&t!==oo.stderr?h:m;function a(e,r){o("onunpipe"),e===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,o("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",u),t.removeListener("error",c),t.removeListener("unpipe",a),i.removeListener("end",h),i.removeListener("end",m),i.removeListener("data",l),f=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||u())}function h(){o("onend"),t.end()}n.endEmitted?oo.nextTick(s):i.once("end",s),t.on("unpipe",a);var u=function(t){return function(){var r=t._readableState;o("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&e(t,"data")&&(r.flowing=!0,x(t))}}(i);t.on("drain",u);var f=!1;function l(e){o("ondata");var r=t.write(e);o("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==D(n.pipes,t))&&!f&&(o("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function c(r){o("onerror",r),m(),t.removeListener("error",c),0===e(t,"error")&&b(t,r)}function d(){t.removeListener("finish",p),m()}function p(){o("onfinish"),t.removeListener("close",d),m()}function m(){o("unpipe"),i.unpipe(t)}return i.on("data",l),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",c),t.once("close",d),t.once("finish",p),t.emit("pipe",i),n.flowing||(o("pipe resume"),i.resume()),t},_.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;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=D(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},_.prototype.on=function(t,e){var i=r.prototype.on.call(this,t,e),n=this._readableState;return"data"===t?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,o("on readable",n.length,n.reading),n.length?A(this):n.reading||oo.nextTick(C,this))),i},_.prototype.addListener=_.prototype.on,_.prototype.removeListener=function(t,e){var i=r.prototype.removeListener.call(this,t,e);return"readable"===t&&oo.nextTick(R,this),i},_.prototype.removeAllListeners=function(t){var e=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||oo.nextTick(R,this),e},_.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,oo.nextTick(P,t,e))}(this,t)),t.paused=!1,this},_.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},_.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(o("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){(o("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 s=0;s<v.length;s++)t.on(v[s],this.emit.bind(this,v[s]));return this._read=function(e){o("wrapped _read",e),i&&(i=!1,t.resume())},this},"function"==typeof Symbol&&(_.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=Gs()),h(this)}),Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(_.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(_.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),_._fromList=N,Object.defineProperty(_.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(_.from=function(t,e){return void 0===u&&(u=zs?Fs:(zs=1,Fs=function(){throw new Error("Readable.from is not available in the browser")})),u(_,t,e)}),Hs}var Ys=ra,Zs=ws.codes,Xs=Zs.ERR_METHOD_NOT_IMPLEMENTED,Qs=Zs.ERR_MULTIPLE_CALLBACK,Js=Zs.ERR_TRANSFORM_ALREADY_TRANSFORMING,$s=Zs.ERR_TRANSFORM_WITH_LENGTH_0,ta=xs();function ea(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new Qs);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function ra(t){if(!(this instanceof ra))return new ra(t);ta.call(this,t),this._transformState={afterTransform:ea.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",ia)}function ia(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?na(this,null,null):this._flush((function(e,r){na(t,e,r)}))}function na(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new $s;if(t._transformState.transforming)throw new Js;return t.push(null)}bo(ra,ta),ra.prototype.push=function(t,e){return this._transformState.needTransform=!1,ta.prototype.push.call(this,t,e)},ra.prototype._transform=function(t,e,r){r(new Xs("_transform()"))},ra.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},ra.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},ra.prototype._destroy=function(t,e){ta.prototype._destroy.call(this,t,(function(t){e(t)}))};var oa,sa=ha,aa=Ys;function ha(t){if(!(this instanceof ha))return new ha(t);aa.call(this,t)}bo(ha,aa),ha.prototype._transform=function(t,e,r){r(null,t)};var ua=ws.codes,fa=ua.ERR_MISSING_ARGS,la=ua.ERR_STREAM_DESTROYED;function ca(t){if(t)throw t}function da(t){t()}function pa(t,e){return t.pipe(e)}var ma=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i,n=function(t){return t.length?"function"!=typeof t[t.length-1]?ca:t.pop():ca}(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new fa("streams");var o=e.map((function(t,r){var s=r<e.length-1;return function(t,e,r,i){i=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(i);var n=!1;t.on("close",(function(){n=!0})),void 0===oa&&(oa=Vs),oa(t,{readable:e,writable:r},(function(t){if(t)return i(t);n=!0,i()}));var o=!1;return function(e){if(!n&&!o)return o=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void i(e||new la("pipe"))}}(t,s,r>0,(function(t){i||(i=t),t&&o.forEach(da),s||(o.forEach(da),n(i))}))}));return e.reduce(pa)};!function(t,e){(e=_o.exports=Ws()).Stream=e,e.Readable=e,e.Writable=Ps(),e.Duplex=xs(),e.Transform=Ys,e.PassThrough=sa,e.finished=Vs,e.pipeline=ma}(0,wo);var ga=fo.Buffer,ya=wo.Transform;function ba(t){ya.call(this),this._block=ga.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}bo(ba,ya),ba.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(t){i=t}r(i)},ba.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},ba.prototype.update=function(t,e){if(function(t,e){if(!ga.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");ga.isBuffer(t)||(t=ga.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var n=this._blockOffset;n<this._blockSize;)r[n++]=t[i++];this._update(),this._blockOffset=0}for(;i<t.length;)r[this._blockOffset++]=t[i++];for(var o=0,s=8*t.length;s>0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},ba.prototype._update=function(){throw new Error("_update is not implemented")},ba.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},ba.prototype._digest=function(){throw new Error("_digest is not implemented")};var va=ba,wa=bo,_a=va,Ma=fo.Buffer,Sa=new Array(16);function Ea(){_a.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function ka(t,e){return t<<e|t>>>32-e}function Aa(t,e,r,i,n,o,s){return ka(t+(e&r|~e&i)+n+o|0,s)+e|0}function Oa(t,e,r,i,n,o,s){return ka(t+(e&i|r&~i)+n+o|0,s)+e|0}function Ta(t,e,r,i,n,o,s){return ka(t+(e^r^i)+n+o|0,s)+e|0}function Ia(t,e,r,i,n,o,s){return ka(t+(r^(e|~i))+n+o|0,s)+e|0}wa(Ea,_a),Ea.prototype._update=function(){for(var t=Sa,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=Aa(r,i,n,o,t[0],3614090360,7),o=Aa(o,r,i,n,t[1],3905402710,12),n=Aa(n,o,r,i,t[2],606105819,17),i=Aa(i,n,o,r,t[3],3250441966,22),r=Aa(r,i,n,o,t[4],4118548399,7),o=Aa(o,r,i,n,t[5],1200080426,12),n=Aa(n,o,r,i,t[6],2821735955,17),i=Aa(i,n,o,r,t[7],4249261313,22),r=Aa(r,i,n,o,t[8],1770035416,7),o=Aa(o,r,i,n,t[9],2336552879,12),n=Aa(n,o,r,i,t[10],4294925233,17),i=Aa(i,n,o,r,t[11],2304563134,22),r=Aa(r,i,n,o,t[12],1804603682,7),o=Aa(o,r,i,n,t[13],4254626195,12),n=Aa(n,o,r,i,t[14],2792965006,17),r=Oa(r,i=Aa(i,n,o,r,t[15],1236535329,22),n,o,t[1],4129170786,5),o=Oa(o,r,i,n,t[6],3225465664,9),n=Oa(n,o,r,i,t[11],643717713,14),i=Oa(i,n,o,r,t[0],3921069994,20),r=Oa(r,i,n,o,t[5],3593408605,5),o=Oa(o,r,i,n,t[10],38016083,9),n=Oa(n,o,r,i,t[15],3634488961,14),i=Oa(i,n,o,r,t[4],3889429448,20),r=Oa(r,i,n,o,t[9],568446438,5),o=Oa(o,r,i,n,t[14],3275163606,9),n=Oa(n,o,r,i,t[3],4107603335,14),i=Oa(i,n,o,r,t[8],1163531501,20),r=Oa(r,i,n,o,t[13],2850285829,5),o=Oa(o,r,i,n,t[2],4243563512,9),n=Oa(n,o,r,i,t[7],1735328473,14),r=Ta(r,i=Oa(i,n,o,r,t[12],2368359562,20),n,o,t[5],4294588738,4),o=Ta(o,r,i,n,t[8],2272392833,11),n=Ta(n,o,r,i,t[11],1839030562,16),i=Ta(i,n,o,r,t[14],4259657740,23),r=Ta(r,i,n,o,t[1],2763975236,4),o=Ta(o,r,i,n,t[4],1272893353,11),n=Ta(n,o,r,i,t[7],4139469664,16),i=Ta(i,n,o,r,t[10],3200236656,23),r=Ta(r,i,n,o,t[13],681279174,4),o=Ta(o,r,i,n,t[0],3936430074,11),n=Ta(n,o,r,i,t[3],3572445317,16),i=Ta(i,n,o,r,t[6],76029189,23),r=Ta(r,i,n,o,t[9],3654602809,4),o=Ta(o,r,i,n,t[12],3873151461,11),n=Ta(n,o,r,i,t[15],530742520,16),r=Ia(r,i=Ta(i,n,o,r,t[2],3299628645,23),n,o,t[0],4096336452,6),o=Ia(o,r,i,n,t[7],1126891415,10),n=Ia(n,o,r,i,t[14],2878612391,15),i=Ia(i,n,o,r,t[5],4237533241,21),r=Ia(r,i,n,o,t[12],1700485571,6),o=Ia(o,r,i,n,t[3],2399980690,10),n=Ia(n,o,r,i,t[10],4293915773,15),i=Ia(i,n,o,r,t[1],2240044497,21),r=Ia(r,i,n,o,t[8],1873313359,6),o=Ia(o,r,i,n,t[15],4264355552,10),n=Ia(n,o,r,i,t[6],2734768916,15),i=Ia(i,n,o,r,t[13],1309151649,21),r=Ia(r,i,n,o,t[4],4149444226,6),o=Ia(o,r,i,n,t[11],3174756917,10),n=Ia(n,o,r,i,t[2],718787259,15),i=Ia(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},Ea.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=Ma.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t};var Ra=Ea,Ca=co.Buffer,Pa=bo,xa=va,Na=new Array(16),Ba=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],La=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Da=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],ja=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Ua=[0,1518500249,1859775393,2400959708,2840853838],qa=[1352829926,1548603684,1836072691,2053994217,0];function Fa(){xa.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function za(t,e){return t<<e|t>>>32-e}function Ha(t,e,r,i,n,o,s,a){return za(t+(e^r^i)+o+s|0,a)+n|0}function Ka(t,e,r,i,n,o,s,a){return za(t+(e&r|~e&i)+o+s|0,a)+n|0}function Va(t,e,r,i,n,o,s,a){return za(t+((e|~r)^i)+o+s|0,a)+n|0}function Ga(t,e,r,i,n,o,s,a){return za(t+(e&i|r&~i)+o+s|0,a)+n|0}function Wa(t,e,r,i,n,o,s,a){return za(t+(e^(r|~i))+o+s|0,a)+n|0}Pa(Fa,xa),Fa.prototype._update=function(){for(var t=Na,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,s=0|this._e,a=0|this._a,h=0|this._b,u=0|this._c,f=0|this._d,l=0|this._e,c=0;c<80;c+=1){var d,p;c<16?(d=Ha(r,i,n,o,s,t[Ba[c]],Ua[0],Da[c]),p=Wa(a,h,u,f,l,t[La[c]],qa[0],ja[c])):c<32?(d=Ka(r,i,n,o,s,t[Ba[c]],Ua[1],Da[c]),p=Ga(a,h,u,f,l,t[La[c]],qa[1],ja[c])):c<48?(d=Va(r,i,n,o,s,t[Ba[c]],Ua[2],Da[c]),p=Va(a,h,u,f,l,t[La[c]],qa[2],ja[c])):c<64?(d=Ga(r,i,n,o,s,t[Ba[c]],Ua[3],Da[c]),p=Ka(a,h,u,f,l,t[La[c]],qa[3],ja[c])):(d=Wa(r,i,n,o,s,t[Ba[c]],Ua[4],Da[c]),p=Ha(a,h,u,f,l,t[La[c]],qa[4],ja[c])),r=s,s=o,o=za(n,10),n=i,i=d,a=l,l=f,f=za(u,10),u=h,h=p}var m=this._b+n+f|0;this._b=this._c+o+l|0,this._c=this._d+s+a|0,this._d=this._e+r+h|0,this._e=this._a+i+u|0,this._a=m},Fa.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=Ca.alloc?Ca.alloc(20):new Ca(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};var Ya=Fa,Za={},Xa={get exports(){return Za},set exports(t){Za=t}},Qa=fo.Buffer;function Ja(t,e){this._block=Qa.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}Ja.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=Qa.from(t,e));for(var r=this._block,i=this._blockSize,n=t.length,o=this._len,s=0;s<n;){for(var a=o%i,h=Math.min(n-s,i-a),u=0;u<h;u++)r[a+u]=t[s+u];s+=h,(o+=h)%i==0&&this._update(r)}return this._len+=n,this},Ja.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=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},Ja.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var $a=Ja,th=bo,eh=$a,rh=fo.Buffer,ih=[1518500249,1859775393,-1894007588,-899497514],nh=new Array(80);function oh(){this.init(),this._w=nh,eh.call(this,64,56)}function sh(t){return t<<30|t>>>2}function ah(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}th(oh,eh),oh.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},oh.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,h=0;h<16;++h)r[h]=t.readInt32BE(4*h);for(;h<80;++h)r[h]=r[h-3]^r[h-8]^r[h-14]^r[h-16];for(var u=0;u<80;++u){var f=~~(u/20),l=0|((e=i)<<5|e>>>27)+ah(f,n,o,s)+a+r[u]+ih[f];a=s,s=o,o=sh(n),n=i,i=l}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},oh.prototype._hash=function(){var t=rh.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};var hh=oh,uh=bo,fh=$a,lh=fo.Buffer,ch=[1518500249,1859775393,-1894007588,-899497514],dh=new Array(80);function ph(){this.init(),this._w=dh,fh.call(this,64,56)}function mh(t){return t<<5|t>>>27}function gh(t){return t<<30|t>>>2}function yh(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}uh(ph,fh),ph.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},ph.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,h=0;h<16;++h)r[h]=t.readInt32BE(4*h);for(;h<80;++h)r[h]=(e=r[h-3]^r[h-8]^r[h-14]^r[h-16])<<1|e>>>31;for(var u=0;u<80;++u){var f=~~(u/20),l=mh(i)+yh(f,n,o,s)+a+r[u]+ch[f]|0;a=s,s=o,o=gh(n),n=i,i=l}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},ph.prototype._hash=function(){var t=lh.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};var bh=ph,vh=bo,wh=$a,_h=fo.Buffer,Mh=[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],Sh=new Array(64);function Eh(){this.init(),this._w=Sh,wh.call(this,64,56)}function kh(t,e,r){return r^t&(e^r)}function Ah(t,e,r){return t&e|r&(t|e)}function Oh(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function Th(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function Ih(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}vh(Eh,wh),Eh.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},Eh.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,h=0|this._f,u=0|this._g,f=0|this._h,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<64;++l)r[l]=0|(((e=r[l-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[l-7]+Ih(r[l-15])+r[l-16];for(var c=0;c<64;++c){var d=f+Th(a)+kh(a,h,u)+Mh[c]+r[c]|0,p=Oh(i)+Ah(i,n,o)|0;f=u,u=h,h=a,a=s+d|0,s=o,o=n,n=i,i=d+p|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=h+this._f|0,this._g=u+this._g|0,this._h=f+this._h|0},Eh.prototype._hash=function(){var t=_h.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};var Rh=Eh,Ch=bo,Ph=Rh,xh=$a,Nh=fo.Buffer,Bh=new Array(64);function Lh(){this.init(),this._w=Bh,xh.call(this,64,56)}Ch(Lh,Ph),Lh.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},Lh.prototype._hash=function(){var t=Nh.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};var Dh=Lh,jh=bo,Uh=$a,qh=fo.Buffer,Fh=[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],zh=new Array(160);function Hh(){this.init(),this._w=zh,Uh.call(this,128,112)}function Kh(t,e,r){return r^t&(e^r)}function Vh(t,e,r){return t&e|r&(t|e)}function Gh(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function Wh(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function Yh(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function Zh(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function Xh(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function Qh(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function Jh(t,e){return t>>>0<e>>>0?1:0}jh(Hh,Uh),Hh.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},Hh.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,s=0|this._eh,a=0|this._fh,h=0|this._gh,u=0|this._hh,f=0|this._al,l=0|this._bl,c=0|this._cl,d=0|this._dl,p=0|this._el,m=0|this._fl,g=0|this._gl,y=0|this._hl,b=0;b<32;b+=2)e[b]=t.readInt32BE(4*b),e[b+1]=t.readInt32BE(4*b+4);for(;b<160;b+=2){var v=e[b-30],w=e[b-30+1],_=Yh(v,w),M=Zh(w,v),S=Xh(v=e[b-4],w=e[b-4+1]),E=Qh(w,v),k=e[b-14],A=e[b-14+1],O=e[b-32],T=e[b-32+1],I=M+A|0,R=_+k+Jh(I,M)|0;R=(R=R+S+Jh(I=I+E|0,E)|0)+O+Jh(I=I+T|0,T)|0,e[b]=R,e[b+1]=I}for(var C=0;C<160;C+=2){R=e[C],I=e[C+1];var P=Vh(r,i,n),x=Vh(f,l,c),N=Gh(r,f),B=Gh(f,r),L=Wh(s,p),D=Wh(p,s),j=Fh[C],U=Fh[C+1],q=Kh(s,a,h),F=Kh(p,m,g),z=y+D|0,H=u+L+Jh(z,y)|0;H=(H=(H=H+q+Jh(z=z+F|0,F)|0)+j+Jh(z=z+U|0,U)|0)+R+Jh(z=z+I|0,I)|0;var K=B+x|0,V=N+P+Jh(K,B)|0;u=h,y=g,h=a,g=m,a=s,m=p,s=o+H+Jh(p=d+z|0,d)|0,o=n,d=c,n=i,c=l,i=r,l=f,r=H+V+Jh(f=z+K|0,z)|0}this._al=this._al+f|0,this._bl=this._bl+l|0,this._cl=this._cl+c|0,this._dl=this._dl+d|0,this._el=this._el+p|0,this._fl=this._fl+m|0,this._gl=this._gl+g|0,this._hl=this._hl+y|0,this._ah=this._ah+r+Jh(this._al,f)|0,this._bh=this._bh+i+Jh(this._bl,l)|0,this._ch=this._ch+n+Jh(this._cl,c)|0,this._dh=this._dh+o+Jh(this._dl,d)|0,this._eh=this._eh+s+Jh(this._el,p)|0,this._fh=this._fh+a+Jh(this._fl,m)|0,this._gh=this._gh+h+Jh(this._gl,g)|0,this._hh=this._hh+u+Jh(this._hl,y)|0},Hh.prototype._hash=function(){var t=qh.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};var $h=Hh,tu=bo,eu=$h,ru=$a,iu=fo.Buffer,nu=new Array(160);function ou(){this.init(),this._w=nu,ru.call(this,128,112)}tu(ou,eu),ou.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},ou.prototype._hash=function(){var t=iu.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};var su=ou,au=Xa.exports=function(t){t=t.toLowerCase();var e=au[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};function hu(){this.head=null,this.tail=null,this.length=0}au.sha=hh,au.sha1=bh,au.sha224=Dh,au.sha256=Rh,au.sha384=su,au.sha512=$h,hu.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},hu.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},hu.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}},hu.prototype.clear=function(){this.head=this.tail=null,this.length=0},hu.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},hu.prototype.concat=function(t){if(0===this.length)return sr.alloc(0);if(1===this.length)return this.head.data;for(var e=sr.allocUnsafe(t>>>0),r=this.head,i=0;r;)r.data.copy(e,i),i+=r.data.length,r=r.next;return e};var uu=sr.isEncoding||function(t){switch(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 fu(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),function(t){if(t&&!uu(t))throw new Error("Unknown encoding: "+t)}(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=cu;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=du;break;default:return void(this.write=lu)}this.charBuffer=new sr(6),this.charReceived=0,this.charLength=0}function lu(t){return t.toString(this.encoding)}function cu(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function du(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}fu.prototype.write=function(t){for(var e="";this.charLength;){var r=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived<this.charLength)return"";if(t=t.slice(r,t.length),!((n=(e=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(e.length-1))>=55296&&n<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var i=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,i),i-=this.charReceived);var n;i=(e+=t.toString(this.encoding,0,i)).length-1;if((n=e.charCodeAt(i))>=55296&&n<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,i)}return e},fu.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var r=t[t.length-e];if(1==e&&r>>5==6){this.charLength=2;break}if(e<=2&&r>>4==14){this.charLength=3;break}if(e<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=e},fu.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var r=this.charReceived,i=this.charBuffer,n=this.encoding;e+=i.slice(0,r).toString(n)}return e};var pu=Object.freeze({__proto__:null,StringDecoder:fu});yu.ReadableState=gu;var mu=Do("stream");function gu(t,e){t=t||{},this.objectMode=!!t.objectMode,e instanceof Vu&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=~~this.highWaterMark,this.buffer=new hu,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.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(this.decoder=new fu(t.encoding),this.encoding=t.encoding)}function yu(t){if(!(this instanceof yu))return new yu(t);this._readableState=new gu(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),So.call(this)}function bu(t,e,r,i,n){var o=function(t,e){var r=null;sr.isBuffer(e)||"string"==typeof e||null==e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(e,r);if(o)t.emit("error",o);else if(null===r)e.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,_u(t)}(t,e);else if(e.objectMode||r&&r.length>0)if(e.ended&&!n){var s=new Error("stream.push() after EOF");t.emit("error",s)}else if(e.endEmitted&&n){var a=new Error("stream.unshift() after end event");t.emit("error",a)}else{var h;!e.decoder||n||i||(r=e.decoder.write(r),h=!e.objectMode&&0===r.length),n||(e.reading=!1),h||(e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&_u(t))),function(t,e){e.readingMore||(e.readingMore=!0,Gn(Su,t,e))}(t,e)}else n||(e.reading=!1);return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(e)}Co(yu,So),yu.prototype.push=function(t,e){var r=this._readableState;return r.objectMode||"string"!=typeof t||(e=e||r.defaultEncoding)!==r.encoding&&(t=sr.from(t,e),e=""),bu(this,r,t,e,!1)},yu.prototype.unshift=function(t){return bu(this,this._readableState,t,"",!0)},yu.prototype.isPaused=function(){return!1===this._readableState.flowing},yu.prototype.setEncoding=function(t){return this._readableState.decoder=new fu(t),this._readableState.encoding=t,this};var vu=8388608;function wu(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=vu?t=vu:(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 _u(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(mu("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?Gn(Mu,t):Mu(t))}function Mu(t){mu("emit readable"),t.emit("readable"),Au(t)}function Su(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(mu("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function Eu(t){mu("readable nexttick read 0"),t.read(0)}function ku(t,e){e.reading||(mu("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),Au(t),e.flowing&&!e.reading&&t.read(0)}function Au(t){var e=t._readableState;for(mu("flow",e.flowing);e.flowing&&null!==t.read(););}function Ou(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.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;t<e.head.data.length?(i=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):i=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,i=1,n=r.data;t-=n.length;for(;r=r.next;){var o=r.data,s=t>o.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=sr.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 Tu(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,Gn(Iu,e,t))}function Iu(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function Ru(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}function Cu(){}function Pu(t,e,r){this.chunk=t,this.encoding=e,this.callback=r,this.next=null}function xu(t,e){Object.defineProperty(this,"buffer",{get:No((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),t=t||{},this.objectMode=!!t.objectMode,e instanceof Vu&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var r=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var n=!1===t.decodeStrings;this.decodeStrings=!n,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?Gn(n,i):n(i);t._writableState.errorEmitted=!0,t.emit("error",i)}(t,r,i,e,n);else{var o=ju(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||Du(t,r),i?Gn(Lu,t,r,o,n):Lu(t,r,o,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 Fu(this)}function Nu(t){if(!(this instanceof Nu||this instanceof Vu))return new Nu(t);this._writableState=new xu(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev)),So.call(this)}function Bu(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 Lu(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),qu(t,e)}function Du(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 s=0;r;)n[s]=r,r=r.next,s+=1;Bu(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 Fu(e)}else{for(;r;){var a=r.chunk,h=r.encoding,u=r.callback;if(Bu(t,e,!1,e.objectMode?1:a.length,a,h,u),r=r.next,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequestCount=0,e.bufferedRequest=r,e.bufferProcessing=!1}function ju(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function Uu(t,e){e.prefinished||(e.prefinished=!0,t.emit("prefinish"))}function qu(t,e){var r=ju(e);return r&&(0===e.pendingcb?(Uu(t,e),e.finished=!0,t.emit("finish")):Uu(t,e)),r}function Fu(t){var e=this;this.next=null,this.entry=null,this.finish=function(r){var i=e.entry;for(e.entry=null;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}}yu.prototype.read=function(t){mu("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return mu("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?Tu(this):_u(this),null;if(0===(t=wu(t,e))&&e.ended)return 0===e.length&&Tu(this),null;var i,n=e.needReadable;return mu("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&mu("length less than watermark",n=!0),e.ended||e.reading?mu("reading or ended",n=!1):n&&(mu("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=wu(r,e))),null===(i=t>0?Ou(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Tu(this)),null!==i&&this.emit("data",i),i},yu.prototype._read=function(t){this.emit("error",new Error("not implemented"))},yu.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,mu("pipe count=%d opts=%j",i.pipesCount,e);var n=!e||!1!==e.end?s:u;function o(t){mu("onunpipe"),t===r&&u()}function s(){mu("onend"),t.end()}i.endEmitted?Gn(n):r.once("end",n),t.on("unpipe",o);var a=function(t){return function(){var e=t._readableState;mu("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&t.listeners("data").length&&(e.flowing=!0,Au(t))}}(r);t.on("drain",a);var h=!1;function u(){mu("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",a),t.removeListener("error",c),t.removeListener("unpipe",o),r.removeListener("end",s),r.removeListener("end",u),r.removeListener("data",l),h=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||a()}var f=!1;function l(e){mu("ondata"),f=!1,!1!==t.write(e)||f||((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==Ru(i.pipes,t))&&!h&&(mu("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,f=!0),r.pause())}function c(e){var r;mu("onerror",e),m(),t.removeListener("error",c),0===(r="error",t.listeners(r).length)&&t.emit("error",e)}function d(){t.removeListener("finish",p),m()}function p(){mu("onfinish"),t.removeListener("close",d),m()}function m(){mu("unpipe"),r.unpipe(t)}return r.on("data",l),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",c),t.once("close",d),t.once("finish",p),t.emit("pipe",r),i.flowing||(mu("pipe resume"),r.resume()),t},yu.prototype.unpipe=function(t){var e=this._readableState;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)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var n=0;n<i;n++)r[n].emit("unpipe",this);return this}var o=Ru(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this)),this},yu.prototype.on=function(t,e){var r=So.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&_u(this):Gn(Eu,this))}return r},yu.prototype.addListener=yu.prototype.on,yu.prototype.resume=function(){var t=this._readableState;return t.flowing||(mu("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Gn(ku,t,e))}(this,t)),this},yu.prototype.pause=function(){return mu("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(mu("pause"),this._readableState.flowing=!1,this.emit("pause")),this},yu.prototype.wrap=function(t){var e=this._readableState,r=!1,i=this;for(var n in t.on("end",(function(){if(mu("wrapped end"),e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&i.push(t)}i.push(null)})),t.on("data",(function(n){(mu("wrapped data"),e.decoder&&(n=e.decoder.write(n)),e.objectMode&&null==n)||(e.objectMode||n&&n.length)&&(i.push(n)||(r=!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));return function(t,e){for(var r=0,i=t.length;r<i;r++)e(t[r],r)}(["error","close","destroy","pause","resume"],(function(e){t.on(e,i.emit.bind(i,e))})),i._read=function(e){mu("wrapped _read",e),r&&(r=!1,t.resume())},i},yu._fromList=Ou,Nu.WritableState=xu,Co(Nu,So),xu.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},Nu.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Nu.prototype.write=function(t,e,r){var i=this._writableState,n=!1;return"function"==typeof e&&(r=e,e=null),sr.isBuffer(t)?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=Cu),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),Gn(e,r)}(this,r):function(t,e,r,i){var n=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):sr.isBuffer(r)||"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),Gn(i,o),n=!1),n}(this,i,t,r)&&(i.pendingcb++,n=function(t,e,r,i,n){r=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=sr.from(e,r));return e}(e,r,i),sr.isBuffer(r)&&(i="buffer");var o=e.objectMode?1:r.length;e.length+=o;var s=e.length<e.highWaterMark;s||(e.needDrain=!0);if(e.writing||e.corked){var a=e.lastBufferedRequest;e.lastBufferedRequest=new Pu(r,i,n),a?a.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else Bu(t,e,!1,o,r,i,n);return s}(this,i,t,e,r)),n},Nu.prototype.cork=function(){this._writableState.corked++},Nu.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||Du(this,t))},Nu.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Nu.prototype._write=function(t,e,r){r(new Error("not implemented"))},Nu.prototype._writev=null,Nu.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,qu(t,e),r&&(e.finished?Gn(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r)},Co(Vu,yu);for(var zu=Object.keys(Nu.prototype),Hu=0;Hu<zu.length;Hu++){var Ku=zu[Hu];Vu.prototype[Ku]||(Vu.prototype[Ku]=Nu.prototype[Ku])}function Vu(t){if(!(this instanceof Vu))return new Vu(t);yu.call(this,t),Nu.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",Gu)}function Gu(){this.allowHalfOpen||this._writableState.ended||Gn(Wu,this)}function Wu(t){t.end()}function Yu(t){this.afterTransform=function(e,r){return function(t,e,r){var i=t._transformState;i.transforming=!1;var n=i.writecb;if(!n)return t.emit("error",new Error("no writecb in Transform class"));i.writechunk=null,i.writecb=null,null!=r&&t.push(r);n(e);var o=t._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&t._read(o.highWaterMark)}(t,e,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Zu(t){if(!(this instanceof Zu))return new Zu(t);Vu.call(this,t),this._transformState=new Yu(this);var e=this;this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(t){Xu(e,t)})):Xu(e)}))}function Xu(t,e){if(e)return t.emit("error",e);var r=t._writableState,i=t._transformState;if(r.length)throw new Error("Calling transform done when ws.length != 0");if(i.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}function Qu(t){if(!(this instanceof Qu))return new Qu(t);Zu.call(this,t)}function Ju(){So.call(this)}Co(Zu,Vu),Zu.prototype.push=function(t,e){return this._transformState.needTransform=!1,Vu.prototype.push.call(this,t,e)},Zu.prototype._transform=function(t,e,r){throw new Error("Not implemented")},Zu.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},Zu.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},Co(Qu,Zu),Qu.prototype._transform=function(t,e,r){r(null,t)},Co(Ju,So),Ju.Readable=yu,Ju.Writable=Nu,Ju.Duplex=Vu,Ju.Transform=Zu,Ju.PassThrough=Qu,Ju.Stream=Ju,Ju.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function n(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",n),t._isStdio||e&&!1===e.end||(r.on("end",s),r.on("close",a));var o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function h(t){if(u(),0===So.listenerCount(this,"error"))throw t}function u(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",h),t.removeListener("error",h),r.removeListener("end",u),r.removeListener("close",u),t.removeListener("close",u)}return r.on("error",h),t.on("error",h),r.on("end",u),r.on("close",u),t.on("close",u),t.emit("pipe",r),t};var $u=X(Object.freeze({__proto__:null,Duplex:Vu,PassThrough:Qu,Readable:yu,Stream:Ju,Transform:Zu,Writable:Nu,default:Ju})),tf=X(pu),ef=fo.Buffer,rf=$u.Transform,nf=tf.StringDecoder;function of(t){rf.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}bo(of,rf),of.prototype.update=function(t,e,r){"string"==typeof t&&(t=ef.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},of.prototype.setAutoPadding=function(){},of.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},of.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},of.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},of.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)}},of.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},of.prototype._finalOrDigest=function(t){var e=this.__final()||ef.alloc(0);return t&&(e=this._toString(e,t,!0)),e},of.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new nf(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};var sf=of,af=Ra,hf=Ya,uf=Za,ff=sf;function lf(t){ff.call(this,"digest"),this._hash=t}bo(lf,ff),lf.prototype._update=function(t){this._hash.update(t)},lf.prototype._final=function(){return this._hash.digest()};var cf=function(t){return"md5"===(t=t.toLowerCase())?new af:"rmd160"===t||"ripemd160"===t?new hf:new lf(uf(t))},df=bo,pf=fo.Buffer,mf=sf,gf=pf.alloc(128),yf=64;function bf(t,e){mf.call(this,"digest"),"string"==typeof e&&(e=pf.from(e)),this._alg=t,this._key=e,e.length>yf?e=t(e):e.length<yf&&(e=pf.concat([e,gf],yf));for(var r=this._ipad=pf.allocUnsafe(yf),i=this._opad=pf.allocUnsafe(yf),n=0;n<yf;n++)r[n]=54^e[n],i[n]=92^e[n];this._hash=[r]}df(bf,mf),bf.prototype._update=function(t){this._hash.push(t)},bf.prototype._final=function(){var t=this._alg(pf.concat(this._hash));return this._alg(pf.concat([this._opad,t]))};var vf=Ra,wf=function(t){return(new vf).update(t).digest()},_f=bo,Mf=bf,Sf=sf,Ef=fo.Buffer,kf=wf,Af=Ya,Of=Za,Tf=Ef.alloc(128);function If(t,e){Sf.call(this,"digest"),"string"==typeof e&&(e=Ef.from(e));var r="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=e,e.length>r)?e=("rmd160"===t?new Af:Of(t)).update(e).digest():e.length<r&&(e=Ef.concat([e,Tf],r));for(var i=this._ipad=Ef.allocUnsafe(r),n=this._opad=Ef.allocUnsafe(r),o=0;o<r;o++)i[o]=54^e[o],n[o]=92^e[o];this._hash="rmd160"===t?new Af:Of(t),this._hash.update(i)}_f(If,Sf),If.prototype._update=function(t){this._hash.update(t)},If.prototype._final=function(){var t=this._hash.digest();return("rmd160"===this._alg?new Af:Of(this._alg)).update(this._opad).update(t).digest()};var Rf=function(t,e){return"rmd160"===(t=t.toLowerCase())||"ripemd160"===t?new If("rmd160",e):"md5"===t?new Mf(kf,e):new If(t,e)},Cf={},Pf={get exports(){return Cf},set exports(t){Cf=t}};var xf={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};Pf.exports=xf;var Nf,Bf={},Lf=Math.pow(2,30)-1,Df=function(t,e){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof e)throw new TypeError("Key length not a number");if(e<0||e>Lf||e!=e)throw new TypeError("Bad key length")};if(Y.process&&Y.process.browser)Nf="utf-8";else if(Y.process&&Y.process.version){Nf=parseInt(oo.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else Nf="utf-8";var jf=Nf,Uf=fo.Buffer,qf=function(t,e,r){if(Uf.isBuffer(t))return t;if("string"==typeof t)return Uf.from(t,e);if(ArrayBuffer.isView(t))return Uf.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")},Ff=wf,zf=Ya,Hf=Za,Kf=fo.Buffer,Vf=Df,Gf=jf,Wf=qf,Yf=Kf.alloc(128),Zf={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Xf(t,e,r){var i=function(t){function e(e){return Hf(t).update(e).digest()}function r(t){return(new zf).update(t).digest()}return"rmd160"===t||"ripemd160"===t?r:"md5"===t?Ff:e}(t),n="sha512"===t||"sha384"===t?128:64;e.length>n?e=i(e):e.length<n&&(e=Kf.concat([e,Yf],n));for(var o=Kf.allocUnsafe(n+Zf[t]),s=Kf.allocUnsafe(n+Zf[t]),a=0;a<n;a++)o[a]=54^e[a],s[a]=92^e[a];var h=Kf.allocUnsafe(n+r+4);o.copy(h,0,0,n),this.ipad1=h,this.ipad2=o,this.opad=s,this.alg=t,this.blocksize=n,this.hash=i,this.size=Zf[t]}Xf.prototype.run=function(t,e){return t.copy(e,this.blocksize),this.hash(e).copy(this.opad,this.blocksize),this.hash(this.opad)};var Qf,Jf,$f=function(t,e,r,i,n){Vf(r,i);var o=new Xf(n=n||"sha1",t=Wf(t,Gf,"Password"),(e=Wf(e,Gf,"Salt")).length),s=Kf.allocUnsafe(i),a=Kf.allocUnsafe(e.length+4);e.copy(a,0,0,e.length);for(var h=0,u=Zf[n],f=Math.ceil(i/u),l=1;l<=f;l++){a.writeUInt32BE(l,e.length);for(var c=o.run(a,o.ipad1),d=c,p=1;p<r;p++){d=o.run(d,o.ipad2);for(var m=0;m<u;m++)c[m]^=d[m]}c.copy(s,h),h+=u}return s},tl=fo.Buffer,el=Df,rl=jf,il=$f,nl=qf,ol=Y.crypto&&Y.crypto.subtle,sl={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"},al=[];function hl(){return Jf||(Jf=Y.process&&Y.process.nextTick?Y.process.nextTick:Y.queueMicrotask?Y.queueMicrotask:Y.setImmediate?Y.setImmediate:Y.setTimeout)}function ul(t,e,r,i,n){return ol.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return ol.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:n}},t,i<<3)})).then((function(t){return tl.from(t)}))}Bf.pbkdf2=function(t,e,r,i,n,o){"function"==typeof n&&(o=n,n=void 0);var s=sl[(n=n||"sha1").toLowerCase()];if(s&&"function"==typeof Y.Promise){if(el(r,i),t=nl(t,rl,"Password"),e=nl(e,rl,"Salt"),"function"!=typeof o)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){hl()((function(){e(null,t)}))}),(function(t){hl()((function(){e(t)}))}))}(function(t){if(Y.process&&!Y.process.browser)return Promise.resolve(!1);if(!ol||!ol.importKey||!ol.deriveBits)return Promise.resolve(!1);if(void 0!==al[t])return al[t];var e=ul(Qf=Qf||tl.alloc(8),Qf,10,128,t).then((function(){return!0})).catch((function(){return!1}));return al[t]=e,e}(s).then((function(o){return o?ul(t,e,r,i,s):il(t,e,r,i,n)})),o)}else hl()((function(){var s;try{s=il(t,e,r,i,n)}catch(t){return o(t)}o(null,s)}))},Bf.pbkdf2Sync=$f;var fl={},ll={},cl={readUInt32BE:function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},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},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},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},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},r28shl:function(t,e){return t<<e&268435455|t>>>28-e}},dl=[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];cl.pc2=function(t,e,r,i){for(var n=0,o=0,s=dl.length>>>1,a=0;a<s;a++)n<<=1,n|=t>>>dl[a]&1;for(a=s;a<dl.length;a++)o<<=1,o|=e>>>dl[a]&1;r[i+0]=n>>>0,r[i+1]=o>>>0},cl.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 pl=[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];cl.substitute=function(t,e){for(var r=0,i=0;i<4;i++){r<<=4,r|=pl[64*i+(t>>>18-6*i&63)]}for(i=0;i<4;i++){r<<=4,r|=pl[256+64*i+(e>>>18-6*i&63)]}return r>>>0};var ml=[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];cl.permute=function(t){for(var e=0,r=0;r<ml.length;r++)e<<=1,e|=t>>>ml[r]&1;return e>>>0},cl.padSplit=function(t,e,r){for(var i=t.toString(2);i.length<e;)i="0"+i;for(var n=[],o=0;o<e;o+=r)n.push(i.slice(o,o+r));return n.join(" ")};var gl=yl;function yl(t,e){if(!t)throw new Error(e||"Assertion failed")}yl.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var bl=gl;function vl(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==t.padding}var wl=vl;vl.prototype._init=function(){},vl.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},vl.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),i=0;i<r;i++)this.buffer[this.bufferOff+i]=t[e+i];return this.bufferOff+=r,r},vl.prototype._flushBuffer=function(t,e){return this._update(this.buffer,0,t,e),this.bufferOff=0,this.blockSize},vl.prototype._updateEncrypt=function(t){var e=0,r=0,i=(this.bufferOff+t.length)/this.blockSize|0,n=new Array(i*this.blockSize);0!==this.bufferOff&&(e+=this._buffer(t,e),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(n,r)));for(var o=t.length-(t.length-e)%this.blockSize;e<o;e+=this.blockSize)this._update(t,e,n,r),r+=this.blockSize;for(;e<t.length;e++,this.bufferOff++)this.buffer[this.bufferOff]=t[e];return n},vl.prototype._updateDecrypt=function(t){for(var e=0,r=0,i=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,n=new Array(i*this.blockSize);i>0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(n,r);return e+=this._buffer(t,e),n},vl.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},vl.prototype._pad=function(t,e){if(0===e)return!1;for(;e<t.length;)t[e++]=0;return!0},vl.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t},vl.prototype._unpad=function(t){return t},vl.prototype._finalDecrypt=function(){bl.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)};var _l=gl,Ml=cl,Sl=wl;function El(){this.tmp=new Array(2),this.keys=null}function kl(t){Sl.call(this,t);var e=new El;this._desState=e,this.deriveKeys(e,t.key)}bo(kl,Sl);var Al=kl;kl.create=function(t){return new kl(t)};var Ol=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];kl.prototype.deriveKeys=function(t,e){t.keys=new Array(32),_l.equal(e.length,this.blockSize,"Invalid key length");var r=Ml.readUInt32BE(e,0),i=Ml.readUInt32BE(e,4);Ml.pc1(r,i,t.tmp,0),r=t.tmp[0],i=t.tmp[1];for(var n=0;n<t.keys.length;n+=2){var o=Ol[n>>>1];r=Ml.r28shl(r,o),i=Ml.r28shl(i,o),Ml.pc2(r,i,t.keys,n)}},kl.prototype._update=function(t,e,r,i){var n=this._desState,o=Ml.readUInt32BE(t,e),s=Ml.readUInt32BE(t,e+4);Ml.ip(o,s,n.tmp,0),o=n.tmp[0],s=n.tmp[1],"encrypt"===this.type?this._encrypt(n,o,s,n.tmp,0):this._decrypt(n,o,s,n.tmp,0),o=n.tmp[0],s=n.tmp[1],Ml.writeUInt32BE(r,o,i),Ml.writeUInt32BE(r,s,i+4)},kl.prototype._pad=function(t,e){if(!1===this.padding)return!1;for(var r=t.length-e,i=e;i<t.length;i++)t[i]=r;return!0},kl.prototype._unpad=function(t){if(!1===this.padding)return t;for(var e=t[t.length-1],r=t.length-e;r<t.length;r++)_l.equal(t[r],e);return t.slice(0,t.length-e)},kl.prototype._encrypt=function(t,e,r,i,n){for(var o=e,s=r,a=0;a<t.keys.length;a+=2){var h=t.keys[a],u=t.keys[a+1];Ml.expand(s,t.tmp,0),h^=t.tmp[0],u^=t.tmp[1];var f=Ml.substitute(h,u),l=s;s=(o^Ml.permute(f))>>>0,o=l}Ml.rip(s,o,i,n)},kl.prototype._decrypt=function(t,e,r,i,n){for(var o=r,s=e,a=t.keys.length-2;a>=0;a-=2){var h=t.keys[a],u=t.keys[a+1];Ml.expand(o,t.tmp,0),h^=t.tmp[0],u^=t.tmp[1];var f=Ml.substitute(h,u),l=o;o=(s^Ml.permute(f))>>>0,s=l}Ml.rip(o,s,i,n)};var Tl={},Il=gl,Rl=bo,Cl={};function Pl(t){Il.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e<this.iv.length;e++)this.iv[e]=t[e]}Tl.instantiate=function(t){function e(e){t.call(this,e),this._cbcInit()}Rl(e,t);for(var r=Object.keys(Cl),i=0;i<r.length;i++){var n=r[i];e.prototype[n]=Cl[n]}return e.create=function(t){return new e(t)},e},Cl._cbcInit=function(){var t=new Pl(this.options.iv);this._cbcState=t},Cl._update=function(t,e,r,i){var n=this._cbcState,o=this.constructor.super_.prototype,s=n.iv;if("encrypt"===this.type){for(var a=0;a<this.blockSize;a++)s[a]^=t[e+a];o._update.call(this,s,0,r,i);for(a=0;a<this.blockSize;a++)s[a]=r[i+a]}else{o._update.call(this,t,e,r,i);for(a=0;a<this.blockSize;a++)r[i+a]^=s[a];for(a=0;a<this.blockSize;a++)s[a]=t[e+a]}};var xl=gl,Nl=wl,Bl=Al;function Ll(t,e){xl.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),i=e.slice(8,16),n=e.slice(16,24);this.ciphers="encrypt"===t?[Bl.create({type:"encrypt",key:r}),Bl.create({type:"decrypt",key:i}),Bl.create({type:"encrypt",key:n})]:[Bl.create({type:"decrypt",key:n}),Bl.create({type:"encrypt",key:i}),Bl.create({type:"decrypt",key:r})]}function Dl(t){Nl.call(this,t);var e=new Ll(this.type,this.options.key);this._edeState=e}bo(Dl,Nl);var jl=Dl;Dl.create=function(t){return new Dl(t)},Dl.prototype._update=function(t,e,r,i){var n=this._edeState;n.ciphers[0]._update(t,e,r,i),n.ciphers[1]._update(r,i,r,i),n.ciphers[2]._update(r,i,r,i)},Dl.prototype._pad=Bl.prototype._pad,Dl.prototype._unpad=Bl.prototype._unpad,ll.utils=cl,ll.Cipher=wl,ll.DES=Al,ll.CBC=Tl,ll.EDE=jl;var Ul=sf,ql=ll,Fl=bo,zl=fo.Buffer,Hl={"des-ede3-cbc":ql.CBC.instantiate(ql.EDE),"des-ede3":ql.EDE,"des-ede-cbc":ql.CBC.instantiate(ql.EDE),"des-ede":ql.EDE,"des-cbc":ql.CBC.instantiate(ql.DES),"des-ecb":ql.DES};Hl.des=Hl["des-cbc"],Hl.des3=Hl["des-ede3-cbc"];var Kl=Vl;function Vl(t){Ul.call(this);var e,r=t.mode.toLowerCase(),i=Hl[r];e=t.decrypt?"decrypt":"encrypt";var n=t.key;zl.isBuffer(n)||(n=zl.from(n)),"des-ede"!==r&&"des-ede-cbc"!==r||(n=zl.concat([n,n.slice(0,8)]));var o=t.iv;zl.isBuffer(o)||(o=zl.from(o)),this._des=i.create({key:n,iv:o,type:e})}Fl(Vl,Ul),Vl.prototype._update=function(t){return zl.from(this._des.update(t))},Vl.prototype._final=function(){return zl.from(this._des.final())};var Gl={},Wl={},Yl={encrypt:function(t,e){return t._cipher.encryptBlock(e)},decrypt:function(t,e){return t._cipher.decryptBlock(e)}},Zl={},Xl=function(t,e){for(var r=Math.min(t.length,e.length),i=new sr(r),n=0;n<r;++n)i[n]=t[n]^e[n];return i},Ql=Xl;Zl.encrypt=function(t,e){var r=Ql(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},Zl.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return Ql(i,r)};var Jl={},$l=fo.Buffer,tc=Xl;function ec(t,e,r){var i=e.length,n=tc(e,t._cache);return t._cache=t._cache.slice(i),t._prev=$l.concat([t._prev,r?e:n]),n}Jl.encrypt=function(t,e,r){for(var i,n=$l.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=$l.allocUnsafe(0)),!(t._cache.length<=e.length)){n=$l.concat([n,ec(t,e,r)]);break}i=t._cache.length,n=$l.concat([n,ec(t,e.slice(0,i),r)]),e=e.slice(i)}return n};var rc={},ic=fo.Buffer;function nc(t,e,r){var i=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=ic.concat([t._prev.slice(1),ic.from([r?e:i])]),i}rc.encrypt=function(t,e,r){for(var i=e.length,n=ic.allocUnsafe(i),o=-1;++o<i;)n[o]=nc(t,e[o],r);return n};var oc={},sc=fo.Buffer;function ac(t,e,r){for(var i,n,o=-1,s=0;++o<8;)i=e&1<<7-o?128:0,s+=(128&(n=t._cipher.encryptBlock(t._prev)[0]^i))>>o%8,t._prev=hc(t._prev,r?i:n);return s}function hc(t,e){var r=t.length,i=-1,n=sc.allocUnsafe(t.length);for(t=sc.concat([t,sc.from([e])]);++i<r;)n[i]=t[i]<<1|t[i+1]>>7;return n}oc.encrypt=function(t,e,r){for(var i=e.length,n=sc.allocUnsafe(i),o=-1;++o<i;)n[o]=ac(t,e[o],r);return n};var uc={},fc=Xl;function lc(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}uc.encrypt=function(t,e){for(;t._cache.length<e.length;)t._cache=sr.concat([t._cache,lc(t)]);var r=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),fc(e,r)};var cc={};var dc=function(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}},pc=Xl,mc=fo.Buffer,gc=dc;function yc(t){var e=t._cipher.encryptBlockRaw(t._prev);return gc(t._prev),e}cc.encrypt=function(t,e){var r=Math.ceil(e.length/16),i=t._cache.length;t._cache=mc.concat([t._cache,mc.allocUnsafe(16*r)]);for(var n=0;n<r;n++){var o=yc(t),s=i+16*n;t._cache.writeUInt32BE(o[0],s+0),t._cache.writeUInt32BE(o[1],s+4),t._cache.writeUInt32BE(o[2],s+8),t._cache.writeUInt32BE(o[3],s+12)}var a=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),pc(e,a)};var bc={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},vc={ECB:Yl,CBC:Zl,CFB:Jl,CFB8:rc,CFB1:oc,OFB:uc,CTR:cc,GCM:cc},wc=bc;for(var _c in wc)wc[_c].module=vc[wc[_c].mode];var Mc=wc,Sc={},Ec=fo.Buffer;function kc(t){Ec.isBuffer(t)||(t=Ec.from(t));for(var e=t.length/4|0,r=new Array(e),i=0;i<e;i++)r[i]=t.readUInt32BE(4*i);return r}function Ac(t){for(;0<t.length;t++)t[0]=0}function Oc(t,e,r,i,n){for(var o,s,a,h,u=r[0],f=r[1],l=r[2],c=r[3],d=t[0]^e[0],p=t[1]^e[1],m=t[2]^e[2],g=t[3]^e[3],y=4,b=1;b<n;b++)o=u[d>>>24]^f[p>>>16&255]^l[m>>>8&255]^c[255&g]^e[y++],s=u[p>>>24]^f[m>>>16&255]^l[g>>>8&255]^c[255&d]^e[y++],a=u[m>>>24]^f[g>>>16&255]^l[d>>>8&255]^c[255&p]^e[y++],h=u[g>>>24]^f[d>>>16&255]^l[p>>>8&255]^c[255&m]^e[y++],d=o,p=s,m=a,g=h;return o=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&g])^e[y++],s=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[g>>>8&255]<<8|i[255&d])^e[y++],a=(i[m>>>24]<<24|i[g>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[y++],h=(i[g>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[y++],[o>>>=0,s>>>=0,a>>>=0,h>>>=0]}var Tc=[0,1,2,4,8,16,32,64,128,27,54],Ic=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,h=0;h<256;++h){var u=a^a<<1^a<<2^a<<3^a<<4;u=u>>>8^255&u^99,r[s]=u,i[u]=s;var f=t[s],l=t[f],c=t[l],d=257*t[u]^16843008*u;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][u]=d<<24|d>>>8,o[1][u]=d<<16|d>>>16,o[2][u]=d<<8|d>>>24,o[3][u]=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 Rc(t){this._key=kc(t),this._reset()}Rc.blockSize=16,Rc.keySize=32,Rc.prototype.blockSize=Rc.blockSize,Rc.prototype.keySize=Rc.keySize,Rc.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],o=0;o<e;o++)n[o]=t[o];for(o=e;o<i;o++){var s=n[o-1];o%e==0?(s=s<<8|s>>>24,s=Ic.SBOX[s>>>24]<<24|Ic.SBOX[s>>>16&255]<<16|Ic.SBOX[s>>>8&255]<<8|Ic.SBOX[255&s],s^=Tc[o/e|0]<<24):e>6&&o%e==4&&(s=Ic.SBOX[s>>>24]<<24|Ic.SBOX[s>>>16&255]<<16|Ic.SBOX[s>>>8&255]<<8|Ic.SBOX[255&s]),n[o]=n[o-e]^s}for(var a=[],h=0;h<i;h++){var u=i-h,f=n[u-(h%4?0:4)];a[h]=h<4||u<=4?f:Ic.INV_SUB_MIX[0][Ic.SBOX[f>>>24]]^Ic.INV_SUB_MIX[1][Ic.SBOX[f>>>16&255]]^Ic.INV_SUB_MIX[2][Ic.SBOX[f>>>8&255]]^Ic.INV_SUB_MIX[3][Ic.SBOX[255&f]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=a},Rc.prototype.encryptBlockRaw=function(t){return Oc(t=kc(t),this._keySchedule,Ic.SUB_MIX,Ic.SBOX,this._nRounds)},Rc.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=Ec.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},Rc.prototype.decryptBlock=function(t){var e=(t=kc(t))[1];t[1]=t[3],t[3]=e;var r=Oc(t,this._invKeySchedule,Ic.INV_SUB_MIX,Ic.INV_SBOX,this._nRounds),i=Ec.allocUnsafe(16);return i.writeUInt32BE(r[0],0),i.writeUInt32BE(r[3],4),i.writeUInt32BE(r[2],8),i.writeUInt32BE(r[1],12),i},Rc.prototype.scrub=function(){Ac(this._keySchedule),Ac(this._invKeySchedule),Ac(this._key)},Sc.AES=Rc;var Cc=fo.Buffer,Pc=Cc.alloc(16,0);function xc(t){var e=Cc.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function Nc(t){this.h=t,this.state=Cc.alloc(16,0),this.cache=Cc.allocUnsafe(0)}Nc.prototype.ghash=function(t){for(var e=-1;++e<t.length;)this.state[e]^=t[e];this._multiply()},Nc.prototype._multiply=function(){for(var t,e,r,i=[(t=this.h).readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)],n=[0,0,0,0],o=-1;++o<128;){for(0!=(this.state[~~(o/8)]&1<<7-o%8)&&(n[0]^=i[0],n[1]^=i[1],n[2]^=i[2],n[3]^=i[3]),r=0!=(1&i[3]),e=3;e>0;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=xc(n)},Nc.prototype.update=function(t){var e;for(this.cache=Cc.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},Nc.prototype.final=function(t,e){return this.cache.length&&this.ghash(Cc.concat([this.cache,Pc],16)),this.ghash(xc([0,t,0,e])),this.state};var Bc=Nc,Lc=Sc,Dc=fo.Buffer,jc=sf,Uc=Bc,qc=Xl,Fc=dc;function zc(t,e,r,i){jc.call(this);var n=Dc.alloc(4,0);this._cipher=new Lc.AES(e);var o=this._cipher.encryptBlock(n);this._ghash=new Uc(o),r=function(t,e,r){if(12===e.length)return t._finID=Dc.concat([e,Dc.from([0,0,0,1])]),Dc.concat([e,Dc.from([0,0,0,2])]);var i=new Uc(r),n=e.length,o=n%16;i.update(e),o&&(o=16-o,i.update(Dc.alloc(o,0))),i.update(Dc.alloc(8,0));var s=8*n,a=Dc.alloc(8);a.writeUIntBE(s,0,8),i.update(a),t._finID=i.state;var h=Dc.from(t._finID);return Fc(h),h}(this,r,o),this._prev=Dc.from(r),this._cache=Dc.allocUnsafe(0),this._secCache=Dc.allocUnsafe(0),this._decrypt=i,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}bo(zc,jc),zc.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=Dc.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},zc.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=qc(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var i=Math.min(t.length,e.length),n=0;n<i;++n)r+=t[n]^e[n];return r}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},zc.prototype.getAuthTag=function(){if(this._decrypt||!Dc.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},zc.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},zc.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length};var Hc=zc,Kc=Sc,Vc=fo.Buffer,Gc=sf;function Wc(t,e,r,i){Gc.call(this),this._cipher=new Kc.AES(e),this._prev=Vc.from(r),this._cache=Vc.allocUnsafe(0),this._secCache=Vc.allocUnsafe(0),this._decrypt=i,this._mode=t}bo(Wc,Gc),Wc.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},Wc.prototype._final=function(){this._cipher.scrub()};var Yc=Wc,Zc=fo.Buffer,Xc=Ra;var Qc=function(t,e,r,i){if(Zc.isBuffer(t)||(t=Zc.from(t,"binary")),e&&(Zc.isBuffer(e)||(e=Zc.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var n=r/8,o=Zc.alloc(n),s=Zc.alloc(i||0),a=Zc.alloc(0);n>0||i>0;){var h=new Xc;h.update(a),h.update(t),e&&h.update(e),a=h.digest();var u=0;if(n>0){var f=o.length-n;u=Math.min(n,a.length),a.copy(o,f,0,u),n-=u}if(u<a.length&&i>0){var l=s.length-i,c=Math.min(i,a.length-u);a.copy(s,l,u,u+c),i-=c}}return a.fill(0),{key:o,iv:s}},Jc=Mc,$c=Hc,td=fo.Buffer,ed=Yc,rd=sf,id=Sc,nd=Qc;function od(t,e,r){rd.call(this),this._cache=new ad,this._cipher=new id.AES(e),this._prev=td.from(r),this._mode=t,this._autopadding=!0}bo(od,rd),od.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get();)r=this._mode.encrypt(this,e),i.push(r);return td.concat(i)};var sd=td.alloc(16,16);function ad(){this.cache=td.allocUnsafe(0)}function hd(t,e,r){var i=Jc[t.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=td.from(e)),e.length!==i.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=td.from(r)),"GCM"!==i.mode&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===i.type?new ed(i.module,e,r):"auth"===i.type?new $c(i.module,e,r):new od(i.module,e,r)}od.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(sd))throw this._cipher.scrub(),new Error("data not multiple of block length")},od.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},ad.prototype.add=function(t){this.cache=td.concat([this.cache,t])},ad.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},ad.prototype.flush=function(){for(var t=16-this.cache.length,e=td.allocUnsafe(t),r=-1;++r<t;)e.writeUInt8(t,r);return td.concat([this.cache,e])},Wl.createCipheriv=hd,Wl.createCipher=function(t,e){var r=Jc[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=nd(e,!1,r.key,r.iv);return hd(t,i.key,i.iv)};var ud={},fd=Hc,ld=fo.Buffer,cd=Mc,dd=Yc,pd=sf,md=Sc,gd=Qc;function yd(t,e,r){pd.call(this),this._cache=new bd,this._last=void 0,this._cipher=new md.AES(e),this._prev=ld.from(r),this._mode=t,this._autopadding=!0}function bd(){this.cache=ld.allocUnsafe(0)}function vd(t,e,r){var i=cd[t.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=ld.from(r)),"GCM"!==i.mode&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=ld.from(e)),e.length!==i.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===i.type?new dd(i.module,e,r,!0):"auth"===i.type?new fd(i.module,e,r,!0):new yd(i.module,e,r)}bo(yd,pd),yd.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 ld.concat(i)},yd.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(;++r<e;)if(t[r+(16-e)]!==e)throw new Error("unable to decrypt data");if(16===e)return;return t.slice(0,16-e)}(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")},yd.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},bd.prototype.add=function(t){this.cache=ld.concat([this.cache,t])},bd.prototype.get=function(t){var e;if(t){if(this.cache.length>16)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},bd.prototype.flush=function(){if(this.cache.length)return this.cache},ud.createDecipher=function(t,e){var r=cd[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=gd(e,!1,r.key,r.iv);return vd(t,i.key,i.iv)},ud.createDecipheriv=vd;var wd=Wl,_d=ud,Md=bc;Gl.createCipher=Gl.Cipher=wd.createCipher,Gl.createCipheriv=Gl.Cipheriv=wd.createCipheriv,Gl.createDecipher=Gl.Decipher=_d.createDecipher,Gl.createDecipheriv=Gl.Decipheriv=_d.createDecipheriv,Gl.listCiphers=Gl.getCiphers=function(){return Object.keys(Md)};var Sd={};!function(t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}}(Sd);var Ed=Kl,kd=Gl,Ad=Mc,Od=Sd,Td=Qc;function Id(t,e,r){if(t=t.toLowerCase(),Ad[t])return kd.createCipheriv(t,e,r);if(Od[t])return new Ed({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function Rd(t,e,r){if(t=t.toLowerCase(),Ad[t])return kd.createDecipheriv(t,e,r);if(Od[t])return new Ed({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}fl.createCipher=fl.Cipher=function(t,e){var r,i;if(t=t.toLowerCase(),Ad[t])r=Ad[t].key,i=Ad[t].iv;else{if(!Od[t])throw new TypeError("invalid suite type");r=8*Od[t].key,i=Od[t].iv}var n=Td(e,!1,r,i);return Id(t,n.key,n.iv)},fl.createCipheriv=fl.Cipheriv=Id,fl.createDecipher=fl.Decipher=function(t,e){var r,i;if(t=t.toLowerCase(),Ad[t])r=Ad[t].key,i=Ad[t].iv;else{if(!Od[t])throw new TypeError("invalid suite type");r=8*Od[t].key,i=Od[t].iv}var n=Td(e,!1,r,i);return Rd(t,n.key,n.iv)},fl.createDecipheriv=fl.Decipheriv=Rd,fl.listCiphers=fl.getCiphers=function(){return Object.keys(Od).concat(kd.getCiphers())};var Cd={},Pd={},xd={get exports(){return Pd},set exports(t){Pd=t}};!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.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 o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:co.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.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<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.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;f<a;f+=i)u=h(t,f,f+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var l=1;for(u=h(t,f,t.length,e),f=0;f<s;f++)l*=e;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[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 c(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,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var f=h>>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!=(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=f[t],d=l[t];i="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);i=(p=p.idivn(d)).isZero()?m+i:u[c-m.length]+m+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.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<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,f=0|s[0],l=8191&f,c=f>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],S=8191&M,E=M>>>13,k=0|s[5],A=8191&k,O=k>>>13,T=0|s[6],I=8191&T,R=T>>>13,C=0|s[7],P=8191&C,x=C>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],j=8191&D,U=D>>>13,q=0|a[0],F=8191&q,z=q>>>13,H=0|a[1],K=8191&H,V=H>>>13,G=0|a[2],W=8191&G,Y=G>>>13,Z=0|a[3],X=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>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],ht=8191&at,ut=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=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,z))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,z))+Math.imul(m,F)|0,o=Math.imul(m,z);var yt=(u+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,z))+Math.imul(b,F)|0,o=Math.imul(b,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var bt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,z))+Math.imul(_,F)|0,o=Math.imul(_,z),i=i+Math.imul(y,K)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var vt=(u+(i=i+Math.imul(l,X)|0)|0)+((8191&(n=(n=n+Math.imul(l,Q)|0)+Math.imul(c,X)|0))<<13)|0;u=((o=o+Math.imul(c,Q)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,F),n=(n=Math.imul(S,z))+Math.imul(E,F)|0,o=Math.imul(E,z),i=i+Math.imul(w,K)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,Q)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,z))+Math.imul(O,F)|0,o=Math.imul(O,z),i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,V)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,Q)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,F),n=(n=Math.imul(I,z))+Math.imul(R,F)|0,o=Math.imul(R,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,Q)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,Q)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|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 Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,F),n=(n=Math.imul(P,z))+Math.imul(x,F)|0,o=Math.imul(x,z),i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,Y)|0,i=i+Math.imul(S,X)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Q)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,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=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,z))+Math.imul(L,F)|0,o=Math.imul(L,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,Q)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(j,F),n=(n=Math.imul(j,z))+Math.imul(U,F)|0,o=Math.imul(U,z),i=i+Math.imul(B,K)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,Q)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Q)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|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 kt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(j,K),n=(n=Math.imul(j,V))+Math.imul(U,K)|0,o=Math.imul(U,V),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,Q)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Q)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(j,W),n=(n=Math.imul(j,Y))+Math.imul(U,W)|0,o=Math.imul(U,Y),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,Q)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,Q)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Ot=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(j,X),n=(n=Math.imul(j,Q))+Math.imul(U,X)|0,o=Math.imul(U,Q),i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(O,ht)|0,o=o+Math.imul(O,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(U,$)|0,o=Math.imul(U,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(j,rt),n=(n=Math.imul(j,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var Rt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(j,ot),n=(n=Math.imul(j,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ct)|0;var Ct=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(j,ht),n=(n=Math.imul(j,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Pt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(j,lt),n=(n=Math.imul(j,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var xt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Nt=(u+(i=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=Et,h[9]=kt,h[10]=At,h[11]=Ot,h[12]=Tt,h[13]=It,h[14]=Rt,h[15]=Ct,h[16]=Pt,h[17]=xt,h[18]=Nt,0!==u&&(h[19]=u,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,e):i<63?c(this,t,e):i<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<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var f=o-u,l=(0|t.words[f])*(0|e.words[u]),c=67108863&l;a=67108863&(c=c+a|0),n+=(s=(s=s+(l/67108864|0)|0)+(c>>>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):p(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},m.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},m.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),f=0;f<n;f+=a)for(var l=h,c=u,d=0;d<s;d++){var p=r[f+d],m=i[f+d],g=r[f+d+s],y=i[f+d+s],b=l*g-c*y;y=l*y+c*g,g=b,r[f+d]=p+g,i[f+d]=m+y,r[f+d+s]=p-g,i[f+d+s]=m-y,d!==a&&(b=h*l-u*c,c=h*c+u*l,l=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},m.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},m.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),f=new Array(i),l=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,f,l,i,n);for(var d=0;d<i;d++){var p=a[d]*f[d]-h[d]*l[d];h[d]=a[d]*l[d]+h[d]*f[d],a[d]=p}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),p(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i||!(this.words[i]&n))},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!=(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var f=i.clone()._ishlnsubmul(o,1,h);0===f.negative&&(i=f,a&&(a.words[h]=1));for(var l=h-1;l>=0;l--){var c=67108864*(0|i.words[o.length+l])+(0|i.words[o.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,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}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.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)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var f=i.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;)(o.isOdd()||s.isOdd())&&(o.iadd(f),s.isub(l)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(i.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(i.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;0==(i.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(i.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.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)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new M(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}y.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.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=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,y),i(w,y),i(_,y),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return g[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.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)},M.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},M.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)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(l,new n(1).iushln(p-g-1));c=c.redMul(y),l=y.redSqr(),d=d.redMul(l),p=g}return c},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new S(t)},i(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.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)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(xd,Y);var Nd={},Bd={get exports(){return Nd},set exports(t){Nd=t}};!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.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 o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:co.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.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<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.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;f<a;f+=i)u=h(t,f,f+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var l=1;for(u=h(t,f,t.length,e),f=0;f<s;f++)l*=e;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[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 c(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,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var f=h>>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!=(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=f[t],d=l[t];i="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);i=(p=p.idivn(d)).isZero()?m+i:u[c-m.length]+m+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.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<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,f=0|s[0],l=8191&f,c=f>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],S=8191&M,E=M>>>13,k=0|s[5],A=8191&k,O=k>>>13,T=0|s[6],I=8191&T,R=T>>>13,C=0|s[7],P=8191&C,x=C>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],j=8191&D,U=D>>>13,q=0|a[0],F=8191&q,z=q>>>13,H=0|a[1],K=8191&H,V=H>>>13,G=0|a[2],W=8191&G,Y=G>>>13,Z=0|a[3],X=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>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],ht=8191&at,ut=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=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,z))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,z))+Math.imul(m,F)|0,o=Math.imul(m,z);var yt=(u+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,z))+Math.imul(b,F)|0,o=Math.imul(b,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var bt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,z))+Math.imul(_,F)|0,o=Math.imul(_,z),i=i+Math.imul(y,K)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var vt=(u+(i=i+Math.imul(l,X)|0)|0)+((8191&(n=(n=n+Math.imul(l,Q)|0)+Math.imul(c,X)|0))<<13)|0;u=((o=o+Math.imul(c,Q)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,F),n=(n=Math.imul(S,z))+Math.imul(E,F)|0,o=Math.imul(E,z),i=i+Math.imul(w,K)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,Q)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,z))+Math.imul(O,F)|0,o=Math.imul(O,z),i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,V)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,Q)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,F),n=(n=Math.imul(I,z))+Math.imul(R,F)|0,o=Math.imul(R,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,Q)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,Q)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|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 Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,F),n=(n=Math.imul(P,z))+Math.imul(x,F)|0,o=Math.imul(x,z),i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,Y)|0,i=i+Math.imul(S,X)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Q)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,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=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,z))+Math.imul(L,F)|0,o=Math.imul(L,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,Q)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(j,F),n=(n=Math.imul(j,z))+Math.imul(U,F)|0,o=Math.imul(U,z),i=i+Math.imul(B,K)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,Q)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Q)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|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 kt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(j,K),n=(n=Math.imul(j,V))+Math.imul(U,K)|0,o=Math.imul(U,V),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,Q)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Q)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(j,W),n=(n=Math.imul(j,Y))+Math.imul(U,W)|0,o=Math.imul(U,Y),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,Q)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,Q)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Ot=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(j,X),n=(n=Math.imul(j,Q))+Math.imul(U,X)|0,o=Math.imul(U,Q),i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(O,ht)|0,o=o+Math.imul(O,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(U,$)|0,o=Math.imul(U,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(j,rt),n=(n=Math.imul(j,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var Rt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(j,ot),n=(n=Math.imul(j,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ct)|0;var Ct=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(j,ht),n=(n=Math.imul(j,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Pt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(j,lt),n=(n=Math.imul(j,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var xt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Nt=(u+(i=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=Et,h[9]=kt,h[10]=At,h[11]=Ot,h[12]=Tt,h[13]=It,h[14]=Rt,h[15]=Ct,h[16]=Pt,h[17]=xt,h[18]=Nt,0!==u&&(h[19]=u,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,e):i<63?c(this,t,e):i<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<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var f=o-u,l=(0|t.words[f])*(0|e.words[u]),c=67108863&l;a=67108863&(c=c+a|0),n+=(s=(s=s+(l/67108864|0)|0)+(c>>>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):p(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},m.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},m.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),f=0;f<n;f+=a)for(var l=h,c=u,d=0;d<s;d++){var p=r[f+d],m=i[f+d],g=r[f+d+s],y=i[f+d+s],b=l*g-c*y;y=l*y+c*g,g=b,r[f+d]=p+g,i[f+d]=m+y,r[f+d+s]=p-g,i[f+d+s]=m-y,d!==a&&(b=h*l-u*c,c=h*c+u*l,l=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},m.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},m.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),f=new Array(i),l=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,f,l,i,n);for(var d=0;d<i;d++){var p=a[d]*f[d]-h[d]*l[d];h[d]=a[d]*l[d]+h[d]*f[d],a[d]=p}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),p(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i||!(this.words[i]&n))},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!=(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var f=i.clone()._ishlnsubmul(o,1,h);0===f.negative&&(i=f,a&&(a.words[h]=1));for(var l=h-1;l>=0;l--){var c=67108864*(0|i.words[o.length+l])+(0|i.words[o.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,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}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.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)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var f=i.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;)(o.isOdd()||s.isOdd())&&(o.iadd(f),s.isub(l)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(i.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(i.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;0==(i.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(i.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.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)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new M(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}y.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.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=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,y),i(w,y),i(_,y),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return g[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.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)},M.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},M.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)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(l,new n(1).iushln(p-g-1));c=c.redMul(y),l=y.redSqr(),d=d.redMul(l),p=g}return c},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new S(t)},i(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.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)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(Bd,Y);var Ld,Dd,jd,Ud,qd,Fd={},zd={get exports(){return Fd},set exports(t){Fd=t}};function Hd(){if(Ld)return Fd;var t;function e(t){this.rand=t}if(Ld=1,zd.exports=function(r){return t||(t=new e(null)),t.generate(r)},Fd.Rand=e,e.prototype.generate=function(t){return this._rand(t)},e.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?e.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?e.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(e.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var r=_w();if("function"!=typeof r.randomBytes)throw new Error("Not supported");e.prototype._rand=function(t){return r.randomBytes(t)}}catch(t){}return Fd}function Kd(){if(jd)return Dd;jd=1;var t=Nd,e=Hd();function r(t){this.rand=t||new e.Rand}return Dd=r,r.create=function(t){return new r(t)},r.prototype._randbelow=function(e){var r=e.bitLength(),i=Math.ceil(r/8);do{var n=new t(this.rand.generate(i))}while(n.cmp(e)>=0);return n},r.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},r.prototype.test=function(e,r,i){var n=e.bitLength(),o=t.mont(e),s=new t(1).toRed(o);r||(r=Math.max(1,n/48|0));for(var a=e.subn(1),h=0;!a.testn(h);h++);for(var u=e.shrn(h),f=a.toRed(o);r>0;r--){var l=this._randrange(new t(2),a);i&&i(l);var c=l.toRed(o).redPow(u);if(0!==c.cmp(s)&&0!==c.cmp(f)){for(var d=1;d<h;d++){if(0===(c=c.redSqr()).cmp(s))return!1;if(0===c.cmp(f))break}if(d===h)return!1}}return!0},r.prototype.getDivisor=function(e,r){var i=e.bitLength(),n=t.mont(e),o=new t(1).toRed(n);r||(r=Math.max(1,i/48|0));for(var s=e.subn(1),a=0;!s.testn(a);a++);for(var h=e.shrn(a),u=s.toRed(n);r>0;r--){var f=this._randrange(new t(2),s),l=e.gcd(f);if(0!==l.cmpn(1))return l;var c=f.toRed(n).redPow(h);if(0!==c.cmp(o)&&0!==c.cmp(u)){for(var d=1;d<a;d++){if(0===(c=c.redSqr()).cmp(o))return c.fromRed().subn(1).gcd(e);if(0===c.cmp(u))break}if(d===a)return(c=c.redSqr()).fromRed().subn(1).gcd(e)}}return!1},Dd}function Vd(){if(qd)return Ud;qd=1;var t=ho;Ud=m,m.simpleSieve=d,m.fermatTest=p;var e=Pd,r=new e(24),i=new(Kd()),n=new e(1),o=new e(2),s=new e(5);new e(16),new e(8);var a=new e(10),h=new e(3);new e(7);var u=new e(11),f=new e(4);new e(12);var l=null;function c(){if(null!==l)return l;var t=[];t[0]=2;for(var e=1,r=3;r<1048576;r+=2){for(var i=Math.ceil(Math.sqrt(r)),n=0;n<e&&t[n]<=i&&r%t[n]!=0;n++);e!==n&&t[n]<=i||(t[e++]=r)}return l=t,t}function d(t){for(var e=c(),r=0;r<e.length;r++)if(0===t.modn(e[r]))return 0===t.cmpn(e[r]);return!0}function p(t){var r=e.mont(t);return 0===o.toRed(r).redPow(t.subn(1)).fromRed().cmpn(1)}function m(l,c){if(l<16)return new e(2===c||5===c?[140,123]:[140,39]);var m,g;for(c=new e(c);;){for(m=new e(t(Math.ceil(l/8)));m.bitLength()>l;)m.ishrn(1);if(m.isEven()&&m.iadd(n),m.testn(1)||m.iadd(o),c.cmp(o)){if(!c.cmp(s))for(;m.mod(a).cmp(h);)m.iadd(f)}else for(;m.mod(r).cmp(u);)m.iadd(f);if(d(g=m.shrn(1))&&d(m)&&p(g)&&p(m)&&i.test(g)&&i.test(m))return m}}return Ud}var Gd,Wd,Yd,Zd={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 Xd(){if(Wd)return Gd;Wd=1;var t=Pd,e=new(Kd()),r=new t(24),i=new t(11),n=new t(10),o=new t(3),s=new t(7),a=Vd(),h=ho;function u(e,r){return r=r||"utf8",sr.isBuffer(e)||(e=new sr(e,r)),this._pub=new t(e),this}function f(e,r){return r=r||"utf8",sr.isBuffer(e)||(e=new sr(e,r)),this._priv=new t(e),this}Gd=c;var l={};function c(e,r,i){this.setGenerator(r),this.__prime=new t(e),this._prime=t.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,i?(this.setPublicKey=u,this.setPrivateKey=f):this._primeCode=8}function d(t,e){var r=new sr(t.toArray());return e?r.toString(e):r}return Object.defineProperty(c.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,h){var u=h.toString("hex"),f=[u,t.toString(16)].join("_");if(f in l)return l[f];var c,d=0;if(t.isEven()||!a.simpleSieve||!a.fermatTest(t)||!e.test(t))return d+=1,d+="02"===u||"05"===u?8:4,l[f]=d,d;switch(e.test(t.shrn(1))||(d+=2),u){case"02":t.mod(r).cmp(i)&&(d+=8);break;case"05":(c=t.mod(n)).cmp(o)&&c.cmp(s)&&(d+=8);break;default:d+=4}return l[f]=d,d}(this.__prime,this.__gen)),this._primeCode}}),c.prototype.generateKeys=function(){return this._priv||(this._priv=new t(h(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},c.prototype.computeSecret=function(e){var r=new sr((e=(e=new t(e)).toRed(this._prime)).redPow(this._priv).fromRed().toArray()),i=this.getPrime();if(r.length<i.length){var n=new sr(i.length-r.length);n.fill(0),r=sr.concat([n,r])}return r},c.prototype.getPublicKey=function(t){return d(this._pub,t)},c.prototype.getPrivateKey=function(t){return d(this._priv,t)},c.prototype.getPrime=function(t){return d(this.__prime,t)},c.prototype.getGenerator=function(t){return d(this._gen,t)},c.prototype.setGenerator=function(e,r){return r=r||"utf8",sr.isBuffer(e)||(e=new sr(e,r)),this.__gen=e,this._gen=new t(e),this},Gd}var Qd={},Jd={get exports(){return Qd},set exports(t){Qd=t}},$d={},tp={get exports(){return $d},set exports(t){$d=t}};!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.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 o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:co.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},n.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;f<a;f+=i)u=h(t,f,f+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var l=1;for(u=h(t,f,t.length,e),f=0;f<s;f++)l*=e;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(t){n.prototype.inspect=f}else n.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(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,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var f=h>>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?l[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=c[t],f=d[t];i="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(f).toString(t);i=(p=p.idivn(f)).isZero()?m+i:l[u-m.length]+m+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var s=this.words[n]<<o|i;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var s=this.words[n]<<o|i;t[r--]=255&s,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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.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<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,f=0|s[0],l=8191&f,c=f>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],S=8191&M,E=M>>>13,k=0|s[5],A=8191&k,O=k>>>13,T=0|s[6],I=8191&T,R=T>>>13,C=0|s[7],P=8191&C,x=C>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],j=8191&D,U=D>>>13,q=0|a[0],F=8191&q,z=q>>>13,H=0|a[1],K=8191&H,V=H>>>13,G=0|a[2],W=8191&G,Y=G>>>13,Z=0|a[3],X=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>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],ht=8191&at,ut=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=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,z))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,z))+Math.imul(m,F)|0,o=Math.imul(m,z);var yt=(u+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,z))+Math.imul(b,F)|0,o=Math.imul(b,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var bt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,z))+Math.imul(_,F)|0,o=Math.imul(_,z),i=i+Math.imul(y,K)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var vt=(u+(i=i+Math.imul(l,X)|0)|0)+((8191&(n=(n=n+Math.imul(l,Q)|0)+Math.imul(c,X)|0))<<13)|0;u=((o=o+Math.imul(c,Q)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,F),n=(n=Math.imul(S,z))+Math.imul(E,F)|0,o=Math.imul(E,z),i=i+Math.imul(w,K)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,Q)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,z))+Math.imul(O,F)|0,o=Math.imul(O,z),i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,V)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,Q)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,F),n=(n=Math.imul(I,z))+Math.imul(R,F)|0,o=Math.imul(R,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,Q)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,Q)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|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 Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,F),n=(n=Math.imul(P,z))+Math.imul(x,F)|0,o=Math.imul(x,z),i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,Y)|0,i=i+Math.imul(S,X)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Q)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,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=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,z))+Math.imul(L,F)|0,o=Math.imul(L,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,Q)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(j,F),n=(n=Math.imul(j,z))+Math.imul(U,F)|0,o=Math.imul(U,z),i=i+Math.imul(B,K)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,Q)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Q)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|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 kt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(j,K),n=(n=Math.imul(j,V))+Math.imul(U,K)|0,o=Math.imul(U,V),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,Q)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Q)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(j,W),n=(n=Math.imul(j,Y))+Math.imul(U,W)|0,o=Math.imul(U,Y),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,Q)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,Q)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Ot=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(j,X),n=(n=Math.imul(j,Q))+Math.imul(U,X)|0,o=Math.imul(U,Q),i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(O,ht)|0,o=o+Math.imul(O,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(U,$)|0,o=Math.imul(U,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(j,rt),n=(n=Math.imul(j,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var Rt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(j,ot),n=(n=Math.imul(j,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ct)|0;var Ct=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(j,ht),n=(n=Math.imul(j,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Pt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(j,lt),n=(n=Math.imul(j,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var xt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Nt=(u+(i=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=Et,h[9]=kt,h[10]=At,h[11]=Ot,h[12]=Tt,h[13]=It,h[14]=Rt,h[15]=Ct,h[16]=Pt,h[17]=xt,h[18]=Nt,0!==u&&(h[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var f=o-u,l=(0|t.words[f])*(0|e.words[u]),c=67108863&l;a=67108863&(c=c+a|0),n+=(s=(s=s+(l/67108864|0)|0)+(c>>>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 y(t,e,r){return g(t,e,r)}Math.imul||(m=p),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i||!(this.words[i]&n))},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!=(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var f=i.clone()._ishlnsubmul(o,1,h);0===f.negative&&(i=f,a&&(a.words[h]=1));for(var l=h-1;l>=0;l--){var c=67108864*(0|i.words[o.length+l])+(0|i.words[o.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,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}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.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)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var f=i.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;)(o.isOdd()||s.isOdd())&&(o.iadd(f),s.isub(l)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(i.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(i.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;0==(i.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(i.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.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)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.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=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(w,v),w.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.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<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(_,v),i(M,v),i(S,v),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return b[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(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):(u(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(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(l,new n(1).iushln(p-g-1));c=c.redMul(y),l=y.redSqr(),d=d.redMul(l),p=g}return c},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},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},n.mont=function(t){return new k(t)},i(k,E),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 n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(tp,Y);var ep=$d,rp=ho;function ip(t){var e,r=t.modulus.byteLength();do{e=new ep(rp(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function np(t,e){var r=function(t){var e=ip(t);return{blinder:e.toRed(ep.mont(t.modulus)).redPow(new ep(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),i=e.modulus.byteLength(),n=new ep(t).mul(r.blinder).umod(e.modulus),o=n.toRed(ep.mont(e.prime1)),s=n.toRed(ep.mont(e.prime2)),a=e.coefficient,h=e.prime1,u=e.prime2,f=o.redPow(e.exponent1).fromRed(),l=s.redPow(e.exponent2).fromRed(),c=f.isub(l).imul(a).umod(h).imul(u);return l.iadd(c).imul(r.unblinder).umod(e.modulus).toArrayLike(sr,"be",i)}np.getr=ip;var op=np,sp={};var ap={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}},hp={},up={},fp={get exports(){return up},set exports(t){up=t}};!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.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 o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:co.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.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<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.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;f<a;f+=i)u=h(t,f,f+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var l=1;for(u=h(t,f,t.length,e),f=0;f<s;f++)l*=e;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[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 c(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,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var f=h>>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!=(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=f[t],d=l[t];i="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);i=(p=p.idivn(d)).isZero()?m+i:u[c-m.length]+m+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.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<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,f=0|s[0],l=8191&f,c=f>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],S=8191&M,E=M>>>13,k=0|s[5],A=8191&k,O=k>>>13,T=0|s[6],I=8191&T,R=T>>>13,C=0|s[7],P=8191&C,x=C>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],j=8191&D,U=D>>>13,q=0|a[0],F=8191&q,z=q>>>13,H=0|a[1],K=8191&H,V=H>>>13,G=0|a[2],W=8191&G,Y=G>>>13,Z=0|a[3],X=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>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],ht=8191&at,ut=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=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,z))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,z))+Math.imul(m,F)|0,o=Math.imul(m,z);var yt=(u+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,z))+Math.imul(b,F)|0,o=Math.imul(b,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var bt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,z))+Math.imul(_,F)|0,o=Math.imul(_,z),i=i+Math.imul(y,K)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var vt=(u+(i=i+Math.imul(l,X)|0)|0)+((8191&(n=(n=n+Math.imul(l,Q)|0)+Math.imul(c,X)|0))<<13)|0;u=((o=o+Math.imul(c,Q)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,F),n=(n=Math.imul(S,z))+Math.imul(E,F)|0,o=Math.imul(E,z),i=i+Math.imul(w,K)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,Q)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,z))+Math.imul(O,F)|0,o=Math.imul(O,z),i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,V)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,Q)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,F),n=(n=Math.imul(I,z))+Math.imul(R,F)|0,o=Math.imul(R,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,Q)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,Q)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|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 Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,F),n=(n=Math.imul(P,z))+Math.imul(x,F)|0,o=Math.imul(x,z),i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,Y)|0,i=i+Math.imul(S,X)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Q)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,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=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,z))+Math.imul(L,F)|0,o=Math.imul(L,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,Q)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(j,F),n=(n=Math.imul(j,z))+Math.imul(U,F)|0,o=Math.imul(U,z),i=i+Math.imul(B,K)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,Q)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Q)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|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 kt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(j,K),n=(n=Math.imul(j,V))+Math.imul(U,K)|0,o=Math.imul(U,V),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,Q)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Q)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(j,W),n=(n=Math.imul(j,Y))+Math.imul(U,W)|0,o=Math.imul(U,Y),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,Q)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,Q)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Ot=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(j,X),n=(n=Math.imul(j,Q))+Math.imul(U,X)|0,o=Math.imul(U,Q),i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(O,ht)|0,o=o+Math.imul(O,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(U,$)|0,o=Math.imul(U,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(j,rt),n=(n=Math.imul(j,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var Rt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(j,ot),n=(n=Math.imul(j,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ct)|0;var Ct=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(j,ht),n=(n=Math.imul(j,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Pt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(j,lt),n=(n=Math.imul(j,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var xt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Nt=(u+(i=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=Et,h[9]=kt,h[10]=At,h[11]=Ot,h[12]=Tt,h[13]=It,h[14]=Rt,h[15]=Ct,h[16]=Pt,h[17]=xt,h[18]=Nt,0!==u&&(h[19]=u,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,e):i<63?c(this,t,e):i<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<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var f=o-u,l=(0|t.words[f])*(0|e.words[u]),c=67108863&l;a=67108863&(c=c+a|0),n+=(s=(s=s+(l/67108864|0)|0)+(c>>>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):p(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},m.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},m.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),f=0;f<n;f+=a)for(var l=h,c=u,d=0;d<s;d++){var p=r[f+d],m=i[f+d],g=r[f+d+s],y=i[f+d+s],b=l*g-c*y;y=l*y+c*g,g=b,r[f+d]=p+g,i[f+d]=m+y,r[f+d+s]=p-g,i[f+d+s]=m-y,d!==a&&(b=h*l-u*c,c=h*c+u*l,l=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},m.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},m.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),f=new Array(i),l=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,f,l,i,n);for(var d=0;d<i;d++){var p=a[d]*f[d]-h[d]*l[d];h[d]=a[d]*l[d]+h[d]*f[d],a[d]=p}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),p(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i||!(this.words[i]&n))},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!=(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var f=i.clone()._ishlnsubmul(o,1,h);0===f.negative&&(i=f,a&&(a.words[h]=1));for(var l=h-1;l>=0;l--){var c=67108864*(0|i.words[o.length+l])+(0|i.words[o.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,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}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.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)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var f=i.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;)(o.isOdd()||s.isOdd())&&(o.iadd(f),s.isub(l)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(i.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(i.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;0==(i.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(i.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.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)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new M(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}y.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.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=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,y),i(w,y),i(_,y),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return g[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.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)},M.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},M.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)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(l,new n(1).iushln(p-g-1));c=c.redMul(y),l=y.redSqr(),d=d.redMul(l),p=g}return c},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new S(t)},i(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.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)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(fp,Y);var lp={};!function(t){var e=lp;function r(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",i=0;i<t.length;i++)e+=r(t[i].toString(16));return e}e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var i=0;i<t.length;i++)r[i]=0|t[i];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(i=0;i<t.length;i++){var n=t.charCodeAt(i),o=n>>8,s=255&n;o?r.push(o,s):r.push(s)}return r},e.zero2=r,e.toHex=i,e.encode=function(t,e){return"hex"===e?i(t):t}}(),function(t){var e=hp,r=up,i=gl,n=lp;e.assert=i,e.toArray=n.toArray,e.zero2=n.zero2,e.toHex=n.toHex,e.encode=n.encode,e.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<<e+1,o=t.clone(),s=0;s<i.length;s++){var a,h=o.andln(n-1);o.isOdd()?(a=h>(n>>1)-1?(n>>1)-h:h,o.isubn(a)):a=0,i[s]=a,o.iushrn(1)}return i},e.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,h=t.andln(3)+n&3,u=e.andln(3)+o&3;3===h&&(h=-1),3===u&&(u=-1),s=0==(1&h)?0:3!==(i=t.andln(7)+n&7)&&5!==i||2!==u?h:-h,r[0].push(s),a=0==(1&u)?0:3!==(i=e.andln(7)+o&7)&&5!==i||2!==h?u:-u,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},e.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},e.parseBytes=function(t){return"string"==typeof t?e.toArray(t,"hex"):t},e.intFromLE=function(t){return new r(t,"hex","le")}}();var cp={},dp=up,pp=hp,mp=pp.getNAF,gp=pp.getJSF,yp=pp.assert;function bp(t,e){this.type=t,this.p=new dp(e.p,16),this.red=e.prime?dp.red(e.prime):dp.mont(this.p),this.zero=new dp(0).toRed(this.red),this.one=new dp(1).toRed(this.red),this.two=new dp(2).toRed(this.red),this.n=e.n&&new dp(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))}var vp=bp;function wp(t,e){this.curve=t,this.type=e,this.precomputed=null}bp.prototype.point=function(){throw new Error("Not implemented")},bp.prototype.validate=function(){throw new Error("Not implemented")},bp.prototype._fixedNafMul=function(t,e){yp(t.precomputed);var r=t._getDoubles(),i=mp(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,s,a=[];for(o=0;o<i.length;o+=r.step){s=0;for(var h=o+r.step-1;h>=o;h--)s=(s<<1)+i[h];a.push(s)}for(var u=this.jpoint(null,null,null),f=this.jpoint(null,null,null),l=n;l>0;l--){for(o=0;o<a.length;o++)(s=a[o])===l?f=f.mixedAdd(r.points[o]):s===-l&&(f=f.mixedAdd(r.points[o].neg()));u=u.add(f)}return u.toP()},bp.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=mp(e,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var h=0;a>=0&&0===o[a];a--)h++;if(a>=0&&h++,s=s.dblp(h),a<0)break;var u=o[a];yp(0!==u),s="affine"===t.type?u>0?s.mixedAdd(n[u-1>>1]):s.mixedAdd(n[-u-1>>1].neg()):u>0?s.add(n[u-1>>1]):s.add(n[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},bp.prototype._wnafMulAdd=function(t,e,r,i,n){var o,s,a,h=this._wnafT1,u=this._wnafT2,f=this._wnafT3,l=0;for(o=0;o<i;o++){var c=(a=e[o])._getNAFPoints(t);h[o]=c.wnd,u[o]=c.points}for(o=i-1;o>=1;o-=2){var d=o-1,p=o;if(1===h[d]&&1===h[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=gp(r[d],r[p]);for(l=Math.max(y[0].length,l),f[d]=new Array(l),f[p]=new Array(l),s=0;s<l;s++){var b=0|y[0][s],v=0|y[1][s];f[d][s]=g[3*(b+1)+(v+1)],f[p][s]=0,u[d]=m}}else f[d]=mp(r[d],h[d],this._bitLength),f[p]=mp(r[p],h[p],this._bitLength),l=Math.max(f[d].length,l),l=Math.max(f[p].length,l)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(o=l;o>=0;o--){for(var M=0;o>=0;){var S=!0;for(s=0;s<i;s++)_[s]=0|f[s][o],0!==_[s]&&(S=!1);if(!S)break;M++,o--}if(o>=0&&M++,w=w.dblp(M),o<0)break;for(s=0;s<i;s++){var E=_[s];0!==E&&(E>0?a=u[s][E-1>>1]:E<0&&(a=u[s][-E-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o<i;o++)u[o]=null;return n?w:w.toP()},bp.BasePoint=wp,wp.prototype.eq=function(){throw new Error("Not implemented")},wp.prototype.validate=function(){return this.curve.validate(this)},bp.prototype.decodePoint=function(t,e){t=pp.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?yp(t[t.length-1]%2==0):7===t[0]&&yp(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},wp.prototype.encodeCompressed=function(t){return this.encode(t,!0)},wp.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},wp.prototype.encode=function(t,e){return pp.encode(this._encode(e),t)},wp.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},wp.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},wp.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var o=0;o<t;o++)i=i.dbl();r.push(i)}return{step:t,points:r}},wp.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},wp.prototype._getBeta=function(){return null},wp.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var _p=up,Mp=bo,Sp=vp,Ep=hp.assert;function kp(t){Sp.call(this,"short",t),this.a=new _p(t.a,16).toRed(this.red),this.b=new _p(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Mp(kp,Sp);var Ap=kp;function Op(t,e,r,i){Sp.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new _p(e,16),this.y=new _p(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function Tp(t,e,r,i){Sp.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new _p(0)):(this.x=new _p(e,16),this.y=new _p(r,16),this.z=new _p(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}kp.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new _p(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new _p(t.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(e))?r=n[0]:(r=n[1],Ep(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new _p(t.a,16),b:new _p(t.b,16)}})):this._getEndoBasis(r)}}},kp.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:_p.mont(t),r=new _p(2).toRed(e).redInvm(),i=r.redNeg(),n=new _p(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},kp.prototype._getEndoBasis=function(t){for(var e,r,i,n,o,s,a,h,u,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=t,c=this.n.clone(),d=new _p(1),p=new _p(0),m=new _p(0),g=new _p(1),y=0;0!==l.cmpn(0);){var b=c.div(l);h=c.sub(b.mul(l)),u=m.sub(b.mul(d));var v=g.sub(b.mul(p));if(!i&&h.cmp(f)<0)e=a.neg(),r=d,i=h.neg(),n=u;else if(i&&2==++y)break;a=h,c=l,l=h,m=d,d=u,g=p,p=v}o=h.neg(),s=u;var w=i.sqr().add(n.sqr());return o.sqr().add(s.sqr()).cmp(w)>=0&&(o=e,s=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:i,b:n},{a:o,b:s}]},kp.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),h=n.mul(r.b),u=o.mul(i.b);return{k1:t.sub(s).sub(a),k2:h.add(u).neg()}},kp.prototype.pointFromX=function(t,e){(t=new _p(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 n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},kp.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)},kp.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],h=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),h=h.neg(!0)),i[2*o]=a,i[2*o+1]=h,n[2*o]=s.k1,n[2*o+1]=s.k2}for(var u=this._wnafMulAdd(1,i,n,2*o,r),f=0;f<2*o;f++)i[f]=null,n[f]=null;return u},Mp(Op,Sp.BasePoint),kp.prototype.point=function(t,e,r){return new Op(this,t,e,r)},kp.prototype.pointFromJSON=function(t,e){return Op.fromJSON(this,t,e)},Op.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},Op.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Op.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(e){return t.point(e[0],e[1],r)}var o=e[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(n))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(n))}},i},Op.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Op.prototype.isInfinity=function(){return this.inf},Op.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)},Op.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)},Op.prototype.getX=function(){return this.x.fromRed()},Op.prototype.getY=function(){return this.y.fromRed()},Op.prototype.mul=function(t){return t=new _p(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)},Op.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)},Op.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)},Op.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))},Op.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},Op.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Mp(Tp,Sp.BasePoint),kp.prototype.jpoint=function(t,e,r){return new Tp(this,t,e,r)},Tp.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)},Tp.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Tp.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),h=o.redSub(s);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),f=u.redMul(a),l=i.redMul(u),c=h.redSqr().redIAdd(f).redISub(l).redISub(l),d=h.redMul(l.redISub(c)).redISub(o.redMul(f)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(c,d,p)},Tp.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 h=s.redSqr(),u=h.redMul(s),f=r.redMul(h),l=a.redSqr().redIAdd(u).redISub(f).redISub(f),c=a.redMul(f.redISub(l)).redISub(n.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(l,c,d)},Tp.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<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,o=this.x,s=this.y,a=this.z,h=a.redSqr().redSqr(),u=s.redAdd(s);for(e=0;e<t;e++){var f=o.redSqr(),l=u.redSqr(),c=l.redSqr(),d=f.redAdd(f).redIAdd(f).redIAdd(i.redMul(h)),p=o.redMul(l),m=d.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=d.redMul(g);y=y.redIAdd(y).redISub(c);var b=u.redMul(a);e+1<t&&(h=h.redMul(c)),o=m,a=b,u=y}return this.curve.jpoint(o,u.redMul(n),a)},Tp.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Tp.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var a=i.redAdd(i).redIAdd(i),h=a.redSqr().redISub(s).redISub(s),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=h,e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),l=this.y.redSqr(),c=l.redSqr(),d=this.x.redAdd(l).redSqr().redISub(f).redISub(c);d=d.redIAdd(d);var p=f.redAdd(f).redIAdd(f),m=p.redSqr(),g=c.redIAdd(c);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},Tp.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),h=a.redSqr().redISub(s).redISub(s);t=h;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),l=this.y.redSqr(),c=this.x.redMul(l),d=this.x.redSub(f).redMul(this.x.redAdd(f));d=d.redAdd(d).redIAdd(d);var p=c.redIAdd(c),m=(p=p.redIAdd(p)).redAdd(p);t=d.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(l).redISub(f);var g=l.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},Tp.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(n)),h=e.redAdd(e),u=(h=h.redIAdd(h)).redMul(s),f=a.redSqr().redISub(u.redAdd(u)),l=u.redISub(f),c=s.redSqr();c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=a.redMul(l).redISub(c),p=r.redAdd(r).redMul(i);return this.curve.jpoint(f,d,p)},Tp.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),o=n.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(i),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),h=i.redIAdd(i);h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var u=n.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(h),f=e.redMul(u);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.x.redMul(a).redISub(f);l=(l=l.redIAdd(l)).redIAdd(l);var c=this.y.redMul(u.redMul(h.redISub(u)).redISub(s.redMul(a)));c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(l,c,d)},Tp.prototype.mul=function(t,e){return t=new _p(t,e),this.curve._wnafMul(this,t)},Tp.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return 0===this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)},Tp.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},Tp.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Tp.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Ip=up,Rp=bo,Cp=vp,Pp=hp;function xp(t){Cp.call(this,"mont",t),this.a=new Ip(t.a,16).toRed(this.red),this.b=new Ip(t.b,16).toRed(this.red),this.i4=new Ip(4).toRed(this.red).redInvm(),this.two=new Ip(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Rp(xp,Cp);var Np=xp;function Bp(t,e,r){Cp.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Ip(e,16),this.z=new Ip(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}xp.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)},Rp(Bp,Cp.BasePoint),xp.prototype.decodePoint=function(t,e){return this.point(Pp.toArray(t,e),1)},xp.prototype.point=function(t,e){return new Bp(this,t,e)},xp.prototype.pointFromJSON=function(t){return Bp.fromJSON(this,t)},Bp.prototype.precompute=function(){},Bp.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Bp.fromJSON=function(t,e){return new Bp(t,e[0],e[1]||t.one)},Bp.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Bp.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Bp.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)},Bp.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Bp.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()),h=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,h)},Bp.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},Bp.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Bp.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Bp.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},Bp.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Bp.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Lp=up,Dp=bo,jp=vp,Up=hp.assert;function qp(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,jp.call(this,"edwards",t),this.a=new Lp(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Lp(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Lp(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Up(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}Dp(qp,jp);var Fp=qp;function zp(t,e,r,i,n){jp.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 Lp(e,16),this.y=new Lp(r,16),this.z=i?new Lp(i,16):this.curve.one,this.t=n&&new Lp(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.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()))))}qp.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},qp.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},qp.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},qp.prototype.pointFromX=function(t,e){(t=new Lp(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),n=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(n.redInvm()),s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var a=s.fromRed().isOdd();return(e&&!a||!e&&a)&&(s=s.redNeg()),this.point(t,s)},qp.prototype.pointFromY=function(t,e){(t=new Lp(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),n=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(n.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},qp.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)},Dp(zp,jp.BasePoint),qp.prototype.pointFromJSON=function(t){return zp.fromJSON(this,t)},qp.prototype.point=function(t,e,r,i){return new zp(this,t,e,r,i)},zp.fromJSON=function(t,e){return new zp(t,e[0],e[1],e[2])},zp.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},zp.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},zp.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),h=n.redMul(s),u=o.redMul(a),f=n.redMul(a),l=s.redMul(o);return this.curve.point(h,u,l,f)},zp.prototype._projDbl=function(){var t,e,r,i,n,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),h=this.y.redSqr();if(this.curve.twisted){var u=(i=this.curve._mulA(a)).redAdd(h);this.zOne?(t=s.redSub(a).redSub(h).redMul(u.redSub(this.curve.two)),e=u.redMul(i.redSub(h)),r=u.redSqr().redSub(u).redSub(u)):(n=this.z.redSqr(),o=u.redSub(n).redISub(n),t=s.redSub(a).redISub(h).redMul(o),e=u.redMul(i.redSub(h)),r=u.redMul(o))}else i=a.redAdd(h),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(h)),r=i.redMul(o);return this.curve.point(t,e,r)},zp.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},zp.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),h=r.redAdd(e),u=o.redMul(s),f=a.redMul(h),l=o.redMul(h),c=s.redMul(a);return this.curve.point(u,f,c,l)},zp.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),h=n.redSub(a),u=n.redAdd(a),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),l=i.redMul(h).redMul(f);return this.curve.twisted?(e=i.redMul(u).redMul(s.redSub(this.curve._mulA(o))),r=h.redMul(u)):(e=i.redMul(u).redMul(s.redSub(o)),r=this.curve._mulC(h).redMul(u)),this.curve.point(l,e,r)},zp.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},zp.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},zp.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},zp.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},zp.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},zp.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},zp.prototype.getX=function(){return this.normalize(),this.x.fromRed()},zp.prototype.getY=function(){return this.normalize(),this.y.fromRed()},zp.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},zp.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}},zp.prototype.toP=zp.prototype.normalize,zp.prototype.mixedAdd=zp.prototype.add,function(t){var e=t;e.base=vp,e.short=Ap,e.mont=Np,e.edwards=Fp}(cp);var Hp={},Kp={},Vp={},Gp=gl,Wp=bo;function Yp(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function Zp(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function Xp(t){return 1===t.length?"0"+t:t}function Qp(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}Vp.inherits=Wp,Vp.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<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var o=t.charCodeAt(n);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=63&o|128):Yp(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n<t.length;n++)r[n]=0|t[n];return r},Vp.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=Xp(t[r].toString(16));return e},Vp.htonl=Zp,Vp.toHex32=function(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];"little"===e&&(n=Zp(n)),r+=Qp(n.toString(16))}return r},Vp.zero2=Xp,Vp.zero8=Qp,Vp.join32=function(t,e,r,i){var n=r-e;Gp(n%4==0);for(var o=new Array(n/4),s=0,a=e;s<o.length;s++,a+=4){var h;h="big"===i?t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],o[s]=h>>>0}return o},Vp.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i<t.length;i++,n+=4){var o=t[i];"big"===e?(r[n]=o>>>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},Vp.rotr32=function(t,e){return t>>>e|t<<32-e},Vp.rotl32=function(t,e){return t<<e|t>>>32-e},Vp.sum32=function(t,e){return t+e>>>0},Vp.sum32_3=function(t,e,r){return t+e+r>>>0},Vp.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},Vp.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},Vp.sum64=function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,s=(o<i?1:0)+r+n;t[e]=s>>>0,t[e+1]=o},Vp.sum64_hi=function(t,e,r,i){return(e+i>>>0<e?1:0)+t+r>>>0},Vp.sum64_lo=function(t,e,r,i){return e+i>>>0},Vp.sum64_4_hi=function(t,e,r,i,n,o,s,a){var h=0,u=e;return h+=(u=u+i>>>0)<e?1:0,h+=(u=u+o>>>0)<o?1:0,t+r+n+s+(h+=(u=u+a>>>0)<a?1:0)>>>0},Vp.sum64_4_lo=function(t,e,r,i,n,o,s,a){return e+i+o+a>>>0},Vp.sum64_5_hi=function(t,e,r,i,n,o,s,a,h,u){var f=0,l=e;return f+=(l=l+i>>>0)<e?1:0,f+=(l=l+o>>>0)<o?1:0,f+=(l=l+a>>>0)<a?1:0,t+r+n+s+h+(f+=(l=l+u>>>0)<u?1:0)>>>0},Vp.sum64_5_lo=function(t,e,r,i,n,o,s,a,h,u){return e+i+o+a+u>>>0},Vp.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},Vp.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},Vp.shr64_hi=function(t,e,r){return t>>>r},Vp.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0};var Jp={},$p=Vp,tm=gl;function em(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Jp.BlockHash=em,em.prototype.update=function(t,e){if(t=$p.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=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=$p.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},em.prototype.digest=function(t){return this.update(this._pad()),tm(null===this.pending),this._digest(t)},em.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=t>>>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<this.padLength;o++)i[n++]=0;return i};var rm={},im={},nm=Vp.rotr32;function om(t,e,r){return t&e^~t&r}function sm(t,e,r){return t&e^t&r^e&r}function am(t,e,r){return t^e^r}im.ft_1=function(t,e,r,i){return 0===t?om(e,r,i):1===t||3===t?am(e,r,i):2===t?sm(e,r,i):void 0},im.ch32=om,im.maj32=sm,im.p32=am,im.s0_256=function(t){return nm(t,2)^nm(t,13)^nm(t,22)},im.s1_256=function(t){return nm(t,6)^nm(t,11)^nm(t,25)},im.g0_256=function(t){return nm(t,7)^nm(t,18)^t>>>3},im.g1_256=function(t){return nm(t,17)^nm(t,19)^t>>>10};var hm=Vp,um=Jp,fm=im,lm=hm.rotl32,cm=hm.sum32,dm=hm.sum32_5,pm=fm.ft_1,mm=um.BlockHash,gm=[1518500249,1859775393,2400959708,3395469782];function ym(){if(!(this instanceof ym))return new ym;mm.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}hm.inherits(ym,mm);var bm=ym;ym.blockSize=512,ym.outSize=160,ym.hmacStrength=80,ym.padLength=64,ym.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=lm(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4];for(i=0;i<r.length;i++){var u=~~(i/20),f=dm(lm(n,5),pm(u,o,s,a),h,r[i],gm[u]);h=a,a=s,s=lm(o,30),o=n,n=f}this.h[0]=cm(this.h[0],n),this.h[1]=cm(this.h[1],o),this.h[2]=cm(this.h[2],s),this.h[3]=cm(this.h[3],a),this.h[4]=cm(this.h[4],h)},ym.prototype._digest=function(t){return"hex"===t?hm.toHex32(this.h,"big"):hm.split32(this.h,"big")};var vm=Vp,wm=Jp,_m=im,Mm=gl,Sm=vm.sum32,Em=vm.sum32_4,km=vm.sum32_5,Am=_m.ch32,Om=_m.maj32,Tm=_m.s0_256,Im=_m.s1_256,Rm=_m.g0_256,Cm=_m.g1_256,Pm=wm.BlockHash,xm=[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 Nm(){if(!(this instanceof Nm))return new Nm;Pm.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=xm,this.W=new Array(64)}vm.inherits(Nm,Pm);var Bm=Nm;Nm.blockSize=512,Nm.outSize=256,Nm.hmacStrength=192,Nm.padLength=64,Nm.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=Em(Cm(r[i-2]),r[i-7],Rm(r[i-15]),r[i-16]);var n=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4],u=this.h[5],f=this.h[6],l=this.h[7];for(Mm(this.k.length===r.length),i=0;i<r.length;i++){var c=km(l,Im(h),Am(h,u,f),this.k[i],r[i]),d=Sm(Tm(n),Om(n,o,s));l=f,f=u,u=h,h=Sm(a,c),a=s,s=o,o=n,n=Sm(c,d)}this.h[0]=Sm(this.h[0],n),this.h[1]=Sm(this.h[1],o),this.h[2]=Sm(this.h[2],s),this.h[3]=Sm(this.h[3],a),this.h[4]=Sm(this.h[4],h),this.h[5]=Sm(this.h[5],u),this.h[6]=Sm(this.h[6],f),this.h[7]=Sm(this.h[7],l)},Nm.prototype._digest=function(t){return"hex"===t?vm.toHex32(this.h,"big"):vm.split32(this.h,"big")};var Lm=Vp,Dm=Bm;function jm(){if(!(this instanceof jm))return new jm;Dm.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Lm.inherits(jm,Dm);var Um=jm;jm.blockSize=512,jm.outSize=224,jm.hmacStrength=192,jm.padLength=64,jm.prototype._digest=function(t){return"hex"===t?Lm.toHex32(this.h.slice(0,7),"big"):Lm.split32(this.h.slice(0,7),"big")};var qm=Vp,Fm=Jp,zm=gl,Hm=qm.rotr64_hi,Km=qm.rotr64_lo,Vm=qm.shr64_hi,Gm=qm.shr64_lo,Wm=qm.sum64,Ym=qm.sum64_hi,Zm=qm.sum64_lo,Xm=qm.sum64_4_hi,Qm=qm.sum64_4_lo,Jm=qm.sum64_5_hi,$m=qm.sum64_5_lo,tg=Fm.BlockHash,eg=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function rg(){if(!(this instanceof rg))return new rg;tg.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=eg,this.W=new Array(160)}qm.inherits(rg,tg);var ig=rg;function ng(t,e,r,i,n){var o=t&r^~t&n;return o<0&&(o+=4294967296),o}function og(t,e,r,i,n,o){var s=e&i^~e&o;return s<0&&(s+=4294967296),s}function sg(t,e,r,i,n){var o=t&r^t&n^r&n;return o<0&&(o+=4294967296),o}function ag(t,e,r,i,n,o){var s=e&i^e&o^i&o;return s<0&&(s+=4294967296),s}function hg(t,e){var r=Hm(t,e,28)^Hm(e,t,2)^Hm(e,t,7);return r<0&&(r+=4294967296),r}function ug(t,e){var r=Km(t,e,28)^Km(e,t,2)^Km(e,t,7);return r<0&&(r+=4294967296),r}function fg(t,e){var r=Hm(t,e,14)^Hm(t,e,18)^Hm(e,t,9);return r<0&&(r+=4294967296),r}function lg(t,e){var r=Km(t,e,14)^Km(t,e,18)^Km(e,t,9);return r<0&&(r+=4294967296),r}function cg(t,e){var r=Hm(t,e,1)^Hm(t,e,8)^Vm(t,e,7);return r<0&&(r+=4294967296),r}function dg(t,e){var r=Km(t,e,1)^Km(t,e,8)^Gm(t,e,7);return r<0&&(r+=4294967296),r}function pg(t,e){var r=Hm(t,e,19)^Hm(e,t,29)^Vm(t,e,6);return r<0&&(r+=4294967296),r}function mg(t,e){var r=Km(t,e,19)^Km(e,t,29)^Gm(t,e,6);return r<0&&(r+=4294967296),r}rg.blockSize=1024,rg.outSize=512,rg.hmacStrength=192,rg.padLength=128,rg.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i<r.length;i+=2){var n=pg(r[i-4],r[i-3]),o=mg(r[i-4],r[i-3]),s=r[i-14],a=r[i-13],h=cg(r[i-30],r[i-29]),u=dg(r[i-30],r[i-29]),f=r[i-32],l=r[i-31];r[i]=Xm(n,o,s,a,h,u,f,l),r[i+1]=Qm(n,o,s,a,h,u,f,l)}},rg.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,i=this.h[0],n=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],h=this.h[5],u=this.h[6],f=this.h[7],l=this.h[8],c=this.h[9],d=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],b=this.h[15];zm(this.k.length===r.length);for(var v=0;v<r.length;v+=2){var w=y,_=b,M=fg(l,c),S=lg(l,c),E=ng(l,c,d,p,m),k=og(l,c,d,p,m,g),A=this.k[v],O=this.k[v+1],T=r[v],I=r[v+1],R=Jm(w,_,M,S,E,k,A,O,T,I),C=$m(w,_,M,S,E,k,A,O,T,I);w=hg(i,n),_=ug(i,n),M=sg(i,n,o,s,a),S=ag(i,n,o,s,a,h);var P=Ym(w,_,M,S),x=Zm(w,_,M,S);y=m,b=g,m=d,g=p,d=l,p=c,l=Ym(u,f,R,C),c=Zm(f,f,R,C),u=a,f=h,a=o,h=s,o=i,s=n,i=Ym(R,C,P,x),n=Zm(R,C,P,x)}Wm(this.h,0,i,n),Wm(this.h,2,o,s),Wm(this.h,4,a,h),Wm(this.h,6,u,f),Wm(this.h,8,l,c),Wm(this.h,10,d,p),Wm(this.h,12,m,g),Wm(this.h,14,y,b)},rg.prototype._digest=function(t){return"hex"===t?qm.toHex32(this.h,"big"):qm.split32(this.h,"big")};var gg=Vp,yg=ig;function bg(){if(!(this instanceof bg))return new bg;yg.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}gg.inherits(bg,yg);var vg=bg;bg.blockSize=1024,bg.outSize=384,bg.hmacStrength=192,bg.padLength=128,bg.prototype._digest=function(t){return"hex"===t?gg.toHex32(this.h.slice(0,12),"big"):gg.split32(this.h.slice(0,12),"big")},rm.sha1=bm,rm.sha224=Um,rm.sha256=Bm,rm.sha384=vg,rm.sha512=ig;var wg={},_g=Vp,Mg=Jp,Sg=_g.rotl32,Eg=_g.sum32,kg=_g.sum32_3,Ag=_g.sum32_4,Og=Mg.BlockHash;function Tg(){if(!(this instanceof Tg))return new Tg;Og.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function Ig(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function Rg(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function Cg(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}_g.inherits(Tg,Og),wg.ripemd160=Tg,Tg.blockSize=512,Tg.outSize=160,Tg.hmacStrength=192,Tg.padLength=64,Tg.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],o=this.h[3],s=this.h[4],a=r,h=i,u=n,f=o,l=s,c=0;c<80;c++){var d=Eg(Sg(Ag(r,Ig(c,i,n,o),t[Pg[c]+e],Rg(c)),Ng[c]),s);r=s,s=o,o=Sg(n,10),n=i,i=d,d=Eg(Sg(Ag(a,Ig(79-c,h,u,f),t[xg[c]+e],Cg(c)),Bg[c]),l),a=l,l=f,f=Sg(u,10),u=h,h=d}d=kg(this.h[1],n,f),this.h[1]=kg(this.h[2],o,l),this.h[2]=kg(this.h[3],s,a),this.h[3]=kg(this.h[4],r,h),this.h[4]=kg(this.h[0],i,u),this.h[0]=d},Tg.prototype._digest=function(t){return"hex"===t?_g.toHex32(this.h,"little"):_g.split32(this.h,"little")};var Pg=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],xg=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Ng=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Bg=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Lg=Vp,Dg=gl;function jg(t,e,r){if(!(this instanceof jg))return new jg(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(Lg.toArray(e,r))}var Ug,qg,Fg=jg;jg.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),Dg(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},jg.prototype.update=function(t,e){return this.inner.update(t,e),this},jg.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=Kp;e.utils=Vp,e.common=Jp,e.sha=rm,e.ripemd=wg,e.hmac=Fg,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(),function(t){var e,r=Hp,i=Kp,n=cp,o=hp.assert;function s(t){"short"===t.type?this.curve=new n.short(t):"edwards"===t.type?this.curve=new n.edwards(t):this.curve=new n.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var i=new s(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:i}),i}})}r.PresetCurve=s,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:i.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:i.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{e=qg?Ug:(qg=1,Ug={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}catch(t){e=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",e]})}();var zg=Kp,Hg=lp,Kg=gl;function Vg(t){if(!(this instanceof Vg))return new Vg(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=Hg.toArray(t.entropy,t.entropyEnc||"hex"),r=Hg.toArray(t.nonce,t.nonceEnc||"hex"),i=Hg.toArray(t.pers,t.persEnc||"hex");Kg(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var Gg=Vg;Vg.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.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},Vg.prototype._hmac=function(){return new zg.hmac(this.hash,this.K)},Vg.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},Vg.prototype.reseed=function(t,e,r,i){"string"!=typeof e&&(i=r,r=e,e=null),t=Hg.toArray(t,e),r=Hg.toArray(r,i),Kg(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Vg.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=Hg.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<t;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var o=n.slice(0,t);return this._update(r),this._reseed++,Hg.encode(o,e)};var Wg=up,Yg=hp.assert;function Zg(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Xg=Zg;Zg.fromPublic=function(t,e,r){return e instanceof Zg?e:new Zg(t,{pub:e,pubEnc:r})},Zg.fromPrivate=function(t,e,r){return e instanceof Zg?e:new Zg(t,{priv:e,privEnc:r})},Zg.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Zg.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Zg.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},Zg.prototype._importPrivate=function(t,e){this.priv=new Wg(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Zg.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?Yg(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Yg(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},Zg.prototype.derive=function(t){return t.validate()||Yg(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Zg.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Zg.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Zg.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Qg=up,Jg=hp,$g=Jg.assert;function ty(t,e){if(t instanceof ty)return t;this._importDER(t,e)||($g(t.r&&t.s,"Signature without r or s"),this.r=new Qg(t.r,16),this.s=new Qg(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var ey,ry,iy=ty;function ny(){this.place=0}function oy(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<i;o++,s++)n<<=8,n|=t[s],n>>>=0;return!(n<=127)&&(e.place=s,n)}function sy(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function ay(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}ty.prototype._importDER=function(t,e){t=Jg.toArray(t,e);var r=new ny;if(48!==t[r.place++])return!1;var i=oy(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=oy(t,r);if(!1===n)return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var s=oy(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new Qg(o),this.s=new Qg(a),this.recoveryParam=null,!0},ty.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=sy(e),r=sy(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];ay(i,e.length),(i=i.concat(e)).push(2),ay(i,r.length);var n=i.concat(r),o=[48];return ay(o,n.length),o=o.concat(n),Jg.encode(o,t)};var hy=hp,uy=hy.assert,fy=hy.parseBytes,ly=hy.cachedProperty;function cy(t,e){this.eddsa=t,this._secret=fy(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=fy(e.pub)}cy.fromPublic=function(t,e){return e instanceof cy?e:new cy(t,{pub:e})},cy.fromSecret=function(t,e){return e instanceof cy?e:new cy(t,{secret:e})},cy.prototype.secret=function(){return this._secret},ly(cy,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),ly(cy,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),ly(cy,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),ly(cy,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),ly(cy,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),ly(cy,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),cy.prototype.sign=function(t){return uy(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},cy.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},cy.prototype.getSecret=function(t){return uy(this._secret,"KeyPair is public only"),hy.encode(this.secret(),t)},cy.prototype.getPublic=function(t){return hy.encode(this.pubBytes(),t)};var dy=cy,py=up,my=hp,gy=my.assert,yy=my.cachedProperty,by=my.parseBytes;function vy(t,e){this.eddsa=t,"object"!=typeof e&&(e=by(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),gy(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof py&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}yy(vy,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),yy(vy,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),yy(vy,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),yy(vy,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),vy.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},vy.prototype.toHex=function(){return my.encode(this.toBytes(),"hex").toUpperCase()};var wy=vy,_y=Kp,My=Hp,Sy=hp,Ey=Sy.assert,ky=Sy.parseBytes,Ay=dy,Oy=wy;function Ty(t){if(Ey("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof Ty))return new Ty(t);t=My[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=_y.sha512}var Iy,Ry=Ty;function Cy(){return Iy||(Iy=1,function(t){var e=t;e.version=ap.version,e.utils=hp,e.rand=Hd(),e.curve=cp,e.curves=Hp,e.ec=function(){if(ry)return ey;ry=1;var t=up,e=Gg,r=hp,i=Hp,n=Hd(),o=r.assert,s=Xg,a=iy;function h(t){if(!(this instanceof h))return new h(t);"string"==typeof t&&(o(Object.prototype.hasOwnProperty.call(i,t),"Unknown curve "+t),t=i[t]),t instanceof i.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}return ey=h,h.prototype.keyPair=function(t){return new s(this,t)},h.prototype.keyFromPrivate=function(t,e){return s.fromPrivate(this,t,e)},h.prototype.keyFromPublic=function(t,e){return s.fromPublic(this,t,e)},h.prototype.genKeyPair=function(r){r||(r={});for(var i=new e({hash:this.hash,pers:r.pers,persEnc:r.persEnc||"utf8",entropy:r.entropy||n(this.hash.hmacStrength),entropyEnc:r.entropy&&r.entropyEnc||"utf8",nonce:this.n.toArray()}),o=this.n.byteLength(),s=this.n.sub(new t(2));;){var a=new t(i.generate(o));if(!(a.cmp(s)>0))return a.iaddn(1),this.keyFromPrivate(a)}},h.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},h.prototype.sign=function(r,i,n,o){"object"==typeof n&&(o=n,n=null),o||(o={}),i=this.keyFromPrivate(i,n),r=this._truncateToN(new t(r,16));for(var s=this.n.byteLength(),h=i.getPrivate().toArray("be",s),u=r.toArray("be",s),f=new e({hash:this.hash,entropy:h,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),l=this.n.sub(new t(1)),c=0;;c++){var d=o.k?o.k(c):new t(f.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 y=d.invm(this.n).mul(g.mul(i.getPrivate()).iadd(r));if(0!==(y=y.umod(this.n)).cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),b^=1),new a({r:g,s:y,recoveryParam:b})}}}}}},h.prototype.verify=function(e,r,i,n){e=this._truncateToN(new t(e,16)),i=this.keyFromPublic(i,n);var o=(r=new a(r,"hex")).r,s=r.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 h,u=s.invm(this.n),f=u.mul(e).umod(this.n),l=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(h=this.g.jmulAdd(f,i.getPublic(),l)).isInfinity()&&h.eqXToP(o):!(h=this.g.mulAdd(f,i.getPublic(),l)).isInfinity()&&0===h.getX().umod(this.n).cmp(o)},h.prototype.recoverPubKey=function(e,r,i,n){o((3&i)===i,"The recovery param is more than two bits"),r=new a(r,n);var s=this.n,h=new t(e),u=r.r,f=r.s,l=1&i,c=i>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");u=c?this.curve.pointFromX(u.add(this.curve.n),l):this.curve.pointFromX(u,l);var d=r.r.invm(s),p=s.sub(h).mul(d).umod(s),m=f.mul(d).umod(s);return this.g.mulAdd(p,u,m)},h.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new a(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")},ey}(),e.eddsa=Ry}(sp)),sp}Ty.prototype.sign=function(t,e){t=ky(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()),a=i.add(s).umod(this.curve.n);return this.makeSignature({R:n,S:a,Rencoded:o})},Ty.prototype.verify=function(t,e,r){t=ky(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)},Ty.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return Sy.intFromLE(t.digest()).umod(this.curve.n)},Ty.prototype.keyFromPublic=function(t){return Ay.fromPublic(this,t)},Ty.prototype.keyFromSecret=function(t){return Ay.fromSecret(this,t)},Ty.prototype.makeSignature=function(t){return t instanceof Oy?t:new Oy(this,t)},Ty.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},Ty.prototype.decodePoint=function(t){var e=(t=Sy.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),i=0!=(128&t[e]),n=Sy.intFromLE(r);return this.curve.pointFromY(n,i)},Ty.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},Ty.prototype.decodeInt=function(t){return Sy.intFromLE(t)},Ty.prototype.isPoint=function(t){return t instanceof this.pointClass};var Py={},xy={},Ny={},By={get exports(){return Ny},set exports(t){Ny=t}};!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.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 o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:co.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.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<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.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;f<a;f+=i)u=h(t,f,f+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var l=1;for(u=h(t,f,t.length,e),f=0;f<s;f++)l*=e;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[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 c(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,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var f=h>>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!=(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=f[t],d=l[t];i="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);i=(p=p.idivn(d)).isZero()?m+i:u[c-m.length]+m+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.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<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,f=0|s[0],l=8191&f,c=f>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],S=8191&M,E=M>>>13,k=0|s[5],A=8191&k,O=k>>>13,T=0|s[6],I=8191&T,R=T>>>13,C=0|s[7],P=8191&C,x=C>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],j=8191&D,U=D>>>13,q=0|a[0],F=8191&q,z=q>>>13,H=0|a[1],K=8191&H,V=H>>>13,G=0|a[2],W=8191&G,Y=G>>>13,Z=0|a[3],X=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>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],ht=8191&at,ut=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=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,z))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,z))+Math.imul(m,F)|0,o=Math.imul(m,z);var yt=(u+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,z))+Math.imul(b,F)|0,o=Math.imul(b,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var bt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,z))+Math.imul(_,F)|0,o=Math.imul(_,z),i=i+Math.imul(y,K)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var vt=(u+(i=i+Math.imul(l,X)|0)|0)+((8191&(n=(n=n+Math.imul(l,Q)|0)+Math.imul(c,X)|0))<<13)|0;u=((o=o+Math.imul(c,Q)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,F),n=(n=Math.imul(S,z))+Math.imul(E,F)|0,o=Math.imul(E,z),i=i+Math.imul(w,K)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,Q)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,z))+Math.imul(O,F)|0,o=Math.imul(O,z),i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,V)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,Q)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,F),n=(n=Math.imul(I,z))+Math.imul(R,F)|0,o=Math.imul(R,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,Q)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,Q)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|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 Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,F),n=(n=Math.imul(P,z))+Math.imul(x,F)|0,o=Math.imul(x,z),i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,Y)|0,i=i+Math.imul(S,X)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Q)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,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=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,z))+Math.imul(L,F)|0,o=Math.imul(L,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,Q)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(j,F),n=(n=Math.imul(j,z))+Math.imul(U,F)|0,o=Math.imul(U,z),i=i+Math.imul(B,K)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,Q)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Q)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|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 kt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(j,K),n=(n=Math.imul(j,V))+Math.imul(U,K)|0,o=Math.imul(U,V),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,Q)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Q)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(j,W),n=(n=Math.imul(j,Y))+Math.imul(U,W)|0,o=Math.imul(U,Y),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,Q)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,Q)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Ot=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(j,X),n=(n=Math.imul(j,Q))+Math.imul(U,X)|0,o=Math.imul(U,Q),i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(O,ht)|0,o=o+Math.imul(O,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(U,$)|0,o=Math.imul(U,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(j,rt),n=(n=Math.imul(j,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var Rt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(j,ot),n=(n=Math.imul(j,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ct)|0;var Ct=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(j,ht),n=(n=Math.imul(j,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Pt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(j,lt),n=(n=Math.imul(j,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var xt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Nt=(u+(i=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=Et,h[9]=kt,h[10]=At,h[11]=Ot,h[12]=Tt,h[13]=It,h[14]=Rt,h[15]=Ct,h[16]=Pt,h[17]=xt,h[18]=Nt,0!==u&&(h[19]=u,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,e):i<63?c(this,t,e):i<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<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var f=o-u,l=(0|t.words[f])*(0|e.words[u]),c=67108863&l;a=67108863&(c=c+a|0),n+=(s=(s=s+(l/67108864|0)|0)+(c>>>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):p(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},m.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},m.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),f=0;f<n;f+=a)for(var l=h,c=u,d=0;d<s;d++){var p=r[f+d],m=i[f+d],g=r[f+d+s],y=i[f+d+s],b=l*g-c*y;y=l*y+c*g,g=b,r[f+d]=p+g,i[f+d]=m+y,r[f+d+s]=p-g,i[f+d+s]=m-y,d!==a&&(b=h*l-u*c,c=h*c+u*l,l=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},m.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},m.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),f=new Array(i),l=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,f,l,i,n);for(var d=0;d<i;d++){var p=a[d]*f[d]-h[d]*l[d];h[d]=a[d]*l[d]+h[d]*f[d],a[d]=p}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),p(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i||!(this.words[i]&n))},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!=(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var f=i.clone()._ishlnsubmul(o,1,h);0===f.negative&&(i=f,a&&(a.words[h]=1));for(var l=h-1;l>=0;l--){var c=67108864*(0|i.words[o.length+l])+(0|i.words[o.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,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}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.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)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var f=i.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;)(o.isOdd()||s.isOdd())&&(o.iadd(f),s.isub(l)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(i.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(i.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;0==(i.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(i.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.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)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new M(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}y.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.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=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,y),i(w,y),i(_,y),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return g[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.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)},M.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},M.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)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(l,new n(1).iushln(p-g-1));c=c.redMul(y),l=y.redSqr(),d=d.redMul(l),p=g}return c},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new S(t)},i(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.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)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(By,Y);var Ly,Dy={},jy={},Uy=co,qy=Uy.Buffer,Fy={};for(Ly in Uy)Uy.hasOwnProperty(Ly)&&"SlowBuffer"!==Ly&&"Buffer"!==Ly&&(Fy[Ly]=Uy[Ly]);var zy=Fy.Buffer={};for(Ly in qy)qy.hasOwnProperty(Ly)&&"allocUnsafe"!==Ly&&"allocUnsafeSlow"!==Ly&&(zy[Ly]=qy[Ly]);if(Fy.Buffer.prototype=qy.prototype,zy.from&&zy.from!==Uint8Array.from||(zy.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 qy(t,e,r)}),zy.alloc||(zy.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=qy(t);return e&&0!==e.length?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i}),!Fy.kStringMaxLength)try{Fy.kStringMaxLength=oo.binding("buffer").kStringMaxLength}catch(Vi){}Fy.constants||(Fy.constants={MAX_LENGTH:Fy.kMaxLength},Fy.kStringMaxLength&&(Fy.constants.MAX_STRING_LENGTH=Fy.kStringMaxLength));var Hy=Fy,Ky={};const Vy=bo;function Gy(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function Wy(t,e){this.path=t,this.rethrow(e)}Ky.Reporter=Gy,Gy.prototype.isError=function(t){return t instanceof Wy},Gy.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},Gy.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},Gy.prototype.enterKey=function(t){return this._reporterState.path.push(t)},Gy.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},Gy.prototype.leaveKey=function(t,e,r){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=r)},Gy.prototype.path=function(){return this._reporterState.path.join("/")},Gy.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},Gy.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},Gy.prototype.error=function(t){let e;const r=this._reporterState,i=t instanceof Wy;if(e=i?t:new Wy(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},Gy.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},Vy(Wy,Error),Wy.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,Wy),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this};var Yy={};const Zy=bo,Xy=Ky.Reporter,Qy=Hy.Buffer;function Jy(t,e){Xy.call(this,e),Qy.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function $y(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return $y.isEncoderBuffer(t)||(t=new $y(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=Qy.byteLength(t);else{if(!Qy.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}Zy(Jy,Xy),Yy.DecoderBuffer=Jy,Jy.isDecoderBuffer=function(t){if(t instanceof Jy)return!0;return"object"==typeof t&&Qy.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},Jy.prototype.save=function(){return{offset:this.offset,reporter:Xy.prototype.save.call(this)}},Jy.prototype.restore=function(t){const e=new Jy(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,Xy.prototype.restore.call(this,t.reporter),e},Jy.prototype.isEmpty=function(){return this.offset===this.length},Jy.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},Jy.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const r=new Jy(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},Jy.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},Yy.EncoderBuffer=$y,$y.isEncoderBuffer=function(t){if(t instanceof $y)return!0;return"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},$y.prototype.join=function(t,e){return t||(t=Qy.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):Qy.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t};const tb=Ky.Reporter,eb=Yy.EncoderBuffer,rb=Yy.DecoderBuffer,ib=gl,nb=["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"],ob=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(nb);function sb(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())}var ab=sb;const hb=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];sb.prototype.clone=function(){const t=this._baseState,e={};hb.forEach((function(r){e[r]=t[r]}));const r=new this.constructor(e.parent);return r._baseState=e,r},sb.prototype._wrap=function(){const t=this._baseState;ob.forEach((function(e){this[e]=function(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},sb.prototype._init=function(t){const e=this._baseState;ib(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),ib.equal(e.children.length,1,"Root node can have only one child")},sb.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&&(ib(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(ib(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){sb.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),nb.forEach((function(t){sb.prototype[t]=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return ib(null===e.tag),e.tag=t,this._useArgs(r),this}})),sb.prototype.use=function(t){ib(t);const e=this._baseState;return ib(null===e.use),e.use=t,this},sb.prototype.optional=function(){return this._baseState.optional=!0,this},sb.prototype.def=function(t){const e=this._baseState;return ib(null===e.default),e.default=t,e.optional=!0,this},sb.prototype.explicit=function(t){const e=this._baseState;return ib(null===e.explicit&&null===e.implicit),e.explicit=t,this},sb.prototype.implicit=function(t){const e=this._baseState;return ib(null===e.explicit&&null===e.implicit),e.implicit=t,this},sb.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},sb.prototype.key=function(t){const e=this._baseState;return ib(null===e.key),e.key=t,this},sb.prototype.any=function(){return this._baseState.any=!0,this},sb.prototype.choice=function(t){const e=this._baseState;return ib(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},sb.prototype.contains=function(t){const e=this._baseState;return ib(null===e.use),e.contains=t,this},sb.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,o=!0,s=null;if(null!==r.key&&(s=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(o=this._peekTag(t,i,r.any),t.isError(o))return o}else{const i=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),o=!0}catch(t){o=!1}t.restore(i)}}if(r.obj&&o&&(i=t.enterObject()),o){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 rb(n);n=this._getUse(r.contains,t._reporterState.obj)._decode(i,e)}}return r.obj&&o&&(n=t.leaveObject(i)),null===r.key||null===n&&!0!==o?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,n),n},sb.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)},sb.prototype._getUse=function(t,e){const r=this._baseState;return r.useDecoder=this._use(t,e),ib(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},sb.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")},sb.prototype._createEncoderBuffer=function(t){return new eb(t,this.reporter)},sb.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},sb.prototype._encodeValue=function(t,e,r){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(t,e||new tb);let n=null;if(this.reporter=e,i.optional&&void 0===t){if(null===i.default)return;t=i.default}let o=null,s=!1;if(i.any)n=this._createEncoderBuffer(t);else if(i.choice)n=this._encodeChoice(t,e);else if(i.contains)o=this._getUse(i.contains,r)._encode(t,e),s=!0;else if(i.children)o=i.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})),o=this._createEncoderBuffer(o);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return e.error("Too many args for : "+i.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,o=this._createEncoderBuffer(t.map((function(r){const i=this._baseState;return this._getUse(i.args[0],t)._encode(r,e)}),r))}else null!==i.use?n=this._getUse(i.use,r)._encode(t,e):(o=this._encodePrimitive(i.tag,t),s=!0);if(!i.any&&null===i.choice){const t=null!==i.implicit?i.implicit:i.tag,r=null===i.implicit?"universal":"context";null===t?null===i.use&&e.error("Tag could be omitted only for .use()"):null===i.use&&(n=this._encodeComposite(t,s,r,o))}return null!==i.explicit&&(n=this._encodeComposite(i.explicit,!1,"context",n)),n},sb.prototype._encodeChoice=function(t,e){const r=this._baseState,i=r.choice[t.type];return i||ib(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,e)},sb.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)},sb.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},sb.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)};var ub={};!function(t){function e(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const i=t[r];e[i]=r})),e}t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=e(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=e(t.tag)}(ub);const fb=bo,lb=Hy.Buffer,cb=ab,db=ub;function pb(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new gb,this.tree._init(t.body)}var mb=pb;function gb(t){cb.call(this,"der",t)}function yb(t){return t<10?"0"+t:t}pb.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},fb(gb,cb),gb.prototype._encodeComposite=function(t,e,r,i){const n=function(t,e,r,i){let n;"seqof"===t?t="seq":"setof"===t&&(t="set");if(db.tagByName.hasOwnProperty(t))n=db.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|=db.tagClassByName[r||"universal"]<<6,n}(t,e,r,this.reporter);if(i.length<128){const t=lb.alloc(2);return t[0]=n,t[1]=i.length,this._createEncoderBuffer([t,i])}let o=1;for(let t=i.length;t>=256;t>>=8)o++;const s=lb.alloc(2+o);s[0]=n,s[1]=128|o;for(let t=1+o,e=i.length;e>0;t--,e>>=8)s[t]=255&e;return this._createEncoderBuffer([s,i])},gb.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=lb.alloc(2*t.length);for(let r=0;r<t.length;r++)e.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(e)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)||"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},gb.prototype._encodeObjid=function(t,e,r){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s.]+/g);for(let e=0;e<t.length;e++)t[e]|=0}else if(Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!r){if(t[1]>=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<t.length;e++){let r=t[e];for(i++;r>=128;r>>=7)i++}const n=lb.alloc(i);let o=n.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(n[o--]=127&r;(r>>=7)>0;)n[o--]=128|127&r}return this._createEncoderBuffer(n)},gb.prototype._encodeTime=function(t,e){let r;const i=new Date(t);return"gentime"===e?r=[yb(i.getUTCFullYear()),yb(i.getUTCMonth()+1),yb(i.getUTCDate()),yb(i.getUTCHours()),yb(i.getUTCMinutes()),yb(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[yb(i.getUTCFullYear()%100),yb(i.getUTCMonth()+1),yb(i.getUTCDate()),yb(i.getUTCHours()),yb(i.getUTCMinutes()),yb(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},gb.prototype._encodeNull=function(){return this._createEncoderBuffer("")},gb.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&&!lb.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=lb.from(e)}if(lb.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=lb.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(lb.from(i))},gb.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},gb.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},gb.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<o.length;n++)if(o[n]!==i.defaultBuffer[n])return!1;return!0};const bb=mb;function vb(t){bb.call(this,t),this.enc="pem"}bo(vb,bb);var wb=vb;vb.prototype.encode=function(t,e){const r=bb.prototype.encode.call(this,t).toString("base64"),i=["-----BEGIN "+e.label+"-----"];for(let t=0;t<r.length;t+=64)i.push(r.slice(t,t+64));return i.push("-----END "+e.label+"-----"),i.join("\n")},function(t){const e=t;e.der=mb,e.pem=wb}(jy);var _b={};const Mb=bo,Sb=Ny,Eb=Yy.DecoderBuffer,kb=ab,Ab=ub;function Ob(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new Ib,this.tree._init(t.body)}var Tb=Ob;function Ib(t){kb.call(this,"der",t)}function Rb(t,e){let r=t.readUInt8(e);if(t.isError(r))return r;const i=Ab.tagClass[r>>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:Ab.tag[r]}}function Cb(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<n;e++){i<<=8;const e=t.readUInt8(r);if(t.isError(e))return e;i|=e}return i}Ob.prototype.decode=function(t,e){return Eb.isDecoderBuffer(t)||(t=new Eb(t,e)),this.tree._decode(t,e)},Mb(Ib,kb),Ib.prototype._peekTag=function(t,e,r){if(t.isEmpty())return!1;const i=t.save(),n=Rb(t,'Failed to peek tag: "'+e+'"');return t.isError(n)?n:(t.restore(i),n.tag===e||n.tagStr===e||n.tagStr+"of"===e||r)},Ib.prototype._decodeTag=function(t,e,r){const i=Rb(t,'Failed to decode tag of "'+e+'"');if(t.isError(i))return i;let n=Cb(t,i.primitive,'Failed to get length of "'+e+'"');if(t.isError(n))return n;if(!r&&i.tag!==e&&i.tagStr!==e&&i.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(i.primitive||null!==n)return t.skip(n,'Failed to match body of: "'+e+'"');const o=t.save(),s=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(s)?s:(n=t.offset-o.offset,t.restore(o),t.skip(n,'Failed to match body of: "'+e+'"'))},Ib.prototype._skipUntilEnd=function(t,e){for(;;){const r=Rb(t,e);if(t.isError(r))return r;const i=Cb(t,r.primitive,e);if(t.isError(i))return i;let n;if(n=r.primitive||null!==i?t.skip(i):this._skipUntilEnd(t,e),t.isError(n))return n;if("end"===r.tagStr)break}},Ib.prototype._decodeList=function(t,e,r,i){const n=[];for(;!t.isEmpty();){const e=this._peekTag(t,"end");if(t.isError(e))return e;const o=r.decode(t,"der",i);if(t.isError(o)&&e)break;n.push(o)}return n},Ib.prototype._decodeStr=function(t,e){if("bitstr"===e){const e=t.readUInt8();return t.isError(e)?e:{unused:e,data:t.raw()}}if("bmpstr"===e){const e=t.raw();if(e.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");let r="";for(let t=0;t<e.length/2;t++)r+=String.fromCharCode(e.readUInt16BE(2*t));return r}if("numstr"===e){const e=t.raw().toString("ascii");return this._isNumstr(e)?e:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){const e=t.raw().toString("ascii");return this._isPrintstr(e)?e:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},Ib.prototype._decodeObjid=function(t,e,r){let i;const n=[];let o=0,s=0;for(;!t.isEmpty();)s=t.readUInt8(),o<<=7,o|=127&s,0==(128&s)&&(n.push(o),o=0);128&s&&n.push(o);const a=n[0]/40|0,h=n[0]%40;if(i=r?n:[a,h].concat(n.slice(1)),e){let t=e[i.join(" ")];void 0===t&&(t=e[i.join(".")]),void 0!==t&&(i=t)}return i},Ib.prototype._decodeTime=function(t,e){const r=t.raw().toString();let i,n,o,s,a,h;if("gentime"===e)i=0|r.slice(0,4),n=0|r.slice(4,6),o=0|r.slice(6,8),s=0|r.slice(8,10),a=0|r.slice(10,12),h=0|r.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");i=0|r.slice(0,2),n=0|r.slice(2,4),o=0|r.slice(4,6),s=0|r.slice(6,8),a=0|r.slice(8,10),h=0|r.slice(10,12),i=i<70?2e3+i:1900+i}return Date.UTC(i,n-1,o,s,a,h,0)},Ib.prototype._decodeNull=function(){return null},Ib.prototype._decodeBool=function(t){const e=t.readUInt8();return t.isError(e)?e:0!==e},Ib.prototype._decodeInt=function(t,e){const r=t.raw();let i=new Sb(r);return e&&(i=e[i.toString(10)]||i),i},Ib.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree};const Pb=bo,xb=Hy.Buffer,Nb=Tb;function Bb(t){Nb.call(this,t),this.enc="pem"}Pb(Bb,Nb);var Lb=Bb;Bb.prototype.decode=function(t,e){const r=t.toString().split(/[\r\n]+/g),i=e.label.toUpperCase(),n=/^-----(BEGIN|END) ([^-]+)-----$/;let o=-1,s=-1;for(let t=0;t<r.length;t++){const e=r[t].match(n);if(null!==e&&e[2]===i){if(-1!==o){if("END"!==e[1])break;s=t;break}if("BEGIN"!==e[1])break;o=t}}if(-1===o||-1===s)throw new Error("PEM section not found for: "+i);const a=r.slice(o+1,s).join("");a.replace(/[^a-z0-9+/=]+/gi,"");const h=xb.from(a,"base64");return Nb.prototype.decode.call(this,h,e)},function(t){const e=t;e.der=Tb,e.pem=Lb}(_b),function(t){const e=jy,r=_b,i=bo;function n(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}t.define=function(t,e){return new n(t,e)},n.prototype._createNamed=function(t){const e=this.name;function r(t){this._initNamed(t,e)}return i(r,t),r.prototype._initNamed=function(e,r){t.call(this,e,r)},new r(this)},n.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(r[t])),this.decoders[t]},n.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},n.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(e[t])),this.encoders[t]},n.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}}(Dy);var Db={};!function(t){const e=t;e.Reporter=Ky.Reporter,e.DecoderBuffer=Yy.DecoderBuffer,e.EncoderBuffer=Yy.EncoderBuffer,e.Node=ab}(Db);var jb={};!function(t){const e=jb;e._reverse=function(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const i=t[r];e[i]=r})),e},e.der=ub}(),function(t){const e=xy;e.bignum=Ny,e.define=Dy.define,e.base=Db,e.constants=jb,e.decoders=_b,e.encoders=jy}();var Ub=xy,qb=Ub.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),Fb=Ub.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),zb=Ub.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),Hb=Ub.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(zb),this.key("subjectPublicKey").bitstr())})),Kb=Ub.define("RelativeDistinguishedName",(function(){this.setof(Fb)})),Vb=Ub.define("RDNSequence",(function(){this.seqof(Kb)})),Gb=Ub.define("Name",(function(){this.choice({rdnSequence:this.use(Vb)})})),Wb=Ub.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(qb),this.key("notAfter").use(qb))})),Yb=Ub.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),Zb=Ub.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(zb),this.key("issuer").use(Gb),this.key("validity").use(Wb),this.key("subject").use(Gb),this.key("subjectPublicKeyInfo").use(Hb),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(Yb).optional())})),Xb=Ub.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(Zb),this.key("signatureAlgorithm").use(zb),this.key("signatureValue").bitstr())})),Qb=xy;Py.certificate=Xb;var Jb=Qb.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));Py.RSAPrivateKey=Jb;var $b=Qb.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));Py.RSAPublicKey=$b;var tv=Qb.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(ev),this.key("subjectPublicKey").bitstr())}));Py.PublicKey=tv;var ev=Qb.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),rv=Qb.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(ev),this.key("subjectPrivateKey").octstr())}));Py.PrivateKey=rv;var iv=Qb.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));Py.EncryptedPrivateKey=iv;var nv=Qb.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));Py.DSAPrivateKey=nv,Py.DSAparam=Qb.define("DSAparam",(function(){this.int()}));var ov=Qb.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(sv),this.key("publicKey").optional().explicit(1).bitstr())}));Py.ECPrivateKey=ov;var sv=Qb.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));Py.signature=Qb.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}));var av=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,hv=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,uv=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,fv=Qc,lv=Gl,cv=fo.Buffer,dv=Py,pv={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"},mv=function(t,e){var r,i=t.toString(),n=i.match(av);if(n){var o="aes"+n[1],s=cv.from(n[2],"hex"),a=cv.from(n[3].replace(/[\r\n]/g,""),"base64"),h=fv(e,s.slice(0,8),parseInt(n[1],10)).key,u=[],f=lv.createDecipheriv(o,h,s);u.push(f.update(a)),u.push(f.final()),r=cv.concat(u)}else{var l=i.match(uv);r=cv.from(l[2].replace(/[\r\n]/g,""),"base64")}return{tag:i.match(hv)[1],data:r}},gv=Gl,yv=Bf,bv=fo.Buffer,vv=wv;function wv(t){var e;"object"!=typeof t||bv.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=bv.from(t));var r,i,n=mv(t,e),o=n.tag,s=n.data;switch(o){case"CERTIFICATE":i=dv.certificate.decode(s,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(i||(i=dv.PublicKey.decode(s,"der")),r=i.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return dv.RSAPublicKey.decode(i.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return i.subjectPrivateKey=i.subjectPublicKey,{type:"ec",data:i};case"1.2.840.10040.4.1":return i.algorithm.params.pub_key=dv.DSAparam.decode(i.subjectPublicKey.data,"der"),{type:"dsa",data:i.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":s=function(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),n=pv[t.algorithm.decrypt.cipher.algo.join(".")],o=t.algorithm.decrypt.cipher.iv,s=t.subjectPrivateKey,a=parseInt(n.split("-")[1],10)/8,h=yv.pbkdf2Sync(e,r,i,a,"sha1"),u=gv.createDecipheriv(n,h,o),f=[];return f.push(u.update(s)),f.push(u.final()),bv.concat(f)}(s=dv.EncryptedPrivateKey.decode(s,"der"),e);case"PRIVATE KEY":switch(r=(i=dv.PrivateKey.decode(s,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return dv.RSAPrivateKey.decode(i.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:i.algorithm.curve,privateKey:dv.ECPrivateKey.decode(i.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return i.algorithm.params.priv_key=dv.DSAparam.decode(i.subjectPrivateKey,"der"),{type:"dsa",params:i.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return dv.RSAPublicKey.decode(s,"der");case"RSA PRIVATE KEY":return dv.RSAPrivateKey.decode(s,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:dv.DSAPrivateKey.decode(s,"der")};case"EC PRIVATE KEY":return{curve:(s=dv.ECPrivateKey.decode(s,"der")).parameters.value,privateKey:s.privateKey};default:throw new Error("unknown key type "+o)}}wv.signature=dv.signature;var _v,Mv,Sv,Ev,kv,Av={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"};function Ov(){if(_v)return Qd;_v=1;var t=fo.Buffer,e=Rf,r=op,i=Cy().ec,n=$d,o=vv,s=Av;function a(r,i,n,o){if((r=t.from(r.toArray())).length<i.byteLength()){var s=t.alloc(i.byteLength()-r.length);r=t.concat([s,r])}var a=n.length,u=function(e,r){e=h(e,r),e=e.mod(r);var i=t.from(e.toArray());if(i.length<r.byteLength()){var n=t.alloc(r.byteLength()-i.length);i=t.concat([n,i])}return i}(n,i),f=t.alloc(a);f.fill(1);var l=t.alloc(a);return l=e(o,l).update(f).update(t.from([0])).update(r).update(u).digest(),f=e(o,l).update(f).digest(),{k:l=e(o,l).update(f).update(t.from([1])).update(r).update(u).digest(),v:f=e(o,l).update(f).digest()}}function h(t,e){var r=new n(t),i=(t.length<<3)-e.bitLength();return i>0&&r.ishrn(i),r}function u(r,i,n){var o,s;do{for(o=t.alloc(0);8*o.length<r.bitLength();)i.v=e(n,i.k).update(i.v).digest(),o=t.concat([o,i.v]);s=h(o,r),i.k=e(n,i.k).update(i.v).update(t.from([0])).digest(),i.v=e(n,i.k).update(i.v).digest()}while(-1!==s.cmp(r));return s}function f(t,e,r,i){return t.toRed(n.mont(r)).redPow(e).fromRed().mod(i)}return Jd.exports=function(e,l,c,d,p){var m=o(l);if(m.curve){if("ecdsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong private key type");return function(e,r){var n=s[r.curve.join(".")];if(!n)throw new Error("unknown curve "+r.curve.join("."));var o=new i(n),a=o.keyFromPrivate(r.privateKey),h=a.sign(e);return t.from(h.toDER())}(e,m)}if("dsa"===m.type){if("dsa"!==d)throw new Error("wrong private key type");return function(e,r,i){var o,s=r.params.priv_key,l=r.params.p,c=r.params.q,d=r.params.g,p=new n(0),m=h(e,c).mod(c),g=!1,y=a(s,c,e,i);for(;!1===g;)p=f(d,o=u(c,y,i),l,c),0===(g=o.invm(c).imul(m.add(s.mul(p))).mod(c)).cmpn(0)&&(g=!1,p=new n(0));return function(e,r){e=e.toArray(),r=r.toArray(),128&e[0]&&(e=[0].concat(e));128&r[0]&&(r=[0].concat(r));var i=e.length+r.length+4,n=[48,i,2,e.length];return n=n.concat(e,[2,r.length],r),t.from(n)}(p,g)}(e,m,c)}if("rsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong private key type");e=t.concat([p,e]);for(var g=m.modulus.byteLength(),y=[0,1];e.length+y.length+1<g;)y.push(255);y.push(0);for(var b=-1;++b<e.length;)y.push(e[b]);return r(y,m)},Qd.getKey=a,Qd.makeKey=u,Qd}function Tv(){if(Sv)return Mv;Sv=1;var t=fo.Buffer,e=$d,r=Cy().ec,i=vv,n=Av;function o(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=e)throw new Error("invalid sig")}return Mv=function(s,a,h,u,f){var l=i(h);if("ec"===l.type){if("ecdsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");return function(t,e,i){var o=n[i.data.algorithm.curve.join(".")];if(!o)throw new Error("unknown curve "+i.data.algorithm.curve.join("."));var s=new r(o),a=i.data.subjectPrivateKey.data;return s.verify(e,t,a)}(s,a,l)}if("dsa"===l.type){if("dsa"!==u)throw new Error("wrong public key type");return function(t,r,n){var s=n.data.p,a=n.data.q,h=n.data.g,u=n.data.pub_key,f=i.signature.decode(t,"der"),l=f.s,c=f.r;o(l,a),o(c,a);var d=e.mont(s),p=l.invm(a),m=h.toRed(d).redPow(new e(r).mul(p).mod(a)).fromRed().mul(u.toRed(d).redPow(c.mul(p).mod(a)).fromRed()).mod(s).mod(a);return 0===m.cmp(c)}(s,a,l)}if("rsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");a=t.concat([f,a]);for(var c=l.modulus.byteLength(),d=[1],p=0;a.length+d.length+2<c;)d.push(255),p++;d.push(0);for(var m=-1;++m<a.length;)d.push(a[m]);d=t.from(d);var g=e.mont(l.modulus);s=(s=new e(s).toRed(g)).redPow(new e(l.publicExponent)),s=t.from(s.fromRed().toArray());var y=p<8?1:0;for(c=Math.min(s.length,d.length),s.length!==d.length&&(y=1),m=-1;++m<c;)y|=s[m]^d[m];return 0===y},Mv}var Iv,Rv,Cv={},Pv={get exports(){return Cv},set exports(t){Cv=t}};!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.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 o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:co.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.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<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.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;f<a;f+=i)u=h(t,f,f+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var l=1;for(u=h(t,f,t.length,e),f=0;f<s;f++)l*=e;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[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 c(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,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var f=h>>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!=(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=f[t],d=l[t];i="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);i=(p=p.idivn(d)).isZero()?m+i:u[c-m.length]+m+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.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<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,f=0|s[0],l=8191&f,c=f>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],S=8191&M,E=M>>>13,k=0|s[5],A=8191&k,O=k>>>13,T=0|s[6],I=8191&T,R=T>>>13,C=0|s[7],P=8191&C,x=C>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],j=8191&D,U=D>>>13,q=0|a[0],F=8191&q,z=q>>>13,H=0|a[1],K=8191&H,V=H>>>13,G=0|a[2],W=8191&G,Y=G>>>13,Z=0|a[3],X=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>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],ht=8191&at,ut=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=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,z))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,z))+Math.imul(m,F)|0,o=Math.imul(m,z);var yt=(u+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,z))+Math.imul(b,F)|0,o=Math.imul(b,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var bt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,z))+Math.imul(_,F)|0,o=Math.imul(_,z),i=i+Math.imul(y,K)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var vt=(u+(i=i+Math.imul(l,X)|0)|0)+((8191&(n=(n=n+Math.imul(l,Q)|0)+Math.imul(c,X)|0))<<13)|0;u=((o=o+Math.imul(c,Q)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,F),n=(n=Math.imul(S,z))+Math.imul(E,F)|0,o=Math.imul(E,z),i=i+Math.imul(w,K)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,Q)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,z))+Math.imul(O,F)|0,o=Math.imul(O,z),i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,V)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,Q)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,F),n=(n=Math.imul(I,z))+Math.imul(R,F)|0,o=Math.imul(R,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,Q)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,Q)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|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 Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,F),n=(n=Math.imul(P,z))+Math.imul(x,F)|0,o=Math.imul(x,z),i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,Y)|0,i=i+Math.imul(S,X)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Q)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,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=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,z))+Math.imul(L,F)|0,o=Math.imul(L,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,Q)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(j,F),n=(n=Math.imul(j,z))+Math.imul(U,F)|0,o=Math.imul(U,z),i=i+Math.imul(B,K)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,Q)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Q)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|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 kt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(j,K),n=(n=Math.imul(j,V))+Math.imul(U,K)|0,o=Math.imul(U,V),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,Q)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Q)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(j,W),n=(n=Math.imul(j,Y))+Math.imul(U,W)|0,o=Math.imul(U,Y),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,Q)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,Q)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Ot=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(j,X),n=(n=Math.imul(j,Q))+Math.imul(U,X)|0,o=Math.imul(U,Q),i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(O,ht)|0,o=o+Math.imul(O,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(U,$)|0,o=Math.imul(U,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(j,rt),n=(n=Math.imul(j,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var Rt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(j,ot),n=(n=Math.imul(j,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ct)|0;var Ct=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(j,ht),n=(n=Math.imul(j,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Pt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(j,lt),n=(n=Math.imul(j,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var xt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Nt=(u+(i=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=Et,h[9]=kt,h[10]=At,h[11]=Ot,h[12]=Tt,h[13]=It,h[14]=Rt,h[15]=Ct,h[16]=Pt,h[17]=xt,h[18]=Nt,0!==u&&(h[19]=u,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,e):i<63?c(this,t,e):i<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<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var f=o-u,l=(0|t.words[f])*(0|e.words[u]),c=67108863&l;a=67108863&(c=c+a|0),n+=(s=(s=s+(l/67108864|0)|0)+(c>>>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):p(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},m.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},m.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),f=0;f<n;f+=a)for(var l=h,c=u,d=0;d<s;d++){var p=r[f+d],m=i[f+d],g=r[f+d+s],y=i[f+d+s],b=l*g-c*y;y=l*y+c*g,g=b,r[f+d]=p+g,i[f+d]=m+y,r[f+d+s]=p-g,i[f+d+s]=m-y,d!==a&&(b=h*l-u*c,c=h*c+u*l,l=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},m.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},m.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),f=new Array(i),l=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,f,l,i,n);for(var d=0;d<i;d++){var p=a[d]*f[d]-h[d]*l[d];h[d]=a[d]*l[d]+h[d]*f[d],a[d]=p}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),p(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i||!(this.words[i]&n))},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!=(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var f=i.clone()._ishlnsubmul(o,1,h);0===f.negative&&(i=f,a&&(a.words[h]=1));for(var l=h-1;l>=0;l--){var c=67108864*(0|i.words[o.length+l])+(0|i.words[o.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,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}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.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)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var f=i.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;)(o.isOdd()||s.isOdd())&&(o.iadd(f),s.isub(l)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(i.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(i.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;0==(i.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(i.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.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)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new M(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}y.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.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=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,y),i(w,y),i(_,y),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return g[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.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)},M.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},M.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)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(l,new n(1).iushln(p-g-1));c=c.redMul(y),l=y.redSqr(),d=d.redMul(l),p=g}return c},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new S(t)},i(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.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)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(Pv,Y);var xv={},Nv=cf,Bv=fo.Buffer,Lv=function(t,e){for(var r,i=Bv.alloc(0),n=0;i.length<e;)r=Dv(n++),i=Bv.concat([i,Nv("sha1").update(t).update(r).digest()]);return i.slice(0,e)};function Dv(t){var e=Bv.allocUnsafe(4);return e.writeUInt32BE(t,0),e}var jv=function(t,e){for(var r=t.length,i=-1;++i<r;)t[i]^=e[i];return t},Uv={},qv={get exports(){return Uv},set exports(t){Uv=t}};!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.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 o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:co.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.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<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.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;f<a;f+=i)u=h(t,f,f+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var l=1;for(u=h(t,f,t.length,e),f=0;f<s;f++)l*=e;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[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 c(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,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var f=h>>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!=(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=f[t],d=l[t];i="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);i=(p=p.idivn(d)).isZero()?m+i:u[c-m.length]+m+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),f=this.clone();if(h){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.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<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,f=0|s[0],l=8191&f,c=f>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,M=0|s[4],S=8191&M,E=M>>>13,k=0|s[5],A=8191&k,O=k>>>13,T=0|s[6],I=8191&T,R=T>>>13,C=0|s[7],P=8191&C,x=C>>>13,N=0|s[8],B=8191&N,L=N>>>13,D=0|s[9],j=8191&D,U=D>>>13,q=0|a[0],F=8191&q,z=q>>>13,H=0|a[1],K=8191&H,V=H>>>13,G=0|a[2],W=8191&G,Y=G>>>13,Z=0|a[3],X=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>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],ht=8191&at,ut=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=(u+(i=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,z))+Math.imul(c,F)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,z))+Math.imul(m,F)|0,o=Math.imul(m,z);var yt=(u+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,z))+Math.imul(b,F)|0,o=Math.imul(b,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var bt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(c,W)|0))<<13)|0;u=((o=o+Math.imul(c,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(w,F),n=(n=Math.imul(w,z))+Math.imul(_,F)|0,o=Math.imul(_,z),i=i+Math.imul(y,K)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var vt=(u+(i=i+Math.imul(l,X)|0)|0)+((8191&(n=(n=n+Math.imul(l,Q)|0)+Math.imul(c,X)|0))<<13)|0;u=((o=o+Math.imul(c,Q)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,F),n=(n=Math.imul(S,z))+Math.imul(E,F)|0,o=Math.imul(E,z),i=i+Math.imul(w,K)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,Q)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,F),n=(n=Math.imul(A,z))+Math.imul(O,F)|0,o=Math.imul(O,z),i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,V)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,Q)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(I,F),n=(n=Math.imul(I,z))+Math.imul(R,F)|0,o=Math.imul(R,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,Q)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,Q)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|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 Mt=(u+(i=i+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,F),n=(n=Math.imul(P,z))+Math.imul(x,F)|0,o=Math.imul(x,z),i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,Y)|0,i=i+Math.imul(S,X)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Q)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,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=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,z))+Math.imul(L,F)|0,o=Math.imul(L,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,Q)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(j,F),n=(n=Math.imul(j,z))+Math.imul(U,F)|0,o=Math.imul(U,z),i=i+Math.imul(B,K)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,Q)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Q)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|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 kt=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(j,K),n=(n=Math.imul(j,V))+Math.imul(U,K)|0,o=Math.imul(U,V),i=i+Math.imul(B,W)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,Q)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Q)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(j,W),n=(n=Math.imul(j,Y))+Math.imul(U,W)|0,o=Math.imul(U,Y),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,Q)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,Q)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Ot=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(j,X),n=(n=Math.imul(j,Q))+Math.imul(U,X)|0,o=Math.imul(U,Q),i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(O,ht)|0,o=o+Math.imul(O,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ct)|0;var Tt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(U,$)|0,o=Math.imul(U,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(j,rt),n=(n=Math.imul(j,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0;var Rt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(j,ot),n=(n=Math.imul(j,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,ut)|0,i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ct)|0;var Ct=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(j,ht),n=(n=Math.imul(j,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),i=i+Math.imul(B,lt)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ct)|0;var Pt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(j,lt),n=(n=Math.imul(j,ct))+Math.imul(U,lt)|0,o=Math.imul(U,ct);var xt=(u+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Nt=(u+(i=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h[0]=gt,h[1]=yt,h[2]=bt,h[3]=vt,h[4]=wt,h[5]=_t,h[6]=Mt,h[7]=St,h[8]=Et,h[9]=kt,h[10]=At,h[11]=Ot,h[12]=Tt,h[13]=It,h[14]=Rt,h[15]=Ct,h[16]=Pt,h[17]=xt,h[18]=Nt,0!==u&&(h[19]=u,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,e):i<63?c(this,t,e):i<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<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var f=o-u,l=(0|t.words[f])*(0|e.words[u]),c=67108863&l;a=67108863&(c=c+a|0),n+=(s=(s=s+(l/67108864|0)|0)+(c>>>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):p(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},m.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},m.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),f=0;f<n;f+=a)for(var l=h,c=u,d=0;d<s;d++){var p=r[f+d],m=i[f+d],g=r[f+d+s],y=i[f+d+s],b=l*g-c*y;y=l*y+c*g,g=b,r[f+d]=p+g,i[f+d]=m+y,r[f+d+s]=p-g,i[f+d+s]=m-y,d!==a&&(b=h*l-u*c,c=h*c+u*l,l=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},m.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},m.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),f=new Array(i),l=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,f,l,i,n);for(var d=0;d<i;d++){var p=a[d]*f[d]-h[d]*l[d];h[d]=a[d]*l[d]+h[d]*f[d],a[d]=p}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),p(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i||!(this.words[i]&n))},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!=(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var f=i.clone()._ishlnsubmul(o,1,h);0===f.negative&&(i=f,a&&(a.words[h]=1));for(var l=h-1;l>=0;l--){var c=67108864*(0|i.words[o.length+l])+(0|i.words[o.length+l-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,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}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.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)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var f=i.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;)(o.isOdd()||s.isOdd())&&(o.iadd(f),s.isub(l)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(i.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(i.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(f),h.isub(l)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var l=0,c=1;0==(i.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(i.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.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)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new M(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}y.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.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=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,y),i(w,y),i(_,y),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return g[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.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)},M.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},M.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)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(l,new n(1).iushln(p-g-1));c=c.redMul(y),l=y.redSqr(),d=d.redMul(l),p=g}return c},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===i&&0===f)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new S(t)},i(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.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)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(qv,Y);var Fv=Uv,zv=fo.Buffer;var Hv=function(t,e){return zv.from(t.toRed(Fv.mont(e.modulus)).redPow(new Fv(e.publicExponent)).fromRed().toArray())},Kv=vv,Vv=ho,Gv=cf,Wv=Lv,Yv=jv,Zv=Uv,Xv=Hv,Qv=op,Jv=fo.Buffer,$v=function(t,e,r){var i;i=t.padding?t.padding:r?1:4;var n,o=Kv(t);if(4===i)n=function(t,e){var r=t.modulus.byteLength(),i=e.length,n=Gv("sha1").update(Jv.alloc(0)).digest(),o=n.length,s=2*o;if(i>r-s-2)throw new Error("message too long");var a=Jv.alloc(r-i-s-2),h=r-o-1,u=Vv(o),f=Yv(Jv.concat([n,a,Jv.alloc(1,1),e],h),Wv(u,h)),l=Yv(u,Wv(f,o));return new Zv(Jv.concat([Jv.alloc(1),l,f],r))}(o,e);else if(1===i)n=function(t,e,r){var i,n=e.length,o=t.modulus.byteLength();if(n>o-11)throw new Error("message too long");i=r?Jv.alloc(o-n-3,255):function(t){var e,r=Jv.allocUnsafe(t),i=0,n=Vv(2*t),o=0;for(;i<t;)o===n.length&&(n=Vv(2*t),o=0),(e=n[o++])&&(r[i++]=e);return r}(o-n-3);return new Zv(Jv.concat([Jv.from([0,r?1:2]),i,Jv.alloc(1),e],o))}(o,e,r);else{if(3!==i)throw new Error("unknown padding");if((n=new Zv(e)).cmp(o.modulus)>=0)throw new Error("data too long for modulus")}return r?Qv(n,o):Xv(n,o)};var tw=vv,ew=Lv,rw=jv,iw=Uv,nw=op,ow=cf,sw=Hv,aw=fo.Buffer,hw=function(t,e,r){var i;i=t.padding?t.padding:r?1:4;var n,o=tw(t),s=o.modulus.byteLength();if(e.length>s||new iw(e).cmp(o.modulus)>=0)throw new Error("decryption error");n=r?sw(new iw(e),o):nw(e,o);var a=aw.alloc(s-n.length);if(n=aw.concat([a,n],s),4===i)return function(t,e){var r=t.modulus.byteLength(),i=ow("sha1").update(aw.alloc(0)).digest(),n=i.length;if(0!==e[0])throw new Error("decryption error");var o=e.slice(1,n+1),s=e.slice(n+1),a=rw(o,ew(s,n)),h=rw(s,ew(a,r-n-1));if(function(t,e){t=aw.from(t),e=aw.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<i;)r+=t[n]^e[n];return r}(i,h.slice(0,n)))throw new Error("decryption error");var u=n;for(;0===h[u];)u++;if(1!==h[u++])throw new Error("decryption error");return h.slice(u)}(o,n);if(1===i)return function(t,e,r){var i=e.slice(0,2),n=2,o=0;for(;0!==e[n++];)if(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,n,r);if(3===i)return n;throw new Error("unknown padding")};!function(t){t.publicEncrypt=$v,t.privateDecrypt=hw,t.privateEncrypt=function(e,r){return t.publicEncrypt(e,r,!0)},t.publicDecrypt=function(e,r){return t.privateDecrypt(e,r,!0)}}(xv);var uw={};function fw(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var lw,cw=fo,dw=ho,pw=cw.Buffer,mw=cw.kMaxLength,gw=Y.crypto||Y.msCrypto,yw=Math.pow(2,32)-1;function bw(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>yw||t<0)throw new TypeError("offset must be a uint32");if(t>mw||t>e)throw new RangeError("offset out of range")}function vw(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>yw||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>mw)throw new RangeError("buffer too small")}function ww(t,e,r,i){if(oo.browser){var n=t.buffer,o=new Uint8Array(n,e,r);return gw.getRandomValues(o),i?void oo.nextTick((function(){i(null,t)})):t}if(!i)return dw(r).copy(t,e),t;dw(r,(function(r,n){if(r)return i(r);n.copy(t,e),i(null,t)}))}function _w(){if(lw)return ao;lw=1,ao.randomBytes=ao.rng=ao.pseudoRandomBytes=ao.prng=ho,ao.createHash=ao.Hash=cf,ao.createHmac=ao.Hmac=Rf;var t=Cf,e=Object.keys(t),r=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(e);ao.getHashes=function(){return r};var i=Bf;ao.pbkdf2=i.pbkdf2,ao.pbkdf2Sync=i.pbkdf2Sync;var n=fl;ao.Cipher=n.Cipher,ao.createCipher=n.createCipher,ao.Cipheriv=n.Cipheriv,ao.createCipheriv=n.createCipheriv,ao.Decipher=n.Decipher,ao.createDecipher=n.createDecipher,ao.Decipheriv=n.Decipheriv,ao.createDecipheriv=n.createDecipheriv,ao.getCiphers=n.getCiphers,ao.listCiphers=n.listCiphers;var o=function(){if(Yd)return Cd;Yd=1;var t=Vd(),e=Zd,r=Xd(),i={binary:!0,hex:!0,base64:!0};return Cd.DiffieHellmanGroup=Cd.createDiffieHellmanGroup=Cd.getDiffieHellman=function(t){var i=new sr(e[t].prime,"hex"),n=new sr(e[t].gen,"hex");return new r(i,n)},Cd.createDiffieHellman=Cd.DiffieHellman=function e(n,o,s,a){return sr.isBuffer(o)||void 0===i[o]?e(n,"binary",o,s):(o=o||"binary",a=a||"binary",s=s||new sr([2]),sr.isBuffer(s)||(s=new sr(s,a)),"number"==typeof n?new r(t(n,s),s,!0):(sr.isBuffer(n)||(n=new sr(n,o)),new r(n,s,!0)))},Cd}();ao.DiffieHellmanGroup=o.DiffieHellmanGroup,ao.createDiffieHellmanGroup=o.createDiffieHellmanGroup,ao.getDiffieHellman=o.getDiffieHellman,ao.createDiffieHellman=o.createDiffieHellman,ao.DiffieHellman=o.DiffieHellman;var s=function(){if(kv)return Ev;kv=1;var t=fo.Buffer,e=cf,r=wo,i=bo,n=Ov(),o=Tv(),s=xf;function a(t){r.Writable.call(this);var i=s[t];if(!i)throw new Error("Unknown message digest");this._hashType=i.hash,this._hash=e(i.hash),this._tag=i.id,this._signType=i.sign}function h(t){r.Writable.call(this);var i=s[t];if(!i)throw new Error("Unknown message digest");this._hash=e(i.hash),this._tag=i.id,this._signType=i.sign}function u(t){return new a(t)}function f(t){return new h(t)}return Object.keys(s).forEach((function(e){s[e].id=t.from(s[e].id,"hex"),s[e.toLowerCase()]=s[e]})),i(a,r.Writable),a.prototype._write=function(t,e,r){this._hash.update(t),r()},a.prototype.update=function(e,r){return"string"==typeof e&&(e=t.from(e,r)),this._hash.update(e),this},a.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),i=n(r,t,this._hashType,this._signType,this._tag);return e?i.toString(e):i},i(h,r.Writable),h.prototype._write=function(t,e,r){this._hash.update(t),r()},h.prototype.update=function(e,r){return"string"==typeof e&&(e=t.from(e,r)),this._hash.update(e),this},h.prototype.verify=function(e,r,i){"string"==typeof r&&(r=t.from(r,i)),this.end();var n=this._hash.digest();return o(r,n,e,this._signType,this._tag)},Ev={Sign:u,Verify:f,createSign:u,createVerify:f}}();ao.createSign=s.createSign,ao.Sign=s.Sign,ao.createVerify=s.createVerify,ao.Verify=s.Verify,ao.createECDH=function(){if(Rv)return Iv;Rv=1;var t=Cy(),e=Cv;Iv=function(t){return new i(t)};var r={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function i(e){this.curveType=r[e],this.curveType||(this.curveType={name:e}),this.curve=new t.ec(this.curveType.name),this.keys=void 0}function n(t,e,r){Array.isArray(t)||(t=t.toArray());var i=new sr(t);if(r&&i.length<r){var n=new sr(r-i.length);n.fill(0),i=sr.concat([n,i])}return e?i.toString(e):i}return r.p224=r.secp224r1,r.p256=r.secp256r1=r.prime256v1,r.p192=r.secp192r1=r.prime192v1,r.p384=r.secp384r1,r.p521=r.secp521r1,i.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)},i.prototype.computeSecret=function(t,e,r){return e=e||"utf8",sr.isBuffer(t)||(t=new sr(t,e)),n(this.curve.keyFromPublic(t).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},i.prototype.getPublicKey=function(t,e){var r=this.keys.getPublic("compressed"===e,!0);return"hybrid"===e&&(r[r.length-1]%2?r[0]=7:r[0]=6),n(r,t)},i.prototype.getPrivateKey=function(t){return n(this.keys.getPrivate(),t)},i.prototype.setPublicKey=function(t,e){return e=e||"utf8",sr.isBuffer(t)||(t=new sr(t,e)),this.keys._importPublic(t),this},i.prototype.setPrivateKey=function(t,r){r=r||"utf8",sr.isBuffer(t)||(t=new sr(t,r));var i=new e(t);return i=i.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(i),this},Iv}();var a=xv;ao.publicEncrypt=a.publicEncrypt,ao.privateEncrypt=a.privateEncrypt,ao.publicDecrypt=a.publicDecrypt,ao.privateDecrypt=a.privateDecrypt;var h=uw;return ao.randomFill=h.randomFill,ao.randomFillSync=h.randomFillSync,ao.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},ao.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},ao}gw&&gw.getRandomValues||!oo.browser?(uw.randomFill=function(t,e,r,i){if(!(pw.isBuffer(t)||t instanceof Y.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof e)i=e,e=0,r=t.length;else if("function"==typeof r)i=r,r=t.length-e;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return bw(e,t.length),vw(r,e,t.length),ww(t,e,r,i)},uw.randomFillSync=function(t,e,r){void 0===e&&(e=0);if(!(pw.isBuffer(t)||t instanceof Y.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');bw(e,t.length),void 0===r&&(r=t.length-e);return vw(r,e,t.length),ww(t,e,r)}):(uw.randomFill=fw,uw.randomFillSync=fw),_w(),so.linebrk=function(t,e){for(var r="",i=0;i+e<t.length;)r+=t.substring(i,i+e)+"\n",i+=e;return r+t.substring(i,t.length)},so.detectEnvironment=function(){return"undefined"==typeof window||!window||oo&&"node"===oo.title?"node":"browser"},so.get32IntFromBuffer=function(t,e){e=e||0;var r;if((r=t.length-e)>0){if(r>=4)return t.readUIntBE(e,r);for(var i=0,n=e+r,o=0;n>e;n--,o+=2)i+=t[n-1]*Math.pow(16,o);return i}return NaN},so._={isObject:function(t){var e=typeof t;return!!t&&("object"==e||"function"==e)},isString:function(t){return"string"==typeof t||t instanceof String},isNumber:function(t){return"number"==typeof t||!isNaN(parseFloat(t))&&isFinite(t)},omit:function(t,e){var r={};for(var i in t)t.hasOwnProperty(i)&&i!==e&&(r[i]=t[i]);return r}},so.trimSurroundingText=function(t,e,r){var i=0,n=t.length,o=t.indexOf(e);o>=0&&(i=o+e.length);var s=t.indexOf(r,o);return s>=0&&(n=s),t.substring(i,n)};var Mw=_w(),Sw=so._;function Ew(t,e){null!=t&&("number"==typeof t?this.fromNumber(t,e):sr.isBuffer(t)?this.fromBuffer(t):null==e&&"string"!=typeof t?this.fromByteArray(t):this.fromString(t,e))}function kw(){return new Ew(null)}Ew.prototype.am=function(t,e,r,i,n,o){for(var s=16383&e,a=e>>14;--o>=0;){var h=16383&this[t],u=this[t++]>>14,f=a*h+u*s;n=((h=s*h+((16383&f)<<14)+r[i]+n)>>28)+(f>>14)+a*u,r[i++]=268435455&h}return n},Ew.prototype.DB=28,Ew.prototype.DM=268435455,Ew.prototype.DV=1<<28;Ew.prototype.FV=Math.pow(2,52),Ew.prototype.F1=24,Ew.prototype.F2=4;var Aw,Ow,Tw="0123456789abcdefghijklmnopqrstuvwxyz",Iw=new Array;for(Aw="0".charCodeAt(0),Ow=0;Ow<=9;++Ow)Iw[Aw++]=Ow;for(Aw="a".charCodeAt(0),Ow=10;Ow<36;++Ow)Iw[Aw++]=Ow;for(Aw="A".charCodeAt(0),Ow=10;Ow<36;++Ow)Iw[Aw++]=Ow;function Rw(t){return Tw.charAt(t)}function Cw(t,e){var r=Iw[t.charCodeAt(e)];return null==r?-1:r}function Pw(t){var e=kw();return e.fromInt(t),e}function xw(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function Nw(t){this.m=t}function Bw(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function Lw(t,e){return t&e}function Dw(t,e){return t|e}function jw(t,e){return t^e}function Uw(t,e){return t&~e}function qw(t){if(0===t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function Fw(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function zw(){}function Hw(t){return t}function Kw(t){this.r2=kw(),this.q3=kw(),Ew.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}Nw.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},Nw.prototype.revert=function(t){return t},Nw.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},Nw.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Nw.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},Bw.prototype.convert=function(t){var e=kw();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(Ew.ZERO)>0&&this.m.subTo(e,e),e},Bw.prototype.revert=function(t){var e=kw();return t.copyTo(e),this.reduce(e),e},Bw.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],i=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,i,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},Bw.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Bw.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},zw.prototype.convert=Hw,zw.prototype.revert=Hw,zw.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},zw.prototype.sqrTo=function(t,e){t.squareTo(e)},Kw.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=kw();return t.copyTo(e),this.reduce(e),e},Kw.prototype.revert=function(t){return t},Kw.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},Kw.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Kw.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var Vw=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Gw=(1<<26)/Vw[Vw.length-1];Ew.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},Ew.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+DV:this.t=0},Ew.prototype.fromString=function(t,e,r){var i;switch(e){case 2:i=1;break;case 4:i=2;break;case 8:i=3;break;case 16:i=4;break;case 32:i=5;break;case 256:i=8;break;default:return void this.fromRadix(t,e)}this.t=0,this.s=0;for(var n=t.length,o=!1,s=0;--n>=0;){var a=8==i?255&t[n]:Cw(t,n);a<0?"-"==t.charAt(n)&&(o=!0):(o=!1,0===s?this[this.t++]=a:s+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=i)>=this.DB&&(s-=this.DB))}r||8!=i||0==(128&t[0])||(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&Ew.ZERO.subTo(this,this)},Ew.prototype.fromByteArray=function(t,e){this.fromString(t,256,e)},Ew.prototype.fromBuffer=function(t){this.fromString(t,256,!0)},Ew.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},Ew.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},Ew.prototype.drShiftTo=function(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s},Ew.prototype.lShiftTo=function(t,e){var r,i=t%this.DB,n=this.DB-i,o=(1<<n)-1,s=Math.floor(t/this.DB),a=this.s<<i&this.DM;for(r=this.t-1;r>=0;--r)e[r+s+1]=this[r]>>n|a,a=(this[r]&o)<<i;for(r=s-1;r>=0;--r)e[r]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()},Ew.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var i=t%this.DB,n=this.DB-i,o=(1<<i)-1;e[0]=this[r]>>i;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<n,e[s-r]=this[s]>>i;i>0&&(e[this.t-r-1]|=(this.s&o)<<n),e.t=this.t-r,e.clamp()}},Ew.prototype.subTo=function(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);r<n;)i+=this[r]-t[r],e[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;r<this.t;)i+=this[r],e[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i-=t[r],e[r++]=i&this.DM,i>>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[r++]=this.DV+i:i>0&&(e[r++]=i),e.t=r,e.clamp()},Ew.prototype.multiplyTo=function(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e[n]=0;for(n=0;n<i.t;++n)e[n+r.t]=r.am(0,i[n],e,n,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&Ew.ZERO.subTo(e,e)},Ew.prototype.squareTo=function(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var i=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,i,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},Ew.prototype.divRemTo=function(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t<i.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=kw());var o=kw(),s=this.s,a=t.s,h=this.DB-xw(i[i.t-1]);h>0?(i.lShiftTo(h,o),n.lShiftTo(h,r)):(i.copyTo(o),n.copyTo(r));var u=o.t,f=o[u-1];if(0!==f){var l=f*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),c=this.FV/l,d=(1<<this.F1)/l,p=1<<this.F2,m=r.t,g=m-u,y=null==e?kw():e;for(o.dlShiftTo(g,y),r.compareTo(y)>=0&&(r[r.t++]=1,r.subTo(y,r)),Ew.ONE.dlShiftTo(u,y),y.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--g>=0;){var b=r[--m]==f?this.DM:Math.floor(r[m]*c+(r[m-1]+p)*d);if((r[m]+=o.am(0,b,r,g,0,u))<b)for(o.dlShiftTo(g,y),r.subTo(y,r);r[m]<--b;)r.subTo(y,r)}null!=e&&(r.drShiftTo(u,e),s!=a&&Ew.ZERO.subTo(e,e)),r.t=u,r.clamp(),h>0&&r.rShiftTo(h,r),s<0&&Ew.ZERO.subTo(r,r)}}},Ew.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},Ew.prototype.isEven=function(){return 0===(this.t>0?1&this[0]:this.s)},Ew.prototype.exp=function(t,e){if(t>4294967295||t<1)return Ew.ONE;var r=kw(),i=kw(),n=e.convert(this),o=xw(t)-1;for(n.copyTo(r);--o>=0;)if(e.sqrTo(r,i),(t&1<<o)>0)e.mulTo(i,n,r);else{var s=r;r=i,i=s}return e.revert(r)},Ew.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},Ew.prototype.toRadix=function(t){if(null==t&&(t=10),0===this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=Pw(r),n=kw(),o=kw(),s="";for(this.divRemTo(i,n,o);n.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,n.divRemTo(i,n,o);return o.intValue().toString(t)+s},Ew.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,o=0,s=0,a=0;a<t.length;++a){var h=Cw(t,a);h<0?"-"==t.charAt(a)&&0===this.signum()&&(n=!0):(s=e*s+h,++o>=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),n&&Ew.ZERO.subTo(this,this)},Ew.prototype.fromNumber=function(t,e){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t),this.testBit(t-1)||this.bitwiseTo(Ew.ONE.shiftLeft(t-1),Dw,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(Ew.ONE.shiftLeft(t-1),this);else{var r=Mw.randomBytes(1+(t>>3)),i=7&t;i>0?r[0]&=(1<<i)-1:r[0]=0,this.fromByteArray(r)}},Ew.prototype.bitwiseTo=function(t,e,r){var i,n,o=Math.min(t.t,this.t);for(i=0;i<o;++i)r[i]=e(this[i],t[i]);if(t.t<this.t){for(n=t.s&this.DM,i=o;i<this.t;++i)r[i]=e(this[i],n);r.t=this.t}else{for(n=this.s&this.DM,i=o;i<t.t;++i)r[i]=e(n,t[i]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()},Ew.prototype.changeBit=function(t,e){var r=Ew.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},Ew.prototype.addTo=function(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);r<n;)i+=this[r]+t[r],e[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;r<this.t;)i+=this[r],e[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i+=t[r],e[r++]=i&this.DM,i>>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e[r++]=i:i<-1&&(e[r++]=this.DV+i),e.t=r,e.clamp()},Ew.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},Ew.prototype.dAddOffset=function(t,e){if(0!==t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},Ew.prototype.multiplyLowerTo=function(t,e,r){var i,n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,t[n],r,n,0,this.t);for(i=Math.min(t.t,e);n<i;++n)this.am(0,t[n],r,n,0,e-n);r.clamp()},Ew.prototype.multiplyUpperTo=function(t,e,r){--e;var i=r.t=this.t+t.t-e;for(r.s=0;--i>=0;)r[i]=0;for(i=Math.max(e-this.t,0);i<t.t;++i)r[this.t+i-e]=this.am(e-i,t[i],r,0,0,this.t+i-e);r.clamp(),r.drShiftTo(1,r)},Ew.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0===e)r=this[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this[i])%t;return r},Ew.prototype.millerRabin=function(t){var e=this.subtract(Ew.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var i=e.shiftRight(r);(t=t+1>>1)>Vw.length&&(t=Vw.length);for(var n=kw(),o=0;o<t;++o){n.fromInt(Vw[Math.floor(Math.random()*Vw.length)]);var s=n.modPow(i,this);if(0!=s.compareTo(Ew.ONE)&&0!=s.compareTo(e)){for(var a=1;a++<r&&0!=s.compareTo(e);)if(0===(s=s.modPowInt(2,this)).compareTo(Ew.ONE))return!1;if(0!=s.compareTo(e))return!1}}return!0},Ew.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<<e)-1,n=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(n=!0,o=Rw(r));s>=0;)a<e?(r=(this[s]&(1<<a)-1)<<e-a,r|=this[--s]>>(a+=this.DB-e)):(r=this[s]>>(a-=e)&i,a<=0&&(a+=this.DB,--s)),r>0&&(n=!0),n&&(o+=Rw(r));return n?o:"0"},Ew.prototype.negate=function(){var t=kw();return Ew.ZERO.subTo(this,t),t},Ew.prototype.abs=function(){return this.s<0?this.negate():this},Ew.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},Ew.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+xw(this[this.t-1]^this.s&this.DM)},Ew.prototype.mod=function(t){var e=kw();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(Ew.ZERO)>0&&t.subTo(e,e),e},Ew.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new Nw(e):new Bw(e),this.exp(t,r)},Ew.prototype.clone=function(){var t=kw();return this.copyTo(t),t},Ew.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0===this.t)return-1}else{if(1==this.t)return this[0];if(0===this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},Ew.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},Ew.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},Ew.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},Ew.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i<this.DB&&(r=this[t]>>i)!=(this.s&this.DM)>>i&&(e[n++]=r|this.s<<this.DB-i);t>=0;)i<8?(r=(this[t]&(1<<i)-1)<<8-i,r|=this[--t]>>(i+=this.DB-8)):(r=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),0!=(128&r)&&(r|=-256),0===n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(e[n++]=r);return e},Ew.prototype.toBuffer=function(t){var e=sr.from(this.toByteArray());if(!0===t&&0===e[0])e=e.slice(1);else if(Sw.isNumber(t)){if(e.length>t){for(var r=0;r<e.length-t;r++)if(0!==e[r])return null;return e.slice(e.length-t)}if(e.length<t){var i=sr.alloc(t);return i.fill(0,0,t-e.length),e.copy(i,t-e.length),i}}return e},Ew.prototype.equals=function(t){return 0==this.compareTo(t)},Ew.prototype.min=function(t){return this.compareTo(t)<0?this:t},Ew.prototype.max=function(t){return this.compareTo(t)>0?this:t},Ew.prototype.and=function(t){var e=kw();return this.bitwiseTo(t,Lw,e),e},Ew.prototype.or=function(t){var e=kw();return this.bitwiseTo(t,Dw,e),e},Ew.prototype.xor=function(t){var e=kw();return this.bitwiseTo(t,jw,e),e},Ew.prototype.andNot=function(t){var e=kw();return this.bitwiseTo(t,Uw,e),e},Ew.prototype.not=function(){for(var t=kw(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},Ew.prototype.shiftLeft=function(t){var e=kw();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},Ew.prototype.shiftRight=function(t){var e=kw();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},Ew.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+qw(this[t]);return this.s<0?this.t*this.DB:-1},Ew.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=Fw(this[r]^e);return t},Ew.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},Ew.prototype.setBit=function(t){return this.changeBit(t,Dw)},Ew.prototype.clearBit=function(t){return this.changeBit(t,Uw)},Ew.prototype.flipBit=function(t){return this.changeBit(t,jw)},Ew.prototype.add=function(t){var e=kw();return this.addTo(t,e),e},Ew.prototype.subtract=function(t){var e=kw();return this.subTo(t,e),e},Ew.prototype.multiply=function(t){var e=kw();return this.multiplyTo(t,e),e},Ew.prototype.divide=function(t){var e=kw();return this.divRemTo(t,e,null),e},Ew.prototype.remainder=function(t){var e=kw();return this.divRemTo(t,null,e),e},Ew.prototype.divideAndRemainder=function(t){var e=kw(),r=kw();return this.divRemTo(t,e,r),new Array(e,r)},Ew.prototype.modPow=function(t,e){var r,i,n=t.bitLength(),o=Pw(1);if(n<=0)return o;r=n<18?1:n<48?3:n<144?4:n<768?5:6,i=n<8?new Nw(e):e.isEven()?new Kw(e):new Bw(e);var s=new Array,a=3,h=r-1,u=(1<<r)-1;if(s[1]=i.convert(this),r>1){var f=kw();for(i.sqrTo(s[1],f);a<=u;)s[a]=kw(),i.mulTo(f,s[a-2],s[a]),a+=2}var l,c,d=t.t-1,p=!0,m=kw();for(n=xw(t[d])-1;d>=0;){for(n>=h?l=t[d]>>n-h&u:(l=(t[d]&(1<<n+1)-1)<<h-n,d>0&&(l|=t[d-1]>>this.DB+n-h)),a=r;0==(1&l);)l>>=1,--a;if((n-=a)<0&&(n+=this.DB,--d),p)s[l].copyTo(o),p=!1;else{for(;a>1;)i.sqrTo(o,m),i.sqrTo(m,o),a-=2;a>0?i.sqrTo(o,m):(c=o,o=m,m=c),i.mulTo(m,s[l],o)}for(;d>=0&&0==(t[d]&1<<n);)i.sqrTo(o,m),c=o,o=m,m=c,--n<0&&(n=this.DB-1,--d)}return i.revert(o)},Ew.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0===t.signum())return Ew.ZERO;for(var r=t.clone(),i=this.clone(),n=Pw(1),o=Pw(0),s=Pw(0),a=Pw(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(n.isEven()&&o.isEven()||(n.addTo(this,n),o.subTo(t,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),e?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(i)>=0?(r.subTo(i,r),e&&n.subTo(s,n),o.subTo(a,o)):(i.subTo(r,i),e&&s.subTo(n,s),a.subTo(o,a))}return 0!=i.compareTo(Ew.ONE)?Ew.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a},Ew.prototype.pow=function(t){return this.exp(t,new zw)},Ew.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(n<o&&(o=n),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},Ew.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r[0]<=Vw[Vw.length-1]){for(e=0;e<Vw.length;++e)if(r[0]==Vw[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<Vw.length;){for(var i=Vw[e],n=e+1;n<Vw.length&&i<Gw;)i*=Vw[n++];for(i=r.modInt(i);e<n;)if(i%Vw[e++]==0)return!1}return r.millerRabin(t)},Ew.int2char=Rw,Ew.ZERO=Pw(0),Ew.ONE=Pw(1),Ew.prototype.square=function(){var t=kw();return this.squareTo(t),t};var Ww=Ew,Yw={},Zw={get exports(){return Yw},set exports(t){Yw=t}},Xw={},Qw={get exports(){return Xw},set exports(t){Xw=t}},Jw=Ww,$w=_w(),t_=xn,e_={md2:sr.from("3020300c06082a864886f70d020205000410","hex"),md5:sr.from("3020300c06082a864886f70d020505000410","hex"),sha1:sr.from("3021300906052b0e03021a05000414","hex"),sha224:sr.from("302d300d06096086480165030402040500041c","hex"),sha256:sr.from("3031300d060960864801650304020105000420","hex"),sha384:sr.from("3041300d060960864801650304020205000430","hex"),sha512:sr.from("3051300d060960864801650304020305000440","hex"),ripemd160:sr.from("3021300906052b2403020105000414","hex"),rmd160:sr.from("3021300906052b2403020105000414","hex")},r_={ripemd160:"rmd160"},i_="sha256";Qw.exports={isEncryption:!0,isSignature:!0},Xw.makeScheme=function(t,e){function r(t,e){this.key=t,this.options=e}return r.prototype.maxMessageLength=function(){return this.options.encryptionSchemeOptions&&this.options.encryptionSchemeOptions.padding==t_.RSA_NO_PADDING?this.key.encryptedDataLength:this.key.encryptedDataLength-11},r.prototype.encPad=function(t,e){var r;if(e=e||{},t.length>this.key.maxMessageLength)throw new Error("Message too long for RSA (n="+this.key.encryptedDataLength+", l="+t.length+")");if(this.options.encryptionSchemeOptions&&this.options.encryptionSchemeOptions.padding==t_.RSA_NO_PADDING)return(r=sr.alloc(this.key.maxMessageLength-t.length)).fill(0),sr.concat([r,t]);if(1===e.type)return(r=sr.alloc(this.key.encryptedDataLength-t.length-1)).fill(255,0,r.length-1),r[0]=1,r[r.length-1]=0,sr.concat([r,t]);(r=sr.alloc(this.key.encryptedDataLength-t.length))[0]=0,r[1]=2;for(var i=$w.randomBytes(r.length-3),n=0;n<i.length;n++){for(var o=i[n];0===o;)o=$w.randomBytes(1)[0];r[n+2]=o}return r[r.length-1]=0,sr.concat([r,t])},r.prototype.encUnPad=function(t,e){e=e||{};var r=0;if(this.options.encryptionSchemeOptions&&this.options.encryptionSchemeOptions.padding==t_.RSA_NO_PADDING)return"function"==typeof t.lastIndexOf?t.slice(t.lastIndexOf("\0")+1,t.length):t.slice(String.prototype.lastIndexOf.call(t,"\0")+1,t.length);if(t.length<4)return null;if(1===e.type){if(0!==t[0]||1!==t[1])return null;for(r=3;0!==t[r];)if(255!=t[r]||++r>=t.length)return null}else{if(0!==t[0]||2!==t[1])return null;for(r=3;0!==t[r];)if(++r>=t.length)return null}return t.slice(r+1,t.length)},r.prototype.sign=function(t){var e=this.options.signingSchemeOptions.hash||i_;if("browser"===this.options.environment){e=r_[e]||e;var r=$w.createHash(e);r.update(t);var i=this.pkcs1pad(r.digest(),e);return this.key.$doPrivate(new Jw(i)).toBuffer(this.key.encryptedDataLength)}var n=$w.createSign("RSA-"+e.toUpperCase());return n.update(t),n.sign(this.options.rsaUtils.exportKey("private"))},r.prototype.verify=function(t,e,r){if(this.options.encryptionSchemeOptions&&this.options.encryptionSchemeOptions.padding==t_.RSA_NO_PADDING)return!1;var i=this.options.signingSchemeOptions.hash||i_;if("browser"===this.options.environment){i=r_[i]||i,r&&(e=sr.from(e,r));var n=$w.createHash(i);n.update(t);var o=this.pkcs1pad(n.digest(),i);return this.key.$doPublic(new Jw(e)).toBuffer().toString("hex")==o.toString("hex")}var s=$w.createVerify("RSA-"+i.toUpperCase());return s.update(t),s.verify(this.options.rsaUtils.exportKey("public"),e,r)},r.prototype.pkcs0pad=function(t){var e=sr.alloc(this.key.maxMessageLength-t.length);return e.fill(0),sr.concat([e,t])},r.prototype.pkcs0unpad=function(t){return"function"==typeof t.lastIndexOf?t.slice(t.lastIndexOf("\0")+1,t.length):t.slice(String.prototype.lastIndexOf.call(t,"\0")+1,t.length)},r.prototype.pkcs1pad=function(t,e){var r=e_[e];if(!r)throw Error("Unsupported hash algorithm");var i=sr.concat([r,t]);if(i.length+10>this.key.encryptedDataLength)throw Error("Key is too short for signing algorithm ("+e+")");var n=sr.alloc(this.key.encryptedDataLength-i.length-1);return n.fill(255,0,n.length-1),n[0]=1,n[n.length-1]=0,sr.concat([n,i])},new r(t,e)};var n_={},o_={get exports(){return n_},set exports(t){n_=t}};!function(t){var e=_w();t.exports={isEncryption:!0,isSignature:!1},t.exports.digestLength={md4:16,md5:16,ripemd160:20,rmd160:20,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64};var r="sha1";t.exports.eme_oaep_mgf1=function(i,n,o){o=o||r;for(var s=t.exports.digestLength[o],a=Math.ceil(n/s),h=sr.alloc(s*a),u=sr.alloc(4),f=0;f<a;++f){var l=e.createHash(o);l.update(i),u.writeUInt32BE(f,0),l.update(u),l.digest().copy(h,f*s)}return h.slice(0,n)},t.exports.makeScheme=function(i,n){function o(t,e){this.key=t,this.options=e}return o.prototype.maxMessageLength=function(){return this.key.encryptedDataLength-2*t.exports.digestLength[this.options.encryptionSchemeOptions.hash||r]-2},o.prototype.encPad=function(i){var n=this.options.encryptionSchemeOptions.hash||r,o=this.options.encryptionSchemeOptions.mgf||t.exports.eme_oaep_mgf1,s=this.options.encryptionSchemeOptions.label||sr.alloc(0),a=this.key.encryptedDataLength,h=t.exports.digestLength[n];if(i.length>a-2*h-2)throw new Error("Message is too long to encode into an encoded message with a length of "+a+" bytes, increaseemLen to fix this error (minimum value for given parameters and options: "+(a-2*h-2)+")");var u=e.createHash(n);u.update(s),u=u.digest();var f=sr.alloc(a-i.length-2*h-1);f.fill(0),f[f.length-1]=1;for(var l=sr.concat([u,f,i]),c=e.randomBytes(h),d=o(c,l.length,n),p=0;p<l.length;p++)l[p]^=d[p];for(d=o(l,h,n),p=0;p<c.length;p++)c[p]^=d[p];var m=sr.alloc(1+c.length+l.length);return m[0]=0,c.copy(m,1),l.copy(m,1+c.length),m},o.prototype.encUnPad=function(i){var n=this.options.encryptionSchemeOptions.hash||r,o=this.options.encryptionSchemeOptions.mgf||t.exports.eme_oaep_mgf1,s=this.options.encryptionSchemeOptions.label||sr.alloc(0),a=t.exports.digestLength[n];if(i.length<2*a+2)throw new Error("Error decoding message, the supplied message is not long enough to be a valid OAEP encoded message");for(var h=i.slice(1,a+1),u=i.slice(1+a),f=o(u,a,n),l=0;l<h.length;l++)h[l]^=f[l];for(f=o(h,u.length,n),l=0;l<u.length;l++)u[l]^=f[l];var c=e.createHash(n);if(c.update(s),c=c.digest(),u.slice(0,a).toString("hex")!=c.toString("hex"))throw new Error("Error decoding message, the lHash calculated from the label provided and the lHash in the encrypted data do not match.");for(l=a;0===u[l++]&&l<u.length;);if(1!=u[l-1])throw new Error("Error decoding message, there is no padding message separator byte");return u.slice(l)},new o(i,n)}}(o_);var s_,a_,h_,u_,f_,l_,c_,d_,p_={},m_={get exports(){return p_},set exports(t){p_=t}};function g_(){if(s_)return p_;s_=1;var t=Ww,e=_w();m_.exports={isEncryption:!1,isSignature:!0};var r="sha1";return p_.makeScheme=function(i,n){var o=y_().pkcs1_oaep;function s(t,e){this.key=t,this.options=e}return s.prototype.sign=function(i){var n=e.createHash(this.options.signingSchemeOptions.hash||r);n.update(i);var o=this.emsa_pss_encode(n.digest(),this.key.keySize-1);return this.key.$doPrivate(new t(o)).toBuffer(this.key.encryptedDataLength)},s.prototype.verify=function(i,n,o){o&&(n=sr.from(n,o)),n=new t(n);var s=Math.ceil((this.key.keySize-1)/8),a=this.key.$doPublic(n).toBuffer(s),h=e.createHash(this.options.signingSchemeOptions.hash||r);return h.update(i),this.emsa_pss_verify(h.digest(),a,this.key.keySize-1)},s.prototype.emsa_pss_encode=function(t,i){var n=this.options.signingSchemeOptions.hash||r,s=this.options.signingSchemeOptions.mgf||o.eme_oaep_mgf1,a=this.options.signingSchemeOptions.saltLength||20,h=o.digestLength[n],u=Math.ceil(i/8);if(u<h+a+2)throw new Error("Output length passed to emBits("+i+") is too small for the options specified("+n+", "+a+"). To fix this issue increase the value of emBits. (minimum size: "+(8*h+8*a+9)+")");var f=e.randomBytes(a),l=sr.alloc(8+h+a);l.fill(0,0,8),t.copy(l,8),f.copy(l,8+t.length);var c=e.createHash(n);c.update(l),c=c.digest();var d=sr.alloc(u-f.length-h-2);d.fill(0);var p=sr.alloc(d.length+1+f.length);d.copy(p),p[d.length]=1,f.copy(p,d.length+1);for(var m=s(c,p.length,n),g=sr.alloc(p.length),y=0;y<m.length;y++)g[y]=p[y]^m[y];var b=8*u-i,v=255^255>>8-b<<8-b;g[0]=g[0]&v;var w=sr.alloc(g.length+c.length+1);return g.copy(w,0),c.copy(w,g.length),w[w.length-1]=188,w},s.prototype.emsa_pss_verify=function(t,i,n){var s=this.options.signingSchemeOptions.hash||r,a=this.options.signingSchemeOptions.mgf||o.eme_oaep_mgf1,h=this.options.signingSchemeOptions.saltLength||20,u=o.digestLength[s],f=Math.ceil(n/8);if(f<u+h+2||188!=i[i.length-1])return!1;var l=sr.alloc(f-u-1);i.copy(l,0,0,f-u-1);for(var c=0,d=0,p=8*f-n;d<p;d++)c|=1<<7-d;if(0!=(l[0]&c))return!1;var m=i.slice(f-u-1,f-1),g=a(m,l.length,s);for(d=0;d<l.length;d++)l[d]^=g[d];for(c=255^255>>8-(p=8*f-n)<<8-p,l[0]=l[0]&c,d=0;0===l[d]&&d<l.length;d++);if(1!=l[d])return!1;var y=l.slice(l.length-h),b=sr.alloc(8+u+h);b.fill(0,0,8),t.copy(b,8),y.copy(b,8+t.length);var v=e.createHash(s);return v.update(b),v=v.digest(),m.toString("hex")===v.toString("hex")},new s(i,n)},p_}function y_(){return a_||(a_=1,function(t){t.exports={pkcs1:Xw,pkcs1_oaep:n_,pss:g_(),isEncryption:function(e){return t.exports[e]&&t.exports[e].isEncryption},isSignature:function(e){return t.exports[e]&&t.exports[e].isSignature}}}(Zw)),Yw}function b_(){if(u_)return h_;u_=1;var t=Ww,e=y_();return h_=function(r,i){var n=e.pkcs1.makeScheme(r,i);return{encrypt:function(e,i){var o,s;return i?(o=new t(n.encPad(e,{type:1})),s=r.$doPrivate(o)):(o=new t(r.encryptionScheme.encPad(e)),s=r.$doPublic(o)),s.toBuffer(r.encryptedDataLength)},decrypt:function(e,i){var o,s=new t(e);return i?(o=r.$doPublic(s),n.encUnPad(o.toBuffer(r.encryptedDataLength),{type:1})):(o=r.$doPrivate(s),r.encryptionScheme.encUnPad(o.toBuffer(r.encryptedDataLength)))}}},h_}var v_=_w(),w_={getEngine:function(t,e){var r=b_();return"node"===e.environment&&"function"==typeof v_.publicEncrypt&&"function"==typeof v_.privateDecrypt&&(r="function"==typeof v_.privateEncrypt&&"function"==typeof v_.publicDecrypt?function(){if(l_)return f_;l_=1;var t=_w(),e=xn,r=y_();return f_=function(i,n){var o=r.pkcs1.makeScheme(i,n);return{encrypt:function(r,i){var s;if(i)return s=e.RSA_PKCS1_PADDING,n.encryptionSchemeOptions&&n.encryptionSchemeOptions.padding&&(s=n.encryptionSchemeOptions.padding),t.privateEncrypt({key:n.rsaUtils.exportKey("private"),padding:s},r);s=e.RSA_PKCS1_OAEP_PADDING,"pkcs1"===n.encryptionScheme&&(s=e.RSA_PKCS1_PADDING),n.encryptionSchemeOptions&&n.encryptionSchemeOptions.padding&&(s=n.encryptionSchemeOptions.padding);var a=r;return s===e.RSA_NO_PADDING&&(a=o.pkcs0pad(r)),t.publicEncrypt({key:n.rsaUtils.exportKey("public"),padding:s},a)},decrypt:function(r,i){var s;if(i)return s=e.RSA_PKCS1_PADDING,n.encryptionSchemeOptions&&n.encryptionSchemeOptions.padding&&(s=n.encryptionSchemeOptions.padding),t.publicDecrypt({key:n.rsaUtils.exportKey("public"),padding:s},r);s=e.RSA_PKCS1_OAEP_PADDING,"pkcs1"===n.encryptionScheme&&(s=e.RSA_PKCS1_PADDING),n.encryptionSchemeOptions&&n.encryptionSchemeOptions.padding&&(s=n.encryptionSchemeOptions.padding);var a=t.privateDecrypt({key:n.rsaUtils.exportKey("private"),padding:s},r);return s===e.RSA_NO_PADDING?o.pkcs0unpad(a):a}}},f_}():function(){if(d_)return c_;d_=1;var t=_w(),e=xn,r=y_();return c_=function(i,n){var o=b_()(i,n),s=r.pkcs1.makeScheme(i,n);return{encrypt:function(r,i){if(i)return o.encrypt(r,i);var a=e.RSA_PKCS1_OAEP_PADDING;"pkcs1"===n.encryptionScheme&&(a=e.RSA_PKCS1_PADDING),n.encryptionSchemeOptions&&n.encryptionSchemeOptions.padding&&(a=n.encryptionSchemeOptions.padding);var h=r;return a===e.RSA_NO_PADDING&&(h=s.pkcs0pad(r)),t.publicEncrypt({key:n.rsaUtils.exportKey("public"),padding:a},h)},decrypt:function(r,i){if(i)return o.decrypt(r,i);var a=e.RSA_PKCS1_OAEP_PADDING;"pkcs1"===n.encryptionScheme&&(a=e.RSA_PKCS1_PADDING),n.encryptionSchemeOptions&&n.encryptionSchemeOptions.padding&&(a=n.encryptionSchemeOptions.padding);var h=t.privateDecrypt({key:n.rsaUtils.exportKey("private"),padding:a},r);return a===e.RSA_NO_PADDING?s.pkcs0unpad(h):h}}},c_}()),r(t,e)}},__=so._;_w();var M_=Ww,S_=so,E_=y_(),k_=w_;Nn.BigInteger=M_,Nn.Key=function(){function t(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return t.prototype.setOptions=function(t){var e=E_[t.signingScheme],r=E_[t.encryptionScheme];e===r?this.signingScheme=this.encryptionScheme=r.makeScheme(this,t):(this.encryptionScheme=r.makeScheme(this,t),this.signingScheme=e.makeScheme(this,t)),this.encryptEngine=k_.getEngine(this,t)},t.prototype.generate=function(t,e){var r=t>>1;this.e=parseInt(e,16);for(var i=new M_(e,16);;){for(;this.p=new M_(t-r,1),0!==this.p.subtract(M_.ONE).gcd(i).compareTo(M_.ONE)||!this.p.isProbablePrime(10););for(;this.q=new M_(r,1),0!==this.q.subtract(M_.ONE).gcd(i).compareTo(M_.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var n=this.p;this.p=this.q,this.q=n}var o=this.p.subtract(M_.ONE),s=this.q.subtract(M_.ONE),a=o.multiply(s);if(0===a.gcd(i).compareTo(M_.ONE)){if(this.n=this.p.multiply(this.q),this.n.bitLength()<t)continue;this.d=i.modInverse(a),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(s),this.coeff=this.q.modInverse(this.p);break}}this.$$recalculateCache()},t.prototype.setPrivate=function(t,e,r,i,n,o,s,a){if(!(t&&e&&r&&t.length>0&&(__.isNumber(e)||e.length>0)&&r.length>0))throw Error("Invalid RSA private key");this.n=new M_(t),this.e=__.isNumber(e)?e:S_.get32IntFromBuffer(e,0),this.d=new M_(r),i&&n&&o&&s&&a&&(this.p=new M_(i),this.q=new M_(n),this.dmp1=new M_(o),this.dmq1=new M_(s),this.coeff=new M_(a)),this.$$recalculateCache()},t.prototype.setPublic=function(t,e){if(!(t&&e&&t.length>0&&(__.isNumber(e)||e.length>0)))throw Error("Invalid RSA public key");this.n=new M_(t),this.e=__.isNumber(e)?e:S_.get32IntFromBuffer(e,0),this.$$recalculateCache()},t.prototype.$doPrivate=function(t){if(this.p||this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)},t.prototype.$doPublic=function(t){return t.modPowInt(this.e,this.n)},t.prototype.encrypt=function(t,e){var r=[],i=[],n=t.length,o=Math.ceil(n/this.maxMessageLength)||1,s=Math.ceil(n/o||1);if(1==o)r.push(t);else for(var a=0;a<o;a++)r.push(t.slice(a*s,(a+1)*s));for(var h=0;h<r.length;h++)i.push(this.encryptEngine.encrypt(r[h],e));return sr.concat(i)},t.prototype.decrypt=function(t,e){if(t.length%this.encryptedDataLength>0)throw Error("Incorrect data or key");for(var r=[],i=0,n=0,o=t.length/this.encryptedDataLength,s=0;s<o;s++)n=(i=s*this.encryptedDataLength)+this.encryptedDataLength,r.push(this.encryptEngine.decrypt(t.slice(i,Math.min(n,t.length)),e));return sr.concat(r)},t.prototype.sign=function(t){return this.signingScheme.sign.apply(this.signingScheme,arguments)},t.prototype.verify=function(t,e,r){return this.signingScheme.verify.apply(this.signingScheme,arguments)},t.prototype.isPrivate=function(){return!!(this.n&&this.e&&this.d)},t.prototype.isPublic=function(t){return this.n&&this.e&&!(t&&this.d)||!1},Object.defineProperty(t.prototype,"keySize",{get:function(){return this.cache.keyBitLength}}),Object.defineProperty(t.prototype,"encryptedDataLength",{get:function(){return this.cache.keyByteLength}}),Object.defineProperty(t.prototype,"maxMessageLength",{get:function(){return this.encryptionScheme.maxMessageLength()}}),t.prototype.$$recalculateCache=function(){this.cache=this.cache||{},this.cache.keyBitLength=this.n.bitLength(),this.cache.keyByteLength=this.cache.keyBitLength+6>>3},t}();var A_={},O_={get exports(){return A_},set exports(t){A_=t}},T_={newInvalidAsn1Error:function(t){var e=new Error;return e.name="InvalidAsn1Error",e.message=t||"",e}},I_={EOC:0,Boolean:1,Integer:2,BitString:3,OctetString:4,Null:5,OID:6,ObjectDescriptor:7,External:8,Real:9,Enumeration:10,PDV:11,Utf8String:12,RelativeOID:13,Sequence:16,Set:17,NumericString:18,PrintableString:19,T61String:20,VideotexString:21,IA5String:22,UTCTime:23,GeneralizedTime:24,GraphicString:25,VisibleString:26,GeneralString:28,UniversalString:29,CharacterString:30,BMPString:31,Constructor:32,Context:128};function R_(t,e){if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0}var C_,P_=Object.prototype.hasOwnProperty,x_=Object.keys||function(t){var e=[];for(var r in t)P_.call(t,r)&&e.push(r);return e},N_=Array.prototype.slice;function B_(){return void 0!==C_?C_:C_="foo"===function(){}.name}function L_(t){return Object.prototype.toString.call(t)}function D_(t){return!Hr(t)&&("function"==typeof le.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}function j_(t,e){t||K_(t,!0,e,"==",V_)}var U_=/\s*function\s+([^\(\s]*)\s*/;function q_(t){if(rs(t)){if(B_())return t.name;var e=t.toString().match(U_);return e&&e[1]}}function F_(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return z_(H_(t.actual),128)+" "+t.operator+" "+z_(H_(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||K_;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var i=r.stack,n=q_(e),o=i.indexOf("\n"+n);if(o>=0){var s=i.indexOf("\n",o+1);i=i.substring(s+1)}this.stack=i}}}function z_(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function H_(t){if(B_()||!rs(t))return jo(t);var e=q_(t);return"[Function"+(e?": "+e:"")+"]"}function K_(t,e,r,i,n){throw new F_({message:r,actual:t,expected:e,operator:i,stackStartFunction:n})}function V_(t,e){t||K_(t,!0,e,"==",V_)}function G_(t,e,r){t!=e&&K_(t,e,r,"==",G_)}function W_(t,e,r){t==e&&K_(t,e,r,"!=",W_)}function Y_(t,e,r){X_(t,e,!1)||K_(t,e,r,"deepEqual",Y_)}function Z_(t,e,r){X_(t,e,!0)||K_(t,e,r,"deepStrictEqual",Z_)}function X_(t,e,r,i){if(t===e)return!0;if(Hr(t)&&Hr(e))return 0===R_(t,e);if(ts(t)&&ts(e))return t.getTime()===e.getTime();if(Jo(t)&&Jo(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(D_(t)&&D_(e)&&L_(t)===L_(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===R_(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(Hr(t)!==Hr(e))return!1;var n=(i=i||{actual:[],expected:[]}).actual.indexOf(t);return-1!==n&&n===i.expected.indexOf(e)||(i.actual.push(t),i.expected.push(e),function(t,e,r,i){if(null==t||null==e)return!1;if(is(t)||is(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var n=Q_(t),o=Q_(e);if(n&&!o||!n&&o)return!1;if(n)return X_(t=N_.call(t),e=N_.call(e),r);var s,a,h=x_(t),u=x_(e);if(h.length!==u.length)return!1;for(h.sort(),u.sort(),a=h.length-1;a>=0;a--)if(h[a]!==u[a])return!1;for(a=h.length-1;a>=0;a--)if(!X_(t[s=h[a]],e[s],r,i))return!1;return!0}(t,e,r,i))}return r?t===e:t==e}function Q_(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function J_(t,e,r){X_(t,e,!1)&&K_(t,e,r,"notDeepEqual",J_)}function $_(t,e,r){X_(t,e,!0)&&K_(t,e,r,"notDeepStrictEqual",$_)}function tM(t,e,r){t!==e&&K_(t,e,r,"===",tM)}function eM(t,e,r){t===e&&K_(t,e,r,"!==",eM)}function rM(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function iM(t,e,r,i){var n;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(t){var e;try{t()}catch(t){e=t}return e}(e),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!n&&K_(n,r,"Missing expected exception"+i);var o="string"==typeof i,s=!t&&n&&!r;if((!t&&es(n)&&o&&rM(n,r)||s)&&K_(n,r,"Got unwanted exception"+i),t&&n&&r&&!rM(n,r)||!t&&n)throw n}function nM(t,e,r){iM(!0,t,e,r)}function oM(t,e,r){iM(!1,t,e,r)}function sM(t){if(t)throw t}j_.AssertionError=F_,Co(F_,Error),j_.fail=K_,j_.ok=V_,j_.equal=G_,j_.notEqual=W_,j_.deepEqual=Y_,j_.deepStrictEqual=Z_,j_.notDeepEqual=J_,j_.notDeepStrictEqual=$_,j_.strictEqual=tM,j_.notStrictEqual=eM,j_.throws=nM,j_.doesNotThrow=oM,j_.ifError=sM;var aM=X(Object.freeze({__proto__:null,AssertionError:F_,assert:V_,deepEqual:Y_,deepStrictEqual:Z_,default:j_,doesNotThrow:oM,equal:G_,fail:K_,ifError:sM,notDeepEqual:J_,notDeepStrictEqual:$_,notEqual:W_,notStrictEqual:eM,ok:V_,strictEqual:tM,throws:nM})),hM=aM,uM=Hy.Buffer,fM=I_,lM=T_.newInvalidAsn1Error;function cM(t){if(!t||!uM.isBuffer(t))throw new TypeError("data must be a node Buffer");this._buf=t,this._size=t.length,this._len=0,this._offset=0}Object.defineProperty(cM.prototype,"length",{enumerable:!0,get:function(){return this._len}}),Object.defineProperty(cM.prototype,"offset",{enumerable:!0,get:function(){return this._offset}}),Object.defineProperty(cM.prototype,"remain",{get:function(){return this._size-this._offset}}),Object.defineProperty(cM.prototype,"buffer",{get:function(){return this._buf.slice(this._offset)}}),cM.prototype.readByte=function(t){if(this._size-this._offset<1)return null;var e=255&this._buf[this._offset];return t||(this._offset+=1),e},cM.prototype.peek=function(){return this.readByte(!0)},cM.prototype.readLength=function(t){if(void 0===t&&(t=this._offset),t>=this._size)return null;var e=255&this._buf[t++];if(null===e)return null;if(128==(128&e)){if(0===(e&=127))throw lM("Indefinite length not supported");if(e>4)throw lM("encoding too long");if(this._size-t<e)return null;this._len=0;for(var r=0;r<e;r++)this._len=(this._len<<8)+(255&this._buf[t++])}else this._len=e;return t},cM.prototype.readSequence=function(t){var e=this.peek();if(null===e)return null;if(void 0!==t&&t!==e)throw lM("Expected 0x"+t.toString(16)+": got 0x"+e.toString(16));var r=this.readLength(this._offset+1);return null===r?null:(this._offset=r,e)},cM.prototype.readInt=function(){return this._readTag(fM.Integer)},cM.prototype.readBoolean=function(){return 0!==this._readTag(fM.Boolean)},cM.prototype.readEnumeration=function(){return this._readTag(fM.Enumeration)},cM.prototype.readString=function(t,e){t||(t=fM.OctetString);var r=this.peek();if(null===r)return null;if(r!==t)throw lM("Expected 0x"+t.toString(16)+": got 0x"+r.toString(16));var i=this.readLength(this._offset+1);if(null===i)return null;if(this.length>this._size-i)return null;if(this._offset=i,0===this.length)return e?uM.alloc(0):"";var n=this._buf.slice(this._offset,this._offset+this.length);return this._offset+=this.length,e?n:n.toString("utf8")},cM.prototype.readOID=function(t){t||(t=fM.OID);var e=this.readString(t,!0);if(null===e)return null;for(var r=[],i=0,n=0;n<e.length;n++){var o=255&e[n];i<<=7,i+=127&o,0==(128&o)&&(r.push(i),i=0)}return i=r.shift(),r.unshift(i%40),r.unshift(i/40>>0),r.join(".")},cM.prototype._readTag=function(t){hM.ok(void 0!==t);var e=this.peek();if(null===e)return null;if(e!==t)throw lM("Expected 0x"+t.toString(16)+": got 0x"+e.toString(16));var r=this.readLength(this._offset+1);if(null===r)return null;if(this.length>4)throw lM("Integer too long: "+this.length);if(this.length>this._size-r)return null;this._offset=r;for(var i=this._buf[this._offset],n=0,o=0;o<this.length;o++)n<<=8,n|=255&this._buf[this._offset++];return 128==(128&i)&&4!==o&&(n-=1<<8*o),n>>0};var dM=cM,pM=aM,mM=Hy.Buffer,gM=I_,yM=T_.newInvalidAsn1Error,bM={size:1024,growthFactor:8};function vM(t){t=function(t,e){return pM.ok(t),pM.equal(typeof t,"object"),pM.ok(e),pM.equal(typeof e,"object"),Object.getOwnPropertyNames(t).forEach((function(r){if(!e[r]){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i)}})),e}(bM,t||{}),this._buf=mM.alloc(t.size||1024),this._size=this._buf.length,this._offset=0,this._options=t,this._seq=[]}Object.defineProperty(vM.prototype,"buffer",{get:function(){if(this._seq.length)throw yM(this._seq.length+" unended sequence(s)");return this._buf.slice(0,this._offset)}}),vM.prototype.writeByte=function(t){if("number"!=typeof t)throw new TypeError("argument must be a Number");this._ensure(1),this._buf[this._offset++]=t},vM.prototype.writeInt=function(t,e){if("number"!=typeof t)throw new TypeError("argument must be a Number");"number"!=typeof e&&(e=gM.Integer);for(var r=4;(0==(4286578688&t)||-8388608==(4286578688&t))&&r>1;)r--,t<<=8;if(r>4)throw yM("BER ints cannot be > 0xffffffff");for(this._ensure(2+r),this._buf[this._offset++]=e,this._buf[this._offset++]=r;r-- >0;)this._buf[this._offset++]=(4278190080&t)>>>24,t<<=8},vM.prototype.writeNull=function(){this.writeByte(gM.Null),this.writeByte(0)},vM.prototype.writeEnumeration=function(t,e){if("number"!=typeof t)throw new TypeError("argument must be a Number");return"number"!=typeof e&&(e=gM.Enumeration),this.writeInt(t,e)},vM.prototype.writeBoolean=function(t,e){if("boolean"!=typeof t)throw new TypeError("argument must be a Boolean");"number"!=typeof e&&(e=gM.Boolean),this._ensure(3),this._buf[this._offset++]=e,this._buf[this._offset++]=1,this._buf[this._offset++]=t?255:0},vM.prototype.writeString=function(t,e){if("string"!=typeof t)throw new TypeError("argument must be a string (was: "+typeof t+")");"number"!=typeof e&&(e=gM.OctetString);var r=mM.byteLength(t);this.writeByte(e),this.writeLength(r),r&&(this._ensure(r),this._buf.write(t,this._offset),this._offset+=r)},vM.prototype.writeBuffer=function(t,e){if("number"!=typeof e)throw new TypeError("tag must be a number");if(!mM.isBuffer(t))throw new TypeError("argument must be a buffer");this.writeByte(e),this.writeLength(t.length),this._ensure(t.length),t.copy(this._buf,this._offset,0,t.length),this._offset+=t.length},vM.prototype.writeStringArray=function(t){if(!t instanceof Array)throw new TypeError("argument must be an Array[String]");var e=this;t.forEach((function(t){e.writeString(t)}))},vM.prototype.writeOID=function(t,e){if("string"!=typeof t)throw new TypeError("argument must be a string");if("number"!=typeof e&&(e=gM.OID),!/^([0-9]+\.){3,}[0-9]+$/.test(t))throw new Error("argument is not a valid OID string");var r=t.split("."),i=[];i.push(40*parseInt(r[0],10)+parseInt(r[1],10)),r.slice(2).forEach((function(t){!function(t,e){e<128?t.push(e):e<16384?(t.push(e>>>7|128),t.push(127&e)):e<2097152?(t.push(e>>>14|128),t.push(255&(e>>>7|128)),t.push(127&e)):e<268435456?(t.push(e>>>21|128),t.push(255&(e>>>14|128)),t.push(255&(e>>>7|128)),t.push(127&e)):(t.push(255&(e>>>28|128)),t.push(255&(e>>>21|128)),t.push(255&(e>>>14|128)),t.push(255&(e>>>7|128)),t.push(127&e))}(i,parseInt(t,10))}));var n=this;this._ensure(2+i.length),this.writeByte(e),this.writeLength(i.length),i.forEach((function(t){n.writeByte(t)}))},vM.prototype.writeLength=function(t){if("number"!=typeof t)throw new TypeError("argument must be a Number");if(this._ensure(4),t<=127)this._buf[this._offset++]=t;else if(t<=255)this._buf[this._offset++]=129,this._buf[this._offset++]=t;else if(t<=65535)this._buf[this._offset++]=130,this._buf[this._offset++]=t>>8,this._buf[this._offset++]=t;else{if(!(t<=16777215))throw yM("Length too long (> 4 bytes)");this._buf[this._offset++]=131,this._buf[this._offset++]=t>>16,this._buf[this._offset++]=t>>8,this._buf[this._offset++]=t}},vM.prototype.startSequence=function(t){"number"!=typeof t&&(t=gM.Sequence|gM.Constructor),this.writeByte(t),this._seq.push(this._offset),this._ensure(3),this._offset+=3},vM.prototype.endSequence=function(){var t=this._seq.pop(),e=t+3,r=this._offset-e;if(r<=127)this._shift(e,r,-2),this._buf[t]=r;else if(r<=255)this._shift(e,r,-1),this._buf[t]=129,this._buf[t+1]=r;else if(r<=65535)this._buf[t]=130,this._buf[t+1]=r>>8,this._buf[t+2]=r;else{if(!(r<=16777215))throw yM("Sequence too long");this._shift(e,r,1),this._buf[t]=131,this._buf[t+1]=r>>16,this._buf[t+2]=r>>8,this._buf[t+3]=r}},vM.prototype._shift=function(t,e,r){pM.ok(void 0!==t),pM.ok(void 0!==e),pM.ok(r),this._buf.copy(this._buf,t+r,t,t+e),this._offset+=r},vM.prototype._ensure=function(t){if(pM.ok(t),this._size-this._offset<t){var e=this._size*this._options.growthFactor;e-this._offset<t&&(e+=t);var r=mM.alloc(e);this._buf.copy(r,0,0,this._offset),this._buf=r,this._size=e}};var wM=vM;!function(t){var e=T_,r=I_,i=dM,n=wM;for(var o in t.exports={Reader:i,Writer:n},r)r.hasOwnProperty(o)&&(t.exports[o]=r[o]);for(var s in e)e.hasOwnProperty(s)&&(t.exports[s]=e[s])}(O_);var _M=A_,MM={Ber:_M,BerReader:_M.Reader,BerWriter:_M.Writer},SM={},EM={get exports(){return SM},set exports(t){SM=t}},kM={},AM={get exports(){return kM},set exports(t){kM=t}};!function(t){var e=MM.Ber,r=so._,i=so;const n="-----BEGIN RSA PRIVATE KEY-----",o="-----END RSA PRIVATE KEY-----",s="-----BEGIN RSA PUBLIC KEY-----",a="-----END RSA PUBLIC KEY-----";t.exports={privateExport:function(t,r){r=r||{};var s=t.n.toBuffer(),a=t.d.toBuffer(),h=t.p.toBuffer(),u=t.q.toBuffer(),f=t.dmp1.toBuffer(),l=t.dmq1.toBuffer(),c=t.coeff.toBuffer(),d=s.length+a.length+h.length+u.length+f.length+l.length+c.length+512,p=new e.Writer({size:d});return p.startSequence(),p.writeInt(0),p.writeBuffer(s,2),p.writeInt(t.e),p.writeBuffer(a,2),p.writeBuffer(h,2),p.writeBuffer(u,2),p.writeBuffer(f,2),p.writeBuffer(l,2),p.writeBuffer(c,2),p.endSequence(),"der"===r.type?p.buffer:n+"\n"+i.linebrk(p.buffer.toString("base64"),64)+"\n"+o},privateImport:function(t,s,a){var h;if("der"!==(a=a||{}).type){if(sr.isBuffer(s)&&(s=s.toString("utf8")),!r.isString(s))throw Error("Unsupported key format");var u=i.trimSurroundingText(s,n,o).replace(/\s+|\n\r|\n|\r$/gm,"");h=sr.from(u,"base64")}else{if(!sr.isBuffer(s))throw Error("Unsupported key format");h=s}var f=new e.Reader(h);f.readSequence(),f.readString(2,!0),t.setPrivate(f.readString(2,!0),f.readString(2,!0),f.readString(2,!0),f.readString(2,!0),f.readString(2,!0),f.readString(2,!0),f.readString(2,!0),f.readString(2,!0))},publicExport:function(t,r){r=r||{};var n=t.n.toBuffer(),o=n.length+512,h=new e.Writer({size:o});return h.startSequence(),h.writeBuffer(n,2),h.writeInt(t.e),h.endSequence(),"der"===r.type?h.buffer:s+"\n"+i.linebrk(h.buffer.toString("base64"),64)+"\n"+a},publicImport:function(t,n,o){var h;if("der"!==(o=o||{}).type){if(sr.isBuffer(n)&&(n=n.toString("utf8")),r.isString(n)){var u=i.trimSurroundingText(n,s,a).replace(/\s+|\n\r|\n|\r$/gm,"");h=sr.from(u,"base64")}}else{if(!sr.isBuffer(n))throw Error("Unsupported key format");h=n}var f=new e.Reader(h);f.readSequence(),t.setPublic(f.readString(2,!0),f.readString(2,!0))},autoImport:function(e,r){return/^[\S\s]*-----BEGIN RSA PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PRIVATE KEY-----[\S\s]*$/g.test(r)?(t.exports.privateImport(e,r),!0):!!/^[\S\s]*-----BEGIN RSA PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PUBLIC KEY-----[\S\s]*$/g.test(r)&&(t.exports.publicImport(e,r),!0)}}}(AM);var OM={},TM={get exports(){return OM},set exports(t){OM=t}};!function(t){var e=MM.Ber,r=so._,i="1.2.840.113549.1.1.1",n=so;const o="-----BEGIN PRIVATE KEY-----",s="-----END PRIVATE KEY-----",a="-----BEGIN PUBLIC KEY-----",h="-----END PUBLIC KEY-----";t.exports={privateExport:function(t,r){r=r||{};var a=t.n.toBuffer(),h=t.d.toBuffer(),u=t.p.toBuffer(),f=t.q.toBuffer(),l=t.dmp1.toBuffer(),c=t.dmq1.toBuffer(),d=t.coeff.toBuffer(),p=a.length+h.length+u.length+f.length+l.length+c.length+d.length+512,m=new e.Writer({size:p});m.startSequence(),m.writeInt(0),m.writeBuffer(a,2),m.writeInt(t.e),m.writeBuffer(h,2),m.writeBuffer(u,2),m.writeBuffer(f,2),m.writeBuffer(l,2),m.writeBuffer(c,2),m.writeBuffer(d,2),m.endSequence();var g=new e.Writer({size:p});return g.startSequence(),g.writeInt(0),g.startSequence(),g.writeOID(i),g.writeNull(),g.endSequence(),g.writeBuffer(m.buffer,4),g.endSequence(),"der"===r.type?g.buffer:o+"\n"+n.linebrk(g.buffer.toString("base64"),64)+"\n"+s},privateImport:function(t,a,h){var u;if("der"!==(h=h||{}).type){if(sr.isBuffer(a)&&(a=a.toString("utf8")),!r.isString(a))throw Error("Unsupported key format");var f=n.trimSurroundingText(a,o,s).replace("-----END PRIVATE KEY-----","").replace(/\s+|\n\r|\n|\r$/gm,"");u=sr.from(f,"base64")}else{if(!sr.isBuffer(a))throw Error("Unsupported key format");u=a}var l=new e.Reader(u);if(l.readSequence(),l.readInt(0),new e.Reader(l.readString(48,!0)).readOID(6,!0)!==i)throw Error("Invalid Public key format");var c=new e.Reader(l.readString(4,!0));c.readSequence(),c.readString(2,!0),t.setPrivate(c.readString(2,!0),c.readString(2,!0),c.readString(2,!0),c.readString(2,!0),c.readString(2,!0),c.readString(2,!0),c.readString(2,!0),c.readString(2,!0))},publicExport:function(t,r){r=r||{};var o=t.n.toBuffer(),s=o.length+512,u=new e.Writer({size:s});u.writeByte(0),u.startSequence(),u.writeBuffer(o,2),u.writeInt(t.e),u.endSequence();var f=new e.Writer({size:s});return f.startSequence(),f.startSequence(),f.writeOID(i),f.writeNull(),f.endSequence(),f.writeBuffer(u.buffer,3),f.endSequence(),"der"===r.type?f.buffer:a+"\n"+n.linebrk(f.buffer.toString("base64"),64)+"\n"+h},publicImport:function(t,o,s){var u;if("der"!==(s=s||{}).type){if(sr.isBuffer(o)&&(o=o.toString("utf8")),r.isString(o)){var f=n.trimSurroundingText(o,a,h).replace(/\s+|\n\r|\n|\r$/gm,"");u=sr.from(f,"base64")}}else{if(!sr.isBuffer(o))throw Error("Unsupported key format");u=o}var l=new e.Reader(u);if(l.readSequence(),new e.Reader(l.readString(48,!0)).readOID(6,!0)!==i)throw Error("Invalid Public key format");var c=new e.Reader(l.readString(3,!0));c.readByte(),c.readSequence(),t.setPublic(c.readString(2,!0),c.readString(2,!0))},autoImport:function(e,r){return/^[\S\s]*-----BEGIN PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PRIVATE KEY-----[\S\s]*$/g.test(r)?(t.exports.privateImport(e,r),!0):!!/^[\S\s]*-----BEGIN PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PUBLIC KEY-----[\S\s]*$/g.test(r)&&(t.exports.publicImport(e,r),!0)}}}(TM);var IM={},RM={get exports(){return IM},set exports(t){IM=t}};!function(t){so._,t.exports={privateExport:function(t,e){return{n:t.n.toBuffer(),e:t.e,d:t.d.toBuffer(),p:t.p.toBuffer(),q:t.q.toBuffer(),dmp1:t.dmp1.toBuffer(),dmq1:t.dmq1.toBuffer(),coeff:t.coeff.toBuffer()}},privateImport:function(t,e,r){if(!(e.n&&e.e&&e.d&&e.p&&e.q&&e.dmp1&&e.dmq1&&e.coeff))throw Error("Invalid key data");t.setPrivate(e.n,e.e,e.d,e.p,e.q,e.dmp1,e.dmq1,e.coeff)},publicExport:function(t,e){return{n:t.n.toBuffer(),e:t.e}},publicImport:function(t,e,r){if(!e.n||!e.e)throw Error("Invalid key data");t.setPublic(e.n,e.e)},autoImport:function(e,r){return!(!r.n||!r.e)&&(r.d&&r.p&&r.q&&r.dmp1&&r.dmq1&&r.coeff?(t.exports.privateImport(e,r),!0):(t.exports.publicImport(e,r),!0))}}}(RM);var CM={},PM={get exports(){return CM},set exports(t){CM=t}};!function(t){var e=so._,r=so,i=Ww;const n="-----BEGIN OPENSSH PRIVATE KEY-----",o="-----END OPENSSH PRIVATE KEY-----";function s(t){const e=t.buf.readInt32BE(t.off);t.off+=4;const r=t.buf.slice(t.off,t.off+e);return t.off+=e,r}function a(t,e){t.buf.writeInt32BE(e.byteLength,t.off),t.off+=4,t.off+=e.copy(t.buf,t.off)}t.exports={privateExport:function(t,e){const i=t.n.toBuffer();let s=sr.alloc(4);for(s.writeUInt32BE(t.e,0);0===s[0];)s=s.slice(1);const h=t.d.toBuffer(),u=t.coeff.toBuffer(),f=t.p.toBuffer(),l=t.q.toBuffer();let c;c=void 0!==t.sshcomment?sr.from(t.sshcomment):sr.from([]);const d=15+s.byteLength+4+i.byteLength,p=23+i.byteLength+4+s.byteLength+4+h.byteLength+4+u.byteLength+4+f.byteLength+4+l.byteLength+4+c.byteLength;let m=43+d+4+p;m+=8*Math.ceil(p/8)-p;const g=sr.alloc(m),y={buf:g,off:0};g.write("openssh-key-v1","utf8"),g.writeUInt8(0,14),y.off+=15,a(y,sr.from("none")),a(y,sr.from("none")),a(y,sr.from("")),y.off=y.buf.writeUInt32BE(1,y.off),y.off=y.buf.writeUInt32BE(d,y.off),a(y,sr.from("ssh-rsa")),a(y,s),a(y,i),y.off=y.buf.writeUInt32BE(m-47-d,y.off),y.off+=8,a(y,sr.from("ssh-rsa")),a(y,i),a(y,s),a(y,h),a(y,u),a(y,f),a(y,l),a(y,c);let b=1;for(;y.off<m;)y.off=y.buf.writeUInt8(b++,y.off);return"der"===e.type?y.buf:n+"\n"+r.linebrk(g.toString("base64"),70)+"\n"+o+"\n"},privateImport:function(t,a,h){var u;if("der"!==(h=h||{}).type){if(sr.isBuffer(a)&&(a=a.toString("utf8")),!e.isString(a))throw Error("Unsupported key format");var f=r.trimSurroundingText(a,n,o).replace(/\s+|\n\r|\n|\r$/gm,"");u=sr.from(f,"base64")}else{if(!sr.isBuffer(a))throw Error("Unsupported key format");u=a}const l={buf:u,off:0};if("openssh-key-v1"!==u.slice(0,14).toString("ascii"))throw"Invalid file format.";if(l.off+=15,"none"!==s(l).toString("ascii"))throw Error("Unsupported key type");if("none"!==s(l).toString("ascii"))throw Error("Unsupported key type");if(""!==s(l).toString("ascii"))throw Error("Unsupported key type");if(l.off+=4,l.off+=4,"ssh-rsa"!==s(l).toString("ascii"))throw Error("Unsupported key type");if(s(l),s(l),l.off+=12,"ssh-rsa"!==s(l).toString("ascii"))throw Error("Unsupported key type");const c=s(l),d=s(l),p=s(l),m=s(l),g=s(l),y=s(l),b=new i(p),v=new i(y),w=new i(g),_=b.mod(w.subtract(i.ONE)),M=b.mod(v.subtract(i.ONE));t.setPrivate(c,d,p,g,y,_.toBuffer(),M.toBuffer(),m),t.sshcomment=s(l).toString("ascii")},publicExport:function(t,e){let r=sr.alloc(4);for(r.writeUInt32BE(t.e,0);0===r[0];)r=r.slice(1);const i=t.n.toBuffer(),n=sr.alloc(r.byteLength+4+i.byteLength+4+7+4),o={buf:n,off:0};a(o,sr.from("ssh-rsa")),a(o,r),a(o,i);let s=t.sshcomment||"";return"der"===e.type?o.buf:"ssh-rsa "+n.toString("base64")+" "+s+"\n"},publicImport:function(t,r,i){var n;if("der"!==(i=i||{}).type){if(sr.isBuffer(r)&&(r=r.toString("utf8")),!e.isString(r))throw Error("Unsupported key format");{if("ssh-rsa "!==r.substring(0,8))throw Error("Unsupported key format");let e=r.indexOf(" ",8);-1===e?e=r.length:t.sshcomment=r.substring(e+1).replace(/\s+|\n\r|\n|\r$/gm,"");const i=r.substring(8,e).replace(/\s+|\n\r|\n|\r$/gm,"");n=sr.from(i,"base64")}}else{if(!sr.isBuffer(r))throw Error("Unsupported key format");n=r}const o={buf:n,off:0},a=s(o).toString("ascii");if("ssh-rsa"!==a)throw Error("Invalid key type: "+a);const h=s(o),u=s(o);t.setPublic(u,h)},autoImport:function(e,r){return/^[\S\s]*-----BEGIN OPENSSH PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END OPENSSH PRIVATE KEY-----[\S\s]*$/g.test(r)?(t.exports.privateImport(e,r),!0):!!/^[\S\s]*ssh-rsa \s*(?=(([A-Za-z0-9+/=]+\s*)+))\1[\S\s]*$/g.test(r)&&(t.exports.publicImport(e,r),!0)}}}(PM),function(t){function e(t){t=t.split("-");for(var e="private",r={type:"default"},i=1;i<t.length;i++)if(t[i])switch(t[i]){case"public":case"private":e=t[i];break;case"pem":case"der":r.type=t[i]}return{scheme:t[0],keyType:e,keyOpt:r}}so._,t.exports={pkcs1:kM,pkcs8:OM,components:IM,openssh:CM,isPrivateExport:function(e){return t.exports[e]&&"function"==typeof t.exports[e].privateExport},isPrivateImport:function(e){return t.exports[e]&&"function"==typeof t.exports[e].privateImport},isPublicExport:function(e){return t.exports[e]&&"function"==typeof t.exports[e].publicExport},isPublicImport:function(e){return t.exports[e]&&"function"==typeof t.exports[e].publicImport},detectAndImport:function(r,i,n){if(void 0===n){for(var o in t.exports)if("function"==typeof t.exports[o].autoImport&&t.exports[o].autoImport(r,i))return!0}else if(n){var s=e(n);if(!t.exports[s.scheme])throw Error("Unsupported key format");"private"===s.keyType?t.exports[s.scheme].privateImport(r,i,s.keyOpt):t.exports[s.scheme].publicImport(r,i,s.keyOpt)}return!1},detectAndExport:function(r,i){if(i){var n=e(i);if(t.exports[n.scheme]){if("private"===n.keyType){if(!r.isPrivate())throw Error("This is not private key");return t.exports[n.scheme].privateExport(r,n.keyOpt)}if(!r.isPublic())throw Error("This is not public key");return t.exports[n.scheme].publicExport(r,n.keyOpt)}throw Error("Unsupported key format")}}}}(EM);var xM=xn,NM=Nn;_w();var BM=so._,LM=so,DM=y_(),jM=SM;void 0===xM.RSA_NO_PADDING&&(xM.RSA_NO_PADDING=3);var UM=function(){var t={node10:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],node:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],iojs:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],browser:["md5","ripemd160","sha1","sha256","sha512"]},e="pkcs1_oaep",r="pkcs1",i={private:"pkcs1-private-pem","private-der":"pkcs1-private-der",public:"pkcs8-public-pem","public-der":"pkcs8-public-der"};function n(t,i,o){if(!(this instanceof n))return new n(t,i,o);BM.isObject(i)&&(o=i,i=void 0),this.$options={signingScheme:r,signingSchemeOptions:{hash:"sha256",saltLength:null},encryptionScheme:e,encryptionSchemeOptions:{hash:"sha1",label:null},environment:LM.detectEnvironment(),rsaUtils:this},this.keyPair=new NM.Key,this.$cache={},sr.isBuffer(t)||BM.isString(t)?this.importKey(t,i):BM.isObject(t)&&this.generateKeyPair(t.b,t.e),this.setOptions(o)}return n.prototype.setOptions=function(i){if((i=i||{}).environment&&(this.$options.environment=i.environment),i.signingScheme){if(BM.isString(i.signingScheme)){var n=i.signingScheme.toLowerCase().split("-");1==n.length?t.node.indexOf(n[0])>-1?(this.$options.signingSchemeOptions={hash:n[0]},this.$options.signingScheme=r):(this.$options.signingScheme=n[0],this.$options.signingSchemeOptions={hash:null}):(this.$options.signingSchemeOptions={hash:n[1]},this.$options.signingScheme=n[0])}else BM.isObject(i.signingScheme)&&(this.$options.signingScheme=i.signingScheme.scheme||r,this.$options.signingSchemeOptions=BM.omit(i.signingScheme,"scheme"));if(!DM.isSignature(this.$options.signingScheme))throw Error("Unsupported signing scheme");if(this.$options.signingSchemeOptions.hash&&-1===t[this.$options.environment].indexOf(this.$options.signingSchemeOptions.hash))throw Error("Unsupported hashing algorithm for "+this.$options.environment+" environment")}if(i.encryptionScheme){if(BM.isString(i.encryptionScheme)?(this.$options.encryptionScheme=i.encryptionScheme.toLowerCase(),this.$options.encryptionSchemeOptions={}):BM.isObject(i.encryptionScheme)&&(this.$options.encryptionScheme=i.encryptionScheme.scheme||e,this.$options.encryptionSchemeOptions=BM.omit(i.encryptionScheme,"scheme")),!DM.isEncryption(this.$options.encryptionScheme))throw Error("Unsupported encryption scheme");if(this.$options.encryptionSchemeOptions.hash&&-1===t[this.$options.environment].indexOf(this.$options.encryptionSchemeOptions.hash))throw Error("Unsupported hashing algorithm for "+this.$options.environment+" environment")}this.keyPair.setOptions(this.$options)},n.prototype.generateKeyPair=function(t,e){if(e=e||65537,(t=t||2048)%8!=0)throw Error("Key size must be a multiple of 8.");return this.keyPair.generate(t,e.toString(16)),this.$cache={},this},n.prototype.importKey=function(t,e){if(!t)throw Error("Empty key given");if(e&&(e=i[e]||e),!jM.detectAndImport(this.keyPair,t,e)&&void 0===e)throw Error("Key format must be specified");return this.$cache={},this},n.prototype.exportKey=function(t){return t=i[t=t||"private"]||t,this.$cache[t]||(this.$cache[t]=jM.detectAndExport(this.keyPair,t)),this.$cache[t]},n.prototype.isPrivate=function(){return this.keyPair.isPrivate()},n.prototype.isPublic=function(t){return this.keyPair.isPublic(t)},n.prototype.isEmpty=function(t){return!(this.keyPair.n||this.keyPair.e||this.keyPair.d)},n.prototype.encrypt=function(t,e,r){return this.$$encryptKey(!1,t,e,r)},n.prototype.decrypt=function(t,e){return this.$$decryptKey(!1,t,e)},n.prototype.encryptPrivate=function(t,e,r){return this.$$encryptKey(!0,t,e,r)},n.prototype.decryptPublic=function(t,e){return this.$$decryptKey(!0,t,e)},n.prototype.$$encryptKey=function(t,e,r,i){try{var n=this.keyPair.encrypt(this.$getDataForEncrypt(e,i),t);return"buffer"!=r&&r?n.toString(r):n}catch(t){throw Error("Error during encryption. Original error: "+t)}},n.prototype.$$decryptKey=function(t,e,r){try{e=BM.isString(e)?sr.from(e,"base64"):e;var i=this.keyPair.decrypt(e,t);if(null===i)throw Error("Key decrypt method returns null.");return this.$getDecryptedData(i,r)}catch(t){throw Error("Error during decryption (probably incorrect key). Original error: "+t)}},n.prototype.sign=function(t,e,r){if(!this.isPrivate())throw Error("This is not private key");var i=this.keyPair.sign(this.$getDataForEncrypt(t,r));return e&&"buffer"!=e&&(i=i.toString(e)),i},n.prototype.verify=function(t,e,r,i){if(!this.isPublic())throw Error("This is not public key");return i=i&&"buffer"!=i?i:null,this.keyPair.verify(this.$getDataForEncrypt(t,r),e,i)},n.prototype.getKeySize=function(){return this.keyPair.keySize},n.prototype.getMaxMessageSize=function(){return this.keyPair.maxMessageLength},n.prototype.$getDataForEncrypt=function(t,e){if(BM.isString(t)||BM.isNumber(t))return sr.from(""+t,e||"utf8");if(sr.isBuffer(t))return t;if(BM.isObject(t))return sr.from(JSON.stringify(t));throw Error("Unexpected data type")},n.prototype.$getDecryptedData=function(t,e){return"buffer"==(e=e||"buffer")?t:"json"==e?JSON.parse(t.toString()):t.toString(e)},n}(),qM="object"==typeof le&&le&&le.Object===Object&&le,FM="object"==typeof self&&self&&self.Object===Object&&self,zM=qM||FM||Function("return this")(),HM=zM.Symbol,KM=Object.prototype,VM=KM.hasOwnProperty,GM=KM.toString,WM=HM?HM.toStringTag:void 0;var YM=Object.prototype.toString;var ZM="[object Null]",XM="[object Undefined]",QM=HM?HM.toStringTag:void 0;function JM(t){return null==t?void 0===t?XM:ZM:QM&&QM in Object(t)?function(t){var e=VM.call(t,WM),r=t[WM];try{t[WM]=void 0;var i=!0}catch(t){}var n=GM.call(t);return i&&(e?t[WM]=r:delete t[WM]),n}(t):function(t){return YM.call(t)}(t)}function $M(t){return null!=t&&"object"==typeof t}var tS="[object Symbol]";function eS(t){return"symbol"==typeof t||$M(t)&&JM(t)==tS}function rS(t,e){for(var r=-1,i=null==t?0:t.length,n=Array(i);++r<i;)n[r]=e(t[r],r,t);return n}var iS=Array.isArray,nS=1/0,oS=HM?HM.prototype:void 0,sS=oS?oS.toString:void 0;function aS(t){if("string"==typeof t)return t;if(iS(t))return rS(t,aS)+"";if(eS(t))return sS?sS.call(t):"";var e=t+"";return"0"==e&&1/t==-nS?"-0":e}var hS=/\s/;var uS=/^\s+/;function fS(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&hS.test(t.charAt(e)););return e}(t)+1).replace(uS,""):t}function lS(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var cS=NaN,dS=/^[-+]0x[0-9a-f]+$/i,pS=/^0b[01]+$/i,mS=/^0o[0-7]+$/i,gS=parseInt;var yS=1/0,bS=17976931348623157e292;function vS(t){return t?(t=function(t){if("number"==typeof t)return t;if(eS(t))return cS;if(lS(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=lS(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=fS(t);var r=pS.test(t);return r||mS.test(t)?gS(t.slice(2),r?2:8):dS.test(t)?cS:+t}(t),t===yS||t===-yS?(t<0?-1:1)*bS:t==t?t:0):0===t?t:0}function wS(t){return t}var _S="[object AsyncFunction]",MS="[object Function]",SS="[object GeneratorFunction]",ES="[object Proxy]";function kS(t){if(!lS(t))return!1;var e=JM(t);return e==MS||e==SS||e==_S||e==ES}var AS,OS=zM["__core-js_shared__"],TS=(AS=/[^.]+$/.exec(OS&&OS.keys&&OS.keys.IE_PROTO||""))?"Symbol(src)_1."+AS:"";var IS=Function.prototype.toString;function RS(t){if(null!=t){try{return IS.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var CS=/^\[object .+?Constructor\]$/,PS=Function.prototype,xS=Object.prototype,NS=PS.toString,BS=xS.hasOwnProperty,LS=RegExp("^"+NS.call(BS).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function DS(t){return!(!lS(t)||(e=t,TS&&TS in e))&&(kS(t)?LS:CS).test(RS(t));var e}function jS(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return DS(r)?r:void 0}var US=jS(zM,"WeakMap"),qS=9007199254740991,FS=/^(?:0|[1-9]\d*)$/;function zS(t,e){var r=typeof t;return!!(e=null==e?qS:e)&&("number"==r||"symbol"!=r&&FS.test(t))&&t>-1&&t%1==0&&t<e}function HS(t,e){return t===e||t!=t&&e!=e}var KS=9007199254740991;function VS(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=KS}function GS(t){return null!=t&&VS(t.length)&&!kS(t)}var WS=Object.prototype;function YS(t){return $M(t)&&"[object Arguments]"==JM(t)}var ZS=Object.prototype,XS=ZS.hasOwnProperty,QS=ZS.propertyIsEnumerable,JS=YS(function(){return arguments}())?YS:function(t){return $M(t)&&XS.call(t,"callee")&&!QS.call(t,"callee")},$S=JS;var tE="object"==typeof exports&&exports&&!exports.nodeType&&exports,eE=tE&&"object"==typeof module&&module&&!module.nodeType&&module,rE=eE&&eE.exports===tE?zM.Buffer:void 0,iE=(rE?rE.isBuffer:void 0)||function(){return!1},nE={};nE["[object Float32Array]"]=nE["[object Float64Array]"]=nE["[object Int8Array]"]=nE["[object Int16Array]"]=nE["[object Int32Array]"]=nE["[object Uint8Array]"]=nE["[object Uint8ClampedArray]"]=nE["[object Uint16Array]"]=nE["[object Uint32Array]"]=!0,nE["[object Arguments]"]=nE["[object Array]"]=nE["[object ArrayBuffer]"]=nE["[object Boolean]"]=nE["[object DataView]"]=nE["[object Date]"]=nE["[object Error]"]=nE["[object Function]"]=nE["[object Map]"]=nE["[object Number]"]=nE["[object Object]"]=nE["[object RegExp]"]=nE["[object Set]"]=nE["[object String]"]=nE["[object WeakMap]"]=!1;var oE,sE="object"==typeof exports&&exports&&!exports.nodeType&&exports,aE=sE&&"object"==typeof module&&module&&!module.nodeType&&module,hE=aE&&aE.exports===sE&&qM.process,uE=function(){try{var t=aE&&aE.require&&aE.require("util").types;return t||hE&&hE.binding&&hE.binding("util")}catch(t){}}(),fE=uE&&uE.isTypedArray,lE=fE?(oE=fE,function(t){return oE(t)}):function(t){return $M(t)&&VS(t.length)&&!!nE[JM(t)]},cE=lE,dE=Object.prototype.hasOwnProperty;function pE(t,e){var r=iS(t),i=!r&&$S(t),n=!r&&!i&&iE(t),o=!r&&!i&&!n&&cE(t),s=r||i||n||o,a=s?function(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}(t.length,String):[],h=a.length;for(var u in t)!e&&!dE.call(t,u)||s&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||zS(u,h))||a.push(u);return a}var mE=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),gE=mE,yE=Object.prototype.hasOwnProperty;function bE(t){if(!function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||WS)}(t))return gE(t);var e=[];for(var r in Object(t))yE.call(t,r)&&"constructor"!=r&&e.push(r);return e}function vE(t){return GS(t)?pE(t):bE(t)}var wE=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_E=/^\w*$/;function ME(t,e){if(iS(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!eS(t))||(_E.test(t)||!wE.test(t)||null!=e&&t in Object(e))}var SE=jS(Object,"create");var EE=Object.prototype.hasOwnProperty;var kE=Object.prototype.hasOwnProperty;function AE(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function OE(t,e){for(var r=t.length;r--;)if(HS(t[r][0],e))return r;return-1}AE.prototype.clear=function(){this.__data__=SE?SE(null):{},this.size=0},AE.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},AE.prototype.get=function(t){var e=this.__data__;if(SE){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return EE.call(e,t)?e[t]:void 0},AE.prototype.has=function(t){var e=this.__data__;return SE?void 0!==e[t]:kE.call(e,t)},AE.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=SE&&void 0===e?"__lodash_hash_undefined__":e,this};var TE=Array.prototype.splice;function IE(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}IE.prototype.clear=function(){this.__data__=[],this.size=0},IE.prototype.delete=function(t){var e=this.__data__,r=OE(e,t);return!(r<0)&&(r==e.length-1?e.pop():TE.call(e,r,1),--this.size,!0)},IE.prototype.get=function(t){var e=this.__data__,r=OE(e,t);return r<0?void 0:e[r][1]},IE.prototype.has=function(t){return OE(this.__data__,t)>-1},IE.prototype.set=function(t,e){var r=this.__data__,i=OE(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this};var RE=jS(zM,"Map");function CE(t,e){var r=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?r["string"==typeof e?"string":"hash"]:r.map}function PE(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}PE.prototype.clear=function(){this.size=0,this.__data__={hash:new AE,map:new(RE||IE),string:new AE}},PE.prototype.delete=function(t){var e=CE(this,t).delete(t);return this.size-=e?1:0,e},PE.prototype.get=function(t){return CE(this,t).get(t)},PE.prototype.has=function(t){return CE(this,t).has(t)},PE.prototype.set=function(t,e){var r=CE(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this};var xE="Expected a function";function NE(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(xE);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(NE.Cache||PE),r}NE.Cache=PE;var BE=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,LE=/\\(\\)?/g,DE=function(t){var e=NE(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(BE,(function(t,r,i,n){e.push(i?n.replace(LE,"$1"):r||t)})),e})),jE=DE;function UE(t,e){return iS(t)?t:ME(t,e)?[t]:jE(function(t){return null==t?"":aS(t)}(t))}var qE=1/0;function FE(t){if("string"==typeof t||eS(t))return t;var e=t+"";return"0"==e&&1/t==-qE?"-0":e}function zE(t,e){for(var r=0,i=(e=UE(e,t)).length;null!=t&&r<i;)t=t[FE(e[r++])];return r&&r==i?t:void 0}function HE(t,e){for(var r=-1,i=e.length,n=t.length;++r<i;)t[n+r]=e[r];return t}var KE=HM?HM.isConcatSpreadable:void 0;function VE(t){return iS(t)||$S(t)||!!(KE&&t&&t[KE])}function GE(t,e,r,i,n){var o=-1,s=t.length;for(r||(r=VE),n||(n=[]);++o<s;){var a=t[o];e>0&&r(a)?e>1?GE(a,e-1,r,i,n):HE(n,a):i||(n[n.length]=a)}return n}function WE(t){var e=this.__data__=new IE(t);this.size=e.size}WE.prototype.clear=function(){this.__data__=new IE,this.size=0},WE.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},WE.prototype.get=function(t){return this.__data__.get(t)},WE.prototype.has=function(t){return this.__data__.has(t)},WE.prototype.set=function(t,e){var r=this.__data__;if(r instanceof IE){var i=r.__data__;if(!RE||i.length<199)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new PE(i)}return r.set(t,e),this.size=r.size,this};var YE=Object.prototype.propertyIsEnumerable,ZE=Object.getOwnPropertySymbols,XE=ZE?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,i=null==t?0:t.length,n=0,o=[];++r<i;){var s=t[r];e(s,r,t)&&(o[n++]=s)}return o}(ZE(t),(function(e){return YE.call(t,e)})))}:function(){return[]},QE=XE;function JE(t){return function(t,e,r){var i=e(t);return iS(t)?i:HE(i,r(t))}(t,vE,QE)}var $E=jS(zM,"DataView"),tk=jS(zM,"Promise"),ek=jS(zM,"Set"),rk="[object Map]",ik="[object Promise]",nk="[object Set]",ok="[object WeakMap]",sk="[object DataView]",ak=RS($E),hk=RS(RE),uk=RS(tk),fk=RS(ek),lk=RS(US),ck=JM;($E&&ck(new $E(new ArrayBuffer(1)))!=sk||RE&&ck(new RE)!=rk||tk&&ck(tk.resolve())!=ik||ek&&ck(new ek)!=nk||US&&ck(new US)!=ok)&&(ck=function(t){var e=JM(t),r="[object Object]"==e?t.constructor:void 0,i=r?RS(r):"";if(i)switch(i){case ak:return sk;case hk:return rk;case uk:return ik;case fk:return nk;case lk:return ok}return e});var dk=ck,pk=zM.Uint8Array;function mk(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new PE;++e<r;)this.add(t[e])}function gk(t,e){for(var r=-1,i=null==t?0:t.length;++r<i;)if(e(t[r],r,t))return!0;return!1}function yk(t,e){return t.has(e)}mk.prototype.add=mk.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},mk.prototype.has=function(t){return this.__data__.has(t)};var bk=1,vk=2;function wk(t,e,r,i,n,o){var s=r&bk,a=t.length,h=e.length;if(a!=h&&!(s&&h>a))return!1;var u=o.get(t),f=o.get(e);if(u&&f)return u==e&&f==t;var l=-1,c=!0,d=r&vk?new mk:void 0;for(o.set(t,e),o.set(e,t);++l<a;){var p=t[l],m=e[l];if(i)var g=s?i(m,p,l,e,t,o):i(p,m,l,t,e,o);if(void 0!==g){if(g)continue;c=!1;break}if(d){if(!gk(e,(function(t,e){if(!yk(d,e)&&(p===t||n(p,t,r,i,o)))return d.push(e)}))){c=!1;break}}else if(p!==m&&!n(p,m,r,i,o)){c=!1;break}}return o.delete(t),o.delete(e),c}function _k(t){var e=-1,r=Array(t.size);return t.forEach((function(t,i){r[++e]=[i,t]})),r}function Mk(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var Sk=1,Ek=2,kk="[object Boolean]",Ak="[object Date]",Ok="[object Error]",Tk="[object Map]",Ik="[object Number]",Rk="[object RegExp]",Ck="[object Set]",Pk="[object String]",xk="[object Symbol]",Nk="[object ArrayBuffer]",Bk="[object DataView]",Lk=HM?HM.prototype:void 0,Dk=Lk?Lk.valueOf:void 0;var jk=1,Uk=Object.prototype.hasOwnProperty;var qk=1,Fk="[object Arguments]",zk="[object Array]",Hk="[object Object]",Kk=Object.prototype.hasOwnProperty;function Vk(t,e,r,i,n,o){var s=iS(t),a=iS(e),h=s?zk:dk(t),u=a?zk:dk(e),f=(h=h==Fk?Hk:h)==Hk,l=(u=u==Fk?Hk:u)==Hk,c=h==u;if(c&&iE(t)){if(!iE(e))return!1;s=!0,f=!1}if(c&&!f)return o||(o=new WE),s||cE(t)?wk(t,e,r,i,n,o):function(t,e,r,i,n,o,s){switch(r){case Bk:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Nk:return!(t.byteLength!=e.byteLength||!o(new pk(t),new pk(e)));case kk:case Ak:case Ik:return HS(+t,+e);case Ok:return t.name==e.name&&t.message==e.message;case Rk:case Pk:return t==e+"";case Tk:var a=_k;case Ck:var h=i&Sk;if(a||(a=Mk),t.size!=e.size&&!h)return!1;var u=s.get(t);if(u)return u==e;i|=Ek,s.set(t,e);var f=wk(a(t),a(e),i,n,o,s);return s.delete(t),f;case xk:if(Dk)return Dk.call(t)==Dk.call(e)}return!1}(t,e,h,r,i,n,o);if(!(r&qk)){var d=f&&Kk.call(t,"__wrapped__"),p=l&&Kk.call(e,"__wrapped__");if(d||p){var m=d?t.value():t,g=p?e.value():e;return o||(o=new WE),n(m,g,r,i,o)}}return!!c&&(o||(o=new WE),function(t,e,r,i,n,o){var s=r&jk,a=JE(t),h=a.length;if(h!=JE(e).length&&!s)return!1;for(var u=h;u--;){var f=a[u];if(!(s?f in e:Uk.call(e,f)))return!1}var l=o.get(t),c=o.get(e);if(l&&c)return l==e&&c==t;var d=!0;o.set(t,e),o.set(e,t);for(var p=s;++u<h;){var m=t[f=a[u]],g=e[f];if(i)var y=s?i(g,m,f,e,t,o):i(m,g,f,t,e,o);if(!(void 0===y?m===g||n(m,g,r,i,o):y)){d=!1;break}p||(p="constructor"==f)}if(d&&!p){var b=t.constructor,v=e.constructor;b==v||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v||(d=!1)}return o.delete(t),o.delete(e),d}(t,e,r,i,n,o))}function Gk(t,e,r,i,n){return t===e||(null==t||null==e||!$M(t)&&!$M(e)?t!=t&&e!=e:Vk(t,e,r,i,Gk,n))}var Wk=1,Yk=2;function Zk(t){return t==t&&!lS(t)}function Xk(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}function Qk(t){var e=function(t){for(var e=vE(t),r=e.length;r--;){var i=e[r],n=t[i];e[r]=[i,n,Zk(n)]}return e}(t);return 1==e.length&&e[0][2]?Xk(e[0][0],e[0][1]):function(r){return r===t||function(t,e,r,i){var n=r.length,o=n,s=!i;if(null==t)return!o;for(t=Object(t);n--;){var a=r[n];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++n<o;){var h=(a=r[n])[0],u=t[h],f=a[1];if(s&&a[2]){if(void 0===u&&!(h in t))return!1}else{var l=new WE;if(i)var c=i(u,f,h,t,e,l);if(!(void 0===c?Gk(f,u,Wk|Yk,i,l):c))return!1}}return!0}(r,t,e)}}function Jk(t,e){return null!=t&&e in Object(t)}function $k(t,e){return null!=t&&function(t,e,r){for(var i=-1,n=(e=UE(e,t)).length,o=!1;++i<n;){var s=FE(e[i]);if(!(o=null!=t&&r(t,s)))break;t=t[s]}return o||++i!=n?o:!!(n=null==t?0:t.length)&&VS(n)&&zS(s,n)&&(iS(t)||$S(t))}(t,e,Jk)}var tA=1,eA=2;function rA(t,e){return ME(t)&&Zk(e)?Xk(FE(t),e):function(r){var i=function(t,e,r){var i=null==t?void 0:zE(t,e);return void 0===i?r:i}(r,t);return void 0===i&&i===e?$k(r,t):Gk(e,i,tA|eA)}}function iA(t){return ME(t)?function(t){return function(e){return null==e?void 0:e[t]}}(FE(t)):function(t){return function(e){return zE(e,t)}}(t)}var nA,oA=function(t,e,r){for(var i=-1,n=Object(t),o=r(t),s=o.length;s--;){var a=o[nA?s:++i];if(!1===e(n[a],a,n))break}return t},sA=oA;var aA=function(t,e){return function(r,i){if(null==r)return r;if(!GS(r))return t(r,i);for(var n=r.length,o=e?n:-1,s=Object(r);(e?o--:++o<n)&&!1!==i(s[o],o,s););return r}}((function(t,e){return t&&sA(t,e,vE)})),hA=aA;function uA(t,e){var r=-1,i=GS(t)?Array(t.length):[];return hA(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}function fA(t,e){return(iS(t)?rS:uA)(t,function(t){return"function"==typeof t?t:null==t?wS:"object"==typeof t?iS(t)?rA(t[0],t[1]):Qk(t):iA(t)}(e))}function lA(t,e,r){return r=void 0===r?1:function(t){var e=vS(t),r=e%1;return e==e?r?e-r:e:0}(r),GE(fA(t,e),r)}const cA="/SceneMetadata.json",dA="/db/sign",pA="/db/tree_models.json",mA="/db/pois.json",gA="/db/data_source.json",yA="/db/topology_paths.json",bA="/db/properties.json",vA="/db/animations.json",wA="/db/model_visions.json",_A="properties",MA="poiRenderer";var SA,EA,kA;!function(t){t.PANEL="PANEL",t.VIDEO="VIDEO",t.VIDEO_STREAM="VIDEO_STREAM"}(SA||(SA={})),function(t){t[t.BIDIRECTION=0]="BIDIRECTION",t[t.POSITIVE=1]="POSITIVE",t[t.OPPOSITE=2]="OPPOSITE",t[t.FORBID=3]="FORBID"}(EA||(EA={})),function(t){t.BFS="BFS",t.DFS="DFS"}(kA||(kA={}));var AA={verifyKey:"",debugKey:"NJHgNB1HDTrHTJc4ERFCBRVBB5HOBEDCjRLChRDIdn8K7EUJD,Vm4C6vC8BpZ6n6G,hxOjYZ{,wYhnJize2rlm9m,6bUcRVbP6sjNbKU8juOWUpukkcV6Cw,Bk2io7{YWJcPnG{1o3GUTpnO:z{kCYHL14HjO8noH1sp[J78k3Y3IcbOSSk97evccx0MdW2uR0f5qhZFQV8e2JCRxxJEBRBC",key:""};const OA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO0AAAC9CAYAAABfw/p4AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAA7aADAAQAAAABAAAAvQAAAABwZIxcAAAzEUlEQVR4Ae2dd5tUVdb27abJGZogNthNThIkCIZRHwOvDoKogHr5PtfM+898jfkm/jOiCIKigzAYUBGQICBRcpbYhKbJ0O/vPlOnPFV1UuXq7nWuq+qEnda+z773WjueRx6xwxAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAqMQFWB47PoDIE2gcD3339fc/78+Ulk5sG77767q5IyVVNJwpgshkAlIPDZZ58Nv3z58lM1NTU9WlpabvLbXVVV9bASZJMMRtpKeRMmR9kRWLJkSW2HDh1mQ9LBrjCQtduXX375OPfH3Gfu+dNPPx2waNGii+59qc5G2lIhbelULAKQryvknP7w4cOxkDZDztu3b4/nYZK0+O/B/czq6uoRaOWv3n777T8yAhXxgZG2iOBa1JWPwMcff1yPlC9A2o5+hFUOIOeQlStX9uG40djYOOn+/ftT8OuwG6KL0CUlbbWEssMQaK8IdOrU6Q6k7BiV/3v37j1z8eLFRZjO01zCJsI0YD53iwpfSHcjbSHRtLhaHQIJ07YxSnBpW37d0/2hoavu3r07Nv15Me+NtMVE1+KuKARoi/b2Ewhzd5/f87jPMJHHoYFLxqWSJRQXAPNnCBQDAQg7BU05xy/ukSNHHub5XT+3qGeQtQXSHl+/fn3JuGSTK6Leirm3egRWrFgxEWLNVkY4r2aY5kx6pvAzG7eJ6c8j7s8QZjPxRZrXEfFk5Wy9x1nBZZ5bGwLLly8f6xI2Ibt6e1NI+9VXX/W9detWf5qnsbJHfNfpjNpMe/hErAAF9hRPygInatEZAqVAAMKOevDgwQuJ0RknSZmzXbp0WfLGG2/cXL16defm5uZpOIxXh1IcmRS+trb2Xy+++OLtOP6L4SeWoMVI2OI0BIqJAG3YBnj4UgAZd6Atb+I2nV/nbOUg7M+YxBmdV6TZdfjw4fenT59+L9s4s/FfssZzNkKZX0MgLgK0RQcyK0nTDJMH5BkWQlj5m0qn1DO5EFaB0dwysZMHyrf6888/f4IHi48ePToq6VCkC2vTFglYi7a4CGhCA9MLZ6L1RvHb7KYGYR+DkC9zXzQrEpL2/eKLL4bMnz//LGQdSqWhTq7epPsIFYEInaGFXfkKcS5axgohnMVhCKQjACk7dOzY8QnGVqdCEEfpcL2B5XP7cRvMs9fc5+lh49zTBn6QNuPJNxgVxVkcHkDUoekeSL+o85HNPE5H3O4rFgFI2QAhFsKrGV5isoTuPutfuyD4//E+zzYjaNCjhP+U8+mosJBVM6QyCKtwEDrFfI6KK1t3I222iJn/kiMAWfstW7ZsLiR5GVL1TBcAktxXby5uzeluce4h6WXi+HLhwoXf0sF0g/u9ccKF+CnqfGRr04Ygb07lRUDak0n66uEdyy+wKcek//uSFA28H63rTKKIKzmm9abFixfvJfoWNwzkPcVwURPPMioI10/E+SImdtG4ZZo2An1zLg8CdPT0hLDz0a7jwggr6SCrQ1r8HuT6QTYSy7T2ElZhdc8v684kNPRNgq9/5513Vr3++uvXs5EjG79G2mzQMr8lQ4Ce2SY03jLIk1x8HpS4S1pM27uQUPOIYx+YxePSPW/btq0jFUDGip50f557VRQ7GhoaPoWwh9IrAY+/glwaaQsCo0VSDAQo/A8hZOREhW7dujmaVjJgKjsaUgqX360ouSBnLW3mAfKHpqzSLKpjx44tgsyx5yHjdzVk3VbsSRVuXoy0LhJ2rkgEaBtGLlB3Na0ywPTES5DvAuHWc94eJ1P4HadJGhB2Hv61i0W3OOFcPxC/zr32nqkMuvLT1jQFPYy0BYXTIis0AhAyskPnzp07SU2r9Lt3775GZqqW3EHASE2NphzNbz5+B+Yo/1gqiCSXdE0FoO1XF1MhTM4xzsBgyYQCfZiDIVBGBCBSJGk139crIp1Ad3QvcxXSH/a6+V2TRmDPtJ9/n2ddmRnVoOeaUsnw1EIun0IDy0oYhbbtJLdCHUbaQiFp8RQFgTiknTZtWgpp0wTJuhc4LbzaxumPMu4ZOpoMWV9Dy74KWXu5HrjvSDt7pHtfiLORthAoWhxFQwCzNVTT4v4QYifHWCWIen9pozq9wlqgDnEu5CjgNXqj1/D7PSo8Mmg9bp2fP0hf0BlSRlo/lO1ZwRFQOy+XSKM0LfEmtSzXVZB19JEjRxZDlORQDnFkq201dKRF7svffPPNU26PdC7yKwxy9cVsfjTX8OnhQmuxdM92bwhki4Dac3TGPEnHTF/Cfp1t+CjSYoo6pGUyxiDM06e511cCRJQmN63+/fsfu3Tp0mziilw7i5/D/fr12+Rd5K4eaeK+gFtOHVUYA1eQJVm5uHLles6p9ss1MQvXfhCQ1vvkk0+k7RZz/QQFvg4C++6GGIYK4UIVi6xjtNiL7Es8T4T1xJVsiELA+7gd9LgFXorsXsK6HpEjW22tikMdYhv37du3AjO9YJ8PCQXEFdjOhkA2CMgU5Pc0JmY/bziNh3KfXPvqdQu6hpQ1ECbIWQvSu0KOkT4ekqSVG6Q9gMmsheqhB340fPMraSY/uKU28okTJ/rzPDSs64g/edzH0NN2tyfbdSvE2UhbCBQtDgcBzRemF/Upyqwz/JEOCwQczSKAbdJ86W5+92jmDpAnmLF+gRLPkCEljQULFlwlvrOQd0hIMKcSoF1cj5+jxFG1dOnSUbSRZ6pyCAvndcPvj2+99VYsze4NF/faSBsXKfMXiIA00fHjxydjompCQeYXrBIh4V9nvvk6nNtYBbpHjx41N2/eDEw3wiFF08ovG7rt42sAoaSVPyqeCVRAzVgLs7EWnCmOeh73QFsPxW9GHlUJ8bwHpvK1uHH5+bM2rR8q9iwWAtJE7lxdAkzlF0hYN8KEiezehp7xm49SySAtHUonIFTkfGTSHaw2MsJlTVhlCFzqIWiKZua+gUprIb/nQjMdw9FIGwMk85KJQK5zdSm0AwnbPzPGzCfXrl3LmbQQL8U8Vuyk/ZDnBzJTKuwTTPBqNQUUK2Ttx++vPHIW8CPDo3qWT4o5g5JPoha29SLg3VCNAphTRtB2mmzwU4zAN/AjzZiitWKEk5cMTauHkOkAmnAq5NVt0Q7iHwc5e4KR3wJ+5X9Drombps0VuXYWjgLYgW+0TmEHxMUUxHy3CR1JfJHzcWn7PSCtyNlIfq8C89aXtMR5A0Kd9AsT9QzCNxP2O9q8O6P8IndPtKvvAn7iiJX/oDSMtEHI2PMkAhCsgUKYsaFa0kOWF8RVE3c+Llp5P5ox3lhLqhy+pJUXyLc/1Wv4HTJoh8ZfBwwY8Cm90EcgY64yOQmRnbzmIxtpw99Xu3aFrKEbqqWDAxlO8dua/tzvnl7cWPNxpRkVrxsH1zqOu/dBZ3p9M9q0rl/tAcW1TO/Ig7ROUcmIrNvdoSrJBPFORAYO8KBKCG2dc9PUSBsAbHt+rA3VIOyzFNa3+MWZM+tMrKcwr4EQv6GYInto0VZ9SWNwHJw7d+7szkaSWbscrbcnRrgMTUu+akizB3mS5o7VIYXfZpE0Pb2uXbu6MqU7hd6rEqBCWc56399CPYY4GmlDwGlvTiiAanp2J164cGFxUHssDZO7FMLkxHq5Uciz6aGNpW3ZL+o0G5T/m4K+FgJpjDOyPYyfFNIy5jr88uXLCyH8LMlJRfC7NJ6uI46M9ifBqlh4n+1OjcmKTRM9ItIMdc5ZRYfGao6tDgF93oIx11mQrg8FO5b8EGkNhDqf7hkiHyCeKfyiupcbpNX95vp64yQakeus+wxNro3X3Nugs0PaJUuW1NJ+ng3RHK2ObN3VA66v5rEI4BiBhwdFoOekXQMeGr5xtLusA3B6muexhq1I7x7pbwcnbdOanBoZlmaUm5E2CqE27k4h1DdoZtHG0kerssot2kYFPoO0MichxEncHg+LkHSrr1y5MgY/u8L8pbtBhEjSyg8yPMd5rDc8eZSWVJo7INN+eplDSauwxDGeGVInaIfPJHikf4WhYnHmO3O5jeV9kc0FhYl7GGnjItUG/UFYEfVVspYdWxNYoL00l3ir20HjhQg+7sM9lLTyT+Eeh7/fkEPaNNZBmzByszfSf0aRBVgNWhSwkzTPojVlbketPuoNYTXUFQsnSH6eHSI3aklfVIZ4B87SRaI+ynzlC1H+5V4dx5P5aZsI0JkSWajCcg4hOrGh+Ag/PxTAMxTeyA27Kaw90WJ1fnGEPIvTpg0J/kgPN01kjDX8E4ewxOWM42JprIoiLJVGytJF7lMsgjDhjbRh6LRxN7Xr0EjH88ymb2cShbyFuGMRAnPVN44guSBHpKYNCqvn3t5tFiVoYn9Kp1VYWD834lP4He44rp8f7zMtXUTDL8BiUL43aLIGHWO70bqxZn4Zab1ottFrCkM/CskczhkT4ClvfsS6CDGOx4EDYiY3+073j0mZ7DxKd/PeE8dQZIu9PzAaPifSkid1BMkU/1TbyEgGrXdFyx31ypPNtcIqPm1W7tdM8MYl7ap7zs8RRntKbYPopyDsw+bm5gU4xaq8rE3rRbWNXX/44YddaFtNo3CMI2sqMAMhx6rEsImTW67PuO06CtNNSLyVD1Idoje5N9f1jqeIP0ik+JM7M2g8FLN5MvFNjgjqOCOfDpmH2+L4l6bFfxyvST/k5WTPnj03+X1jJ9EhNSrpOcYFebtMZbMJsv4R5V14MNw0hY6xvvhdh/z7CTsLmZ4Ep2e4bgJDrR0e889//nMHv9BeZtO0UYi3QndeujbLnoDpt4iyMF6MUDYoHF24fE1DHt5sUYj28HxnA9+i4ePMB7lu0Vgiz2NpSsy7katXr3b2X2KLmREUxEWk9aQKojedsGsKcMqG32F+cbsb4Z50Ji9X0GSrqYjW+hFWHjVsJRImA4Vc4O8OedsAWVey8VskYakkRzY2Ni4i3BTC1YNTL5nk5FcfpJbFsIF4vgLr6/jpPnXq1AxrKF2c7Kqr9NB2X3EIQMjHMEs1Lqla3ffA7TK/r9CyoYWfAtdAwXrZN5K0h5BjH+WwP/4HpTnFviWObynAkaaqlgVSyOeHRUz+7hDf9j179uz301zkrROyTiA99SK3EOc44nw2KE7iU+927C1kiH8A8Wo8tzNt101UbEMIP4n73aS5GffHmD32B+kOIt3ZuPXGbSfy7vKT1yuXaVovGq34WoUQ8+tVOnVep3wFElZZpHBoYsArhAnVhBSqE8QVa+sI/I3Ph7CSC9LLzI48NDRCer6akectxLPvxo0bamfuTScAzsleWxKaDmmGKcFhw4YFfkKEMKfpaf8MPDZG7fkkU1hpEKUmlwyErMfUfubaaT5A0O5Kj7bsZayhl/Grj2Vf6dWrl+SNNI0V1jStUGgjByR8lgIQq+AryxSgH9G2v4dln+V40yDBk2F+CumGRb0szjQ/P81IfmTObyJPjX4ySbuBj6YxJhehi5CQ8Wv5J85niSOJH9fXkUfTNE/4xed9lqgAtXGcfkshay/ayguIX+b0Kc4jeX6O7VzXuTPAqGSfxs8Rv1ll3rjTr4206Yi04nsKRhUF4WUKSX1YNiiMl2jnbYxTWNauXdv9+vXr76Epci4rIgY/DQENDZNLbvjZgybd5Pr7+OOP62lnnyD5lMkX2peKT1J+wHNptiZIsvm999477obzniGUTM+n+PlO9qCzbqnau5C2P9hokcQ9fjuIcw8VQORwkGTEBJ5F2Gamdm5EfscKIF1t6zpI8vHrwnVHzjoOId+GOHF78+Fe5/wi3AjsXFkIqManULyOhnDm2nqlQ2PeolBtQZOlfPiYMNpsLGMlixsW91cocPXufRbnaxTkzcR9EkJEtkMVLzLeHThw4EdUFP1pm2su9EAIscYdovGmjXmpj1zdDiIXcjuzjYhzAv4Cm4Kk4bQzFTdhpmAKH9QYtjctv2t1+D3xxBP/A94N/PbKfGbSxhCmRg7F1P1FixR4/hLxX2ED9M/poFOl1ZsPhu3N51u2Rlq/t9HKn6mwUkbfIBuOGQhxNISwm8Kyw1tYMH37UODVCdKPQvYxhUv+Mg5pEsj+SoZDwAOSu0f6v2JWqlc6GSdWgLRY5ER7Cvplrz9Id1K9vwHJZTwWmcaPH68hpGnI0SXDQ9oD0rtTW1u7JGqc1Q2moTSGj0TMQ/SWT6RSEYaN5FszwAaT5lbctK2NVk29y7k7FdDK999/P68ZaG76Nk7rItGGzmi2u/Qif02n1HwK0iWGGH7xDndoeIZtY56EsBMgh1NxQyiZjse8MKjwT5kyZSyaY7r3edg16T3s3bv3sjlz5jSn+yMprUF9Lv15+r2XsHKDBM7kizBrwI1Dvee3bt2aTZjQzjjXP+JKzi1xCCsSoj01V3oav06kdQaL5lBTU5P2RVYFKVIuhbB30bjqRb+Iv62kcbNQhCVO64gSCG31UE+mtzCKhJMmTRqD5poBMZxxVTfvFKyzkOLf7j3a+jGuYxd+N5zOxO07dJOYdPEBhMp6RhMVzE7atoG7YshqIF9PkfwwryxB15BJnwrZhdn6mxejIP+QtQ6M9D2ge5yvE3YE19uxJn4Fq+e5H839bmTQEj6tBqpDA6+K06kWlGbQ80A7PyiAPW89CHgLo9paEydOXECB044UKYRVjih0Q1TwdU0B/Qv3r/OLpa0UxnuQhu90PMlD2prrm/UBAcZAtIzyCmE68JsNqd8h0riEPaQhFhHOi5GfUEqT+NVufQ33M4T5gvMWyKned2ndaiwZZxcL3eP2Dnm8zSdBlhaDsJIxAwQ9tKPtIPCvf/2rF4XuFUzcv5Kr5FCHXw4pgM5wB2S97ece9xmF9lG3AkgPQyfP/vRnMe+78omOhnS/dP7o+7SP84vsn4FUWjL3OWHW+5nv6XHrnmjVJneGkMCnL/ctMtPB6DTX3TCRH6fpobnal7hX/F+oQypqPNcvrbjPjLRxkWpl/jQkgsacwacw3qGA1ccRH2JrfWwNw0EH4vgP84Pm89W2c+fOvULhj5z+5xP3RbTXtfTnIhFaOEreG8jzHWRbJYKlx+G9R7Yq/bzPmAih+DXtcAgVoLP2ljSdyocOptEJv2toy65W/rxhi3FtpC0GqhUQJ195G0rhm4IoobOevKLSmdKJoZYR6rRCc2TMO05ok1iFkrSdCsAbv3tN4XfMSfc+7Ew8GnpZL7OUDqbOGktN9w+BDuIvZRxXfnikHRm3MaFhGe3hI+nh0u8h5GA65N7kp6GZ5IEJfZu8O+GRfSz+ulLBPc6ze3g6Ko9UCLeSAYp8YaQtMsDlip4B/uOknXVBcte2QuCkGUv77RYF9EfMvs/RbL/FyROFuyMrWzQLKOOQbIozwyH1gTYqdxYxYHKeh0iaNPI6ZNFHvlIOv3XByHsQK0M9uTui2q0ioSJkWGsYadTyc5oJ3kSoGNTB5LRjcddCDFUSil8TJUp6GGlLCndqYmgNfTpiHsvgNPWtoAcFXm290CmKfgmq0DIkNEDEouA389tFPJ+iSX7n3NK3b199AvKOX9j0Z/jzNZElG4U+0KQlzeMQaBnE3nXq1KmpzCNeiFz1ip9wzmZw6Wnh161kzhH+c+T9IWqCBNirE0vDN+999dVXffv06aMKiageDKPjrqc3DczrJu7P8Wuk+fBvNL+mgEZVPN4oCnZtpC0YlNlFRGEZQ+HSXOFBFIhZ3Mfq+cwmFbX1KIDZBHH8QhIt53uonRgomFv4JVcDSWsRZ6weYOLonxivzJCBvGvyQbpJ2whZ/41G/4YAQ6TRSGsyZ2857YAGd9uRyXgJc5Y416L5vkTe0HarAomk+NOXA7rz64DpPU5mMDIf5lafu9TkDMcfM680w+wZyPotYSK3klG4Yh5eMIqZjsXtQYAOoke5TVkGRrmcRRku6PtgbnEThVC7/t8mvVhmrcREjhGagBFkViKrq9XkPfSgoybD1FQACv8NTid1TXrOGlW01wrI0gJJFmAG/wUnx2yVH+9BfjTUktJZRD7Vq+vE5/Wbfk3l2JX434Ckb6jTjUrBNXtH6Z549ioM8Y/BJH+a7+Nqgsp5xnN/itLc6WkV676ghaRYQraleLUImkKgubzp2PeGzBMLnVc012biVNvrFwqiM5E9Kg1pHk+vaIZ3yHGNuE5nOPg8gATDIYPvVELanHuBYY/GNEnyNM2Fl4h3LmEyOpu8UROmF341+SP2IULKM7Krfa6mQ2e2bx3OvaYfniX9TmjwhsRkf5nBXZFFci/HT/KTIIqj3Ed6wSm3PG06fWr5TuwFNEcFJiCjU6UJAtxyeqwBfgqdY96iVWJrSDRehjbzCgBx4vYAd+Dr72O8Yd1rNNcZ1rFuo8d6Epp1ISTJGId1/aadpaVj2f3EqV08Jl26dOl9xlSdHTsgqdOeJo8TFC+4ONqVy7G6p6Jbjx+1izVMpLQq6jDSluh1aAohhz4s7Mw6Cki2E+7TA9zyfjxy5MjDFEYNU8Q5etPuGxLkcffu3TK7m4Pcvc/RYhkVAGRKfkWetnesoSnCwLP72zWEgykdOdarCR7giZgPNSmiMz3jTuXBe1An223OTqeblv4h7w3I21sVq5oVkDWyXezNYymvjbQlQpslXFoJEmnSUZjGYvqFmoe5iqwVPhTeWJ1ISoN2n2/vr9yohB5S6GNpbtLsSfuwVuF0qHOKpoC2i3kBN0f7OQ4hfxDqsKYeQrDIqYfqZFLnESb+W2qbE61rFWgfqioIqYkSDg5YPlo00YJ2/Y6zOt4cqyRElLI72SqfErwCCtAECksgAbwioJUewVR8mmdfep8X6lrTCFnh45iFUXFSiB/XIvigKX/0pv5OXNrtMaVTyBsv+dZ+VBuludBiPcjfDPLnO37rDee5vgjBNtImv+B55nspgkLCaXQejSbMTdLqwPUY0v6NtC/xrJYKcRjynGSY7Q4VgeJxJp/E2RDAN9EyPDRNW2TQ9WErCom0bOyDsjYYTTQ8doAsPGqaHYVVHS2Rh8hIoXfaeX6eE72pKcv5PP40hvkTZFvJ0NElSKPxUO1KGIuw+LuJKfyDZkLRORRKWPxWgfN4CLuY616kuxzRf5EsnPvLnUtH23I9Fa3/JhbNSNy+ZqjoW/lrTYeRtohvS2YaJpp2LgjUREHJU7iecns8g/zk+py4XXMxMgqIE7q1KdorJS7I8JAwuzlpo7IDECSrLVUVnmNXg2c71yghgbcFnLWlTGcqPE38GMzvGX4PyOtIzPE6Ko4jXGtj8l7IfJCKYAUVwumouCvR3UhbpLeiYQ7ahHMoIFmvHU2I1INe14wpe4UQl10gpB2lCSMPiOCsZAnyqA4h/LjzkU/ibzntzs0sV+sNYeeT/xf5dQ8K730OWY9DvmWYs1u8O2x4/YRc74aQOkaS3pNYE/rcxib5J86xGnOmw2uVu0sjMmv1Tqs8jLRFeG2Ygh3YD+hVCkbKVLhsk0JrTFabMttwUf5VYCnQv0f5c91pt4a2xyHIduL8Gs26ll0r7kPWFzCr3+TZQDeOiLMzEwqyrvvggw+uh/nV6iXwnZk+04qwNyCseoF1HOBeFYjTaIWsTgWl4a+///3vmmjSqg8jbRFeH4X1OWr7QflGTTw1aIaZ+cbjFx759ic6YvycU57hN7lAPsUhcQNBjjFj6BwdblMZc12E3KP8/KU/g2R30K4/s0H3SjqCMlYVpfvX/dGjR7WZ22QqnYyKhEpuj/wQ50TW3r7B/ZN0eq3DFN6g523lyLqtVeyMU4t2pVdyGGD35LyvUqaOxc038uvzDzPi+o/jj+GIVcXo3YRkc0g/1pxn8pSytalXbnWaQcCneNbD+zzoGr+acxx7t35pVUjaHVP8KPj2oFLQZmkttFM/0nxhbzrk6W3ce1Ih7eT5biqUWJMwvHFU+nVNuQQE8+qvv/56CGbUYwA8kELRi2faG7YawjpiMRg+iW78j4q5C0Ah80+B0mc0CkpYyQce+szHFxTG9An2eYmP2bgPMsQiLdor4wPSzDCq5R1JNnX8xDrwe5p0N8XZikVNA1ka5H8k6T8kvetU4uqJPgHO9e5X5ImzGmJPUGcUFdwG3JpaW2UfC7yEp5Jo2o8++qgvWlNDH4MpeH04d+cd1GC+RMrKCziFebMm0mOZPagAUwHNI0+hmSLvLWBwlorqmrAgf0PiiI6/H8DBmRAQx38cPxIFzaQvnMdqe0OIH9H4v2s6IASZDuHHRGTXK0ZyD2Tvw6BriCkctetGR8rKz8j4Evdqt64gTQ3jzOXXxG8jfrTYQj3DznhwUJxt5XlBSbt3795Ohw8f1uD1o7zU2kRh0NS8vNLhpaygwMaa7F6OF5PYhV8dL93C0qfw3aby+o/X1MW0rAOvVwkXSnZIfmvEiBFLc+hVDRNJn8KYjFyx2s3IeRk5jvA+popMoREnHInbdw/koLAiq2vS0qH1KuHruP8QnDTVcTr3x7lfJzOY+35g3oxMWj54OCjOtvY8J/OYl1fFy5ZJVAdg6iHsza8rHQrVbs3LS42NFXFolwING2gDrUbCaurZVDcCnF/h+hP3vpLOGktVTzEyhxIWmR9gFq6FsBcocBrc11RF7e63hntNBNAsqMADXLvSCSNMtgR6ysGBRe2/I/905I98Ybyj/uQh1hRL3pl2eDyASNvoVY4cXlqyZEkteZyNNleH1HZlhfSu8exxJk48TpmTMtDUyXrw0tfnNpLGINq1e4KWECqOtnhEasANGzb0PHfunAATSftx7s6vo0vObEEhbBNhGgHd+fESGvnkg0zFlPYaNW76pyjW8/IPZZteMf2Tl1jfzpEMkPR7aQPytYA8O/NwVbBZnvbLjh079rAj/ls87xsmL3E8xIJZFjUsEhaHnxta7EXyMtLPLcdn55BzUzYbdKMEnM+GgMktcFpCeXgIVmPAROtq75L1XzlrfHkBZe80ltf69DKTo6ytLlhS0/LSqjFH6sjBMMBQm6EX584Q1iE2107m3HNUTgmvmSmO5iSMtGcjy7CuxDXveOm/UKCHEodjNhLfs7zEo7zQiukNpKBJQ9VHYUEh+5UK5zDDENpPODlxXhUf+ZzJ5HvNjdVEgNfD4iJsNV9ZUy/tujB/2bpBFH2ZvBCk1a6HW+Jsoqbylug80neENkFCWSAXwWRAYqvUIzQlrqpTEsJuxc8+5QuclmKd3M02j23Jv7NdJGDNg1gyc7M+VPvzwq/y4ht5EY0QrZFJ6Y1Bk8yzSYDvpMzAHFNbxjmIfy9zRTe69+U8g5nGIl+IkgGZj0LY7yiIY8lLym4VnrAn8bOWApluXXi8/HmJCflvzOxY45p/hgq/Ij9OGzHcl78r716m/864u/WTT1XEGh56B3xa+C6OM0KADJrn/By/c+DxpRYA0Ln3vxSxXZC2oM0C0mi1Rw2FaTiAxyXsDXKqlf5XKDiXqQWvQKKrEL4oU8JY/7mTzxmOJn6nvUi6E3jhO3iBkW2kYr4RZBiMLNKaUclc5MNOPzC0pU65IMJqEfawjRs3dr169eovDHEMI97QiBlmeRrtvELL46IEiOtOfqRtNV83q4NwR8jbFrSfykboofWtaGJ9auQ8/n/FsjvO9XDyPJqAu+vr64+w9at6ggeDcT+G+hox3dW+3RMacTtzrBGAFBrtcpeSdYBzv7btmLg4NkKWkpolMqWpfVXDviDhEjK+zOWXui/HgUnXE9L4bReTIg6FuRmL4z908lRTqOen4+v1LLczZ87MpwL8hMK6G7fJXvf0a95Z38RX4RyTMd09l3tkPU6+YpOW/MX+xq00JsTUB7/GgsVuaWTJSD72Uc6Gcx7H7e5p06bdp5I+jx810x7j1yhyc7bDg4DTUKWgpJtljnni8Ve2S15qFbXtfAQY4AqBli/KDCE3/qAzOOl7p/OQKbTDCPf7+FulYSrC/I1CGWt4BItnTV1d3bkjR44sJnzotjOkcUd7KxVq4glydkDO/xeUd/c5FfwtSLWVCuYg55TOQ9ePe9a7Q7uOhazTudbEmRaaT0u8Ex94tzKRhaf2sGogzs7gsMnve7RuvO397JphPwBY8gXwYvpplUolgKOCwctOaccygV1DQCU9MEWlMbXxWChhZbUg73ciLFbCIq5jEVaZobnxsqwLKqXI9psKtxZ8FwoErCgtY0uWgfR40azaq3gX6Wp3B2cP5HQ/3ntNPaRZ0IlgIwn3DeFkRlehzcd4/ZHk/sT9VPwdQbMuN8J6Ecq8dkgrsxc8nbExeQG8Thq7y/RenifqWeTlHnJTRz5tgxlr9wU3TL7nCRMm6KvkMttCD2T7hYJ3Ag0iM17j17EP4q8h3Aym+B2S+Rkj4Hit2Y3hL64X3+YP2J9gqd0y5ErZA9kvUjUflHcqoHksTRygDiXw+ANcHHKSr3GqAN2w7Pf0OxXbJs5Lec8pH6F2/dg5FYEkeAC7k5ejYRrnoADpmyX93Ptyn9kfaCvy3Xfl4OXPKtYicTcN9wwO2rw7spJApoMU0t/o9Z6MrA1u+GzOxOG0ZxnuSLEu/OJApiqIMcvPLcdnKaRFliv8VmMK/0ff9wmLU0vm1NuPJn2bMI6VhlmcxEzEVXwQtDv7ZWkozzk0MUJkTZ/477rbOROBJGl5/9rc6nvXiwoE17Pd+3KfNYSESFq54Ry8/GqsgdgdJ264bM/Ms32MdJ+OCgdJ/6Bw/4SmGUKbbGaU/yB34Y4V8VdNdeTycJA/9zl+6iSje5/PmbjuKXyi8t64b9++FVhhZ6LiRLPW0YGkpsAoytDn9JivoZmgCmCY5im74XF3tC1kHu4+s3P2CCRJq6BqS/DCknN8AVmf9stJY2QvSnQITCjtTtDk+uR6tMwx977QZw1RoDm07anTYRcUPxrkOr2j32CqdmGyxOtB/uI+J7lH9V1ZTNIt5DFpXQSFR8ZHg9yyeU5amnS/Vx1cWAx7o4aUNIuJ8tEVgmrzti7I3Q2z+D6V6Qily/1x8pDU3uAks38rz3/MRi7zm4pACmnlxIybdepMcQ8AfooXkzoe5DqW+CxTisLhbNilpGkn6ZsrajsW5aCATSXiThGR30W7rP3b3/52hw4yrZgJJXhEXElnhmDmyrrgXexKPvS5AA911B3zccr6EWRdh7UQ64PIlImZ4DOfvGu3Q/UoOx1NiPM28vwFa6OK3w0IXMszBxP1nfDbye/PApa1lBYgg7SYZU28iIMuNLwMabIn3Ptyn3nhxygEf7hycF1bKPPQjdM9UyhDtRxpt+DnG60NxUR8F6xq3LD5nom6O23EEYMGDdKYZuDEBdLcoJ7qfNNT+KjhI1Xe/JzeXyp35x1QaTp7CTOU40yAgLDqLd+G/FfBZiL3s5hEUcjOskJktVXHkUFa5YaVHz8DeHK2DQVjqrdtUu4co2E3iTCuHGg4DcUURMO5ceqMppA5nkzH66ZrnLR+8wyzymQSx9q1IT2OsHtwf17WBeekdeH1z/PdmLFaSVOSg/T0nR2nfU/lfppEtdCjJ2byY1qcDh4XuNd7uIVcn1OEPqYD6gsw0gQdOwqEgC9pVVCoITe7afAeaiBGzp0rbjyFOkuzQNxkYUW+zizfCp1FlEva0qDg4DuFjgK6l8K4Dw07A1kK0hGULiPxSrM9S8E/itu5NPeT4OBL5jR/ed16N5YTITlqkElrpFWZ7U1EPlZnTHlhpXnITrkCnxsJfwlvdioEAr6kVcTqiOCUnOML+KOYjpaclVSIxPOJA2tgG+GTnRyYadNVmPKJ0y8sBfFXNMZtrxuEPc2C/82k18B1ckGD10+hrolfH57WV+w2efoaGuvr6/UZi0ArIN/0SVdrpmezUdt7mOmjFR/PburMl9mdHSLBRR1L9/jVyxLT1qw0rZbRoVmw6ZVKz45UBAJJK2+8jG+83pmB87RepvdZua41rod8yXmpFOAqFNNfCi0P2kJrOVVBOAfXV8DgW+b+9uRctE4wNz3ypMt5WpuK1pd1oU81ro27xNGNJ9uzKgR+GlutIt3nsCjUQ+1U4uTbGcYRNvjRdMYrjBd35PxQfSLZpmX+s0MglLS8FJlkSbOMlzKQlzcyuySK55ueTlkD19wU0LYNGqZx7wt1RoMcoKBepgBru5i1pKsOqncShCpUMoHxQJraNWvWaAOCbVz/R2ZnoOcCOtA8OE4efyHNavL+Cuk7UzIZ1nE0rZKSTNoCFZmS76GAIlhUPgiEklb+KaTfeswyjb3NKNVMJB95Ux6pZqf9tMl9KBJB3Ffc+0KdSYey2bIRLLS/UxMV1/sqyIWKP048mKl/hRi3aMdeiOO/UH5oJv1G3g+AQWey7I6/OppWaSDT3ajx3ELJYvH8F4HIgpdYkZFso/ACu/PF7KK247J5OZoQghY45YahcPVRW9O9L9SZwnkOwp5n+EIrjkJX4BQqTW88EKYL7cZh3meluoa4P5PWGaXH+z+Npj1WqrQtnUwEIkmrIBBhM9rWOyA+qZgzkTLFDH9C58dmCpO3U+Z5bmPlLTzmVFc6ZiaDxcDUp6W7owf/hdKl9mdK5Jl68eE3WDVraBp8babwn9iU4yp2pxIFdjQv7nlXSF7kMYYiUjqqXLdynNGuz6KNxrlpI99O5Nvq3ud7pue8rqmp6bVStWND5N2B5kt2jIX4M6c2ikBsbURbSrOkkh0gaLKGRI9i2aHRzgiQtLNXECqYyR9++GEX77Ncr7Ujpb6AVwGEldUzuVL6FHLF08Llh0BW0+7oiFnHRlvawtJJFWLokxArKUhe0zQ/iUJCy+SlTaneYS0ZTP6QqTsypITkvoq5tNN5uCHFIcsbEYStYN4iz7EruCyTyMq7MKBP4SUCrc0qoHluMwiklvQY2YI0r8GHOtcrvbUb2DLTWXLlPivEGXO3B/Nb+1IxaKjD+XGtz2jEJg9e92Mh5EVa8ruQ/BZ8GCkfjNS9QIW0XF91zyceC9s6EchK0yqLLEH7nuVWH0iT6R5iaCbSEXX96z7bQ4un0WT9MD/1iYd+aLR+FMp+xNuJCiElujh8heCaxH+bTpPDjDPmNc2POcVzKo2wAkSWDp1SGtr6NAUgu2kXCGStaYUKbdkZcCM57EPB3k2nz+YwxLTFyOTJk3t5NSf+RdSc18MSVlPomvlpltI5lrOdKNSMHBaiy7SeGpancrtB3nWaAFFuOSz90iKQE2khiNqW/4vm6yhxuW9Bsy3XBHvdax4qc2Vdk7Yv5OrPTybmfxvD8hTzkClIWG0qdotrfdtFkwv0WYhzPC9KW5pKaTha/iXSiillebyBxzFma1VMD355UGh/qeZEWsGkCQyQ9mUXMgrQLe6vwt++nHPqtRX5ie8uJ33C8DJrNM+yYflJNlXLyfR2ZYt7Jk9acDAT+ZNDR3HDlsMfHYOrmfziTHooR/qWZnkQyJm0EjfXThppT4ihXShuoqH1xYLzaLWTrqYuBRSao4ymHopFMBhZ+iKLeqCzbuOXQla/NMBsP/0IeXWy+cVrzyofgbwKKYRbR6FfGGZGQgZpT61Muc7lRXZVPP3aa6+dlclbCnikPUl7KDIOIf3kN3OpOJwKC8I6YiBPKcQpVBrnjLCFgrL1xZN3SYUU0yDDk8o6xJAZe4P7y9qOhA3HTlK4kmtyiwkPaVatWrVqIPNitT2nPpuoNnRXnie/mVvM9EsVN5VLM+35jzkXpT1fqnxYOrkjkDdpc08695BMeOjBhmH6JOejMm2JqQfkdDrFco+18kOSx/uMzy6J2sup8nNiEuaDQEWTVrOR+JJcHeQcggYdwFkLz7VVZ0XLnc8LCQpLvluwZFaiZQuyiVtQOva88hGomMKPmT0ArVmHWTsITqqTqBvtTsppZQ+7lOoVg8N3dNQdKVV6lk7lIpBXR1Q+2YKkmjv8PAqkF+dOboeQe1bcRlih4OCwywj7Xyzsn11CywUCmlTbcaaszCmXLJWcLpbHKZbibalkGU220iIQe/J9EcQyuzcCVAh7nd73NRHezLmdIVA20lIgtT7XjmAE7l65cmVFsLO5tFcEytoRRbs29lfS29MLUk8xxzK0rO1w2J5efMy8lk3TSj5mVG2MKWe78aYpnsy51japRth289azy2hZScuY40G127ITuW37pnNuK4sATrbtXFru8kGgrKRNCL4unwy0pbCYxEfRsDvbUp4sL4VHoOykpZA2UlhPFz5rrS7GRrYn/bbVSW0ClxyBspNWOYa03/JrtxPgyfoddv5YWfK3bwm2SgQqgrRo27vMhNrVKhHMU2ja9A9ZrvgZbdmSLFXMU1wLXgEIVARphYM2FpfGqQBMSiaCeoqZqrl6zpw5zSVL1BJq9QhUDGmFJENAP6ogt4dD+US7/kxl9Ud7yK/lsXAIVBRpmRR/nILcLvbypTlwgGZB8sNmhXulFlNbR6CiSJsAe11b17Y0Ay7QU/xTWy9clr/iIFBxpEX7XMNMPlac7JY/Vgh7k1U7q8oviUnQWhGoONIKSDTt9+pVba2gBslNvh7U1taqp7jdDm8FYWPP4yNQkaRF2z7gm7Pb42ej8n2iYVsg65cvvvji7cqX1iSsZAQqkrQCjE6pnSimkuzkWIoXBGF/oDK6WIq0LI22jUDFklawU9C/h7ht4Q38Rjv2UFvIiOWh/AhUNGnRTGeYfNDatdMZCJvX1/vKX0xMgkpCoKJJK6B69uy5Tu3BSgItriyI3QRhV8f1b/4MgTgIVDxpNcWPwt/qTEtkvsPPtouJUwrNT1YIlHW7mbiSUvirtTUNpnJFbwan9jdjzPpm7lmGdr6jpzj1q9hxM2z+DIEQBFoFaSU/pB3P1L9nQvJSMieRk06y5DdzSfgin508PW/evD943ipN+ZKBZwnljUCrIa1yytfZ3+PUI+9cZxGBCEplodVHzofFuD7brVu3k/Y9nSxANK8FRaBsm5XnkgsI8y3f9JlfLCsZgj5AU6oNfZXzech5Yu7cue1iAUMu78PClAeBVqVpBREfstaXCR7NBy5I2UK78zbkv0ZcFzmfmT9//hmu29zUyXxwsrCViUCr0rSCkE89rmtubv6/ECyywpFpCyGdb+Zy3cj1H5cvXz75j3/842Zlvg6TyhCIRiCy4EdHUXofn3zyyQx6aae4KSfI+QDz+eb9+/evokUvcH3Kpg26CNm5LSHQKkmrF0BvcgOnASwsuNCnT5/TNrzSloql5cUQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBNorAv8ffdoYPNOFmuYAAAAASUVORK5CYII=",TA=237,IA=189,RA=new e,CA=new r;class PA extends i{get size(){var t;return null!==(t=this._size)&&void 0!==t?t:this.size=new n(100,100)}set size(t){this._size=t;const{x:e,y:r}=t,{camera:i,currViewport:n}=this;n.set(e*Math.random(),r*Math.random(),e,r),i.left=i.right=e/2,i.left=-i.left,i.top=i.bottom=r/2,i.bottom=-i.bottom,i.updateProjectionMatrix()}get velocity(){var t;return null!==(t=this._velocity)&&void 0!==t?t:this._velocity=this.direction.clone().multiplyScalar(this.speed)}set velocity(t){this._velocity=t}constructor(t){super(),this.viewport=t,this.fontSize=50,this.imageWidth=200,this.camera=new o(-1.6,1.6,.8,-.8,0,4),this.direction=(new n).random().normalize(),this.speed=2,this.currViewport=new e,this.lastRenderTime=0,this.autoRender=t=>{t-this.lastRenderTime>30&&this.render(),requestAnimationFrame(this.autoRender)},this.camera.position.z=2,this._generateMarkForImage()}_generateMark(t=[28145,22323,36805,32500,25968,23383,23402,29983,25216,26415,26377,38480,20844,21496]){}_generateMarkForString(t=[28145,22323,36805,32500,25968,23383,23402,29983,25216,26415,26377,38480,20844,21496]){const e=Array.isArray(t)?String.fromCodePoint(...t):t,r=e.length,{fontSize:i}=this,o=i/4,u=2*o,{x:f,y:l}=this.size=new n(i*r+u,i+u),c=document.createElement("canvas");c.width=f,c.height=l;const d=c.getContext("2d");if(!d)return;const p=d.createLinearGradient(0,0,f,l);p.addColorStop(0,"#ff3653"),p.addColorStop(.5,"#8adb00"),p.addColorStop(1,"#2c8fff"),d.fillStyle=p,d.font=`bold ${i}px/1 serif`,d.fillText(e,o,l-1.5*o);const m=CA.load(c.toDataURL()),g=new s({map:m,toneMapped:!1,transparent:!0}),y=new a(new h(f,l),g);this.add(y)}_generateMarkForImage(t=OA,e=TA,r=IA){const{renderer:i}=this.viewport,{width:o,height:f}=i.domElement,{renderWidth:l,renderHeight:c}=this._calculateImageSize(o,f,e,r);this.size=new n(i.domElement.width,i.domElement.height);const d=CA.load(t);d.wrapS=u,d.wrapT=u,d.repeat.set(l/e,c/r);const p=new s({map:d,toneMapped:!1,transparent:!0}),m=new a(new h(l,c),p);this.add(m)}_calculateImageSize(t,e,r,i){let n=0,o=0;return n=t,o=n*(i/r),o<e/2&&(o=e,n=o*(r/i)),{renderWidth:n,renderHeight:o}}render(){const{renderer:t}=this.viewport;t.getViewport(RA),t.clearDepth(),t.render(this,this.camera)}addToViewport(){this.viewport.postRender.set("cps-water-mark",(()=>this.render()))}removeFromViewport(){this.viewport.postRender.delete("cps-water-mark")}}function xA(t){let e="";for(let r=0;r<t.length;r++){const i=t.charCodeAt(r)-1;e+=String.fromCharCode(i)}return e}function NA(t,e){const r=new Map;return t.reduce(((t,r)=>{const i=t.get(r[e]);return i?i.push(r):t.set(r[e],[r]),t}),r),r}const BA=(t,e)=>{const{content:r,sign:i}=t;if(!e.verify(r,i,"utf8","base64"))throw new Error("v2 error");const n=function(t,e){const r=t.charCodeAt(0),i=t.substring(1,r),n=t.substring(r),o=function(t){const e=function(t){const e=[];let r,i,n,o,s,a,h,u=0;t=t.replace(/[^A-Za-z0-9+/=]/g,"");for(;u<t.length;)o=LA.indexOf(t.charAt(u++)),s=LA.indexOf(t.charAt(u++)),a=LA.indexOf(t.charAt(u++)),h=LA.indexOf(t.charAt(u++)),r=o<<2|s>>4,i=(15&s)<<4|a>>2,n=(3&a)<<6|h,e.push(r),64!==a&&e.push(i),64!==h&&e.push(n);return new Int8Array(e)}(t),r=new DataView(e.buffer).getInt16(0);if(1===r)return function(t){const e=new DataView(t);let r=2;const i=e.getInt16(r);r+=2;const n=[];for(let t=0;t<i;t++){const t=e.getInt16(r);r+=2;const i=e.getInt16(r);r+=2;const o=e.getInt32(r);r+=4;const s=e.getInt32(r);r+=4;const a={index:t,encrypt:i>0,start:o,end:s};n.push(a)}return n.sort(((t,e)=>t.index<=e.index?-1:1)),n}(e.buffer);throw new Error(`解析信息头失败,版本错误: version=${r}`)}(i);let s="";for(const t of o){const r=n.substring(t.start,t.end);let i;i=t.encrypt?e.decryptPublic(r,"utf8"):xA(r),s+=i}return s}(r,e);return JSON.parse(n)};const LA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function DA(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jA={},UA={get exports(){return jA},set exports(t){jA=t}};UA.exports=function(){function t(e,r,i){function n(s,a){if(!r[s]){if(!e[s]){if(!a&&DA)return DA(s);if(o)return o(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var u=r[s]={exports:{}};e[s][0].call(u.exports,(function(t){return n(e[s][1][t]||t)}),u,u.exports,t,e,r,i)}return r[s].exports}for(var o=DA,s=0;s<i.length;s++)n(i[s]);return n}return t}()({1:[function(t,e,r){(function(r,i){(function(){const n=t("events").EventEmitter,o=t("./store"),s=t("./topic-alias-recv"),a=t("./topic-alias-send"),h=t("mqtt-packet"),u=t("./default-message-id-provider"),f=t("readable-stream").Writable,l=t("inherits"),c=t("reinterval"),d=t("rfdc/default"),p=t("./validations"),m=t("xtend"),g=t("debug")("mqttjs:client"),y=r?r.nextTick:function(t){setTimeout(t,0)},b=i.setImmediate||function(t){y(t)},v={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},w=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],_={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function M(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function S(t,e){if(5===t.options.protocolVersion&&"publish"===e.cmd){let r;e.properties&&(r=e.properties.topicAlias);const i=e.topic.toString();if(t.topicAliasSend)if(r){if(0!==i.length&&(g("applyTopicAlias :: register topic: %s - alias: %d",i,r),!t.topicAliasSend.put(i,r)))return g("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}else 0!==i.length&&(t.options.autoAssignTopicAlias?(r=t.topicAliasSend.getAliasByTopic(i),r?(e.topic="",e.properties={...e.properties,topicAlias:r},g("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",i,r)):(r=t.topicAliasSend.getLruAlias(),t.topicAliasSend.put(i,r),e.properties={...e.properties,topicAlias:r},g("applyTopicAlias :: auto assign topic: %s - alias: %d",i,r))):t.options.autoUseTopicAlias&&(r=t.topicAliasSend.getAliasByTopic(i),r&&(e.topic="",e.properties={...e.properties,topicAlias:r},g("applyTopicAlias :: auto use topic: %s - alias: %d",i,r))));else if(r)return g("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}}function E(t,e){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(0===i.length){if(void 0===r)return new Error("Unregistered Topic Alias");if(i=t.topicAliasSend.getTopicByAlias(r),void 0===i)return new Error("Unregistered Topic Alias");e.topic=i}r&&delete e.properties.topicAlias}function k(t,e,r){g("sendPacket :: packet: %O",e),g("sendPacket :: emitting `packetsend`"),t.emit("packetsend",e),g("sendPacket :: writing to stream");const i=h.writeToStream(e,t.stream,t.options);g("sendPacket :: writeToStream result %s",i),!i&&r&&r!==I?(g("sendPacket :: handle events on `drain` once through callback."),t.stream.once("drain",r)):r&&(g("sendPacket :: invoking cb"),r())}function A(t){t&&(g("flush: queue exists? %b",!!t),Object.keys(t).forEach((function(e){"function"==typeof t[e].cb&&(t[e].cb(new Error("Connection closed")),delete t[e])})))}function O(t){t&&(g("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(t).forEach((function(e){t[e].volatile&&"function"==typeof t[e].cb&&(t[e].cb(new Error("Connection closed")),delete t[e])})))}function T(t,e,r,i){g("storeAndSend :: store packet with cmd %s to outgoingStore",e.cmd);let n,o=e;if("publish"===o.cmd&&(o=d(e),n=E(t,o),n))return r&&r(n);t.outgoingStore.put(o,(function(n){if(n)return r&&r(n);i(),k(t,e,r)}))}function I(t){g("nop ::",t)}function R(t,e){let r;const i=this;if(!(this instanceof R))return new R(t,e);for(r in this.options=e||{},v)void 0===this.options[r]?this.options[r]=v[r]:this.options[r]=e[r];g("MqttClient :: options.protocol",e.protocol),g("MqttClient :: options.protocolVersion",e.protocolVersion),g("MqttClient :: options.username",e.username),g("MqttClient :: options.keepalive",e.keepalive),g("MqttClient :: options.reconnectPeriod",e.reconnectPeriod),g("MqttClient :: options.rejectUnauthorized",e.rejectUnauthorized),g("MqttClient :: options.topicAliasMaximum",e.topicAliasMaximum),this.options.clientId="string"==typeof e.clientId?e.clientId:M(),g("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===e.protocolVersion&&e.customHandleAcks?e.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=t,this.messageIdProvider=void 0===this.options.messageIdProvider?new u:this.options.messageIdProvider,this.outgoingStore=e.outgoingStore||new o,this.incomingStore=e.incomingStore||new o,this.queueQoSZero=void 0===e.queueQoSZero||e.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,e.topicAliasMaximum>0&&(e.topicAliasMaximum>65535?g("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new s(e.topicAliasMaximum)),this.on("connect",(function(){const t=this.queue;function e(){const r=t.shift();g("deliver :: entry %o",r);let n=null;if(!r)return void i._resubscribe();n=r.packet,g("deliver :: call _sendPacket for %o",n);let o=!0;n.messageId&&0!==n.messageId&&(i.messageIdProvider.register(n.messageId)||(o=!1)),o?i._sendPacket(n,(function(t){r.cb&&r.cb(t),e()})):(g("messageId: %d has already used. The message is skipped and removed.",n.messageId),e())}g("connect :: sending queued packets"),e()})),this.on("close",(function(){g("close :: connected set to `false`"),this.connected=!1,g("close :: clearing connackTimer"),clearTimeout(this.connackTimer),g("close :: clearing ping timer"),null!==i.pingTimer&&(i.pingTimer.clear(),i.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),g("close :: calling _setupReconnect"),this._setupReconnect()})),n.call(this),g("MqttClient :: setting up stream"),this._setupStream()}l(R,n),R.prototype._setupStream=function(){const t=this,e=new f,r=h.parser(this.options);let i=null;const n=[];function o(){if(n.length)y(s);else{const t=i;i=null,t()}}function s(){g("work :: getting next packet in queue");const e=n.shift();if(e)g("work :: packet pulled from queue"),t._handlePacket(e,o);else{g("work :: no packets in queue");const t=i;i=null,g("work :: done flag is %s",!!t),t&&t()}}function a(e){g("streamErrorHandler :: error",e.message),w.includes(e.code)?(g("streamErrorHandler :: emitting error"),t.emit("error",e)):I(e)}g("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),g("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),r.on("packet",(function(t){g("parser :: on packet push to packets array."),n.push(t)})),e._write=function(t,e,n){i=n,g("writable stream :: parsing buffer"),r.parse(t),s()},g("_setupStream :: pipe stream to writable stream"),this.stream.pipe(e),this.stream.on("error",a),this.stream.on("close",(function(){g("(%s)stream :: on close",t.options.clientId),O(t.outgoing),g("stream: emit close to MqttClient"),t.emit("close")})),g("_setupStream: sending packet `connect`");const u=Object.create(this.options);if(u.cmd="connect",this.topicAliasRecv&&(u.properties||(u.properties={}),this.topicAliasRecv&&(u.properties.topicAliasMaximum=this.topicAliasRecv.max)),k(this,u),r.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return t.end((()=>this.emit("error",new Error("Packet has no Authentication Method")))),this;this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket&&k(this,m({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){g("!!connectTimeout hit!! Calling _cleanUp with force `true`"),t._cleanUp(!0)}),this.options.connectTimeout)},R.prototype._handlePacket=function(t,e){const r=this.options;if(5===r.protocolVersion&&r.properties&&r.properties.maximumPacketSize&&r.properties.maximumPacketSize<t.length)return this.emit("error",new Error("exceeding packets size "+t.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(g("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",t),t.cmd){case"publish":this._handlePublish(t,e);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(t),e();break;case"pubrel":this._handlePubrel(t,e);break;case"connack":this._handleConnack(t),e();break;case"auth":this._handleAuth(t),e();break;case"pingresp":this._handlePingresp(t),e();break;case"disconnect":this._handleDisconnect(t),e()}},R.prototype._checkDisconnecting=function(t){return this.disconnecting&&(t&&t!==I?t(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},R.prototype.publish=function(t,e,r,i){g("publish :: message `%s` to topic `%s`",e,t);const n=this.options;if("function"==typeof r&&(i=r,r=null),r=m({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(i))return this;const o=this,s=function(){let s=0;if((1===r.qos||2===r.qos)&&(s=o._nextId(),null===s))return g("No messageId left"),!1;const a={cmd:"publish",topic:t,payload:e,qos:r.qos,retain:r.retain,messageId:s,dup:r.dup};switch(5===n.protocolVersion&&(a.properties=r.properties),g("publish :: qos",r.qos),r.qos){case 1:case 2:o.outgoing[a.messageId]={volatile:!1,cb:i||I},g("MqttClient:publish: packet cmd: %s",a.cmd),o._sendPacket(a,void 0,r.cbStorePut);break;default:g("MqttClient:publish: packet cmd: %s",a.cmd),o._sendPacket(a,i,r.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!s())&&this._storeProcessingQueue.push({invoke:s,cbStorePut:r.cbStorePut,callback:i}),this},R.prototype.subscribe=function(){const t=this,e=new Array(arguments.length);for(let t=0;t<arguments.length;t++)e[t]=arguments[t];const r=[];let i=e.shift();const n=i.resubscribe;let o=e.pop()||I,s=e.pop();const a=this.options.protocolVersion;delete i.resubscribe,"string"==typeof i&&(i=[i]),"function"!=typeof o&&(s=o,o=I);const h=p.validateTopics(i);if(null!==h)return b(o,new Error("Invalid topic "+h)),this;if(this._checkDisconnecting(o))return g("subscribe: discconecting true"),this;const u={qos:0};if(5===a&&(u.nl=!1,u.rap=!1,u.rh=0),s=m(u,s),Array.isArray(i)?i.forEach((function(e){if(g("subscribe: array topic %s",e),!Object.prototype.hasOwnProperty.call(t._resubscribeTopics,e)||t._resubscribeTopics[e].qos<s.qos||n){const t={topic:e,qos:s.qos};5===a&&(t.nl=s.nl,t.rap=s.rap,t.rh=s.rh,t.properties=s.properties),g("subscribe: pushing topic `%s` and qos `%s` to subs list",t.topic,t.qos),r.push(t)}})):Object.keys(i).forEach((function(e){if(g("subscribe: object topic %s",e),!Object.prototype.hasOwnProperty.call(t._resubscribeTopics,e)||t._resubscribeTopics[e].qos<i[e].qos||n){const t={topic:e,qos:i[e].qos};5===a&&(t.nl=i[e].nl,t.rap=i[e].rap,t.rh=i[e].rh,t.properties=s.properties),g("subscribe: pushing `%s` to subs list",t),r.push(t)}})),!r.length)return o(null,[]),this;const f=function(){const e=t._nextId();if(null===e)return g("No messageId left"),!1;const i={cmd:"subscribe",subscriptions:r,qos:1,retain:!1,dup:!1,messageId:e};if(s.properties&&(i.properties=s.properties),t.options.resubscribe){g("subscribe :: resubscribe true");const e=[];r.forEach((function(r){if(t.options.reconnectPeriod>0){const i={qos:r.qos};5===a&&(i.nl=r.nl||!1,i.rap=r.rap||!1,i.rh=r.rh||0,i.properties=r.properties),t._resubscribeTopics[r.topic]=i,e.push(r.topic)}})),t.messageIdToTopic[i.messageId]=e}return t.outgoing[i.messageId]={volatile:!0,cb:function(t,e){if(!t){const t=e.granted;for(let e=0;e<t.length;e+=1)r[e].qos=t[e]}o(t,r)}},g("subscribe :: call _sendPacket"),t._sendPacket(i),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!f())&&this._storeProcessingQueue.push({invoke:f,callback:o}),this},R.prototype.unsubscribe=function(){const t=this,e=new Array(arguments.length);for(let t=0;t<arguments.length;t++)e[t]=arguments[t];let r=e.shift(),i=e.pop()||I,n=e.pop();"string"==typeof r&&(r=[r]),"function"!=typeof i&&(n=i,i=I);const o=p.validateTopics(r);if(null!==o)return b(i,new Error("Invalid topic "+o)),this;if(t._checkDisconnecting(i))return this;const s=function(){const e=t._nextId();if(null===e)return g("No messageId left"),!1;const o={cmd:"unsubscribe",qos:1,messageId:e};return"string"==typeof r?o.unsubscriptions=[r]:Array.isArray(r)&&(o.unsubscriptions=r),t.options.resubscribe&&o.unsubscriptions.forEach((function(e){delete t._resubscribeTopics[e]})),"object"==typeof n&&n.properties&&(o.properties=n.properties),t.outgoing[o.messageId]={volatile:!0,cb:i},g("unsubscribe: call _sendPacket"),t._sendPacket(o),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!s())&&this._storeProcessingQueue.push({invoke:s,callback:i}),this},R.prototype.end=function(t,e,r){const i=this;function n(){g("end :: closeStores: closing incoming and outgoing stores"),i.disconnected=!0,i.incomingStore.close((function(t){i.outgoingStore.close((function(e){if(g("end :: closeStores: emitting end"),i.emit("end"),r){const i=t||e;g("end :: closeStores: invoking callback with args"),r(i)}}))})),i._deferredReconnect&&i._deferredReconnect()}function o(){g("end :: (%s) :: finish :: calling _cleanUp with force %s",i.options.clientId,t),i._cleanUp(t,(()=>{g("end :: finish :: calling process.nextTick on closeStores"),y(n.bind(i))}),e)}return g("end :: (%s)",this.options.clientId),null!=t&&"boolean"==typeof t||(r=e||I,e=t,t=!1,"object"!=typeof e&&(r=e,e=null,"function"!=typeof r&&(r=I))),"object"!=typeof e&&(r=e,e=null),g("end :: cb? %s",!!r),r=r||I,this.disconnecting?(r(),this):(this._clearReconnect(),this.disconnecting=!0,!t&&Object.keys(this.outgoing).length>0?(g("end :: (%s) :: calling finish in 10ms once outgoing is empty",i.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,o,10))):(g("end :: (%s) :: immediately calling finish",i.options.clientId),o()),this)},R.prototype.removeOutgoingMessage=function(t){const e=this.outgoing[t]?this.outgoing[t].cb:null;return delete this.outgoing[t],this.outgoingStore.del({messageId:t},(function(){e(new Error("Message removed"))})),this},R.prototype.reconnect=function(t){g("client reconnect");const e=this,r=function(){t?(e.options.incomingStore=t.incomingStore,e.options.outgoingStore=t.outgoingStore):(e.options.incomingStore=null,e.options.outgoingStore=null),e.incomingStore=e.options.incomingStore||new o,e.outgoingStore=e.options.outgoingStore||new o,e.disconnecting=!1,e.disconnected=!1,e._deferredReconnect=null,e._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},R.prototype._reconnect=function(){g("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end((()=>{this._setupStream()})),g("client already connected. disconnecting first.")):(g("_reconnect: calling _setupStream"),this._setupStream())},R.prototype._setupReconnect=function(){const t=this;!t.disconnecting&&!t.reconnectTimer&&t.options.reconnectPeriod>0?(this.reconnecting||(g("_setupReconnect :: emit `offline` state"),this.emit("offline"),g("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),g("_setupReconnect :: setting reconnectTimer for %d ms",t.options.reconnectPeriod),t.reconnectTimer=setInterval((function(){g("reconnectTimer :: reconnect triggered!"),t._reconnect()}),t.options.reconnectPeriod)):g("_setupReconnect :: doing nothing...")},R.prototype._clearReconnect=function(){g("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},R.prototype._cleanUp=function(t,e){const r=arguments[2];if(e&&(g("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",e)),g("_cleanUp :: forced? %s",t),t)0===this.options.reconnectPeriod&&this.options.clean&&A(this.outgoing),g("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const t=m({cmd:"disconnect"},r);g("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(t,b.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(g("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(g("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),e&&!this.connected&&(g("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",e),e())},R.prototype._sendPacket=function(t,e,r){g("_sendPacket :: (%s) :: start",this.options.clientId),r=r||I,e=e||I;const i=S(this,t);if(i)e(i);else{if(!this.connected)return"auth"===t.cmd?(this._shiftPingInterval(),void k(this,t,e)):(g("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(t,e,r));switch(this._shiftPingInterval(),t.cmd){case"publish":break;case"pubrel":return void T(this,t,e,r);default:return void k(this,t,e)}switch(t.qos){case 2:case 1:T(this,t,e,r);break;default:k(this,t,e)}g("_sendPacket :: (%s) :: end",this.options.clientId)}},R.prototype._storePacket=function(t,e,r){g("_storePacket :: packet: %o",t),g("_storePacket :: cb? %s",!!e),r=r||I;let i=t;if("publish"===i.cmd){i=d(t);const r=E(this,i);if(r)return e&&e(r)}0===(i.qos||0)&&this.queueQoSZero||"publish"!==i.cmd?this.queue.push({packet:i,cb:e}):i.qos>0?(e=this.outgoing[i.messageId]?this.outgoing[i.messageId].cb:null,this.outgoingStore.put(i,(function(t){if(t)return e&&e(t);r()}))):e&&e(new Error("No connection to broker"))},R.prototype._setupPingTimer=function(){g("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const t=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=c((function(){t._checkPing()}),1e3*this.options.keepalive))},R.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},R.prototype._checkPing=function(){g("_checkPing :: checking ping..."),this.pingResp?(g("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(g("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},R.prototype._handlePingresp=function(){this.pingResp=!0},R.prototype._handleConnack=function(t){g("_handleConnack");const e=this.options,r=5===e.protocolVersion?t.reasonCode:t.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,t.properties){if(t.properties.topicAliasMaximum){if(t.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));t.properties.topicAliasMaximum>0&&(this.topicAliasSend=new a(t.properties.topicAliasMaximum))}t.properties.serverKeepAlive&&e.keepalive&&(e.keepalive=t.properties.serverKeepAlive,this._shiftPingInterval()),t.properties.maximumPacketSize&&(e.properties||(e.properties={}),e.properties.maximumPacketSize=t.properties.maximumPacketSize)}if(0===r)this.reconnecting=!1,this._onConnect(t);else if(r>0){const t=new Error("Connection refused: "+_[r]);t.code=r,this.emit("error",t)}},R.prototype._handleAuth=function(t){const e=this.options.protocolVersion,r=5===e?t.reasonCode:t.returnCode;if(5!==e){const t=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+e);return t.code=r,void this.emit("error",t)}const i=this;this.handleAuth(t,(function(t,e){if(t)i.emit("error",t);else if(24===r)i.reconnecting=!1,i._sendPacket(e);else{const e=new Error("Connection refused: "+_[r]);t.code=r,i.emit("error",e)}}))},R.prototype.handleAuth=function(t,e){e()},R.prototype._handlePublish=function(t,e){g("_handlePublish: packet %o",t),e=void 0!==e?e:I;let r=t.topic.toString();const i=t.payload,n=t.qos,o=t.messageId,s=this,a=this.options,h=[0,16,128,131,135,144,145,151,153];if(5===this.options.protocolVersion){let e;if(t.properties&&(e=t.properties.topicAlias),void 0!==e)if(0===r.length){if(!(e>0&&e<=65535))return g("_handlePublish :: topic alias out of range. alias: %d",e),void this.emit("error",new Error("Received Topic Alias is out of range"));{const t=this.topicAliasRecv.getTopicByAlias(e);if(!t)return g("_handlePublish :: unregistered topic alias. alias: %d",e),void this.emit("error",new Error("Received unregistered Topic Alias"));r=t,g("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",r,e)}}else{if(!this.topicAliasRecv.put(r,e))return g("_handlePublish :: topic alias out of range. alias: %d",e),void this.emit("error",new Error("Received Topic Alias is out of range"));g("_handlePublish :: registered topic: %s - alias: %d",r,e)}}switch(g("_handlePublish: qos %d",n),n){case 2:a.customHandleAcks(r,i,t,(function(r,i){return r instanceof Error||(i=r,r=null),r?s.emit("error",r):-1===h.indexOf(i)?s.emit("error",new Error("Wrong reason code for pubrec")):void(i?s._sendPacket({cmd:"pubrec",messageId:o,reasonCode:i},e):s.incomingStore.put(t,(function(){s._sendPacket({cmd:"pubrec",messageId:o},e)})))}));break;case 1:a.customHandleAcks(r,i,t,(function(n,a){return n instanceof Error||(a=n,n=null),n?s.emit("error",n):-1===h.indexOf(a)?s.emit("error",new Error("Wrong reason code for puback")):(a||s.emit("message",r,i,t),void s.handleMessage(t,(function(t){if(t)return e&&e(t);s._sendPacket({cmd:"puback",messageId:o,reasonCode:a},e)})))}));break;case 0:this.emit("message",r,i,t),this.handleMessage(t,e);break;default:g("_handlePublish: unknown QoS. Doing nothing.")}},R.prototype.handleMessage=function(t,e){e()},R.prototype._handleAck=function(t){const e=t.messageId,r=t.cmd;let i=null;const n=this.outgoing[e]?this.outgoing[e].cb:null,o=this;let s;if(n){switch(g("_handleAck :: packet type",r),r){case"pubcomp":case"puback":{const r=t.reasonCode;r&&r>0&&16!==r&&(s=new Error("Publish error: "+_[r]),s.code=r,n(s,t)),delete this.outgoing[e],this.outgoingStore.del(t,n),this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue();break}case"pubrec":{i={cmd:"pubrel",qos:2,messageId:e};const r=t.reasonCode;r&&r>0&&16!==r?(s=new Error("Publish error: "+_[r]),s.code=r,n(s,t)):this._sendPacket(i);break}case"suback":delete this.outgoing[e],this.messageIdProvider.deallocate(e);for(let r=0;r<t.granted.length;r++)if(0!=(128&t.granted[r])){const t=this.messageIdToTopic[e];t&&t.forEach((function(t){delete o._resubscribeTopics[t]}))}this._invokeStoreProcessingQueue(),n(null,t);break;case"unsuback":delete this.outgoing[e],this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue(),n(null);break;default:o.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else g("_handleAck :: Server sent an ack in error. Ignoring.")},R.prototype._handlePubrel=function(t,e){g("handling pubrel packet"),e=void 0!==e?e:I;const r=t.messageId,i=this,n={cmd:"pubcomp",messageId:r};i.incomingStore.get(t,(function(t,r){t?i._sendPacket(n,e):(i.emit("message",r.topic,r.payload,r),i.handleMessage(r,(function(t){if(t)return e(t);i.incomingStore.del(r,I),i._sendPacket(n,e)})))}))},R.prototype._handleDisconnect=function(t){this.emit("disconnect",t)},R.prototype._nextId=function(){return this.messageIdProvider.allocate()},R.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},R.prototype._resubscribe=function(){g("_resubscribe");const t=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!this.connackPacket.sessionPresent)&&t.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){g("_resubscribe: protocolVersion 5");for(let e=0;e<t.length;e++){const r={};r[t[e]]=this._resubscribeTopics[t[e]],r.resubscribe=!0,this.subscribe(r,{properties:r[t[e]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},R.prototype._onConnect=function(t){if(this.disconnected)return void this.emit("connect",t);const e=this;function r(){let i=e.outgoingStore.createStream();function n(){e._storeProcessing=!1,e._packetIdsDuringStoreProcessing={}}function o(){i.destroy(),i=null,e._flushStoreProcessingQueue(),n()}function s(){if(!i)return;e._storeProcessing=!0;const t=i.read(1);let r;t?e._packetIdsDuringStoreProcessing[t.messageId]?s():e.disconnecting||e.reconnectTimer?i.destroy&&i.destroy():(r=e.outgoing[t.messageId]?e.outgoing[t.messageId].cb:null,e.outgoing[t.messageId]={volatile:!1,cb:function(t,e){r&&r(t,e),s()}},e._packetIdsDuringStoreProcessing[t.messageId]=!0,e.messageIdProvider.register(t.messageId)?e._sendPacket(t):g("messageId: %d has already used.",t.messageId)):i.once("readable",s)}e.once("close",o),i.on("error",(function(t){n(),e._flushStoreProcessingQueue(),e.removeListener("close",o),e.emit("error",t)})),i.on("end",(function(){let i=!0;for(const t in e._packetIdsDuringStoreProcessing)if(!e._packetIdsDuringStoreProcessing[t]){i=!1;break}i?(n(),e.removeListener("close",o),e._invokeAllStoreProcessingQueue(),e.emit("connect",t)):r()})),s()}this.connackPacket=t,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,r()},R.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const t=this._storeProcessingQueue[0];if(t&&t.invoke())return this._storeProcessingQueue.shift(),!0}return!1},R.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},R.prototype._flushStoreProcessingQueue=function(){for(const t of this._storeProcessingQueue)t.cbStorePut&&t.cbStorePut(new Error("Connection closed")),t.callback&&t.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},e.exports=R}).call(this)}).call(this,t("_process"),void 0!==Y?Y:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./default-message-id-provider":7,"./store":8,"./topic-alias-recv":9,"./topic-alias-send":10,"./validations":11,_process:50,debug:18,events:22,inherits:24,"mqtt-packet":40,"readable-stream":69,reinterval:70,"rfdc/default":71,xtend:81}],2:[function(t,e,r){const{Buffer:i}=t("buffer"),n=t("readable-stream").Transform,o=t("duplexify");let s,a,h,u=!1;function f(){const t=new n;return t._write=function(t,e,r){s.sendSocketMessage({data:t.buffer,success:function(){r()},fail:function(){r(new Error)}})},t._flush=function(t){s.closeSocket({success:function(){t()}})},t}function l(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function c(t,e){const r="alis"===t.protocol?"wss":"ws";let i=r+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(i=r+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(i=t.transformWsUrl(i,t,e)),i}function d(){u||(u=!0,s.onSocketOpen((function(){h.setReadable(a),h.setWritable(a),h.emit("connect")})),s.onSocketMessage((function(t){if("string"==typeof t.data){const e=i.from(t.data,"base64");a.push(e)}else{const e=new FileReader;e.addEventListener("load",(function(){let t=e.result;t=t instanceof ArrayBuffer?i.from(t):i.from(t,"utf8"),a.push(t)})),e.readAsArrayBuffer(t.data)}})),s.onSocketClose((function(){h.end(),h.destroy()})),s.onSocketError((function(t){h.destroy(t)})))}function p(t,e){if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");const r="MQIsdp"===e.protocolId&&3===e.protocolVersion?"mqttv3.1":"mqtt";l(e);const i=c(e,t);return s=e.my,s.connectSocket({url:i,protocols:r}),a=f(),h=o.obj(),d(),h}e.exports=p},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(t,e,r){const i=t("net"),n=t("debug")("mqttjs:tcp");function o(t,e){e.port=e.port||1883,e.hostname=e.hostname||e.host||"localhost";const r=e.port,o=e.hostname;return n("port %d and host %s",r,o),i.createConnection(r,o)}e.exports=o},{debug:18,net:16}],4:[function(t,e,r){const i=t("tls"),n=t("net"),o=t("debug")("mqttjs:tls");function s(t,e){e.port=e.port||8883,e.host=e.hostname||e.host||"localhost",0===n.isIP(e.host)&&(e.servername=e.host),e.rejectUnauthorized=!1!==e.rejectUnauthorized,delete e.path,o("port %d host %s rejectUnauthorized %b",e.port,e.host,e.rejectUnauthorized);const r=i.connect(e);function s(i){e.rejectUnauthorized&&t.emit("error",i),r.end()}return r.on("secureConnect",(function(){e.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",s)})),r.on("error",s),r}e.exports=s},{debug:18,net:16,tls:16}],5:[function(t,e,r){(function(r){(function(){const{Buffer:i}=t("buffer"),n=t("ws"),o=t("debug")("mqttjs:ws"),s=t("duplexify"),a=t("readable-stream").Transform,h=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],u=void 0!==r&&"browser"===r.title||"function"==typeof __webpack_require__;function f(t,e){let r=t.protocol+"://"+t.hostname+":"+t.port+t.path;return"function"==typeof t.transformWsUrl&&(r=t.transformWsUrl(r,t,e)),r}function l(t){const e=t;return t.hostname||(e.hostname="localhost"),t.port||("wss"===t.protocol?e.port=443:e.port=80),t.path||(e.path="/"),t.wsOptions||(e.wsOptions={}),u||"wss"!==t.protocol||h.forEach((function(r){Object.prototype.hasOwnProperty.call(t,r)&&!Object.prototype.hasOwnProperty.call(t.wsOptions,r)&&(e.wsOptions[r]=t[r])})),e}function c(t){const e=l(t);if(e.hostname||(e.hostname=e.host),!e.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const t=new URL(document.URL);e.hostname=t.hostname,e.port||(e.port=t.port)}return void 0===e.objectMode&&(e.objectMode=!(!0===e.binary||void 0===e.binary)),e}function d(t,e,r){o("createWebSocket"),o("protocol: "+r.protocolId+" "+r.protocolVersion);const i="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";return o("creating new Websocket for url: "+e+" and protocol: "+i),new n(e,[i],r.wsOptions)}function p(t,e){const r="MQIsdp"===e.protocolId&&3===e.protocolVersion?"mqttv3.1":"mqtt",i=f(e,t),n=new WebSocket(i,[r]);return n.binaryType="arraybuffer",n}function m(t,e){o("streamBuilder");const r=l(e),i=f(r,t),s=d(t,i,r),a=n.createWebSocketStream(s,r.wsOptions);return a.url=i,s.on("close",(()=>{a.destroy()})),a}function g(t,e){let r;o("browserStreamBuilder");const n=c(e).browserBufferSize||524288,h=e.browserBufferTimeout||1e3,u=!e.objectMode,f=p(t,e),l=m(e,_,M);e.objectMode||(l._writev=w),l.on("close",(()=>{f.close()}));const d=void 0!==f.addEventListener;function m(t,e,r){const i=new a({objectModeMode:t.objectMode});return i._write=e,i._flush=r,i}function g(){r.setReadable(l),r.setWritable(l),r.emit("connect")}function y(){r.end(),r.destroy()}function b(t){r.destroy(t)}function v(t){let e=t.data;e=e instanceof ArrayBuffer?i.from(e):i.from(e,"utf8"),l.push(e)}function w(t,e){const r=new Array(t.length);for(let e=0;e<t.length;e++)"string"==typeof t[e].chunk?r[e]=i.from(t[e],"utf8"):r[e]=t[e].chunk;this._write(i.concat(r),"binary",e)}function _(t,e,r){f.bufferedAmount>n&&setTimeout(_,h,t,e,r),u&&"string"==typeof t&&(t=i.from(t,"utf8"));try{f.send(t)}catch(t){return r(t)}r()}function M(t){f.close(),t()}return f.readyState===f.OPEN?r=l:(r=r=s(void 0,void 0,e),e.objectMode||(r._writev=w),d?f.addEventListener("open",g):f.onopen=g),r.socket=f,d?(f.addEventListener("close",y),f.addEventListener("error",b),f.addEventListener("message",v)):(f.onclose=y,f.onerror=b,f.onmessage=v),r}e.exports=u?g:m}).call(this)}).call(this,t("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(t,e,r){const{Buffer:i}=t("buffer"),n=t("readable-stream").Transform,o=t("duplexify");let s,a,h;function u(){const t=new n;return t._write=function(t,e,r){s.send({data:t.buffer,success:function(){r()},fail:function(t){r(new Error(t))}})},t._flush=function(t){s.close({success:function(){t()}})},t}function f(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function l(t,e){const r="wxs"===t.protocol?"wss":"ws";let i=r+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(i=r+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(i=t.transformWsUrl(i,t,e)),i}function c(){s.onOpen((function(){h.setReadable(a),h.setWritable(a),h.emit("connect")})),s.onMessage((function(t){let e=t.data;e=e instanceof ArrayBuffer?i.from(e):i.from(e,"utf8"),a.push(e)})),s.onClose((function(){h.end(),h.destroy()})),s.onError((function(t){h.destroy(new Error(t.errMsg))}))}function d(t,e){if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");const r="MQIsdp"===e.protocolId&&3===e.protocolVersion?"mqttv3.1":"mqtt";f(e);const i=l(e,t);s=wx.connectSocket({url:i,protocols:[r]}),a=u(),h=o.obj(),h._destroy=function(t,e){s.close({success:function(){e&&e(t)}})};const n=h.destroy;return h.destroy=function(){h.destroy=n;const t=this;setTimeout((function(){s.close({fail:function(){t._destroy(new Error)}})}),0)}.bind(h),c(),h}e.exports=d},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(t,e,r){function i(){if(!(this instanceof i))return new i;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}i.prototype.allocate=function(){const t=this.nextId++;return 65536===this.nextId&&(this.nextId=1),t},i.prototype.getLastAllocated=function(){return 1===this.nextId?65535:this.nextId-1},i.prototype.register=function(t){return!0},i.prototype.deallocate=function(t){},i.prototype.clear=function(){},e.exports=i},{}],8:[function(t,e,r){const i=t("xtend"),n=t("readable-stream").Readable,o={objectMode:!0},s={clean:!0};function a(t){if(!(this instanceof a))return new a(t);this.options=t||{},this.options=i(s,t),this._inflights=new Map}a.prototype.put=function(t,e){return this._inflights.set(t.messageId,t),e&&e(),this},a.prototype.createStream=function(){const t=new n(o),e=[];let r=!1,i=0;return this._inflights.forEach((function(t,r){e.push(t)})),t._read=function(){!r&&i<e.length?this.push(e[i++]):this.push(null)},t.destroy=function(){if(r)return;const t=this;r=!0,setTimeout((function(){t.emit("close")}),0)},t},a.prototype.del=function(t,e){return(t=this._inflights.get(t.messageId))?(this._inflights.delete(t.messageId),e(null,t)):e&&e(new Error("missing packet")),this},a.prototype.get=function(t,e){return(t=this._inflights.get(t.messageId))?e(null,t):e&&e(new Error("missing packet")),this},a.prototype.close=function(t){this.options.clean&&(this._inflights=null),t&&t()},e.exports=a},{"readable-stream":69,xtend:81}],9:[function(t,e,r){function i(t){if(!(this instanceof i))return new i(t);this.aliasToTopic={},this.max=t}i.prototype.put=function(t,e){return!(0===e||e>this.max||(this.aliasToTopic[e]=t,this.length=Object.keys(this.aliasToTopic).length,0))},i.prototype.getTopicByAlias=function(t){return this.aliasToTopic[t]},i.prototype.clear=function(){this.aliasToTopic={}},e.exports=i},{}],10:[function(t,e,r){const i=t("lru-cache"),n=t("number-allocator").NumberAllocator;function o(t){if(!(this instanceof o))return new o(t);t>0&&(this.aliasToTopic=new i({max:t}),this.topicToAlias={},this.numberAllocator=new n(1,t),this.max=t,this.length=0)}o.prototype.put=function(t,e){if(0===e||e>this.max)return!1;const r=this.aliasToTopic.get(e);return r&&delete this.topicToAlias[r],this.aliasToTopic.set(e,t),this.topicToAlias[t]=e,this.numberAllocator.use(e),this.length=this.aliasToTopic.length,!0},o.prototype.getTopicByAlias=function(t){return this.aliasToTopic.get(t)},o.prototype.getAliasByTopic=function(t){const e=this.topicToAlias[t];return void 0!==e&&this.aliasToTopic.get(e),e},o.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},o.prototype.getLruAlias=function(){const t=this.numberAllocator.firstVacant();return t||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},e.exports=o},{"lru-cache":37,"number-allocator":46}],11:[function(t,e,r){function i(t){const e=t.split("/");for(let t=0;t<e.length;t++)if("+"!==e[t]){if("#"===e[t])return t===e.length-1;if(-1!==e[t].indexOf("+")||-1!==e[t].indexOf("#"))return!1}return!0}function n(t){if(0===t.length)return"empty_topic_list";for(let e=0;e<t.length;e++)if(!i(t[e]))return t[e];return null}e.exports={validateTopics:n}},{}],12:[function(t,e,r){(function(r){(function(){const i=t("../client"),n=t("../store"),o=t("url"),s=t("xtend"),a=t("debug")("mqttjs"),h={};function u(t){let e;t.auth&&(e=t.auth.match(/^(.+):(.+)$/),e?(t.username=e[1],t.password=e[2]):t.username=t.auth)}function f(t,e){if(a("connecting to an MQTT broker..."),"object"!=typeof t||e||(e=t,t=null),e=e||{},t){const r=o.parse(t,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(e=s(r,e)).protocol)throw new Error("Missing protocol");e.protocol=e.protocol.replace(/:$/,"")}if(u(e),e.query&&"string"==typeof e.query.clientId&&(e.clientId=e.query.clientId),e.cert&&e.key){if(!e.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(e.protocol))switch(e.protocol){case"mqtt":e.protocol="mqtts";break;case"ws":e.protocol="wss";break;case"wx":e.protocol="wxs";break;case"ali":e.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+e.protocol+'"!')}}if(!h[e.protocol]){const t=-1!==["mqtts","wss"].indexOf(e.protocol);e.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(e,r){return(!t||r%2!=0)&&"function"==typeof h[e]}))[0]}if(!1===e.clean&&!e.clientId)throw new Error("Missing clientId for unclean clients");function r(t){return e.servers&&(t._reconnectCount&&t._reconnectCount!==e.servers.length||(t._reconnectCount=0),e.host=e.servers[t._reconnectCount].host,e.port=e.servers[t._reconnectCount].port,e.protocol=e.servers[t._reconnectCount].protocol?e.servers[t._reconnectCount].protocol:e.defaultProtocol,e.hostname=e.host,t._reconnectCount++),a("calling streambuilder for",e.protocol),h[e.protocol](t,e)}e.protocol&&(e.defaultProtocol=e.protocol);const n=new i(r,e);return n.on("error",(function(){})),n}void 0!==r&&"browser"!==r.title||"function"!=typeof __webpack_require__?(h.mqtt=t("./tcp"),h.tcp=t("./tcp"),h.ssl=t("./tls"),h.tls=t("./tls"),h.mqtts=t("./tls")):(h.wx=t("./wx"),h.wxs=t("./wx"),h.ali=t("./ali"),h.alis=t("./ali")),h.ws=t("./ws"),h.wss=t("./ws"),e.exports=f,e.exports.connect=f,e.exports.MqttClient=i,e.exports.Store=n}).call(this)}).call(this,t("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:50,debug:18,url:76,xtend:81}],13:[function(t,e,r){r.byteLength=f,r.toByteArray=c,r.fromByteArray=m;for(var i=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,h=s.length;a<h;++a)i[a]=s[a],n[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)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){var e=u(t),r=e[0],i=e[1];return 3*(r+i)/4-i}function l(t,e,r){return 3*(e+r)/4-r}function c(t){var e,r,i=u(t),s=i[0],a=i[1],h=new o(l(t,s,a)),f=0,c=a>0?s-4:s;for(r=0;r<c;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],h[f++]=e>>16&255,h[f++]=e>>8&255,h[f++]=255&e;return 2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,h[f++]=255&e),1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,h[f++]=e>>8&255,h[f++]=255&e),h}function d(t){return i[t>>18&63]+i[t>>12&63]+i[t>>6&63]+i[63&t]}function p(t,e,r){for(var i,n=[],o=e;o<r;o+=3)i=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),n.push(d(i));return n.join("")}function m(t){for(var e,r=t.length,n=r%3,o=[],s=16383,a=0,h=r-n;a<h;a+=s)o.push(p(t,a,a+s>h?h:a+s));return 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]+"=")),o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},{}],14:[function(t,e,r){const{Buffer:i}=t("buffer"),n=Symbol.for("BufferList");function o(t){if(!(this instanceof o))return new o(t);o._init.call(this,t)}o._init=function(t){Object.defineProperty(this,n,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)},o.prototype._new=function(t){return new o(t)},o.prototype._offset=function(t){if(0===t)return[0,0];let e=0;for(let r=0;r<this._bufs.length;r++){const i=e+this._bufs[r].length;if(t<i||r===this._bufs.length-1)return[r,t-e];e=i}},o.prototype._reverseOffset=function(t){const e=t[0];let r=t[1];for(let t=0;t<e;t++)r+=this._bufs[t].length;return r},o.prototype.get=function(t){if(t>this.length||t<0)return;const e=this._offset(t);return this._bufs[e[0]][e[1]]},o.prototype.slice=function(t,e){return"number"==typeof t&&t<0&&(t+=this.length),"number"==typeof e&&e<0&&(e+=this.length),this.copy(null,0,t,e)},o.prototype.copy=function(t,e,r,n){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof n||n>this.length)&&(n=this.length),r>=this.length)return t||i.alloc(0);if(n<=0)return t||i.alloc(0);const o=!!t,s=this._offset(r),a=n-r;let h=a,u=o&&e||0,f=s[1];if(0===r&&n===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(let e=0;e<this._bufs.length;e++)this._bufs[e].copy(t,u),u+=this._bufs[e].length;return t}if(h<=this._bufs[s[0]].length-f)return o?this._bufs[s[0]].copy(t,e,f,f+h):this._bufs[s[0]].slice(f,f+h);o||(t=i.allocUnsafe(a));for(let e=s[0];e<this._bufs.length;e++){const r=this._bufs[e].length-f;if(!(h>r)){this._bufs[e].copy(t,u,f,f+h),u+=r;break}this._bufs[e].copy(t,u,f),u+=r,h-=r,f&&(f=0)}return t.length>u?t.slice(0,u):t},o.prototype.shallowSlice=function(t,e){if(t=t||0,e="number"!=typeof e?this.length:e,t<0&&(t+=this.length),e<0&&(e+=this.length),t===e)return this._new();const r=this._offset(t),i=this._offset(e),n=this._bufs.slice(r[0],i[0]+1);return 0===i[1]?n.pop():n[n.length-1]=n[n.length-1].slice(0,i[1]),0!==r[1]&&(n[0]=n[0].slice(r[1])),this._new(n)},o.prototype.toString=function(t,e,r){return this.slice(e,r).toString(t)},o.prototype.consume=function(t){if(t=Math.trunc(t),Number.isNaN(t)||t<=0)return this;for(;this._bufs.length;){if(!(t>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const t=this._new();for(let e=0;e<this._bufs.length;e++)t.append(this._bufs[e]);return t},o.prototype.append=function(t){if(null==t)return this;if(t.buffer)this._appendBuffer(i.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let e=0;e<t.length;e++)this.append(t[e]);else if(this._isBufferList(t))for(let e=0;e<t._bufs.length;e++)this.append(t._bufs[e]);else"number"==typeof t&&(t=t.toString()),this._appendBuffer(i.from(t));return this},o.prototype._appendBuffer=function(t){this._bufs.push(t),this.length+=t.length},o.prototype.indexOf=function(t,e,r){if(void 0===r&&"string"==typeof e&&(r=e,e=void 0),"function"==typeof t||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof t?t=i.from([t]):"string"==typeof t?t=i.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=i.from(t.buffer,t.byteOffset,t.byteLength):i.isBuffer(t)||(t=i.from(t)),e=Number(e||0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),0===t.length)return e>this.length?this.length:e;const n=this._offset(e);let o=n[0],s=n[1];for(;o<this._bufs.length;o++){const e=this._bufs[o];for(;s<e.length;)if(e.length-s>=t.length){const r=e.indexOf(t,s);if(-1!==r)return this._reverseOffset([o,r]);s=e.length-t.length+1}else{const e=this._reverseOffset([o,s]);if(this._match(e,t))return e;s++}s=0}return-1},o.prototype._match=function(t,e){if(this.length-t<e.length)return!1;for(let r=0;r<e.length;r++)if(this.get(t+r)!==e[r])return!1;return!0},function(){const t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const e in t)!function(e){null===t[e]?o.prototype[e]=function(t,r){return this.slice(t,t+r)[e](0,r)}:o.prototype[e]=function(r=0){return this.slice(r,r+t[e])[e](0)}}(e)}(),o.prototype._isBufferList=function(t){return t instanceof o||o.isBufferList(t)},o.isBufferList=function(t){return null!=t&&t[n]},e.exports=o},{buffer:17}],15:[function(t,e,r){const i=t("readable-stream").Duplex,n=t("inherits"),o=t("./BufferList");function s(t){if(!(this instanceof s))return new s(t);if("function"==typeof t){this._callback=t;const e=function(t){this._callback&&(this._callback(t),this._callback=null)}.bind(this);this.on("pipe",(function(t){t.on("error",e)})),this.on("unpipe",(function(t){t.removeListener("error",e)})),t=null}o._init.call(this,t),i.call(this)}n(s,i),Object.assign(s.prototype,o.prototype),s.prototype._new=function(t){return new s(t)},s.prototype._write=function(t,e,r){this._appendBuffer(t),"function"==typeof r&&r()},s.prototype._read=function(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)},s.prototype.end=function(t){i.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},s.prototype._destroy=function(t,e){this._bufs.length=0,this.length=0,e(t)},s.prototype._isBufferList=function(t){return t instanceof s||t instanceof o||s.isBufferList(t)},s.isBufferList=o.isBufferList,e.exports=s,e.exports.BufferListStream=s,e.exports.BufferList=o},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(t,e,r){},{}],17:[function(t,e,r){(function(e){(function(){var e=t("base64-js"),i=t("ieee754");r.Buffer=a,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50;var n=2147483647;function o(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}function s(t){if(t>n)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return h(t,e,r)}function h(t,e,r){if("string"==typeof t)return c(t,e);if(ArrayBuffer.isView(t))return d(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return a.from(i,e,r);var n=m(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t,e,r){return u(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}function l(t){return u(t),s(t<0?0:0|g(t))}function c(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|b(t,e),i=s(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function d(t){for(var e=t.length<0?0:0|g(t.length),r=s(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return(i=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r)).__proto__=a.prototype,i}function m(t){if(a.isBuffer(t)){var e=0|g(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||Q(t.length)?s(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}function g(t){if(t>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),a.alloc(+t)}function b(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(t).length;default:if(n)return i?-1:V(t).length;e=(""+e).toLowerCase(),n=!0}}function v(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 B(this,e,r);case"utf8":case"utf-8":return R(this,e,r);case"ascii":return x(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return I(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function w(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function _(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),Q(r=+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=a.from(e,i)),a.isBuffer(e))return 0===e.length?-1:M(t,e,r,i,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):M(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function M(t,e,r,i,n){var o,s=1,a=t.length,h=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,h/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){var f=-1;for(o=r;o<a;o++)if(u(t,o)===u(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===h)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+h>a&&(r=a-h),o=r;o>=0;o--){for(var l=!0,c=0;c<h;c++)if(u(t,o+c)!==u(e,c)){l=!1;break}if(l)return o}return-1}function S(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=e.length;i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(e.substr(2*s,2),16);if(Q(a))return s;t[r+s]=a}return s}function E(t,e,r,i){return Z(V(e,t.length-r),t,r,i)}function k(t,e,r,i){return Z(G(e),t,r,i)}function A(t,e,r,i){return k(t,e,r,i)}function O(t,e,r,i){return Z(Y(e),t,r,i)}function T(t,e,r,i){return Z(W(e,t.length-r),t,r,i)}function I(t,r,i){return 0===r&&i===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,i))}function R(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var o,s,a,h,u=t[n],f=null,l=u>239?4:u>223?3:u>191?2:1;if(n+l<=r)switch(l){case 1:u<128&&(f=u);break;case 2:128==(192&(o=t[n+1]))&&(h=(31&u)<<6|63&o)>127&&(f=h);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(h=(15&u)<<12|(63&o)<<6|63&s)>2047&&(h<55296||h>57343)&&(f=h);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(h=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&h<1114112&&(f=h)}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 P(i)}r.kMaxLength=n,a.TYPED_ARRAY_SUPPORT=o(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),a.poolSize=8192,a.from=function(t,e,r){return h(t,e,r)},a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,a.alloc=function(t,e,r){return f(t,e,r)},a.allocUnsafe=function(t){return l(t)},a.allocUnsafeSlow=function(t){return l(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(X(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),X(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=a.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var o=t[r];if(X(o,Uint8Array)&&(o=a.from(o)),!a.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length}return i},a.byteLength=b,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)w(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},a.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?R(this,0,t):v.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},a.prototype.compare=function(t,e,r,i,n){if(X(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);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),h=Math.min(o,s),u=this.slice(i,n),f=t.slice(e,r),l=0;l<h;++l)if(u[l]!==f[l]){o=u[l],s=f[l];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return _(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return _(this,t,e,r,!1)},a.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(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 S(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":return k(this,t,e,r);case"latin1":case"binary":return A(this,t,e,r);case"base64":return O(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function P(t){var e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);for(var r="",i=0;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=C));return r}function x(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function N(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function B(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=e;o<r;++o)n+=K(t[o]);return n}function L(t,e,r){for(var i=t.slice(e,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function D(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function j(t,e,r,i,n,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function U(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 q(t,e,r,n,o){return e=+e,r>>>=0,o||U(t,e,r,4),i.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,o){return e=+e,r>>>=0,o||U(t,e,r,8),i.write(t,e,r,n,52,8),r+8}a.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var i=this.subarray(t,e);return i.__proto__=a.prototype,i},a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i},a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},a.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||D(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},a.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||D(t,4,this.length),i.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),i.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),i.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),i.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||j(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o<r&&(n*=256);)this[e+o]=t/n&255;return e+r},a.prototype.writeUIntBE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||j(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);j(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},a.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);j(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},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return q(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return q(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,i){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n=i-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,i);else if(this===t&&r<e&&e<i)for(var o=n-1;o>=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,i),e);return n},a.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var n=t.charCodeAt(0);("utf8"===i&&n<128||"latin1"===i)&&(t=n)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=a.isBuffer(t)?t:a.from(t,i),h=s.length;if(0===h)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%h]}return this};var z=/[^+/0-9A-Za-z-_]/g;function H(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function K(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],s=0;s<i;++s){if((r=t.charCodeAt(s))>55295&&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 G(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function W(t,e){for(var r,i,n,o=[],s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n=r%256,o.push(n),o.push(i);return o}function Y(t){return e.toByteArray(H(t))}function Z(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Q(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(t,e,r){(function(i){(function(){function n(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let i=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(t=>{"%%"!==t&&(i++,"%c"===t&&(n=i))})),t.splice(n,0,r)}function s(t){try{t?r.storage.setItem("debug",t):r.storage.removeItem("debug")}catch(t){}}function a(){let t;try{t=r.storage.getItem("debug")}catch(t){}return!t&&void 0!==i&&"env"in i&&(t=i.env.DEBUG),t}function h(){try{return localStorage}catch(t){}}r.formatArgs=o,r.save=s,r.load=a,r.useColors=n,r.storage=h(),r.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),e.exports=t("./common")(r);const{formatters:u}=e.exports;u.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this)}).call(this,t("_process"))},{"./common":19,_process:50}],19:[function(t,e,r){function i(e){function r(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return i.colors[Math.abs(e)%i.colors.length]}function i(t){let e,r,o,s=null;function a(...t){if(!a.enabled)return;const r=a,n=Number(new Date),o=n-(e||n);r.diff=o,r.prev=e,r.curr=n,e=n,t[0]=i.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let s=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,((e,n)=>{if("%%"===e)return"%";s++;const o=i.formatters[n];if("function"==typeof o){const i=t[s];e=o.call(r,i),t.splice(s,1),s--}return e})),i.formatArgs.call(r,t),(r.log||i.log).apply(r,t)}return a.namespace=t,a.useColors=i.useColors(),a.color=i.selectColor(t),a.extend=n,a.destroy=i.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(r!==i.namespaces&&(r=i.namespaces,o=i.enabled(t)),o),set:t=>{s=t}}),"function"==typeof i.init&&i.init(a),a}function n(t,e){const r=i(this.namespace+(void 0===e?":":e)+t);return r.log=this.log,r}function o(t){let e;i.save(t),i.namespaces=t,i.names=[],i.skips=[];const r=("string"==typeof t?t:"").split(/[\s,]+/),n=r.length;for(e=0;e<n;e++)r[e]&&("-"===(t=r[e].replace(/\*/g,".*?"))[0]?i.skips.push(new RegExp("^"+t.substr(1)+"$")):i.names.push(new RegExp("^"+t+"$")))}function s(){const t=[...i.names.map(h),...i.skips.map(h).map((t=>"-"+t))].join(",");return i.enable(""),t}function a(t){if("*"===t[t.length-1])return!0;let e,r;for(e=0,r=i.skips.length;e<r;e++)if(i.skips[e].test(t))return!1;for(e=0,r=i.names.length;e<r;e++)if(i.names[e].test(t))return!0;return!1}function h(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}function u(t){return t instanceof Error?t.stack||t.message:t}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return i.debug=i,i.default=i,i.coerce=u,i.disable=s,i.enable=o,i.enabled=a,i.humanize=t("ms"),i.destroy=f,Object.keys(e).forEach((t=>{i[t]=e[t]})),i.names=[],i.skips=[],i.formatters={},i.selectColor=r,i.enable(i.load()),i}e.exports=i},{ms:45}],20:[function(t,e,r){(function(r,i){(function(){var n=t("readable-stream"),o=t("end-of-stream"),s=t("inherits"),a=t("stream-shift"),h=i.from&&i.from!==Uint8Array.from?i.from([0]):new i([0]),u=function(t,e){t._corked?t.once("uncork",e):e()},f=function(t,e){t._autoDestroy&&t.destroy(e)},l=function(t,e){return function(r){r?f(t,"premature close"===r.message?null:r):e&&!t._ended&&t.end()}},c=function(t,e){return t?t._writableState&&t._writableState.finished?e():t._writableState?t.end(e):(t.end(),void e()):e()},d=function(){},p=function(t){return new n.Readable({objectMode:!0,highWaterMark:16}).wrap(t)},m=function(t,e,r){if(!(this instanceof m))return new m(t,e,r);n.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||!1!==r.autoDestroy,this._forwardDestroy=!r||!1!==r.destroy,this._forwardEnd=!r||!1!==r.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,t&&this.setWritable(t),e&&this.setReadable(e)};s(m,n.Duplex),m.obj=function(t,e,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new m(t,e,r)},m.prototype.cork=function(){1==++this._corked&&this.emit("cork")},m.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},m.prototype.setWritable=function(t){if(this._unwrite&&this._unwrite(),this.destroyed)t&&t.destroy&&t.destroy();else if(null!==t&&!1!==t){var e=this,i=o(t,{writable:!0,readable:!1},l(this,this._forwardEnd)),n=function(){var t=e._ondrain;e._ondrain=null,t&&t()},s=function(){e._writable.removeListener("drain",n),i()};this._unwrite&&r.nextTick(n),this._writable=t,this._writable.on("drain",n),this._unwrite=s,this.uncork()}else this.end()},m.prototype.setReadable=function(t){if(this._unread&&this._unread(),this.destroyed)t&&t.destroy&&t.destroy();else{if(null===t||!1===t)return this.push(null),void this.resume();var e=this,r=o(t,{writable:!1,readable:!0},l(this)),i=function(){e._forward()},n=function(){e.push(null)},s=function(){e._readable2.removeListener("readable",i),e._readable2.removeListener("end",n),r()};this._drained=!0,this._readable=t,this._readable2=t._readableState?t:p(t),this._readable2.on("readable",i),this._readable2.on("end",n),this._unread=s,this._forward()}},m.prototype._read=function(){this._drained=!0,this._forward()},m.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var t;for(this._forwarding=!0;this._drained&&null!==(t=a(this._readable2));)this.destroyed||(this._drained=this.push(t));this._forwarding=!1}},m.prototype.destroy=function(t,e){if(e||(e=d),this.destroyed)return e(null);this.destroyed=!0;var i=this;r.nextTick((function(){i._destroy(t),e(null)}))},m.prototype._destroy=function(t){if(t){var e=this._ondrain;this._ondrain=null,e?e(t):this.emit("error",t)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},m.prototype._write=function(t,e,r){if(!this.destroyed)return this._corked?u(this,this._write.bind(this,t,e,r)):t===h?this._finish(r):this._writable?void(!1===this._writable.write(t)?this._ondrain=r:this.destroyed||r()):r()},m.prototype._finish=function(t){var e=this;this.emit("preend"),u(this,(function(){c(e._forwardEnd&&e._writable,(function(){!1===e._writableState.prefinished&&(e._writableState.prefinished=!0),e.emit("prefinish"),u(e,t)}))}))},m.prototype.end=function(t,e,r){return"function"==typeof t?this.end(null,null,t):"function"==typeof e?this.end(t,null,e):(this._ended=!0,t&&this.write(t),this._writableState.ending||this._writableState.destroyed||this.write(h),n.Writable.prototype.end.call(this,r))},e.exports=m}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(t,e,r){(function(r){(function(){var i=t("once"),n=function(){},o=function(t){return t.setHeader&&"function"==typeof t.abort},s=function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length},a=function(t,e,h){if("function"==typeof e)return a(t,null,e);e||(e={}),h=i(h||n);var u=t._writableState,f=t._readableState,l=e.readable||!1!==e.readable&&t.readable,c=e.writable||!1!==e.writable&&t.writable,d=!1,p=function(){t.writable||m()},m=function(){c=!1,l||h.call(t)},g=function(){l=!1,c||h.call(t)},y=function(e){h.call(t,e?new Error("exited with error code: "+e):null)},b=function(e){h.call(t,e)},v=function(){r.nextTick(w)},w=function(){if(!d)return(!l||f&&f.ended&&!f.destroyed)&&(!c||u&&u.ended&&!u.destroyed)?void 0:h.call(t,new Error("premature close"))},_=function(){t.req.on("finish",m)};return o(t)?(t.on("complete",m),t.on("abort",v),t.req?_():t.on("request",_)):c&&!u&&(t.on("end",p),t.on("close",p)),s(t)&&t.on("exit",y),t.on("end",g),t.on("finish",m),!1!==e.error&&t.on("error",b),t.on("close",v),function(){d=!0,t.removeListener("complete",m),t.removeListener("abort",v),t.removeListener("request",_),t.req&&t.req.removeListener("finish",m),t.removeListener("end",p),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("exit",y),t.removeListener("end",g),t.removeListener("error",b),t.removeListener("close",v)}};e.exports=a}).call(this)}).call(this,t("_process"))},{_process:50,once:48}],22:[function(t,e,r){var i=Object.create||E,n=Object.keys||k,o=Function.prototype.bind||A;function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=i(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var a,h=10;try{var u={};Object.defineProperty&&Object.defineProperty(u,"x",{value:0}),a=0===u.x}catch(t){a=!1}function f(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function l(t,e,r){if(e)t.call(r);else for(var i=t.length,n=M(t,i),o=0;o<i;++o)n[o].call(r)}function c(t,e,r,i){if(e)t.call(r,i);else for(var n=t.length,o=M(t,n),s=0;s<n;++s)o[s].call(r,i)}function d(t,e,r,i,n){if(e)t.call(r,i,n);else for(var o=t.length,s=M(t,o),a=0;a<o;++a)s[a].call(r,i,n)}function p(t,e,r,i,n,o){if(e)t.call(r,i,n,o);else for(var s=t.length,a=M(t,s),h=0;h<s;++h)a[h].call(r,i,n,o)}function m(t,e,r,i){if(e)t.apply(r,i);else for(var n=t.length,o=M(t,n),s=0;s<n;++s)o[s].apply(r,i)}function g(t,e,r,n){var o,s,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((s=t._events)?(s.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),a=s[e]):(s=t._events=i(null),t._eventsCount=0),a){if("function"==typeof a?a=s[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),!a.warned&&(o=f(t))&&o>0&&a.length>o){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",h.name,h.message)}}else a=s[e]=r,++t._eventsCount;return t}function y(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e<t.length;++e)t[e]=arguments[e];this.listener.apply(this.target,t)}}function b(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=o.call(y,i);return n.listener=r,i.wrapFn=n,n}function v(t,e,r){var i=t._events;if(!i)return[];var n=i[e];return n?"function"==typeof n?r?[n.listener||n]:[n]:r?S(n):M(n,n.length):[]}function w(t){var e=this._events;if(e){var r=e[t];if("function"==typeof r)return 1;if(r)return r.length}return 0}function _(t,e){for(var r=e,i=r+1,n=t.length;i<n;r+=1,i+=1)t[r]=t[i];t.pop()}function M(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function S(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function E(t){var e=function(){};return e.prototype=t,new e}function k(t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e);return e}function A(t){var e=this;return function(){return e.apply(t,arguments)}}a?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return h},set:function(t){if("number"!=typeof t||t<0||t!=t)throw new TypeError('"defaultMaxListeners" must be a positive number');h=t}}):s.defaultMaxListeners=h,s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return f(this)},s.prototype.emit=function(t){var e,r,i,n,o,s,a="error"===t;if(s=this._events)a=a&&null==s.error;else if(!a)return!1;if(a){if(arguments.length>1&&(e=arguments[1]),e instanceof Error)throw e;var h=new Error('Unhandled "error" event. ('+e+")");throw h.context=e,h}if(!(r=s[t]))return!1;var u="function"==typeof r;switch(i=arguments.length){case 1:l(r,u,this);break;case 2:c(r,u,this,arguments[1]);break;case 3:d(r,u,this,arguments[1],arguments[2]);break;case 4:p(r,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(n=new Array(i-1),o=1;o<i;o++)n[o-1]=arguments[o];m(r,u,this,n)}return!0},s.prototype.addListener=function(t,e){return g(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return g(this,t,e,!0)},s.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.on(t,b(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.prependListener(t,b(this,t,e)),this},s.prototype.removeListener=function(t,e){var r,n,o,s,a;if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=i(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===e||r[s].listener===e){a=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():_(r,o),1===r.length&&(n[t]=r[0]),n.removeListener&&this.emit("removeListener",t,a||e)}return this},s.prototype.removeAllListeners=function(t){var e,r,o;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=i(null),this._eventsCount=0):r[t]&&(0==--this._eventsCount?this._events=i(null):delete r[t]),this;if(0===arguments.length){var s,a=n(r);for(o=0;o<a.length;++o)"removeListener"!==(s=a[o])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=i(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(e)for(o=e.length-1;o>=0;o--)this.removeListener(t,e[o]);return this},s.prototype.listeners=function(t){return v(this,t,!0)},s.prototype.rawListeners=function(t){return v(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):w.call(t,e)},s.prototype.listenerCount=w,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(t,e,r){
4
4
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
5
5
  r.read=function(t,e,r,i,n){var o,s,a=8*n-i-1,h=(1<<a)-1,u=h>>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-u;else{if(o===h)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=u}return(d?-1:1)*s*Math.pow(2,o-i)},r.write=function(t,e,r,i,n,o){var s,a,h,u=8*o-n-1,f=(1<<u)-1,l=f>>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*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+l>=1?c/h:c*Math.pow(2,1-l))*h>=2&&(s++,h/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*h-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<<n|a,u+=n;u>0;t[r+d]=255&s,d+=p,s/=256,u-=8);t[r+d-p]|=128*m}},{}],24:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],25:[function(t,e,r){Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function t(t,e){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=t,this.value=e}return t.prototype.rotateLeft=function(){var t=this.parent,e=this.brother,r=this.leftChild,i=this.rightChild;if(!i)throw new Error("unknown error");var n=i.leftChild,o=i.rightChild;return t&&(t.leftChild===this?t.leftChild=i:t.rightChild===this&&(t.rightChild=i)),i.parent=t,i.brother=e,i.leftChild=this,i.rightChild=o,e&&(e.brother=i),this.parent=i,this.brother=o,this.leftChild=r,this.rightChild=n,o&&(o.parent=i,o.brother=this),r&&(r.parent=this,r.brother=n),n&&(n.parent=this,n.brother=r),i},t.prototype.rotateRight=function(){var t=this.parent,e=this.brother,r=this.leftChild;if(!r)throw new Error("unknown error");var i=this.rightChild,n=r.leftChild,o=r.rightChild;return t&&(t.leftChild===this?t.leftChild=r:t.rightChild===this&&(t.rightChild=r)),r.parent=t,r.brother=e,r.leftChild=n,r.rightChild=this,e&&(e.brother=r),n&&(n.parent=r,n.brother=this),this.parent=r,this.brother=n,this.leftChild=o,this.rightChild=i,o&&(o.parent=this,o.brother=i),i&&(i.parent=this,i.brother=o),r},t.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},t.TreeNodeColorType={red:!0,black:!1},t}();Object.freeze(i),r.default=i},{}],26:[function(t,e,r){var i=this&&this.__generator||function(t,e){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return h([t,e])}}function h(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}};function n(t){var e=this;void 0===t&&(t=[]);var r=[],o=0,s=0,a=0,h=0,u=0,f=0;this.size=function(){return f},this.empty=function(){return 0===f},this.clear=function(){o=a=s=h=u=f=0,c.call(this,n.bucketSize),f=0},this.front=function(){return r[o][s]},this.back=function(){return r[a][h]},this.forEach=function(t){if(!this.empty()){var e=0;if(o!==a){for(u=s;u<n.bucketSize;++u)t(r[o][u],e++);for(u=o+1;u<a;++u)for(var i=0;i<n.bucketSize;++i)t(r[u][i],e++);for(u=0;u<=h;++u)t(r[a][u],e++)}else for(var u=s;u<=h;++u)t(r[o][u],e++)}};var l=function(t){var e=o*n.bucketSize+s,r=e+t,i=a*n.bucketSize+h;if(r<e||r>i)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(r/n.bucketSize),curNodePointerIndex:r%n.bucketSize}};this.getElementByPos=function(t){var e=l(t),i=e.curNodeBucketIndex,n=e.curNodePointerIndex;return r[i][n]},this.eraseElementByPos=function(t){var e=this;if(t<0||t>f)throw new Error("pos should more than 0 and less than queue's size");if(0===t)this.popFront();else if(t===this.size())this.popBack();else{for(var r=[],i=t+1;i<f;++i)r.push(this.getElementByPos(i));this.cut(t),this.popBack(),r.forEach((function(t){return e.pushBack(t)}))}},this.eraseElementByValue=function(t){if(!this.empty()){var e=[];this.forEach((function(r){r!==t&&e.push(r)}));for(var r=e.length,i=0;i<r;++i)this.setElementByPos(i,e[i]);this.cut(r-1)}};var c=function(t){for(var e=[],i=t*n.sigma,l=Math.max(Math.ceil(i/n.bucketSize),2),c=0;c<l;++c)e.push(new Array(n.bucketSize));var d=Math.ceil(t/n.bucketSize),p=Math.floor(l/2)-Math.floor(d/2),m=p,g=0;if(this.size())for(c=0;c<d;++c){for(var y=0;y<n.bucketSize;++y)if(e[p+c][y]=this.front(),this.popFront(),this.empty()){m=p+c,g=y;break}if(this.empty())break}r=e,o=p,s=0,a=m,h=g,u=l,f=t};this.pushBack=function(t){this.empty()||(a===u-1&&h===n.bucketSize-1&&c.call(this,this.size()),h<n.bucketSize-1?++h:a<u-1&&(++a,h=0)),++f,r[a][h]=t},this.popBack=function(){this.empty()||(1!==this.size()&&(h>0?--h:o<a&&(--a,h=n.bucketSize-1)),f>0&&--f)},this.setElementByPos=function(t,e){var i=l(t),n=i.curNodeBucketIndex,o=i.curNodePointerIndex;r[n][o]=e},this.insert=function(t,e,r){var i=this;if(void 0===r&&(r=1),0===t)for(;r--;)this.pushFront(e);else if(t===this.size())for(;r--;)this.pushBack(e);else{for(var n=[],o=t;o<f;++o)n.push(this.getElementByPos(o));for(this.cut(t-1),o=0;o<r;++o)this.pushBack(e);n.forEach((function(t){return i.pushBack(t)}))}},this.find=function(t){if(o===a){for(var e=s;e<=h;++e)if(r[o][e]===t)return!0;return!1}for(e=s;e<n.bucketSize;++e)if(r[o][e]===t)return!0;for(e=o+1;e<a;++e)for(var i=0;i<n.bucketSize;++i)if(r[e][i]===t)return!0;for(e=0;e<=h;++e)if(r[a][e]===t)return!0;return!1},this.reverse=function(){for(var t=0,e=f-1;t<e;){var r=this.getElementByPos(t);this.setElementByPos(t,this.getElementByPos(e)),this.setElementByPos(e,r),++t,--e}},this.unique=function(){if(!this.empty()){var t=[],e=this.front();this.forEach((function(r,i){0!==i&&r===e||(t.push(r),e=r)}));for(var r=0;r<f;++r)this.setElementByPos(r,t[r]);this.cut(t.length-1)}},this.sort=function(t){var e=[];this.forEach((function(t){e.push(t)})),e.sort(t);for(var r=0;r<f;++r)this.setElementByPos(r,e[r])},this.pushFront=function(t){this.empty()||(0===o&&0===s&&c.call(this,this.size()),s>0?--s:o>0&&(--o,s=n.bucketSize-1)),++f,r[o][s]=t},this.popFront=function(){this.empty()||(1!==this.size()&&(s<n.bucketSize-1?++s:o<a&&(++o,s=0)),f>0&&--f)},this.shrinkToFit=function(){var t=this,e=[];this.forEach((function(t){e.push(t)}));var i=e.length;r=[];for(var o=Math.ceil(i/n.bucketSize),s=0;s<o;++s)r.push(new Array(n.bucketSize));this.clear(),e.forEach((function(e){return t.pushBack(e)}))},this.cut=function(t){if(t<0)this.clear();else{var e=l(t),r=e.curNodeBucketIndex,i=e.curNodePointerIndex;a=r,h=i,f=t+1}},this[Symbol.iterator]=function(){return function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(0===f)return[2];if(o!==a)return[3,5];e=s,i.label=1;case 1:return e<=h?[4,r[o][e]]:[3,4];case 2:i.sent(),i.label=3;case 3:return++e,[3,1];case 4:return[2];case 5:e=s,i.label=6;case 6:return e<n.bucketSize?[4,r[o][e]]:[3,9];case 7:i.sent(),i.label=8;case 8:return++e,[3,6];case 9:e=o+1,i.label=10;case 10:if(!(e<a))return[3,15];t=0,i.label=11;case 11:return t<n.bucketSize?[4,r[e][t]]:[3,14];case 12:i.sent(),i.label=13;case 13:return++t,[3,11];case 14:return++e,[3,10];case 15:e=0,i.label=16;case 16:return e<=h?[4,r[a][e]]:[3,19];case 17:i.sent(),i.label=18;case 18:return++e,[3,16];case 19:return[2]}}))}()},function(){var i=n.bucketSize;t.size?i=t.size():t.length&&(i=t.length);var s=i*n.sigma;u=Math.ceil(s/n.bucketSize),u=Math.max(u,3);for(var h=0;h<u;++h)r.push(new Array(n.bucketSize));var f=Math.ceil(i/n.bucketSize);o=Math.floor(u/2)-Math.floor(f/2),a=o,t.forEach((function(t){return e.pushBack(t)}))}(),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),n.sigma=3,n.bucketSize=5e3,Object.freeze(n),r.default=n},{}],27:[function(t,e,r){var i=this&&this.__generator||function(t,e){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return h([t,e])}}function h(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var o=t("../LinkList/LinkList"),s=t("../Map/Map");function a(t,e,r){var h=this;if(void 0===t&&(t=[]),void 0===e&&(e=a.initSize),r=r||function(t){var e,r,i=0,o="";if("number"==typeof t)i=((i=Math.floor(t))<<5)-i,i&=i;else{o="string"!=typeof t?JSON.stringify(t):t;try{for(var s=n(o),a=s.next();!a.done;a=s.next())i=(i<<5)-i+a.value.charCodeAt(0),i&=i}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}}return i^=i>>>16},0!=(e&e-1))throw new Error("initBucketNum must be 2 to the power of n");var u=0,f=[],l=Math.max(a.initSize,Math.min(a.maxSize,e));this.size=function(){return u},this.empty=function(){return 0===u},this.clear=function(){u=0,l=e,f=[]},this.forEach=function(t){var e=0;f.forEach((function(r){r.forEach((function(r){t(r,e++)}))}))};var c=function(t){if(!(t>=a.maxSize)){l=2*t;var e=[];f.forEach((function(i,n){if(!i.empty()){if(i instanceof o.default&&1===i.size()){var h=i.front(),u=h.key,c=h.value;e[r(u)&l-1]=new o.default([{key:u,value:c}])}else if(i instanceof s.default){var d=new o.default,p=new o.default;i.forEach((function(e){0==(r(e.key)&t)?d.pushBack(e):p.pushBack(e)})),d.size()>a.untreeifyThreshold?e[n]=new s.default(d):d.size()&&(e[n]=d),p.size()>a.untreeifyThreshold?e[n+t]=new s.default(p):p.size()&&(e[n+t]=p)}else{var m=new o.default,g=new o.default;i.forEach((function(e){0==(r(e.key)&t)?m.pushBack(e):g.pushBack(e)})),m.size()&&(e[n]=m),g.size()&&(e[n+t]=g)}f[n].clear()}})),f=e}};this.setElement=function(t,e){var i,h;if(null==t)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!=e){var d=r(t)&l-1;if(f[d]){var p=f[d].size();if(f[d]instanceof o.default){try{for(var m=n(f[d]),g=m.next();!g.done;g=m.next()){var y=g.value;if(y.key===t)return void(y.value=e)}}catch(t){i={error:t}}finally{try{g&&!g.done&&(h=m.return)&&h.call(m)}finally{if(i)throw i.error}}f[d].pushBack({key:t,value:e}),f[d].size()>=a.treeifyThreshold&&(f[d]=new s.default(f[d]))}else f[d].setElement(t,e);var b=f[d].size();u+=b-p}else++u,f[d]=new o.default([{key:t,value:e}]);u>l*a.sigma&&c.call(this,l)}else this.eraseElementByKey(t)},this.getElementByKey=function(t){var e,i,o=r(t)&l-1;if(f[o]){if(f[o]instanceof s.default)return f[o].getElementByKey(t);try{for(var a=n(f[o]),h=a.next();!h.done;h=a.next()){var u=h.value;if(u.key===t)return u.value}}catch(t){e={error:t}}finally{try{h&&!h.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}}},this.eraseElementByKey=function(t){var e,i,h=r(t)&l-1;if(f[h]){var c=f[h].size();if(f[h]instanceof s.default)f[h].eraseElementByKey(t),f[h].size()<=a.untreeifyThreshold&&(f[h]=new o.default(f[h]));else{var d=-1;try{for(var p=n(f[h]),m=p.next();!m.done;m=p.next()){var g=m.value;if(++d,g.key===t){f[h].eraseElementByPos(d);break}}}catch(t){e={error:t}}finally{try{m&&!m.done&&(i=p.return)&&i.call(p)}finally{if(e)throw e.error}}}var y=f[h].size();u+=y-c}},this.find=function(t){var e,i,o=r(t)&l-1;if(!f[o])return!1;if(f[o]instanceof s.default)return f[o].find(t);try{for(var a=n(f[o]),h=a.next();!h.done;h=a.next())if(h.value.key===t)return!0}catch(t){e={error:t}}finally{try{h&&!h.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}return!1},this[Symbol.iterator]=function(){return function(){var t,e,r,o,s,a;return i(this,(function(i){switch(i.label){case 0:t=0,i.label=1;case 1:if(!(t<l))return[3,10];for(;t<l&&!f[t];)++t;if(t>=l)return[3,10];i.label=2;case 2:i.trys.push([2,7,8,9]),s=void 0,e=n(f[t]),r=e.next(),i.label=3;case 3:return r.done?[3,6]:[4,r.value];case 4:i.sent(),i.label=5;case 5:return r=e.next(),[3,3];case 6:return[3,9];case 7:return o=i.sent(),s={error:o},[3,9];case 8:try{r&&!r.done&&(a=e.return)&&a.call(e)}finally{if(s)throw s.error}return[7];case 9:return++t,[3,1];case 10:return[2]}}))}()},t.forEach((function(t){var e=t.key,r=t.value;return h.setElement(e,r)})),Object.freeze(this)}a.initSize=16,a.maxSize=1<<30,a.sigma=.75,a.treeifyThreshold=8,a.untreeifyThreshold=6,a.minTreeifySize=64,Object.freeze(a),r.default=a},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(t,e,r){var i=this&&this.__generator||function(t,e){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return h([t,e])}}function h(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var o=t("../Set/Set"),s=t("../LinkList/LinkList");function a(t,e,r){var h=this;if(void 0===t&&(t=[]),void 0===e&&(e=a.initSize),r=r||function(t){var e=0,r="";if("number"==typeof t)e=((e=Math.floor(t))<<5)-e,e&=e;else{r="string"!=typeof t?JSON.stringify(t):t;for(var i=0;i<r.length;i++)e=(e<<5)-e+r.charCodeAt(i),e&=e}return e^=e>>>16},0!=(e&e-1))throw new Error("initBucketNum must be 2 to the power of n");var u=0,f=[],l=Math.max(a.initSize,Math.min(a.maxSize,e));this.size=function(){return u},this.empty=function(){return 0===u},this.clear=function(){u=0,l=e,f=[]},this.forEach=function(t){var e=0;f.forEach((function(r){r.forEach((function(r){t(r,e++)}))}))};var c=function(t){if(!(t>=a.maxSize)){l=2*t;var e=[];f.forEach((function(i,n){if(!i.empty()){if(i instanceof s.default&&1===i.size()){var h=i.front();if(void 0===h)throw new Error("unknown error");e[r(h)&l-1]=new s.default([h])}else if(i instanceof o.default){var u=new s.default,c=new s.default;i.forEach((function(e){0==(r(e)&t)?u.pushBack(e):c.pushBack(e)})),u.size()>a.untreeifyThreshold?e[n]=new o.default(u):u.size()&&(e[n]=u),c.size()>a.untreeifyThreshold?e[n+t]=new o.default(c):c.size()&&(e[n+t]=c)}else{var d=new s.default,p=new s.default;i.forEach((function(e){0==(r(e)&t)?d.pushBack(e):p.pushBack(e)})),d.size()&&(e[n]=d),p.size()&&(e[n+t]=p)}f[n].clear()}})),f=e}};this.insert=function(t){if(null==t)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var e=r(t)&l-1;if(f[e]){var i=f[e].size();if(f[e]instanceof s.default){if(f[e].find(t))return;f[e].pushBack(t),f[e].size()>=a.treeifyThreshold&&(f[e]=new o.default(f[e]))}else f[e].insert(t);var n=f[e].size();u+=n-i}else f[e]=new s.default([t]),++u;u>l*a.sigma&&c.call(this,l)},this.eraseElementByValue=function(t){var e=r(t)&l-1;if(f[e]){var i=f[e].size();f[e].eraseElementByValue(t),f[e]instanceof o.default&&f[e].size()<=a.untreeifyThreshold&&(f[e]=new s.default(f[e]));var n=f[e].size();u+=n-i}},this.find=function(t){var e=r(t)&l-1;return!!f[e]&&f[e].find(t)},this[Symbol.iterator]=function(){return function(){var t,e,r,o,s,a;return i(this,(function(i){switch(i.label){case 0:t=0,i.label=1;case 1:if(!(t<l))return[3,10];for(;t<l&&!f[t];)++t;if(t>=l)return[3,10];i.label=2;case 2:i.trys.push([2,7,8,9]),s=void 0,e=n(f[t]),r=e.next(),i.label=3;case 3:return r.done?[3,6]:[4,r.value];case 4:i.sent(),i.label=5;case 5:return r=e.next(),[3,3];case 6:return[3,9];case 7:return o=i.sent(),s={error:o},[3,9];case 8:try{r&&!r.done&&(a=e.return)&&a.call(e)}finally{if(s)throw s.error}return[7];case 9:return++t,[3,1];case 10:return[2]}}))}()},t.forEach((function(t){return h.insert(t)})),Object.freeze(this)}a.initSize=16,a.maxSize=1<<30,a.sigma=.75,a.treeifyThreshold=8,a.untreeifyThreshold=6,a.minTreeifySize=64,Object.freeze(a),r.default=a},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(t,e,r){var i=this&&this.__generator||function(t,e){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return h([t,e])}}function h(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}};Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(t){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=t}return t}();function o(t){var e=this;void 0===t&&(t=[]);var r=0,o=void 0,s=void 0;this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){o=s=void 0,r=0},this.front=function(){return null==o?void 0:o.value},this.back=function(){return null==s?void 0:s.value},this.forEach=function(t){for(var e=o,r=0;e;){if(void 0===e.value)throw new Error("unknown error");t(e.value,r++),e=e.next}},this.getElementByPos=function(t){if(t<0||t>=r)throw new Error("pos must more then 0 and less then the list length");for(var e=o;t--&&e;)e=e.next;if(!e||void 0===e.value)throw new Error("unknown error");return e.value},this.eraseElementByPos=function(t){if(t<0||t>=r)throw new Error("erase pos must more then 0 and less then the list length");if(0===t)this.popFront();else if(t===r-1)this.popBack();else{for(var e=o;t--;){if(!(null==e?void 0:e.next))throw new Error("unknown error");e=e.next}if(!e||!e.pre||!e.next)throw new Error("unknown error");var i=e.pre,n=e.next;n.pre=i,i.next=n,r>0&&--r}},this.eraseElementByValue=function(t){for(;o&&o.value===t;)this.popFront();for(;s&&s.value===t;)this.popBack();if(o)for(var e=o;e;){if(e.value===t){var i=e.pre,n=e.next;n&&(n.pre=i),i&&(i.next=n),r>0&&--r}e=e.next}},this.pushBack=function(t){if(null==t)throw new Error("you can't push null or undefined here");++r;var e=new n(t);s?(s.next=e,e.pre=s,s=e):o=s=e},this.popBack=function(){s&&(r>0&&--r,s&&(o===s?o=s=void 0:(s=s.pre)&&(s.next=void 0)))},this.setElementByPos=function(t,e){if(null==e)throw new Error("you can't set null or undefined here");if(t<0||t>=r)throw new Error("pos must more then 0 and less then the list length");for(var i=o;t--;){if(!i)throw new Error("unknown error");i=i.next}i&&(i.value=e)},this.insert=function(t,e,i){if(void 0===i&&(i=1),null==e)throw new Error("you can't insert null or undefined here");if(t<0||t>r)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(i<0)throw new Error("insert size must more than 0");if(0===t)for(;i--;)this.pushFront(e);else if(t===r)for(;i--;)this.pushBack(e);else{for(var s=o,a=1;a<t;++a){if(!(null==s?void 0:s.next))throw new Error("unknown error");s=null==s?void 0:s.next}if(!s)throw new Error("unknown error");var h=s.next;for(r+=i;i--;)s.next=new n(e),s.next.pre=s,s=s.next;s.next=h,h&&(h.pre=s)}},this.find=function(t){for(var e=o;e;){if(e.value===t)return!0;e=e.next}return!1},this.reverse=function(){for(var t=o,e=s,i=0;t&&e&&2*i<r;){var n=t.value;t.value=e.value,e.value=n,t=t.next,e=e.pre,++i}},this.unique=function(){for(var t=o;t;){for(var e=t;e&&e.next&&e.value===e.next.value;)e=e.next,r>0&&--r;t.next=e.next,t.next&&(t.next.pre=t),t=t.next}},this.sort=function(t){var e=[];this.forEach((function(t){e.push(t)})),e.sort(t);var r=o;e.forEach((function(t){r&&(r.value=t,r=r.next)}))},this.pushFront=function(t){if(null==t)throw new Error("you can't push null or undefined here");++r;var e=new n(t);o?(e.next=o,o.pre=e,o=e):o=s=e},this.popFront=function(){o&&(r>0&&--r,o&&(o===s?o=s=void 0:(o=o.next)&&(o.pre=void 0)))},this.merge=function(t){var e=this,i=o;t.forEach((function(t){for(;i&&void 0!==i.value&&i.value<=t;)i=i.next;if(void 0===i)e.pushBack(t),i=s;else if(i===o)e.pushFront(t),i=o;else{++r;var a=i.pre;a&&(a.next=new n(t),a.next.pre=a,a.next.next=i,i&&(i.pre=a.next))}}))},this[Symbol.iterator]=function(){return function(){var t;return i(this,(function(e){switch(e.label){case 0:t=o,e.label=1;case 1:if(void 0===t)return[3,3];if(!t.value)throw new Error("unknown error");return[4,t.value];case 2:return e.sent(),t=t.next,[3,1];case 3:return[2]}}))}()},t.forEach((function(t){return e.pushBack(t)})),Object.freeze(this)}Object.freeze(o),r.default=o},{}],30:[function(t,e,r){var i=this&&this.__generator||function(t,e){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return h([t,e])}}function h(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var o=t("../Base/TreeNode");function s(t,e){var r=this;void 0===t&&(t=[]),e=e||function(t,e){return t<e?-1:t>e?1:0};var s=0,a=new o.default;a.color=o.default.TreeNodeColorType.black,this.size=function(){return s},this.empty=function(){return 0===s},this.clear=function(){s=0,a.key=a.value=void 0,a.leftChild=a.rightChild=a.brother=void 0};var h=function(t){if(!t||void 0===t.key)throw new Error("unknown error");return t.leftChild?h(t.leftChild):t},u=function(t){if(!t||void 0===t.key)throw new Error("unknown error");return t.rightChild?u(t.rightChild):t};this.front=function(){if(!this.empty()){var t=h(a);if(void 0===t.key||void 0===t.value)throw new Error("unknown error");return{key:t.key,value:t.value}}},this.back=function(){if(!this.empty()){var t=u(a);if(void 0===t.key||void 0===t.value)throw new Error("unknown error");return{key:t.key,value:t.value}}},this.forEach=function(t){var e,r,i=0;try{for(var o=n(this),s=o.next();!s.done;s=o.next())t(s.value,i++)}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},this.getElementByPos=function(t){var e,r;if(t<0||t>=this.size())throw new Error("pos must more than 0 and less than set's size");var i=0;try{for(var o=n(this),s=o.next();!s.done;s=o.next()){var a=s.value;if(i===t)return a;++i}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}throw new Error("unknown Error")};var f=function(t,r){if(t&&void 0!==t.key&&void 0!==t.value){var i=e(t.key,r);return 0===i?{key:t.key,value:t.value}:i<0?f(t.rightChild,r):f(t.leftChild,r)||{key:t.key,value:t.value}}};this.lowerBound=function(t){return f(a,t)};var l=function(t,r){if(t&&void 0!==t.key&&void 0!==t.value)return e(t.key,r)<=0?l(t.rightChild,r):l(t.leftChild,r)||{key:t.key,value:t.value}};this.upperBound=function(t){return l(a,t)};var c=function(t,r){if(t&&void 0!==t.key&&void 0!==t.value){var i=e(t.key,r);return 0===i?{key:t.key,value:t.value}:i>0?c(t.leftChild,r):c(t.rightChild,r)||{key:t.key,value:t.value}}};this.reverseLowerBound=function(t){return c(a,t)};var d=function(t,r){if(t&&void 0!==t.key&&void 0!==t.value)return e(t.key,r)>=0?d(t.leftChild,r):d(t.rightChild,r)||{key:t.key,value:t.value}};this.reverseUpperBound=function(t){return d(a,t)};var p=function(t){var e=t.parent;if(!e){if(t===a)return;throw new Error("unknown error")}if(t.color!==o.default.TreeNodeColorType.red){var r=t.brother;if(!r)throw new Error("unknown error");if(t===e.leftChild)if(r.color===o.default.TreeNodeColorType.red){r.color=o.default.TreeNodeColorType.black,e.color=o.default.TreeNodeColorType.red;var i=e.rotateLeft();a===e&&(a=i),p(t)}else r.color===o.default.TreeNodeColorType.black&&(r.rightChild&&r.rightChild.color===o.default.TreeNodeColorType.red?(r.color=e.color,e.color=o.default.TreeNodeColorType.black,r.rightChild&&(r.rightChild.color=o.default.TreeNodeColorType.black),i=e.rotateLeft(),a===e&&(a=i),t.color=o.default.TreeNodeColorType.black):r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||!r.leftChild||r.leftChild.color!==o.default.TreeNodeColorType.red?r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||(r.color=o.default.TreeNodeColorType.red,p(e)):(r.color=o.default.TreeNodeColorType.red,r.leftChild&&(r.leftChild.color=o.default.TreeNodeColorType.black),i=r.rotateRight(),a===r&&(a=i),p(t)));else t===e.rightChild&&(r.color===o.default.TreeNodeColorType.red?(r.color=o.default.TreeNodeColorType.black,e.color=o.default.TreeNodeColorType.red,i=e.rotateRight(),a===e&&(a=i),p(t)):r.color===o.default.TreeNodeColorType.black&&(r.leftChild&&r.leftChild.color===o.default.TreeNodeColorType.red?(r.color=e.color,e.color=o.default.TreeNodeColorType.black,r.leftChild&&(r.leftChild.color=o.default.TreeNodeColorType.black),i=e.rotateRight(),a===e&&(a=i),t.color=o.default.TreeNodeColorType.black):r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||!r.rightChild||r.rightChild.color!==o.default.TreeNodeColorType.red?r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||(r.color=o.default.TreeNodeColorType.red,p(e)):(r.color=o.default.TreeNodeColorType.red,r.rightChild&&(r.rightChild.color=o.default.TreeNodeColorType.black),i=r.rotateLeft(),a===r&&(a=i),p(t))))}else t.color=o.default.TreeNodeColorType.black},m=function(t){for(var e=t;e.leftChild||e.rightChild;){if(e.rightChild){e=h(e.rightChild);var r=t.key;t.key=e.key,e.key=r;var i=t.value;t.value=e.value,e.value=i,t=e}e.leftChild&&(e=u(e.leftChild),r=t.key,t.key=e.key,e.key=r,i=t.value,t.value=e.value,e.value=i,t=e)}p(e),e&&e.remove(),--s,a.color=o.default.TreeNodeColorType.black},g=function(t,e){return!(!t||void 0===t.key)&&(!!g(t.leftChild,e)||!!e(t)||g(t.rightChild,e))};this.eraseElementByPos=function(t){if(t<0||t>=s)throw new Error("pos must more than 0 and less than set's size");var e=0;g(a,(function(r){return t===e?(m(r),!0):(++e,!1)}))},this.eraseElementByKey=function(t){if(!this.empty()){var r=v(a,t);void 0!==r&&void 0!==r.key&&0===e(r.key,t)&&m(r)}};var y=function(t,r){if(!t||void 0===t.key)throw new Error("unknown error");var i=e(r,t.key);return i<0?t.leftChild?y(t.leftChild,r):(t.leftChild=new o.default,t.leftChild.parent=t,t.leftChild.brother=t.rightChild,t.rightChild&&(t.rightChild.brother=t.leftChild),t.leftChild):i>0?t.rightChild?y(t.rightChild,r):(t.rightChild=new o.default,t.rightChild.parent=t,t.rightChild.brother=t.leftChild,t.leftChild&&(t.leftChild.brother=t.rightChild),t.rightChild):t},b=function(t){var e=t.parent;if(!e){if(t===a)return;throw new Error("unknown error")}if(e.color!==o.default.TreeNodeColorType.black&&e.color===o.default.TreeNodeColorType.red){var r=e.brother,i=e.parent;if(!i)throw new Error("unknown error");if(r&&r.color===o.default.TreeNodeColorType.red)r.color=e.color=o.default.TreeNodeColorType.black,i.color=o.default.TreeNodeColorType.red,b(i);else if(!r||r.color===o.default.TreeNodeColorType.black)if(e===i.leftChild)if(t===e.leftChild){e.color=o.default.TreeNodeColorType.black,i.color=o.default.TreeNodeColorType.red;var n=i.rotateRight();i===a&&(a=n)}else t===e.rightChild&&(n=e.rotateLeft(),i===a&&(a=n),b(e));else e===i.rightChild&&(t===e.leftChild?(n=e.rotateRight(),i===a&&(a=n),b(e)):t===e.rightChild&&(e.color=o.default.TreeNodeColorType.black,i.color=o.default.TreeNodeColorType.red,n=i.rotateLeft(),i===a&&(a=n)))}};this.setElement=function(t,r){if(null==t)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!=r){if(this.empty())return++s,a.key=t,a.value=r,void(a.color=o.default.TreeNodeColorType.black);var i=y(a,t);void 0===i.key||0!==e(i.key,t)?(++s,i.key=t,i.value=r,b(i),a.color=o.default.TreeNodeColorType.black):i.value=r}else this.eraseElementByKey(t)};var v=function(t,r){if(t&&void 0!==t.key){var i=e(r,t.key);return i<0?v(t.leftChild,r):i>0?v(t.rightChild,r):t}};this.find=function(t){return!!v(a,t)},this.getElementByKey=function(t){var e=v(a,t);if(void 0===(null==e?void 0:e.key)||void 0===(null==e?void 0:e.value))throw new Error("unknown error");return e.value},this.union=function(t){var e=this;t.forEach((function(t){var r=t.key,i=t.value;return e.setElement(r,i)}))},this.getHeight=function(){if(this.empty())return 0;var t=function(e){return e?Math.max(t(e.leftChild),t(e.rightChild))+1:1};return t(a)};var w=function(t){return i(this,(function(e){switch(e.label){case 0:return t&&void 0!==t.key&&void 0!==t.value?[5,n(w(t.leftChild))]:[2];case 1:return e.sent(),[4,{key:t.key,value:t.value}];case 2:return e.sent(),[5,n(w(t.rightChild))];case 3:return e.sent(),[2]}}))};this[Symbol.iterator]=function(){return w(a)},t.forEach((function(t){var e=t.key,i=t.value;return r.setElement(e,i)})),Object.freeze(this)}Object.freeze(s),r.default=s},{"../Base/TreeNode":25}],31:[function(t,e,r){function i(t,e){void 0===t&&(t=[]),e=e||function(t,e){return t>e?-1:t<e?1:0};var r=[];t.forEach((function(t){return r.push(t)}));var i=r.length,n=function(t,e){if(t<0||t>=i)throw new Error("unknown error");if(e<0||e>=i)throw new Error("unknown error");var n=r[t];r[t]=r[e],r[e]=n},o=function(t){if(t<0||t>=i)throw new Error("unknown error");var o=2*t+1,s=2*t+2;o<i&&e(r[t],r[o])>0&&n(t,o),s<i&&e(r[t],r[s])>0&&n(t,s)};!function(){for(var t=Math.floor((i-1)/2);t>=0;--t)for(var o=t,s=2*o+1;s<i;){var a=s+1,h=s;if(a<i&&e(r[s],r[a])>0&&(h=a),e(r[o],r[h])<=0)break;n(o,h),s=2*(o=h)+1}}(),this.size=function(){return i},this.empty=function(){return 0===i},this.clear=function(){i=0,r.length=0},this.push=function(t){if(r.push(t),1!=++i)for(var n=i-1;n>0;){var s=Math.floor((n-1)/2);if(e(r[s],t)<=0)break;o(s),n=s}},this.pop=function(){if(!this.empty())if(1!==this.size()){var t=r[i-1];--i;for(var n=0;n<this.size();){var o=2*n+1,s=2*n+2;if(o>=this.size())break;var a=o;if(s<this.size()&&e(r[o],r[s])>0&&(a=s),e(r[a],t)>=0)break;r[n]=r[a],n=a}r[n]=t}else--i},this.top=function(){return r[0]},Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(i),r.default=i},{}],32:[function(t,e,r){Object.defineProperty(r,"__esModule",{value:!0});var i=t("../LinkList/LinkList");function n(t){void 0===t&&(t=[]);var e=new i.default(t);this.size=function(){return e.size()},this.empty=function(){return e.empty()},this.clear=function(){e.clear()},this.push=function(t){e.pushBack(t)},this.pop=function(){e.popFront()},this.front=function(){return e.front()},Object.freeze(this)}Object.freeze(n),r.default=n},{"../LinkList/LinkList":29}],33:[function(t,e,r){var i=this&&this.__generator||function(t,e){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return h([t,e])}}function h(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var o=t("../Base/TreeNode");function s(t,e){var r=this;void 0===t&&(t=[]),e=e||function(t,e){return t<e?-1:t>e?1:0};var s=0,a=new o.default;a.color=o.default.TreeNodeColorType.black,this.size=function(){return s},this.empty=function(){return 0===s},this.clear=function(){s=0,a.key=void 0,a.leftChild=a.rightChild=a.brother=a.parent=void 0,a.color=o.default.TreeNodeColorType.black};var h=function(t){if(!t||void 0===t.key)throw new Error("unknown error");return t.leftChild?h(t.leftChild):t},u=function(t){if(!t||void 0===t.key)throw new Error("unknown error");return t.rightChild?u(t.rightChild):t};this.front=function(){if(!this.empty())return h(a).key},this.back=function(){if(!this.empty())return u(a).key},this.forEach=function(t){var e,r,i=0;try{for(var o=n(this),s=o.next();!s.done;s=o.next())t(s.value,i++)}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},this.getElementByPos=function(t){var e,r;if(t<0||t>=this.size())throw new Error("pos must more than 0 and less than set's size");var i=0;try{for(var o=n(this),s=o.next();!s.done;s=o.next()){var a=s.value;if(i===t)return a;++i}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}throw new Error("unknown error")};var f=function(t){var e=t.parent;if(!e){if(t===a)return;throw new Error("unknown error")}if(t.color!==o.default.TreeNodeColorType.red){var r=t.brother;if(!r)throw new Error("unknown error");if(t===e.leftChild)if(r.color===o.default.TreeNodeColorType.red){r.color=o.default.TreeNodeColorType.black,e.color=o.default.TreeNodeColorType.red;var i=e.rotateLeft();a===e&&(a=i),f(t)}else r.color===o.default.TreeNodeColorType.black&&(r.rightChild&&r.rightChild.color===o.default.TreeNodeColorType.red?(r.color=e.color,e.color=o.default.TreeNodeColorType.black,r.rightChild&&(r.rightChild.color=o.default.TreeNodeColorType.black),i=e.rotateLeft(),a===e&&(a=i),t.color=o.default.TreeNodeColorType.black):r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||!r.leftChild||r.leftChild.color!==o.default.TreeNodeColorType.red?r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||(r.color=o.default.TreeNodeColorType.red,f(e)):(r.color=o.default.TreeNodeColorType.red,r.leftChild&&(r.leftChild.color=o.default.TreeNodeColorType.black),i=r.rotateRight(),a===r&&(a=i),f(t)));else t===e.rightChild&&(r.color===o.default.TreeNodeColorType.red?(r.color=o.default.TreeNodeColorType.black,e.color=o.default.TreeNodeColorType.red,i=e.rotateRight(),a===e&&(a=i),f(t)):r.color===o.default.TreeNodeColorType.black&&(r.leftChild&&r.leftChild.color===o.default.TreeNodeColorType.red?(r.color=e.color,e.color=o.default.TreeNodeColorType.black,r.leftChild&&(r.leftChild.color=o.default.TreeNodeColorType.black),i=e.rotateRight(),a===e&&(a=i),t.color=o.default.TreeNodeColorType.black):r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||!r.rightChild||r.rightChild.color!==o.default.TreeNodeColorType.red?r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||(r.color=o.default.TreeNodeColorType.red,f(e)):(r.color=o.default.TreeNodeColorType.red,r.rightChild&&(r.rightChild.color=o.default.TreeNodeColorType.black),i=r.rotateLeft(),a===r&&(a=i),f(t))))}else t.color=o.default.TreeNodeColorType.black},l=function(t){for(var e=t;e.leftChild||e.rightChild;){if(e.rightChild){e=h(e.rightChild);var r=t.key;t.key=e.key,e.key=r,t=e}e.leftChild&&(e=u(e.leftChild),r=t.key,t.key=e.key,e.key=r,t=e)}f(e),e&&e.remove(),--s,a.color=o.default.TreeNodeColorType.black},c=function(t,e){return!(!t||void 0===t.key)&&(!!c(t.leftChild,e)||!!e(t)||c(t.rightChild,e))};this.eraseElementByPos=function(t){if(t<0||t>=s)throw new Error("pos must more than 0 and less than set's size");var e=0;c(a,(function(r){return t===e?(l(r),!0):(++e,!1)}))},this.eraseElementByValue=function(t){if(!this.empty()){var r=m(a,t);void 0!==r&&void 0!==r.key&&0===e(r.key,t)&&l(r)}};var d=function(t,r){if(!t||void 0===t.key)throw new Error("unknown error");var i=e(r,t.key);return i<0?t.leftChild?d(t.leftChild,r):(t.leftChild=new o.default,t.leftChild.parent=t,t.leftChild.brother=t.rightChild,t.rightChild&&(t.rightChild.brother=t.leftChild),t.leftChild):i>0?t.rightChild?d(t.rightChild,r):(t.rightChild=new o.default,t.rightChild.parent=t,t.rightChild.brother=t.leftChild,t.leftChild&&(t.leftChild.brother=t.rightChild),t.rightChild):t},p=function(t){var e=t.parent;if(!e){if(t===a)return;throw new Error("unknown error")}if(e.color!==o.default.TreeNodeColorType.black&&e.color===o.default.TreeNodeColorType.red){var r=e.brother,i=e.parent;if(!i)throw new Error("unknown error");if(r&&r.color===o.default.TreeNodeColorType.red)r.color=e.color=o.default.TreeNodeColorType.black,i.color=o.default.TreeNodeColorType.red,p(i);else if(!r||r.color===o.default.TreeNodeColorType.black)if(e===i.leftChild)if(t===e.leftChild){e.color=o.default.TreeNodeColorType.black,i.color=o.default.TreeNodeColorType.red;var n=i.rotateRight();i===a&&(a=n)}else t===e.rightChild&&(n=e.rotateLeft(),i===a&&(a=n),p(e));else e===i.rightChild&&(t===e.leftChild?(n=e.rotateRight(),i===a&&(a=n),p(e)):t===e.rightChild&&(e.color=o.default.TreeNodeColorType.black,i.color=o.default.TreeNodeColorType.red,n=i.rotateLeft(),i===a&&(a=n)))}};this.insert=function(t){if(null==t)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++s,a.key=t,void(a.color=o.default.TreeNodeColorType.black);var r=d(a,t);void 0!==r.key&&0===e(r.key,t)||(++s,r.key=t,p(r),a.color=o.default.TreeNodeColorType.black)};var m=function(t,r){if(t&&void 0!==t.key){var i=e(r,t.key);return i<0?m(t.leftChild,r):i>0?m(t.rightChild,r):t}};this.find=function(t){var r=m(a,t);return void 0!==r&&void 0!==r.key&&0===e(r.key,t)};var g=function(t,r){if(t&&void 0!==t.key){var i=e(t.key,r);if(0===i)return t.key;if(i<0)return g(t.rightChild,r);var n=g(t.leftChild,r);return void 0!==n?n:t.key}};this.lowerBound=function(t){return g(a,t)};var y=function(t,r){if(t&&void 0!==t.key){if(e(t.key,r)<=0)return y(t.rightChild,r);var i=y(t.leftChild,r);return void 0!==i?i:t.key}};this.upperBound=function(t){return y(a,t)};var b=function(t,r){if(t&&void 0!==t.key){var i=e(t.key,r);if(0===i)return t.key;if(i>0)return b(t.leftChild,r);var n=b(t.rightChild,r);return void 0!==n?n:t.key}};this.reverseLowerBound=function(t){return b(a,t)};var v=function(t,r){if(t&&void 0!==t.key){if(e(t.key,r)>=0)return v(t.leftChild,r);var i=v(t.rightChild,r);return void 0!==i?i:t.key}};this.reverseUpperBound=function(t){return v(a,t)},this.union=function(t){var e=this;t.forEach((function(t){return e.insert(t)}))},this.getHeight=function(){if(this.empty())return 0;var t=function(e){return e?Math.max(t(e.leftChild),t(e.rightChild))+1:1};return t(a)};var w=function(t){return i(this,(function(e){switch(e.label){case 0:return t&&void 0!==t.key?[5,n(w(t.leftChild))]:[2];case 1:return e.sent(),[4,t.key];case 2:return e.sent(),[5,n(w(t.rightChild))];case 3:return e.sent(),[2]}}))};this[Symbol.iterator]=function(){return w(a)},t.forEach((function(t){return r.insert(t)})),Object.freeze(this)}Object.freeze(s),r.default=s},{"../Base/TreeNode":25}],34:[function(t,e,r){function i(t){var e=this;void 0===t&&(t=[]);var r=0,i=[];this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){r=0,i.length=0},this.push=function(t){i.push(t),++r},this.pop=function(){i.pop(),r>0&&--r},this.top=function(){return i[r-1]},t.forEach((function(t){return e.push(t)})),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(i),r.default=i},{}],35:[function(t,e,r){var i=this&&this.__generator||function(t,e){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return h([t,e])}}function h(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function a(t){var e=this;void 0===t&&(t=[]);var r=0,a=[];this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){r=0,a.length=0},this.front=function(){if(!this.empty())return a[0]},this.back=function(){if(!this.empty())return a[r-1]},this.forEach=function(t){a.forEach(t)},this.getElementByPos=function(t){if(t<0||t>=r)throw new Error("pos must more than 0 and less than vector's size");return a[t]},this.eraseElementByPos=function(t){if(t<0||t>=r)throw new Error("pos must more than 0 and less than vector's size");for(var e=t;e<r-1;++e)a[e]=a[e+1];this.popBack()},this.eraseElementByValue=function(t){var e=[];this.forEach((function(r){r!==t&&e.push(r)})),e.forEach((function(t,e){a[e]=t}));for(var i=e.length;r>i;)this.popBack()},this.pushBack=function(t){a.push(t),++r},this.popBack=function(){a.pop(),r>0&&--r},this.setElementByPos=function(t,e){if(t<0||t>=r)throw new Error("pos must more than 0 and less than vector's size");a[t]=e},this.insert=function(t,e,i){if(void 0===i&&(i=1),t<0||t>r)throw new Error("pos must more than 0 and less than or equal to vector's size");a.splice.apply(a,o([t,0],n(new Array(i).fill(e)),!1)),r+=i},this.find=function(t){return a.includes(t)},this.reverse=function(){a.reverse()},this.unique=function(){var t,e=[];this.forEach((function(r,i){0!==i&&r===t||(e.push(r),t=r)})),e.forEach((function(t,e){a[e]=t}));for(var i=e.length;r>i;)this.popBack()},this.sort=function(t){a.sort(t)},this[Symbol.iterator]=function(){return function(){return i(this,(function(t){switch(t.label){case 0:return[5,s(a)];case 1:return[2,t.sent()]}}))}()},t.forEach((function(t){return e.pushBack(t)})),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(a),r.default=a},{}],36:[function(t,e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.HashMap=r.HashSet=r.Map=r.Set=r.PriorityQueue=r.Deque=r.LinkList=r.Queue=r.Stack=r.Vector=void 0;var i=t("./Vector/Vector");r.Vector=i.default;var n=t("./Stack/Stack");r.Stack=n.default;var o=t("./Queue/Queue");r.Queue=o.default;var s=t("./LinkList/LinkList");r.LinkList=s.default;var a=t("./Deque/Deque");r.Deque=a.default;var h=t("./PriorityQueue/PriorityQueue");r.PriorityQueue=h.default;var u=t("./Set/Set");r.Set=u.default;var f=t("./Map/Map");r.Map=f.default;var l=t("./HashSet/HashSet");r.HashSet=l.default;var c=t("./HashMap/HashMap");r.HashMap=c.default},{"./Deque/Deque":26,"./HashMap/HashMap":27,"./HashSet/HashSet":28,"./LinkList/LinkList":29,"./Map/Map":30,"./PriorityQueue/PriorityQueue":31,"./Queue/Queue":32,"./Set/Set":33,"./Stack/Stack":34,"./Vector/Vector":35}],37:[function(t,e,r){const i=t("yallist"),n=Symbol("max"),o=Symbol("length"),s=Symbol("lengthCalculator"),a=Symbol("allowStale"),h=Symbol("maxAge"),u=Symbol("dispose"),f=Symbol("noDisposeOnSet"),l=Symbol("lruList"),c=Symbol("cache"),d=Symbol("updateAgeOnGet"),p=()=>1;class m{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[n]=t.max||1/0;const e=t.length||p;if(this[s]="function"!=typeof e?p:e,this[a]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[h]=t.maxAge||0,this[u]=t.dispose,this[f]=t.noDisposeOnSet||!1,this[d]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[n]=t||1/0,b(this)}get max(){return this[n]}set allowStale(t){this[a]=!!t}get allowStale(){return this[a]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[h]=t,b(this)}get maxAge(){return this[h]}set lengthCalculator(t){"function"!=typeof t&&(t=p),t!==this[s]&&(this[s]=t,this[o]=0,this[l].forEach((t=>{t.length=this[s](t.value,t.key),this[o]+=t.length}))),b(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[l].length}rforEach(t,e){e=e||this;for(let r=this[l].tail;null!==r;){const i=r.prev;_(this,t,r,e),r=i}}forEach(t,e){e=e||this;for(let r=this[l].head;null!==r;){const i=r.next;_(this,t,r,e),r=i}}keys(){return this[l].toArray().map((t=>t.key))}values(){return this[l].toArray().map((t=>t.value))}reset(){this[u]&&this[l]&&this[l].length&&this[l].forEach((t=>this[u](t.key,t.value))),this[c]=new Map,this[l]=new i,this[o]=0}dump(){return this[l].map((t=>!y(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)})).toArray().filter((t=>t))}dumpLru(){return this[l]}set(t,e,r){if((r=r||this[h])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const i=r?Date.now():0,a=this[s](e,t);if(this[c].has(t)){if(a>this[n])return v(this,this[c].get(t)),!1;const s=this[c].get(t).value;return this[u]&&(this[f]||this[u](t,s.value)),s.now=i,s.maxAge=r,s.value=e,this[o]+=a-s.length,s.length=a,this.get(t),b(this),!0}const d=new w(t,e,a,i,r);return d.length>this[n]?(this[u]&&this[u](t,e),!1):(this[o]+=d.length,this[l].unshift(d),this[c].set(t,this[l].head),b(this),!0)}has(t){if(!this[c].has(t))return!1;const e=this[c].get(t).value;return!y(this,e)}get(t){return g(this,t,!0)}peek(t){return g(this,t,!1)}pop(){const t=this[l].tail;return t?(v(this,t),t.value):null}del(t){v(this,this[c].get(t))}load(t){this.reset();const e=Date.now();for(let r=t.length-1;r>=0;r--){const i=t[r],n=i.e||0;if(0===n)this.set(i.k,i.v);else{const t=n-e;t>0&&this.set(i.k,i.v,t)}}}prune(){this[c].forEach(((t,e)=>g(this,e,!1)))}}const g=(t,e,r)=>{const i=t[c].get(e);if(i){const e=i.value;if(y(t,e)){if(v(t,i),!t[a])return}else r&&(t[d]&&(i.value.now=Date.now()),t[l].unshiftNode(i));return e.value}},y=(t,e)=>{if(!e||!e.maxAge&&!t[h])return!1;const r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[h]&&r>t[h]},b=t=>{if(t[o]>t[n])for(let e=t[l].tail;t[o]>t[n]&&null!==e;){const r=e.prev;v(t,e),e=r}},v=(t,e)=>{if(e){const r=e.value;t[u]&&t[u](r.key,r.value),t[o]-=r.length,t[c].delete(r.key),t[l].removeNode(e)}};class w{constructor(t,e,r,i,n){this.key=t,this.value=e,this.length=r,this.now=i,this.maxAge=n||0}}const _=(t,e,r,i)=>{let n=r.value;y(t,n)&&(v(t,r),t[a]||(n=void 0)),n&&e.call(i,n.value,n.key,t)};e.exports=m},{yallist:83}],38:[function(t,e,r){(function(t){(function(){const r=e.exports;r.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},r.codes={};for(const t in r.types){const e=r.types[t];r.codes[e]=t}r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=t.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=t.from([r.codes.connack<<r.CMD_SHIFT]),r.USERNAME_MASK=128,r.PASSWORD_MASK=64,r.WILL_RETAIN_MASK=32,r.WILL_QOS_MASK=24,r.WILL_QOS_SHIFT=3,r.WILL_FLAG_MASK=4,r.CLEAN_SESSION_MASK=2,r.CONNECT_HEADER=t.from([r.codes.connect<<r.CMD_SHIFT]),r.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},r.propertiesCodes={};for(const t in r.properties){const e=r.properties[t];r.propertiesCodes[e]=t}function i(e){return[0,1,2].map((i=>[0,1].map((n=>[0,1].map((o=>{const s=t.alloc(1);return s.writeUInt8(r.codes[e]<<r.CMD_SHIFT|(n?r.DUP_MASK:0)|i<<r.QOS_SHIFT|o,0,!0),s}))))))}r.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},r.PUBLISH_HEADER=i("publish"),r.SUBSCRIBE_HEADER=i("subscribe"),r.SUBSCRIBE_OPTIONS_QOS_MASK=3,r.SUBSCRIBE_OPTIONS_NL_MASK=1,r.SUBSCRIBE_OPTIONS_NL_SHIFT=2,r.SUBSCRIBE_OPTIONS_RAP_MASK=1,r.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,r.SUBSCRIBE_OPTIONS_RH_MASK=3,r.SUBSCRIBE_OPTIONS_RH_SHIFT=4,r.SUBSCRIBE_OPTIONS_RH=[0,16,32],r.SUBSCRIBE_OPTIONS_NL=4,r.SUBSCRIBE_OPTIONS_RAP=8,r.SUBSCRIBE_OPTIONS_QOS=[0,1,2],r.UNSUBSCRIBE_HEADER=i("unsubscribe"),r.ACKS={unsuback:i("unsuback"),puback:i("puback"),pubcomp:i("pubcomp"),pubrel:i("pubrel"),pubrec:i("pubrec")},r.SUBACK_HEADER=t.from([r.codes.suback<<r.CMD_SHIFT]),r.VERSION3=t.from([3]),r.VERSION4=t.from([4]),r.VERSION5=t.from([5]),r.VERSION131=t.from([131]),r.VERSION132=t.from([132]),r.QOS=[0,1,2].map((e=>t.from([e]))),r.EMPTY={pingreq:t.from([r.codes.pingreq<<4,0]),pingresp:t.from([r.codes.pingresp<<4,0]),disconnect:t.from([r.codes.disconnect<<4,0])}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:17}],39:[function(t,e,r){(function(r){(function(){const i=t("./writeToStream"),n=t("events");function o(t,e){const r=new s;return i(t,r,e),r.concat()}class s extends n{constructor(){super(),this._array=new Array(20),this._i=0}write(t){return this._array[this._i++]=t,!0}concat(){let t=0;const e=new Array(this._array.length),i=this._array;let n,o=0;for(n=0;n<i.length&&void 0!==i[n];n++)"string"!=typeof i[n]?e[n]=i[n].length:e[n]=r.byteLength(i[n]),t+=e[n];const s=r.allocUnsafe(t);for(n=0;n<i.length&&void 0!==i[n];n++)"string"!=typeof i[n]?(i[n].copy(s,o),o+=e[n]):(s.write(i[n],o),o+=e[n]);return s}}e.exports=o}).call(this)}).call(this,t("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(t,e,r){r.parser=t("./parser").parser,r.generate=t("./generate"),r.writeToStream=t("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(t,e,r){(function(t){(function(){const r=65536,i={},n=t.isBuffer(t.from([1,2]).subarray(0,1));function o(e){const r=t.allocUnsafe(2);return r.writeUInt8(e>>8,0),r.writeUInt8(255&e,1),r}function s(){for(let t=0;t<r;t++)i[t]=o(t)}function a(e){const r=4;let i=0,o=0;const s=t.allocUnsafe(r);do{i=e%128|0,(e=e/128|0)>0&&(i|=128),s.writeUInt8(i,o++)}while(e>0&&o<r);return e>0&&(o=0),n?s.subarray(0,o):s.slice(0,o)}function h(e){const r=t.allocUnsafe(4);return r.writeUInt32BE(e,0),r}e.exports={cache:i,generateCache:s,generateNumber:o,genBufVariableByteInt:a,generate4ByteBuffer:h}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:17}],42:[function(t,e,r){class i{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}e.exports=i},{}],43:[function(t,e,r){const i=t("bl"),n=t("events"),o=t("./packet"),s=t("./constants"),a=t("debug")("mqtt-packet:parser");class h extends n{constructor(){super(),this.parser=this.constructor.parser}static parser(t){return this instanceof h?(this.settings=t||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new h).parser(t)}_resetState(){a("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new o,this.error=null,this._list=i(),this._stateCounter=0}parse(t){for(this.error&&this._resetState(),this._list.append(t),a("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,a("parse: state complete. _stateCounter is now: %d",this._stateCounter),a("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return a("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const t=this._list.readUInt8(0);return this.packet.cmd=s.types[t>>s.CMD_SHIFT],this.packet.retain=0!=(t&s.RETAIN_MASK),this.packet.qos=t>>s.QOS_SHIFT&s.QOS_MASK,this.packet.dup=0!=(t&s.DUP_MASK),a("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const t=this._parseVarByteNum(!0);return t&&(this.packet.length=t.value,this._list.consume(t.bytes)),a("_parseLength %d",t.value),!!t}_parsePayload(){a("_parsePayload: payload %O",this._list);let t=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}t=!0}return a("_parsePayload complete result: %s",t),t}_parseConnect(){let t,e,r,i;a("_parseConnect");const n={},o=this.packet,h=this._parseString();if(null===h)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==h&&"MQIsdp"!==h)return this._emitError(new Error("Invalid protocolId"));if(o.protocolId=h,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(o.protocolVersion=this._list.readUInt8(this._pos),o.protocolVersion>=128&&(o.bridgeMode=!0,o.protocolVersion=o.protocolVersion-128),3!==o.protocolVersion&&4!==o.protocolVersion&&5!==o.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(n.username=this._list.readUInt8(this._pos)&s.USERNAME_MASK,n.password=this._list.readUInt8(this._pos)&s.PASSWORD_MASK,n.will=this._list.readUInt8(this._pos)&s.WILL_FLAG_MASK,n.will&&(o.will={},o.will.retain=0!=(this._list.readUInt8(this._pos)&s.WILL_RETAIN_MASK),o.will.qos=(this._list.readUInt8(this._pos)&s.WILL_QOS_MASK)>>s.WILL_QOS_SHIFT),o.clean=0!=(this._list.readUInt8(this._pos)&s.CLEAN_SESSION_MASK),this._pos++,o.keepalive=this._parseNum(),-1===o.keepalive)return this._emitError(new Error("Packet too short"));if(5===o.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(o.properties=t)}const u=this._parseString();if(null===u)return this._emitError(new Error("Packet too short"));if(o.clientId=u,a("_parseConnect: packet.clientId: %s",o.clientId),n.will){if(5===o.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(o.will.properties=t)}if(t=this._parseString(),null===t)return this._emitError(new Error("Cannot parse will topic"));if(o.will.topic=t,a("_parseConnect: packet.will.topic: %s",o.will.topic),e=this._parseBuffer(),null===e)return this._emitError(new Error("Cannot parse will payload"));o.will.payload=e,a("_parseConnect: packet.will.paylaod: %s",o.will.payload)}if(n.username){if(i=this._parseString(),null===i)return this._emitError(new Error("Cannot parse username"));o.username=i,a("_parseConnect: packet.username: %s",o.username)}if(n.password){if(r=this._parseBuffer(),null===r)return this._emitError(new Error("Cannot parse password"));o.password=r}return this.settings=o,a("_parseConnect: complete"),o}_parseConnack(){a("_parseConnack");const t=this.packet;if(this._list.length<1)return null;if(t.sessionPresent=!!(this._list.readUInt8(this._pos++)&s.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?t.reasonCode=this._list.readUInt8(this._pos++):t.reasonCode=0;else{if(this._list.length<2)return null;t.returnCode=this._list.readUInt8(this._pos++)}if(-1===t.returnCode||-1===t.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}a("_parseConnack: complete")}_parsePublish(){a("_parsePublish");const t=this.packet;if(t.topic=this._parseString(),null===t.topic)return this._emitError(new Error("Cannot parse topic"));if(!(t.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}t.payload=this._list.slice(this._pos,t.length),a("_parsePublish: payload from buffer list: %o",t.payload)}}_parseSubscribe(){a("_parseSubscribe");const t=this.packet;let e,r,i,n,o,h,u;if(1!==t.qos)return this._emitError(new Error("Wrong subscribe header"));if(t.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}for(;this._pos<t.length;){if(e=this._parseString(),null===e)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=t.length)return this._emitError(new Error("Malformed Subscribe Payload"));r=this._parseByte(),i=r&s.SUBSCRIBE_OPTIONS_QOS_MASK,h=0!=(r>>s.SUBSCRIBE_OPTIONS_NL_SHIFT&s.SUBSCRIBE_OPTIONS_NL_MASK),o=0!=(r>>s.SUBSCRIBE_OPTIONS_RAP_SHIFT&s.SUBSCRIBE_OPTIONS_RAP_MASK),n=r>>s.SUBSCRIBE_OPTIONS_RH_SHIFT&s.SUBSCRIBE_OPTIONS_RH_MASK,u={topic:e,qos:i},5===this.settings.protocolVersion?(u.nl=h,u.rap=o,u.rh=n):this.settings.bridgeMode&&(u.rh=0,u.rap=!0,u.nl=!0),a("_parseSubscribe: push subscription `%s` to subscription",u),t.subscriptions.push(u)}}}_parseSuback(){a("_parseSuback");const t=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){a("_parseUnsubscribe");const t=this.packet;if(t.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}for(;this._pos<t.length;){const e=this._parseString();if(null===e)return this._emitError(new Error("Cannot parse topic"));a("_parseUnsubscribe: push topic `%s` to unsubscriptions",e),t.unsubscriptions.push(e)}}}_parseUnsuback(){a("_parseUnsuback");const t=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const e=this._parseProperties();for(Object.getOwnPropertyNames(e).length&&(t.properties=e),t.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){a("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const t=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(t.length>2?(t.reasonCode=this._parseByte(),a("_parseConfirmation: packet.reasonCode `%d`",t.reasonCode)):t.reasonCode=0,t.length>3)){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}return!0}_parseDisconnect(){const t=this.packet;if(a("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?t.reasonCode=this._parseByte():t.reasonCode=0;const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}return a("_parseDisconnect result: true"),!0}_parseAuth(){a("_parseAuth");const t=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));t.reasonCode=this._parseByte();const e=this._parseProperties();return Object.getOwnPropertyNames(e).length&&(t.properties=e),a("_parseAuth: result: true"),!0}_parseMessageId(){const t=this.packet;return t.messageId=this._parseNum(),null===t.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(a("_parseMessageId: packet.messageId %d",t.messageId),!0)}_parseString(t){const e=this._parseNum(),r=e+this._pos;if(-1===e||r>this._list.length||r>this.packet.length)return null;const i=this._list.toString("utf8",this._pos,r);return this._pos+=e,a("_parseString: result: %s",i),i}_parseStringPair(){return a("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const t=this._parseNum(),e=t+this._pos;if(-1===t||e>this._list.length||e>this.packet.length)return null;const r=this._list.slice(this._pos,e);return this._pos+=t,a("_parseBuffer: result: %o",r),r}_parseNum(){if(this._list.length-this._pos<2)return-1;const t=this._list.readUInt16BE(this._pos);return this._pos+=2,a("_parseNum: result: %s",t),t}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const t=this._list.readUInt32BE(this._pos);return this._pos+=4,a("_parse4ByteNum: result: %s",t),t}_parseVarByteNum(t){a("_parseVarByteNum");const e=4;let r,i=0,n=1,o=0,h=!1;const u=this._pos?this._pos:0;for(;i<e&&u+i<this._list.length;){if(r=this._list.readUInt8(u+i++),o+=n*(r&s.VARBYTEINT_MASK),n*=128,0==(r&s.VARBYTEINT_FIN_MASK)){h=!0;break}if(this._list.length<=i)break}return!h&&i===e&&this._list.length>=i&&this._emitError(new Error("Invalid variable byte integer")),u&&(this._pos+=i),h=!!h&&(t?{bytes:i,value:o}:o),a("_parseVarByteNum: result: %o",h),h}_parseByte(){let t;return this._pos<this._list.length&&(t=this._list.readUInt8(this._pos),this._pos++),a("_parseByte: result: %o",t),t}_parseByType(t){switch(a("_parseByType: type: %s",t),t){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){a("_parseProperties");const t=this._parseVarByteNum(),e=this._pos+t,r={};for(;this._pos<e;){const t=this._parseByte();if(!t)return this._emitError(new Error("Cannot parse property code type")),!1;const e=s.propertiesCodes[t];if(!e)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==e)r[e]?(Array.isArray(r[e])||(r[e]=[r[e]]),r[e].push(this._parseByType(s.propertiesTypes[e]))):r[e]=this._parseByType(s.propertiesTypes[e]);else{r[e]||(r[e]=Object.create(null));const t=this._parseByType(s.propertiesTypes[e]);if(r[e][t.name])if(Array.isArray(r[e][t.name]))r[e][t.name].push(t.value);else{const i=r[e][t.name];r[e][t.name]=[i],r[e][t.name].push(t.value)}else r[e][t.name]=t.value}}return r}_newPacket(){return a("_newPacket"),this.packet&&(this._list.consume(this.packet.length),a("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),a("_newPacket: new packet"),this.packet=new o,this._pos=0,!0}_emitError(t){a("_emitError"),this.error=t,this.emit("error",t)}}e.exports=h},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(t,e,r){(function(r){(function(){const i=t("./constants"),n=r.allocUnsafe(0),o=r.from([0]),s=t("./numbers"),a=t("process-nextick-args").nextTick,h=t("debug")("mqtt-packet:writeToStream"),u=s.cache,f=s.generateNumber,l=s.generateCache,c=s.genBufVariableByteInt,d=s.generate4ByteBuffer;let p=x,m=!0;function g(t,e,r){switch(h("generate called"),e.cork&&(e.cork(),a(y,e)),m&&(m=!1,l()),h("generate: packet.cmd: %s",t.cmd),t.cmd){case"connect":return b(t,e);case"connack":return v(t,e,r);case"publish":return w(t,e,r);case"puback":case"pubrec":case"pubrel":case"pubcomp":return _(t,e,r);case"subscribe":return M(t,e,r);case"suback":return S(t,e,r);case"unsubscribe":return E(t,e,r);case"unsuback":return k(t,e,r);case"pingreq":case"pingresp":return A(t,e);case"disconnect":return O(t,e,r);case"auth":return T(t,e,r);default:return e.emit("error",new Error("Unknown command")),!1}}function y(t){t.uncork()}function b(t,e,n){const o=t||{},s=o.protocolId||"MQTT";let a=o.protocolVersion||4;const h=o.will;let u=o.clean;const f=o.keepalive||0,l=o.clientId||"",c=o.username,d=o.password,m=o.properties;void 0===u&&(u=!0);let g=0;if(!s||"string"!=typeof s&&!r.isBuffer(s))return e.emit("error",new Error("Invalid protocolId")),!1;if(g+=s.length+2,3!==a&&4!==a&&5!==a)return e.emit("error",new Error("Invalid protocol version")),!1;if(g+=1,("string"==typeof l||r.isBuffer(l))&&(l||a>=4)&&(l||u))g+=r.byteLength(l)+2;else{if(a<4)return e.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*u==0)return e.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof f||f<0||f>65535||f%1!=0)return e.emit("error",new Error("Invalid keepalive")),!1;if(g+=2,g+=1,5===a){var y=D(e,m);if(!y)return!1;g+=y.length}if(h){if("object"!=typeof h)return e.emit("error",new Error("Invalid will")),!1;if(!h.topic||"string"!=typeof h.topic)return e.emit("error",new Error("Invalid will topic")),!1;if(g+=r.byteLength(h.topic)+2,g+=2,h.payload){if(!(h.payload.length>=0))return e.emit("error",new Error("Invalid will payload")),!1;"string"==typeof h.payload?g+=r.byteLength(h.payload):g+=h.payload.length}var b={};if(5===a){if(!(b=D(e,h.properties)))return!1;g+=b.length}}let v=!1;if(null!=c){if(!z(c))return e.emit("error",new Error("Invalid username")),!1;v=!0,g+=r.byteLength(c)+2}if(null!=d){if(!v)return e.emit("error",new Error("Username is required to use password")),!1;if(!z(d))return e.emit("error",new Error("Invalid password")),!1;g+=F(d)+2}e.write(i.CONNECT_HEADER),R(e,g),L(e,s),o.bridgeMode&&(a+=128),e.write(131===a?i.VERSION131:132===a?i.VERSION132:4===a?i.VERSION4:5===a?i.VERSION5:i.VERSION3);let w=0;return w|=null!=c?i.USERNAME_MASK:0,w|=null!=d?i.PASSWORD_MASK:0,w|=h&&h.retain?i.WILL_RETAIN_MASK:0,w|=h&&h.qos?h.qos<<i.WILL_QOS_SHIFT:0,w|=h?i.WILL_FLAG_MASK:0,w|=u?i.CLEAN_SESSION_MASK:0,e.write(r.from([w])),p(e,f),5===a&&y.write(),L(e,l),h&&(5===a&&b.write(),C(e,h.topic),L(e,h.payload)),null!=c&&L(e,c),null!=d&&L(e,d),!0}function v(t,e,n){const s=n?n.protocolVersion:4,a=t||{},h=5===s?a.reasonCode:a.returnCode,u=a.properties;let f=2;if("number"!=typeof h)return e.emit("error",new Error("Invalid return code")),!1;let l=null;if(5===s){if(l=D(e,u),!l)return!1;f+=l.length}return e.write(i.CONNACK_HEADER),R(e,f),e.write(a.sessionPresent?i.SESSIONPRESENT_HEADER:o),e.write(r.from([h])),null!=l&&l.write(),!0}function w(t,e,o){h("publish: packet: %o",t);const s=o?o.protocolVersion:4,a=t||{},u=a.qos||0,f=a.retain?i.RETAIN_MASK:0,l=a.topic,c=a.payload||n,d=a.messageId,m=a.properties;let g=0;if("string"==typeof l)g+=r.byteLength(l)+2;else{if(!r.isBuffer(l))return e.emit("error",new Error("Invalid topic")),!1;g+=l.length+2}if(r.isBuffer(c)?g+=c.length:g+=r.byteLength(c),u&&"number"!=typeof d)return e.emit("error",new Error("Invalid messageId")),!1;u&&(g+=2);let y=null;if(5===s){if(y=D(e,m),!y)return!1;g+=y.length}return e.write(i.PUBLISH_HEADER[u][a.dup?1:0][f?1:0]),R(e,g),p(e,F(l)),e.write(l),u>0&&p(e,d),null!=y&&y.write(),h("publish: payload: %o",c),e.write(c)}function _(t,e,n){const o=n?n.protocolVersion:4,s=t||{},a=s.cmd||"puback",h=s.messageId,u=s.dup&&"pubrel"===a?i.DUP_MASK:0;let f=0;const l=s.reasonCode,c=s.properties;let d=5===o?3:2;if("pubrel"===a&&(f=1),"number"!=typeof h)return e.emit("error",new Error("Invalid messageId")),!1;let m=null;if(5===o&&"object"==typeof c){if(m=j(e,c,n,d),!m)return!1;d+=m.length}return e.write(i.ACKS[a][f][u][0]),R(e,d),p(e,h),5===o&&e.write(r.from([l])),null!==m&&m.write(),!0}function M(t,e,n){h("subscribe: packet: ");const o=n?n.protocolVersion:4,s=t||{},a=s.dup?i.DUP_MASK:0,u=s.messageId,f=s.subscriptions,l=s.properties;let c=0;if("number"!=typeof u)return e.emit("error",new Error("Invalid messageId")),!1;c+=2;let d=null;if(5===o){if(d=D(e,l),!d)return!1;c+=d.length}if("object"!=typeof f||!f.length)return e.emit("error",new Error("Invalid subscriptions")),!1;for(let t=0;t<f.length;t+=1){const i=f[t].topic,n=f[t].qos;if("string"!=typeof i)return e.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof n)return e.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===o){if("boolean"!=typeof(f[t].nl||!1))return e.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(f[t].rap||!1))return e.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const r=f[t].rh||0;if("number"!=typeof r||r>2)return e.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}c+=r.byteLength(i)+2+1}h("subscribe: writing to stream: %o",i.SUBSCRIBE_HEADER),e.write(i.SUBSCRIBE_HEADER[1][a?1:0][0]),R(e,c),p(e,u),null!==d&&d.write();let m=!0;for(const t of f){const n=t.topic,s=t.qos,a=+t.nl,h=+t.rap,u=t.rh;let f;C(e,n),f=i.SUBSCRIBE_OPTIONS_QOS[s],5===o&&(f|=a?i.SUBSCRIBE_OPTIONS_NL:0,f|=h?i.SUBSCRIBE_OPTIONS_RAP:0,f|=u?i.SUBSCRIBE_OPTIONS_RH[u]:0),m=e.write(r.from([f]))}return m}function S(t,e,n){const o=n?n.protocolVersion:4,s=t||{},a=s.messageId,h=s.granted,u=s.properties;let f=0;if("number"!=typeof a)return e.emit("error",new Error("Invalid messageId")),!1;if(f+=2,"object"!=typeof h||!h.length)return e.emit("error",new Error("Invalid qos vector")),!1;for(let t=0;t<h.length;t+=1){if("number"!=typeof h[t])return e.emit("error",new Error("Invalid qos vector")),!1;f+=1}let l=null;if(5===o){if(l=j(e,u,n,f),!l)return!1;f+=l.length}return e.write(i.SUBACK_HEADER),R(e,f),p(e,a),null!==l&&l.write(),e.write(r.from(h))}function E(t,e,n){const o=n?n.protocolVersion:4,s=t||{},a=s.messageId,h=s.dup?i.DUP_MASK:0,u=s.unsubscriptions,f=s.properties;let l=0;if("number"!=typeof a)return e.emit("error",new Error("Invalid messageId")),!1;if(l+=2,"object"!=typeof u||!u.length)return e.emit("error",new Error("Invalid unsubscriptions")),!1;for(let t=0;t<u.length;t+=1){if("string"!=typeof u[t])return e.emit("error",new Error("Invalid unsubscriptions")),!1;l+=r.byteLength(u[t])+2}let c=null;if(5===o){if(c=D(e,f),!c)return!1;l+=c.length}e.write(i.UNSUBSCRIBE_HEADER[1][h?1:0][0]),R(e,l),p(e,a),null!==c&&c.write();let d=!0;for(let t=0;t<u.length;t++)d=C(e,u[t]);return d}function k(t,e,n){const o=n?n.protocolVersion:4,s=t||{},a=s.messageId,h=s.dup?i.DUP_MASK:0,u=s.granted,f=s.properties,l=s.cmd,c=0;let d=2;if("number"!=typeof a)return e.emit("error",new Error("Invalid messageId")),!1;if(5===o){if("object"!=typeof u||!u.length)return e.emit("error",new Error("Invalid qos vector")),!1;for(let t=0;t<u.length;t+=1){if("number"!=typeof u[t])return e.emit("error",new Error("Invalid qos vector")),!1;d+=1}}let m=null;if(5===o){if(m=j(e,f,n,d),!m)return!1;d+=m.length}return e.write(i.ACKS[l][c][h][0]),R(e,d),p(e,a),null!==m&&m.write(),5===o&&e.write(r.from(u)),!0}function A(t,e,r){return e.write(i.EMPTY[t.cmd])}function O(t,e,n){const o=n?n.protocolVersion:4,s=t||{},a=s.reasonCode,h=s.properties;let u=5===o?1:0,f=null;if(5===o){if(f=j(e,h,n,u),!f)return!1;u+=f.length}return e.write(r.from([i.codes.disconnect<<4])),R(e,u),5===o&&e.write(r.from([a])),null!==f&&f.write(),!0}function T(t,e,n){const o=n?n.protocolVersion:4,s=t||{},a=s.reasonCode,h=s.properties;let u=5===o?1:0;5!==o&&e.emit("error",new Error("Invalid mqtt version for auth packet"));const f=j(e,h,n,u);return!!f&&(u+=f.length,e.write(r.from([i.codes.auth<<4])),R(e,u),e.write(r.from([a])),null!==f&&f.write(),!0)}Object.defineProperty(g,"cacheNumbers",{get:()=>p===x,set(t){t?(u&&0!==Object.keys(u).length||(m=!0),p=x):(m=!1,p=N)}});const I={};function R(t,e){if(e>i.VARBYTEINT_MAX)return t.emit("error",new Error(`Invalid variable byte integer: ${e}`)),!1;let r=I[e];return r||(r=c(e),e<16384&&(I[e]=r)),h("writeVarByteInt: writing to stream: %o",r),t.write(r)}function C(t,e){const i=r.byteLength(e);return p(t,i),h("writeString: %s",e),t.write(e,"utf8")}function P(t,e,r){C(t,e),C(t,r)}function x(t,e){return h("writeNumberCached: number: %d",e),h("writeNumberCached: %o",u[e]),t.write(u[e])}function N(t,e){const r=f(e);return h("writeNumberGenerated: %o",r),t.write(r)}function B(t,e){const r=d(e);return h("write4ByteNumber: %o",r),t.write(r)}function L(t,e){"string"==typeof e?C(t,e):e?(p(t,e.length),t.write(e)):p(t,0)}function D(t,e){if("object"!=typeof e||null!=e.length)return{length:1,write(){q(t,{},0)}};let n=0;function o(e,n){let o=0;switch(i.propertiesTypes[e]){case"byte":if("boolean"!=typeof n)return t.emit("error",new Error(`Invalid ${e}: ${n}`)),!1;o+=2;break;case"int8":if("number"!=typeof n||n<0||n>255)return t.emit("error",new Error(`Invalid ${e}: ${n}`)),!1;o+=2;break;case"binary":if(n&&null===n)return t.emit("error",new Error(`Invalid ${e}: ${n}`)),!1;o+=1+r.byteLength(n)+2;break;case"int16":if("number"!=typeof n||n<0||n>65535)return t.emit("error",new Error(`Invalid ${e}: ${n}`)),!1;o+=3;break;case"int32":if("number"!=typeof n||n<0||n>4294967295)return t.emit("error",new Error(`Invalid ${e}: ${n}`)),!1;o+=5;break;case"var":if("number"!=typeof n||n<0||n>268435455)return t.emit("error",new Error(`Invalid ${e}: ${n}`)),!1;o+=1+r.byteLength(c(n));break;case"string":if("string"!=typeof n)return t.emit("error",new Error(`Invalid ${e}: ${n}`)),!1;o+=3+r.byteLength(n.toString());break;case"pair":if("object"!=typeof n)return t.emit("error",new Error(`Invalid ${e}: ${n}`)),!1;o+=Object.getOwnPropertyNames(n).reduce(((t,e)=>{const i=n[e];return Array.isArray(i)?t+=i.reduce(((t,i)=>t+=3+r.byteLength(e.toString())+2+r.byteLength(i.toString())),0):t+=3+r.byteLength(e.toString())+2+r.byteLength(n[e].toString()),t}),0);break;default:return t.emit("error",new Error(`Invalid property ${e}: ${n}`)),!1}return o}if(e)for(const t in e){let r=0,i=0;const s=e[t];if(Array.isArray(s))for(let e=0;e<s.length;e++){if(i=o(t,s[e]),!i)return!1;r+=i}else{if(i=o(t,s),!i)return!1;r=i}if(!r)return!1;n+=r}return{length:r.byteLength(c(n))+n,write(){q(t,e,n)}}}function j(t,e,r,i){const n=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0;let s=D(t,e);if(o)for(;i+s.length>o;){const r=n.shift();if(!r||!e[r])return!1;delete e[r],s=D(t,e)}return s}function U(t,e,n){switch(i.propertiesTypes[e]){case"byte":t.write(r.from([i.properties[e]])),t.write(r.from([+n]));break;case"int8":t.write(r.from([i.properties[e]])),t.write(r.from([n]));break;case"binary":t.write(r.from([i.properties[e]])),L(t,n);break;case"int16":t.write(r.from([i.properties[e]])),p(t,n);break;case"int32":t.write(r.from([i.properties[e]])),B(t,n);break;case"var":t.write(r.from([i.properties[e]])),R(t,n);break;case"string":t.write(r.from([i.properties[e]])),C(t,n);break;case"pair":Object.getOwnPropertyNames(n).forEach((o=>{const s=n[o];Array.isArray(s)?s.forEach((n=>{t.write(r.from([i.properties[e]])),P(t,o.toString(),n.toString())})):(t.write(r.from([i.properties[e]])),P(t,o.toString(),s.toString()))}));break;default:return t.emit("error",new Error(`Invalid property ${e} value: ${n}`)),!1}}function q(t,e,r){R(t,r);for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&null!==e[r]){const i=e[r];if(Array.isArray(i))for(let e=0;e<i.length;e++)U(t,r,i[e]);else U(t,r,i)}}function F(t){return t?t instanceof r?t.length:r.byteLength(t):0}function z(t){return"string"==typeof t||t instanceof r}e.exports=g}).call(this)}).call(this,t("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(t,e,r){var i=1e3,n=60*i,o=60*n,s=24*o,a=7*s,h=365.25*s;function u(t){if(!((t=String(t)).length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*h;case"weeks":case"week":case"w":return r*a;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*o;case"minutes":case"minute":case"mins":case"min":case"m":return r*n;case"seconds":case"second":case"secs":case"sec":case"s":return r*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function f(t){var e=Math.abs(t);return e>=s?Math.round(t/s)+"d":e>=o?Math.round(t/o)+"h":e>=n?Math.round(t/n)+"m":e>=i?Math.round(t/i)+"s":t+"ms"}function l(t){var e=Math.abs(t);return e>=s?c(t,e,s,"day"):e>=o?c(t,e,o,"hour"):e>=n?c(t,e,n,"minute"):e>=i?c(t,e,i,"second"):t+" ms"}function c(t,e,r,i){var n=e>=1.5*r;return Math.round(t/r)+" "+i+(n?"s":"")}e.exports=function(t,e){e=e||{};var r=typeof t;if("string"===r&&t.length>0)return u(t);if("number"===r&&isFinite(t))return e.long?l(t):f(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},{}],46:[function(t,e,r){const i=t("./lib/number-allocator.js");e.exports.NumberAllocator=i},{"./lib/number-allocator.js":47}],47:[function(t,e,r){const i=t("js-sdsl").Set,n=t("debug")("number-allocator:trace"),o=t("debug")("number-allocator:error");function s(t,e){this.low=t,this.high=e}function a(t,e){if(!(this instanceof a))return new a(t,e);this.min=t,this.max=e,this.ss=new i([],((t,e)=>t.compare(e))),n("Create"),this.clear()}s.prototype.equals=function(t){return this.low===t.low&&this.high===t.high},s.prototype.compare=function(t){return this.low<t.low&&this.high<t.low?-1:t.low<this.low&&t.high<this.low?1:0},a.prototype.firstVacant=function(){return 0===this.ss.size()?null:this.ss.front().low},a.prototype.alloc=function(){if(0===this.ss.size())return n("alloc():empty"),null;const t=this.ss.front(),e=t.low;return e+1<=t.high?++t.low:this.ss.eraseElementByPos(0),n("alloc():"+e),e},a.prototype.use=function(t){const e=new s(t,t),r=this.ss.lowerBound(e);if(r){if(r.equals(e))return this.ss.eraseElementByValue(r),n("use():"+t),!0;if(r.low>t)return!1;if(r.low===t)return++r.low,n("use():"+t),!0;if(r.high===t)return--r.high,n("use():"+t),!0;const i=r.low;return r.low=t+1,this.ss.insert(new s(i,t-1)),n("use():"+t),!0}return n("use():failed"),!1},a.prototype.free=function(t){if(t<this.min||t>this.max)return void o("free():"+t+" is out of range");const e=new s(t,t),r=this.ss.lowerBound(e);if(r){if(r.low<=t&&t<=r.high)return void o("free():"+t+" has already been vacant");if(r===this.ss.front())t+1===r.low?--r.low:this.ss.insert(e);else{const i=this.ss.reverseLowerBound(e);i.high+1===t?t+1===r.low?(this.ss.eraseElementByValue(i),r.low=i.low):i.high=t:t+1===r.low?r.low=t:this.ss.insert(e)}}else{if(r===this.ss.front())return void this.ss.insert(e);const i=this.ss.reverseLowerBound(e);i.high+1===t?i.high=t:this.ss.insert(e)}n("free():"+t)},a.prototype.clear=function(){n("clear()"),this.ss.clear(),this.ss.insert(new s(this.min,this.max))},a.prototype.intervalCount=function(){return this.ss.size()},a.prototype.dump=function(){console.log("length:"+this.ss.size());for(const t of this.ss)console.log(t)},e.exports=a},{debug:18,"js-sdsl":36}],48:[function(t,e,r){var i=t("wrappy");function n(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function o(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}e.exports=i(n),e.exports.strict=i(o),n.proto=n((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})}))},{wrappy:79}],49:[function(t,e,r){(function(t){(function(){function r(e,r,i,n){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,i)}));case 4:return t.nextTick((function(){e.call(null,r,i,n)}));default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return t.nextTick((function(){e.apply(null,o)}))}}void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:r}:e.exports=t}).call(this)}).call(this,t("_process"))},{_process:50}],50:[function(t,e,r){var i,n,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function h(t){if(i===setTimeout)return setTimeout(t,0);if((i===s||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}function u(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:s}catch(t){i=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var f,l=[],c=!1,d=-1;function p(){c&&f&&(c=!1,f.length?l=f.concat(l):d=-1,l.length&&m())}function m(){if(!c){var t=h(p);c=!0;for(var e=l.length;e;){for(f=l,l=[];++d<e;)f&&f[d].run();d=-1,e=l.length}f=null,c=!1,u(t)}}function g(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];l.push(new g(t,e)),1!==l.length||c||h(m)},g.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],51:[function(t,e,r){(function(t){(function(){!function(i){var n="object"==typeof r&&r&&!r.nodeType&&r,o="object"==typeof e&&e&&!e.nodeType&&e,s="object"==typeof t&&t;s.global!==s&&s.window!==s&&s.self!==s||(i=s);var a,h,u=2147483647,f=36,l=1,c=26,d=38,p=700,m=72,g=128,y="-",b=/^xn--/,v=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},M=f-l,S=Math.floor,E=String.fromCharCode;function k(t){throw new RangeError(_[t])}function A(t,e){for(var r=t.length,i=[];r--;)i[r]=e(t[r]);return i}function O(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+A((t=t.replace(w,".")).split("."),e).join(".")}function T(t){for(var e,r,i=[],n=0,o=t.length;n<o;)(e=t.charCodeAt(n++))>=55296&&e<=56319&&n<o?56320==(64512&(r=t.charCodeAt(n++)))?i.push(((1023&e)<<10)+(1023&r)+65536):(i.push(e),n--):i.push(e);return i}function I(t){return A(t,(function(t){var e="";return t>65535&&(e+=E((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=E(t)})).join("")}function R(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:f}function C(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function P(t,e,r){var i=0;for(t=r?S(t/p):t>>1,t+=S(t/e);t>M*c>>1;i+=f)t=S(t/M);return S(i+(M+1)*t/(t+d))}function x(t){var e,r,i,n,o,s,a,h,d,p,b=[],v=t.length,w=0,_=g,M=m;for((r=t.lastIndexOf(y))<0&&(r=0),i=0;i<r;++i)t.charCodeAt(i)>=128&&k("not-basic"),b.push(t.charCodeAt(i));for(n=r>0?r+1:0;n<v;){for(o=w,s=1,a=f;n>=v&&k("invalid-input"),((h=R(t.charCodeAt(n++)))>=f||h>S((u-w)/s))&&k("overflow"),w+=h*s,!(h<(d=a<=M?l:a>=M+c?c:a-M));a+=f)s>S(u/(p=f-d))&&k("overflow"),s*=p;M=P(w-o,e=b.length+1,0==o),S(w/e)>u-_&&k("overflow"),_+=S(w/e),w%=e,b.splice(w++,0,_)}return I(b)}function N(t){var e,r,i,n,o,s,a,h,d,p,b,v,w,_,M,A=[];for(v=(t=T(t)).length,e=g,r=0,o=m,s=0;s<v;++s)(b=t[s])<128&&A.push(E(b));for(i=n=A.length,n&&A.push(y);i<v;){for(a=u,s=0;s<v;++s)(b=t[s])>=e&&b<a&&(a=b);for(a-e>S((u-r)/(w=i+1))&&k("overflow"),r+=(a-e)*w,e=a,s=0;s<v;++s)if((b=t[s])<e&&++r>u&&k("overflow"),b==e){for(h=r,d=f;!(h<(p=d<=o?l:d>=o+c?c:d-o));d+=f)M=h-p,_=f-p,A.push(E(C(p+M%_,0))),h=S(M/_);A.push(E(C(h,0))),o=P(r,w,i==n),r=0,++i}++r,++e}return A.join("")}function B(t){return O(t,(function(t){return b.test(t)?x(t.slice(4).toLowerCase()):t}))}function L(t){return O(t,(function(t){return v.test(t)?"xn--"+N(t):t}))}if(a={version:"1.4.1",ucs2:{decode:T,encode:I},decode:x,encode:N,toASCII:L,toUnicode:B},n&&o)if(e.exports==n)o.exports=a;else for(h in a)a.hasOwnProperty(h)&&(n[h]=a[h]);else i.punycode=a}(this)}).call(this)}).call(this,void 0!==Y?Y:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],52:[function(t,e,r){function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,o){e=e||"&",r=r||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var h=1e3;o&&"number"==typeof o.maxKeys&&(h=o.maxKeys);var u=t.length;h>0&&u>h&&(u=h);for(var f=0;f<u;++f){var l,c,d,p,m=t[f].replace(a,"%20"),g=m.indexOf(r);g>=0?(l=m.substr(0,g),c=m.substr(g+1)):(l=m,c=""),d=decodeURIComponent(l),p=decodeURIComponent(c),i(s,d)?n(s[d])?s[d].push(p):s[d]=[s[d],p]:s[d]=p}return s};var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],53:[function(t,e,r){var i=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};e.exports=function(t,e,r,a){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?o(s(t),(function(s){var a=encodeURIComponent(i(s))+r;return n(t[s])?o(t[s],(function(t){return a+encodeURIComponent(i(t))})).join(e):a+encodeURIComponent(i(t[s]))})).join(e):a?encodeURIComponent(i(a))+r+encodeURIComponent(i(t)):""};var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var r=[],i=0;i<t.length;i++)r.push(e(t[i],i));return r}var s=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},{}],54:[function(t,e,r){r.decode=r.parse=t("./decode"),r.encode=r.stringify=t("./encode")},{"./decode":52,"./encode":53}],55:[function(t,e,r){function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var n={};function o(t,e,r){function o(t,r,i){return"string"==typeof e?e:e(t,r,i)}r||(r=Error);var s=function(t){function e(e,r,i){return t.call(this,o(e,r,i))||this}return i(e,t),e}(r);s.prototype.name=r.name,s.prototype.code=t,n[t]=s}function s(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))}function a(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function h(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function u(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}o("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),o("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n;if("string"==typeof e&&a(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be",h(t," argument"))n="The ".concat(t," ").concat(i," ").concat(s(e,"type"));else{var o=u(t,".")?"property":"argument";n='The "'.concat(t,'" ').concat(o," ").concat(i," ").concat(s(e,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=n},{}],56:[function(t,e,r){(function(r){(function(){var i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=u;var n=t("./_stream_readable"),o=t("./_stream_writable");t("inherits")(u,n);for(var s=i(o.prototype),a=0;a<s.length;a++){var h=s[a];u.prototype[h]||(u.prototype[h]=o.prototype[h])}function u(t){if(!(this instanceof u))return new u(t);n.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",f)))}function f(){this._writableState.ended||r.nextTick(l,this)}function l(t){t.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this)}).call(this,t("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(t,e,r){e.exports=n;var i=t("./_stream_transform");function n(t){if(!(this instanceof n))return new n(t);i.call(this,t)}t("inherits")(n,i),n.prototype._transform=function(t,e,r){r(null,t)}},{"./_stream_transform":59,inherits:24}],58:[function(t,e,r){(function(r,i){(function(){var n;e.exports=T,T.ReadableState=O,t("events").EventEmitter;var o=function(t,e){return t.listeners(e).length},s=t("./internal/streams/stream"),a=t("buffer").Buffer,h=i.Uint8Array||function(){};function u(t){return a.from(t)}function f(t){return a.isBuffer(t)||t instanceof h}var l,c=t("util");l=c&&c.debuglog?c.debuglog("stream"):function(){};var d,p,m,g=t("./internal/streams/buffer_list"),y=t("./internal/streams/destroy"),b=t("./internal/streams/state").getHighWaterMark,v=t("../errors").codes,w=v.ERR_INVALID_ARG_TYPE,_=v.ERR_STREAM_PUSH_AFTER_EOF,M=v.ERR_METHOD_NOT_IMPLEMENTED,S=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;t("inherits")(T,s);var E=y.errorOrDestroy,k=["error","close","destroy","pause","resume"];function A(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)}function O(e,r,i){n=n||t("./_stream_duplex"),e=e||{},"boolean"!=typeof i&&(i=r instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=b(this,e,"readableHighWaterMark",i),this.buffer=new g,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!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=t("string_decoder/").StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function T(e){if(n=n||t("./_stream_duplex"),!(this instanceof T))return new T(e);var r=this instanceof n;this._readableState=new O(e,this,r),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function I(t,e,r,i,n){l("readableAddChunk",e);var o,s=t._readableState;if(null===e)s.reading=!1,B(t,s);else if(n||(o=C(s,e)),o)E(t,o);else if(s.objectMode||e&&e.length>0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=u(e)),i)s.endEmitted?E(t,new S):R(t,s,e,!0);else if(s.ended)E(t,new _);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.length<s.highWaterMark||0===s.length)}function R(t,e,r,i){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&L(t)),j(t,e)}function C(t,e){var r;return f(e)||"string"==typeof e||void 0===e||t.objectMode||(r=new w("chunk",["string","Buffer","Uint8Array"],e)),r}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),T.prototype.destroy=y.destroy,T.prototype._undestroy=y.undestroy,T.prototype._destroy=function(t,e){e(t)},T.prototype.push=function(t,e){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof t&&((e=e||i.defaultEncoding)!==i.encoding&&(t=a.from(t,e),e=""),r=!0),I(this,t,e,!1,r)},T.prototype.unshift=function(t){return I(this,t,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(e){d||(d=t("string_decoder/").StringDecoder);var r=new d(e);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var i=this._readableState.buffer.head,n="";null!==i;)n+=r.write(i.data),i=i.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var P=1073741824;function x(t){return t>=P?t=P:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function N(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=x(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function B(t,e){if(l("onEofChunk"),!e.ended){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?L(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,D(t)))}}function L(t){var e=t._readableState;l("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(l("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(D,t))}function D(t){var e=t._readableState;l("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,V(t)}function j(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(U,t,e))}function U(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(l("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function q(t){return function(){var e=t._readableState;l("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,V(t))}}function F(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function z(t){l("readable nexttick read 0"),t.read(0)}function H(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(K,t,e))}function K(t,e){l("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),V(t),e.flowing&&!e.reading&&t.read(0)}function V(t){var e=t._readableState;for(l("flow",e.flowing);e.flowing&&null!==t.read(););}function G(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 W(t){var e=t._readableState;l("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(Y,e,t))}function Y(t,e){if(l("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 Z(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}T.prototype.read=function(t){l("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return l("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?W(this):L(this),null;if(0===(t=N(t,e))&&e.ended)return 0===e.length&&W(this),null;var i,n=e.needReadable;return l("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&l("length less than watermark",n=!0),e.ended||e.reading?l("reading or ended",n=!1):n&&(l("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=N(r,e))),null===(i=t>0?G(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&&W(this)),null!==i&&this.emit("data",i),i},T.prototype._read=function(t){E(this,new M("_read()"))},T.prototype.pipe=function(t,e){var i=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,l("pipe count=%d opts=%j",n.pipesCount,e);var s=e&&!1===e.end||t===r.stdout||t===r.stderr?y:h;function a(t,e){l("onunpipe"),t===i&&e&&!1===e.hasUnpiped&&(e.hasUnpiped=!0,c())}function h(){l("onend"),t.end()}n.endEmitted?r.nextTick(s):i.once("end",s),t.on("unpipe",a);var u=q(i);t.on("drain",u);var f=!1;function c(){l("cleanup"),t.removeListener("close",m),t.removeListener("finish",g),t.removeListener("drain",u),t.removeListener("error",p),t.removeListener("unpipe",a),i.removeListener("end",h),i.removeListener("end",y),i.removeListener("data",d),f=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||u()}function d(e){l("ondata");var r=t.write(e);l("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==Z(n.pipes,t))&&!f&&(l("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function p(e){l("onerror",e),y(),t.removeListener("error",p),0===o(t,"error")&&E(t,e)}function m(){t.removeListener("finish",g),y()}function g(){l("onfinish"),t.removeListener("close",m),y()}function y(){l("unpipe"),i.unpipe(t)}return i.on("data",d),A(t,"error",p),t.once("close",m),t.once("finish",g),t.emit("pipe",i),n.flowing||(l("pipe resume"),i.resume()),t},T.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;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=Z(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},T.prototype.on=function(t,e){var i=s.prototype.on.call(this,t,e),n=this._readableState;return"data"===t?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,l("on readable",n.length,n.reading),n.length?L(this):n.reading||r.nextTick(z,this))),i},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(t,e){var i=s.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(F,this),i},T.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(F,this),e},T.prototype.resume=function(){var t=this._readableState;return t.flowing||(l("resume"),t.flowing=!t.readableListening,H(this,t)),t.paused=!1,this},T.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(l("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){l("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<k.length;o++)t.on(k[o],this.emit.bind(this,k[o]));return this._read=function(e){l("wrapped _read",e),i&&(i=!1,t.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===p&&(p=t("./internal/streams/async_iterator")),p(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),T._fromList=G,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(e,r){return void 0===m&&(m=t("./internal/streams/from")),m(T,e,r)})}).call(this)}).call(this,t("_process"),void 0!==Y?Y:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/async_iterator":61,"./internal/streams/buffer_list":62,"./internal/streams/destroy":63,"./internal/streams/from":65,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,events:22,inherits:24,"string_decoder/":75,util:16}],59:[function(t,e,r){e.exports=f;var i=t("../errors").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,h=t("./_stream_duplex");function u(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<n.highWaterMark)&&this._read(n.highWaterMark)}function f(t){if(!(this instanceof f))return new f(t);h.call(this,t),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",l)}function l(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?c(this,null,null):this._flush((function(e,r){c(t,e,r)}))}function c(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new a;if(t._transformState.transforming)throw new s;return t.push(null)}t("inherits")(f,h),f.prototype.push=function(t,e){return this._transformState.needTransform=!1,h.prototype.push.call(this,t,e)},f.prototype._transform=function(t,e,r){r(new n("_transform()"))},f.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},f.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},f.prototype._destroy=function(t,e){h.prototype._destroy.call(this,t,(function(t){e(t)}))}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(t,e,r){(function(r,i){(function(){function n(t){var e=this;this.next=null,this.entry=null,this.finish=function(){K(e,t)}}var o;e.exports=O,O.WritableState=A;var s={deprecate:t("util-deprecate")},a=t("./internal/streams/stream"),h=t("buffer").Buffer,u=i.Uint8Array||function(){};function f(t){return h.from(t)}function l(t){return h.isBuffer(t)||t instanceof u}var c,d=t("./internal/streams/destroy"),p=t("./internal/streams/state").getHighWaterMark,m=t("../errors").codes,g=m.ERR_INVALID_ARG_TYPE,y=m.ERR_METHOD_NOT_IMPLEMENTED,b=m.ERR_MULTIPLE_CALLBACK,v=m.ERR_STREAM_CANNOT_PIPE,w=m.ERR_STREAM_DESTROYED,_=m.ERR_STREAM_NULL_VALUES,M=m.ERR_STREAM_WRITE_AFTER_END,S=m.ERR_UNKNOWN_ENCODING,E=d.errorOrDestroy;function k(){}function A(e,r,i){o=o||t("./_stream_duplex"),e=e||{},"boolean"!=typeof i&&(i=r instanceof o),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=p(this,e,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){B(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function O(e){var r=this instanceof(o=o||t("./_stream_duplex"));if(!r&&!c.call(O,this))return new O(e);this._writableState=new A(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),a.call(this)}function T(t,e){var i=new M;E(t,i),r.nextTick(e,i)}function I(t,e,i,n){var o;return null===i?o=new _:"string"==typeof i||e.objectMode||(o=new g("chunk",["string","Buffer"],i)),!o||(E(t,o),r.nextTick(n,o),!1)}function R(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,r)),e}function C(t,e,r,i,n,o){if(!r){var s=R(e,i,n);i!==s&&(r=!0,n="buffer",i=s)}var a=e.objectMode?1:i.length;e.length+=a;var h=e.length<e.highWaterMark;if(h||(e.needDrain=!0),e.writing||e.corked){var u=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},u?u.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else P(t,e,!1,a,i,n,o);return h}function P(t,e,r,i,n,o,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new w("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function x(t,e,i,n,o){--e.pendingcb,i?(r.nextTick(o,n),r.nextTick(z,t,e),t._writableState.errorEmitted=!0,E(t,n)):(o(n),t._writableState.errorEmitted=!0,E(t,n),z(t,e))}function N(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function B(t,e){var i=t._writableState,n=i.sync,o=i.writecb;if("function"!=typeof o)throw new b;if(N(i),e)x(t,i,n,e,o);else{var s=U(i)||t.destroyed;s||i.corked||i.bufferProcessing||!i.bufferedRequest||j(t,i),n?r.nextTick(L,t,i,s,o):L(t,i,s,o)}}function L(t,e,r,i){r||D(t,e),e.pendingcb--,i(),z(t,e)}function D(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function j(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,o=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var a=0,h=!0;r;)o[a]=r,r.isBuf||(h=!1),r=r.next,a+=1;o.allBuffers=h,P(t,e,!0,e.length,o,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new n(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,f=r.encoding,l=r.callback;if(P(t,e,!1,e.objectMode?1:u.length,u,f,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function U(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function q(t,e){t._final((function(r){e.pendingcb--,r&&E(t,r),e.prefinished=!0,t.emit("prefinish"),z(t,e)}))}function F(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(q,t,e)))}function z(t,e){var r=U(e);if(r&&(F(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}function H(t,e,i){e.ending=!0,z(t,e),i&&(e.finished?r.nextTick(i):t.once("finish",i)),e.ended=!0,t.writable=!1}function K(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}t("inherits")(O,a),A.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(A.prototype,"buffer",{get:s.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]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(O,Symbol.hasInstance,{value:function(t){return!!c.call(this,t)||this===O&&t&&t._writableState instanceof A}})):c=function(t){return t instanceof this},O.prototype.pipe=function(){E(this,new v)},O.prototype.write=function(t,e,r){var i=this._writableState,n=!1,o=!i.objectMode&&l(t);return o&&!h.isBuffer(t)&&(t=f(t)),"function"==typeof e&&(r=e,e=null),o?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=k),i.ending?T(this,r):(o||I(this,i,t,r))&&(i.pendingcb++,n=C(this,i,o,t,e,r)),n},O.prototype.cork=function(){this._writableState.corked++},O.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||j(this,t))},O.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new S(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(O.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(O.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),O.prototype._write=function(t,e,r){r(new y("_write()"))},O.prototype._writev=null,O.prototype.end=function(t,e,r){var i=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),i.corked&&(i.corked=1,this.uncork()),i.ending||H(this,i,r),this},Object.defineProperty(O.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),O.prototype.destroy=d.destroy,O.prototype._undestroy=d.undestroy,O.prototype._destroy=function(t,e){e(t)}}).call(this)}).call(this,t("_process"),void 0!==Y?Y:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/destroy":63,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,inherits:24,"util-deprecate":78}],61:[function(t,e,r){(function(r){(function(){var i;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}var o=t("./end-of-stream"),s=Symbol("lastResolve"),a=Symbol("lastReject"),h=Symbol("error"),u=Symbol("ended"),f=Symbol("lastPromise"),l=Symbol("handlePromise"),c=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[s];if(null!==e){var r=t[c].read();null!==r&&(t[f]=null,t[s]=null,t[a]=null,e(d(r,!1)))}}function m(t){r.nextTick(p,t)}function g(t,e){return function(r,i){t.then((function(){e[u]?r(d(void 0,!0)):e[l](r,i)}),i)}}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((n(i={get stream(){return this[c]},next:function(){var t=this,e=this[h];if(null!==e)return Promise.reject(e);if(this[u])return Promise.resolve(d(void 0,!0));if(this[c].destroyed)return new Promise((function(e,i){r.nextTick((function(){t[h]?i(t[h]):e(d(void 0,!0))}))}));var i,n=this[f];if(n)i=new Promise(g(n,this));else{var o=this[c].read();if(null!==o)return Promise.resolve(d(o,!1));i=new Promise(this[l])}return this[f]=i,i}},Symbol.asyncIterator,(function(){return this})),n(i,"return",(function(){var t=this;return new Promise((function(e,r){t[c].destroy(null,(function(t){t?r(t):e(d(void 0,!0))}))}))})),i),y),v=function(t){var e,r=Object.create(b,(n(e={},c,{value:t,writable:!0}),n(e,s,{value:null,writable:!0}),n(e,a,{value:null,writable:!0}),n(e,h,{value:null,writable:!0}),n(e,u,{value:t._readableState.endEmitted,writable:!0}),n(e,l,{value:function(t,e){var i=r[c].read();i?(r[f]=null,r[s]=null,r[a]=null,t(d(i,!1))):(r[s]=t,r[a]=e)},writable:!0}),e));return r[f]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[a];return null!==e&&(r[f]=null,r[s]=null,r[a]=null,e(t)),void(r[h]=t)}var i=r[s];null!==i&&(r[f]=null,r[s]=null,r[a]=null,i(d(void 0,!0))),r[u]=!0})),t.on("readable",m.bind(null,r)),r};e.exports=v}).call(this)}).call(this,t("_process"))},{"./end-of-stream":64,_process:50}],62:[function(t,e,r){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){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function h(t,e,r){return e&&a(t.prototype,e),r&&a(t,r),t}var u=t("buffer").Buffer,f=t("util").inspect,l=f&&f.custom||"inspect";function c(t,e,r){u.prototype.copy.call(t,e,r)}e.exports=function(){function t(){s(this,t),this.head=null,this.tail=null,this.length=0}return h(t,[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?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 u.alloc(0);for(var e=u.allocUnsafe(t>>>0),r=this.head,i=0;r;)c(r.data,e,i),i+=r.data.length,r=r.next;return e}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,i=e.data;for(t-=i.length;e=e.next;){var n=e.data,o=t>n.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=u.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:l,value:function(t,e){return f(this,n({},e,{depth:0,customInspect:!1}))}}]),t}()},{buffer:17,util:16}],63:[function(t,e,r){(function(t){(function(){function r(e,r){var o=this,a=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return a||h?(r?r(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(s,this,e)):t.nextTick(s,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!r&&e?o._writableState?o._writableState.errorEmitted?t.nextTick(n,o):(o._writableState.errorEmitted=!0,t.nextTick(i,o,e)):t.nextTick(i,o,e):r?(t.nextTick(n,o),r(e)):t.nextTick(n,o)})),this)}function i(t,e){s(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(t,e){t.emit("error",e)}function a(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}e.exports={destroy:r,undestroy:o,errorOrDestroy:a}}).call(this)}).call(this,t("_process"))},{_process:50}],64:[function(t,e,r){var i=t("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function n(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}function o(){}function s(t){return t.setHeader&&"function"==typeof t.abort}function a(t,e,r){if("function"==typeof e)return a(t,null,e);e||(e={}),r=n(r||o);var h=e.readable||!1!==e.readable&&t.readable,u=e.writable||!1!==e.writable&&t.writable,f=function(){t.writable||c()},l=t._writableState&&t._writableState.finished,c=function(){u=!1,l=!0,h||r.call(t)},d=t._readableState&&t._readableState.endEmitted,p=function(){h=!1,d=!0,u||r.call(t)},m=function(e){r.call(t,e)},g=function(){var e;return h&&!d?(t._readableState&&t._readableState.ended||(e=new i),r.call(t,e)):u&&!l?(t._writableState&&t._writableState.ended||(e=new i),r.call(t,e)):void 0},y=function(){t.req.on("finish",c)};return s(t)?(t.on("complete",c),t.on("abort",g),t.req?y():t.on("request",y)):u&&!t._writableState&&(t.on("end",f),t.on("close",f)),t.on("end",p),t.on("finish",c),!1!==e.error&&t.on("error",m),t.on("close",g),function(){t.removeListener("complete",c),t.removeListener("abort",g),t.removeListener("request",y),t.req&&t.req.removeListener("finish",c),t.removeListener("end",f),t.removeListener("close",f),t.removeListener("finish",c),t.removeListener("end",p),t.removeListener("error",m),t.removeListener("close",g)}}e.exports=a},{"../../../errors":55}],65:[function(t,e,r){e.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(t,e,r){var i;function n(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var o=t("../../../errors").codes,s=o.ERR_MISSING_ARGS,a=o.ERR_STREAM_DESTROYED;function h(t){if(t)throw t}function u(t){return t.setHeader&&"function"==typeof t.abort}function f(e,r,o,s){s=n(s);var h=!1;e.on("close",(function(){h=!0})),void 0===i&&(i=t("./end-of-stream")),i(e,{readable:r,writable:o},(function(t){if(t)return s(t);h=!0,s()}));var f=!1;return function(t){if(!h&&!f)return f=!0,u(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new a("pipe"))}}function l(t){t()}function c(t,e){return t.pipe(e)}function d(t){return t.length?"function"!=typeof t[t.length-1]?h:t.pop():h}function p(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i,n=d(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new s("streams");var o=e.map((function(t,r){var s=r<e.length-1;return f(t,s,r>0,(function(t){i||(i=t),t&&o.forEach(l),s||(o.forEach(l),n(i))}))}));return e.reduce(c)}e.exports=p},{"../../../errors":55,"./end-of-stream":64}],67:[function(t,e,r){var i=t("../../../errors").codes.ERR_INVALID_OPT_VALUE;function n(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}function o(t,e,r,o){var s=n(e,o,r);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new i(o?r:"highWaterMark",s);return Math.floor(s)}return t.objectMode?16:16384}e.exports={getHighWaterMark:o}},{"../../../errors":55}],68:[function(t,e,r){e.exports=t("events").EventEmitter},{events:22}],69:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js"),r.finished=t("./lib/internal/streams/end-of-stream.js"),r.pipeline=t("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60,"./lib/internal/streams/end-of-stream.js":64,"./lib/internal/streams/pipeline.js":66}],70:[function(t,e,r){function i(t,e,r){var i=this;this._callback=t,this._args=r,this._interval=setInterval(t,e,this._args),this.reschedule=function(t){t||(t=i._interval),i._interval&&clearInterval(i._interval),i._interval=setInterval(i._callback,t,i._args)},this.clear=function(){i._interval&&(clearInterval(i._interval),i._interval=void 0)},this.destroy=function(){i._interval&&clearInterval(i._interval),i._callback=void 0,i._interval=void 0,i._args=void 0}}function n(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var t;if(arguments.length>0){t=new Array(arguments.length-2);for(var e=0;e<t.length;e++)t[e]=arguments[e+2]}return new i(arguments[0],arguments[1],t)}e.exports=n},{}],71:[function(t,e,r){e.exports=t("./index.js")()},{"./index.js":72}],72:[function(t,e,r){(function(t){(function(){function r(e){return e instanceof t?t.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function i(t){return(t=t||{}).circles?n(t):t.proto?o:i;function e(t,e){for(var i=Object.keys(t),n=new Array(i.length),o=0;o<i.length;o++){var s=i[o],a=t[s];"object"!=typeof a||null===a?n[s]=a:a instanceof Date?n[s]=new Date(a):ArrayBuffer.isView(a)?n[s]=r(a):n[s]=e(a)}return n}function i(t){if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return e(t,i);if(t instanceof Map)return new Map(e(Array.from(t),i));if(t instanceof Set)return new Set(e(Array.from(t),i));var n={};for(var o in t)if(!1!==Object.hasOwnProperty.call(t,o)){var s=t[o];"object"!=typeof s||null===s?n[o]=s:s instanceof Date?n[o]=new Date(s):s instanceof Map?n[o]=new Map(e(Array.from(s),i)):s instanceof Set?n[o]=new Set(e(Array.from(s),i)):ArrayBuffer.isView(s)?n[o]=r(s):n[o]=i(s)}return n}function o(t){if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return e(t,o);if(t instanceof Map)return new Map(e(Array.from(t),o));if(t instanceof Set)return new Set(e(Array.from(t),o));var i={};for(var n in t){var s=t[n];"object"!=typeof s||null===s?i[n]=s:s instanceof Date?i[n]=new Date(s):s instanceof Map?i[n]=new Map(e(Array.from(s),o)):s instanceof Set?i[n]=new Set(e(Array.from(s),o)):ArrayBuffer.isView(s)?i[n]=r(s):i[n]=o(s)}return i}}function n(t){var e=[],i=[];return t.proto?s:o;function n(t,n){for(var o=Object.keys(t),s=new Array(o.length),a=0;a<o.length;a++){var h=o[a],u=t[h];if("object"!=typeof u||null===u)s[h]=u;else if(u instanceof Date)s[h]=new Date(u);else if(ArrayBuffer.isView(u))s[h]=r(u);else{var f=e.indexOf(u);s[h]=-1!==f?i[f]:n(u)}}return s}function o(t){if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return n(t,o);if(t instanceof Map)return new Map(n(Array.from(t),o));if(t instanceof Set)return new Set(n(Array.from(t),o));var s={};for(var a in e.push(t),i.push(s),t)if(!1!==Object.hasOwnProperty.call(t,a)){var h=t[a];if("object"!=typeof h||null===h)s[a]=h;else if(h instanceof Date)s[a]=new Date(h);else if(h instanceof Map)s[a]=new Map(n(Array.from(h),o));else if(h instanceof Set)s[a]=new Set(n(Array.from(h),o));else if(ArrayBuffer.isView(h))s[a]=r(h);else{var u=e.indexOf(h);s[a]=-1!==u?i[u]:o(h)}}return e.pop(),i.pop(),s}function s(t){if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return n(t,s);if(t instanceof Map)return new Map(n(Array.from(t),s));if(t instanceof Set)return new Set(n(Array.from(t),s));var o={};for(var a in e.push(t),i.push(o),t){var h=t[a];if("object"!=typeof h||null===h)o[a]=h;else if(h instanceof Date)o[a]=new Date(h);else if(h instanceof Map)o[a]=new Map(n(Array.from(h),s));else if(h instanceof Set)o[a]=new Set(n(Array.from(h),s));else if(ArrayBuffer.isView(h))o[a]=r(h);else{var u=e.indexOf(h);o[a]=-1!==u?i[u]:s(h)}}return e.pop(),i.pop(),o}}e.exports=i}).call(this)}).call(this,t("buffer").Buffer)},{buffer:17}],73:[function(t,e,r){
6
6
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
7
- var i=t("buffer"),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?e.exports=i:(o(i,r),r.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)}},{buffer:17}],74:[function(t,e,r){function i(t){var e=t._readableState;return e?e.objectMode||"number"==typeof t._duplexState?t.read():t.read(n(e)):null}function n(t){return t.buffer.length?t.buffer.head?t.buffer.head.data.length:t.buffer[0].length:t.length}e.exports=i},{}],75:[function(t,e,r){var i=t("safe-buffer").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){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}}function s(t){var e=o(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}function a(t){var e;switch(this.encoding=s(t),this.encoding){case"utf16le":this.text=p,this.end=m,e=4;break;case"utf8":this.fillLast=l,e=4;break;case"base64":this.text=g,this.end=y,e=3;break;default:return this.write=b,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function h(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function u(t,e,r){var i=e.length-1;if(i<r)return 0;var n=h(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||-2===n?0:(n=h(e[i]))>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||-2===n?0:(n=h(e[i]))>=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}function f(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,"�"}}function l(t){var e=this.lastTotal-this.lastNeed,r=f(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 c(t,e){var r=u(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)}function d(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function p(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 m(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 g(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 y(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function b(t){return t.toString(this.encoding)}function v(t){return t&&t.length?this.write(t):""}r.StringDecoder=a,a.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<t.length?e?e+this.text(t,r):this.text(t,r):e||""},a.prototype.end=d,a.prototype.text=c,a.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}},{"safe-buffer":73}],76:[function(t,e,r){var i=t("punycode"),n=t("./util");function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=w,r.resolve=M,r.resolveObject=S,r.format=_,r.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),f=["'"].concat(u),l=["%","/","?",";","#"].concat(f),c=["/","?","#"],d=255,p=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=t("querystring");function w(t,e,r){if(t&&n.isObject(t)&&t instanceof o)return t;var i=new o;return i.parse(t,e,r),i}function _(t){return n.isString(t)&&(t=w(t)),t instanceof o?t.format():o.prototype.format.call(t)}function M(t,e){return w(t,!1,!0).resolve(e)}function S(t,e){return t?w(t,!1,!0).resolveObject(e):e}o.prototype.parse=function(t,e,r){if(!n.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),a=-1!==o&&o<t.indexOf("#")?"?":"#",u=t.split(a),w=/\\/g;u[0]=u[0].replace(w,"/");var _=t=u.join(a);if(_=_.trim(),!r&&1===t.split("#").length){var M=h.exec(_);if(M)return this.path=_,this.href=_,this.pathname=M[1],M[2]?(this.search=M[2],this.query=e?v.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var S=s.exec(_);if(S){var E=(S=S[0]).toLowerCase();this.protocol=E,_=_.substr(S.length)}if(r||S||_.match(/^\/\/[^@\/]+@[^@\/]+/)){var k="//"===_.substr(0,2);!k||S&&y[S]||(_=_.substr(2),this.slashes=!0)}if(!y[S]&&(k||S&&!b[S])){for(var A,O,T=-1,I=0;I<c.length;I++)-1!==(R=_.indexOf(c[I]))&&(-1===T||R<T)&&(T=R);for(-1!==(O=-1===T?_.lastIndexOf("@"):_.lastIndexOf("@",T))&&(A=_.slice(0,O),_=_.slice(O+1),this.auth=decodeURIComponent(A)),T=-1,I=0;I<l.length;I++){var R;-1!==(R=_.indexOf(l[I]))&&(-1===T||R<T)&&(T=R)}-1===T&&(T=_.length),this.host=_.slice(0,T),_=_.slice(T),this.parseHost(),this.hostname=this.hostname||"";var C="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!C)for(var P=this.hostname.split(/\./),x=(I=0,P.length);I<x;I++){var N=P[I];if(N&&!N.match(p)){for(var B="",L=0,D=N.length;L<D;L++)N.charCodeAt(L)>127?B+="x":B+=N[L];if(!B.match(p)){var j=P.slice(0,I),U=P.slice(I+1),q=N.match(m);q&&(j.push(q[1]),U.unshift(q[2])),U.length&&(_="/"+U.join(".")+_),this.hostname=j.join(".");break}}}this.hostname.length>d?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=i.toASCII(this.hostname));var F=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+F,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==_[0]&&(_="/"+_))}if(!g[E])for(I=0,x=f.length;I<x;I++){var H=f[I];if(-1!==_.indexOf(H)){var K=encodeURIComponent(H);K===H&&(K=escape(H)),_=_.split(H).join(K)}}var V=_.indexOf("#");-1!==V&&(this.hash=_.substr(V),_=_.slice(0,V));var G=_.indexOf("?");if(-1!==G?(this.search=_.substr(G),this.query=_.substr(G+1),e&&(this.query=v.parse(this.query)),_=_.slice(0,G)):e&&(this.search="",this.query={}),_&&(this.pathname=_),b[E]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){F=this.pathname||"";var W=this.search||"";this.path=F+W}return this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",i=this.hash||"",o=!1,s="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&n.isObject(this.query)&&Object.keys(this.query).length&&(s=v.stringify(this.query));var a=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||b[e])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),a&&"?"!==a.charAt(0)&&(a="?"+a),e+o+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(a=a.replace("#","%23"))+i},o.prototype.resolve=function(t){return this.resolveObject(w(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if(n.isString(t)){var e=new o;e.parse(t,!1,!0),t=e}for(var r=new o,i=Object.keys(this),s=0;s<i.length;s++){var a=i[s];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var h=Object.keys(t),u=0;u<h.length;u++){var f=h[u];"protocol"!==f&&(r[f]=t[f])}return b[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!b[t.protocol]){for(var l=Object.keys(t),c=0;c<l.length;c++){var d=l[c];r[d]=t[d]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||y[t.protocol])r.pathname=t.pathname;else{for(var p=(t.pathname||"").split("/");p.length&&!(t.host=p.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),r.pathname=p.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var m=r.pathname||"",g=r.search||"";r.path=m+g}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),w=t.host||t.pathname&&"/"===t.pathname.charAt(0),_=w||v||r.host&&t.pathname,M=_,S=r.pathname&&r.pathname.split("/")||[],E=(p=t.pathname&&t.pathname.split("/")||[],r.protocol&&!b[r.protocol]);if(E&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===p[0]?p[0]=t.host:p.unshift(t.host)),t.host=null),_=_&&(""===p[0]||""===S[0])),w)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,S=p;else if(p.length)S||(S=[]),S.pop(),S=S.concat(p),r.search=t.search,r.query=t.query;else if(!n.isNullOrUndefined(t.search))return E&&(r.hostname=r.host=S.shift(),(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift())),r.search=t.search,r.query=t.query,n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var k=S.slice(-1)[0],A=(r.host||t.host||S.length>1)&&("."===k||".."===k)||""===k,O=0,T=S.length;T>=0;T--)"."===(k=S[T])?S.splice(T,1):".."===k?(S.splice(T,1),O++):O&&(S.splice(T,1),O--);if(!_&&!M)for(;O--;O)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var I,R=""===S[0]||S[0]&&"/"===S[0].charAt(0);return E&&(r.hostname=r.host=R?"":S.length?S.shift():"",(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift())),(_=_||r.host&&S.length)&&!R&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":77,punycode:51,querystring:54}],77:[function(t,e,r){e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],78:[function(t,e,r){(function(t){(function(){function r(t,e){if(i("noDeprecation"))return t;var r=!1;function n(){if(!r){if(i("throwDeprecation"))throw new Error(e);i("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function i(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=r}).call(this)}).call(this,void 0!==Y?Y:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],79:[function(t,e,r){function i(t,e){if(t&&e)return i(t)(e);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){r[e]=t[e]})),r;function r(){for(var e=new Array(arguments.length),r=0;r<e.length;r++)e[r]=arguments[r];var i=t.apply(this,e),n=e[e.length-1];return"function"==typeof i&&i!==n&&Object.keys(n).forEach((function(t){i[t]=n[t]})),i}}e.exports=i},{}],80:[function(t,e,r){e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(t,e,r){e.exports=n;var i=Object.prototype.hasOwnProperty;function n(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var n in r)i.call(r,n)&&(t[n]=r[n])}return t}},{}],82:[function(t,e,r){e.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}},{}],83:[function(t,e,r){function i(t){var e=this;if(e instanceof i||(e=new i),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)e.push(arguments[r]);return e}function n(t,e,r){var i=e===t.head?new a(r,null,e,t):new a(r,e,e.next,t);return null===i.next&&(t.tail=i),null===i.prev&&(t.head=i),t.length++,i}function o(t,e){t.tail=new a(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function s(t,e){t.head=new a(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function a(t,e,r,i){if(!(this instanceof a))return new a(t,e,r,i);this.list=i,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=i,i.Node=a,i.create=i,i.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e},i.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},i.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},i.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)o(this,arguments[t]);return this.length},i.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)s(this,arguments[t]);return this.length},i.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},i.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},i.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,i=0;null!==r;i++)t.call(e,r.value,i,this),r=r.next},i.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,i=this.length-1;null!==r;i--)t.call(e,r.value,i,this),r=r.prev},i.prototype.get=function(t){for(var e=0,r=this.head;null!==r&&e<t;e++)r=r.next;if(e===t&&null!==r)return r.value},i.prototype.getReverse=function(t){for(var e=0,r=this.tail;null!==r&&e<t;e++)r=r.prev;if(e===t&&null!==r)return r.value},i.prototype.map=function(t,e){e=e||this;for(var r=new i,n=this.head;null!==n;)r.push(t.call(e,n.value,this)),n=n.next;return r},i.prototype.mapReverse=function(t,e){e=e||this;for(var r=new i,n=this.tail;null!==n;)r.push(t.call(e,n.value,this)),n=n.prev;return r},i.prototype.reduce=function(t,e){var r,i=this.head;if(arguments.length>1)r=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,r=this.head.value}for(var n=0;null!==i;n++)r=t(r,i.value,n),i=i.next;return r},i.prototype.reduceReverse=function(t,e){var r,i=this.tail;if(arguments.length>1)r=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==i;n--)r=t(r,i.value,n),i=i.prev;return r},i.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;null!==r;e++)t[e]=r.value,r=r.next;return t},i.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;null!==r;e++)t[e]=r.value,r=r.prev;return t},i.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new i;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=0,o=this.head;null!==o&&n<t;n++)o=o.next;for(;null!==o&&n<e;n++,o=o.next)r.push(o.value);return r},i.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new i;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=this.length,o=this.tail;null!==o&&n>e;n--)o=o.prev;for(;null!==o&&n>t;n--,o=o.prev)r.push(o.value);return r},i.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var i=0,o=this.head;null!==o&&i<t;i++)o=o.next;var s=[];for(i=0;o&&i<e;i++)s.push(o.value),o=this.removeNode(o);for(null===o&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev),i=0;i<r.length;i++)o=n(this,o,r[i]);return s},i.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;null!==r;r=r.prev){var i=r.prev;r.prev=r.next,r.next=i}return this.head=e,this.tail=t,this};try{t("./iterator.js")(i)}catch(t){}},{"./iterator.js":82}]},{},[12])(12);var qA=Z(jA);const FA=Object.create(null);FA.open="0",FA.close="1",FA.ping="2",FA.pong="3",FA.message="4",FA.upgrade="5",FA.noop="6";const zA=Object.create(null);Object.keys(FA).forEach((t=>{zA[FA[t]]=t}));const HA={type:"error",data:"parser error"},KA="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),VA="function"==typeof ArrayBuffer,GA=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,WA=({type:t,data:e},r,i)=>KA&&e instanceof Blob?r?i(e):YA(e,i):VA&&(e instanceof ArrayBuffer||GA(e))?r?i(e):YA(new Blob([e]),i):i(FA[t]+(e||"")),YA=(t,e)=>{const r=new FileReader;return r.onload=function(){const t=r.result.split(",")[1];e("b"+(t||""))},r.readAsDataURL(t)};function ZA(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let XA;const QA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",JA="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let t=0;t<64;t++)JA[QA.charCodeAt(t)]=t;const $A="function"==typeof ArrayBuffer,tO=(t,e)=>{if("string"!=typeof t)return{type:"message",data:rO(t,e)};const r=t.charAt(0);if("b"===r)return{type:"message",data:eO(t.substring(1),e)};return zA[r]?t.length>1?{type:zA[r],data:t.substring(1)}:{type:zA[r]}:HA},eO=(t,e)=>{if($A){const r=(t=>{let e,r,i,n,o,s=.75*t.length,a=t.length,h=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);const u=new ArrayBuffer(s),f=new Uint8Array(u);for(e=0;e<a;e+=4)r=JA[t.charCodeAt(e)],i=JA[t.charCodeAt(e+1)],n=JA[t.charCodeAt(e+2)],o=JA[t.charCodeAt(e+3)],f[h++]=r<<2|i>>4,f[h++]=(15&i)<<4|n>>2,f[h++]=(3&n)<<6|63&o;return u})(t);return rO(r,e)}return{base64:!0,data:t}},rO=(t,e)=>"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer,iO=String.fromCharCode(30);function nO(){return new TransformStream({transform(t,e){!function(t,e){KA&&t.data instanceof Blob?t.data.arrayBuffer().then(ZA).then(e):VA&&(t.data instanceof ArrayBuffer||GA(t.data))?e(ZA(t.data)):WA(t,!1,(t=>{XA||(XA=new TextEncoder),e(XA.encode(t))}))}(t,(r=>{const i=r.length;let n;if(i<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,i);else if(i<65536){n=new Uint8Array(3);const t=new DataView(n.buffer);t.setUint8(0,126),t.setUint16(1,i)}else{n=new Uint8Array(9);const t=new DataView(n.buffer);t.setUint8(0,127),t.setBigUint64(1,BigInt(i))}t.data&&"string"!=typeof t.data&&(n[0]|=128),e.enqueue(n),e.enqueue(r)}))}})}let oO;function sO(t){return t.reduce(((t,e)=>t+e.length),0)}function aO(t,e){if(t[0].length===e)return t.shift();const r=new Uint8Array(e);let i=0;for(let n=0;n<e;n++)r[n]=t[0][i++],i===t[0].length&&(t.shift(),i=0);return t.length&&i<t[0].length&&(t[0]=t[0].slice(i)),r}function hO(t){if(t)return function(t){for(var e in hO.prototype)t[e]=hO.prototype[e];return t}(t)}hO.prototype.on=hO.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},hO.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},hO.prototype.off=hO.prototype.removeListener=hO.prototype.removeAllListeners=hO.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,i=this._callbacks["$"+t];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n=0;n<i.length;n++)if((r=i[n])===e||r.fn===e){i.splice(n,1);break}return 0===i.length&&delete this._callbacks["$"+t],this},hO.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(r){i=0;for(var n=(r=r.slice(0)).length;i<n;++i)r[i].apply(this,e)}return this},hO.prototype.emitReserved=hO.prototype.emit,hO.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},hO.prototype.hasListeners=function(t){return!!this.listeners(t).length};const uO="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function fO(t,...e){return e.reduce(((e,r)=>(t.hasOwnProperty(r)&&(e[r]=t[r]),e)),{})}const lO=uO.setTimeout,cO=uO.clearTimeout;function dO(t,e){e.useNativeTimers?(t.setTimeoutFn=lO.bind(uO),t.clearTimeoutFn=cO.bind(uO)):(t.setTimeoutFn=uO.setTimeout.bind(uO),t.clearTimeoutFn=uO.clearTimeout.bind(uO))}class pO extends Error{constructor(t,e,r){super(t),this.description=e,this.context=r,this.type="TransportError"}}class mO extends hO{constructor(t){super(),this.writable=!1,dO(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,e,r){return super.emitReserved("error",new pO(t,e,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const e=tO(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){const t=this.opts.hostname;return-1===t.indexOf(":")?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(t){const e=function(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}(t);return e.length?"?"+e:""}}const gO="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),yO=64,bO={};let vO,wO=0,_O=0;function MO(t){let e="";do{e=gO[t%yO]+e,t=Math.floor(t/yO)}while(t>0);return e}function SO(){const t=MO(+new Date);return t!==vO?(wO=0,vO=t):t+"."+MO(wO++)}for(;_O<yO;_O++)bO[gO[_O]]=_O;let EO=!1;try{EO="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}const kO=EO;function AO(t){const e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||kO))return new XMLHttpRequest}catch(t){}if(!e)try{return new(uO[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}function OO(){}const TO=null!=new AO({xdomain:!1}).responseType;class IO extends hO{constructor(t,e){super(),dO(this,e),this.opts=e,this.method=e.method||"GET",this.uri=t,this.data=void 0!==e.data?e.data:null,this.create()}create(){var t;const e=fO(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd;const r=this.xhr=new AO(e);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let t in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(t)&&r.setRequestHeader(t,this.opts.extraHeaders[t])}}catch(t){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}null===(t=this.opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var t;3===r.readyState&&(null===(t=this.opts.cookieJar)||void 0===t||t.parseCookies(r)),4===r.readyState&&(200===r.status||1223===r.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(t){return void this.setTimeoutFn((()=>{this.onError(t)}),0)}"undefined"!=typeof document&&(this.index=IO.requestsCount++,IO.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=OO,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete IO.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(IO.requestsCount=0,IO.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",RO);else if("function"==typeof addEventListener){addEventListener("onpagehide"in uO?"pagehide":"unload",RO,!1)}function RO(){for(let t in IO.requests)IO.requests.hasOwnProperty(t)&&IO.requests[t].abort()}const CO="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),PO=uO.WebSocket||uO.MozWebSocket,xO="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();const NO={websocket:class extends mO{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),e=this.opts.protocols,r=xO?{}:fO(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=xO?new PO(t,e,r):e?new PO(t,e):new PO(t)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const r=t[e],i=e===t.length-1;WA(r,this.supportsBinary,(t=>{try{this.ws.send(t)}catch(t){}i&&CO((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=SO()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}check(){return!!PO}},webtransport:class extends mO{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((t=>{this.onError("webtransport error",t)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((t=>{const e=function(t,e){oO||(oO=new TextDecoder);const r=[];let i=0,n=-1,o=!1;return new TransformStream({transform(s,a){for(r.push(s);;){if(0===i){if(sO(r)<1)break;const t=aO(r,1);o=128==(128&t[0]),n=127&t[0],i=n<126?3:126===n?1:2}else if(1===i){if(sO(r)<2)break;const t=aO(r,2);n=new DataView(t.buffer,t.byteOffset,t.length).getUint16(0),i=3}else if(2===i){if(sO(r)<8)break;const t=aO(r,8),e=new DataView(t.buffer,t.byteOffset,t.length),o=e.getUint32(0);if(o>Math.pow(2,21)-1){a.enqueue(HA);break}n=o*Math.pow(2,32)+e.getUint32(4),i=3}else{if(sO(r)<n)break;const t=aO(r,n);a.enqueue(tO(o?t:oO.decode(t),e)),i=0}if(0===n||n>t){a.enqueue(HA);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(e).getReader(),i=nO();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const n=()=>{r.read().then((({done:t,value:e})=>{t||(this.onPacket(e),n())})).catch((t=>{}))};n();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then((()=>this.onOpen()))}))})))}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const r=t[e],i=e===t.length-1;this.writer.write(r).then((()=>{i&&CO((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var t;null===(t=this.transport)||void 0===t||t.close()}},polling:class extends mO{constructor(t){if(super(t),this.polling=!1,"undefined"!=typeof location){const e="https:"===location.protocol;let r=location.port;r||(r=e?"443":"80"),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||r!==t.port}const e=t&&t.forceBase64;this.supportsBinary=TO&&!e,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(t){this.readyState="pausing";const e=()=>{this.readyState="paused",t()};if(this.polling||!this.writable){let t=0;this.polling&&(t++,this.once("pollComplete",(function(){--t||e()}))),this.writable||(t++,this.once("drain",(function(){--t||e()})))}else e()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){((t,e)=>{const r=t.split(iO),i=[];for(let t=0;t<r.length;t++){const n=tO(r[t],e);if(i.push(n),"error"===n.type)break}return i})(t,this.socket.binaryType).forEach((t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){this.writable=!1,((t,e)=>{const r=t.length,i=new Array(r);let n=0;t.forEach(((t,o)=>{WA(t,!1,(t=>{i[o]=t,++n===r&&e(i.join(iO))}))}))})(t,(t=>{this.doWrite(t,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const t=this.opts.secure?"https":"http",e=this.query||{};return!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=SO()),this.supportsBinary||e.sid||(e.b64=1),this.createUri(t,e)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new IO(this.uri(),t)}doWrite(t,e){const r=this.request({method:"POST",data:t});r.on("success",e),r.on("error",((t,e)=>{this.onError("xhr post error",t,e)}))}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",((t,e)=>{this.onError("xhr poll error",t,e)})),this.pollXhr=t}}},BO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,LO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function DO(t){const e=t,r=t.indexOf("["),i=t.indexOf("]");-1!=r&&-1!=i&&(t=t.substring(0,r)+t.substring(r,i).replace(/:/g,";")+t.substring(i,t.length));let n=BO.exec(t||""),o={},s=14;for(;s--;)o[LO[s]]=n[s]||"";return-1!=r&&-1!=i&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(t,e){const r=/\/{2,9}/g,i=e.replace(r,"/").split("/");"/"!=e.slice(0,1)&&0!==e.length||i.splice(0,1);"/"==e.slice(-1)&&i.splice(i.length-1,1);return i}(0,o.path),o.queryKey=function(t,e){const r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,i){e&&(r[e]=i)})),r}(0,o.query),o}let jO=class t extends hO{constructor(t,e={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],t&&"object"==typeof t&&(e=t,t=null),t?(t=DO(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=DO(e.host).host),dO(this,e),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=e.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(t){let e={},r=t.split("&");for(let t=0,i=r.length;t<i;t++){let i=r[t].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);const r=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new NO[t](r)}open(){let e;if(this.opts.rememberUpgrade&&t.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(t){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(t=>this.onClose("transport close",t)))}probe(e){let r=this.createTransport(e),i=!1;t.priorWebsocketSuccess=!1;const n=()=>{i||(r.send([{type:"ping",data:"probe"}]),r.once("packet",(e=>{if(!i)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;t.priorWebsocketSuccess="websocket"===r.name,this.transport.pause((()=>{i||"closed"!==this.readyState&&(f(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())}))}else{const t=new Error("probe error");t.transport=r.name,this.emitReserved("upgradeError",t)}})))};function o(){i||(i=!0,f(),r.close(),r=null)}const s=t=>{const e=new Error("probe error: "+t);e.transport=r.name,o(),this.emitReserved("upgradeError",e)};function a(){s("transport closed")}function h(){s("socket closed")}function u(t){r&&t.name!==r.name&&o()}const f=()=>{r.removeListener("open",n),r.removeListener("error",s),r.removeListener("close",a),this.off("close",h),this.off("upgrading",u)};r.once("open",n),r.once("error",s),r.once("close",a),this.once("close",h),this.once("upgrading",u),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{i||r.open()}),200):r.open()}onOpen(){if(this.readyState="open",t.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let t=0;const e=this.upgrades.length;for(;t<e;t++)this.probe(this.upgrades[t])}}onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),this.resetPingTimeout(),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.maxPayload=t.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(t+="string"==typeof(e=i)?function(t){let e=0,r=0;for(let i=0,n=t.length;i<n;i++)e=t.charCodeAt(i),e<128?r+=1:e<2048?r+=2:e<55296||e>=57344?r+=3:(i++,r+=4);return r}(e):Math.ceil(1.33*(e.byteLength||e.size))),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}var e;return this.writeBuffer}write(t,e,r){return this.sendPacket("message",t,e,r),this}send(t,e,r){return this.sendPacket("message",t,e,r),this}sendPacket(t,e,r,i){if("function"==typeof e&&(i=e,e=void 0),"function"==typeof r&&(i=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const n={type:t,data:e,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},r=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?r():t()})):this.upgrading?r():t()),this}onError(e){t.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const e=[];let r=0;const i=t.length;for(;r<i;r++)~this.transports.indexOf(t[r])&&e.push(t[r]);return e}};jO.protocol=4;const UO="function"==typeof ArrayBuffer,qO=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,FO=Object.prototype.toString,zO="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===FO.call(Blob),HO="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===FO.call(File);function KO(t){return UO&&(t instanceof ArrayBuffer||qO(t))||zO&&t instanceof Blob||HO&&t instanceof File}function VO(t,e){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let e=0,r=t.length;e<r;e++)if(VO(t[e]))return!0;return!1}if(KO(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return VO(t.toJSON(),!0);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&VO(t[e]))return!0;return!1}function GO(t){const e=[],r=t.data,i=t;return i.data=WO(r,e),i.attachments=e.length,{packet:i,buffers:e}}function WO(t,e){if(!t)return t;if(KO(t)){const r={_placeholder:!0,num:e.length};return e.push(t),r}if(Array.isArray(t)){const r=new Array(t.length);for(let i=0;i<t.length;i++)r[i]=WO(t[i],e);return r}if("object"==typeof t&&!(t instanceof Date)){const r={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=WO(t[i],e));return r}return t}function YO(t,e){return t.data=ZO(t.data,e),delete t.attachments,t}function ZO(t,e){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=ZO(t[r],e);else if("object"==typeof t)for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=ZO(t[r],e));return t}const XO=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var QO;!function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"}(QO||(QO={}));function JO(t){return"[object Object]"===Object.prototype.toString.call(t)}class $O extends hO{constructor(t){super(),this.reviver=t}add(t){let e;if("string"==typeof t){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);const r=e.type===QO.BINARY_EVENT;r||e.type===QO.BINARY_ACK?(e.type=r?QO.EVENT:QO.ACK,this.reconstructor=new tT(e),0===e.attachments&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else{if(!KO(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e))}}decodeString(t){let e=0;const r={type:Number(t.charAt(0))};if(void 0===QO[r.type])throw new Error("unknown packet type "+r.type);if(r.type===QO.BINARY_EVENT||r.type===QO.BINARY_ACK){const i=e+1;for(;"-"!==t.charAt(++e)&&e!=t.length;);const n=t.substring(i,e);if(n!=Number(n)||"-"!==t.charAt(e))throw new Error("Illegal attachments");r.attachments=Number(n)}if("/"===t.charAt(e+1)){const i=e+1;for(;++e;){if(","===t.charAt(e))break;if(e===t.length)break}r.nsp=t.substring(i,e)}else r.nsp="/";const i=t.charAt(e+1);if(""!==i&&Number(i)==i){const i=e+1;for(;++e;){const r=t.charAt(e);if(null==r||Number(r)!=r){--e;break}if(e===t.length)break}r.id=Number(t.substring(i,e+1))}if(t.charAt(++e)){const i=this.tryParse(t.substr(e));if(!$O.isPayloadValid(r.type,i))throw new Error("invalid payload");r.data=i}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch(t){return!1}}static isPayloadValid(t,e){switch(t){case QO.CONNECT:return JO(e);case QO.DISCONNECT:return void 0===e;case QO.CONNECT_ERROR:return"string"==typeof e||JO(e);case QO.EVENT:case QO.BINARY_EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===XO.indexOf(e[0]));case QO.ACK:case QO.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class tT{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const t=YO(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var eT=Object.freeze({__proto__:null,Decoder:$O,Encoder:class{constructor(t){this.replacer=t}encode(t){return t.type!==QO.EVENT&&t.type!==QO.ACK||!VO(t)?[this.encodeAsString(t)]:this.encodeAsBinary({type:t.type===QO.EVENT?QO.BINARY_EVENT:QO.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id})}encodeAsString(t){let e=""+t.type;return t.type!==QO.BINARY_EVENT&&t.type!==QO.BINARY_ACK||(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){const e=GO(t),r=this.encodeAsString(e.packet),i=e.buffers;return i.unshift(r),i}},get PacketType(){return QO},protocol:5});function rT(t,e,r){return t.on(e,r),function(){t.off(e,r)}}const iT=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class nT extends hO{constructor(t,e,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[rT(t,"open",this.onopen.bind(this)),rT(t,"packet",this.onpacket.bind(this)),rT(t,"error",this.onerror.bind(this)),rT(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){if(iT.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const r={type:QO.EVENT,data:e,options:{}};if(r.options.compress=!1!==this.flags.compress,"function"==typeof e[e.length-1]){const t=this.ids++,i=e.pop();this._registerAckCallback(t,i),r.id=t}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,e){var r;const i=null!==(r=this.flags.timeout)&&void 0!==r?r:this._opts.ackTimeout;if(void 0===i)return void(this.acks[t]=e);const n=this.io.setTimeoutFn((()=>{delete this.acks[t];for(let e=0;e<this.sendBuffer.length;e++)this.sendBuffer[e].id===t&&this.sendBuffer.splice(e,1);e.call(this,new Error("operation has timed out"))}),i);this.acks[t]=(...t)=>{this.io.clearTimeoutFn(n),e.apply(this,[null,...t])}}emitWithAck(t,...e){const r=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((i,n)=>{e.push(((t,e)=>r?t?n(t):i(e):i(t))),this.emit(t,...e)}))}_addToQueue(t){let e;"function"==typeof t[t.length-1]&&(e=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push(((t,...i)=>{if(r!==this._queue[0])return;return null!==t?r.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(t)):(this._queue.shift(),e&&e(null,...i)),r.pending=!1,this._drainQueue()})),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||0===this._queue.length)return;const e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){"function"==typeof this.auth?this.auth((t=>{this._sendConnectPacket(t)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:QO.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case QO.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case QO.EVENT:case QO.BINARY_EVENT:this.onevent(t);break;case QO.ACK:case QO.BINARY_ACK:this.onack(t);break;case QO.DISCONNECT:this.ondisconnect();break;case QO.CONNECT_ERROR:this.destroy();const e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){const e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const r of e)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}ack(t){const e=this;let r=!1;return function(...i){r||(r=!0,e.packet({type:QO.ACK,id:t,data:i}))}}onack(t){const e=this.acks[t.id];"function"==typeof e&&(e.apply(this,t.data),delete this.acks[t.id])}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((t=>this.emitEvent(t))),this.receiveBuffer=[],this.sendBuffer.forEach((t=>{this.notifyOutgoingListeners(t),this.packet(t)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((t=>t())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:QO.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const e=this._anyListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const e=this._anyOutgoingListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const r of e)r.apply(this,t.data)}}}function oT(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}oT.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-r:t+r}return 0|Math.min(t,this.max)},oT.prototype.reset=function(){this.attempts=0},oT.prototype.setMin=function(t){this.ms=t},oT.prototype.setMax=function(t){this.max=t},oT.prototype.setJitter=function(t){this.jitter=t};class sT extends hO{constructor(t,e){var r;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.opts=e,dO(this,e),this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(r=e.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new oT({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this._readyState="closed",this.uri=t;const i=e.parser||eT;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==e.autoConnect,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null===(e=this.backoff)||void 0===e||e.setMin(t),this)}randomizationFactor(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null===(e=this.backoff)||void 0===e||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null===(e=this.backoff)||void 0===e||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new jO(this.uri,this.opts);const e=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=rT(e,"open",(function(){r.onopen(),t&&t()})),n=e=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",e),t?t(e):this.maybeReconnectOnOpen()},o=rT(e,"error",n);if(!1!==this._timeout){const t=this._timeout,r=this.setTimeoutFn((()=>{i(),n(new Error("timeout")),e.close()}),t);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(rT(t,"ping",this.onping.bind(this)),rT(t,"data",this.ondata.bind(this)),rT(t,"error",this.onerror.bind(this)),rT(t,"close",this.onclose.bind(this)),rT(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}ondecoded(t){CO((()=>{this.emitReserved("packet",t)}),this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new nT(this,t,e),this.nsps[t]=r),r}_destroy(t){const e=Object.keys(this.nsps);for(const t of e){if(this.nsps[t].active)return}this._close()}_packet(t){const e=this.encoder.encode(t);for(let r=0;r<e.length;r++)this.engine.write(e[r],t.options)}cleanup(){this.subs.forEach((t=>t())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,e){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn((()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open((e=>{e?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",e)):t.onreconnect()})))}),e);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const aT={};function hT(t,e){"object"==typeof t&&(e=t,t=void 0);const r=function(t,e="",r){let i=t;r=r||"undefined"!=typeof location&&location,null==t&&(t=r.protocol+"//"+r.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?r.protocol+t:r.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==r?r.protocol+"//"+t:"https://"+t),i=DO(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const n=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+e,i.href=i.protocol+"://"+n+(r&&r.port===i.port?"":":"+i.port),i}(t,(e=e||{}).path||"/socket.io"),i=r.source,n=r.id,o=r.path,s=aT[n]&&o in aT[n].nsps;let a;return e.forceNew||e["force new connection"]||!1===e.multiplex||s?a=new sT(i,e):(aT[n]||(aT[n]=new sT(i,e)),a=aT[n]),r.query&&!e.query&&(e.query=r.queryKey),a.socket(r.path,e)}Object.assign(hT,{Manager:sT,Socket:nT,io:hT,connect:hT});class uT{constructor(t,e){this.method="GET",this.protocol="HTTPS",this.body=null,this.interval=0,this.timeout=1e4,this.responseType="",this.filteredData=null,this.XHR=void 0,this.isInterval=!1,this.successCallback=void 0,this.errorCallback=void 0,this.statusCallback=void 0,this.onTimeout=()=>{this.XHR&&(this.onErrorCallback(new Error("Error: timeout")),this.circulateRequest())},this.onLoad=()=>{if(this.XHR){if(this.responseData=this.toObject(this.XHR.response),4!==this.XHR.readyState||200!=this.XHR.status&&304!=this.XHR.status)this.onErrorCallback(new Error(this.XHR.statusText));else{try{this.filteredData=this.filter?this.filter(this.responseData):this.responseData}catch(t){this.filteredData=void 0,console.error(t)}this.onSuccessCallback(this.responseData,this.filteredData)}this.circulateRequest()}},this.onError=()=>{this.XHR&&this.onErrorCallback(new Error(this.XHR.statusText))},this.url=t,e&&(this.option=e,this.method=e.method?e.method.toUpperCase():"GET",this.protocol=e.protocol?e.protocol.toUpperCase():"HTTPS",this.headers=e.headers?e.headers:void 0,this.params=e.params?e.params:void 0,this.body=e.body?e.body:null,this.interval=void 0!==e.interval?e.interval:0,this.timeout=e.timeout?e.timeout:1e4,this.responseType=void 0!==e.responseType?e.responseType:"",e.filter&&(this.filter="function"==typeof e.filter?e.filter:new Function("response",e.filter)))}get getUrl(){return this.url}get getOption(){return Object.assign(Object.assign({},this.option),{url:this.url})}get getStatus(){var t;return null===(t=this.XHR)||void 0===t?void 0:t.status}get getRequesting(){return this.isInterval&&0!==this.interval}get getResponseData(){return this.responseData}get getFilterData(){return this.filteredData}send(){this.isInterval=!0,this.request()}abort(){this.isInterval=!1}onceSend(){this.request()}listen(t,e){this.successCallback=t,e&&(this.errorCallback=e)}on(t,e){switch(t){case"onSuccess":this.successCallback=e;break;case"onError":this.errorCallback=e;break;case"onStatus":this.statusCallback=e}}onStatusCallback(t,e){this.statusCallback&&this.statusCallback(t,e)}onErrorCallback(t){this.errorCallback&&this.errorCallback(t),this.onStatusCallback("error",t)}onSuccessCallback(t,e){this.successCallback&&this.successCallback(t,e),this.onStatusCallback("success")}request(){try{if(this.onStatusCallback("connect"),this.XHR||(this.XHR=new XMLHttpRequest),this.XHR.open(this.method,this.paramsUrl()),this.XHR.responseType=this.responseType,this.XHR.timeout=this.timeout,this.XHR.onload=this.onLoad,this.XHR.onerror=this.onError,this.XHR.ontimeout=this.onTimeout,this.headers)for(const t in this.headers)Object.prototype.hasOwnProperty.call(this.headers,t)&&"multipart/form-data"!==this.headers[t]&&this.XHR.setRequestHeader(t,this.headers[t]);this.XHR.send(this.body)}catch(t){console.error(t),this.onErrorCallback(t)}}circulateRequest(){if(this.getRequesting){const t=setTimeout((()=>{this.request(),clearTimeout(t)}),this.interval)}else this.isInterval&&(this.isInterval=!1)}paramsUrl(){let t=this.url+"?";if(this.params)for(const e in this.params)Object.prototype.hasOwnProperty.call(this.params,e)&&(t+=encodeURIComponent(e)+"="+encodeURIComponent(this.params[e])+"&");return t.slice(0,-1)}toObject(t){if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}}}var fT,lT,cT,dT,pT,mT,gT,yT,bT,vT,wT,_T,MT,ST,ET,kT,AT,OT,TT,IT,RT;function CT(t){const e=typeof t;return null!=t&&("object"===e||"function"===e)}function PT(t){let e=t.protocolValue+t.url;return t.port&&(e+=":"+t.port),e}function xT(t,e,r=!1,i,n,o){try{if(!e)return t;let n="";r&&CT(t)&&(n=`const { ${Object.keys(t).join(",")} } = response;`);const a=new Function("response",n+e)(t),h=i?function(t){return"number"==typeof t}(s=a)?`${s}`:CT(s)?JSON.stringify(s,null,2):s:a;return o&&o(h),h}catch(t){return n&&n(t),t}var s}function NT(t,e){if(t.protocol!==lT.HTTP)return;const r=t.configureJson,i=function(t,e){switch(e){case mT.SECOND:return 1e3*t;case mT.MINUTE:return 1e3*t*60;case mT.HOUR:return 1e3*t*60*60;case mT.DAY:return 1e3*t*60*60*24;default:return 1e3*t}}(r.interval,r.unit),n=Object.assign(e[fT.HEADERS],t[fT.HEADERS]);let o=null;const s=r.params,a=new FormData;switch(a.set("default","defaultData"),r.bodyType){case dT.NONE:break;case dT.JSON:n["Content-Type"]=gT.JSON,o=r.body.json;break;case dT.XML:n["Content-Type"]=gT.XML,o=r.body.xml;break;case dT.X_WWW_FORM_URLENCODED:n["Content-Type"]=gT.FORM_URLENCODED;o=function(t){const e=new URLSearchParams;for(const r in t)Object.prototype.hasOwnProperty.call(t,"key")&&e.append(r,t[r]);return e.toString()}(r.body["x-www-form-urlencoded"]);break;case dT.FORM_DATA:{n["Content-Type"]=gT.FORM_DATA;const t=r.body["form-data"];for(const e in t)a.set(e,t[e]);o=a;break}}return{params:s,headers:n,interval:i,body:o,method:r.method,filter:r.filter,protocol:e.protocol}}function BT(t,e,r,i){const n=(t,e)=>{r({status:t,message:e})};e.on("reconnect",(()=>{n(yT.CONNECT)})),e.on("close",(t=>{const e=t||new Error("连接关闭");n(yT.CLOSE,e)})),e.on("error",(t=>{n(yT.ERROR,t)})),e.on("message",((r,n,o)=>{i({api:t,client:e,data:{topic:r,payload:n,packet:o}})})),e.on("connect",(r=>{if(0===r.returnCode)n(yT.SUCCESS,r),function(t,e){const r=t.configureJson,i=r.subscription;if(0==i.length)return;const n={};i.forEach((t=>{t.topic&&(n[t.topic]={qos:t.qos})})),Object.keys(n).length>0&&e.subscribe(n,(t=>{t&&console.error(t)}))}(t,e);else{const t=void 0!==r.returnCode?String(r.returnCode):r.cmd;e.emit("close",new Error(t))}}))}function LT(t,e,r,i){const n=PT(e),o=function(t){if(t.protocol!==lT.MQTT)return;const e=t.configureJson,{baseConfig:r,willMessage:i}=e,n={clientId:r.clientId,keepalive:r.keepAlive,protocolVersion:Number(r.version),protocolId:"MQTT",reconnectPeriod:0};return i&&i.topic&&(n.will={topic:i.topic,payload:i.message||"",qos:i.qos,retain:i.retain}),r.username&&(n.username=r.username),r.password&&(n.password=r.password),n}(t),s=qA.connect(n+(t.url||""),o),a=t.configureJson,{successCallback:h,errorCallback:u}=a;return BT(t,s,(({status:e,message:i})=>{const n=e!==yT.CONNECT?i:void 0;r({api:t,client:s,status:e,message:n}),e===yT.CONNECT&&h?xT({connect:i,client:s},h,!0):e!==yT.ERROR&&e!==yT.CLOSE||!u||xT({error:i,client:s},u,!0)}),i),s}function DT(t,e,r,i){let n=PT(e);const o=function(t,e){if(t.protocol!==lT.WEBSOCKET)return;const r=t.configureJson,i=Object.assign(e[fT.HEADERS],t[fT.HEADERS]),{subProtocols:n,query:o}=r,s=n?n.split(","):["websocket","polling"];return{reconnection:!1,reconnectionAttempts:0,path:t.url,query:o,transports:s,extraHeaders:i,withCredentials:!0}}(t,e),s=t.configureJson,{successCallback:a,errorCallback:h,nameSpace:u}=s;u&&(n+=(/^\/.*/.test(u)?"":"/")+u);const f=hT(n,o);return function(t,e,r,i){const n=t.configureJson,{eventList:o}=n;e.on("connect",(()=>{r(yT.SUCCESS)})),e.on("disconnect",(t=>{r(yT.CLOSE,new Error(t))})),e.on("connect_error",(t=>{r(yT.ERROR,t)})),e.on("reconnect",(()=>{r(yT.CONNECT)})),e.on("reconnect_error",(t=>{r(yT.ERROR,t)})),e.on("reconnect_failed",(t=>{r(yT.ERROR,t||new Error("reconnect_failed"))}));for(let r=0;r<o.length;r++){const n=o[r];e.on(n.event,((...r)=>{i({api:t,client:e,data:{message:r,event:n.event}})}))}}(t,f,((e,i)=>{r({status:e,api:t,client:f,message:i}),e===yT.SUCCESS&&a?xT({socket:f},a,!0):e!==yT.ERROR&&e!==yT.CLOSE||!h||xT({error:i,socket:f},h,!0)}),i),f.connect(),f}!function(t){t.PARAMS="params",t.BODY="body",t.HEADERS="headers"}(fT||(fT={})),function(t){t.HTTP="HTTP",t.MQTT="MQTT",t.WEBSOCKET="WebSocket"}(lT||(lT={})),function(t){t.HTTPS="https://",t.HTTP="http://",t.MQTTS="wss://",t.MQTT="ws://",t.WSS="wss://",t.WS="ws://"}(cT||(cT={})),function(t){t.NONE="none",t.FORM_DATA="form-data",t.X_WWW_FORM_URLENCODED="x-www-form-urlencoded",t.JSON="json",t.XML="xml"}(dT||(dT={})),function(t){t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.OPTIONS="OPTIONS",t.DELETE="DELETE"}(pT||(pT={})),function(t){t.SECOND="second",t.MINUTE="minute",t.HOUR="hour",t.DAY="day"}(mT||(mT={})),lT.HTTP,lT.HTTP,lT.MQTT,lT.MQTT,lT.WEBSOCKET,lT.WEBSOCKET,function(t){t.JSON="application/json;charset=UTF-8",t.TEXT="text/plain;charset=UTF-8",t.XML="application/xml;charset=UTF-8",t.FORM_URLENCODED="application/x-www-form-urlencoded;charset=UTF-8",t.FORM_DATA="multipart/form-data"}(gT||(gT={})),function(t){t.SUCCESS="success",t.ERROR="error",t.CONNECT="connect",t.CLOSE="close"}(yT||(yT={}));class jT{constructor(t,e){this.sourceEnv=t,this.sourceApi=e,bT.add(this),vT.set(this,{}),wT.set(this,void 0),_T.set(this,void 0),D(this,bT,"m",MT).call(this)}on(t,e){"onStatus"===t?j(this,wT,e,"f"):"onMessage"===t&&j(this,_T,e,"f")}getClientById(t){return D(this,vT,"f")[t]}requestAll(){const t=this.sourceApi;t&&t.length>0&&D(this,bT,"m",AT).call(this,t)}requestById(t){const e=this.sourceApi.filter((e=>t.some((t=>t===e.id))));e&&e.length>0&&D(this,bT,"m",AT).call(this,e)}closeAll(){for(const t in D(this,vT,"f"))if(Object.prototype.hasOwnProperty.call(D(this,vT,"f"),t)){const e=D(this,vT,"f")[t];D(this,bT,"m",kT).call(this,e)}}closeById(t){for(let e=0;e<t.length;e++){const r=t[e],i=D(this,vT,"f")[r];D(this,bT,"m",kT).call(this,i)}}}vT=new WeakMap,wT=new WeakMap,_T=new WeakMap,bT=new WeakSet,MT=function(){j(this,vT,{},"f")},ST=function(t){console.log("onStatus",t),D(this,wT,"f")&&D(this,wT,"f").call(this,t)},ET=function(t){console.log("onMessage",t),D(this,_T,"f")&&D(this,_T,"f").call(this,t)},kT=function(t){t instanceof uT?t.abort():t instanceof nT?t.close():t instanceof jA.MqttClient&&t.end()},AT=function(t){for(let e=0;e<t.length;e++){const r=t[e],i=D(this,bT,"m",RT).call(this,r.sid);if(r.nodeArray&&r.nodeArray.length>0&&i)switch(r.protocol){case lT.HTTP:D(this,bT,"m",OT).call(this,r,i);break;case lT.MQTT:D(this,bT,"m",TT).call(this,r,i);break;case lT.WEBSOCKET:D(this,bT,"m",IT).call(this,r,i)}}},OT=function(t,e){let r=D(this,vT,"f")[t.id];if(r)return r.send();r=function(t,e,r,i){const n=PT(e),o=NT(t,e),s=new uT(n+t.url,o);return s.on("onSuccess",((e,r)=>{i({api:t,client:s,data:r||e})})),s.on("onError",(e=>{i({api:t,client:s,data:e})})),s.on("onStatus",((e,i)=>{r({api:t,client:s,status:e,message:i})})),s.send(),s}(t,e,D(this,bT,"m",ST).bind(this),D(this,bT,"m",ET).bind(this)),D(this,vT,"f")[t.id]=r},TT=function(t,e){let r=D(this,vT,"f")[t.id];if(r)return r.reconnect();r=LT(t,e,D(this,bT,"m",ST).bind(this),D(this,bT,"m",ET).bind(this)),D(this,vT,"f")[t.id]=r},IT=function(t,e){let r=D(this,vT,"f")[t.id];if(r)return r.connect();r=DT(t,e,D(this,bT,"m",ST).bind(this),D(this,bT,"m",ET).bind(this)),D(this,vT,"f")[t.id]=r},RT=function(t){return this.sourceEnv.find((e=>e.id===t))};const UT=(t,e)=>e.filter((e=>e.nodeId===t&&"PANEL"===e.contentType));var qT,FT,zT,HT,KT,VT,GT,WT,YT,ZT,XT,QT,JT,$T,tI,eI,rI,iI,nI,oI,sI,aI,hI,uI,fI,lI,cI;class dI{constructor(t,e,r,i){this.treeList=t,this.poiList=e,this.plugin=r,this.cpsPlugin=i,qT.add(this),FT.set(this,{}),D(this,qT,"m",zT).call(this)}batchPoi(t,e){t.nodeArray&&0!==t.nodeArray.length&&("HTTP"===t.protocol?D(this,qT,"m",VT).call(this,t.nodeArray,e):"MQTT"===t.protocol?D(this,qT,"m",HT).call(this,t.nodeArray,e):"WebSocket"===t.protocol&&D(this,qT,"m",KT).call(this,t.nodeArray,e))}}FT=new WeakMap,qT=new WeakSet,zT=function(){if(this.treeList){const t=(t=>{const e=[],r={},i=(t,e)=>{for(const n of t){const{id:t,pid:o,familyId:s,name:a,renderType:h,path:u,children:f,deviceCode:l,deviceName:c}=n,d=Object.assign(Object.assign({},n),{id:t,pid:o,familyId:s,name:a,renderType:h,path:u,children:[],deviceCode:l,deviceName:c});e.push(d),r[t]=d,f.length>0&&i(f,d.children)}};return i(t,e),{treeNodes:e,flatNodes:r}})(this.treeList);j(this,FT,t.flatNodes,"f")}},HT=function(t,e){const{payload:r,topic:i}=e,n=(t=>{try{return JSON.parse(t)}catch(t){return null}})(r.toString()),o=null==t?void 0:t.filter((t=>{var e;return null===(e=t.eventList)||void 0===e?void 0:e.some((t=>((t,e)=>{if(t===e)return!0;const r=t.split("/"),i=e.split("/"),n=r.indexOf("#"),o=r.indexOf("+");if(-1!==n){if(-1!==o&&o<n)return r.slice(0,n).every(((t,e)=>"+"===t||t===i[e]||void 0));{const r=t.indexOf("#");if(t.slice(0,r)===e.slice(0,r))return!0}}else if(-1!==o&&r.length===i.length)return r.every(((t,e)=>"+"===t||t===i[e]||void 0));return!1})(t,i)))}));o&&D(this,qT,"m",VT).call(this,o,n)},KT=function(t,e){const{event:r,message:i}=e,n=t.filter((t=>{var e;return null===(e=t.eventList)||void 0===e?void 0:e.some((t=>t===r))}));n&&D(this,qT,"m",VT).call(this,n,i)},VT=function(t,e){if(!this.poiList)return;const r=[];for(let i=0;i<t.length;i++){const n=t[i],o=UT(n.nodeId,this.poiList),s=D(this,qT,"m",GT).call(this,e,n.matchParams||"",n.nodeId);s&&(o.forEach((t=>{if(t.contentData){const e=t.contentData.ds_user["接口数据"];if(!e)return;for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)){const r=s[t];e.hasOwnProperty(t)&&(e[t].value=r)}}})),r.push(...o))}r.length>0&&D(this,qT,"m",WT).call(this,r)},GT=function(t,e,r){const i=D(this,FT,"f")[r],n=null==i?void 0:i.deviceCode;if(i&&n)return"[object Array]"===Object.prototype.toString.call(t)?t.find((t=>String(t[e])===n)):"[object Object]"===Object.prototype.toString.call(t)?t:void 0},WT=function(t){this.plugin&&this.plugin.batchRender({dataSource:t.map(this.cpsPlugin.formatPoiData)})};class pI{get path(){return D(this,ZT,"f")}set path(t){D(this,ZT,"f")!==t&&j(this,XT,!0,"f"),j(this,ZT,t,"f")}constructor(t,e){this.ssp=t,YT.add(this),ZT.set(this,""),XT.set(this,!0),this.metaData=null,this.treeData=null,this.poiData=null,this.dataSourceData=null,this.topologyData=null,this.propertiesData=null,this.objectsAnimations=new Map,this.animationsData=null,this.modelVisionsData=null,this.flowData=[],QT.set(this,AA),JT.set(this,new PA(this.ssp.viewport)),$T.set(this,!1),tI.set(this,!1),eI.set(this,!1),this.formatPoiData=t=>{const{dimensional:e,poiId:r,media:i,display:n,scale:o,x:s,y:a,z:h,rotationX:u,rotationY:f,rotationZ:l,width:c,height:d,nodeId:p,contentType:m,style:g,contentData:y}=t;return{id:r,pid:p,visible:n,width:c,height:d,type:e,contentType:m,position:{x:s,y:a,z:h},rotation:{x:Math.PI/180*u,y:Math.PI/180*f,z:Math.PI/180*l},scale:{x:o/100,y:o/100,z:o/100},style:g,dataSource:(b=y,null==b?[]:lA(b,((t,e)=>lA(t,((t,r)=>lA(t,((t,i)=>({index:t.index,value:t.value||"",group:r,key:i,label:t.label||i,customId:[e,r,i].join("/"),dataOrigin:e})))),2)))),fileUrl:(null==i?void 0:i.assetId)||(null==i?void 0:i.fileId)?(null==i?void 0:i.url)?D(this,YT,"m",hI).call(this,i.url):void 0:null==i?void 0:i.url};var b},(null==e?void 0:e.key)&&this.setKey(e.key),(null==e?void 0:e.path)&&this.setPath(e.path)}setKey(t){t!==xA(D(this,QT,"f").debugKey)&&(D(this,QT,"f").key=t)}async fetchMetaData(){const t=await D(this,YT,"m",uI).call(this,cA);return this.metaData=t,t}async fetchTreeData(){const t=await D(this,YT,"m",uI).call(this,pA);return this.treeData=t,t}async fetchPoiData(){const t=await D(this,YT,"m",uI).call(this,mA);return this.poiData=t.map((t=>Object.assign(Object.assign({},t),{contentData:JSON.parse(t.content||"{}")}))),this.poiData}async fetchDataSourceData(){const t=await D(this,YT,"m",uI).call(this,gA);return this.dataSourceData=t,t}async fetchTopologyData(){const t=await D(this,YT,"m",uI).call(this,yA).then((t=>{const e={linkWidth:.1,linkColor:["#00ff00"],nodeRadius:.05,nodeColor:"#0000ff"};return t.map((t=>{const r=Object.assign(Object.assign({},e),t);return r.imgUrl&&(r.imgUrl=`${this.path}${r.imgUrl}`),r}))}));return this.topologyData=t,t}async fetchPropertiesData(){const t=await D(this,YT,"m",uI).call(this,bA).then((t=>NA(t,"modelId")));return this.propertiesData=t,t}async fetchAnimationsData(){const t=await D(this,YT,"m",uI).call(this,vA).then((t=>NA(t,"modelId")));return this.animationsData=t,t}async fetchModelVisionsData(){const t=await D(this,YT,"m",uI).call(this,wA).then((t=>new Map(Object.entries(t))));return this.modelVisionsData=t,t}async loadPoi(t){var e,r;const i=this.ssp.getPlugin(MA)||this.ssp.registerPlugin(W,MA);try{await this.fetchPoiData(),i.batchRender({dataSource:null!==(r=null===(e=this.poiData)||void 0===e?void 0:e.map(this.formatPoiData))&&void 0!==r?r:[]}),t&&this.refreshPoiByDataSource()}catch(t){}}async refreshPoiByDataSource(){const t=this.ssp.getPlugin(MA)||this.ssp.registerPlugin(W,MA);try{const{dataSources:e,dataSourceApis:r}=await this.fetchDataSourceData(),i=new dI(this.treeData,this.poiData,t,this);if(e&&r){const t=new jT(e,r);t.requestAll(),t.on("onMessage",(({api:t,data:e,client:r})=>{i.batchPoi(t,e)}))}}catch(t){}}getTreeNodeById(t,e=this.treeData){if(!e)return;const r=e.find((e=>e.id===t));if(r)return r;for(let r=0;r<e.length;r++){const i=this.getTreeNodeById(t,e[r].children);if(i)return i}}setPath(t){this.path=t}async loadScene(t={}){const{key:e,path:r}=t;e&&this.setKey(e),r&&this.setPath(r);const{version:i}=await this.fetchMetaData();if(i>=1.2&&D(this,XT,"f")){if(await D(this,YT,"m",rI).call(this),!D(this,$T,"f")&&!D(this,tI,"f")){const{utils:t}=this.ssp;return void t.error(`未授权的场景包:${this.path}`)}!D(this,$T,"f")&&D(this,tI,"f")&&(D(this,eI,"f")||D(this,JT,"f").addToViewport()),j(this,XT,!1,"f")}else i<1.2&&(this.treeData=await this.fetchTreeData());const n=Object.assign({syncProperties:!0,syncModelVisions:!0,needsModelsBoundsTree:!0,applyPresetEffects:!1,loadSceneAlgorithm:kA.DFS,loadLevel:1/0,loadPoi:!1,refreshPoiByDataSource:!1,loadFlowData:!1},t),o=[];n.syncProperties&&o.push(this.fetchPropertiesData()),n.syncModelVisions&&o.push(this.fetchModelVisionsData()),await Promise.allSettled(o),n.loadSceneAlgorithm===kA.BFS?await D(this,YT,"m",cI).call(this,n):n.loadSceneAlgorithm===kA.DFS&&await D(this,YT,"m",lI).call(this,n);const s=[];n.needsModelsBoundsTree&&s.push(this.ssp.computeModelsBoundsTree()),n.applyPresetEffects&&s.push(this.presetEffects()),n.loadPoi&&s.push(this.loadPoi(n.refreshPoiByDataSource)),n.loadFlowData&&s.push(this.loadFlowData()),await Promise.allSettled(s)}async presetEffects(t={}){const{hdr:e=!0,ssao:r=!0,directionalLightShadow:i=!0}=t;if(await this.ssp.render(),e){const{environment:t}=await this.fetchMetaData();t&&this.ssp.setEnvironment({file:`${this.path}${t}`})}if(r&&this.ssp.setSSAO(),i){const t=this.ssp.getAllModel().reduce(((t,e)=>t.union(this.ssp.utils.getBoundingBox(e.children[0]))),new f),{min:e,max:r}=t,n=new l;t.getSize(n);let o=45;this.ssp.utils.isObject(i)&&"number"==typeof i.angle&&(o=i.angle);const s=Math.tan(Math.PI/180*o)*n.x;this.ssp.createDirectionalLight({id:"directionalLight",name:"directionalLight",position:{x:r.x,y:s,z:r.z},target:{x:e.x,y:e.y,z:e.z},openShadow:!0,shadowAutoUpdate:!1,intensity:2,mapSize:this.ssp.viewport.renderer.capabilities.maxTextureSize/2})}}async getTopologies(){return this.fetchTopologyData()}sortTopologyNodes(t,e){var r;const i=t.nodes.reduce(((t,e)=>(t.set(e.id,e),t)),new Map);if(e&&!i.has(e))return void this.ssp.utils.error(`startNodeId ${e} 未找到对应 node`);let n=e?i.get(e):t.nodes[0];if(!n)return;const o=new Set;o.add(n);for(let e=0;e<t.nodes.length-1;e++){let t;for(const e of null!==(r=n.graphs)&&void 0!==r?r:[]){const r=i.get(e.targetNodeId);if(r&&!o.has(r)){t=r;break}}if(!t)break;n=t,o.add(n)}return Object.assign(Object.assign({},t),{nodes:[...new Set([...o,...t.nodes])]})}async playAnimationById(t,e=0,r={}){const{utils:{error:i}}=this.ssp,n=this.ssp.getObjectById(t);if(n)return this.playObjectAnimation(n,e,r);i(`playAnimationById: id 为 ${t} 场景对象未找到`)}async playObjectAnimation(t,e=0,r={}){const{utils:{error:n},animation:o}=this.ssp,{autoStopPrevious:s=!0,onStart:a,onUpdate:h}=r;s&&this.stopObjectAnimation(t);const u=await this.fetchAnimationsData(),f=t.sid,l=u.get(f);if(l){const r=l[e];if(r)try{for(let e=0,n=r.keyframes.length;e<n;e++){let n;if(r.keyframes[e-1]){const t=r.keyframes[e-1];n={x:t.x,y:t.y,z:t.z,rotationX:t.rotationX,rotationY:t.rotationY,rotationZ:t.rotationZ,scaleX:t.scaleX,scaleY:t.scaleY,scaleZ:t.scaleZ}}else{const e=new i,r=(new c).fromArray(t.userData.matrix);e.applyMatrix4(r),n={x:e.position.x,y:e.position.y,z:e.position.z,rotationX:e.rotation.x,rotationY:e.rotation.y,rotationZ:e.rotation.z,scaleX:e.scale.x,scaleY:e.scale.y,scaleZ:e.scale.z}}const s=r.keyframes[e],{delay:u,duration:l,easing:d,repeat:p,yoyo:m}=s,g={x:s.x,y:s.y,z:s.z,rotationX:s.rotationX,rotationY:s.rotationY,rotationZ:s.rotationZ,scaleX:s.scaleX,scaleY:s.scaleY,scaleZ:s.scaleZ};await o(n,g,{delay:u,duration:l,mode:d,repeat:-1===p?1/0:p,yoyo:m},((e,r)=>{t.position.set(e.x,e.y,e.z),t.rotation.set(e.rotationX,e.rotationY,e.rotationZ),t.scale.set(e.scaleX,e.scaleY,e.scaleZ),null==h||h(e,r)}),(t=>{var e;this.objectsAnimations.has(f)||this.objectsAnimations.set(f,new Set),null===(e=this.objectsAnimations.get(f))||void 0===e||e.add(t),null==a||a(t)}))}}catch(t){}else n(`id: ${f} 未找到索引为 ${e} 的动画`)}else n(`id: ${f} 未找到动画`)}async stopObjectAnimation(t){var e,r;const i=t.sid;this.objectsAnimations.has(i)&&(null===(e=this.objectsAnimations.get(i))||void 0===e||e.forEach((t=>t.stop())),null===(r=this.objectsAnimations.get(i))||void 0===r||r.clear())}async flyToSceneFromVisionsData(t=0,e={}){const{utils:{error:r}}=this.ssp;if(this.modelVisionsData||await this.fetchModelVisionsData(),this.modelVisionsData){const i=this.modelVisionsData.get(""),n=null==i?void 0:i[t];if(n)return this.ssp.flyTo(n.position,n.rotation,e);r("场景视角数据未找到")}}async flyToObjectFromVisionsData(t,e=0,r={}){const{utils:{error:i}}=this.ssp;if(this.modelVisionsData||await this.fetchModelVisionsData(),this.modelVisionsData){const n=this.modelVisionsData.get(t.sid),o=null==n?void 0:n[e];if(o)return this.ssp.flyTo(o.position,o.rotation,r);i("对象视角数据未找到")}}async loadFlowData(){const t=new xt(this.path),{flowList:e}=await t.getFlowData();this.flowData=e,this.soonflow=new class{nodeTypeMethods;outInstances;constructor(t,e){this.nodeTypeMethods=t,this.outInstances=e}async parseFlow(t,e){return new Ct(t,e,this.nodeTypeMethods,this.outInstances).runParse()}unregisterFlow(t,e){new Pt(t,e,this.nodeTypeMethods,this.outInstances)}}(pn,{ssp:this.ssp})}async runFlowById(t){const e=this.flowData.find((e=>e.id===t));if(!e)return this.ssp.utils.error(`CpsManagerPlugin.init.runFlowById() flowData not found by flowId(${t})`),Promise.reject(`CpsManagerPlugin.init.runFlowById() flowData not found by flowId(${t})`);const{nodes:r,edges:i}=e;return this.soonflow.parseFlow(r,i)}}ZT=new WeakMap,XT=new WeakMap,QT=new WeakMap,JT=new WeakMap,$T=new WeakMap,tI=new WeakMap,eI=new WeakMap,YT=new WeakSet,rI=async function(){let e;const{resource:r}=await this.fetchMetaData();if(D(this,QT,"f").verifyKey){if(e=await D(this,YT,"m",iI).call(this,r),"forbid"===e)return void j(this,$T,!1,"f");if("noServerEnc"===e)await D(this,YT,"m",sI).call(this,r);else{const t=D(this,QT,"f").verifyKey,{verifiedRes:r,dec:i}=D(this,YT,"m",oI).call(this,e,t);j(this,$T,r,"f"),D(this,$T,"f")&&(this.treeData=i)}}else if(D(this,QT,"f").key){const{verifiedRes:t}=await D(this,YT,"m",aI).call(this,r);t||await D(this,YT,"m",sI).call(this,r)}else D(this,QT,"f").debugKey?await D(this,YT,"m",sI).call(this,r):t.utils.error("许可证密钥不存在")},iI=async function(t){const e=Math.random().toString(36).substring(2),{verifyKey:r}=D(this,QT,"f"),i=new UM(r,"pkcs8-public",{signingScheme:"pkcs1-md5",encryptionScheme:"pkcs1"}),n=i.encrypt(e,"base64"),o=await D(this,YT,"m",nI).call(this,D(this,YT,"m",hI).call(this,t),n),{license:s,serverEnc:a}=o;if(!a)return"noServerEnc";return i.decryptPublic(a,"utf8")!==e?"forbid":s},nI=async function(t,e=""){try{const r=await fetch(t,{headers:{token:e}}),i=r.headers,n=await r.json();return{license:n,serverEnc:i.get("token")}}catch(t){return{license:{content:"",sign:""},serverEnc:""}}},oI=function(t,e){let r=null,i=!0;try{const i=new UM(e,"pkcs8-public",{signingScheme:"pkcs1-md5",encryptionScheme:"pkcs1"});if(2===t.version)r=BA(t,i);else r=((t,e)=>{const{content:r,sign:i}=t;if(!e.verify(r,i,"base64","base64"))throw new Error("v1 error");return e.decryptPublic(r,"json")})(t,i)}catch(t){i=!1,this.ssp.utils.error("秘钥 key 验证失败")}return{verifiedRes:i,dec:r}},sI=async function(t){const e=await D(this,YT,"m",uI).call(this,t),r=xA(D(this,QT,"f").debugKey),{verifiedRes:i,dec:n}=D(this,YT,"m",oI).call(this,e,r);j(this,tI,i,"f"),D(this,tI,"f")&&(this.treeData=n)},aI=async function(t){const e=await D(this,YT,"m",uI).call(this,t),r=D(this,QT,"f").key,{verifiedRes:i,dec:n}=D(this,YT,"m",oI).call(this,e,r);return j(this,eI,i,"f"),j(this,tI,i,"f"),D(this,eI,"f")&&(this.treeData=n),{verifiedRes:i,dec:n}},hI=function(t){return`${D(this,ZT,"f")}${t}`},uI=async function(t){const{utils:e}=this.ssp;return e.fetchFile(D(this,YT,"m",hI).call(this,t),"json")},fI=async function(t,e){const r=this.ssp.getObjectById(t.id);if(r)return r;const{syncProperties:i}=e,{id:n,name:o,renderType:s,path:a,matrix:h}=t,{ssp:u}=this,f=(new c).fromArray(h);let l=null;if("3D"===s)if(a)try{const t=a.replaceAll(/#/g,"%23");l=await u.loadModel({id:n,name:o,url:D(this,YT,"m",hI).call(this,t)})}catch(t){console.error(t)}else u.utils.warn(`id: ${n} path 为空`);else"GROUP"!==s&&"STUB"!==s||(l=u.createGroup({id:n,name:o}));if(l){f.decompose(l.position,l.quaternion,l.scale);const e=Object.assign({},t);if(Reflect.deleteProperty(e,"children"),l.userData=e,i&&this.propertiesData){const t=this.propertiesData.get(n);t&&(l.userData[_A]=t)}}return l},lI=async function(e){const{loadLevel:r,loadTargetId:i}=e;let n=null;if(i){const e=this.getTreeNodeById(i);e?n=[e]:t.utils.error("根据 loadTargetId 未找到对应树节点")}else n=this.treeData;if(!n)return t.utils.error("treeData is null");const o=async(t,i,n=0)=>{if(n++,r&&n>r)return;const{ssp:s}=this,a=await D(this,YT,"m",fI).call(this,t,e);a&&i&&s.addObject(a,i),await Promise.allSettled(t.children.map((t=>o(t,a,n))))};await Promise.allSettled(n.map((t=>o(t,t.pid?this.ssp.getObjectById(t.pid):null,0))))},cI=async function(e){if(!this.treeData)return void t.utils.error("treeData is null");const r=[],i=Object.create(null),n=[],{ssp:o}=this;for(r.push(...this.treeData);r.length>0;){r.splice(0,r.length).forEach((t=>{n.push(t),r.push(...t.children.map((e=>(i[e.id]=t.id,e))))}))}await Promise.allSettled(n.map((t=>D(this,YT,"m",fI).call(this,t,e)))),Object.entries(i).forEach((([t,e])=>{const r=o.getObjectById(t),i=o.getObjectById(e);r&&i&&o.addObject(r,i)}))};export{vA as ANIMATIONS_DATA_FILE_PATH,gA as DATA_SOURCE_FILE_PATH,kA as LoadSceneAlgorithm,cA as META_DATA_FILE_PATH,wA as MODEL_VISIONS_DATA_FILE_PATH,mA as POI_DATA_FILE_PATH,MA as POI_PLUGIN_NAME,bA as PROPERTIES_DATA_FLEE_PATH,_A as PROPERTIES_KEY,SA as PoiContentTypeEnum,dA as SIGN_PATH,yA as TOPOLOGY_DATA_FILE_PATH,pA as TREE_DATA_FILE_PATH,pI as default};
7
+ var i=t("buffer"),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?e.exports=i:(o(i,r),r.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)}},{buffer:17}],74:[function(t,e,r){function i(t){var e=t._readableState;return e?e.objectMode||"number"==typeof t._duplexState?t.read():t.read(n(e)):null}function n(t){return t.buffer.length?t.buffer.head?t.buffer.head.data.length:t.buffer[0].length:t.length}e.exports=i},{}],75:[function(t,e,r){var i=t("safe-buffer").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){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}}function s(t){var e=o(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}function a(t){var e;switch(this.encoding=s(t),this.encoding){case"utf16le":this.text=p,this.end=m,e=4;break;case"utf8":this.fillLast=l,e=4;break;case"base64":this.text=g,this.end=y,e=3;break;default:return this.write=b,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function h(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function u(t,e,r){var i=e.length-1;if(i<r)return 0;var n=h(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||-2===n?0:(n=h(e[i]))>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||-2===n?0:(n=h(e[i]))>=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}function f(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,"�"}}function l(t){var e=this.lastTotal-this.lastNeed,r=f(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 c(t,e){var r=u(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)}function d(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function p(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 m(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 g(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 y(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function b(t){return t.toString(this.encoding)}function v(t){return t&&t.length?this.write(t):""}r.StringDecoder=a,a.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<t.length?e?e+this.text(t,r):this.text(t,r):e||""},a.prototype.end=d,a.prototype.text=c,a.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}},{"safe-buffer":73}],76:[function(t,e,r){var i=t("punycode"),n=t("./util");function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=w,r.resolve=M,r.resolveObject=S,r.format=_,r.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),f=["'"].concat(u),l=["%","/","?",";","#"].concat(f),c=["/","?","#"],d=255,p=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=t("querystring");function w(t,e,r){if(t&&n.isObject(t)&&t instanceof o)return t;var i=new o;return i.parse(t,e,r),i}function _(t){return n.isString(t)&&(t=w(t)),t instanceof o?t.format():o.prototype.format.call(t)}function M(t,e){return w(t,!1,!0).resolve(e)}function S(t,e){return t?w(t,!1,!0).resolveObject(e):e}o.prototype.parse=function(t,e,r){if(!n.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),a=-1!==o&&o<t.indexOf("#")?"?":"#",u=t.split(a),w=/\\/g;u[0]=u[0].replace(w,"/");var _=t=u.join(a);if(_=_.trim(),!r&&1===t.split("#").length){var M=h.exec(_);if(M)return this.path=_,this.href=_,this.pathname=M[1],M[2]?(this.search=M[2],this.query=e?v.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var S=s.exec(_);if(S){var E=(S=S[0]).toLowerCase();this.protocol=E,_=_.substr(S.length)}if(r||S||_.match(/^\/\/[^@\/]+@[^@\/]+/)){var k="//"===_.substr(0,2);!k||S&&y[S]||(_=_.substr(2),this.slashes=!0)}if(!y[S]&&(k||S&&!b[S])){for(var A,O,T=-1,I=0;I<c.length;I++)-1!==(R=_.indexOf(c[I]))&&(-1===T||R<T)&&(T=R);for(-1!==(O=-1===T?_.lastIndexOf("@"):_.lastIndexOf("@",T))&&(A=_.slice(0,O),_=_.slice(O+1),this.auth=decodeURIComponent(A)),T=-1,I=0;I<l.length;I++){var R;-1!==(R=_.indexOf(l[I]))&&(-1===T||R<T)&&(T=R)}-1===T&&(T=_.length),this.host=_.slice(0,T),_=_.slice(T),this.parseHost(),this.hostname=this.hostname||"";var C="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!C)for(var P=this.hostname.split(/\./),x=(I=0,P.length);I<x;I++){var N=P[I];if(N&&!N.match(p)){for(var B="",L=0,D=N.length;L<D;L++)N.charCodeAt(L)>127?B+="x":B+=N[L];if(!B.match(p)){var j=P.slice(0,I),U=P.slice(I+1),q=N.match(m);q&&(j.push(q[1]),U.unshift(q[2])),U.length&&(_="/"+U.join(".")+_),this.hostname=j.join(".");break}}}this.hostname.length>d?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=i.toASCII(this.hostname));var F=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+F,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==_[0]&&(_="/"+_))}if(!g[E])for(I=0,x=f.length;I<x;I++){var H=f[I];if(-1!==_.indexOf(H)){var K=encodeURIComponent(H);K===H&&(K=escape(H)),_=_.split(H).join(K)}}var V=_.indexOf("#");-1!==V&&(this.hash=_.substr(V),_=_.slice(0,V));var G=_.indexOf("?");if(-1!==G?(this.search=_.substr(G),this.query=_.substr(G+1),e&&(this.query=v.parse(this.query)),_=_.slice(0,G)):e&&(this.search="",this.query={}),_&&(this.pathname=_),b[E]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){F=this.pathname||"";var W=this.search||"";this.path=F+W}return this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",i=this.hash||"",o=!1,s="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&n.isObject(this.query)&&Object.keys(this.query).length&&(s=v.stringify(this.query));var a=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||b[e])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),a&&"?"!==a.charAt(0)&&(a="?"+a),e+o+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(a=a.replace("#","%23"))+i},o.prototype.resolve=function(t){return this.resolveObject(w(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if(n.isString(t)){var e=new o;e.parse(t,!1,!0),t=e}for(var r=new o,i=Object.keys(this),s=0;s<i.length;s++){var a=i[s];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var h=Object.keys(t),u=0;u<h.length;u++){var f=h[u];"protocol"!==f&&(r[f]=t[f])}return b[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!b[t.protocol]){for(var l=Object.keys(t),c=0;c<l.length;c++){var d=l[c];r[d]=t[d]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||y[t.protocol])r.pathname=t.pathname;else{for(var p=(t.pathname||"").split("/");p.length&&!(t.host=p.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),r.pathname=p.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var m=r.pathname||"",g=r.search||"";r.path=m+g}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),w=t.host||t.pathname&&"/"===t.pathname.charAt(0),_=w||v||r.host&&t.pathname,M=_,S=r.pathname&&r.pathname.split("/")||[],E=(p=t.pathname&&t.pathname.split("/")||[],r.protocol&&!b[r.protocol]);if(E&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===p[0]?p[0]=t.host:p.unshift(t.host)),t.host=null),_=_&&(""===p[0]||""===S[0])),w)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,S=p;else if(p.length)S||(S=[]),S.pop(),S=S.concat(p),r.search=t.search,r.query=t.query;else if(!n.isNullOrUndefined(t.search))return E&&(r.hostname=r.host=S.shift(),(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift())),r.search=t.search,r.query=t.query,n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var k=S.slice(-1)[0],A=(r.host||t.host||S.length>1)&&("."===k||".."===k)||""===k,O=0,T=S.length;T>=0;T--)"."===(k=S[T])?S.splice(T,1):".."===k?(S.splice(T,1),O++):O&&(S.splice(T,1),O--);if(!_&&!M)for(;O--;O)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var I,R=""===S[0]||S[0]&&"/"===S[0].charAt(0);return E&&(r.hostname=r.host=R?"":S.length?S.shift():"",(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift())),(_=_||r.host&&S.length)&&!R&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":77,punycode:51,querystring:54}],77:[function(t,e,r){e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],78:[function(t,e,r){(function(t){(function(){function r(t,e){if(i("noDeprecation"))return t;var r=!1;function n(){if(!r){if(i("throwDeprecation"))throw new Error(e);i("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function i(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=r}).call(this)}).call(this,void 0!==Y?Y:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],79:[function(t,e,r){function i(t,e){if(t&&e)return i(t)(e);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){r[e]=t[e]})),r;function r(){for(var e=new Array(arguments.length),r=0;r<e.length;r++)e[r]=arguments[r];var i=t.apply(this,e),n=e[e.length-1];return"function"==typeof i&&i!==n&&Object.keys(n).forEach((function(t){i[t]=n[t]})),i}}e.exports=i},{}],80:[function(t,e,r){e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(t,e,r){e.exports=n;var i=Object.prototype.hasOwnProperty;function n(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var n in r)i.call(r,n)&&(t[n]=r[n])}return t}},{}],82:[function(t,e,r){e.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}},{}],83:[function(t,e,r){function i(t){var e=this;if(e instanceof i||(e=new i),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)e.push(arguments[r]);return e}function n(t,e,r){var i=e===t.head?new a(r,null,e,t):new a(r,e,e.next,t);return null===i.next&&(t.tail=i),null===i.prev&&(t.head=i),t.length++,i}function o(t,e){t.tail=new a(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function s(t,e){t.head=new a(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function a(t,e,r,i){if(!(this instanceof a))return new a(t,e,r,i);this.list=i,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=i,i.Node=a,i.create=i,i.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e},i.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},i.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},i.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)o(this,arguments[t]);return this.length},i.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)s(this,arguments[t]);return this.length},i.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},i.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},i.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,i=0;null!==r;i++)t.call(e,r.value,i,this),r=r.next},i.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,i=this.length-1;null!==r;i--)t.call(e,r.value,i,this),r=r.prev},i.prototype.get=function(t){for(var e=0,r=this.head;null!==r&&e<t;e++)r=r.next;if(e===t&&null!==r)return r.value},i.prototype.getReverse=function(t){for(var e=0,r=this.tail;null!==r&&e<t;e++)r=r.prev;if(e===t&&null!==r)return r.value},i.prototype.map=function(t,e){e=e||this;for(var r=new i,n=this.head;null!==n;)r.push(t.call(e,n.value,this)),n=n.next;return r},i.prototype.mapReverse=function(t,e){e=e||this;for(var r=new i,n=this.tail;null!==n;)r.push(t.call(e,n.value,this)),n=n.prev;return r},i.prototype.reduce=function(t,e){var r,i=this.head;if(arguments.length>1)r=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,r=this.head.value}for(var n=0;null!==i;n++)r=t(r,i.value,n),i=i.next;return r},i.prototype.reduceReverse=function(t,e){var r,i=this.tail;if(arguments.length>1)r=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==i;n--)r=t(r,i.value,n),i=i.prev;return r},i.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;null!==r;e++)t[e]=r.value,r=r.next;return t},i.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;null!==r;e++)t[e]=r.value,r=r.prev;return t},i.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new i;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=0,o=this.head;null!==o&&n<t;n++)o=o.next;for(;null!==o&&n<e;n++,o=o.next)r.push(o.value);return r},i.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new i;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=this.length,o=this.tail;null!==o&&n>e;n--)o=o.prev;for(;null!==o&&n>t;n--,o=o.prev)r.push(o.value);return r},i.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var i=0,o=this.head;null!==o&&i<t;i++)o=o.next;var s=[];for(i=0;o&&i<e;i++)s.push(o.value),o=this.removeNode(o);for(null===o&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev),i=0;i<r.length;i++)o=n(this,o,r[i]);return s},i.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;null!==r;r=r.prev){var i=r.prev;r.prev=r.next,r.next=i}return this.head=e,this.tail=t,this};try{t("./iterator.js")(i)}catch(t){}},{"./iterator.js":82}]},{},[12])(12);var qA=Z(jA);const FA=Object.create(null);FA.open="0",FA.close="1",FA.ping="2",FA.pong="3",FA.message="4",FA.upgrade="5",FA.noop="6";const zA=Object.create(null);Object.keys(FA).forEach((t=>{zA[FA[t]]=t}));const HA={type:"error",data:"parser error"},KA="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),VA="function"==typeof ArrayBuffer,GA=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,WA=({type:t,data:e},r,i)=>KA&&e instanceof Blob?r?i(e):YA(e,i):VA&&(e instanceof ArrayBuffer||GA(e))?r?i(e):YA(new Blob([e]),i):i(FA[t]+(e||"")),YA=(t,e)=>{const r=new FileReader;return r.onload=function(){const t=r.result.split(",")[1];e("b"+(t||""))},r.readAsDataURL(t)};function ZA(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let XA;const QA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",JA="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let t=0;t<64;t++)JA[QA.charCodeAt(t)]=t;const $A="function"==typeof ArrayBuffer,tO=(t,e)=>{if("string"!=typeof t)return{type:"message",data:rO(t,e)};const r=t.charAt(0);if("b"===r)return{type:"message",data:eO(t.substring(1),e)};return zA[r]?t.length>1?{type:zA[r],data:t.substring(1)}:{type:zA[r]}:HA},eO=(t,e)=>{if($A){const r=(t=>{let e,r,i,n,o,s=.75*t.length,a=t.length,h=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);const u=new ArrayBuffer(s),f=new Uint8Array(u);for(e=0;e<a;e+=4)r=JA[t.charCodeAt(e)],i=JA[t.charCodeAt(e+1)],n=JA[t.charCodeAt(e+2)],o=JA[t.charCodeAt(e+3)],f[h++]=r<<2|i>>4,f[h++]=(15&i)<<4|n>>2,f[h++]=(3&n)<<6|63&o;return u})(t);return rO(r,e)}return{base64:!0,data:t}},rO=(t,e)=>"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer,iO=String.fromCharCode(30);function nO(){return new TransformStream({transform(t,e){!function(t,e){KA&&t.data instanceof Blob?t.data.arrayBuffer().then(ZA).then(e):VA&&(t.data instanceof ArrayBuffer||GA(t.data))?e(ZA(t.data)):WA(t,!1,(t=>{XA||(XA=new TextEncoder),e(XA.encode(t))}))}(t,(r=>{const i=r.length;let n;if(i<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,i);else if(i<65536){n=new Uint8Array(3);const t=new DataView(n.buffer);t.setUint8(0,126),t.setUint16(1,i)}else{n=new Uint8Array(9);const t=new DataView(n.buffer);t.setUint8(0,127),t.setBigUint64(1,BigInt(i))}t.data&&"string"!=typeof t.data&&(n[0]|=128),e.enqueue(n),e.enqueue(r)}))}})}let oO;function sO(t){return t.reduce(((t,e)=>t+e.length),0)}function aO(t,e){if(t[0].length===e)return t.shift();const r=new Uint8Array(e);let i=0;for(let n=0;n<e;n++)r[n]=t[0][i++],i===t[0].length&&(t.shift(),i=0);return t.length&&i<t[0].length&&(t[0]=t[0].slice(i)),r}function hO(t){if(t)return function(t){for(var e in hO.prototype)t[e]=hO.prototype[e];return t}(t)}hO.prototype.on=hO.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},hO.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},hO.prototype.off=hO.prototype.removeListener=hO.prototype.removeAllListeners=hO.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,i=this._callbacks["$"+t];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n=0;n<i.length;n++)if((r=i[n])===e||r.fn===e){i.splice(n,1);break}return 0===i.length&&delete this._callbacks["$"+t],this},hO.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(r){i=0;for(var n=(r=r.slice(0)).length;i<n;++i)r[i].apply(this,e)}return this},hO.prototype.emitReserved=hO.prototype.emit,hO.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},hO.prototype.hasListeners=function(t){return!!this.listeners(t).length};const uO="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function fO(t,...e){return e.reduce(((e,r)=>(t.hasOwnProperty(r)&&(e[r]=t[r]),e)),{})}const lO=uO.setTimeout,cO=uO.clearTimeout;function dO(t,e){e.useNativeTimers?(t.setTimeoutFn=lO.bind(uO),t.clearTimeoutFn=cO.bind(uO)):(t.setTimeoutFn=uO.setTimeout.bind(uO),t.clearTimeoutFn=uO.clearTimeout.bind(uO))}class pO extends Error{constructor(t,e,r){super(t),this.description=e,this.context=r,this.type="TransportError"}}class mO extends hO{constructor(t){super(),this.writable=!1,dO(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,e,r){return super.emitReserved("error",new pO(t,e,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const e=tO(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){const t=this.opts.hostname;return-1===t.indexOf(":")?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(t){const e=function(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}(t);return e.length?"?"+e:""}}const gO="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),yO=64,bO={};let vO,wO=0,_O=0;function MO(t){let e="";do{e=gO[t%yO]+e,t=Math.floor(t/yO)}while(t>0);return e}function SO(){const t=MO(+new Date);return t!==vO?(wO=0,vO=t):t+"."+MO(wO++)}for(;_O<yO;_O++)bO[gO[_O]]=_O;let EO=!1;try{EO="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}const kO=EO;function AO(t){const e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||kO))return new XMLHttpRequest}catch(t){}if(!e)try{return new(uO[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}function OO(){}const TO=null!=new AO({xdomain:!1}).responseType;class IO extends hO{constructor(t,e){super(),dO(this,e),this.opts=e,this.method=e.method||"GET",this.uri=t,this.data=void 0!==e.data?e.data:null,this.create()}create(){var t;const e=fO(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd;const r=this.xhr=new AO(e);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let t in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(t)&&r.setRequestHeader(t,this.opts.extraHeaders[t])}}catch(t){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}null===(t=this.opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var t;3===r.readyState&&(null===(t=this.opts.cookieJar)||void 0===t||t.parseCookies(r)),4===r.readyState&&(200===r.status||1223===r.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(t){return void this.setTimeoutFn((()=>{this.onError(t)}),0)}"undefined"!=typeof document&&(this.index=IO.requestsCount++,IO.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=OO,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete IO.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(IO.requestsCount=0,IO.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",RO);else if("function"==typeof addEventListener){addEventListener("onpagehide"in uO?"pagehide":"unload",RO,!1)}function RO(){for(let t in IO.requests)IO.requests.hasOwnProperty(t)&&IO.requests[t].abort()}const CO="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),PO=uO.WebSocket||uO.MozWebSocket,xO="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();const NO={websocket:class extends mO{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),e=this.opts.protocols,r=xO?{}:fO(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=xO?new PO(t,e,r):e?new PO(t,e):new PO(t)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const r=t[e],i=e===t.length-1;WA(r,this.supportsBinary,(t=>{try{this.ws.send(t)}catch(t){}i&&CO((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=SO()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}check(){return!!PO}},webtransport:class extends mO{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((t=>{this.onError("webtransport error",t)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((t=>{const e=function(t,e){oO||(oO=new TextDecoder);const r=[];let i=0,n=-1,o=!1;return new TransformStream({transform(s,a){for(r.push(s);;){if(0===i){if(sO(r)<1)break;const t=aO(r,1);o=128==(128&t[0]),n=127&t[0],i=n<126?3:126===n?1:2}else if(1===i){if(sO(r)<2)break;const t=aO(r,2);n=new DataView(t.buffer,t.byteOffset,t.length).getUint16(0),i=3}else if(2===i){if(sO(r)<8)break;const t=aO(r,8),e=new DataView(t.buffer,t.byteOffset,t.length),o=e.getUint32(0);if(o>Math.pow(2,21)-1){a.enqueue(HA);break}n=o*Math.pow(2,32)+e.getUint32(4),i=3}else{if(sO(r)<n)break;const t=aO(r,n);a.enqueue(tO(o?t:oO.decode(t),e)),i=0}if(0===n||n>t){a.enqueue(HA);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(e).getReader(),i=nO();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const n=()=>{r.read().then((({done:t,value:e})=>{t||(this.onPacket(e),n())})).catch((t=>{}))};n();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then((()=>this.onOpen()))}))})))}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const r=t[e],i=e===t.length-1;this.writer.write(r).then((()=>{i&&CO((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var t;null===(t=this.transport)||void 0===t||t.close()}},polling:class extends mO{constructor(t){if(super(t),this.polling=!1,"undefined"!=typeof location){const e="https:"===location.protocol;let r=location.port;r||(r=e?"443":"80"),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||r!==t.port}const e=t&&t.forceBase64;this.supportsBinary=TO&&!e,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(t){this.readyState="pausing";const e=()=>{this.readyState="paused",t()};if(this.polling||!this.writable){let t=0;this.polling&&(t++,this.once("pollComplete",(function(){--t||e()}))),this.writable||(t++,this.once("drain",(function(){--t||e()})))}else e()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){((t,e)=>{const r=t.split(iO),i=[];for(let t=0;t<r.length;t++){const n=tO(r[t],e);if(i.push(n),"error"===n.type)break}return i})(t,this.socket.binaryType).forEach((t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){this.writable=!1,((t,e)=>{const r=t.length,i=new Array(r);let n=0;t.forEach(((t,o)=>{WA(t,!1,(t=>{i[o]=t,++n===r&&e(i.join(iO))}))}))})(t,(t=>{this.doWrite(t,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const t=this.opts.secure?"https":"http",e=this.query||{};return!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=SO()),this.supportsBinary||e.sid||(e.b64=1),this.createUri(t,e)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new IO(this.uri(),t)}doWrite(t,e){const r=this.request({method:"POST",data:t});r.on("success",e),r.on("error",((t,e)=>{this.onError("xhr post error",t,e)}))}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",((t,e)=>{this.onError("xhr poll error",t,e)})),this.pollXhr=t}}},BO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,LO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function DO(t){const e=t,r=t.indexOf("["),i=t.indexOf("]");-1!=r&&-1!=i&&(t=t.substring(0,r)+t.substring(r,i).replace(/:/g,";")+t.substring(i,t.length));let n=BO.exec(t||""),o={},s=14;for(;s--;)o[LO[s]]=n[s]||"";return-1!=r&&-1!=i&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(t,e){const r=/\/{2,9}/g,i=e.replace(r,"/").split("/");"/"!=e.slice(0,1)&&0!==e.length||i.splice(0,1);"/"==e.slice(-1)&&i.splice(i.length-1,1);return i}(0,o.path),o.queryKey=function(t,e){const r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,i){e&&(r[e]=i)})),r}(0,o.query),o}let jO=class t extends hO{constructor(t,e={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],t&&"object"==typeof t&&(e=t,t=null),t?(t=DO(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=DO(e.host).host),dO(this,e),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=e.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(t){let e={},r=t.split("&");for(let t=0,i=r.length;t<i;t++){let i=r[t].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);const r=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new NO[t](r)}open(){let e;if(this.opts.rememberUpgrade&&t.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(t){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(t=>this.onClose("transport close",t)))}probe(e){let r=this.createTransport(e),i=!1;t.priorWebsocketSuccess=!1;const n=()=>{i||(r.send([{type:"ping",data:"probe"}]),r.once("packet",(e=>{if(!i)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;t.priorWebsocketSuccess="websocket"===r.name,this.transport.pause((()=>{i||"closed"!==this.readyState&&(f(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())}))}else{const t=new Error("probe error");t.transport=r.name,this.emitReserved("upgradeError",t)}})))};function o(){i||(i=!0,f(),r.close(),r=null)}const s=t=>{const e=new Error("probe error: "+t);e.transport=r.name,o(),this.emitReserved("upgradeError",e)};function a(){s("transport closed")}function h(){s("socket closed")}function u(t){r&&t.name!==r.name&&o()}const f=()=>{r.removeListener("open",n),r.removeListener("error",s),r.removeListener("close",a),this.off("close",h),this.off("upgrading",u)};r.once("open",n),r.once("error",s),r.once("close",a),this.once("close",h),this.once("upgrading",u),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{i||r.open()}),200):r.open()}onOpen(){if(this.readyState="open",t.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let t=0;const e=this.upgrades.length;for(;t<e;t++)this.probe(this.upgrades[t])}}onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),this.resetPingTimeout(),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.maxPayload=t.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(t+="string"==typeof(e=i)?function(t){let e=0,r=0;for(let i=0,n=t.length;i<n;i++)e=t.charCodeAt(i),e<128?r+=1:e<2048?r+=2:e<55296||e>=57344?r+=3:(i++,r+=4);return r}(e):Math.ceil(1.33*(e.byteLength||e.size))),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}var e;return this.writeBuffer}write(t,e,r){return this.sendPacket("message",t,e,r),this}send(t,e,r){return this.sendPacket("message",t,e,r),this}sendPacket(t,e,r,i){if("function"==typeof e&&(i=e,e=void 0),"function"==typeof r&&(i=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const n={type:t,data:e,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},r=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?r():t()})):this.upgrading?r():t()),this}onError(e){t.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const e=[];let r=0;const i=t.length;for(;r<i;r++)~this.transports.indexOf(t[r])&&e.push(t[r]);return e}};jO.protocol=4;const UO="function"==typeof ArrayBuffer,qO=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,FO=Object.prototype.toString,zO="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===FO.call(Blob),HO="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===FO.call(File);function KO(t){return UO&&(t instanceof ArrayBuffer||qO(t))||zO&&t instanceof Blob||HO&&t instanceof File}function VO(t,e){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let e=0,r=t.length;e<r;e++)if(VO(t[e]))return!0;return!1}if(KO(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return VO(t.toJSON(),!0);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&VO(t[e]))return!0;return!1}function GO(t){const e=[],r=t.data,i=t;return i.data=WO(r,e),i.attachments=e.length,{packet:i,buffers:e}}function WO(t,e){if(!t)return t;if(KO(t)){const r={_placeholder:!0,num:e.length};return e.push(t),r}if(Array.isArray(t)){const r=new Array(t.length);for(let i=0;i<t.length;i++)r[i]=WO(t[i],e);return r}if("object"==typeof t&&!(t instanceof Date)){const r={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=WO(t[i],e));return r}return t}function YO(t,e){return t.data=ZO(t.data,e),delete t.attachments,t}function ZO(t,e){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=ZO(t[r],e);else if("object"==typeof t)for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=ZO(t[r],e));return t}const XO=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var QO;!function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"}(QO||(QO={}));function JO(t){return"[object Object]"===Object.prototype.toString.call(t)}class $O extends hO{constructor(t){super(),this.reviver=t}add(t){let e;if("string"==typeof t){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);const r=e.type===QO.BINARY_EVENT;r||e.type===QO.BINARY_ACK?(e.type=r?QO.EVENT:QO.ACK,this.reconstructor=new tT(e),0===e.attachments&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else{if(!KO(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e))}}decodeString(t){let e=0;const r={type:Number(t.charAt(0))};if(void 0===QO[r.type])throw new Error("unknown packet type "+r.type);if(r.type===QO.BINARY_EVENT||r.type===QO.BINARY_ACK){const i=e+1;for(;"-"!==t.charAt(++e)&&e!=t.length;);const n=t.substring(i,e);if(n!=Number(n)||"-"!==t.charAt(e))throw new Error("Illegal attachments");r.attachments=Number(n)}if("/"===t.charAt(e+1)){const i=e+1;for(;++e;){if(","===t.charAt(e))break;if(e===t.length)break}r.nsp=t.substring(i,e)}else r.nsp="/";const i=t.charAt(e+1);if(""!==i&&Number(i)==i){const i=e+1;for(;++e;){const r=t.charAt(e);if(null==r||Number(r)!=r){--e;break}if(e===t.length)break}r.id=Number(t.substring(i,e+1))}if(t.charAt(++e)){const i=this.tryParse(t.substr(e));if(!$O.isPayloadValid(r.type,i))throw new Error("invalid payload");r.data=i}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch(t){return!1}}static isPayloadValid(t,e){switch(t){case QO.CONNECT:return JO(e);case QO.DISCONNECT:return void 0===e;case QO.CONNECT_ERROR:return"string"==typeof e||JO(e);case QO.EVENT:case QO.BINARY_EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===XO.indexOf(e[0]));case QO.ACK:case QO.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class tT{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const t=YO(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var eT=Object.freeze({__proto__:null,Decoder:$O,Encoder:class{constructor(t){this.replacer=t}encode(t){return t.type!==QO.EVENT&&t.type!==QO.ACK||!VO(t)?[this.encodeAsString(t)]:this.encodeAsBinary({type:t.type===QO.EVENT?QO.BINARY_EVENT:QO.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id})}encodeAsString(t){let e=""+t.type;return t.type!==QO.BINARY_EVENT&&t.type!==QO.BINARY_ACK||(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){const e=GO(t),r=this.encodeAsString(e.packet),i=e.buffers;return i.unshift(r),i}},get PacketType(){return QO},protocol:5});function rT(t,e,r){return t.on(e,r),function(){t.off(e,r)}}const iT=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class nT extends hO{constructor(t,e,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[rT(t,"open",this.onopen.bind(this)),rT(t,"packet",this.onpacket.bind(this)),rT(t,"error",this.onerror.bind(this)),rT(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){if(iT.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const r={type:QO.EVENT,data:e,options:{}};if(r.options.compress=!1!==this.flags.compress,"function"==typeof e[e.length-1]){const t=this.ids++,i=e.pop();this._registerAckCallback(t,i),r.id=t}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,e){var r;const i=null!==(r=this.flags.timeout)&&void 0!==r?r:this._opts.ackTimeout;if(void 0===i)return void(this.acks[t]=e);const n=this.io.setTimeoutFn((()=>{delete this.acks[t];for(let e=0;e<this.sendBuffer.length;e++)this.sendBuffer[e].id===t&&this.sendBuffer.splice(e,1);e.call(this,new Error("operation has timed out"))}),i);this.acks[t]=(...t)=>{this.io.clearTimeoutFn(n),e.apply(this,[null,...t])}}emitWithAck(t,...e){const r=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((i,n)=>{e.push(((t,e)=>r?t?n(t):i(e):i(t))),this.emit(t,...e)}))}_addToQueue(t){let e;"function"==typeof t[t.length-1]&&(e=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push(((t,...i)=>{if(r!==this._queue[0])return;return null!==t?r.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(t)):(this._queue.shift(),e&&e(null,...i)),r.pending=!1,this._drainQueue()})),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||0===this._queue.length)return;const e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){"function"==typeof this.auth?this.auth((t=>{this._sendConnectPacket(t)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:QO.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case QO.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case QO.EVENT:case QO.BINARY_EVENT:this.onevent(t);break;case QO.ACK:case QO.BINARY_ACK:this.onack(t);break;case QO.DISCONNECT:this.ondisconnect();break;case QO.CONNECT_ERROR:this.destroy();const e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){const e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const r of e)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}ack(t){const e=this;let r=!1;return function(...i){r||(r=!0,e.packet({type:QO.ACK,id:t,data:i}))}}onack(t){const e=this.acks[t.id];"function"==typeof e&&(e.apply(this,t.data),delete this.acks[t.id])}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((t=>this.emitEvent(t))),this.receiveBuffer=[],this.sendBuffer.forEach((t=>{this.notifyOutgoingListeners(t),this.packet(t)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((t=>t())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:QO.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const e=this._anyListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const e=this._anyOutgoingListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const r of e)r.apply(this,t.data)}}}function oT(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}oT.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-r:t+r}return 0|Math.min(t,this.max)},oT.prototype.reset=function(){this.attempts=0},oT.prototype.setMin=function(t){this.ms=t},oT.prototype.setMax=function(t){this.max=t},oT.prototype.setJitter=function(t){this.jitter=t};class sT extends hO{constructor(t,e){var r;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.opts=e,dO(this,e),this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(r=e.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new oT({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this._readyState="closed",this.uri=t;const i=e.parser||eT;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==e.autoConnect,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null===(e=this.backoff)||void 0===e||e.setMin(t),this)}randomizationFactor(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null===(e=this.backoff)||void 0===e||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null===(e=this.backoff)||void 0===e||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new jO(this.uri,this.opts);const e=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=rT(e,"open",(function(){r.onopen(),t&&t()})),n=e=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",e),t?t(e):this.maybeReconnectOnOpen()},o=rT(e,"error",n);if(!1!==this._timeout){const t=this._timeout,r=this.setTimeoutFn((()=>{i(),n(new Error("timeout")),e.close()}),t);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(rT(t,"ping",this.onping.bind(this)),rT(t,"data",this.ondata.bind(this)),rT(t,"error",this.onerror.bind(this)),rT(t,"close",this.onclose.bind(this)),rT(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}ondecoded(t){CO((()=>{this.emitReserved("packet",t)}),this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new nT(this,t,e),this.nsps[t]=r),r}_destroy(t){const e=Object.keys(this.nsps);for(const t of e){if(this.nsps[t].active)return}this._close()}_packet(t){const e=this.encoder.encode(t);for(let r=0;r<e.length;r++)this.engine.write(e[r],t.options)}cleanup(){this.subs.forEach((t=>t())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,e){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn((()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open((e=>{e?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",e)):t.onreconnect()})))}),e);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const aT={};function hT(t,e){"object"==typeof t&&(e=t,t=void 0);const r=function(t,e="",r){let i=t;r=r||"undefined"!=typeof location&&location,null==t&&(t=r.protocol+"//"+r.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?r.protocol+t:r.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==r?r.protocol+"//"+t:"https://"+t),i=DO(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const n=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+e,i.href=i.protocol+"://"+n+(r&&r.port===i.port?"":":"+i.port),i}(t,(e=e||{}).path||"/socket.io"),i=r.source,n=r.id,o=r.path,s=aT[n]&&o in aT[n].nsps;let a;return e.forceNew||e["force new connection"]||!1===e.multiplex||s?a=new sT(i,e):(aT[n]||(aT[n]=new sT(i,e)),a=aT[n]),r.query&&!e.query&&(e.query=r.queryKey),a.socket(r.path,e)}Object.assign(hT,{Manager:sT,Socket:nT,io:hT,connect:hT});class uT{constructor(t,e){this.method="GET",this.protocol="HTTPS",this.body=null,this.interval=0,this.timeout=1e4,this.responseType="",this.filteredData=null,this.XHR=void 0,this.isInterval=!1,this.successCallback=void 0,this.errorCallback=void 0,this.statusCallback=void 0,this.onTimeout=()=>{this.XHR&&(this.onErrorCallback(new Error("Error: timeout")),this.circulateRequest())},this.onLoad=()=>{if(this.XHR){if(this.responseData=this.toObject(this.XHR.response),4!==this.XHR.readyState||200!=this.XHR.status&&304!=this.XHR.status)this.onErrorCallback(new Error(this.XHR.statusText));else{try{this.filteredData=this.filter?this.filter(this.responseData):this.responseData}catch(t){this.filteredData=void 0,console.error(t)}this.onSuccessCallback(this.responseData,this.filteredData)}this.circulateRequest()}},this.onError=()=>{this.XHR&&this.onErrorCallback(new Error(this.XHR.statusText))},this.url=t,e&&(this.option=e,this.method=e.method?e.method.toUpperCase():"GET",this.protocol=e.protocol?e.protocol.toUpperCase():"HTTPS",this.headers=e.headers?e.headers:void 0,this.params=e.params?e.params:void 0,this.body=e.body?e.body:null,this.interval=void 0!==e.interval?e.interval:0,this.timeout=e.timeout?e.timeout:1e4,this.responseType=void 0!==e.responseType?e.responseType:"",e.filter&&(this.filter="function"==typeof e.filter?e.filter:new Function("response",e.filter)))}get getUrl(){return this.url}get getOption(){return Object.assign(Object.assign({},this.option),{url:this.url})}get getStatus(){var t;return null===(t=this.XHR)||void 0===t?void 0:t.status}get getRequesting(){return this.isInterval&&0!==this.interval}get getResponseData(){return this.responseData}get getFilterData(){return this.filteredData}send(){this.isInterval=!0,this.request()}abort(){this.isInterval=!1}onceSend(){this.request()}listen(t,e){this.successCallback=t,e&&(this.errorCallback=e)}on(t,e){switch(t){case"onSuccess":this.successCallback=e;break;case"onError":this.errorCallback=e;break;case"onStatus":this.statusCallback=e}}onStatusCallback(t,e){this.statusCallback&&this.statusCallback(t,e)}onErrorCallback(t){this.errorCallback&&this.errorCallback(t),this.onStatusCallback("error",t)}onSuccessCallback(t,e){this.successCallback&&this.successCallback(t,e),this.onStatusCallback("success")}request(){try{if(this.onStatusCallback("connect"),this.XHR||(this.XHR=new XMLHttpRequest),this.XHR.open(this.method,this.paramsUrl()),this.XHR.responseType=this.responseType,this.XHR.timeout=this.timeout,this.XHR.onload=this.onLoad,this.XHR.onerror=this.onError,this.XHR.ontimeout=this.onTimeout,this.headers)for(const t in this.headers)Object.prototype.hasOwnProperty.call(this.headers,t)&&"multipart/form-data"!==this.headers[t]&&this.XHR.setRequestHeader(t,this.headers[t]);this.XHR.send(this.body)}catch(t){console.error(t),this.onErrorCallback(t)}}circulateRequest(){if(this.getRequesting){const t=setTimeout((()=>{this.request(),clearTimeout(t)}),this.interval)}else this.isInterval&&(this.isInterval=!1)}paramsUrl(){let t=this.url+"?";if(this.params)for(const e in this.params)Object.prototype.hasOwnProperty.call(this.params,e)&&(t+=encodeURIComponent(e)+"="+encodeURIComponent(this.params[e])+"&");return t.slice(0,-1)}toObject(t){if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}}}var fT,lT,cT,dT,pT,mT,gT,yT,bT,vT,wT,_T,MT,ST,ET,kT,AT,OT,TT,IT,RT;function CT(t){const e=typeof t;return null!=t&&("object"===e||"function"===e)}function PT(t){let e=t.protocolValue+t.url;return t.port&&(e+=":"+t.port),e}function xT(t,e,r=!1,i,n,o){try{if(!e)return t;let n="";r&&CT(t)&&(n=`const { ${Object.keys(t).join(",")} } = response;`);const a=new Function("response",n+e)(t),h=i?function(t){return"number"==typeof t}(s=a)?`${s}`:CT(s)?JSON.stringify(s,null,2):s:a;return o&&o(h),h}catch(t){return n&&n(t),t}var s}function NT(t,e){if(t.protocol!==lT.HTTP)return;const r=t.configureJson,i=function(t,e){switch(e){case mT.SECOND:return 1e3*t;case mT.MINUTE:return 1e3*t*60;case mT.HOUR:return 1e3*t*60*60;case mT.DAY:return 1e3*t*60*60*24;default:return 1e3*t}}(r.interval,r.unit),n=Object.assign(e[fT.HEADERS],t[fT.HEADERS]);let o=null;const s=r.params,a=new FormData;switch(a.set("default","defaultData"),r.bodyType){case dT.NONE:break;case dT.JSON:n["Content-Type"]=gT.JSON,o=r.body.json;break;case dT.XML:n["Content-Type"]=gT.XML,o=r.body.xml;break;case dT.X_WWW_FORM_URLENCODED:n["Content-Type"]=gT.FORM_URLENCODED;o=function(t){const e=new URLSearchParams;for(const r in t)Object.prototype.hasOwnProperty.call(t,"key")&&e.append(r,t[r]);return e.toString()}(r.body["x-www-form-urlencoded"]);break;case dT.FORM_DATA:{n["Content-Type"]=gT.FORM_DATA;const t=r.body["form-data"];for(const e in t)a.set(e,t[e]);o=a;break}}return{params:s,headers:n,interval:i,body:o,method:r.method,filter:r.filter,protocol:e.protocol}}function BT(t,e,r,i){const n=(t,e)=>{r({status:t,message:e})};e.on("reconnect",(()=>{n(yT.CONNECT)})),e.on("close",(t=>{const e=t||new Error("连接关闭");n(yT.CLOSE,e)})),e.on("error",(t=>{n(yT.ERROR,t)})),e.on("message",((r,n,o)=>{i({api:t,client:e,data:{topic:r,payload:n,packet:o}})})),e.on("connect",(r=>{if(0===r.returnCode)n(yT.SUCCESS,r),function(t,e){const r=t.configureJson,i=r.subscription;if(0==i.length)return;const n={};i.forEach((t=>{t.topic&&(n[t.topic]={qos:t.qos})})),Object.keys(n).length>0&&e.subscribe(n,(t=>{t&&console.error(t)}))}(t,e);else{const t=void 0!==r.returnCode?String(r.returnCode):r.cmd;e.emit("close",new Error(t))}}))}function LT(t,e,r,i){const n=PT(e),o=function(t){if(t.protocol!==lT.MQTT)return;const e=t.configureJson,{baseConfig:r,willMessage:i}=e,n={clientId:r.clientId,keepalive:r.keepAlive,protocolVersion:Number(r.version),protocolId:"MQTT",reconnectPeriod:0};return i&&i.topic&&(n.will={topic:i.topic,payload:i.message||"",qos:i.qos,retain:i.retain}),r.username&&(n.username=r.username),r.password&&(n.password=r.password),n}(t),s=qA.connect(n+(t.url||""),o),a=t.configureJson,{successCallback:h,errorCallback:u}=a;return BT(t,s,(({status:e,message:i})=>{const n=e!==yT.CONNECT?i:void 0;r({api:t,client:s,status:e,message:n}),e===yT.CONNECT&&h?xT({connect:i,client:s},h,!0):e!==yT.ERROR&&e!==yT.CLOSE||!u||xT({error:i,client:s},u,!0)}),i),s}function DT(t,e,r,i){let n=PT(e);const o=function(t,e){if(t.protocol!==lT.WEBSOCKET)return;const r=t.configureJson,i=Object.assign(e[fT.HEADERS],t[fT.HEADERS]),{subProtocols:n,query:o}=r,s=n?n.split(","):["websocket","polling"];return{reconnection:!1,reconnectionAttempts:0,path:t.url,query:o,transports:s,extraHeaders:i,withCredentials:!0}}(t,e),s=t.configureJson,{successCallback:a,errorCallback:h,nameSpace:u}=s;u&&(n+=(/^\/.*/.test(u)?"":"/")+u);const f=hT(n,o);return function(t,e,r,i){const n=t.configureJson,{eventList:o}=n;e.on("connect",(()=>{r(yT.SUCCESS)})),e.on("disconnect",(t=>{r(yT.CLOSE,new Error(t))})),e.on("connect_error",(t=>{r(yT.ERROR,t)})),e.on("reconnect",(()=>{r(yT.CONNECT)})),e.on("reconnect_error",(t=>{r(yT.ERROR,t)})),e.on("reconnect_failed",(t=>{r(yT.ERROR,t||new Error("reconnect_failed"))}));for(let r=0;r<o.length;r++){const n=o[r];e.on(n.event,((...r)=>{i({api:t,client:e,data:{message:r,event:n.event}})}))}}(t,f,((e,i)=>{r({status:e,api:t,client:f,message:i}),e===yT.SUCCESS&&a?xT({socket:f},a,!0):e!==yT.ERROR&&e!==yT.CLOSE||!h||xT({error:i,socket:f},h,!0)}),i),f.connect(),f}!function(t){t.PARAMS="params",t.BODY="body",t.HEADERS="headers"}(fT||(fT={})),function(t){t.HTTP="HTTP",t.MQTT="MQTT",t.WEBSOCKET="WebSocket"}(lT||(lT={})),function(t){t.HTTPS="https://",t.HTTP="http://",t.MQTTS="wss://",t.MQTT="ws://",t.WSS="wss://",t.WS="ws://"}(cT||(cT={})),function(t){t.NONE="none",t.FORM_DATA="form-data",t.X_WWW_FORM_URLENCODED="x-www-form-urlencoded",t.JSON="json",t.XML="xml"}(dT||(dT={})),function(t){t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.OPTIONS="OPTIONS",t.DELETE="DELETE"}(pT||(pT={})),function(t){t.SECOND="second",t.MINUTE="minute",t.HOUR="hour",t.DAY="day"}(mT||(mT={})),lT.HTTP,lT.HTTP,lT.MQTT,lT.MQTT,lT.WEBSOCKET,lT.WEBSOCKET,function(t){t.JSON="application/json;charset=UTF-8",t.TEXT="text/plain;charset=UTF-8",t.XML="application/xml;charset=UTF-8",t.FORM_URLENCODED="application/x-www-form-urlencoded;charset=UTF-8",t.FORM_DATA="multipart/form-data"}(gT||(gT={})),function(t){t.SUCCESS="success",t.ERROR="error",t.CONNECT="connect",t.CLOSE="close"}(yT||(yT={}));class jT{constructor(t,e){this.sourceEnv=t,this.sourceApi=e,bT.add(this),vT.set(this,{}),wT.set(this,void 0),_T.set(this,void 0),D(this,bT,"m",MT).call(this)}on(t,e){"onStatus"===t?j(this,wT,e,"f"):"onMessage"===t&&j(this,_T,e,"f")}getClientById(t){return D(this,vT,"f")[t]}requestAll(){const t=this.sourceApi;t&&t.length>0&&D(this,bT,"m",AT).call(this,t)}requestById(t){const e=this.sourceApi.filter((e=>t.some((t=>t===e.id))));e&&e.length>0&&D(this,bT,"m",AT).call(this,e)}closeAll(){for(const t in D(this,vT,"f"))if(Object.prototype.hasOwnProperty.call(D(this,vT,"f"),t)){const e=D(this,vT,"f")[t];D(this,bT,"m",kT).call(this,e)}}closeById(t){for(let e=0;e<t.length;e++){const r=t[e],i=D(this,vT,"f")[r];D(this,bT,"m",kT).call(this,i)}}}vT=new WeakMap,wT=new WeakMap,_T=new WeakMap,bT=new WeakSet,MT=function(){j(this,vT,{},"f")},ST=function(t){console.log("onStatus",t),D(this,wT,"f")&&D(this,wT,"f").call(this,t)},ET=function(t){console.log("onMessage",t),D(this,_T,"f")&&D(this,_T,"f").call(this,t)},kT=function(t){t instanceof uT?t.abort():t instanceof nT?t.close():t instanceof jA.MqttClient&&t.end()},AT=function(t){for(let e=0;e<t.length;e++){const r=t[e],i=D(this,bT,"m",RT).call(this,r.sid);if(r.nodeArray&&r.nodeArray.length>0&&i)switch(r.protocol){case lT.HTTP:D(this,bT,"m",OT).call(this,r,i);break;case lT.MQTT:D(this,bT,"m",TT).call(this,r,i);break;case lT.WEBSOCKET:D(this,bT,"m",IT).call(this,r,i)}}},OT=function(t,e){let r=D(this,vT,"f")[t.id];if(r)return r.send();r=function(t,e,r,i){const n=PT(e),o=NT(t,e),s=new uT(n+t.url,o);return s.on("onSuccess",((e,r)=>{i({api:t,client:s,data:r||e})})),s.on("onError",(e=>{i({api:t,client:s,data:e})})),s.on("onStatus",((e,i)=>{r({api:t,client:s,status:e,message:i})})),s.send(),s}(t,e,D(this,bT,"m",ST).bind(this),D(this,bT,"m",ET).bind(this)),D(this,vT,"f")[t.id]=r},TT=function(t,e){let r=D(this,vT,"f")[t.id];if(r)return r.reconnect();r=LT(t,e,D(this,bT,"m",ST).bind(this),D(this,bT,"m",ET).bind(this)),D(this,vT,"f")[t.id]=r},IT=function(t,e){let r=D(this,vT,"f")[t.id];if(r)return r.connect();r=DT(t,e,D(this,bT,"m",ST).bind(this),D(this,bT,"m",ET).bind(this)),D(this,vT,"f")[t.id]=r},RT=function(t){return this.sourceEnv.find((e=>e.id===t))};const UT=(t,e)=>e.filter((e=>e.nodeId===t&&"PANEL"===e.contentType));var qT,FT,zT,HT,KT,VT,GT,WT,YT,ZT,XT,QT,JT,$T,tI,eI,rI,iI,nI,oI,sI,aI,hI,uI,fI,lI,cI;class dI{constructor(t,e,r,i){this.treeList=t,this.poiList=e,this.plugin=r,this.cpsPlugin=i,qT.add(this),FT.set(this,{}),D(this,qT,"m",zT).call(this)}batchPoi(t,e){t.nodeArray&&0!==t.nodeArray.length&&("HTTP"===t.protocol?D(this,qT,"m",VT).call(this,t.nodeArray,e):"MQTT"===t.protocol?D(this,qT,"m",HT).call(this,t.nodeArray,e):"WebSocket"===t.protocol&&D(this,qT,"m",KT).call(this,t.nodeArray,e))}}FT=new WeakMap,qT=new WeakSet,zT=function(){if(this.treeList){const t=(t=>{const e=[],r={},i=(t,e)=>{for(const n of t){const{id:t,pid:o,familyId:s,name:a,renderType:h,path:u,children:f,deviceCode:l,deviceName:c}=n,d=Object.assign(Object.assign({},n),{id:t,pid:o,familyId:s,name:a,renderType:h,path:u,children:[],deviceCode:l,deviceName:c});e.push(d),r[t]=d,f.length>0&&i(f,d.children)}};return i(t,e),{treeNodes:e,flatNodes:r}})(this.treeList);j(this,FT,t.flatNodes,"f")}},HT=function(t,e){const{payload:r,topic:i}=e,n=(t=>{try{return JSON.parse(t)}catch(t){return null}})(r.toString()),o=null==t?void 0:t.filter((t=>{var e;return null===(e=t.eventList)||void 0===e?void 0:e.some((t=>((t,e)=>{if(t===e)return!0;const r=t.split("/"),i=e.split("/"),n=r.indexOf("#"),o=r.indexOf("+");if(-1!==n){if(-1!==o&&o<n)return r.slice(0,n).every(((t,e)=>"+"===t||t===i[e]||void 0));{const r=t.indexOf("#");if(t.slice(0,r)===e.slice(0,r))return!0}}else if(-1!==o&&r.length===i.length)return r.every(((t,e)=>"+"===t||t===i[e]||void 0));return!1})(t,i)))}));o&&D(this,qT,"m",VT).call(this,o,n)},KT=function(t,e){const{event:r,message:i}=e,n=t.filter((t=>{var e;return null===(e=t.eventList)||void 0===e?void 0:e.some((t=>t===r))}));n&&D(this,qT,"m",VT).call(this,n,i)},VT=function(t,e){if(!this.poiList)return;const r=[];for(let i=0;i<t.length;i++){const n=t[i],o=UT(n.nodeId,this.poiList),s=D(this,qT,"m",GT).call(this,e,n.matchParams||"",n.nodeId);s&&(o.forEach((t=>{if(t.contentData){const e=t.contentData.ds_user["接口数据"];if(!e)return;for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)){const r=s[t];e.hasOwnProperty(t)&&(e[t].value=r)}}})),r.push(...o))}r.length>0&&D(this,qT,"m",WT).call(this,r)},GT=function(t,e,r){const i=D(this,FT,"f")[r],n=null==i?void 0:i.deviceCode;if(i&&n)return"[object Array]"===Object.prototype.toString.call(t)?t.find((t=>String(t[e])===n)):"[object Object]"===Object.prototype.toString.call(t)?t:void 0},WT=function(t){this.plugin&&this.plugin.batchRender({dataSource:t.map(this.cpsPlugin.formatPoiData)})};class pI{get path(){return D(this,ZT,"f")}set path(t){D(this,ZT,"f")!==t&&j(this,XT,!0,"f"),j(this,ZT,t,"f")}constructor(t,e){this.ssp=t,YT.add(this),ZT.set(this,""),XT.set(this,!0),this.metaData=null,this.treeData=null,this.poiData=null,this.dataSourceData=null,this.topologyData=null,this.propertiesData=null,this.objectsAnimations=new Map,this.animationsData=null,this.modelVisionsData=null,this.soonflow=new class{nodeTypeMethods;outInstances;constructor(t,e){this.nodeTypeMethods=t,this.outInstances=e}async parseFlow(t,e){return new Ct(t,e,this.nodeTypeMethods,this.outInstances).runParse()}unregisterFlow(t,e){new Pt(t,e,this.nodeTypeMethods,this.outInstances)}}(pn,{ssp:this.ssp,cpsManager:this}),this.flowData=null,QT.set(this,AA),JT.set(this,new PA(this.ssp.viewport)),$T.set(this,!1),tI.set(this,!1),eI.set(this,!1),this.formatPoiData=t=>{const{dimensional:e,poiId:r,media:i,display:n,scale:o,x:s,y:a,z:h,rotationX:u,rotationY:f,rotationZ:l,width:c,height:d,nodeId:p,contentType:m,style:g,contentData:y}=t;return{id:r,pid:p,visible:n,width:c,height:d,type:e,contentType:m,position:{x:s,y:a,z:h},rotation:{x:Math.PI/180*u,y:Math.PI/180*f,z:Math.PI/180*l},scale:{x:o/100,y:o/100,z:o/100},style:g,dataSource:(b=y,null==b?[]:lA(b,((t,e)=>lA(t,((t,r)=>lA(t,((t,i)=>({index:t.index,value:t.value||"",group:r,key:i,label:t.label||i,customId:[e,r,i].join("/"),dataOrigin:e})))),2)))),fileUrl:(null==i?void 0:i.assetId)||(null==i?void 0:i.fileId)?(null==i?void 0:i.url)?D(this,YT,"m",hI).call(this,i.url):void 0:null==i?void 0:i.url};var b},(null==e?void 0:e.key)&&this.setKey(e.key),(null==e?void 0:e.path)&&this.setPath(e.path)}setKey(t){t!==xA(D(this,QT,"f").debugKey)&&(D(this,QT,"f").key=t)}async fetchMetaData(){const t=await D(this,YT,"m",uI).call(this,cA);return this.metaData=t,t}async fetchTreeData(){const t=await D(this,YT,"m",uI).call(this,pA);return this.treeData=t,t}async fetchPoiData(){const t=await D(this,YT,"m",uI).call(this,mA);return this.poiData=t.map((t=>Object.assign(Object.assign({},t),{contentData:JSON.parse(t.content||"{}")}))),this.poiData}async fetchDataSourceData(){const t=await D(this,YT,"m",uI).call(this,gA);return this.dataSourceData=t,t}async fetchTopologyData(){const t=await D(this,YT,"m",uI).call(this,yA).then((t=>{const e={linkWidth:.1,linkColor:["#00ff00"],nodeRadius:.05,nodeColor:"#0000ff"};return t.map((t=>{const r=Object.assign(Object.assign({},e),t);return r.imgUrl&&(r.imgUrl=`${this.path}${r.imgUrl}`),r}))}));return this.topologyData=t,t}async fetchPropertiesData(){const t=await D(this,YT,"m",uI).call(this,bA).then((t=>NA(t,"modelId")));return this.propertiesData=t,t}async fetchAnimationsData(){const t=await D(this,YT,"m",uI).call(this,vA).then((t=>NA(t,"modelId")));return this.animationsData=t,t}async fetchModelVisionsData(){const t=await D(this,YT,"m",uI).call(this,wA).then((t=>new Map(Object.entries(t))));return this.modelVisionsData=t,t}async loadPoi(t){var e,r;const i=this.ssp.getPlugin(MA)||this.ssp.registerPlugin(W,MA);try{await this.fetchPoiData(),i.batchRender({dataSource:null!==(r=null===(e=this.poiData)||void 0===e?void 0:e.map(this.formatPoiData))&&void 0!==r?r:[]}),t&&this.refreshPoiByDataSource()}catch(t){}}async refreshPoiByDataSource(){const t=this.ssp.getPlugin(MA)||this.ssp.registerPlugin(W,MA);try{const{dataSources:e,dataSourceApis:r}=await this.fetchDataSourceData(),i=new dI(this.treeData,this.poiData,t,this);if(e&&r){const t=new jT(e,r);t.requestAll(),t.on("onMessage",(({api:t,data:e,client:r})=>{i.batchPoi(t,e)}))}}catch(t){}}getTreeNodeById(t,e=this.treeData){if(!e)return;const r=e.find((e=>e.id===t));if(r)return r;for(let r=0;r<e.length;r++){const i=this.getTreeNodeById(t,e[r].children);if(i)return i}}setPath(t){this.path=t}async loadScene(t={}){const{key:e,path:r}=t;e&&this.setKey(e),r&&this.setPath(r);const{version:i}=await this.fetchMetaData();if(i>=1.2&&D(this,XT,"f")){if(await D(this,YT,"m",rI).call(this),!D(this,$T,"f")&&!D(this,tI,"f")){const{utils:t}=this.ssp;return void t.error(`未授权的场景包:${this.path}`)}!D(this,$T,"f")&&D(this,tI,"f")&&(D(this,eI,"f")||D(this,JT,"f").addToViewport()),j(this,XT,!1,"f")}else i<1.2&&(this.treeData=await this.fetchTreeData());const n=Object.assign({syncProperties:!0,syncModelVisions:!0,needsModelsBoundsTree:!0,applyPresetEffects:!1,loadSceneAlgorithm:kA.DFS,loadLevel:1/0,loadPoi:!1,refreshPoiByDataSource:!1,loadFlowData:!1},t),o=[];n.syncProperties&&o.push(this.fetchPropertiesData()),n.syncModelVisions&&o.push(this.fetchModelVisionsData()),await Promise.allSettled(o),n.loadSceneAlgorithm===kA.BFS?await D(this,YT,"m",cI).call(this,n):n.loadSceneAlgorithm===kA.DFS&&await D(this,YT,"m",lI).call(this,n);const s=[];n.needsModelsBoundsTree&&s.push(this.ssp.computeModelsBoundsTree()),n.applyPresetEffects&&s.push(this.presetEffects()),n.loadPoi&&s.push(this.loadPoi(n.refreshPoiByDataSource)),n.loadFlowData&&s.push(this.loadFlowData()),await Promise.allSettled(s)}async presetEffects(t={}){const{hdr:e=!0,ssao:r=!0,directionalLightShadow:i=!0}=t;if(await this.ssp.render(),e){const{environment:t}=await this.fetchMetaData();t&&this.ssp.setEnvironment({file:`${this.path}${t}`})}if(r&&this.ssp.setSSAO(),i){const t=this.ssp.getAllModel().reduce(((t,e)=>t.union(this.ssp.utils.getBoundingBox(e.children[0]))),new f),{min:e,max:r}=t,n=new l;t.getSize(n);let o=45;this.ssp.utils.isObject(i)&&"number"==typeof i.angle&&(o=i.angle);const s=Math.tan(Math.PI/180*o)*n.x;this.ssp.createDirectionalLight({id:"directionalLight",name:"directionalLight",position:{x:r.x,y:s,z:r.z},target:{x:e.x,y:e.y,z:e.z},openShadow:!0,shadowAutoUpdate:!1,intensity:2,mapSize:this.ssp.viewport.renderer.capabilities.maxTextureSize/2})}}async getTopologies(){return this.fetchTopologyData()}sortTopologyNodes(t,e){var r;const i=t.nodes.reduce(((t,e)=>(t.set(e.id,e),t)),new Map);if(e&&!i.has(e))return void this.ssp.utils.error(`startNodeId ${e} 未找到对应 node`);let n=e?i.get(e):t.nodes[0];if(!n)return;const o=new Set;o.add(n);for(let e=0;e<t.nodes.length-1;e++){let t;for(const e of null!==(r=n.graphs)&&void 0!==r?r:[]){const r=i.get(e.targetNodeId);if(r&&!o.has(r)){t=r;break}}if(!t)break;n=t,o.add(n)}return Object.assign(Object.assign({},t),{nodes:[...new Set([...o,...t.nodes])]})}async playAnimationById(t,e=0,r={}){const{utils:{error:i}}=this.ssp,n=this.ssp.getObjectById(t);if(n)return this.playObjectAnimation(n,e,r);i(`playAnimationById: id 为 ${t} 场景对象未找到`)}async playObjectAnimation(t,e=0,r={}){const{utils:{error:n},animation:o}=this.ssp,{autoStopPrevious:s=!0,onStart:a,onUpdate:h}=r;s&&this.stopObjectAnimation(t);const u=await this.fetchAnimationsData(),f=t.sid,l=u.get(f);if(l){const r=l[e];if(r)try{for(let e=0,n=r.keyframes.length;e<n;e++){let n;if(r.keyframes[e-1]){const t=r.keyframes[e-1];n={x:t.x,y:t.y,z:t.z,rotationX:t.rotationX,rotationY:t.rotationY,rotationZ:t.rotationZ,scaleX:t.scaleX,scaleY:t.scaleY,scaleZ:t.scaleZ}}else{const e=new i,r=(new c).fromArray(t.userData.matrix);e.applyMatrix4(r),n={x:e.position.x,y:e.position.y,z:e.position.z,rotationX:e.rotation.x,rotationY:e.rotation.y,rotationZ:e.rotation.z,scaleX:e.scale.x,scaleY:e.scale.y,scaleZ:e.scale.z}}const s=r.keyframes[e],{delay:u,duration:l,easing:d,repeat:p,yoyo:m}=s,g={x:s.x,y:s.y,z:s.z,rotationX:s.rotationX,rotationY:s.rotationY,rotationZ:s.rotationZ,scaleX:s.scaleX,scaleY:s.scaleY,scaleZ:s.scaleZ};await o(n,g,{delay:u,duration:l,mode:d,repeat:-1===p?1/0:p,yoyo:m},((e,r)=>{t.position.set(e.x,e.y,e.z),t.rotation.set(e.rotationX,e.rotationY,e.rotationZ),t.scale.set(e.scaleX,e.scaleY,e.scaleZ),null==h||h(e,r)}),(t=>{var e;this.objectsAnimations.has(f)||this.objectsAnimations.set(f,new Set),null===(e=this.objectsAnimations.get(f))||void 0===e||e.add(t),null==a||a(t)}))}}catch(t){}else n(`id: ${f} 未找到索引为 ${e} 的动画`)}else n(`id: ${f} 未找到动画`)}async stopObjectAnimation(t){var e,r;const i=t.sid;this.objectsAnimations.has(i)&&(null===(e=this.objectsAnimations.get(i))||void 0===e||e.forEach((t=>t.stop())),null===(r=this.objectsAnimations.get(i))||void 0===r||r.clear())}async flyToSceneFromVisionsData(t=0,e={}){const{utils:{error:r}}=this.ssp;if(this.modelVisionsData||await this.fetchModelVisionsData(),this.modelVisionsData){const i=this.modelVisionsData.get(""),n=null==i?void 0:i[t];if(n)return this.ssp.flyTo(n.position,n.rotation,e);r("场景视角数据未找到")}}async flyToObjectFromVisionsData(t,e=0,r={}){const{utils:{error:i}}=this.ssp;if(this.modelVisionsData||await this.fetchModelVisionsData(),this.modelVisionsData){const n=this.modelVisionsData.get(t.sid),o=null==n?void 0:n[e];if(o)return this.ssp.flyTo(o.position,o.rotation,r);i("对象视角数据未找到")}}async loadFlowData(){const t=new xt(this.path),{flowList:e}=await t.getFlowData();return this.flowData=e,e}async runFlowById(t){if(!this.flowData)return Promise.reject("CpsManagerPlugin.runFlowById(): 请先调用 loadFlowData 获取 flowData");const e=this.flowData.find((e=>e.id===t));if(!e)return Promise.reject(`CpsManagerPlugin.runFlowById() flowData not found by flowId(${t})`);const{nodes:r,edges:i}=e;return this.soonflow.parseFlow(r,i)}}ZT=new WeakMap,XT=new WeakMap,QT=new WeakMap,JT=new WeakMap,$T=new WeakMap,tI=new WeakMap,eI=new WeakMap,YT=new WeakSet,rI=async function(){let e;const{resource:r}=await this.fetchMetaData();if(D(this,QT,"f").verifyKey){if(e=await D(this,YT,"m",iI).call(this,r),"forbid"===e)return void j(this,$T,!1,"f");if("noServerEnc"===e)await D(this,YT,"m",sI).call(this,r);else{const t=D(this,QT,"f").verifyKey,{verifiedRes:r,dec:i}=D(this,YT,"m",oI).call(this,e,t);j(this,$T,r,"f"),D(this,$T,"f")&&(this.treeData=i)}}else if(D(this,QT,"f").key){const{verifiedRes:t}=await D(this,YT,"m",aI).call(this,r);t||await D(this,YT,"m",sI).call(this,r)}else D(this,QT,"f").debugKey?await D(this,YT,"m",sI).call(this,r):t.utils.error("许可证密钥不存在")},iI=async function(t){const e=Math.random().toString(36).substring(2),{verifyKey:r}=D(this,QT,"f"),i=new UM(r,"pkcs8-public",{signingScheme:"pkcs1-md5",encryptionScheme:"pkcs1"}),n=i.encrypt(e,"base64"),o=await D(this,YT,"m",nI).call(this,D(this,YT,"m",hI).call(this,t),n),{license:s,serverEnc:a}=o;if(!a)return"noServerEnc";return i.decryptPublic(a,"utf8")!==e?"forbid":s},nI=async function(t,e=""){try{const r=await fetch(t,{headers:{token:e}}),i=r.headers,n=await r.json();return{license:n,serverEnc:i.get("token")}}catch(t){return{license:{content:"",sign:""},serverEnc:""}}},oI=function(t,e){let r=null,i=!0;try{const i=new UM(e,"pkcs8-public",{signingScheme:"pkcs1-md5",encryptionScheme:"pkcs1"});if(2===t.version)r=BA(t,i);else r=((t,e)=>{const{content:r,sign:i}=t;if(!e.verify(r,i,"base64","base64"))throw new Error("v1 error");return e.decryptPublic(r,"json")})(t,i)}catch(t){i=!1,this.ssp.utils.error("秘钥 key 验证失败")}return{verifiedRes:i,dec:r}},sI=async function(t){const e=await D(this,YT,"m",uI).call(this,t),r=xA(D(this,QT,"f").debugKey),{verifiedRes:i,dec:n}=D(this,YT,"m",oI).call(this,e,r);j(this,tI,i,"f"),D(this,tI,"f")&&(this.treeData=n)},aI=async function(t){const e=await D(this,YT,"m",uI).call(this,t),r=D(this,QT,"f").key,{verifiedRes:i,dec:n}=D(this,YT,"m",oI).call(this,e,r);return j(this,eI,i,"f"),j(this,tI,i,"f"),D(this,eI,"f")&&(this.treeData=n),{verifiedRes:i,dec:n}},hI=function(t){return`${D(this,ZT,"f")}${t}`},uI=async function(t){const{utils:e}=this.ssp;return e.fetchFile(D(this,YT,"m",hI).call(this,t),"json")},fI=async function(t,e){const r=this.ssp.getObjectById(t.id);if(r)return r;const{syncProperties:i}=e,{id:n,name:o,renderType:s,path:a,matrix:h}=t,{ssp:u}=this,f=(new c).fromArray(h);let l=null;if("3D"===s)if(a)try{const t=a.replaceAll(/#/g,"%23");l=await u.loadModel({id:n,name:o,url:D(this,YT,"m",hI).call(this,t)})}catch(t){console.error(t)}else u.utils.warn(`id: ${n} path 为空`);else"GROUP"!==s&&"STUB"!==s||(l=u.createGroup({id:n,name:o}));if(l){f.decompose(l.position,l.quaternion,l.scale);const e=Object.assign({},t);if(Reflect.deleteProperty(e,"children"),l.userData=e,i&&this.propertiesData){const t=this.propertiesData.get(n);t&&(l.userData[_A]=t)}}return l},lI=async function(e){const{loadLevel:r,loadTargetId:i}=e;let n=null;if(i){const e=this.getTreeNodeById(i);e?n=[e]:t.utils.error("根据 loadTargetId 未找到对应树节点")}else n=this.treeData;if(!n)return t.utils.error("treeData is null");const o=async(t,i,n=0)=>{if(n++,r&&n>r)return;const{ssp:s}=this,a=await D(this,YT,"m",fI).call(this,t,e);a&&i&&s.addObject(a,i),await Promise.allSettled(t.children.map((t=>o(t,a,n))))};await Promise.allSettled(n.map((t=>o(t,t.pid?this.ssp.getObjectById(t.pid):null,0))))},cI=async function(e){if(!this.treeData)return void t.utils.error("treeData is null");const r=[],i=Object.create(null),n=[],{ssp:o}=this;for(r.push(...this.treeData);r.length>0;){r.splice(0,r.length).forEach((t=>{n.push(t),r.push(...t.children.map((e=>(i[e.id]=t.id,e))))}))}await Promise.allSettled(n.map((t=>D(this,YT,"m",fI).call(this,t,e)))),Object.entries(i).forEach((([t,e])=>{const r=o.getObjectById(t),i=o.getObjectById(e);r&&i&&o.addObject(r,i)}))};export{vA as ANIMATIONS_DATA_FILE_PATH,gA as DATA_SOURCE_FILE_PATH,kA as LoadSceneAlgorithm,cA as META_DATA_FILE_PATH,wA as MODEL_VISIONS_DATA_FILE_PATH,mA as POI_DATA_FILE_PATH,MA as POI_PLUGIN_NAME,bA as PROPERTIES_DATA_FLEE_PATH,_A as PROPERTIES_KEY,SA as PoiContentTypeEnum,dA as SIGN_PATH,yA as TOPOLOGY_DATA_FILE_PATH,pA as TREE_DATA_FILE_PATH,pI as default};