zoid
Version:
Cross domain components.
1 lines • 89.3 kB
JavaScript
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("zoid",[],e):"object"==typeof exports?exports.zoid=e():n.zoid=e()}("undefined"!=typeof self?self:this,(function(){return function(n){var e={};function r(t){if(e[t])return e[t].exports;var o=e[t]={i:t,l:!1,exports:{}};return n[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=n,r.c=e,r.d=function(n,e,t){r.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:t})},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,e){if(1&e&&(n=r(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)r.d(t,o,function(e){return n[e]}.bind(null,o));return t},r.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(e,"a",e),e},r.o=function(n,e){return{}.hasOwnProperty.call(n,e)},r.p="",r(r.s=0)}([function(n,e,r){"use strict";function t(n,e){return(t=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n})(n,e)}function o(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,t(n,e)}function i(){return(i=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)({}).hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n}).apply(this,arguments)}function a(n){try{if(!n)return!1;if("undefined"!=typeof Promise&&n instanceof Promise)return!0;if("undefined"!=typeof window&&"function"==typeof window.Window&&n instanceof window.Window)return!1;if("undefined"!=typeof window&&"function"==typeof window.constructor&&n instanceof window.constructor)return!1;var e={}.toString;if(e){var r=e.call(n);if("[object Window]"===r||"[object global]"===r||"[object DOMWindow]"===r)return!1}if("function"==typeof n.then)return!0}catch(n){return!1}return!1}r.r(e),r.d(e,"PopupOpenError",(function(){return Ln})),r.d(e,"create",(function(){return Pr})),r.d(e,"destroy",(function(){return Dr})),r.d(e,"destroyComponents",(function(){return Or})),r.d(e,"destroyAll",(function(){return Cr})),r.d(e,"PROP_TYPE",(function(){return Xe})),r.d(e,"PROP_SERIALIZATION",(function(){return Ke})),r.d(e,"CONTEXT",(function(){return Qe})),r.d(e,"EVENT",(function(){return nr}));var u,c=[],s=[],f=0;function d(){if(!f&&u){var n=u;u=null,n.resolve()}}function l(){f+=1}function h(){f-=1,d()}var p=function(){function n(n){var e=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],n){var r,t,o=!1,i=!1,a=!1;l();try{n((function(n){a?e.resolve(n):(o=!0,r=n)}),(function(n){a?e.reject(n):(i=!0,t=n)}))}catch(n){return h(),void this.reject(n)}h(),a=!0,o?this.resolve(r):i&&this.reject(t)}}var e=n.prototype;return e.resolve=function(n){if(this.resolved||this.rejected)return this;if(a(n))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=n,this.dispatch(),this},e.reject=function(n){var e=this;if(this.resolved||this.rejected)return this;if(a(n))throw new Error("Can not reject promise with another promise");if(!n){var r=n&&"function"==typeof n.toString?n.toString():{}.toString.call(n);n=new Error("Expected reject to be called with Error, got "+r)}return this.rejected=!0,this.error=n,this.errorHandled||setTimeout((function(){e.errorHandled||function(n,e){if(-1===c.indexOf(n)){c.push(n),setTimeout((function(){throw n}),1);for(var r=0;r<s.length;r++)s[r](n,e)}}(n,e)}),1),this.dispatch(),this},e.asyncReject=function(n){return this.errorHandled=!0,this.reject(n),this},e.dispatch=function(){var e=this.resolved,r=this.rejected,t=this.handlers;if(!this.dispatching&&(e||r)){this.dispatching=!0,l();for(var o=function(n,e){return n.then((function(n){e.resolve(n)}),(function(n){e.reject(n)}))},i=0;i<t.length;i++){var u=t[i],c=u.onSuccess,s=u.onError,f=u.promise,d=void 0;if(e)try{d=c?c(this.value):this.value}catch(n){f.reject(n);continue}else if(r){if(!s){f.reject(this.error);continue}try{d=s(this.error)}catch(n){f.reject(n);continue}}if(d instanceof n&&(d.resolved||d.rejected)){var p=d;p.resolved?f.resolve(p.value):f.reject(p.error),p.errorHandled=!0}else a(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?f.resolve(d.value):f.reject(d.error):o(d,f):f.resolve(d)}t.length=0,this.dispatching=!1,h()}},e.then=function(e,r){if(e&&"function"!=typeof e&&!e.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 t=new n;return this.handlers.push({promise:t,onSuccess:e,onError:r}),this.errorHandled=!0,this.dispatch(),t},e.catch=function(n){return this.then(void 0,n)},e.finally=function(e){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.finally expected a function");return this.then((function(r){return n.try(e).then((function(){return r}))}),(function(r){return n.try(e).then((function(){throw r}))}))},e.timeout=function(n,e){var r=this;if(this.resolved||this.rejected)return this;var t=setTimeout((function(){r.resolved||r.rejected||r.reject(e||new Error("Promise timed out after "+n+"ms"))}),n);return this.then((function(n){return clearTimeout(t),n}))},e.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.lazy=function(){return this.errorHandled=!0,this},n.resolve=function(e){return e instanceof n?e:a(e)?new n((function(n,r){return e.then(n,r)})):(new n).resolve(e)},n.reject=function(e){return(new n).reject(e)},n.asyncReject=function(e){return(new n).asyncReject(e)},n.all=function(e){var r=new n,t=e.length,o=[].slice();if(!t)return r.resolve(o),r;for(var i=function(n,e,i){return e.then((function(e){o[n]=e,0==(t-=1)&&r.resolve(o)}),(function(n){i.reject(n)}))},u=0;u<e.length;u++){var c=e[u];if(c instanceof n){if(c.resolved){o[u]=c.value,t-=1;continue}}else if(!a(c)){o[u]=c,t-=1;continue}i(u,n.resolve(c),r)}return 0===t&&r.resolve(o),r},n.hash=function(e){var r={},t=[],o=function(n){if(e.hasOwnProperty(n)){var o=e[n];a(o)?t.push(o.then((function(e){r[n]=e}))):r[n]=o}};for(var i in e)o(i);return n.all(t).then((function(){return r}))},n.map=function(e,r){return n.all(e.map(r))},n.onPossiblyUnhandledException=function(n){return function(n){return s.push(n),{cancel:function(){s.splice(s.indexOf(n),1)}}}(n)},n.try=function(e,r,t){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.try expected a function");var o;l();try{o=e.apply(r,t||[])}catch(e){return h(),n.reject(e)}return h(),n.resolve(o)},n.delay=function(e){return new n((function(n){setTimeout(n,e)}))},n.isPromise=function(e){return!!(e&&e instanceof n)||a(e)},n.flush=function(){return e=u=u||new n,d(),e;var e},n}();function w(n){return"[object RegExp]"==={}.toString.call(n)}var v={IFRAME:"iframe",POPUP:"popup"},m="Call was rejected by callee.\r\n";function y(n){return void 0===n&&(n=window),n.location.protocol}function g(n){if(void 0===n&&(n=window),n.mockDomain){var e=n.mockDomain.split("//")[0];if(e)return e}return y(n)}function b(n){return void 0===n&&(n=window),"about:"===g(n)}function E(n){if(void 0===n&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function _(n){if(void 0===n&&(n=window),n&&!E(n))try{return n.opener}catch(n){}}function x(n){try{return!0}catch(n){}return!1}function P(n){void 0===n&&(n=window);var e=n.location;if(!e)throw new Error("Can not read window location");var r=y(n);if(!r)throw new Error("Can not read window protocol");if("file:"===r)return"file://";if("about:"===r){var t=E(n);return t&&x()?P(t):"about://"}var o=e.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function O(n){void 0===n&&(n=window);var e=P(n);return e&&n.mockDomain&&0===n.mockDomain.indexOf("mock:")?n.mockDomain:e}function C(n){if(!function(n){try{if(n===window)return!0}catch(n){}try{var e=Object.getOwnPropertyDescriptor(n,"location");if(e&&!1===e.enumerable)return!1}catch(n){}try{if(b(n)&&x())return!0}catch(n){}try{if(function(n){return void 0===n&&(n=window),"mock:"===g(n)}(n)&&x())return!0}catch(n){}try{if(P(n)===P(window))return!0}catch(n){}return!1}(n))return!1;try{if(n===window)return!0;if(b(n)&&x())return!0;if(O(window)===O(n))return!0}catch(n){}return!1}function D(n){if(!C(n))throw new Error("Expected window to be same domain");return n}function S(n,e){if(!n||!e)return!1;var r=E(e);return r?r===n:-1!==function(n){var e=[];try{for(;n.parent!==n;)e.push(n.parent),n=n.parent}catch(n){}return e}(e).indexOf(n)}function W(n){var e,r,t=[];try{e=n.frames}catch(r){e=n}try{r=e.length}catch(n){}if(0===r)return t;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=e[o]}catch(n){continue}t.push(i)}return t}for(var a=0;a<100;a++){var u=void 0;try{u=e[a]}catch(n){return t}if(!u)return t;t.push(u)}return t}function j(n){for(var e=[],r=0,t=W(n);r<t.length;r++){var o=t[r];e.push(o);for(var i=0,a=j(o);i<a.length;i++)e.push(a[i])}return e}function N(n){void 0===n&&(n=window);try{if(n.top)return n.top}catch(n){}if(E(n)===n)return n;try{if(S(window,n)&&window.top)return window.top}catch(n){}try{if(S(n,window)&&window.top)return window.top}catch(n){}for(var e=0,r=j(n);e<r.length;e++){var t=r[e];try{if(t.top)return t.top}catch(n){}if(E(t)===t)return t}}function R(n){var e=N(n);if(!e)throw new Error("Can not determine top window");var r=[].concat(j(e),[e]);return-1===r.indexOf(n)&&(r=[].concat(r,[n],j(n))),r}var A=[],T=[];function I(n,e){void 0===e&&(e=!0);try{if(n===window)return!1}catch(n){return!0}try{if(!n)return!0}catch(n){return!0}try{if(n.closed)return!0}catch(n){return!n||n.message!==m}if(e&&C(n))try{if(n.mockclosed)return!0}catch(n){}try{if(!n.parent||!n.top)return!0}catch(n){}var r=function(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}(A,n);if(-1!==r){var t=T[r];if(t&&function(n){if(!n.contentWindow)return!0;if(!n.parentNode)return!0;var e=n.ownerDocument;if(e&&e.documentElement&&!e.documentElement.contains(n)){for(var r=n;r.parentNode&&r.parentNode!==r;)r=r.parentNode;if(!r.host||!e.documentElement.contains(r.host))return!0}return!1}(t))return!0}return!1}function z(n,e){for(var r=W(n),t=0;t<r.length;t++){var o=r[t];try{if(C(o)&&o.name===e&&-1!==r.indexOf(o))return o}catch(n){}}try{if(-1!==r.indexOf(n.frames[e]))return n.frames[e]}catch(n){}try{if(-1!==r.indexOf(n[e]))return n[e]}catch(n){}}function k(n){return void 0===n&&(n=window),_(n=n||window)||E(n)||void 0}function F(n,e){for(var r=0;r<n.length;r++)for(var t=n[r],o=0;o<e.length;o++)if(t===e[o])return!0;return!1}function M(n){void 0===n&&(n=window);for(var e=0,r=n;r;)(r=E(r))&&(e+=1);return e}function U(n,e){var r=N(n)||n,t=N(e)||e;try{if(r&&t)return r===t}catch(n){}var o=R(n),i=R(e);if(F(o,i))return!0;var a=_(r),u=_(t);return a&&F(R(a),i)||u&&F(R(u),o),!1}function L(n,e){if("string"==typeof n){if("string"==typeof e)return"*"===n||e===n;if(w(e))return!1;if(Array.isArray(e))return!1}return w(n)?w(e)?n.toString()===e.toString():!Array.isArray(e)&&Boolean(e.match(n)):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!w(e)&&n.some((function(n){return L(n,e)})))}function q(n){return n.match(/^(https?|mock|file):\/\//)?n.split("/").slice(0,3).join("/"):O()}function B(n,e,r,t){var o;return void 0===r&&(r=1e3),void 0===t&&(t=1/0),function i(){if(I(n))return o&&clearTimeout(o),e();t<=0?clearTimeout(o):(t-=r,o=setTimeout(i,r))}(),{cancel:function(){o&&clearTimeout(o)}}}function $(n){try{if(n===window)return!0}catch(n){if(n&&n.message===m)return!0}try{if("[object Window]"==={}.toString.call(n))return!0}catch(n){if(n&&n.message===m)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===m)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===m)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===m)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===m)return!0}try{if(n&&"__unlikely_value__"===n.__cross_domain_utils_window_check__)return!1}catch(n){return!0}try{if("postMessage"in n&&"self"in n&&"location"in n)return!0}catch(n){}return!1}function J(n){if(C(n))return D(n).frameElement;for(var e=0,r=document.querySelectorAll("iframe");e<r.length;e++){var t=r[e];if(t&&t.contentWindow&&t.contentWindow===n)return t}}function H(n){if(function(n){return void 0===n&&(n=window),Boolean(E(n))}(n)){var e=J(n);if(e&&e.parentElement)return void e.parentElement.removeChild(e)}try{n.close()}catch(n){}}function Y(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}var Z,G=function(){function n(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var n=new WeakMap,e={};return Object.freeze(e),n.set(e,"__testvalue__"),"__testvalue__"===n.get(e)}catch(n){return!1}}())try{this.weakmap=new WeakMap}catch(n){}this.keys=[],this.values=[]}var e=n.prototype;return e._cleanupClosedWindows=function(){for(var n=this.weakmap,e=this.keys,r=0;r<e.length;r++){var t=e[r];if($(t)&&I(t)){if(n)try{n.delete(t)}catch(n){}e.splice(r,1),this.values.splice(r,1),r-=1}}},e.isSafeToReadWrite=function(n){return!$(n)},e.set=function(n,e){if(!n)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(n,e)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n))try{var t=this.name,o=n[t];return void(o&&o[0]===n?o[1]=e:Object.defineProperty(n,t,{value:[n,e],writable:!0}))}catch(n){}this._cleanupClosedWindows();var i=this.keys,a=this.values,u=Y(i,n);-1===u?(i.push(n),a.push(e)):a[u]=e},e.get=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return e.get(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n))try{var r=n[this.name];return r&&r[0]===n?r[1]:void 0}catch(n){}this._cleanupClosedWindows();var t=Y(this.keys,n);if(-1!==t)return this.values[t]},e.delete=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n))try{var r=n[this.name];r&&r[0]===n&&(r[0]=r[1]=void 0)}catch(n){}this._cleanupClosedWindows();var t=this.keys,o=Y(t,n);-1!==o&&(t.splice(o,1),this.values.splice(o,1))},e.has=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return!0}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n))try{var r=n[this.name];return!(!r||r[0]!==n)}catch(n){}return this._cleanupClosedWindows(),-1!==Y(this.keys,n)},e.getOrSet=function(n,e){if(this.has(n))return this.get(n);var r=e();return this.set(n,r),r},n}();function V(n){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function X(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(n){return!1}}function K(n,e,r){return(K=X()?Reflect.construct:function(n,e,r){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(n,o));return r&&t(i,r.prototype),i}).apply(null,arguments)}function Q(n){var e="function"==typeof Map?new Map:void 0;return(Q=function(n){if(null===n||-1===Function.toString.call(n).indexOf("[native code]"))return n;if("function"!=typeof n)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return K(n,arguments,V(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t(r,n)})(n)}function nn(n){return n.name||n.__name__||n.displayName||"anonymous"}function en(n,e){try{delete n.name,n.name=e}catch(n){}return n.__name__=n.displayName=e,n}function rn(n){if("function"==typeof btoa)return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(function(n,e){return String.fromCharCode(parseInt(e,16))}))).replace(/[=]/g,"");if("undefined"!=typeof Buffer)return Buffer.from(n,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}function tn(){var n="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,(function(){return n.charAt(Math.floor(Math.random()*n.length))}))+"_"+rn((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function on(n){try{return JSON.stringify([].slice.call(n),(function(n,e){return"function"==typeof e?"memoize["+function(n){if(Z=Z||new G,null==n||"object"!=typeof n&&"function"!=typeof n)throw new Error("Invalid object");var e=Z.get(n);return e||(e=typeof n+":"+tn(),Z.set(n,e)),e}(e)+"]":e}))}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}function an(){return{}}var un=0,cn=0;function sn(n,e){void 0===e&&(e={});var r,t,o=e.thisNamespace,i=void 0!==o&&o,a=e.time,u=un;un+=1;var c=function(){for(var e=arguments.length,o=new Array(e),c=0;c<e;c++)o[c]=arguments[c];var s;u<cn&&(r=null,t=null,u=un,un+=1),s=i?(t=t||new G).getOrSet(this,an):r=r||{};var f=on(o),d=s[f];if(d&&a&&Date.now()-d.time<a&&(delete s[f],d=null),d)return d.value;var l=Date.now(),h=n.apply(this,arguments);return s[f]={time:l,value:h},h};return c.reset=function(){r=null,t=null},en(c,(e.name||nn(n))+"::memoized")}function fn(n){var e={};function r(){for(var r=arguments,t=this,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];var u=on(i);return e.hasOwnProperty(u)||(e[u]=p.try((function(){return n.apply(t,r)})).finally((function(){delete e[u]}))),e[u]}return r.reset=function(){e={}},en(r,nn(n)+"::promiseMemoized")}function dn(){}function ln(n){var e=!1;return en((function(){if(!e)return e=!0,n.apply(this,arguments)}),nn(n)+"::once")}function hn(n,e){if(void 0===e&&(e=1),e>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if("string"==typeof n)return n;if(n instanceof Error){var r=n&&n.stack,t=n&&n.message;if(r&&t)return-1!==r.indexOf(t)?r:t+"\n"+r;if(r)return r;if(t)return t}return n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}catch(n){return"Error while stringifying error: "+hn(n,e+1)}}function pn(n){return"string"==typeof n?n:n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}function wn(n,e){if(!e)return n;if(Object.assign)return Object.assign(n,e);for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return n}function vn(n){return n}function mn(n,e){var r;return function t(){r=setTimeout((function(){n(),t()}),e)}(),{cancel:function(){clearTimeout(r)}}}function yn(n){return n.replace(/-([a-z])/g,(function(n){return n[1].toUpperCase()}))}function gn(n,e,r){if(Array.isArray(n)){if("number"!=typeof e)throw new TypeError("Array key must be number")}else if("object"==typeof n&&null!==n&&"string"!=typeof e)throw new TypeError("Object key must be string");Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){delete n[e];var t=r();return n[e]=t,t},set:function(r){delete n[e],n[e]=r}})}function bn(n){return[].slice.call(n)}function En(n){return"object"==typeof(e=n)&&null!==e&&"[object Object]"==={}.toString.call(n);var e}function _n(n){if(!En(n))return!1;var e=n.constructor;if("function"!=typeof e)return!1;var r=e.prototype;return!!En(r)&&!!r.hasOwnProperty("isPrototypeOf")}function xn(n,e,r){if(void 0===r&&(r=""),Array.isArray(n)){for(var t=n.length,o=[],i=function(t){gn(o,t,(function(){var o=r?r+"."+t:""+t,i=e(n[t],t,o);return(_n(i)||Array.isArray(i))&&(i=xn(i,e,o)),i}))},a=0;a<t;a++)i(a);return o}if(_n(n)){var u={},c=function(t){if(!n.hasOwnProperty(t))return"continue";gn(u,t,(function(){var o=r?r+"."+t:""+t,i=e(n[t],t,o);return(_n(i)||Array.isArray(i))&&(i=xn(i,e,o)),i}))};for(var s in n)c(s);return u}throw new Error("Pass an object or array")}function Pn(n){return null!=n}function On(n){return"[object RegExp]"==={}.toString.call(n)}function Cn(n,e,r){if(n.hasOwnProperty(e))return n[e];var t=r();return n[e]=t,t}function Dn(n){var e,r=[],t=!1,o={set:function(e,r){return t||(n[e]=r,o.register((function(){delete n[e]}))),r},register:function(n){var o=ln((function(){return n(e)}));return t?n(e):r.push(o),{cancel:function(){var n=r.indexOf(o);-1!==n&&r.splice(n,1)}}},all:function(n){e=n;var o=[];for(t=!0;r.length;){var i=r.shift();o.push(i())}return p.all(o).then(dn)}};return o}function Sn(n,e){if(null==e)throw new Error("Expected "+n+" to be present");return e}sn.clear=function(){cn=un},sn((function(n){if(Object.values)return Object.values(n);var e=[];for(var r in n)n.hasOwnProperty(r)&&e.push(n[r]);return e}));var Wn=function(n){function e(e){var r;return(r=n.call(this,e)||this).name=r.constructor.name,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(r),r.constructor):r.stack=new Error(e).stack,r}return o(e,n),e}(Q(Error));function jn(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function Nn(){return Boolean(document.body)&&"complete"===document.readyState}function Rn(){return Boolean(document.body)&&"interactive"===document.readyState}function An(n){return encodeURIComponent(n)}function Tn(n){return function(e,r,t){void 0===t&&(t=[]);var o=e.__inline_memoize_cache__=e.__inline_memoize_cache__||{},i=on(t);return o.hasOwnProperty(i)?o[i]:o[i]=function(){var e={};if(!n)return e;if(-1===n.indexOf("="))return e;for(var r=0,t=n.split("&");r<t.length;r++){var o=t[r];(o=o.split("="))[0]&&o[1]&&(e[decodeURIComponent(o[0])]=decodeURIComponent(o[1]))}return e}.apply(void 0,t)}(Tn,0,[n])}function In(n,e){return void 0===e&&(e={}),e&&Object.keys(e).length?(void 0===(r=i({},Tn(n),e))&&(r={}),Object.keys(r).filter((function(n){return"string"==typeof r[n]||"boolean"==typeof r[n]})).map((function(n){var e=r[n];if("string"!=typeof e&&"boolean"!=typeof e)throw new TypeError("Invalid type for query");return An(n)+"="+An(e.toString())})).join("&")):n;var r}function zn(n,e){n.appendChild(e)}function kn(n){return n instanceof window.Element||null!==n&&"object"==typeof n&&1===n.nodeType&&"object"==typeof n.style&&"object"==typeof n.ownerDocument}function Fn(n,e){return void 0===e&&(e=document),kn(n)?n:"string"==typeof n?e.querySelector(n):void 0}function Mn(n){return new p((function(e,r){var t=pn(n),o=Fn(n);if(o)return e(o);if(Nn())return r(new Error("Document is ready and element "+t+" does not exist"));var i=setInterval((function(){return(o=Fn(n))?(e(o),void clearInterval(i)):Nn()?(clearInterval(i),r(new Error("Document is ready and element "+t+" does not exist"))):void 0}),10)}))}sn((function(){return new p((function(n){if(Nn()||Rn())return n();var e=setInterval((function(){if(Nn()||Rn())return clearInterval(e),n()}),10)}))}));var Un,Ln=function(n){function e(){return n.apply(this,arguments)||this}return o(e,n),e}(Wn);function qn(n){if((Un=Un||new G).has(n)){var e=Un.get(n);if(e)return e}var r=new p((function(e,r){n.addEventListener("load",(function(){(function(n){if(function(){for(var n=0;n<A.length;n++){var e=!1;try{e=A[n].closed}catch(n){}e&&(T.splice(n,1),A.splice(n,1))}}(),n&&n.contentWindow)try{A.push(n.contentWindow),T.push(n)}catch(n){}})(n),e(n)})),n.addEventListener("error",(function(t){n.contentWindow?e(n):r(t)}))}));return Un.set(n,r),r}function Bn(n){return qn(n).then((function(n){if(!n.contentWindow)throw new Error("Could not find window in iframe");return n.contentWindow}))}function $n(n,e){void 0===n&&(n={});var r=n.style||{},t=function(n,e,r){void 0===n&&(n="div"),void 0===e&&(e={}),n=n.toLowerCase();var t,o,i,a=document.createElement(n);if(e.style&&wn(a.style,e.style),e.class&&(a.className=e.class.join(" ")),e.id&&a.setAttribute("id",e.id),e.attributes)for(var u=0,c=Object.keys(e.attributes);u<c.length;u++){var s=c[u];a.setAttribute(s,e.attributes[s])}if(e.styleSheet&&(t=a,o=e.styleSheet,void 0===i&&(i=window.document),t.styleSheet?t.styleSheet.cssText=o:t.appendChild(i.createTextNode(o))),e.html){if("iframe"===n)throw new Error("Iframe html can not be written unless container provided and iframe in DOM");a.innerHTML=e.html}return a}("iframe",{attributes:i({allowTransparency:"true"},n.attributes||{}),style:i({backgroundColor:"transparent",border:"none"},r),html:n.html,class:n.class}),o=window.navigator.userAgent.match(/MSIE|Edge/i);return t.hasAttribute("id")||t.setAttribute("id",tn()),qn(t),e&&function(n,e){void 0===e&&(e=document);var r=Fn(n,e);if(r)return r;throw new Error("Can not find element: "+pn(n))}(e).appendChild(t),(n.url||o)&&t.setAttribute("src",n.url||"about:blank"),t}function Jn(n,e,r){return n.addEventListener(e,r),{cancel:function(){n.removeEventListener(e,r)}}}function Hn(n){n.style.setProperty("display","")}function Yn(n){n.style.setProperty("display","none","important")}function Zn(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function Gn(n){return!(n&&n.parentNode&&n.ownerDocument&&n.ownerDocument.documentElement&&n.ownerDocument.documentElement.contains(n))}function Vn(n,e,r){var t=void 0===r?{}:r,o=t.width,i=void 0===o||o,a=t.height,u=void 0===a||a,c=t.interval,s=void 0===c?100:c,f=t.win,d=void 0===f?window:f,l=n.offsetWidth,h=n.offsetHeight,p=!1;e({width:l,height:h});var w,v,m=function(){if(!p&&function(n){return Boolean(n.offsetWidth||n.offsetHeight||n.getClientRects().length)}(n)){var r=n.offsetWidth,t=n.offsetHeight;(i&&r!==l||u&&t!==h)&&e({width:r,height:t}),l=r,h=t}};return d.addEventListener("resize",m),void 0!==d.ResizeObserver?((w=new d.ResizeObserver(m)).observe(n),v=mn(m,10*s)):void 0!==d.MutationObserver?((w=new d.MutationObserver(m)).observe(n,{attributes:!0,childList:!0,subtree:!0,characterData:!1}),v=mn(m,10*s)):v=mn(m,s),{cancel:function(){p=!0,w.disconnect(),window.removeEventListener("resize",m),v.cancel()}}}function Xn(n){for(;n.parentNode;)n=n.parentNode;return"[object ShadowRoot]"===n.toString()}var Kn="undefined"!=typeof document?document.currentScript:null,Qn=sn((function(){if(Kn)return Kn;if(Kn=function(){try{var n=function(){try{throw new Error("_")}catch(n){return n.stack||""}}(),e=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n),r=e&&e[1];if(!r)return;for(var t=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();t<o.length;t++){var i=o[t];if(i.src&&i.src===r)return i}}catch(n){}}())return Kn;throw new Error("Can not determine current script")})),ne=tn();function ee(n){return function(n){if("number"==typeof n)return n;var e=n.match(/^([0-9]+)(px|%)$/);if(!e)throw new Error("Could not match css value from "+n);return parseInt(e[1],10)}(n)+"px"}function re(n){return"number"==typeof n?ee(n):"string"==typeof(e=n)&&/^[0-9]+%$/.test(e)?n:ee(n);var e}function te(n){void 0===n&&(n=window);var e="__post_robot_10_0_44__";return n!==window?n[e]:n[e]=n[e]||{}}sn((function(){var n;try{n=Qn()}catch(n){return ne}var e=n.getAttribute("data-uid");if(e&&"string"==typeof e)return e;if((e=n.getAttribute("data-uid-auto"))&&"string"==typeof e)return e;if(n.src){var r=function(n){for(var e="",r=0;r<n.length;r++){var t=n[r].charCodeAt(0)*r;n[r+1]&&(t+=n[r+1].charCodeAt(0)*(r-1)),e+=String.fromCharCode(97+Math.abs(t)%26)}return e}(JSON.stringify({src:n.src,dataset:n.dataset}));e="uid_"+r.slice(r.length-30)}else e=tn();return n.setAttribute("data-uid-auto",e),e}));var oe=function(){return{}};function ie(n,e){return void 0===n&&(n="store"),void 0===e&&(e=oe),Cn(te(),n,(function(){var n=e();return{has:function(e){return n.hasOwnProperty(e)},get:function(e,r){return n.hasOwnProperty(e)?n[e]:r},set:function(e,r){return n[e]=r,r},del:function(e){delete n[e]},getOrSet:function(e,r){return Cn(n,e,r)},reset:function(){n=e()},keys:function(){return Object.keys(n)}}}))}var ae,ue=function(){};function ce(){var n=te();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new ue,n.WINDOW_WILDCARD}function se(n,e){return void 0===n&&(n="store"),void 0===e&&(e=oe),ie("windowStore").getOrSet(n,(function(){var r=new G,t=function(n){return r.getOrSet(n,e)};return{has:function(e){return t(e).hasOwnProperty(n)},get:function(e,r){var o=t(e);return o.hasOwnProperty(n)?o[n]:r},set:function(e,r){return t(e)[n]=r,r},del:function(e){delete t(e)[n]},getOrSet:function(e,r){return Cn(t(e),n,r)}}}))}function fe(){return ie("instance").getOrSet("instanceID",tn)}function de(n,e){var r=e.domain,t=se("helloPromises"),o=t.get(n);o&&o.resolve({domain:r});var i=p.resolve({domain:r});return t.set(n,i),i}function le(n,e){return(0,e.send)(n,"postrobot_hello",{instanceID:fe()},{domain:"*",timeout:-1}).then((function(e){var r=e.origin,t=e.data.instanceID;return de(n,{domain:r}),{win:n,domain:r,instanceID:t}}))}function he(n,e){var r=e.send;return se("windowInstanceIDPromises").getOrSet(n,(function(){return le(n,{send:r}).then((function(n){return n.instanceID}))}))}function pe(n){se("knownWindows").set(n,!0)}function we(n){return"object"==typeof n&&null!==n&&"string"==typeof n.__type__}function ve(n){return void 0===n?"undefined":null===n?"null":Array.isArray(n)?"array":"function"==typeof n?"function":"object"==typeof n?n instanceof Error?"error":"function"==typeof n.then?"promise":"[object RegExp]"==={}.toString.call(n)?"regex":"[object Date]"==={}.toString.call(n)?"date":"object":"string"==typeof n?"string":"number"==typeof n?"number":"boolean"==typeof n?"boolean":void 0}function me(n,e){return{__type__:n,__val__:e}}var ye,ge=((ae={}).function=function(){},ae.error=function(n){return me("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},ae.promise=function(){},ae.regex=function(n){return me("regex",n.source)},ae.date=function(n){return me("date",n.toJSON())},ae.array=function(n){return n},ae.object=function(n){return n},ae.string=function(n){return n},ae.number=function(n){return n},ae.boolean=function(n){return n},ae.null=function(n){return n},ae[void 0]=function(n){return me("undefined",n)},ae),be={},Ee=((ye={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},ye.error=function(n){var e=n.stack,r=n.code,t=n.data,o=new Error(n.message);return o.code=r,t&&(o.data=t),o.stack=e+"\n\n"+o.stack,o},ye.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},ye.regex=function(n){return new RegExp(n)},ye.date=function(n){return new Date(n)},ye.array=function(n){return n},ye.object=function(n){return n},ye.string=function(n){return n},ye.number=function(n){return n},ye.boolean=function(n){return n},ye.null=function(n){return n},ye[void 0]=function(){},ye),_e={};function xe(){for(var n=ie("idToProxyWindow"),e=0,r=n.keys();e<r.length;e++){var t=r[e];n.get(t).shouldClean()&&n.del(t)}}function Pe(n,e){var r=e.send,t=e.id,o=void 0===t?tn():t,i=n.then((function(n){if(C(n))return D(n).name})),a=n.then((function(n){if(I(n))throw new Error("Window is closed, can not determine type");return _(n)?v.POPUP:v.IFRAME}));i.catch(dn),a.catch(dn);var u=function(){return n.then((function(n){if(!I(n))return C(n)?D(n).name:i}))};return{id:o,getType:function(){return a},getInstanceID:fn((function(){return n.then((function(n){return he(n,{send:r})}))})),close:function(){return n.then(H)},getName:u,focus:function(){return n.then((function(n){n.focus()}))},isClosed:function(){return n.then((function(n){return I(n)}))},setLocation:function(e,r){return void 0===r&&(r={}),n.then((function(n){var t=window.location.protocol+"//"+window.location.host,o=r.method,i=void 0===o?"get":o,a=r.body;if(0===e.indexOf("/"))e=""+t+e;else if(!e.match(/^https?:\/\//)&&0!==e.indexOf(t))throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(e));if("post"===i)return u().then((function(n){if(!n)throw new Error("Can not post to window without target name");!function(n){var e=n.url,r=n.target,t=n.body,o=n.method,i=void 0===o?"post":o,a=document.createElement("form");if(a.setAttribute("target",r),a.setAttribute("method",i),a.setAttribute("action",e),a.style.display="none",t)for(var u=0,c=Object.keys(t);u<c.length;u++){var s,f=c[u],d=document.createElement("input");d.setAttribute("name",f),d.setAttribute("value",null==(s=t[f])?void 0:s.toString()),a.appendChild(d)}jn().appendChild(a),a.submit(),jn().removeChild(a)}({url:e,target:n,method:i,body:a})}));if("get"!==i)throw new Error("Unsupported method: "+i);if(C(n))try{if(n.location&&"function"==typeof n.location.replace)return void n.location.replace(e)}catch(n){}n.location=e}))},setName:function(e){return n.then((function(n){var r=C(n),t=J(n);if(!r)throw new Error("Can not set name for cross-domain window: "+e);D(n).name=e,t&&t.setAttribute("name",e),i=p.resolve(e)}))}}}new p((function(n){if(window.document&&window.document.body)return n(window.document.body);var e=setInterval((function(){if(window.document&&window.document.body)return clearInterval(e),n(window.document.body)}),10)}));var Oe=function(){function n(n){var e=n.send,r=n.win,t=n.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new p,this.serializedWindow=t||Pe(this.actualWindowPromise,{send:e}),ie("idToProxyWindow").set(this.getID(),this),r&&this.setWindow(r,{send:e})}var e=n.prototype;return e.getID=function(){return this.serializedWindow.id},e.getType=function(){return this.serializedWindow.getType()},e.isPopup=function(){return this.getType().then((function(n){return n===v.POPUP}))},e.setLocation=function(n,e){var r=this;return this.serializedWindow.setLocation(n,e).then((function(){return r}))},e.getName=function(){return this.serializedWindow.getName()},e.setName=function(n){var e=this;return this.serializedWindow.setName(n).then((function(){return e}))},e.close=function(){var n=this;return this.serializedWindow.close().then((function(){return n}))},e.focus=function(){var n=this,e=this.isPopup(),r=this.getName(),t=p.hash({isPopup:e,name:r}).then((function(n){var e=n.name;n.isPopup&&e&&window.open("",e)})),o=this.serializedWindow.focus();return p.all([t,o]).then((function(){return n}))},e.isClosed=function(){return this.serializedWindow.isClosed()},e.getWindow=function(){return this.actualWindow},e.setWindow=function(n,e){var r=e.send;this.actualWindow=n,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=Pe(this.actualWindowPromise,{send:r,id:this.getID()}),se("winToProxyWindow").set(n,this)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(n,e){var r=this,t=e.send;return p.try((function(){return r.actualWindow?n===r.actualWindow:p.hash({proxyInstanceID:r.getInstanceID(),knownWindowInstanceID:he(n,{send:t})}).then((function(e){var o=e.proxyInstanceID===e.knownWindowInstanceID;return o&&r.setWindow(n,{send:t}),o}))}))},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return this.serializedWindow.getInstanceID()},e.shouldClean=function(){return Boolean(this.actualWindow&&I(this.actualWindow))},e.serialize=function(){return this.serializedWindow},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e,r){var t=r.send;return xe(),n.toProxyWindow(e,{send:t}).serialize()},n.deserialize=function(e,r){var t=r.send;return xe(),ie("idToProxyWindow").get(e.id)||new n({serializedWindow:e,send:t})},n.isProxyWindow=function(n){return Boolean(n&&!$(n)&&n.isProxyWindow)},n.toProxyWindow=function(e,r){var t=r.send;if(xe(),n.isProxyWindow(e))return e;var o=e;return se("winToProxyWindow").get(o)||new n({win:o,send:t})},n}();function Ce(n,e,r,t,o){var i=se("methodStore"),a=ie("proxyWindowMethods");Oe.isProxyWindow(t)?a.set(n,{val:e,name:r,domain:o,source:t}):(a.del(n),i.getOrSet(t,(function(){return{}}))[n]={domain:o,name:r,val:e,source:t})}function De(n,e){var r=se("methodStore"),t=ie("proxyWindowMethods");return r.getOrSet(n,(function(){return{}}))[e]||t.get(e)}function Se(n,e,r,t,o){var i,a,u;a=(i={on:o.on,send:o.send}).on,u=i.send,ie("builtinListeners").getOrSet("functionCalls",(function(){return a("postrobot_method",{domain:"*"},(function(n){var e=n.source,r=n.origin,t=n.data,o=t.id,i=t.name,a=De(e,o);if(!a)throw new Error("Could not find method '"+i+"' with id: "+t.id+" in "+O(window));var c=a.source,s=a.domain,f=a.val;return p.try((function(){if(!L(s,r))throw new Error("Method '"+t.name+"' domain "+JSON.stringify(On(a.domain)?a.domain.source:a.domain)+" does not match origin "+r+" in "+O(window));if(Oe.isProxyWindow(c))return c.matchWindow(e,{send:u}).then((function(n){if(!n)throw new Error("Method call '"+t.name+"' failed - proxy window does not match source in "+O(window))}))})).then((function(){return f.apply({source:e,origin:r},t.args)}),(function(n){return p.try((function(){if(f.onError)return f.onError(n)})).then((function(){var e;throw n.stack&&(n.stack="Remote call to "+i+"("+(void 0===(e=t.args)&&(e=[]),bn(e).map((function(n){return"string"==typeof n?"'"+n+"'":void 0===n?"undefined":null===n?"null":"boolean"==typeof n?n.toString():Array.isArray(n)?"[ ... ]":"object"==typeof n?"{ ... }":"function"==typeof n?"() => { ... }":"<"+typeof n+">"})).join(", ")+") failed\n\n")+n.stack),n}))})).then((function(n){return{result:n,id:o,name:i}}))}))}));var c=r.__id__||tn();n=Oe.unwrap(n);var s=r.__name__||r.name||t;return"string"==typeof s&&"function"==typeof s.indexOf&&0===s.indexOf("anonymous::")&&(s=s.replace("anonymous::",t+"::")),Oe.isProxyWindow(n)?(Ce(c,r,s,n,e),n.awaitWindow().then((function(n){Ce(c,r,s,n,e)}))):Ce(c,r,s,n,e),me("cross_domain_function",{id:c,name:s})}function We(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){void 0===e&&(e=be);var r=JSON.stringify(n,(function(n){var r=this[n];if(we(this))return r;var t=ve(r);if(!t)return r;var o=e[t]||ge[t];return o?o(r,n):r}));return void 0===r?"undefined":r}(r,((o={}).promise=function(r,t){return function(n,e,r,t,o){return me("cross_domain_zalgo_promise",{then:Se(n,e,(function(n,e){return r.then(n,e)}),t,{on:o.on,send:o.send})})}(n,e,r,t,{on:i,send:a})},o.function=function(r,t){return Se(n,e,r,t,{on:i,send:a})},o.object=function(n){return $(n)||Oe.isProxyWindow(n)?me("cross_domain_window",Oe.serialize(n,{send:a})):n},o))}function je(n,e,r,t){var o,i=t.send;return function(n,e){if(void 0===e&&(e=_e),"undefined"!==n)return JSON.parse(n,(function(n,r){if(we(this))return r;var t,o;if(we(r)?(t=r.__type__,o=r.__val__):(t=ve(r),o=r),!t)return o;var i=e[t]||Ee[t];return i?i(o,n):o}))}(r,((o={}).cross_domain_zalgo_promise=function(n){return function(n,e,r){return new p(r.then)}(0,0,n)},o.cross_domain_function=function(r){return function(n,e,r,t){var o=r.id,i=r.name,a=t.send,u=function(r){function t(){var u=arguments;return Oe.toProxyWindow(n,{send:a}).awaitWindow().then((function(n){var c=De(n,o);if(c&&c.val!==t)return c.val.apply({source:window,origin:O()},u);var s=[].slice.call(u);return r.fireAndForget?a(n,"postrobot_method",{id:o,name:i,args:s},{domain:e,fireAndForget:!0}):a(n,"postrobot_method",{id:o,name:i,args:s},{domain:e,fireAndForget:!1}).then((function(n){return n.data.result}))})).catch((function(n){throw n}))}return void 0===r&&(r={}),t.__name__=i,t.__origin__=e,t.__source__=n,t.__id__=o,t.origin=e,t},c=u();return c.fireAndForget=u({fireAndForget:!0}),c}(n,e,r,{send:i})},o.cross_domain_window=function(n){return Oe.deserialize(n,{send:i})},o))}var Ne={};function Re(n,e,r,t){var o=t.on,i=t.send;return p.try((function(){var t=se().getOrSet(n,(function(){return{}}));return t.buffer=t.buffer||[],t.buffer.push(r),t.flush=t.flush||p.flush().then((function(){if(I(n))throw new Error("Window is closed");var r,a=We(n,e,((r={}).__post_robot_10_0_44__=t.buffer||[],r),{on:o,send:i});delete t.buffer;for(var u=Object.keys(Ne),c=[],s=0;s<u.length;s++){var f=u[s];try{Ne[f](n,a,e)}catch(n){c.push(n)}}if(c.length===u.length)throw new Error("All post-robot messaging strategies failed:\n\n"+c.map((function(n,e){return e+". "+hn(n)})).join("\n\n"))})),t.flush.then((function(){delete t.flush}))})).then(dn)}function Ae(n){return ie("responseListeners").get(n)}function Te(n){ie("responseListeners").del(n)}function Ie(n){return ie("erroredResponseListeners").has(n)}function ze(n){var e=n.name,r=n.win,t=n.domain,o=se("requestListeners");if("*"===r&&(r=null),"*"===t&&(t=null),!e)throw new Error("Name required to get request listener");for(var i=0,a=[r,ce()];i<a.length;i++){var u=a[i];if(u){var c=o.get(u);if(c){var s=c[e];if(s){if(t&&"string"==typeof t){if(s[t])return s[t];if(s.__domain_regex__)for(var f=0,d=s.__domain_regex__;f<d.length;f++){var l=d[f],h=l.listener;if(L(l.regex,t))return h}}if(s["*"])return s["*"]}}}}}function ke(n,e,r,t){var o=t.on,i=t.send,a=ze({name:r.name,win:n,domain:e}),u="postrobot_method"===r.name&&r.data&&"string"==typeof r.data.name?r.data.name+"()":r.name;function c(t,a,c){return p.flush().then((function(){if(!r.fireAndForget&&!I(n))try{return Re(n,e,{id:tn(),origin:O(window),type:"postrobot_message_response",hash:r.hash,name:r.name,ack:t,data:a,error:c},{on:o,send:i})}catch(n){throw new Error("Send response message failed for "+u+" in "+O()+"\n\n"+hn(n))}}))}return p.all([p.flush().then((function(){if(!r.fireAndForget&&!I(n))try{return Re(n,e,{id:tn(),origin:O(window),type:"postrobot_message_ack",hash:r.hash,name:r.name},{on:o,send:i})}catch(n){throw new Error("Send ack message failed for "+u+" in "+O()+"\n\n"+hn(n))}})),p.try((function(){if(!a)throw new Error("No handler found for post message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!L(a.domain,e))throw new Error("Request origin "+e+" does not match domain "+a.domain.toString());return a.handler({source:n,origin:e,data:r.data})})).then((function(n){return c("success",n)}),(function(n){return c("error",null,n)}))]).then(dn).catch((function(n){if(a&&a.handleError)return a.handleError(n);throw n}))}function Fe(n,e,r){if(!Ie(r.hash)){var t=Ae(r.hash);if(!t)throw new Error("No handler found for post message ack for message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!L(t.domain,e))throw new Error("Ack origin "+e+" does not match domain "+t.domain.toString());if(n!==t.win)throw new Error("Ack source does not match registered window")}catch(n){t.promise.reject(n)}t.ack=!0}}function Me(n,e,r){if(!Ie(r.hash)){var t,o=Ae(r.hash);if(!o)throw new Error("No handler found for post message response for message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!L(o.domain,e))throw new Error("Response origin "+e+" does not match domain "+(t=o.domain,Array.isArray(t)?"("+t.join(" | ")+")":w(t)?"RegExp("+t.toString()+")":t.toString()));if(n!==o.win)throw new Error("Response source does not match registered window");Te(r.hash),"error"===r.ack?o.promise.reject(r.error):"success"===r.ack&&o.promise.resolve({source:n,origin:e,data:r.data})}}function Ue(n,e){var r=e.on,t=e.send,o=ie("receivedMessages");try{if(!window||window.closed||!n.source)return}catch(n){return}var i=n.source,a=n.origin,u=function(n,e,r,t){var o,i=t.on,a=t.send;try{o=je(e,r,n,{on:i,send:a})}catch(n){return}if(o&&"object"==typeof o&&null!==o){var u=o.__post_robot_10_0_44__;if(Array.isArray(u))return u}}(n.data,i,a,{on:r,send:t});if(u){pe(i);for(var c=0;c<u.length;c++){var s=u[c];if(o.has(s.id))return;if(o.set(s.id,!0),I(i)&&!s.fireAndForget)return;0===s.origin.indexOf("file:")&&(a="file://");try{"postrobot_message_request"===s.type?ke(i,a,s,{on:r,send:t}):"postrobot_message_response"===s.type?Me(i,a,s):"postrobot_message_ack"===s.type&&Fe(i,a,s)}catch(n){setTimeout((function(){throw n}),0)}}}}function Le(n,e,r){if(!n)throw new Error("Expected name");if("function"==typeof(e=e||{})&&(r=e,e={}),!r)throw new Error("Expected handler");(e=e||{}).name=n,e.handler=r||e.handler;var t=e.window,o=e.domain,i=function n(e,r){var t=e.name,o=e.win,i=e.domain,a=se("requestListeners");if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var u=[],c=0,s=o;c<s.length;c++)u.push(n({name:t,domain:i,win:s[c]},r));return{cancel:function(){for(var n=0;n<u.length;n++)u[n].cancel()}}}if(Array.isArray(i)){for(var f=[],d=0,l=i;d<l.length;d++)f.push(n({name:t,win:o,domain:l[d]},r));return{cancel:function(){for(var n=0;n<f.length;n++)f[n].cancel()}}}var h=ze({name:t,win:o,domain:i});if(o&&"*"!==o||(o=ce()),i=i||"*",h)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===ce()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===ce()?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+t+" on domain "+i.toString()):new Error("Request listener already exists for "+t);var p,w,v=a.getOrSet(o,(function(){return{}})),m=Cn(v,t,(function(){return{}})),y=i.toString();return On(i)?(p=Cn(m,"__domain_regex__",(function(){return[]}))).push(w={regex:i,listener:r}):m[y]=r,{cancel:function(){delete m[y],w&&(p.splice(p.indexOf(w,1)),p.length||delete m.__domain_regex__),Object.keys(m).length||delete v[t],o&&!Object.keys(v).length&&a.del(o)}}}({name:n,win:t,domain:o},{handler:e.handler,handleError:e.errorHandler||function(n){throw n},window:t,domain:o||"*",name:n});return{cancel:function(){i.cancel()}}}Ne.postrobot_post_message=function(n,e,r){0===r.indexOf("file:")&&(r="*"),n.postMessage(e,r)},Ne.postrobot_global=function(n,e){if(!function(n){return(n=n||window).navigator.mockUserAgent||n.navigator.userAgent}(window).match(/MSIE|rv:11|trident|edge\/12|edge\/13/i))throw new Error("Global messaging not needed for browser");if(!C(n))throw new Error("Post message through global disabled between different domain windows");if(!1!==U(window,n))throw new Error("Can only use global to communicate between two different windows, not between frames");var r=te(n);if(!r)throw new Error("Can not find postRobot global on foreign window");r.receiveMessage({source:window,origin:O(),data:e})};var qe=function n(e,r,t,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,u=o.timeout||5e3,c=o.fireAndForget||!1;return p.try((function(){if(function(n,e,r){if(!n)throw new Error("Expected name");if(r&&"string"!=typeof r&&!Array.isArray(r)&&!On(r))throw new TypeError("Can not send "+n+". Expected domain "+JSON.stringify(r)+" to be a string, array, or regex");if(I(e))throw new Error("Can not send "+n+". Target window is closed")}(r,e,i),function(n,e){var r=k(e);if(r)return r===n;if(e===n)return!1;if(N(e)===e)return!1;for(var t=0,o=W(n);t<o.length;t++)if(o[t]===e)return!0;return!1}(window,e))return function(n,e,r){void 0===e&&(e=5e3),void 0===r&&(r="Window");var t=function(n){return se("helloPromises").getOrSet(n,(function(){return new p}))}(n);return-1!==e&&(t=t.timeout(e,new Error(r+" did not load after "+e+"ms"))),t}(e,u)})).then((function(r){return function(n,e,r,t){var o=t.send;return p.try((function(){return"string"==typeof e?e:p.try((function(){return r||le(n,{send:o}).then((function(n){return n.domain}))})).then((function(n){if(!L(e,e))throw new Error("Domain "+pn(e)+" does not match "+pn(e));return n}))}))}(e,i,(void 0===r?{}:r).domain,{send:n})})).then((function(o){var i=o,u="postrobot_method"===r&&t&&"string"==typeof t.name?t.name+"()":r,s=new p,f=r+"_"+tn();if(!c){var d={name:r,win:e,domain:i,promise:s};!function(n,e){ie("responseListeners").set(n,e)}(f,d);var l=se("requestPromises").getOrSet(e,(function(){return[]}));l.push(s),s.catch((function(){!function(n){ie("erroredResponseListeners").set(n,!0)}(f),Te(f)}));var h=function(n){return se("knownWindows").get(n,!1)}(e)?1e4:2e3,w=a,v=h,m=w,y=mn((function(){return I(e)?s.reject(new Error("Window closed for "+r+" before "+(d.ack?"response":"ack"))):d.cancelled?s.reject(new Error("Response listener was cancelled for "+r)):(v=Math.max(v-500,0),-1!==m&&(m=Math.max(m-500,0)),d.ack||0!==v?0===m?s.reject(new Error("No response for postMessage "+u+" in "+O()+" in "+w+"ms")):void 0:s.reject(new Error("No ack for postMessage "+u+" in "+O()+" in "+h+"ms")))}),500);s.finally((function(){y.cancel(),l.splice(l.indexOf(s,1))})).catch(dn)}return Re(e,i,{id:tn(),origin:O(window),type:"postrobot_message_request",hash:f,name:r,data:t,fireAndForget:c},{on:Le,send:n}).then((function(){return c?s.resolve():s}),(function(n){throw new Error("Send request message failed for "+u+" in "+O()+"\n\n"+hn(n))}))}))};function Be(n){return Oe.toProxyWindow(n,{send:qe})}function $e(n){if(!C(n))throw new Error("Can not get global for window on different domain");return n.__zoid_9_0_86__||(n.__zoid_9_0_86__={}),n.__zoid_9_0_86__}function Je(n,e){try{return e($e(n))}catch(n){}}function He(n){return{get:function(){var e=this;return p.try((function(){if(e.source&&e.source!==window)throw new Error("Can not call get on proxy object from a remote window");return n}))}}}function Ye(n){return rn(JSON.stringify(n))}function Ze(n){var e=$e(n);return e.references=e.references||{},e.references}function Ge(n){var e,r,t=n.data,o=n.metaData,i=n.sender,a=n.receiver,u=n.passByReference,c=void 0!==u&&u,s=n.basic,f=void 0!==s&&s,d=Be(a.win),l=f?JSON.stringify(t):We(d,a.domain,t,{on:Le,send:qe}),h=c?(e=l,r=tn(),Ze(window)[r]=e,{type:"uid",uid:r}):function(n){return{type:"raw",val:n}}(l);return{serializedData:Ye({sender:{domain:i.domain},metaData:o,reference:h}),cleanReference:function(){var n,e;n=window,"uid"===(e=h).type&&delete Ze(n)[e.uid]}}}function Ve(n){var e,r,t=n.sender,o=n.basic,i=void 0!==o&&o,a=function(n){return JSON.parse(function(n){if("function"==typeof atob)return decodeURIComponent([].map.call(atob(n),(function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)})).join(""));if("undefi