metaapi.cloud-metastats-sdk
Version:
Javascript SDK for MetaStats forex trading statistics API. Can calculate metrics for MetaTrader accounts added to MetaApi. Supports both MetaTrader 5 (MT5) and MetaTrader 4 (MT4). (https://metaapi.cloud)
1 lines • 55.3 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MetaStats=t():e.MetaStats=t()}(this,(()=>(()=>{var e={155:e=>{var t,n,r=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var a,u=[],c=!1,l=-1;function f(){c&&a&&(c=!1,a.length?u=a.concat(u):l=-1,u.length&&p())}function p(){if(!c){var e=s(f);c=!0;for(var t=u.length;t;){for(a=u,u=[];++l<t;)a&&a[l].run();l=-1,t=u.length}a=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function h(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new d(e,t)),1!==u.length||c||s(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=h,r.addListener=h,r.once=h,r.off=h,r.removeListener=h,r.removeAllListeners=h,r.emit=h,r.prependListener=h,r.prependOnceListener=h,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},559:function(e,t,n){var r,o,i,s;s=function(e,t){"use strict";function n(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function r(e){return function(){var t=this,r=arguments;return new Promise((function(o,i){var s=e.apply(t,r);function a(e){n(s,o,i,a,u,"next",e)}function u(e){n(s,o,i,a,u,"throw",e)}a(void 0)}))}}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var s=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"agiliumtrade.agiliumtrade.ai";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._httpClient=t,this._domain=r,this._token=n,this._urlCache=null,this._accountCache={}}var n,s;return n=e,s=[{key:"token",get:function(){return this._token}},{key:"requestMetastats",value:function(e,t){var n=this;return r((function(){var r,o,s,a;return i(this,(function(i){switch(i.label){case 0:return[4,n._updateHost()];case 1:return i.sent(),[4,n._updateAccountHost(t)];case 2:i.sent(),r=n._accountCache[t],i.label=3;case 3:return i.trys.push([3,5,,10]),o=r.regions[r.regionIndex],s=e("https://metastats-api-v1.".concat(o.region,".").concat(n._urlCache.domain),o.id),[4,n._httpClient.request(s)];case 4:return[2,i.sent()];case 5:if(a=i.sent(),["ConflictError","InternalError","ApiError","TimeoutError"].includes(a.name))return[3,6];throw a;case 6:if(r.regions.length!==r.regionIndex+1)return[3,7];throw r.regionIndex=0,a;case 7:return r.regionIndex++,[4,n.requestMetastats(e,t)];case 8:return[2,i.sent()];case 9:return[3,10];case 10:return[2]}}))}))()}},{key:"_updateHost",value:function(){var e=this;return r((function(){var t;return i(this,(function(n){switch(n.label){case 0:return!e._urlCache||e._urlCache.lastUpdated<Date.now()-6e5?[4,e._httpClient.requestWithFailover({url:"https://mt-provisioning-api-v1.".concat(e._domain,"/users/current/servers/mt-client-api"),method:"GET",headers:{"auth-token":e._token},json:!0})]:[3,2];case 1:t=n.sent(),e._urlCache={domain:t.domain,lastUpdated:Date.now()},n.label=2;case 2:return[2]}}))}))()}},{key:"_updateAccountHost",value:function(e){var n=this;return r((function(){var o,s,a,u;return i(this,(function(c){switch(c.label){case 0:return!n._accountCache[e]||n._accountCache[e].lastUpdated<Date.now()-6e5?(l=r((function(e){var t;return i(this,(function(r){switch(r.label){case 0:return t={url:"https://mt-provisioning-api-v1.".concat(n._domain,"/users/current/accounts/").concat(e),method:"GET",headers:{"auth-token":n._token},json:!0},[4,n._httpClient.requestWithFailover(t)];case 1:return[2,r.sent()]}}))})),o=function(e){return l.apply(this,arguments)},s=[],[4,o(e)]):[3,4];case 1:return(a=c.sent()).primaryAccountId?[4,o(a.primaryAccountId)]:[3,3];case 2:a=c.sent(),c.label=3;case 3:if(!(s=(s=[{_id:a._id,region:a.region,state:a.state}].concat(a.accountReplicas||[])).filter((function(e){return"DEPLOYED"===e.state}))).length)throw new t.ValidationError("There are no replicas deployed yet. Please make sure at least one of the replicas is deployed.");u=s.map((function(e){return{region:e.region,id:e._id}})),n._accountCache[e]={regions:u,regionIndex:0,lastUpdated:Date.now()},c.label=4;case 4:return[2]}var l}))}))()}}],s&&o(n.prototype,s),e}()},"object"==typeof e.exports?s(t,n(355)):(o=[t,n(355)],void 0===(i="function"==typeof(r=s)?r.apply(t,o):r)||(e.exports=i))},355:function(e,t,n){var r,o,i,s,a=n(155);s=function(e){"use strict";function t(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){return r=l()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&u(o,n.prototype),o},r.apply(null,arguments)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},i(e)}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function c(e){var t="function"==typeof Map?new Map:void 0;return c=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return r(e,arguments,i(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),u(o,e)},c(e)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function f(e){var n=l();return function(){var r,o,s,a,u=i(e);if(n){var c=i(this).constructor;r=Reflect.construct(u,arguments,c)}else r=u.apply(this,arguments);return o=this,!(s=r)||"object"!=((a=s)&&"undefined"!=typeof Symbol&&a.constructor===Symbol?"symbol":typeof a)&&"function"!=typeof s?t(o):s}}Object.defineProperty(e,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(e,{ApiError:function(){return d},ForbiddenError:function(){return y},InternalError:function(){return v},NotFoundError:function(){return h},TooManyRequestsError:function(){return g},UnauthorizedError:function(){return m},ValidationError:function(){return b}});var p=void 0!==a&&a.release&&"node"===a.release.name,d=function(e){s(u,e);var r,i,a=f(u);function u(e,r,o,i){var s;return n(this,u),(s=a.call(this,i?r+". Request URL: "+i:r)).name=e.name,s.status=o,s.url=i,p&&Error.captureStackTrace&&Error.captureStackTrace(t(s),e),s}return r=u,(i=[{key:"code",get:function(){return this._code},set:function(e){this._code=e}},{key:"arguments",get:function(){return this._args},set:function(e){this._args=e}}])&&o(r.prototype,i),u}(c(Error)),h=function(e){s(r,e);var t=f(r);function r(e,o){return n(this,r),t.call(this,r,e,404,o)}return r}(d),y=function(e){s(r,e);var t=f(r);function r(e,o){return n(this,r),t.call(this,r,e,403,o)}return r}(d),m=function(e){s(r,e);var t=f(r);function r(e,o){return n(this,r),t.call(this,r,e,401,o)}return r}(d),b=function(e){s(r,e);var t=f(r);function r(e,o,i){var s;return n(this,r),(s=t.call(this,r,e,400,i)).details=o,s}return r}(d),v=function(e){s(r,e);var t=f(r);function r(e,o){return n(this,r),t.call(this,r,e,500,o)}return r}(d),g=function(e){s(r,e);var t=f(r);function r(e,o,i){var s;return n(this,r),(s=t.call(this,r,e,429,i)).metadata=o,s}return r}(d)},"object"==typeof e.exports?s(t):(o=[t],void 0===(i="function"==typeof(r=s)?r.apply(t,o):r)||(e.exports=i))},313:function(e,t,n){var r,o,i,s;s=function(e,t,n,r){"use strict";function o(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function a(e){o(s,r,i,a,u,"next",e)}function u(e){o(s,r,i,a,u,"throw",e)}a(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e){return e&&e.__esModule?e:{default:e}}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r,o,i,s=l(e);if(t){var a=l(this).constructor;n=Reflect.construct(s,arguments,a)}else n=s.apply(this,arguments);return r=this,!(o=n)||"object"!=((i=o)&&"undefined"!=typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)&&"function"!=typeof o?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):o}}function h(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}Object.defineProperty(e,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(e,{HttpClientMock:function(){return m},default:function(){return y}}),t=f(t),r=f(r);var y=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:60,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,e),this._timeout=1e3*t,this._retries=n.retries||5,this._minRetryDelay=1e3*(n.minDelayInSeconds||1),this._maxRetryDelay=1e3*(n.maxDelayInSeconds||30)}return u(e,[{key:"request",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now()+this._maxRetryDelay*this._retries,n=this;return i((function(){var r,o,i,s;return h(this,(function(a){switch(a.label){case 0:e.timeout=n._timeout,r=0,e.callback=function(e,t){t&&202===t.status&&(r=t.headers["retry-after"])},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n._makeRequest(e)];case 2:return i=a.sent(),e.callback(null,i),o=i&&i.data||void 0,[3,4];case 3:throw s=a.sent(),n._convertError(s);case 4:return r?[4,n._handleRetry(t,1e3*r)]:[3,7];case 5:return a.sent(),[4,n.request(e,t)];case 6:o=a.sent(),a.label=7;case 7:return[2,o]}}))}))()}},{key:"requestWithFailover",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now()+this._maxRetryDelay*this._retries,r=this;return i((function(){var o,i,s,a;return h(this,(function(u){switch(u.label){case 0:e.timeout=r._timeout,o=0,e.callback=function(e,t){t&&202===t.status&&(o=t.headers["retry-after"])},u.label=1;case 1:return u.trys.push([1,3,,5]),[4,r._makeRequest(e)];case 2:return s=u.sent(),e.callback(null,s),i=s&&s.data||void 0,[3,5];case 3:return a=u.sent(),[4,r._handleError(a,t,n)];case 4:return t=u.sent(),[2,r.requestWithFailover(e,t,n)];case 5:return o?[4,r._handleRetry(n,1e3*o)]:[3,8];case 6:return u.sent(),[4,r.requestWithFailover(e,t,n)];case 7:i=u.sent(),u.label=8;case 8:return[2,i]}}))}))()}},{key:"_makeRequest",value:function(e){return(0,t.default)(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){c(e,t,n[t])}))}return e}({transitional:{clarifyTimeoutError:!0}},e))}},{key:"_wait",value:function(e){return i((function(){return h(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){return setTimeout(t,e)}))];case 1:return t.sent(),[2]}}))}))()}},{key:"_handleRetry",value:function(e,t){var n=this;return i((function(){return h(this,(function(o){switch(o.label){case 0:return e>Date.now()+t?[4,n._wait(t)]:[3,2];case 1:return o.sent(),[3,3];case 2:throw new r.default("Timed out waiting for the end of the process of calculating metrics");case 3:return[2]}}))}))()}},{key:"_handleError",value:function(e,t,n){var r=this;return i((function(){var o,i,s;return h(this,(function(a){switch(a.label){case 0:return o=r._convertError(e),["InternalError","ApiError"].includes(o.name)&&t<r._retries?(i=Math.min(Math.pow(2,t)*r._minRetryDelay,r._maxRetryDelay),[4,r._wait(i)]):[3,2];case 1:return a.sent(),[2,t+1];case 2:return"TooManyRequestsError"!==o.name?[3,4]:(s=Date.parse(o.metadata.recommendedRetryTime))<n?[4,r._wait(s-Date.now())]:[3,4];case 3:return a.sent(),[2,t];case 4:throw o}}))}))()}},{key:"_convertError",value:function(e){var t,r=e.response||{},o=r.data||{},i=r.status||e.status,s=null==e||null===(t=e.config)||void 0===t?void 0:t.url,a=o.message||e.message,u=o.message||e.code||e.message;switch(i){case 400:return new n.ValidationError(a,o.details||e.details,s);case 401:return new n.UnauthorizedError(a,s);case 403:return new n.ForbiddenError(a,s);case 404:return new n.NotFoundError(a,s);case 429:return new n.TooManyRequestsError(a,o.metadata||e.metadata,s);case 500:return new n.InternalError(a,s);default:return new n.ApiError(n.ApiError,u,i,s)}}}]),e}(),m=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(n,e);var t=d(n);function n(e,r,o){var i;return s(this,n),(i=t.call(this,r,o))._requestFn=e,i}return u(n,[{key:"_makeRequest",value:function(){return this._requestFn.apply(this,arguments)}}]),n}(y)},"object"==typeof e.exports?s(t,n(218),n(355),n(554)):(o=[t,n(218),n(355),n(554)],void 0===(i="function"==typeof(r=s)?r.apply(t,o):r)||(e.exports=i))},120:function(e,t){var n,r,o,i;i=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof e.exports?i(t):(r=[t],void 0===(o="function"==typeof(n=i)?n.apply(t,r):n)||(e.exports=o))},698:function(e,t,n){var r,o,i,s;s=function(e,t){"use strict";var n,r;function o(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function a(e){o(s,r,i,a,u,"next",e)}function u(e){o(s,r,i,a,u,"throw",e)}a(void 0)}))}}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}}),n=t,r=e,Object.keys(n).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}})}));var u=function(){function e(t){var n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r=void 0,(n="_domainClient")in this?Object.defineProperty(this,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):this[n]=r,this._domainClient=t}var t,n;return t=e,n=[{key:"getMetrics",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this;return i((function(){var r;return a(this,(function(o){switch(o.label){case 0:return r=function(e,r){return{url:e+"/users/current/accounts/".concat(r,"/metrics"),method:"GET",headers:{"auth-token":n._domainClient.token},params:{includeOpenPositions:t},json:!0}},[4,n._domainClient.requestMetastats(r,e)];case 1:return[2,o.sent().metrics]}}))}))()}},{key:"getAccountTrades",value:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1e3,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=this;return i((function(){var i;return a(this,(function(a){switch(a.label){case 0:return i=function(e,i){return{url:e+"/users/current/accounts/".concat(i,"/historical-trades/").concat(t,"/").concat(n),method:"GET",headers:{"auth-token":u._domainClient.token},params:{updateHistory:r,limit:o,offset:s},json:!0}},[4,u._domainClient.requestMetastats(i,e)];case 1:return[2,a.sent().trades]}}))}))()}},{key:"getAccountOpenTrades",value:function(e){var t=this;return i((function(){var n;return a(this,(function(r){switch(r.label){case 0:return n=function(e,n){return{url:e+"/users/current/accounts/".concat(n,"/open-trades"),method:"GET",headers:{"auth-token":t._domainClient.token},json:!0}},[4,t._domainClient.requestMetastats(n,e)];case 1:return[2,r.sent().openTrades]}}))}))()}},{key:"resetMetrics",value:function(e){var t=this;return i((function(){var n;return a(this,(function(r){return n=function(e,n){return{url:e+"/users/current/accounts/".concat(n),method:"DELETE",headers:{"auth-token":t._domainClient.token},json:!0}},[2,t._domainClient.requestMetastats(n,e)]}))}))()}}],n&&s(t.prototype,n),e}()},"object"==typeof e.exports?s(t,n(120)):(o=[t,n(120)],void 0===(i="function"==typeof(r=s)?r.apply(t,o):r)||(e.exports=i))},554:function(e,t){var n,r,o,i;i=function(e){"use strict";function t(e,n,o){return t=i()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&r(i,n.prototype),i},t.apply(null,arguments)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}function o(e){var i="function"==typeof Map?new Map:void 0;return o=function(e){if(null===e||(o=e,-1===Function.toString.call(o).indexOf("[native code]")))return e;var o;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,s)}function s(){return t(e,arguments,n(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),r(s,e)},o(e)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var s=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}(a,e);var t,o,s=(t=a,o=i(),function(){var e,r,i,s,a=n(t);if(o){var u=n(this).constructor;e=Reflect.construct(a,arguments,u)}else e=a.apply(this,arguments);return r=this,!(i=e)||"object"!=((s=i)&&"undefined"!=typeof Symbol&&s.constructor===Symbol?"symbol":typeof s)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=s.call(this,e)).name="TimeoutError",t}return a}(o(Error))},"object"==typeof e.exports?i(t):(r=[t],void 0===(o="function"==typeof(n=i)?n.apply(t,r):n)||(e.exports=o))},511:function(e,t,n){var r,o,i,s;s=function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(e,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(e,{MetaStats:function(){return t.default},default:function(){return r}});var r=(t=n(t)).default},"object"==typeof e.exports?s(t,n(288)):(o=[t,n(288)],void 0===(i="function"==typeof(r=s)?r.apply(t,o):r)||(e.exports=i))},288:function(e,t,n){var r,o,i,s;s=function(e,t,n,r){"use strict";function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}}),t=i(t),n=i(n),r=i(r);var s=function(){function e(o){var i,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s=void 0,(i="_metaStatsClient")in this?Object.defineProperty(this,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):this[i]=s;var u=new t.default(a.requestTimeout,a.retryOpts),c=new n.default(u,o,a.domain);this._metaStatsClient=new r.default(c)}var i,s;return i=e,(s=[{key:"getMetrics",get:function(){return this._metaStatsClient.getMetrics.bind(this._metaStatsClient)}},{key:"getAccountTrades",get:function(){return this._metaStatsClient.getAccountTrades.bind(this._metaStatsClient)}},{key:"getAccountOpenTrades",get:function(){return this._metaStatsClient.getAccountOpenTrades.bind(this._metaStatsClient)}},{key:"resetMetrics",get:function(){return this._metaStatsClient.resetMetrics.bind(this._metaStatsClient)}}])&&o(i.prototype,s),e}()},"object"==typeof e.exports?s(t,n(313),n(559),n(698)):(o=[t,n(313),n(559),n(698)],void 0===(i="function"==typeof(r=s)?r.apply(t,o):r)||(e.exports=i))},218:(e,t,n)=>{"use strict";function r(e,t){return function(){return e.apply(t,arguments)}}const{toString:o}=Object.prototype,{getPrototypeOf:i}=Object,s=(a=Object.create(null),e=>{const t=o.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const u=e=>(e=e.toLowerCase(),t=>s(t)===e),c=e=>t=>typeof t===e,{isArray:l}=Array,f=c("undefined"),p=u("ArrayBuffer"),d=c("string"),h=c("function"),y=c("number"),m=e=>null!==e&&"object"==typeof e,b=e=>{if("object"!==s(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},v=u("Date"),g=u("File"),w=u("Blob"),E=u("FileList"),O=u("URLSearchParams");function _(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function S(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,T=e=>!f(e)&&e!==R,j=(x="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>x&&e instanceof x);var x;const P=u("HTMLFormElement"),A=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),C=u("RegExp"),k=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};_(n,((n,o)=>{!1!==t(n,o,e)&&(r[o]=n)})),Object.defineProperties(e,r)},N="abcdefghijklmnopqrstuvwxyz",D="0123456789",F={DIGIT:D,ALPHA:N,ALPHA_DIGIT:N+N.toUpperCase()+D};var U={isArray:l,isArrayBuffer:p,isBuffer:function(e){return null!==e&&!f(e)&&null!==e.constructor&&!f(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=s(e))||"object"===t&&h(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&p(e.buffer),t},isString:d,isNumber:y,isBoolean:e=>!0===e||!1===e,isObject:m,isPlainObject:b,isUndefined:f,isDate:v,isFile:g,isBlob:w,isRegExp:C,isFunction:h,isStream:e=>m(e)&&h(e.pipe),isURLSearchParams:O,isTypedArray:j,isFileList:E,forEach:_,merge:function e(){const{caseless:t}=T(this)&&this||{},n={},r=(r,o)=>{const i=t&&S(n,o)||o;b(n[i])&&b(r)?n[i]=e(n[i],r):b(r)?n[i]=e({},r):l(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&_(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:o}={})=>(_(t,((t,o)=>{n&&h(t)?e[o]=r(t,n):e[o]=t}),{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,a;const u={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],r&&!r(a,e,t)||u[a]||(t[a]=e[a],u[a]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:u,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!y(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:P,hasOwnProperty:A,hasOwnProp:A,reduceDescriptors:k,freezeMethods:e=>{k(e,((t,n)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];h(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:S,global:R,isContextDefined:T,ALPHABET:F,generateString:(e=16,t=F.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(m(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=l(e)?[]:{};return _(e,((e,t)=>{const i=n(e,r+1);!f(i)&&(o[t]=i)})),t[r]=void 0,o}}return e};return n(e,0)}};function L(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}U.inherits(L,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:U.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const B=L.prototype,M={};function q(e){return U.isPlainObject(e)||U.isArray(e)}function I(e){return U.endsWith(e,"[]")?e.slice(0,-2):e}function z(e,t,n){return e?e.concat(t).map((function(e,t){return e=I(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}["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((e=>{M[e]={value:e}})),Object.defineProperties(L,M),Object.defineProperty(B,"isAxiosError",{value:!0}),L.from=(e,t,n,r,o,i)=>{const s=Object.create(B);return U.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),L.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const H=U.toFlatObject(U,{},null,(function(e){return/^is[A-Z]/.test(e)}));function J(e,t,n){if(!U.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=U.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!U.isUndefined(t[e])}))).metaTokens,o=n.visitor||c,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&U.isSpecCompliantForm(t);if(!U.isFunction(o))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(U.isDate(e))return e.toISOString();if(!a&&U.isBlob(e))throw new L("Blob is not supported. Use a Buffer instead.");return U.isArrayBuffer(e)||U.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(U.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(U.isArray(e)&&function(e){return U.isArray(e)&&!e.some(q)}(e)||(U.isFileList(e)||U.endsWith(n,"[]"))&&(a=U.toArray(e)))return n=I(n),a.forEach((function(e,r){!U.isUndefined(e)&&null!==e&&t.append(!0===s?z([n],r,i):null===s?n:n+"[]",u(e))})),!1;return!!q(e)||(t.append(z(o,n,i),u(e)),!1)}const l=[],f=Object.assign(H,{defaultVisitor:c,convertValue:u,isVisitable:q});if(!U.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!U.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),U.forEach(n,(function(n,i){!0===(!(U.isUndefined(n)||null===n)&&o.call(t,n,U.isString(i)?i.trim():i,r,f))&&e(n,r?r.concat(i):[i])})),l.pop()}}(e),t}function W(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function V(e,t){this._pairs=[],e&&J(e,this,t)}const G=V.prototype;function K(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $(e,t,n){if(!t)return e;const r=n&&n.encode||K,o=n&&n.serialize;let i;if(i=o?o(t,n):U.isURLSearchParams(t)?t.toString():new V(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}G.append=function(e,t){this._pairs.push([e,t])},G.toString=function(e){const t=e?function(t){return e.call(this,t,W)}:W;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var X=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){U.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Q={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Y={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:V,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&"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 Z(e){function t(e,n,r,o){let i=e[o++];const s=Number.isFinite(+i),a=o>=e.length;return i=!i&&U.isArray(r)?r.length:i,a?(U.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s):(r[i]&&U.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&U.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s)}if(U.isFormData(e)&&U.isFunction(e.entries)){const n={};return U.forEachEntry(e,((e,r)=>{t(function(e){return U.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const ee={"Content-Type":void 0},te={transitional:Q,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=U.isObject(e);if(o&&U.isHTMLForm(e)&&(e=new FormData(e)),U.isFormData(e))return r&&r?JSON.stringify(Z(e)):e;if(U.isArrayBuffer(e)||U.isBuffer(e)||U.isStream(e)||U.isFile(e)||U.isBlob(e))return e;if(U.isArrayBufferView(e))return e.buffer;if(U.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return J(e,new Y.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return Y.isNode&&U.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=U.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return J(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e){if(U.isString(e))try{return(0,JSON.parse)(e),U.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||te.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(e&&U.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw L.from(e,L.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Y.classes.FormData,Blob:Y.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};U.forEach(["delete","get","head"],(function(e){te.headers[e]={}})),U.forEach(["post","put","patch"],(function(e){te.headers[e]=U.merge(ee)}));var ne=te;const re=U.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"]),oe=Symbol("internals");function ie(e){return e&&String(e).trim().toLowerCase()}function se(e){return!1===e||null==e?e:U.isArray(e)?e.map(se):String(e)}function ae(e,t,n,r,o){return U.isFunction(r)?r.call(this,t,n):(o&&(t=n),U.isString(t)?U.isString(r)?-1!==t.indexOf(r):U.isRegExp(r)?r.test(t):void 0:void 0)}class ue{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ie(t);if(!o)throw new Error("header name must be a non-empty string");const i=U.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=se(e))}const i=(e,t)=>U.forEach(e,((e,n)=>o(e,n,t)));return U.isPlainObject(e)||e instanceof this.constructor?i(e,t):U.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&re[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t):null!=e&&o(t,e,n),this}get(e,t){if(e=ie(e)){const n=U.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(U.isFunction(t))return t.call(this,e,n);if(U.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ie(e)){const n=U.findKey(this,e);return!(!n||void 0===this[n]||t&&!ae(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ie(e)){const o=U.findKey(n,e);!o||t&&!ae(0,n[o],o,t)||(delete n[o],r=!0)}}return U.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!ae(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return U.forEach(this,((r,o)=>{const i=U.findKey(n,o);if(i)return t[i]=se(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();s!==o&&delete t[o],t[s]=se(r),n[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return U.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&U.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[oe]=this[oe]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ie(e);t[r]||(function(e,t){const n=U.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return U.isArray(e)?e.forEach(r):r(e),this}}ue.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),U.freezeMethods(ue.prototype),U.freezeMethods(ue);var ce=ue;function le(e,t){const n=this||ne,r=t||n,o=ce.from(r.headers);let i=r.data;return U.forEach(e,(function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)})),o.normalize(),i}function fe(e){return!(!e||!e.__CANCEL__)}function pe(e,t,n){L.call(this,null==e?"canceled":e,L.ERR_CANCELED,t,n),this.name="CanceledError"}U.inherits(pe,L,{__CANCEL__:!0});var de=Y.isStandardBrowserEnv?{write:function(e,t,n,r,o,i){const s=[];s.push(e+"="+encodeURIComponent(t)),U.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),U.isString(r)&&s.push("path="+r),U.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function he(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var ye=Y.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=U.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function me(e,t){let n=0;const r=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const u=Date.now(),c=r[s];o||(o=u),n[i]=a,r[i]=u;let l=s,f=0;for(;l!==i;)f+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o<t)return;const p=c&&u-c;return p?Math.round(1e3*f/p):void 0}}(50,250);return o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,a=i-n,u=r(a);n=i;const c={loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:u||void 0,estimated:u&&s&&i<=s?(s-i)/u:void 0,event:o};c[t?"download":"upload"]=!0,e(c)}}const be={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let r=e.data;const o=ce.from(e.headers).normalize(),i=e.responseType;let s;function a(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}U.isFormData(r)&&(Y.isStandardBrowserEnv||Y.isStandardBrowserWebWorkerEnv)&&o.setContentType(!1);let u=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(t+":"+n))}const c=he(e.baseURL,e.url);function l(){if(!u)return;const r=ce.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new L("Request failed with status code "+n.status,[L.ERR_BAD_REQUEST,L.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),a()}),(function(e){n(e),a()}),{data:i&&"text"!==i&&"json"!==i?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:r,config:e,request:u}),u=null}if(u.open(e.method.toUpperCase(),$(c,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(n(new L("Request aborted",L.ECONNABORTED,e,u)),u=null)},u.onerror=function(){n(new L("Network Error",L.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||Q;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new L(t,r.clarifyTimeoutError?L.ETIMEDOUT:L.ECONNABORTED,e,u)),u=null},Y.isStandardBrowserEnv){const t=(e.withCredentials||ye(c))&&e.xsrfCookieName&&de.read(e.xsrfCookieName);t&&o.set(e.xsrfHeaderName,t)}void 0===r&&o.setContentType(null),"setRequestHeader"in u&&U.forEach(o.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),U.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),i&&"json"!==i&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",me(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",me(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=t=>{u&&(n(!t||t.type?new pe(null,e,u):t),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const f=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(c);f&&-1===Y.protocols.indexOf(f)?n(new L("Unsupported protocol "+f+":",L.ERR_BAD_REQUEST,e)):u.send(r||null)}))}};U.forEach(be,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));function ve(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pe(null,e)}function ge(e){return ve(e),e.headers=ce.from(e.headers),e.data=le.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),(e=>{e=U.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let o=0;o<t&&(n=e[o],!(r=U.isString(n)?be[n.toLowerCase()]:n));o++);if(!r){if(!1===r)throw new L(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(U.hasOwnProp(be,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`)}if(!U.isFunction(r))throw new TypeError("adapter is not a function");return r})(e.adapter||ne.adapter)(e).then((function(t){return ve(e),t.data=le.call(e,e.transformResponse,t),t.headers=ce.from(t.headers),t}),(function(t){return fe(t)||(ve(e),t&&t.response&&(t.response.data=le.call(e,e.transformResponse,t.response),t.response.headers=ce.from(t.response.headers))),Promise.reject(t)}))}const we=e=>e instanceof ce?e.toJSON():e;function Ee(e,t){t=t||{};const n={};function r(e,t,n){return U.isPlainObject(e)&&U.isPlainObject(t)?U.merge.call({caseless:n},e,t):U.isPlainObject(t)?U.merge({},t):U.isArray(t)?t.slice():t}function o(e,t,n){return U.isUndefined(t)?U.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!U.isUndefined(t))return r(void 0,t)}function s(e,t){return U.isUndefined(t)?U.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const u={url:i,method:i,data:i,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:(e,t)=>o(we(e),we(t),!0)};return U.forEach(Object.keys(e).concat(Object.keys(t)),(function(r){const i=u[r]||o,s=i(e[r],t[r],r);U.isUndefined(s)&&i!==a||(n[r]=s)})),n}const Oe={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Oe[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const _e={};Oe.transitional=function(e,t,n){function r(e,t){return"[Axios v1.3.6] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new L(r(o," has been removed"+(t?" in "+t:"")),L.ERR_DEPRECATED);return t&&!_e[o]&&(_e[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var Se={assertOptions:function(e,t,n){if("object"!=typeof e)throw new L("options must be an object",L.ERR_