UNPKG

@bearer/js

Version:

A JavaScript library for working with Bearer integrations

15 lines (13 loc) 79.7 kB
/*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};var t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n((function(t){t(e.value)})).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}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,s])}}}function o(e,t,n){var r,o,i,a,s;function c(){var u=Date.now()-a;u<t&&u>=0?r=setTimeout(c,t-u):(r=null,n||(s=e.apply(i,o),i=o=null))}null==t&&(t=100);var u=function(){i=this,o=arguments,a=Date.now();var u=n&&!r;return r||(r=setTimeout(c,t)),u&&(s=e.apply(i,o),i=o=null),s};return u.clear=function(){r&&(clearTimeout(r),r=null)},u.flush=function(){r&&(s=e.apply(i,o),i=o=null,clearTimeout(r),r=null)},u}o.debounce=o;var i=o,a="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(e,t){return e(t={exports:{}},t.exports),t.exports}var c,u=s((function(e,t){"undefined"!=typeof self&&self,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./src/index.js")}({"./node_modules/cross-domain-utils/src/constants.js":function(e,t,n){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));var r={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},o="*"},"./node_modules/cross-domain-utils/src/index.js":function(e,t,n){var r=n("./node_modules/cross-domain-utils/src/utils.js");n.d(t,"getActualDomain",(function(){return r.a})),n.d(t,"getAncestor",(function(){return r.b})),n.d(t,"getDomain",(function(){return r.c})),n.d(t,"getUserAgent",(function(){return r.d})),n.d(t,"isActuallySameDomain",(function(){return r.e})),n.d(t,"isAncestor",(function(){return r.f})),n.d(t,"isIframe",(function(){return r.g})),n.d(t,"isPopup",(function(){return r.h})),n.d(t,"isWindow",(function(){return r.i})),n.d(t,"isWindowClosed",(function(){return r.j})),n.d(t,"matchDomain",(function(){return r.k})),n.d(t,"stringifyDomainPattern",(function(){return r.l}));var o=n("./node_modules/cross-domain-utils/src/types.js");n.n(o),n("./node_modules/cross-domain-utils/src/constants.js")},"./node_modules/cross-domain-utils/src/types.js":function(e,t){},"./node_modules/cross-domain-utils/src/utils.js":function(e,t,n){function r(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var o=n("./node_modules/cross-domain-utils/src/constants.js");t.a=f,t.c=d,t.e=l,t.j=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(e===window)return!1}catch(e){return!0}try{if(!e)return!0}catch(e){return!0}try{if(e.closed)return!0}catch(e){return!e||e.message!==i}if(t&&function(e){if(!l(e))return!1;try{if(e===window)return!0;if(a(e)&&u(e))return!0;if(d(window)===d(e))return!0}catch(e){}return!1}(e))try{if(e.mockclosed)return!0}catch(e){}try{if(!e.parent||!e.top)return!0}catch(e){}var n=function(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}(v,e);if(-1!==n){var r=y[n];if(r&&function(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var t=e.ownerDocument;return!(!t||!t.documentElement||t.documentElement.contains(e))}(r))return!0}return!1},t.d=function(e){return(e=e||window).navigator.mockUserAgent||e.navigator.userAgent},t.b=m,t.f=function(e,t){var n=m(t);if(n)return n===e;if(t===e)return!1;if(function(e){if(e){try{if(e.top)return e.top}catch(e){}if(s(e)===e)return e;try{if(h(window,e)&&window.top)return window.top}catch(e){}try{if(h(e,window)&&window.top)return window.top}catch(e){}for(var t=0,n=function e(t){for(var n=[],r=0,o=p(t),i=null==o?0:o.length;r<i;r++){var a=o[r];n.push(a);for(var s=0,c=e(a),u=null==c?0:c.length;s<u;s++){var f=c[s];n.push(f)}}return n}(e),r=null==n?0:n.length;t<r;t++){var o=n[t];try{if(o.top)return o.top}catch(e){}if(s(o)===o)return o}}}(t)===t)return!1;for(var r=0,o=p(e),i=null==o?0:o.length;r<i;r++)if(o[r]===t)return!0;return!1},t.h=function(){return Boolean(c(window))},t.g=function(){return Boolean(s(window))},t.k=function e(t,n){if("string"==typeof t){if("string"==typeof n)return t===o.b||n===t;if(r(n))return!1;if(Array.isArray(n))return!1}return r(t)?r(n)?t.toString()===n.toString():!Array.isArray(n)&&Boolean(n.match(t)):!!Array.isArray(t)&&(Array.isArray(n)?JSON.stringify(t)===JSON.stringify(n):!r(n)&&t.some((function(t){return e(t,n)})))},t.l=function(e){return Array.isArray(e)?"("+e.join(" | ")+")":r(e)?"RegExp("+e.toString():e.toString()},t.i=function(e){try{if(e===window)return!0}catch(e){if(e&&e.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(e))return!0}catch(e){if(e&&e.message===i)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.self===e)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.parent===e)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.top===e)return!0}catch(e){if(e&&e.message===i)return!0}try{e&&e.__cross_domain_utils_window_check__}catch(e){return!0}return!1};var i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===o.a.ABOUT}function s(e){if(e)try{if(e.parent&&e.parent!==e)return e.parent}catch(e){}}function c(e){if(e&&!s(e))try{return e.opener}catch(e){}}function u(e){try{return e&&e.location&&e.location.href,!0}catch(e){}return!1}function f(e){var t=(e=e||window).location;if(!t)throw new Error("Can not read window location");var n=t.protocol;if(!n)throw new Error("Can not read window protocol");if(n===o.a.FILE)return o.a.FILE+"//";if(n===o.a.ABOUT){var r=s(e);return r&&u(r)?f(r):o.a.ABOUT+"//"}var i=t.host;if(!i)throw new Error("Can not read window host");return n+"//"+i}function d(e){var t=f(e=e||window);return t&&e.mockDomain&&0===e.mockDomain.indexOf(o.a.MOCK)?e.mockDomain:t}function l(e){try{if(e===window)return!0}catch(e){}try{var t=Object.getOwnPropertyDescriptor(e,"location");if(t&&!1===t.enumerable)return!1}catch(e){}try{if(a(e)&&u(e))return!0}catch(e){}try{if(f(e)===f(window))return!0}catch(e){}return!1}function h(e,t){if(!e||!t)return!1;var n=s(t);return n?n===e:-1!==function(e){var t=[];try{for(;e.parent!==e;)t.push(e.parent),e=e.parent}catch(e){}return t}(t).indexOf(e)}function p(e){var t=[],n=void 0;try{n=e.frames}catch(t){n=e}var r=void 0;try{r=n.length}catch(e){}if(0===r)return t;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=n[o]}catch(e){continue}t.push(i)}return t}for(var a=0;a<100;a++){var s=void 0;try{s=n[a]}catch(e){return t}if(!s)return t;t.push(s)}return t}var v=[],y=[];function m(e){return c(e=e||window)||s(e)||void 0}},"./src/index.js":function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),n.d({},"WeakMap",(function(){return u}));var r={};n.d(r,"cleanUpWindow",(function(){return ne})),n.d(r,"Promise",(function(){return E})),n.d(r,"bridge",(function(){return re})),n.d(r,"init",(function(){return oe})),n.d(r,"parent",(function(){return te})),n.d(r,"send",(function(){return J})),n.d(r,"request",(function(){return H})),n.d(r,"sendToParent",(function(){return $})),n.d(r,"client",(function(){return Y})),n.d(r,"on",(function(){return X})),n.d(r,"listen",(function(){return Z})),n.d(r,"once",(function(){return Q})),n.d(r,"listener",(function(){return V})),n.d(r,"CONFIG",(function(){return l})),n.d(r,"CONSTANTS",(function(){return f})),n.d(r,"disable",(function(){return ee}));var o=n("./node_modules/cross-domain-utils/src/index.js");function i(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}var a,s=Object.defineProperty,c=Date.now()%1e9,u=function(){function e(){if(function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),c+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+c,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var e=new WeakMap,t={};return Object.freeze(t),e.set(t,"__testvalue__"),"__testvalue__"===e.get(t)}catch(e){return!1}}())try{this.weakmap=new WeakMap}catch(e){}this.keys=[],this.values=[]}return e.prototype._cleanupClosedWindows=function(){for(var e=this.weakmap,t=this.keys,n=0;n<t.length;n++){var r=t[n];if(Object(o.isWindow)(r)&&Object(o.isWindowClosed)(r)){if(e)try{e.delete(r)}catch(e){}t.splice(n,1),this.values.splice(n,1),n-=1}}},e.prototype.isSafeToReadWrite=function(e){if(Object(o.isWindow)(e))return!1;try{e&&e.self,e&&e[this.name]}catch(e){return!1}return!0},e.prototype.set=function(e,t){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.set(e,t)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var r=this.name,o=e[r];o&&o[0]===e?o[1]=t:s(e,r,{value:[e,t],writable:!0})}else{this._cleanupClosedWindows();var a=this.keys,c=this.values,u=i(a,e);-1===u?(a.push(e),c.push(t)):c[u]=t}},e.prototype.get=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return t.get(e)}catch(e){delete this.weakmap}if(!this.isSafeToReadWrite(e)){this._cleanupClosedWindows();var n=i(this.keys,e);if(-1===n)return;return this.values[n]}var r=e[this.name];if(r&&r[0]===e)return r[1]},e.prototype.delete=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.delete(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var n=e[this.name];n&&n[0]===e&&(n[0]=n[1]=void 0)}else{this._cleanupClosedWindows();var r=this.keys,o=i(r,e);-1!==o&&(r.splice(o,1),this.values.splice(o,1))}},e.prototype.has=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return!0}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var n=e[this.name];return!(!n||n[0]!==e)}return this._cleanupClosedWindows(),-1!==i(this.keys,e)},e.prototype.getOrSet=function(e,t){if(this.has(e))return this.get(e);var n=t();return this.set(e,n),n},e}(),f={POST_MESSAGE_TYPE:{REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},POST_MESSAGE_ACK:{SUCCESS:"success",ERROR:"error"},POST_MESSAGE_NAMES:{METHOD:"postrobot_method",HELLO:"postrobot_ready",OPEN_TUNNEL:"postrobot_open_tunnel"},WINDOW_TYPES:{FULLPAGE:"fullpage",POPUP:"popup",IFRAME:"iframe"},WINDOW_PROPS:{POSTROBOT:"__postRobot__"},SERIALIZATION_TYPES:{METHOD:"postrobot_method",ERROR:"postrobot_error",PROMISE:"postrobot_promise",ZALGO_PROMISE:"postrobot_zalgo_promise",REGEX:"regex"},SEND_STRATEGIES:{POST_MESSAGE:"postrobot_post_message",BRIDGE:"postrobot_bridge",GLOBAL:"postrobot_global"},MOCK_PROTOCOL:"mock:",FILE_PROTOCOL:"file:",BRIDGE_NAME_PREFIX:"__postrobot_bridge__",POSTROBOT_PROXY:"__postrobot_proxy__",WILDCARD:"*"},d={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},l=(Object.keys(d).map((function(e){return d[e]})),{ALLOW_POSTMESSAGE_POPUP:!("__ALLOW_POSTMESSAGE_POPUP__"in window)||window.__ALLOW_POSTMESSAGE_POPUP__,BRIDGE_TIMEOUT:5e3,CHILD_WINDOW_TIMEOUT:5e3,ACK_TIMEOUT:-1!==window.navigator.userAgent.match(/MSIE/i)?1e4:2e3,RES_TIMEOUT:-1,ALLOWED_POST_MESSAGE_METHODS:(a={},a[f.SEND_STRATEGIES.POST_MESSAGE]=!0,a[f.SEND_STRATEGIES.BRIDGE]=!0,a[f.SEND_STRATEGIES.GLOBAL]=!0,a),ALLOW_SAME_ORIGIN:!1});0===window.location.href.indexOf(f.FILE_PROTOCOL)&&(l.ALLOW_POSTMESSAGE_POPUP=!0);var h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(t>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+Object.prototype.toString.call(e)+">";if("string"==typeof e)return e;if(e instanceof Error){var n=e&&e.stack,r=e&&e.message;if(n&&r)return-1!==n.indexOf(r)?n:r+"\n"+n;if(n)return n;if(r)return r}return"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}catch(e){return"Error while stringifying error: "+p(e,t+1)}}var v=function(e){if(!e)return e;var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}};function y(){}function m(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,(function(){return e.charAt(Math.floor(Math.random()*e.length))}))}function w(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n>=100)throw new Error("Self-referential object passed, or object contained too many layers");var r=void 0;if("object"!==(void 0===e?"undefined":h(e))||null===e||Array.isArray(e)){if(!Array.isArray(e))throw new TypeError("Invalid type: "+(void 0===e?"undefined":h(e)));r=[]}else r={};return function(e,t){Array.isArray(e)?function(e,t){for(var n=0;n<e.length;n++)t(e[n],n)}(e,t):"object"===(void 0===e?"undefined":h(e))&&null!==e&&function(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}(e,t)}(e,(function(e,o){var i=t(e,o);void 0!==i?r[o]=i:"object"===(void 0===e?"undefined":h(e))&&null!==e?r[o]=w(e,t,n+1):r[o]=e})),r}function g(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function _(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&e instanceof window.constructor)return!1;var t={}.toString;if(t){var n=t.call(e);if("[object Window]"===n||"[object global]"===n||"[object DOMWindow]"===n)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}function b(){var e=void 0;if("undefined"!=typeof window)e=window;else{if("undefined"==typeof window)throw new TypeError("Can not find global");e=window}var t=e.__zalgopromise__=e.__zalgopromise__||{};return t.flushPromises=t.flushPromises||[],t.activeCount=t.activeCount||0,t.possiblyUnhandledPromiseHandlers=t.possiblyUnhandledPromiseHandlers||[],t.dispatchedErrors=t.dispatchedErrors||[],t}var E=function(){function e(t){var n=this;if(function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],t){var r=void 0,o=void 0,i=!1,a=!1,s=!1;try{t((function(e){s?n.resolve(e):(i=!0,r=e)}),(function(e){s?n.reject(e):(a=!0,o=e)}))}catch(e){return void this.reject(e)}s=!0,i?this.resolve(r):a&&this.reject(o)}}return e.prototype.resolve=function(e){if(this.resolved||this.rejected)return this;if(_(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},e.prototype.reject=function(e){var t=this;if(this.resolved||this.rejected)return this;if(_(e))throw new Error("Can not reject promise with another promise");if(!e){var n=e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e);e=new Error("Expected reject to be called with Error, got "+n)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout((function(){t.errorHandled||function(e,t){if(-1===b().dispatchedErrors.indexOf(e)){b().dispatchedErrors.push(e),setTimeout((function(){throw e}),1);for(var n=0;n<b().possiblyUnhandledPromiseHandlers.length;n++)b().possiblyUnhandledPromiseHandlers[n](e,t)}}(e,t)}),1),this.dispatch(),this},e.prototype.asyncReject=function(e){return this.errorHandled=!0,this.reject(e),this},e.prototype.dispatch=function(){var t=this,n=this.dispatching,r=this.resolved,o=this.rejected,i=this.handlers;if(!n&&(r||o)){this.dispatching=!0,b().activeCount+=1;for(var a=function(n){var a=i[n],s=a.onSuccess,c=a.onError,u=a.promise,f=void 0;if(r)try{f=s?s(t.value):t.value}catch(e){return u.reject(e),"continue"}else if(o){if(!c)return u.reject(t.error),"continue";try{f=c(t.error)}catch(e){return u.reject(e),"continue"}}f instanceof e&&(f.resolved||f.rejected)?(f.resolved?u.resolve(f.value):u.reject(f.error),f.errorHandled=!0):_(f)?f instanceof e&&(f.resolved||f.rejected)?f.resolved?u.resolve(f.value):u.reject(f.error):f.then((function(e){u.resolve(e)}),(function(e){u.reject(e)})):u.resolve(f)},s=0;s<i.length;s++)a(s);i.length=0,this.dispatching=!1,b().activeCount-=1,0===b().activeCount&&e.flushQueue()}},e.prototype.then=function(t,n){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for success handler");if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for error handler");var r=new e;return this.handlers.push({promise:r,onSuccess:t,onError:n}),this.errorHandled=!0,this.dispatch(),r},e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.finally=function(t){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.finally expected a function");return this.then((function(n){return e.try(t).then((function(){return n}))}),(function(n){return e.try(t).then((function(){throw n}))}))},e.prototype.timeout=function(e,t){var n=this;if(this.resolved||this.rejected)return this;var r=setTimeout((function(){n.resolved||n.rejected||n.reject(t||new Error("Promise timed out after "+e+"ms"))}),e);return this.then((function(e){return clearTimeout(r),e}))},e.prototype.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.resolve=function(t){return t instanceof e?t:_(t)?new e((function(e,n){return t.then(e,n)})):(new e).resolve(t)},e.reject=function(t){return(new e).reject(t)},e.asyncReject=function(t){return(new e).asyncReject(t)},e.all=function(t){var n=new e,r=t.length,o=[];if(!r)return n.resolve(o),n;for(var i=function(i){var a=t[i];if(a instanceof e){if(a.resolved)return o[i]=a.value,r-=1,"continue"}else if(!_(a))return o[i]=a,r-=1,"continue";e.resolve(a).then((function(e){o[i]=e,0==(r-=1)&&n.resolve(o)}),(function(e){n.reject(e)}))},a=0;a<t.length;a++)i(a);return 0===r&&n.resolve(o),n},e.hash=function(t){var n={};return e.all(Object.keys(t).map((function(r){return e.resolve(t[r]).then((function(e){n[r]=e}))}))).then((function(){return n}))},e.map=function(t,n){return e.all(t.map(n))},e.onPossiblyUnhandledException=function(e){return function(e){return b().possiblyUnhandledPromiseHandlers.push(e),{cancel:function(){b().possiblyUnhandledPromiseHandlers.splice(b().possiblyUnhandledPromiseHandlers.indexOf(e),1)}}}(e)},e.try=function(t,n,r){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=t.apply(n,r||[])}catch(t){return e.reject(t)}return e.resolve(o)},e.delay=function(t){return new e((function(e){setTimeout(e,t)}))},e.isPromise=function(t){return!!(t&&t instanceof e)||_(t)},e.flush=function(){var t=new e;return b().flushPromises.push(t),0===b().activeCount&&e.flushQueue(),t},e.flushQueue=function(){var e=b().flushPromises;b().flushPromises=[];for(var t=0,n=null==e?0:e.length;t<n;t++)e[t].resolve()},e}(),O=window[f.WINDOW_PROPS.POSTROBOT]=window[f.WINDOW_PROPS.POSTROBOT]||{};O.registerSelf=function(){};var S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};O.methods=O.methods||new u;var C=v((function(){O.on(f.POST_MESSAGE_NAMES.METHOD,{origin:f.WILDCARD},(function(e){var t=e.source,n=e.origin,r=e.data,i=O.methods.get(t);if(!i)throw new Error("Could not find any methods this window has privileges to call");var a=i[r.id];if(!a)throw new Error("Could not find method with id: "+r.id);if(!Object(o.matchDomain)(a.domain,n))throw new Error("Method domain "+a.domain+" does not match origin "+n);return E.try((function(){return a.method.apply({source:t,origin:n,data:r},r.args)})).then((function(e){return{result:e,id:r.id,name:r.name}}))}))}));function j(e,t){return"object"===(void 0===e?"undefined":S(e))&&null!==e&&e.__type__===t}function A(e,t,n,r){var o=m(),i=O.methods.get(e);return i||(i={},O.methods.set(e,i)),i[o]={domain:t,method:n},{__type__:f.SERIALIZATION_TYPES.METHOD,__id__:o,__name__:r}}function P(e,t,n){function r(){var r=Array.prototype.slice.call(arguments);return O.send(e,f.POST_MESSAGE_NAMES.METHOD,{id:n.__id__,name:n.__name__,args:r},{domain:t,timeout:-1}).then((function(e){return e.data.result}),(function(e){throw e}))}return r.__name__=n.__name__,r.__xdomain__=!0,r.source=e,r.origin=t,r}function T(e,t,n){return new E((function(r,o){return P(e,t,n.__then__)(r,o)}))}function I(e){return O.send(e,f.POST_MESSAGE_NAMES.HELLO,{},{domain:f.WILDCARD,timeout:-1}).then((function(e){return{origin:e.origin}}))}O.readyPromises=O.readyPromises||new u;var R={};R[f.SEND_STRATEGIES.POST_MESSAGE]=function(e,t,n){(Array.isArray(n)?n:"string"==typeof n?[n]:[f.WILDCARD]).map((function(t){if(0===t.indexOf(f.MOCK_PROTOCOL)){if(window.location.protocol===f.FILE_PROTOCOL)return f.WILDCARD;if(!Object(o.isActuallySameDomain)(e))throw new Error("Attempting to send messsage to mock domain "+t+", but window is actually cross-domain");return Object(o.getActualDomain)(e)}return 0===t.indexOf(f.FILE_PROTOCOL)?f.WILDCARD:t})).forEach((function(n){return e.postMessage(t,n)}))};var x=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function L(e,t,n){return E.try((function(){var r;if(t=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=m(),i=Object(o.isPopup)()?f.WINDOW_TYPES.POPUP:Object(o.isIframe)()?f.WINDOW_TYPES.IFRAME:f.WINDOW_TYPES.FULLPAGE,a=Object(o.getDomain)(window);return x({},t,n,{sourceDomain:a,id:t.id||r,windowType:i})}(e,t,{data:function(e,n,r){return w({obj:t.data},(function(t,r){return"function"==typeof t?A(e,n,t,r.toString()):t instanceof Error?(o=t,{__type__:f.SERIALIZATION_TYPES.ERROR,__message__:p(o),__code__:o.code}):window.Promise&&t instanceof window.Promise?function(e,t,n,r){return{__type__:f.SERIALIZATION_TYPES.PROMISE,__then__:A(e,t,(function(e,t){return n.then(e,t)}),r+".then")}}(e,n,t,r.toString()):E.isPromise(t)?function(e,t,n,r){return{__type__:f.SERIALIZATION_TYPES.ZALGO_PROMISE,__then__:A(e,t,(function(e,t){return n.then(e,t)}),r+".then")}}(e,n,t,r.toString()):g(t)?(i=t,{__type__:f.SERIALIZATION_TYPES.REGEX,__source__:i.source}):void 0;var o,i})).obj}(e,n),domain:n}),e===window&&!l.ALLOW_SAME_ORIGIN)throw new Error("Attemping to send message to self");if(Object(o.isWindowClosed)(e))throw new Error("Window is closed");var i=[],a=function(e,t,n){var r=void 0,o=void 0;try{if("{}"!==JSON.stringify({})&&(r=Object.prototype.toJSON,delete Object.prototype.toJSON),"{}"!==JSON.stringify({}))throw new Error("Can not correctly serialize JSON objects");if("[]"!==JSON.stringify([])&&(o=Array.prototype.toJSON,delete Array.prototype.toJSON),"[]"!==JSON.stringify([]))throw new Error("Can not correctly serialize JSON objects")}catch(e){throw new Error("Can not repair JSON.stringify: "+e.message)}var i=JSON.stringify.call(this,e,null,2);try{r&&(Object.prototype.toJSON=r),o&&(Array.prototype.toJSON=o)}catch(e){throw new Error("Can not repair JSON.stringify: "+e.message)}return i}(((r={})[f.WINDOW_PROPS.POSTROBOT]=t,r));return E.map(Object.keys(R),(function(t){return E.try((function(){if(!l.ALLOWED_POST_MESSAGE_METHODS[t])throw new Error("Strategy disallowed: "+t);return R[t](e,a,n)})).then((function(){return i.push(t+": success"),!0}),(function(e){return i.push(t+": "+p(e)+"\n"),!1}))})).then((function(e){var n=e.some(Boolean),r=t.type+" "+t.name+" "+(n?"success":"error")+":\n - "+i.join("\n - ")+"\n";if(!n)throw new Error(r)}))}))}O.responseListeners=O.responseListeners||{},O.requestListeners=O.requestListeners||{},O.WINDOW_WILDCARD=O.WINDOW_WILDCARD||new function(){},O.erroredResponseListeners=O.erroredResponseListeners||{};var D,N="__domain_regex__";function M(e){return O.responseListeners[e]}function W(e){delete O.responseListeners[e]}function F(e){return Boolean(O.erroredResponseListeners[e])}function k(e){var t=e.name,n=e.win,r=e.domain;if(n===f.WILDCARD&&(n=null),r===f.WILDCARD&&(r=null),!t)throw new Error("Name required to get request listener");var i=O.requestListeners[t];if(i)for(var a=0,s=[n,O.WINDOW_WILDCARD],c=null==s?0:s.length;a<c;a++){var u=s[a],d=u&&i.get(u);if(d){if(r&&"string"==typeof r){if(d[r])return d[r];if(d[N])for(var l=0,h=d[N],p=null==h?0:h.length;l<p;l++){var v=h[l],y=v.regex,m=v.listener;if(Object(o.matchDomain)(y,r))return m}}if(d[f.WILDCARD])return d[f.WILDCARD]}}}var U=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B=((D={})[f.POST_MESSAGE_TYPE.ACK]=function(e,t,n){if(!F(n.hash)){var r=M(n.hash);if(!r)throw new Error("No handler found for post message ack for message: "+n.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(o.matchDomain)(r.domain,t))throw new Error("Ack origin "+t+" does not match domain "+r.domain.toString());r.ack=!0}},D[f.POST_MESSAGE_TYPE.REQUEST]=function(e,t,n){var r=k({name:n.name,win:e,domain:t});function i(r){return n.fireAndForget||Object(o.isWindowClosed)(e)?E.resolve():L(e,U({target:n.originalSource,hash:n.hash,name:n.name},r),t)}return E.all([i({type:f.POST_MESSAGE_TYPE.ACK}),E.try((function(){if(!r)throw new Error("No handler found for post message: "+n.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(o.matchDomain)(r.domain,t))throw new Error("Request origin "+t+" does not match domain "+r.domain.toString());var i=n.data;return r.handler({source:e,origin:t,data:i})})).then((function(e){return i({type:f.POST_MESSAGE_TYPE.RESPONSE,ack:f.POST_MESSAGE_ACK.SUCCESS,data:e})}),(function(e){var t=p(e).replace(/^Error: /,""),n=e.code;return i({type:f.POST_MESSAGE_TYPE.RESPONSE,ack:f.POST_MESSAGE_ACK.ERROR,error:t,code:n})}))]).then(y).catch((function(e){if(r&&r.handleError)return r.handleError(e);throw e}))},D[f.POST_MESSAGE_TYPE.RESPONSE]=function(e,t,n){if(!F(n.hash)){var r=M(n.hash);if(!r)throw new Error("No handler found for post message response for message: "+n.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(o.matchDomain)(r.domain,t))throw new Error("Response origin "+t+" does not match domain "+Object(o.stringifyDomainPattern)(r.domain));if(W(n.hash),n.ack===f.POST_MESSAGE_ACK.ERROR){var i=new Error(n.error);return n.code&&(i.code=n.code),r.respond(i,null)}if(n.ack===f.POST_MESSAGE_ACK.SUCCESS){var a=n.data||n.response;return r.respond(null,{source:e,origin:t,data:a})}}},D),q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function G(e){if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!e.source)return}catch(e){return}var t=e.source,n=e.origin,r=function(e){var t,n=void 0;try{t=e,n=JSON.parse(t)}catch(e){return}if(n&&"object"===(void 0===n?"undefined":q(n))&&null!==n&&(n=n[f.WINDOW_PROPS.POSTROBOT])&&"object"===(void 0===n?"undefined":q(n))&&null!==n&&n.type&&"string"==typeof n.type&&B[n.type])return n}(e.data);if(r){if(!r.sourceDomain||"string"!=typeof r.sourceDomain)throw new Error("Expected message to have sourceDomain");0!==r.sourceDomain.indexOf(f.MOCK_PROTOCOL)&&0!==r.sourceDomain.indexOf(f.FILE_PROTOCOL)||(n=r.sourceDomain),-1===O.receivedMessages.indexOf(r.id)&&(O.receivedMessages.push(r.id),Object(o.isWindowClosed)(t)&&!r.fireAndForget||(r.data&&(r.data=function(e,t,n){return w({obj:r.data},(function(n){if("object"===(void 0===n?"undefined":S(n))&&null!==n)return j(n,f.SERIALIZATION_TYPES.METHOD)?P(e,t,n):j(n,f.SERIALIZATION_TYPES.ERROR)?function(e,t,n){var r=new Error(n.__message__);return n.__code__&&(r.code=n.__code__),r}(0,0,n):j(n,f.SERIALIZATION_TYPES.PROMISE)?function(e,t,n){return window.Promise?new window.Promise((function(r,o){return P(e,t,n.__then__)(r,o)})):T(e,t,n)}(e,t,n):j(n,f.SERIALIZATION_TYPES.ZALGO_PROMISE)?T(e,t,n):j(n,f.SERIALIZATION_TYPES.REGEX)?function(e,t,n){return new RegExp(n.__source__)}(0,0,n):void 0})).obj}(t,n)),B[r.type](t,n,r)))}}function z(e){try{e.source}catch(e){return}G({source:e.source||e.sourceElement,origin:e.origin||e.originalEvent&&e.originalEvent.origin,data:e.data})}function H(e){return E.try((function(){if(!e.name)throw new Error("Expected options.name");var t=e.name,n=void 0,r=void 0;if("string"==typeof e.window){var i=document.getElementById(e.window);if(!i)throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be a valid element id");if("iframe"!==i.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be an iframe");if(!i.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");n=i.contentWindow}else if(e.window instanceof HTMLIFrameElement){if("iframe"!==e.window.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be an iframe");if(e.window&&!e.window.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");e.window&&e.window.contentWindow&&(n=e.window.contentWindow)}else n=e.window;if(!n)throw new Error("Expected options.window to be a window object, iframe, or iframe element id.");var a=n;r=e.domain||f.WILDCARD;var s=e.name+"_"+m();if(Object(o.isWindowClosed)(a))throw new Error("Target window is closed");var c=!1,u=O.requestPromises.get(a);u||(u=[],O.requestPromises.set(a,u));var d=E.try((function(){if(Object(o.isAncestor)(window,a))return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Window",r=O.readyPromises.get(e);return r||(r=new E,O.readyPromises.set(e,r),-1!==t&&setTimeout((function(){return r.reject(new Error(n+" did not load after "+t+"ms"))}),t),r)}(a,e.timeout||l.CHILD_WINDOW_TIMEOUT)})).then((function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(g(r)&&!e)return I(a)})).then((function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(g(r)){if(!Object(o.matchDomain)(r,n))throw new Error("Remote window domain "+n+" does not match regex: "+r.toString());r=n}if("string"!=typeof r&&!Array.isArray(r))throw new TypeError("Expected domain to be a string or array");var i=r;return new E((function(n,r){var h=void 0;if(e.fireAndForget||function(e,t){O.responseListeners[e]=t}(s,h={name:t,window:a,domain:i,respond:function(e,t){e||(c=!0,u.splice(u.indexOf(d,1))),e?r(e):n(t)}}),L(a,{type:f.POST_MESSAGE_TYPE.REQUEST,hash:s,name:t,data:e.data,fireAndForget:e.fireAndForget},i).catch(r),e.fireAndForget)return n();var p=l.ACK_TIMEOUT,v=e.timeout||l.RES_TIMEOUT,y=100;setTimeout((function n(){if(!c){if(Object(o.isWindowClosed)(a))return h.ack?r(new Error("Window closed for "+t+" before response")):r(new Error("Window closed for "+t+" before ack"));if(p=Math.max(p-y,0),-1!==v&&(v=Math.max(v-y,0)),h.ack){if(-1===v)return;y=Math.min(v,2e3)}else{if(0===p)return r(new Error("No ack for postMessage "+t+" in "+Object(o.getDomain)()+" in "+l.ACK_TIMEOUT+"ms"));if(0===v)return r(new Error("No response for postMessage "+t+" in "+Object(o.getDomain)()+" in "+(e.timeout||l.RES_TIMEOUT)+"ms"))}setTimeout(n,y)}}),y)}))}));return d.catch((function(){!function(e){O.erroredResponseListeners[e]=!0}(s),W(s)})),u.push(d),d}))}function J(e,t,n,r){return(r=r||{}).window=e,r.name=t,r.data=n,H(r)}function $(e,t,n){var r=Object(o.getAncestor)();return r?J(r,e,t,n):new E((function(e,t){return t(new Error("Window does not have a parent"))}))}function Y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.window)throw new Error("Expected options.window");var t=e.window;return{send:function(n,r){return J(t,n,r,e)}}}O.receivedMessages=O.receivedMessages||[],O.receiveMessage=G,O.requestPromises=O.requestPromises||new u,O.send=J;var K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function Z(e){if(!e.name)throw new Error("Expected options.name");if(!e.handler)throw new Error("Expected options.handler");var t,n=e.name,r=e.window,i=e.domain,a={handler:e.handler,handleError:e.errorHandler||function(e){throw e},window:r,domain:i||f.WILDCARD,name:n},s=function e(t,n){var r=t.name,o=t.win,i=t.domain;if(!r||"string"!=typeof r)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var a=[],s=0,c=o,d=null==c?0:c.length;s<d;s++){var l=c[s];a.push(e({name:r,domain:i,win:l},n))}return{cancel:function(){for(var e=0,t=null==a?0:a.length;e<t;e++)a[e].cancel()}}}if(Array.isArray(i)){for(var h=[],p=0,v=i,y=null==v?0:v.length;p<y;p++){var m=v[p];h.push(e({name:r,win:o,domain:m},n))}return{cancel:function(){for(var e=0,t=null==h?0:h.length;e<t;e++)h[e].cancel()}}}var w=k({name:r,win:o,domain:i});if(o&&o!==f.WILDCARD||(o=O.WINDOW_WILDCARD),i=i||f.WILDCARD,w)throw o&&i?new Error("Request listener already exists for "+r+" on domain "+i.toString()+" for "+(o===O.WINDOW_WILDCARD?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+r+" for "+(o===O.WINDOW_WILDCARD?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+r+" on domain "+i.toString()):new Error("Request listener already exists for "+r);var _=O.requestListeners,b=_[r];b||(b=new u,_[r]=b);var E=b.get(o);E||(E={},b.set(o,E));var S=i.toString(),C=E[N],j=void 0;return g(i)?(C||(C=[],E[N]=C),j={regex:i,listener:n},C.push(j)):E[S]=n,{cancel:function(){E&&(delete E[S],o&&0===Object.keys(E).length&&b.delete(o),j&&C.splice(C.indexOf(j,1)))}}}({name:n,win:r,domain:i},a);if(e.once){var c=a.handler;a.handler=v((function(){return s.cancel(),c.apply(this,arguments)}))}if(a.window&&e.errorOnClose)var d=(t=void 0,t=setTimeout((function e(){t=setTimeout(e,50),function(){r&&"object"===(void 0===r?"undefined":K(r))&&Object(o.isWindowClosed)(r)&&(d.cancel(),a.handleError(new Error("Post message target window is closed")))}.call()}),50),{cancel:function(){clearTimeout(t)}});return{cancel:function(){s.cancel()}}}function X(e,t,n){return"function"==typeof t&&(n=t,t={}),(t=t||{}).name=e,t.handler=n||t.handler,Z(t)}function Q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];"function"==typeof t&&(n=t,t={}),t=t||{},n=n||t.handler;var r=t.errorHandler,o=new E((function(o,i){(t=t||{}).name=e,t.once=!0,t.handler=function(e){if(o(e),n)return n(e)},t.errorHandler=function(e){if(i(e),r)return r(e)}})),i=Z(t);return o.cancel=i.cancel,o}function V(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{on:function(t,n){return X(t,e,n)}}}function ee(){delete window[f.WINDOW_PROPS.POSTROBOT],window.removeEventListener("message",z)}O.on=X;var te=Object(o.getAncestor)();function ne(e){var t=O.requestPromises.get(e);if(t)for(var n=0,r=null==t?0:t.length;n<r;n++)t[n].reject(new Error("No response from window - cleaned up"));O.popupWindowsByWin&&O.popupWindowsByWin.delete(e),O.remoteWindows&&O.remoteWindows.delete(e),O.requestPromises.delete(e),O.methods.delete(e),O.readyPromises.delete(e)}var re=null;function oe(){var e,t;O.initialized||(t=z,(e=window).addEventListener?e.addEventListener("message",t):e.attachEvent("onmessage",t),function(){e=function(e){var t=e.source,n=e.origin,r=O.readyPromises.get(t)||new E;r.resolve({origin:n}),O.readyPromises.set(t,r)},O.on(f.POST_MESSAGE_NAMES.HELLO,{domain:f.WILDCARD},(function(t){var n=t.source,r=t.origin;return e({source:n,origin:r})}));var e,t=Object(o.getAncestor)();t&&I(t).catch(y)}(),C({on:X,send:J})),O.initialized=!0}oe(),n.d(t,"cleanUpWindow",(function(){return ne})),n.d(t,"Promise",(function(){return E})),n.d(t,"bridge",(function(){return re})),n.d(t,"init",(function(){return oe})),n.d(t,"parent",(function(){return te})),n.d(t,"send",(function(){return J})),n.d(t,"request",(function(){return H})),n.d(t,"sendToParent",(function(){return $})),n.d(t,"client",(function(){return Y})),n.d(t,"on",(function(){return X})),n.d(t,"listen",(function(){return Z})),n.d(t,"once",(function(){return Q})),n.d(t,"listener",(function(){return V})),n.d(t,"CONFIG",(function(){return l})),n.d(t,"CONSTANTS",(function(){return f})),n.d(t,"disable",(function(){return ee})),t.default=r}})}));(c=u)&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")&&c.default;u.postRobot;var f=s((function(e){e.exports=u,e.exports.default=e.exports})),d=s((function(e,t){e.exports=function(){var e=1e3,t=6e4,n=36e5,r=24*n,o=function(o,a){a=a||{};var s=typeof o;if("string"===s&&o.length>0)return function(o){if(!((o=String(o)).length>100)){var i=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(i){var a=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return a*r;case"hours":case"hour":case"hrs":case"hr":case"h":return a*n;case"minutes":case"minute":case"mins":case"min":case"m":return a*t;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(o);if("number"===s&&!1===isNaN(o))return a.long?function(o){var a=Math.abs(o);return a>=r?i(o,a,r,"day"):a>=n?i(o,a,n,"hour"):a>=t?i(o,a,t,"minute"):a>=e?i(o,a,e,"second"):o+" ms"}(o):function(o){var i=Math.abs(o);return i>=r?Math.round(o/r)+"d":i>=n?Math.round(o/n)+"h":i>=t?Math.round(o/t)+"m":i>=e?Math.round(o/e)+"s":o+"ms"}(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))};function i(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}var a,s=(function(e,t){t.log=function(...e){return"object"==typeof console&&console.log&&console.log(...e)},t.formatArgs=function(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 n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(o=r))}),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){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+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=function(e){function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}function n(e){let o;function a(...e){if(!a.enabled)return;const t=a,r=Number(new Date),i=r-(o||r);t.diff=i,t.prev=o,t.curr=r,o=r,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,o)=>{if("%%"===r)return r;s++;const i=n.formatters[o];if("function"==typeof i){const n=e[s];r=i.call(t,n),e.splice(s,1),s--}return r}),n.formatArgs.call(t,e),(t.log||n.log).apply(t,e)}return a.namespace=e,a.enabled=n.enabled(e),a.useColors=n.useColors(),a.color=t(e),a.destroy=r,a.extend=i,"function"==typeof n.init&&n.init(a),n.instances.push(a),a}function r(){const e=n.instances.indexOf(this);return-1!==e&&(n.instances.splice(e,1),!0)}function i(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function a(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){return e instanceof Error?e.stack||e.message:e},n.disable=function(){const e=[...n.names.map(a),...n.skips.map(a).map(e=>"-"+e)].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(t=0;t<o;t++)r[t]&&("-"===(e=r[t].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")));for(t=0;t<n.instances.length;t++){const e=n.instances[t];e.enabled=n.enabled(e.namespace)}},n.enabled=function(e){if("*"===e[e.length-1])return!0;let t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1},n.humanize=o,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=t,n.enable(n.load()),n}(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(a={exports:{}},a.exports),a.exports);return s.log,s.formatArgs,s.save,s.load,s.useColors,s.storage,s.colors,e=>s(`bearer:${e}`)}()}))("js");function l(e){return Object.keys(e).reduce((function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t}),{})}var h=function(){var e=this;this.events={},this.on=function(t,n){"object"!=typeof e.events[t]&&(e.events[t]=[]),e.events[t].push(n)},this.clearListeners=function(t){e.events[t]=[]},this.removeListener=function(t,n){if(e.events[t]){var r=e.events[t].indexOf(n);r>-1&&e.events[t].splice(r,1)}},this.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(e.events[t])for(var o=e.events[t].slice(),i=o.length,a=0;a<i;a++)o[a].apply(e,n)},this.once=function(t,n){var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];e.removeListener(t,r),n.apply(e,o)};e.on(t,r)}},p=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},v=Object.prototype.toString;function y(e){return"[object Array]"===v.call(e)}function m(e){return null!==e&&"object"==typeof e}function w(e){return"[object Function]"===v.call(e)}function g(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),y(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var _={isArray:y,isArrayBuffer:function(e){return"[object ArrayBuffer]"===v.call(e)},isBuffer:function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:m,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===v.call(e)},isFile:function(e){return"[object File]"===v.call(e)},isBlob:function(e){return"[object Blob]"===v.call(e)},isFunction:w,isStream:function(e){return m(e)&&w(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:g,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,o=arguments.length;r<o;r++)g(arguments[r],n);return t},deepMerge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]="object"==typeof n?e({},n):n}for(var r=0,o=arguments.length;r<o;r++)g(arguments[r],n);return t},extend:function(e,t,n){return g(t,(function(t,r){e[r]=n&&"function"==typeof t?p(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}};function b(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var E=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(_.isURLSearchParams(t))r=t.toString();else{var o=[];_.forEach(t,(function(e,t){null!=e&&(_.isArray(e)?t+="[]":e=[e],_.forEach(e,(function(e){_.isDate(e)?e=e.toISOString():_.isObject(e)&&(e=JSON.stringify(e)),o.push(b(t)+"="+b(e))})))})),r=o.join("&")}if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e};function O(){this.handlers=[]}O.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},O.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},O.prototype.forEach=function(e){_.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var S=O,C=function(e,t,n){return _.forEach(n,(function(n){e=n(e,t)})),e},j=function(e){return!(!e||!e.__CANCEL__)},A=function(e,t){_.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},P=function(e,t,n,r,o){return function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.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:this.config,code:this.code}},e}(new Error(e),t,n,r,o)},T=["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"],I=_.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(