UNPKG

@bearer/js

Version:

A JavaScript library for working with Bearer integrations

15 lines (13 loc) 84.9 kB
"use strict"; /*! ***************************************************************************** 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 extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&(r[n[o]]=e[n[o]])}return r}function __awaiter(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new r((function(t){t(e.value)})).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function __generator(e,t){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=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++,n=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],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function debounce(e,t,r){var n,o,i,a,s;function c(){var u=Date.now()-a;u<t&&u>=0?n=setTimeout(c,t-u):(n=null,r||(s=e.apply(i,o),i=o=null))}null==t&&(t=100);var u=function(){i=this,o=arguments,a=Date.now();var u=r&&!n;return n||(n=setTimeout(c,t)),u&&(s=e.apply(i,o),i=o=null),s};return u.clear=function(){n&&(clearTimeout(n),n=null)},u.flush=function(){n&&(s=e.apply(i,o),i=o=null,clearTimeout(n),n=null)},u}debounce.debounce=debounce;var debounce_1=debounce,commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var postRobot=createCommonjsModule((function(e,t){"undefined"!=typeof self&&self,e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s="./src/index.js")}({"./node_modules/cross-domain-utils/src/constants.js":function(e,t,r){r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return o}));var n={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},o="*"},"./node_modules/cross-domain-utils/src/index.js":function(e,t,r){var n=r("./node_modules/cross-domain-utils/src/utils.js");r.d(t,"getActualDomain",(function(){return n.a})),r.d(t,"getAncestor",(function(){return n.b})),r.d(t,"getDomain",(function(){return n.c})),r.d(t,"getUserAgent",(function(){return n.d})),r.d(t,"isActuallySameDomain",(function(){return n.e})),r.d(t,"isAncestor",(function(){return n.f})),r.d(t,"isIframe",(function(){return n.g})),r.d(t,"isPopup",(function(){return n.h})),r.d(t,"isWindow",(function(){return n.i})),r.d(t,"isWindowClosed",(function(){return n.j})),r.d(t,"matchDomain",(function(){return n.k})),r.d(t,"stringifyDomainPattern",(function(){return n.l}));var o=r("./node_modules/cross-domain-utils/src/types.js");r.n(o),r("./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,r){function n(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var o=r("./node_modules/cross-domain-utils/src/constants.js");t.a=f,t.c=l,t.e=d,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(!d(e))return!1;try{if(e===window)return!0;if(a(e)&&u(e))return!0;if(l(window)===l(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 r=function(e,t){for(var r=0;r<e.length;r++)try{if(e[r]===t)return r}catch(e){}return-1}(m,e);if(-1!==r){var n=g[r];if(n&&function(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var t=e.ownerDocument;return!(!t||!t.documentElement||t.documentElement.contains(e))}(n))return!0}return!1},t.d=function(e){return(e=e||window).navigator.mockUserAgent||e.navigator.userAgent},t.b=y,t.f=function(e,t){var r=y(t);if(r)return r===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,r=function e(t){for(var r=[],n=0,o=p(t),i=null==o?0:o.length;n<i;n++){var a=o[n];r.push(a);for(var s=0,c=e(a),u=null==c?0:c.length;s<u;s++){var f=c[s];r.push(f)}}return r}(e),n=null==r?0:r.length;t<n;t++){var o=r[t];try{if(o.top)return o.top}catch(e){}if(s(o)===o)return o}}}(t)===t)return!1;for(var n=0,o=p(e),i=null==o?0:o.length;n<i;n++)if(o[n]===t)return!0;return!1},t.h=function(){return Boolean(c(window))},t.g=function(){return Boolean(s(window))},t.k=function e(t,r){if("string"==typeof t){if("string"==typeof r)return t===o.b||r===t;if(n(r))return!1;if(Array.isArray(r))return!1}return n(t)?n(r)?t.toString()===r.toString():!Array.isArray(r)&&Boolean(r.match(t)):!!Array.isArray(t)&&(Array.isArray(r)?JSON.stringify(t)===JSON.stringify(r):!n(r)&&t.some((function(t){return e(t,r)})))},t.l=function(e){return Array.isArray(e)?"("+e.join(" | ")+")":n(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 r=t.protocol;if(!r)throw new Error("Can not read window protocol");if(r===o.a.FILE)return o.a.FILE+"//";if(r===o.a.ABOUT){var n=s(e);return n&&u(n)?f(n):o.a.ABOUT+"//"}var i=t.host;if(!i)throw new Error("Can not read window host");return r+"//"+i}function l(e){var t=f(e=e||window);return t&&e.mockDomain&&0===e.mockDomain.indexOf(o.a.MOCK)?e.mockDomain:t}function d(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 r=s(t);return r?r===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=[],r=void 0;try{r=e.frames}catch(t){r=e}var n=void 0;try{n=r.length}catch(e){}if(0===n)return t;if(n){for(var o=0;o<n;o++){var i=void 0;try{i=r[o]}catch(e){continue}t.push(i)}return t}for(var a=0;a<100;a++){var s=void 0;try{s=r[a]}catch(e){return t}if(!s)return t;t.push(s)}return t}var m=[],g=[];function y(e){return c(e=e||window)||s(e)||void 0}},"./src/index.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),r.d({},"WeakMap",(function(){return u}));var n={};r.d(n,"cleanUpWindow",(function(){return re})),r.d(n,"Promise",(function(){return E})),r.d(n,"bridge",(function(){return ne})),r.d(n,"init",(function(){return oe})),r.d(n,"parent",(function(){return te})),r.d(n,"send",(function(){return $})),r.d(n,"request",(function(){return z})),r.d(n,"sendToParent",(function(){return Y})),r.d(n,"client",(function(){return K})),r.d(n,"on",(function(){return X})),r.d(n,"listen",(function(){return Z})),r.d(n,"once",(function(){return Q})),r.d(n,"listener",(function(){return V})),r.d(n,"CONFIG",(function(){return d})),r.d(n,"CONSTANTS",(function(){return f})),r.d(n,"disable",(function(){return ee}));var o=r("./node_modules/cross-domain-utils/src/index.js");function i(e,t){for(var r=0;r<e.length;r++)try{if(e[r]===t)return r}catch(e){}return-1}var a,s=Object.defineProperty,c=Date.now()%1e9,u=function(){function e(){if(function(t,r){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,r=0;r<t.length;r++){var n=t[r];if(Object(o.isWindow)(n)&&Object(o.isWindowClosed)(n)){if(e)try{e.delete(n)}catch(e){}t.splice(r,1),this.values.splice(r,1),r-=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 r=this.weakmap;if(r)try{r.set(e,t)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var n=this.name,o=e[n];o&&o[0]===e?o[1]=t:s(e,n,{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 r=i(this.keys,e);if(-1===r)return;return this.values[r]}var n=e[this.name];if(n&&n[0]===e)return n[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 r=e[this.name];r&&r[0]===e&&(r[0]=r[1]=void 0)}else{this._cleanupClosedWindows();var n=this.keys,o=i(n,e);-1!==o&&(n.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 r=e[this.name];return!(!r||r[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 r=t();return this.set(e,r),r},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:"*"},l={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},d=(Object.keys(l).map((function(e){return l[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)&&(d.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 r=e&&e.stack,n=e&&e.message;if(r&&n)return-1!==r.indexOf(n)?r:n+"\n"+r;if(r)return r;if(n)return n}return"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}catch(e){return"Error while stringifying error: "+p(e,t+1)}}var m=function(e){if(!e)return e;var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}};function g(){}function y(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,(function(){return e.charAt(Math.floor(Math.random()*e.length))}))}function v(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(r>=100)throw new Error("Self-referential object passed, or object contained too many layers");var n=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)));n=[]}else n={};return function(e,t){Array.isArray(e)?function(e,t){for(var r=0;r<e.length;r++)t(e[r],r)}(e,t):"object"===(void 0===e?"undefined":h(e))&&null!==e&&function(e,t){for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)}(e,t)}(e,(function(e,o){var i=t(e,o);void 0!==i?n[o]=i:"object"===(void 0===e?"undefined":h(e))&&null!==e?n[o]=v(e,t,r+1):n[o]=e})),n}function w(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 r=t.call(e);if("[object Window]"===r||"[object global]"===r||"[object DOMWindow]"===r)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 r=this;if(function(t,r){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 n=void 0,o=void 0,i=!1,a=!1,s=!1;try{t((function(e){s?r.resolve(e):(i=!0,n=e)}),(function(e){s?r.reject(e):(a=!0,o=e)}))}catch(e){return void this.reject(e)}s=!0,i?this.resolve(n):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 r=e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e);e=new Error("Expected reject to be called with Error, got "+r)}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 r=0;r<b().possiblyUnhandledPromiseHandlers.length;r++)b().possiblyUnhandledPromiseHandlers[r](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,r=this.dispatching,n=this.resolved,o=this.rejected,i=this.handlers;if(!r&&(n||o)){this.dispatching=!0,b().activeCount+=1;for(var a=function(r){var a=i[r],s=a.onSuccess,c=a.onError,u=a.promise,f=void 0;if(n)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,r){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for success handler");if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.then expected a function for error handler");var n=new e;return this.handlers.push({promise:n,onSuccess:t,onError:r}),this.errorHandled=!0,this.dispatch(),n},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(r){return e.try(t).then((function(){return r}))}),(function(r){return e.try(t).then((function(){throw r}))}))},e.prototype.timeout=function(e,t){var r=this;if(this.resolved||this.rejected)return this;var n=setTimeout((function(){r.resolved||r.rejected||r.reject(t||new Error("Promise timed out after "+e+"ms"))}),e);return this.then((function(e){return clearTimeout(n),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,r){return t.then(e,r)})):(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 r=new e,n=t.length,o=[];if(!n)return r.resolve(o),r;for(var i=function(i){var a=t[i];if(a instanceof e){if(a.resolved)return o[i]=a.value,n-=1,"continue"}else if(!_(a))return o[i]=a,n-=1,"continue";e.resolve(a).then((function(e){o[i]=e,0==(n-=1)&&r.resolve(o)}),(function(e){r.reject(e)}))},a=0;a<t.length;a++)i(a);return 0===n&&r.resolve(o),r},e.hash=function(t){var r={};return e.all(Object.keys(t).map((function(n){return e.resolve(t[n]).then((function(e){r[n]=e}))}))).then((function(){return r}))},e.map=function(t,r){return e.all(t.map(r))},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,r,n){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=t.apply(r,n||[])}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,r=null==e?0:e.length;t<r;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=m((function(){O.on(f.POST_MESSAGE_NAMES.METHOD,{origin:f.WILDCARD},(function(e){var t=e.source,r=e.origin,n=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[n.id];if(!a)throw new Error("Could not find method with id: "+n.id);if(!Object(o.matchDomain)(a.domain,r))throw new Error("Method domain "+a.domain+" does not match origin "+r);return E.try((function(){return a.method.apply({source:t,origin:r,data:n},n.args)})).then((function(e){return{result:e,id:n.id,name:n.name}}))}))}));function j(e,t){return"object"===(void 0===e?"undefined":S(e))&&null!==e&&e.__type__===t}function A(e,t,r,n){var o=y(),i=O.methods.get(e);return i||(i={},O.methods.set(e,i)),i[o]={domain:t,method:r},{__type__:f.SERIALIZATION_TYPES.METHOD,__id__:o,__name__:n}}function T(e,t,r){function n(){var n=Array.prototype.slice.call(arguments);return O.send(e,f.POST_MESSAGE_NAMES.METHOD,{id:r.__id__,name:r.__name__,args:n},{domain:t,timeout:-1}).then((function(e){return e.data.result}),(function(e){throw e}))}return n.__name__=r.__name__,n.__xdomain__=!0,n.source=e,n.origin=t,n}function I(e,t,r){return new E((function(n,o){return T(e,t,r.__then__)(n,o)}))}function P(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,r){(Array.isArray(r)?r:"string"==typeof r?[r]:[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(r){return e.postMessage(t,r)}))};var x=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function L(e,t,r){return E.try((function(){var n;if(t=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=y(),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,r,{sourceDomain:a,id:t.id||n,windowType:i})}(e,t,{data:function(e,r,n){return v({obj:t.data},(function(t,n){return"function"==typeof t?A(e,r,t,n.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,r,n){return{__type__:f.SERIALIZATION_TYPES.PROMISE,__then__:A(e,t,(function(e,t){return r.then(e,t)}),n+".then")}}(e,r,t,n.toString()):E.isPromise(t)?function(e,t,r,n){return{__type__:f.SERIALIZATION_TYPES.ZALGO_PROMISE,__then__:A(e,t,(function(e,t){return r.then(e,t)}),n+".then")}}(e,r,t,n.toString()):w(t)?(i=t,{__type__:f.SERIALIZATION_TYPES.REGEX,__source__:i.source}):void 0;var o,i})).obj}(e,r),domain:r}),e===window&&!d.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,r){var n=void 0,o=void 0;try{if("{}"!==JSON.stringify({})&&(n=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{n&&(Object.prototype.toJSON=n),o&&(Array.prototype.toJSON=o)}catch(e){throw new Error("Can not repair JSON.stringify: "+e.message)}return i}(((n={})[f.WINDOW_PROPS.POSTROBOT]=t,n));return E.map(Object.keys(R),(function(t){return E.try((function(){if(!d.ALLOWED_POST_MESSAGE_METHODS[t])throw new Error("Strategy disallowed: "+t);return R[t](e,a,r)})).then((function(){return i.push(t+": success"),!0}),(function(e){return i.push(t+": "+p(e)+"\n"),!1}))})).then((function(e){var r=e.some(Boolean),n=t.type+" "+t.name+" "+(r?"success":"error")+":\n - "+i.join("\n - ")+"\n";if(!r)throw new Error(n)}))}))}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 F(e){delete O.responseListeners[e]}function k(e){return Boolean(O.erroredResponseListeners[e])}function W(e){var t=e.name,r=e.win,n=e.domain;if(r===f.WILDCARD&&(r=null),n===f.WILDCARD&&(n=null),!t)throw new Error("Name required to get request listener");var i=O.requestListeners[t];if(i)for(var a=0,s=[r,O.WINDOW_WILDCARD],c=null==s?0:s.length;a<c;a++){var u=s[a],l=u&&i.get(u);if(l){if(n&&"string"==typeof n){if(l[n])return l[n];if(l[N])for(var d=0,h=l[N],p=null==h?0:h.length;d<p;d++){var m=h[d],g=m.regex,y=m.listener;if(Object(o.matchDomain)(g,n))return y}}if(l[f.WILDCARD])return l[f.WILDCARD]}}}var U=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},G=((D={})[f.POST_MESSAGE_TYPE.ACK]=function(e,t,r){if(!k(r.hash)){var n=M(r.hash);if(!n)throw new Error("No handler found for post message ack for message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(o.matchDomain)(n.domain,t))throw new Error("Ack origin "+t+" does not match domain "+n.domain.toString());n.ack=!0}},D[f.POST_MESSAGE_TYPE.REQUEST]=function(e,t,r){var n=W({name:r.name,win:e,domain:t});function i(n){return r.fireAndForget||Object(o.isWindowClosed)(e)?E.resolve():L(e,U({target:r.originalSource,hash:r.hash,name:r.name},n),t)}return E.all([i({type:f.POST_MESSAGE_TYPE.ACK}),E.try((function(){if(!n)throw new Error("No handler found for post message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(o.matchDomain)(n.domain,t))throw new Error("Request origin "+t+" does not match domain "+n.domain.toString());var i=r.data;return n.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: /,""),r=e.code;return i({type:f.POST_MESSAGE_TYPE.RESPONSE,ack:f.POST_MESSAGE_ACK.ERROR,error:t,code:r})}))]).then(g).catch((function(e){if(n&&n.handleError)return n.handleError(e);throw e}))},D[f.POST_MESSAGE_TYPE.RESPONSE]=function(e,t,r){if(!k(r.hash)){var n=M(r.hash);if(!n)throw new Error("No handler found for post message response for message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(o.matchDomain)(n.domain,t))throw new Error("Response origin "+t+" does not match domain "+Object(o.stringifyDomainPattern)(n.domain));if(F(r.hash),r.ack===f.POST_MESSAGE_ACK.ERROR){var i=new Error(r.error);return r.code&&(i.code=r.code),n.respond(i,null)}if(r.ack===f.POST_MESSAGE_ACK.SUCCESS){var a=r.data||r.response;return n.respond(null,{source:e,origin:t,data:a})}}},D),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 B(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,r=e.origin,n=function(e){var t,r=void 0;try{t=e,r=JSON.parse(t)}catch(e){return}if(r&&"object"===(void 0===r?"undefined":H(r))&&null!==r&&(r=r[f.WINDOW_PROPS.POSTROBOT])&&"object"===(void 0===r?"undefined":H(r))&&null!==r&&r.type&&"string"==typeof r.type&&G[r.type])return r}(e.data);if(n){if(!n.sourceDomain||"string"!=typeof n.sourceDomain)throw new Error("Expected message to have sourceDomain");0!==n.sourceDomain.indexOf(f.MOCK_PROTOCOL)&&0!==n.sourceDomain.indexOf(f.FILE_PROTOCOL)||(r=n.sourceDomain),-1===O.receivedMessages.indexOf(n.id)&&(O.receivedMessages.push(n.id),Object(o.isWindowClosed)(t)&&!n.fireAndForget||(n.data&&(n.data=function(e,t,r){return v({obj:n.data},(function(r){if("object"===(void 0===r?"undefined":S(r))&&null!==r)return j(r,f.SERIALIZATION_TYPES.METHOD)?T(e,t,r):j(r,f.SERIALIZATION_TYPES.ERROR)?function(e,t,r){var n=new Error(r.__message__);return r.__code__&&(n.code=r.__code__),n}(0,0,r):j(r,f.SERIALIZATION_TYPES.PROMISE)?function(e,t,r){return window.Promise?new window.Promise((function(n,o){return T(e,t,r.__then__)(n,o)})):I(e,t,r)}(e,t,r):j(r,f.SERIALIZATION_TYPES.ZALGO_PROMISE)?I(e,t,r):j(r,f.SERIALIZATION_TYPES.REGEX)?function(e,t,r){return new RegExp(r.__source__)}(0,0,r):void 0})).obj}(t,r)),G[n.type](t,r,n)))}}function q(e){try{e.source}catch(e){return}B({source:e.source||e.sourceElement,origin:e.origin||e.originalEvent&&e.originalEvent.origin,data:e.data})}function z(e){return E.try((function(){if(!e.name)throw new Error("Expected options.name");var t=e.name,r=void 0,n=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.");r=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&&(r=e.window.contentWindow)}else r=e.window;if(!r)throw new Error("Expected options.window to be a window object, iframe, or iframe element id.");var a=r;n=e.domain||f.WILDCARD;var s=e.name+"_"+y();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 l=E.try((function(){if(Object(o.isAncestor)(window,a))return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Window",n=O.readyPromises.get(e);return n||(n=new E,O.readyPromises.set(e,n),-1!==t&&setTimeout((function(){return n.reject(new Error(r+" did not load after "+t+"ms"))}),t),n)}(a,e.timeout||d.CHILD_WINDOW_TIMEOUT)})).then((function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(w(n)&&!e)return P(a)})).then((function(){var r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(w(n)){if(!Object(o.matchDomain)(n,r))throw new Error("Remote window domain "+r+" does not match regex: "+n.toString());n=r}if("string"!=typeof n&&!Array.isArray(n))throw new TypeError("Expected domain to be a string or array");var i=n;return new E((function(r,n){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(l,1))),e?n(e):r(t)}}),L(a,{type:f.POST_MESSAGE_TYPE.REQUEST,hash:s,name:t,data:e.data,fireAndForget:e.fireAndForget},i).catch(n),e.fireAndForget)return r();var p=d.ACK_TIMEOUT,m=e.timeout||d.RES_TIMEOUT,g=100;setTimeout((function r(){if(!c){if(Object(o.isWindowClosed)(a))return h.ack?n(new Error("Window closed for "+t+" before response")):n(new Error("Window closed for "+t+" before ack"));if(p=Math.max(p-g,0),-1!==m&&(m=Math.max(m-g,0)),h.ack){if(-1===m)return;g=Math.min(m,2e3)}else{if(0===p)return n(new Error("No ack for postMessage "+t+" in "+Object(o.getDomain)()+" in "+d.ACK_TIMEOUT+"ms"));if(0===m)return n(new Error("No response for postMessage "+t+" in "+Object(o.getDomain)()+" in "+(e.timeout||d.RES_TIMEOUT)+"ms"))}setTimeout(r,g)}}),g)}))}));return l.catch((function(){!function(e){O.erroredResponseListeners[e]=!0}(s),F(s)})),u.push(l),l}))}function $(e,t,r,n){return(n=n||{}).window=e,n.name=t,n.data=r,z(n)}function Y(e,t,r){var n=Object(o.getAncestor)();return n?$(n,e,t,r):new E((function(e,t){return t(new Error("Window does not have a parent"))}))}function K(){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(r,n){return $(t,r,n,e)}}}O.receivedMessages=O.receivedMessages||[],O.receiveMessage=B,O.requestPromises=O.requestPromises||new u,O.send=$;var J="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,r=e.name,n=e.window,i=e.domain,a={handler:e.handler,handleError:e.errorHandler||function(e){throw e},window:n,domain:i||f.WILDCARD,name:r},s=function e(t,r){var n=t.name,o=t.win,i=t.domain;if(!n||"string"!=typeof n)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var a=[],s=0,c=o,l=null==c?0:c.length;s<l;s++){var d=c[s];a.push(e({name:n,domain:i,win:d},r))}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,m=i,g=null==m?0:m.length;p<g;p++){var y=m[p];h.push(e({name:n,win:o,domain:y},r))}return{cancel:function(){for(var e=0,t=null==h?0:h.length;e<t;e++)h[e].cancel()}}}var v=W({name:n,win:o,domain:i});if(o&&o!==f.WILDCARD||(o=O.WINDOW_WILDCARD),i=i||f.WILDCARD,v)throw o&&i?new Error("Request listener already exists for "+n+" on domain "+i.toString()+" for "+(o===O.WINDOW_WILDCARD?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+n+" for "+(o===O.WINDOW_WILDCARD?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+n+" on domain "+i.toString()):new Error("Request listener already exists for "+n);var _=O.requestListeners,b=_[n];b||(b=new u,_[n]=b);var E=b.get(o);E||(E={},b.set(o,E));var S=i.toString(),C=E[N],j=void 0;return w(i)?(C||(C=[],E[N]=C),j={regex:i,listener:r},C.push(j)):E[S]=r,{cancel:function(){E&&(delete E[S],o&&0===Object.keys(E).length&&b.delete(o),j&&C.splice(C.indexOf(j,1)))}}}({name:r,win:n,domain:i},a);if(e.once){var c=a.handler;a.handler=m((function(){return s.cancel(),c.apply(this,arguments)}))}if(a.window&&e.errorOnClose)var l=(t=void 0,t=setTimeout((function e(){t=setTimeout(e,50),function(){n&&"object"===(void 0===n?"undefined":J(n))&&Object(o.isWindowClosed)(n)&&(l.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,r){return"function"==typeof t&&(r=t,t={}),(t=t||{}).name=e,t.handler=r||t.handler,Z(t)}function Q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2];"function"==typeof t&&(r=t,t={}),t=t||{},r=r||t.handler;var n=t.errorHandler,o=new E((function(o,i){(t=t||{}).name=e,t.once=!0,t.handler=function(e){if(o(e),r)return r(e)},t.errorHandler=function(e){if(i(e),n)return n(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,r){return X(t,e,r)}}}function ee(){delete window[f.WINDOW_PROPS.POSTROBOT],window.removeEventListener("message",q)}O.on=X;var te=Object(o.getAncestor)();function re(e){var t=O.requestPromises.get(e);if(t)for(var r=0,n=null==t?0:t.length;r<n;r++)t[r].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 ne=null;function oe(){var e,t;O.initialized||(t=q,(e=window).addEventListener?e.addEventListener("message",t):e.attachEvent("onmessage",t),function(){e=function(e){var t=e.source,r=e.origin,n=O.readyPromises.get(t)||new E;n.resolve({origin:r}),O.readyPromises.set(t,n)},O.on(f.POST_MESSAGE_NAMES.HELLO,{domain:f.WILDCARD},(function(t){var r=t.source,n=t.origin;return e({source:r,origin:n})}));var e,t=Object(o.getAncestor)();t&&P(t).catch(g)}(),C({on:X,send:$})),O.initialized=!0}oe(),r.d(t,"cleanUpWindow",(function(){return re})),r.d(t,"Promise",(function(){return E})),r.d(t,"bridge",(function(){return ne})),r.d(t,"init",(function(){return oe})),r.d(t,"parent",(function(){return te})),r.d(t,"send",(function(){return $})),r.d(t,"request",(function(){return z})),r.d(t,"sendToParent",(function(){return Y})),r.d(t,"client",(function(){return K})),r.d(t,"on",(function(){return X})),r.d(t,"listen",(function(){return Z})),r.d(t,"once",(function(){return Q})),r.d(t,"listener",(function(){return V})),r.d(t,"CONFIG",(function(){return d})),r.d(t,"CONSTANTS",(function(){return f})),r.d(t,"disable",(function(){return ee})),t.default=n}})}));unwrapExports(postRobot);var postRobot_1=postRobot.postRobot,postRobot$1=createCommonjsModule((function(e){e.exports=postRobot,e.exports.default=e.exports})),logger_browser=createCommonjsModule((function(e,t){e.exports=function(){var e=1e3,t=6e4,r=36e5,n=24*r,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*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;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>=n?i(o,a,n,"day"):a>=r?i(o,a,r,"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>=n?Math.round(o/n)+"d":i>=r?Math.round(o/r)+"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,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(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 r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))}),t.splice(o,0,r)},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 r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]}function r(e){let o;function a(...e){if(!a.enabled)return;const t=a,n=Number(new Date),i=n-(o||n);t.diff=i,t.prev=o,t.curr=n,o=n,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,o)=>{if("%%"===n)return n;s++;const i=r.formatters[o];if("function"==typeof i){const r=e[s];n=i.call(t,r),e.splice(s,1),s--}return n}),r.formatArgs.call(t,e),(t.log||r.log).apply(t,e)}return a.namespace=e,a.enabled=r.enabled(e),a.useColors=r.useColors(),a.color=t(e),a.destroy=n,a.extend=i,"function"==typeof r.init&&r.init(a),r.instances.push(a),a}function n(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function i(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function a(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){const e=[...r.names.map(a),...r.skips.map(a).map(e=>"-"+e)].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(t=0;t<o;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")));for(t=0;t<r.instances.length;t++){const e=r.instances[t];e.enabled=r.enabled(e.namespace)}},r.enabled=function(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=o,Object.keys(e).forEach(t=>{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}(t);const{formatters:r}=e.exports;r.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}`)}()})),debug=logger_browser("js");function cleanQuery(e){return Object.keys(e).reduce((function(t,r){return e[r]&&(t[r]=e[r]),t}),{})}function cleanOptions(e){return Object.keys(e).reduce((function(t,r){return void 0!==e[r]&&(t[r]=e[r]),t}),{})}function buildQuery(e){return Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&")}var EventEmitter=function(){var e=this;this.events={},this.on=function(t,r){"object"!=typeof e.events[t]&&(e.events[t]=[]),e.events[t].push(r)},this.clearListeners=function(t){e.events[t]=[]},this.removeListener=function(t,r){if(e.events[t]){var n=e.events[t].indexOf(r);n>-1&&e.events[t].splice(n,1)}},this.emit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(e.events[t])for(var o=e.events[t].slice(),i=o.length,a=0;a<i;a++)o[a].apply(e,r)},this.once=function(t,r){var n=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];e.removeListener(t,n),r.apply(e,o)};e.on(t,n)}},bind=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},isBuffer=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},toString=Object.prototype.toString;function isArray(e){return"[object Array]"===toString.call(e)}function isArrayBuffer(e){return"[object ArrayBuffer]"===toString.call(e)}function isFormData(e){return"undefined"!=typeof FormData&&e instanceof FormData}function isArrayBufferView(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function isString(e){return"string"==typeof e}function isNumber(e){return"number"==typeof e}function isUndefined(e){return void 0===e}function isObject(e){return null!==e&&"object"==typeof e}function isDate(e){return"[object Date]"===toString.call(e)}function isFile(e){return"[object File]"===toString.call(e)}function isBlob(e){return"[object Blob]"===toString.call(e)}function isFunction(e){return"[object Function]"===toString.call(e)}function isStream(e){return isObject(e)&&isFunction(e.pipe)}function isURLSearchParams(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function trim(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function isStandardBrowserEnv(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function forEach(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),isArray(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}function merge(){var e={};function t(t,r){"object"==typeof e[r]&&"object"==typeof t?e[r]=merge(e[r],t):e[r]=t}for(var r=0,n=arguments.length;r<n;r++)forEach(arguments[r],t);return e}function deepMerge(){var e={};function t(t,r){"object"==typeof e[r]&&"object"==typeof t?e[r]=deepMerge(e[r],t):e[r]="object"==typeof t?deepMerge({},t):t}for(var r=0,n=arguments.length;r<n;r++)forEach(arguments[r],t);return e}function extend(e,t,r){return forEach(t,(function(t,n){e[n]=r&&"function"==typeof t?bind(t,r):t})),e}var utils={isArray:isArray,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString,isNumber:isNumber,isObject:isObject,isUndefined:isUndefined,isDate:isDate,isFile:isFile,isBlob:isBlob,isFunction:isFunction,isStream:isStream,isURLSearchParams:isURLSearchParams,isStandardBrowserEnv:isStandardBrowserEnv,forEach:forEach,merge:merge,deepMerge:deepMerge,extend:extend,trim:trim};function encode(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 buildURL=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(utils.isURLSearchParams(t))n=t.toString();else{var o=[];utils.forEach(t,(function(e,t){null!=e&&(utils.isArray(e)?t+="[]":e=[e],utils.forEach(e,(function(e){utils.isDate(e)?e=e.toISOString():utils.isObject(e)&&(e=JSON.stringify(e)),o.push(encode(t)+"="+encode(e))})))})),n=o.join("&")}if(n){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e};function Intercep