text: !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){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}function o(){return(o=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 i(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 kn})),r.d(e,"create",(function(){return tr})),r.d(e,"destroy",(function(){return ur})),r.d(e,"destroyComponents",(function(){return or})),r.d(e,"destroyAll",(function(){return ir})),r.d(e,"PROP_TYPE",(function(){return Me})),r.d(e,"PROP_SERIALIZATION",(function(){return Le})),r.d(e,"CONTEXT",(function(){return qe})),r.d(e,"EVENT",(function(){return Ue}));var u,a=[],c=[],s=0;function f(){if(!s&&u){var n=u;u=null,n.resolve()}}function d(){s+=1}function l(){s-=1,f()}var h=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,u=!1;d();try{n((function(n){u?e.resolve(n):(o=!0,r=n)}),(function(n){u?e.reject(n):(i=!0,t=n)}))}catch(n){return l(),void this.reject(n)}l(),u=!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(i(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(i(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===a.indexOf(n)){a.push(n),setTimeout((function(){throw n}),1);for(var r=0;r<c.length;r++)c[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,d();for(var o=function(n,e){return n.then((function(n){e.resolve(n)}),(function(n){e.reject(n)}))},u=0;u<t.length;u++){var a=t[u],c=a.onSuccess,s=a.onError,f=a.promise,h=void 0;if(e)try{h=c?c(this.value):this.value}catch(n){f.reject(n);continue}else if(r){if(!s){f.reject(this.error);continue}try{h=s(this.error)}catch(n){f.reject(n);continue}}h instanceof n&&(h.resolved||h.rejected)?(h.resolved?f.resolve(h.value):f.reject(h.error),h.errorHandled=!0):i(h)?h instanceof n&&(h.resolved||h.rejected)?h.resolved?f.resolve(h.value):f.reject(h.error):o(h,f):f.resolve(h)}t.length=0,this.dispatching=!1,l()}},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)},n.resolve=function(e){return e instanceof n?e:i(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=[];if(!t)return r.resolve(o),r;for(var u=function(n,e,i){return e.then((function(e){o[n]=e,0==(t-=1)&&r.resolve(o)}),(function(n){i.reject(n)}))},a=0;a<e.length;a++){var c=e[a];if(c instanceof n){if(c.resolved){o[a]=c.value,t-=1;continue}}else if(!i(c)){o[a]=c,t-=1;continue}u(a,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];i(o)?t.push(o.then((function(e){r[n]=e}))):r[n]=o}};for(var u in e)o(u);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 c.push(n),{cancel:function(){c.splice(c.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;d();try{o=e.apply(r,t||[])}catch(e){return l(),n.reject(e)}return l(),n.resolve(o)},n.delay=function(e){return new n((function(n){setTimeout(n,e)}))},n.isPromise=function(e){return!!(e&&e instanceof n)||i(e)},n.flush=function(){return e=u=u||new n,f(),e;var e},n}();function w(n){return"[object RegExp]"==={}.toString.call(n)}var p={IFRAME:"iframe",POPUP:"popup"},v="Call was rejected by callee.\r\n";function m(n){return void 0===n&&(n=window),"about:"===n.location.protocol}function y(n){if(void 0===n&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function g(n){if(void 0===n&&(n=window),n&&!y(n))try{return n.opener}catch(n){}}function _(n){try{return!0}catch(n){}return!1}function E(n){void 0===n&&(n=window);var e=n.location;if(!e)throw new Error("Can not read window location");var r=e.protocol;if(!r)throw new Error("Can not read window protocol");if("file:"===r)return"file://";if("about:"===r){var t=y(n);return t&&_()?E(t):"about://"}var o=e.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function b(n){void 0===n&&(n=window);var e=E(n);return e&&n.mockDomain&&0===n.mockDomain.indexOf("mock:")?n.mockDomain:e}function x(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(m(n)&&_())return!0}catch(n){}try{if(E(n)===E(window))return!0}catch(n){}return!1}(n))return!1;try{if(n===window)return!0;if(m(n)&&_())return!0;if(b(window)===b(n))return!0}catch(n){}return!1}function P(n){if(!x(n))throw new Error("Expected window to be same domain");return n}function O(n,e){if(!n||!e)return!1;var r=y(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 u=0;u<100;u++){var a=void 0;try{a=e[u]}catch(n){return t}if(!a)return t;t.push(a)}return t}function S(n){for(var e=[],r=0,t=W(n);r<t.length;r++){var o=t[r];e.push(o);for(var i=0,u=S(o);i<u.length;i++)e.push(u[i])}return e}function C(n){void 0===n&&(n=window);try{if(n.top)return n.top}catch(n){}if(y(n)===n)return n;try{if(O(window,n)&&window.top)return window.top}catch(n){}try{if(O(n,window)&&window.top)return window.top}catch(n){}for(var e=0,r=S(n);e<r.length;e++){var t=r[e];try{if(t.top)return t.top}catch(n){}if(y(t)===t)return t}}function D(n){var e=C(n);if(!e)throw new Error("Can not determine top window");var r=[].concat(S(e),[e]);return-1===r.indexOf(n)&&(r=[].concat(r,[n],S(n))),r}var j=[],R=[];function k(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!==v}if(e&&x(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}(j,n);if(-1!==r){var t=R[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 A(n){return void 0===n&&(n=window),g(n=n||window)||y(n)||void 0}function z(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 T(n){void 0===n&&(n=window);for(var e=0,r=n;r;)(r=y(r))&&(e+=1);return e}function N(n,e){var r=C(n)||n,t=C(e)||e;try{if(r&&t)return r===t}catch(n){}var o=D(n),i=D(e);if(z(o,i))return!0;var u=g(r),a=g(t);return u&&z(D(u),i)||a&&z(D(a),o),!1}function I(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 I(n,e)})))}function F(n){return n.match(/^(https?|mock|file):\/\//)?n.split("/").slice(0,3).join("/"):b()}function M(n,e,r,t){var o;return void 0===r&&(r=1e3),void 0===t&&(t=1/0),function i(){if(k(n))return o&&clearTimeout(o),e();t<=0?clearTimeout(o):(t-=r,o=setTimeout(i,r))}(),{cancel:function(){o&&clearTimeout(o)}}}function L(n){try{if(n===window)return!0}catch(n){if(n&&n.message===v)return!0}try{if("[object Window]"==={}.toString.call(n))return!0}catch(n){if(n&&n.message===v)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===v)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===v)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===v)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===v)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 q(n){try{n.close()}catch(n){}}function U(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}var B,J=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(L(t)&&k(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!L(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,u=this.values,a=U(i,n);-1===a?(i.push(n),u.push(e)):u[a]=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=U(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=U(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!==U(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 H(n){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function Y(n,e){return(Y=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n})(n,e)}function Z(){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 V(n,e,r){return(V=Z()?Reflect.construct:function(n,e,r){var t=[null];t.push.apply(t,e);var o=new(Function.bind.apply(n,t));return r&&Y(o,r.prototype),o}).apply(null,arguments)}function $(n){var e="function"==typeof Map?new Map:void 0;return($=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 V(n,arguments,H(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Y(r,n)})(n)}function G(n){return n.name||n.__name__||n.displayName||"anonymous"}function X(n,e){try{delete n.name,n.name=e}catch(n){}return n.__name__=n.displayName=e,n}function K(n){if("function"==typeof btoa)return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(function(n,e){return String.fromCharCode(parseInt(e,16))})));if("undefined"!=typeof Buffer)return Buffer.from(n,"utf8").toString("base64");throw new Error("Can not find window.btoa or Buffer")}function Q(){var n="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,(function(){return n.charAt(Math.floor(Math.random()*n.length))}))+"_"+K((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function nn(n){try{return JSON.stringify([].slice.call(n),(function(n,e){return"function"==typeof e?"memoize["+function(n){if(B=B||new J,null==n||"object"!=typeof n&&"function"!=typeof n)throw new Error("Invalid object");var e=B.get(n);return e||(e=typeof n+":"+Q(),B.set(n,e)),e}(e)+"]":e}))}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}function en(){return{}}var rn=0,tn=0;function on(n,e){void 0===e&&(e={});var r,t,o=e.thisNamespace,i=void 0!==o&&o,u=e.time,a=rn;rn+=1;var c=function(){for(var e=arguments.length,o=new Array(e),c=0;c<e;c++)o[c]=arguments[c];var s;a<tn&&(r=null,t=null,a=rn,rn+=1),s=i?(t=t||new J).getOrSet(this,en):r=r||{};var f=nn(o),d=s[f];if(d&&u&&Date.now()-d.time<u&&(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},X(c,(e.name||G(n))+"::memoized")}function un(n){var e={};function r(){for(var r=arguments,t=this,o=arguments.length,i=new Array(o),u=0;u<o;u++)i[u]=arguments[u];var a=nn(i);return e.hasOwnProperty(a)||(e[a]=h.try((function(){return n.apply(t,r)})).finally((function(){delete e[a]}))),e[a]}return r.reset=function(){e={}},X(r,G(n)+"::promiseMemoized")}function an(n,e,r){void 0===r&&(r=[]);var t=n.__inline_memoize_cache__=n.__inline_memoize_cache__||{},o=nn(r);return t.hasOwnProperty(o)?t[o]:t[o]=e.apply(void 0,r)}function cn(){}function sn(n){var e=!1;return X((function(){if(!e)return e=!0,n.apply(this,arguments)}),G(n)+"::once")}function fn(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: "+fn(n,e+1)}}function dn(n){return"string"==typeof n?n:n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}function ln(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 hn(n){return n}function wn(n,e){var r;return function t(){r=setTimeout((function(){n(),t()}),e)}(),{cancel:function(){clearTimeout(r)}}}function pn(n){return[].slice.call(n)}function vn(n){return null!=n}function mn(n){return"[object RegExp]"==={}.toString.call(n)}function yn(n,e,r){if(n.hasOwnProperty(e))return n[e];var t=r();return n[e]=t,t}function gn(n){var e,r=[],t=!1;return{set:function(e,r){return t||(n[e]=r,this.register((function(){delete n[e]}))),r},register:function(n){t?n(e):r.push(sn((function(){return n(e)})))},all:function(n){e=n;var o=[];for(t=!0;r.length;){var i=r.shift();o.push(i())}return h.all(o).then(cn)}}}function _n(n,e){if(null==e)throw new Error("Expected "+n+" to be present");return e}on.clear=function(){tn=rn},on((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 En=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 t(e,n),e}($(Error));function bn(){return Boolean(document.body)&&"complete"===document.readyState}function xn(){return Boolean(document.body)&&"interactive"===document.readyState}function Pn(n){return n.replace(/\?/g,"%3F").replace(/&/g,"%26").replace(/#/g,"%23").replace(/\+/g,"%2B")}function On(n){return an(On,(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}),[n])}function Wn(n,e){return void 0===e&&(e={}),e&&Object.keys(e).length?(void 0===(r=o({},On(n),e))&&(r={}),Object.keys(r).filter((function(n){return"string"==typeof r[n]})).map((function(n){return Pn(n)+"="+Pn(r[n])})).join("&")):n;var r}function Sn(n,e){n.appendChild(e)}function Cn(n){return n instanceof window.Element||null!==n&&"object"==typeof n&&1===n.nodeType&&"object"==typeof n.style&&"object"==typeof n.ownerDocument}function Dn(n,e){return void 0===e&&(e=document),Cn(n)?n:"string"==typeof n?e.querySelector(n):void 0}function jn(n){return new h((function(e,r){var t=dn(n),o=Dn(n);if(o)return e(o);if(bn())return r(new Error("Document is ready and element "+t+" does not exist"));var i=setInterval((function(){return(o=Dn(n))?(clearInterval(i),e(o)):bn()?(clearInterval(i),r(new Error("Document is ready and element "+t+" does not exist"))):void 0}),10)}))}on((function(){return new h((function(n){if(bn()||xn())return n();var e=setInterval((function(){if(bn()||xn())return clearInterval(e),n()}),10)}))}));var Rn,kn=function(n){function e(){return n.apply(this,arguments)||this}return t(e,n),e}(En);function An(n){if((Rn=Rn||new J).has(n)){var e=Rn.get(n);if(e)return e}var r=new h((function(e,r){n.addEventListener("load",(function(){(function(n){if(function(){for(var n=0;n<j.length;n++){var e=!1;try{e=j[n].closed}catch(n){}e&&(R.splice(n,1),j.splice(n,1))}}(),n&&n.contentWindow)try{j.push(n.contentWindow),R.push(n)}catch(n){}})(n),e(n)})),n.addEventListener("error",(function(t){n.contentWindow?e(n):r(t)}))}));return Rn.set(n,r),r}function zn(n){return An(n).then((function(n){if(!n.contentWindow)throw new Error("Could not find window in iframe");return n.contentWindow}))}function Tn(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,u=document.createElement(n);if(e.style&&ln(u.style,e.style),e.class&&(u.className=e.class.join(" ")),e.id&&u.setAttribute("id",e.id),e.attributes)for(var a=0,c=Object.keys(e.attributes);a<c.length;a++){var s=c[a];u.setAttribute(s,e.attributes[s])}if(e.styleSheet&&(t=u,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");u.innerHTML=e.html}return u}("iframe",{attributes:o({allowTransparency:"true"},n.attributes||{}),style:o({backgroundColor:"transparent",border:"none"},r),html:n.html,class:n.class}),i=window.navigator.userAgent.match(/MSIE|Edge/i);return t.hasAttribute("id")||t.setAttribute("id",Q()),An(t),e&&function(n,e){void 0===e&&(e=document);var r=Dn(n,e);if(r)return r;throw new Error("Can not find element: "+dn(n))}(e).appendChild(t),(n.url||i)&&t.setAttribute("src",n.url||"about:blank"),t}function Nn(n,e,r){return n.addEventListener(e,r),{cancel:function(){n.removeEventListener(e,r)}}}function In(n){n.style.setProperty("display","")}function Fn(n){n.style.setProperty("display","none","important")}function Mn(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function Ln(n){return!(n&&n.parentNode&&n.ownerDocument&&n.ownerDocument.documentElement&&n.ownerDocument.documentElement.contains(n))}function qn(n,e,r){var t=void 0===r?{}:r,o=t.width,i=void 0===o||o,u=t.height,a=void 0===u||u,c=t.interval,s=void 0===c?100:c,f=t.win,d=void 0===f?window:f,l=n.offsetWidth,h=n.offsetHeight,w=!1;e({width:l,height:h});var p,v,m=function(){if(!w&&function(n){return Boolean(n.offsetWidth||n.offsetHeight||n.getClientRects().length)}(n)){var r=n.offsetWidth,t=n.offsetHeight;(i&&r!==l||a&&t!==h)&&e({width:r,height:t}),l=r,h=t}};return d.addEventListener("resize",m),void 0!==d.ResizeObserver?((p=new d.ResizeObserver(m)).observe(n),v=wn(m,10*s)):void 0!==d.MutationObserver?((p=new d.MutationObserver(m)).observe(n,{attributes:!0,childList:!0,subtree:!0,characterData:!1}),v=wn(m,10*s)):v=wn(m,s),{cancel:function(){w=!0,p.disconnect(),window.removeEventListener("resize",m),v.cancel()}}}function Un(n){for(;n.parentNode;)n=n.parentNode;return"[object ShadowRoot]"===n.toString()}var Bn="undefined"!=typeof document?document.currentScript:null,Jn=on((function(){if(Bn)return Bn;if(Bn=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 Bn;throw new Error("Can not determine current script")})),Hn=Q();function Yn(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 Zn(n){return"number"==typeof n?Yn(n):"string"==typeof(e=n)&&/^[0-9]+%$/.test(e)?n:Yn(n);var e}function Vn(n){void 0===n&&(n=window);var e="__post_robot_10_0_42__";return n!==window?n[e]:n[e]=n[e]||{}}on((function(){var n;try{n=Jn()}catch(n){return Hn}var e=n.getAttribute("data-uid");return e&&"string"==typeof e||(e=n.getAttribute("data-uid-auto"))&&"string"==typeof e||(e=Q(),n.setAttribute("data-uid-auto",e)),e}));var $n=function(){return{}};function Gn(n,e){return void 0===n&&(n="store"),void 0===e&&(e=$n),yn(Vn(),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 yn(n,e,r)},reset:function(){n=e()},keys:function(){return Object.keys(n)}}}))}var Xn,Kn=function(){};function Qn(){var n=Vn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new Kn,n.WINDOW_WILDCARD}function ne(n,e){return void 0===n&&(n="store"),void 0===e&&(e=$n),Gn("windowStore").getOrSet(n,(function(){var r=new J,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 yn(t(e),n,r)}}}))}function ee(){return Gn("instance").getOrSet("instanceID",Q)}function re(n,e){var r=e.domain,t=ne("helloPromises"),o=t.get(n);o&&o.resolve({domain:r});var i=h.resolve({domain:r});return t.set(n,i),i}function te(n,e){return(0,e.send)(n,"postrobot_hello",{instanceID:ee()},{domain:"*",timeout:-1}).then((function(e){var r=e.origin,t=e.data.instanceID;return re(n,{domain:r}),{win:n,domain:r,instanceID:t}}))}function oe(n,e){var r=e.send;return ne("windowInstanceIDPromises").getOrSet(n,(function(){return te(n,{send:r}).then((function(n){return n.instanceID}))}))}function ie(n){ne("knownWindows").set(n,!0)}function ue(n){return"object"==typeof n&&null!==n&&"string"==typeof n.__type__}function ae(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 ce(n,e){return{__type__:n,__val__:e}}var se,fe=((Xn={}).function=function(){},Xn.error=function(n){return ce("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},Xn.promise=function(){},Xn.regex=function(n){return ce("regex",n.source)},Xn.date=function(n){return ce("date",n.toJSON())},Xn.array=function(n){return n},Xn.object=function(n){return n},Xn.string=function(n){return n},Xn.number=function(n){return n},Xn.boolean=function(n){return n},Xn.null=function(n){return n},Xn),de={},le=((se={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},se.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},se.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},se.regex=function(n){return new RegExp(n)},se.date=function(n){return new Date(n)},se.array=function(n){return n},se.object=function(n){return n},se.string=function(n){return n},se.number=function(n){return n},se.boolean=function(n){return n},se.null=function(n){return n},se),he={};function we(){for(var n=Gn("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?Q():t,i=n.then((function(n){if(x(n))return P(n).name})),u=n.then((function(n){if(k(n))throw new Error("Window is closed, can not determine type");return g(n)?p.POPUP:p.IFRAME}));return i.catch(cn),u.catch(cn),{id:o,getType:function(){return u},getInstanceID:un((function(){return n.then((function(n){return oe(n,{send:r})}))})),close:function(){return n.then(q)},getName:function(){return n.then((function(n){if(!k(n))return x(n)?P(n).name:i}))},focus:function(){return n.then((function(n){n.focus()}))},isClosed:function(){return n.then((function(n){return k(n)}))},setLocation:function(e){return n.then((function(n){var r=window.location.protocol+"//"+window.location.host;if(0===e.indexOf("/"))e=""+r+e;else if(!e.match(/^https?:\/\//)&&0!==e.indexOf(r))throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(e));if(x(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=x(n),t=function(n){if(x(n))return P(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}}(n);if(!r)throw new Error("Can not set name for cross-domain window: "+e);P(n).name=e,t&&t.setAttribute("name",e),i=h.resolve(e)}))}}}new h((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 ve=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 h,this.serializedWindow=t||pe(this.actualWindowPromise,{send:e}),Gn("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===p.POPUP}))},e.setLocation=function(n){var e=this;return this.serializedWindow.setLocation(n).then((function(){return e}))},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=h.hash({isPopup:e,name:r}).then((function(n){var e=n.name;n.isPopup&&e&&window.open("",e)})),o=this.serializedWindow.focus();return h.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()}),ne("winToProxyWindow").set(n,this)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(n,e){var r=this,t=e.send;return h.try((function(){return r.actualWindow?n===r.actualWindow:h.hash({proxyInstanceID:r.getInstanceID(),knownWindowInstanceID:oe(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&&k(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 we(),n.toProxyWindow(e,{send:t}).serialize()},n.deserialize=function(e,r){var t=r.send;return we(),Gn("idToProxyWindow").get(e.id)||new n({serializedWindow:e,send:t})},n.isProxyWindow=function(n){return Boolean(n&&!L(n)&&n.isProxyWindow)},n.toProxyWindow=function(e,r){var t=r.send;if(we(),n.isProxyWindow(e))return e;var o=e;return ne("winToProxyWindow").get(o)||new n({win:o,send:t})},n}();function me(n,e,r,t,o){var i=ne("methodStore"),u=Gn("proxyWindowMethods");ve.isProxyWindow(t)?u.set(n,{val:e,name:r,domain:o,source:t}):(u.del(n),i.getOrSet(t,(function(){return{}}))[n]={domain:o,name:r,val:e,source:t})}function ye(n,e){var r=ne("methodStore"),t=Gn("proxyWindowMethods");return r.getOrSet(n,(function(){return{}}))[e]||t.get(e)}function ge(n,e,r,t,o){var i,u,a;u=(i={on:o.on,send:o.send}).on,a=i.send,Gn("builtinListeners").getOrSet("functionCalls",(function(){return u("postrobot_method",{domain:"*"},(function(n){var e=n.source,r=n.origin,t=n.data,o=t.id,i=t.name,u=ye(e,o);if(!u)throw new Error("Could not find method '"+i+"' with id: "+t.id+" in "+b(window));var c=u.source,s=u.domain,f=u.val;return h.try((function(){if(!I(s,r))throw new Error("Method '"+t.name+"' domain "+JSON.stringify(mn(u.domain)?u.domain.source:u.domain)+" does not match origin "+r+" in "+b(window));if(ve.isProxyWindow(c))return c.matchWindow(e,{send:a}).then((function(n){if(!n)throw new Error("Method call '"+t.name+"' failed - proxy window does not match source in "+b(window))}))})).then((function(){return f.apply({source:e,origin:r},t.args)}),(function(n){return h.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=[]),pn(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__||Q();n=ve.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+"::")),ve.isProxyWindow(n)?(me(c,r,s,n,e),n.awaitWindow().then((function(n){me(c,r,s,n,e)}))):me(c,r,s,n,e),ce("cross_domain_function",{id:c,name:s})}function _e(n,e,r,t){var o,i=t.on,u=t.send;return function(n,e){void 0===e&&(e=de);var r=JSON.stringify(n,(function(n){var r=this[n];if(ue(this))return r;var t=ae(r);if(!t)return r;var o=e[t]||fe[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 ce("cross_domain_zalgo_promise",{then:ge(n,e,(function(n,e){return r.then(n,e)}),t,{on:o.on,send:o.send})})}(n,e,r,t,{on:i,send:u})},o.function=function(r,t){return ge(n,e,r,t,{on:i,send:u})},o.object=function(n){return L(n)||ve.isProxyWindow(n)?ce("cross_domain_window",ve.serialize(n,{send:u})):n},o))}function Ee(n,e,r,t){var o,i=t.send;return function(n,e){if(void 0===e&&(e=he),"undefined"!==n)return JSON.parse(n,(function(n,r){if(ue(this))return r;var t,o;if(ue(r)?(t=r.__type__,o=r.__val__):(t=ae(r),o=r),!t)return o;var i=e[t]||le[t];return i?i(o,n):o}))}(r,((o={}).cross_domain_zalgo_promise=function(n){return function(n,e,r){return new h(r.then)}(0,0,n)},o.cross_domain_function=function(r){return function(n,e,r,t){var o=r.id,i=r.name,u=t.send,a=function(r){function t(){var a=arguments;return ve.toProxyWindow(n,{send:u}).awaitWindow().then((function(n){var c=ye(n,o);if(c&&c.val!==t)return c.val.apply({source:window,origin:b()},a);var s=[].slice.call(a);return r.fireAndForget?u(n,"postrobot_method",{id:o,name:i,args:s},{domain:e,fireAndForget:!0}):u(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=a();return c.fireAndForget=a({fireAndForget:!0}),c}(n,e,r,{send:i})},o.cross_domain_window=function(n){return ve.deserialize(n,{send:i})},o))}var be={};function xe(n,e,r,t){var o=t.on,i=t.send;return h.try((function(){var t=ne().getOrSet(n,(function(){return{}}));return t.buffer=t.buffer||[],t.buffer.push(r),t.flush=t.flush||h.flush().then((function(){if(k(n))throw new Error("Window is closed");var r,u=_e(n,e,((r={}).__post_robot_10_0_42__=t.buffer||[],r),{on:o,send:i});delete t.buffer;for(var a=Object.keys(be),c=[],s=0;s<a.length;s++){var f=a[s];try{be[f](n,u,e)}catch(n){c.push(n)}}if(c.length===a.length)throw new Error("All post-robot messaging strategies failed:\n\n"+c.map((function(n,e){return e+". "+fn(n)})).join("\n\n"))})),t.flush.then((function(){delete t.flush}))})).then(cn)}function Pe(n){return Gn("responseListeners").get(n)}function Oe(n){Gn("responseListeners").del(n)}function We(n){return Gn("erroredResponseListeners").has(n)}function Se(n){var e=n.name,r=n.win,t=n.domain,o=ne("requestListeners");if("*"===r&&(r=null),"*"===t&&(t=null),!e)throw new Error("Name required to get request listener");for(var i=0,u=[r,Qn()];i<u.length;i++){var a=u[i];if(a){var c=o.get(a);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(I(l.regex,t))return h}}if(s["*"])return s["*"]}}}}}function Ce(n,e,r,t){var o=t.on,i=t.send,u=Se({name:r.name,win:n,domain:e}),a="postrobot_method"===r.name&&r.data&&"string"==typeof r.data.name?r.data.name+"()":r.name;function c(t,u,c){return h.flush().then((function(){if(!r.fireAndForget&&!k(n))try{return xe(n,e,{id:Q(),origin:b(window),type:"postrobot_message_response",hash:r.hash,name:r.name,ack:t,data:u,error:c},{on:o,send:i})}catch(n){throw new Error("Send response message failed for "+a+" in "+b()+"\n\n"+fn(n))}}))}return h.all([h.flush().then((function(){if(!r.fireAndForget&&!k(n))try{return xe(n,e,{id:Q(),origin:b(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 "+a+" in "+b()+"\n\n"+fn(n))}})),h.try((function(){if(!u)throw new Error("No handler found for post message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!I(u.domain,e))throw new Error("Request origin "+e+" does not match domain "+u.domain.toString());return u.handler({source:n,origin:e,data:r.data})})).then((function(n){return c("success",n)}),(function(n){return c("error",null,n)}))]).then(cn).catch((function(n){if(u&&u.handleError)return u.handleError(n);throw n}))}function De(n,e,r){if(!We(r.hash)){var t=Pe(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(!I(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 je(n,e,r){if(!We(r.hash)){var t,o=Pe(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(!I(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");Oe(r.hash),"error"===r.ack?o.promise.reject(r.error):"success"===r.ack&&o.promise.resolve({source:n,origin:e,data:r.data})}}function Re(n,e){var r=e.on,t=e.send,o=Gn("receivedMessages");try{if(!window||window.closed||!n.source)return}catch(n){return}var i=n.source,u=n.origin,a=function(n,e,r,t){var o,i=t.on,u=t.send;try{o=Ee(e,r,n,{on:i,send:u})}catch(n){return}if(o&&"object"==typeof o&&null!==o){var a=o.__post_robot_10_0_42__;if(Array.isArray(a))return a}}(n.data,i,u,{on:r,send:t});if(a){ie(i);for(var c=0;c<a.length;c++){var s=a[c];if(o.has(s.id))return;if(o.set(s.id,!0),k(i)&&!s.fireAndForget)return;0===s.origin.indexOf("file:")&&(u="file://");try{"postrobot_message_request"===s.type?Ce(i,u,s,{on:r,send:t}):"postrobot_message_response"===s.type?je(i,u,s):"postrobot_message_ack"===s.type&&De(i,u,s)}catch(n){setTimeout((function(){throw n}),0)}}}}function ke(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,u=ne("requestListeners");if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var a=[],c=0,s=o;c<s.length;c++)a.push(n({name:t,domain:i,win:s[c]},r));return{cancel:function(){for(var n=0;n<a.length;n++)a[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=Se({name:t,win:o,domain:i});if(o&&"*"!==o||(o=Qn()),i=i||"*",h)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===Qn()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===Qn()?"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 w,p,v=u.getOrSet(o,(function(){return{}})),m=yn(v,t,(function(){return{}})),y=i.toString();return mn(i)?(w=yn(m,"__domain_regex__",(function(){return[]}))).push(p={regex:i,listener:r}):m[y]=r,{cancel:function(){delete m[y],p&&(w.splice(w.indexOf(p,1)),w.length||delete m.__domain_regex__),Object.keys(m).length||delete v[t],o&&!Object.keys(v).length&&u.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()}}}be.postrobot_post_message=function(n,e,r){0===r.indexOf("file:")&&(r="*"),n.postMessage(e,r)},be.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(!x(n))throw new Error("Post message through global disabled between different domain windows");if(!1!==N(window,n))throw new Error("Can only use global to communicate between two different windows, not between frames");var r=Vn(n);if(!r)throw new Error("Can not find postRobot global on foreign window");r.receiveMessage({source:window,origin:b(),data:e})};var Ae=function n(e,r,t,o){var i=(o=o||{}).domain||"*",u=o.timeout||-1,a=o.timeout||5e3,c=o.fireAndForget||!1;return h.try((function(){if(function(n,e,r){if(!n)throw new Error("Expected name");if(r&&"string"!=typeof r&&!Array.isArray(r)&&!mn(r))throw new TypeError("Can not send "+n+". Expected domain "+JSON.stringify(r)+" to be a string, array, or regex");if(k(e))throw new Error("Can not send "+n+". Target window is closed")}(r,e,i),function(n,e){var r=A(e);if(r)return r===n;if(e===n)return!1;if(C(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 ne("helloPromises").getOrSet(n,(function(){return new h}))}(n);return-1!==e&&(t=t.timeout(e,new Error(r+" did not load after "+e+"ms"))),t}(e,a)})).then((function(r){return function(n,e,r,t){var o=t.send;return h.try((function(){return"string"==typeof e?e:h.try((function(){return r||te(n,{send:o}).then((function(n){return n.domain}))})).then((function(n){if(!I(e,e))throw new Error("Domain "+dn(e)+" does not match "+dn(e));return n}))}))}(e,i,(void 0===r?{}:r).domain,{send:n})})).then((function(o){var i=o,a="postrobot_method"===r&&t&&"string"==typeof t.name?t.name+"()":r,s=new h,f=r+"_"+Q();if(!c){var d={name:r,win:e,domain:i,promise:s};!function(n,e){Gn("responseListeners").set(n,e)}(f,d);var l=ne("requestPromises").getOrSet(e,(function(){return[]}));l.push(s),s.catch((function(){!function(n){Gn("erroredResponseListeners").set(n,!0)}(f),Oe(f)}));var w=function(n){return ne("knownWindows").get(n,!1)}(e)?1e4:2e3,p=u,v=w,m=p,y=wn((function(){return k(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 "+a+" in "+b()+" in "+p+"ms")):void 0:s.reject(new Error("No ack for postMessage "+a+" in "+b()+" in "+w+"ms")))}),500);s.finally((function(){y.cancel(),l.splice(l.indexOf(s,1))})).catch(cn)}return xe(e,i,{id:Q(),origin:b(window),type:"postrobot_message_request",hash:f,name:r,data:t,fireAndForget:c},{on:ke,send:n}).then((function(){return c?s.resolve():s}),(function(n){throw new Error("Send request message failed for "+a+" in "+b()+"\n\n"+fn(n))}))}))};function ze(n,e,r){return _e(n,e,r,{on:ke,send:Ae})}function Te(n,e,r){return Ee(n,e,r,{on:ke,send:Ae})}function Ne(n){return ve.toProxyWindow(n,{send:Ae})}function Ie(n){if(void 0===n&&(n=window),!x(n))throw new Error("Can not get global for window on different domain");return n.__zoid_9_0_63__||(n.__zoid_9_0_63__={}),n.__zoid_9_0_63__}function Fe(n){return{get:function(){var e=this;return h.try((function(){if(e.source&&e.source!==window)throw new Error("Can not call get on proxy object from a remote window");return n}))}}}var Me={STRING:"string",OBJECT:"object",FUNCTION:"function",BOOLEAN:"boolean",NUMBER:"number",ARRAY:"array"},Le={JSON:"json",DOTIFY:"dotify",BASE64:"base64"},qe=p,Ue={RENDER:"zoid-render",RENDERED:"zoid-rendered",DISPLAY:"zoid-display",ERROR:"zoid-error",CLOSE:"zoid-close",DESTROY:"zoid-destroy",PROPS:"zoid-props",RESIZE:"zoid-resize",FOCUS:"zoid-focus"};function Be(n,e,r,t,o){if(!n.hasOwnProperty(r))return t;var i=n[r];return"function"==typeof i.childDecorate?i.childDecorate({value:t,uid:o.uid,close:o.close,focus:o.focus,onError:o.onError,onProps:o.onProps,resize:o.resize,getParent:o.getParent,getParentDomain:o.getParentDomain,show:o.show,hide:o.hide}):t}function Je(n){return an(Je,(function(){if(!n)throw new Error("No window name");var e=n.split("__"),r=e[1],t=e[2],o=e[3];if("zoid"!==r)throw new Error("Window not rendered by zoid - got "+r);if(!t)throw new Error("Expected component name");if(!o)throw new Error("Expected encoded payload");try{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("undefined"!=typeof Buffer)return Buffer.from(n,"base64").toString("utf8");throw new Error("Can not find window.atob or Buffer")}(o))}catch(n){throw new Error("Can not decode window name payload: "+o+": "+fn(n))}}),[n])}function He(){try{return Je(window.name)}catch(n){}}function Ye(){return h.try((function(){window.focus()}))}function Ze(){return h.try((function(){window.close()}))}function Ve(n,e,r){return h.try((function(){return"function"==typeof n.queryParam?n.queryParam({value:r}):"string"==typeof n.queryParam?n.queryParam:e}))}function $e(n,e,r){return h.try((function(){return"function"==typeof n.queryValue&&vn(r)?n.queryValue({value:r}):r}))}function Ge(n,e,r){void 0===e&&(e={}),void 0===r&&(r=window);var t,i,u,a,c,s=n.propsDef,f=n.containerTemplate,d=n.prerenderTemplate,l=n.tag,w=n.name,p=n.attributes,v=n.dimensions,m=n.autoResize,y=n.url,g=n.domain,_=new h,E=[],O=gn(),W={},S={visible:!0},C=e.event?e.event:(t={},i={},{on:function(n,e){var r=i[n]=i[n]||[];r.push(e);var t=!1;return{cancel:function(){t||(t=!0,r.splice(r.indexOf(e),1))}}},once:function(n,e){var r=this.on(n,(function(){r.cancel(),e()}));return r},trigger:function(n){for(var e=arguments.length,r=new Array(e>1?e-1:0),t=1;t<e;t++)r[t-1]=arguments[t];var o=i[n],u=[];if(o)for(var a=function(n){var e=o[n];u.push(h.try((function(){return e.apply(void 0,r)})))},c=0;c<o.length;c++)a(c);return h.all(u).then(cn)},triggerOnce:function(n){if(t[n])return h.resolve();t[n]=!0;for(var e=arguments.length,r=new Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return this.trigger.apply(this,[n].concat(r))},reset:function(){i={}}}),D=e.props?e.props:{},j=e.onError,R=e.getProxyContainer,A=e.show,z=e.hide,L=e.close,q=e.renderContainer,U=e.getProxyWindow,B=e.setProxyWin,J=e.openFrame,H=e.openPrerenderFrame,Y=e.prerender,Z=e.open,V=e.openPrerender,$=e.watchForUnload,G=e.getInternalState,X=e.setInternalState,nn=function(n){for(var e={},r=0,t=Object.keys(D);r<t.length;r++){var o=t[r],i=s[o];i&&!1===i.sendToChild||i&&i.sameDomain&&!I(n,b(window))||(e[o]=D[o])}return h.hash(e)},en=function(){return h.try((function(){return G?G():S}))},rn=function(n){return h.try((function(){return X?X(n):S=o({},S,n)}))},tn=function(){return U?U():h.try((function(){var n=D.window;if(n){var e=Ne(n);return O.register((function(){return n.close()})),e}return new ve({send:Ae})}))},un=function(n){return R?R(n):h.try((function(){return jn(n)})).then((function(n){return Un(n)&&(n=function(n){var e=function(n){var e=function(n){for(;n.parentNode;)n=n.parentNode;if(Un(n))return n}(n);if(e.host)return e.host}(n);if(!e)throw new Error("Element is not in shadow dom");if(Un(e))throw new Error("Host element is also in shadow dom");var r="shadow-slot-"+Q(),t=document.createElement("slot");t.setAttribute("name",r),n.appendChild(t);var o=document.createElement("div");return o.setAttribute("slot",r),e.appendChild(o),o}(n)),Fe(n)}))},an=function(n){return B?B(n):h.try((function(){u=n}))},dn=function(){return A?A():h.hash({setState:rn({visible:!0}),showElement:a?a.get().then(In):null}).then(cn)},hn=function(){return z?z():h.hash({setState:rn({visible:!1}),showElement:a?a.get().then(Fn):null}).then(cn)},yn=function(){return"function"==typeof y?y({props:D}):y},_n=function(){return"function"==typeof p?p({props:D}):p},En=function(){return g&&"string"==typeof g?g:F(yn())},bn=function(){return g&&mn(g)?g:En()},xn=function(n,e){var r=e.windowName;return J?J(n,{windowName:r}):h.try((function(){if(n===qe.IFRAME)return Fe(Tn({attributes:o({name:r,title:w},_n().iframe)}))}))},Pn=function(n){return H?H(n):h.try((function(){if(n===qe.IFRAME)return Fe(Tn({attributes:o({name:"__zoid_prerender_frame__"+w+"_"+Q()+"__",title:"prerender__"+w},_n().iframe)}))}))},On=function(n,e,r){return V?V(n,e,r):h.try((function(){if(n===qe.IFRAME){if(!r)throw new Error("Expected proxy frame to be passed");return r.get().then((function(n){return O.register((function(){return Mn(n)})),zn(n).then((function(n){return P(n)})).then((function(n){return Ne(n)}))}))}throw new Error("No render context available for "+n)}))},Cn=function(){return h.try((function(){if(u)return h.all([C.trigger(Ue.FOCUS),u.focus()]).then(cn)}))},Rn=function(n,e,r,t){if(e===b(window)){var o=Ie(window);return o.windows=o.windows||{},o.windows[r]=window,O.register((function(){delete o.windows[r]})),{type:"global",uid:r}}return t===qe.POPUP?{type:"opener"}:{type:"parent",distance:T(window)}},kn=function(n){return h.try((function(){c=n,_.resolve(),O.register((function(){return n.close.fireAndForget().catch(cn)}))}))},An=function(n){var e=n.width,r=n.height;return h.try((function(){C.trigger(Ue.RESIZE,{width:e,height:r})}))},Bn=function(n){return h.try((function(){return C.trigger(Ue.DESTROY)})).catch(cn).then((function(){return O.all(n)})).then((function(){_.asyncReject(n||new Error("Component destroyed"))}))},Jn=on((function(n){return h.try((function(){if(L){if(k(L.__source__))return;return L()}return h.try((function(){return C.trigger(Ue.CLOSE)})).then((function(){return Bn(n||new Error("Component closed"))}))}))})),Hn=function(n,e){var r=e.proxyWin,t=e.proxyFrame;return Z?Z(n,{proxyWin:r,proxyFrame:t,windowName:e.windowName}):h.try((function(){if(n===qe.IFRAME){if(!t)throw new Error("Expected proxy frame to be passed");return t.get().then((function(n){return zn(n).then((function(e){return O.register((function(){return Mn(n)})),O.register((function(){return function(n){for(var e=0,r=ne("requestPromises").get(n,[]);e<r.length;e++)r[e].reject(new Error("Window "+(k(n)?"closed":"cleaned up")+" before response")).catch(cn)}(e)})),e}))}))}throw new Error("No render context available for "+n)})).then((function(n){return r.setWindow(n,{send:Ae}),r}))},Yn=function(){return h.try((function(){var n=Nn(window,"unload",sn((function(){Bn(new Error("Window navigated away"))}))),e=M(r,Bn,3e3);if(O.register(e.cancel),O.register(n.cancel),$)return $()}))},Zn=function(n){var e=!1;return n.isClosed().then((function(r){return r?(e=!0,Jn(new Error("Detected component window close"))):h.delay(200).then((function(){return n.isClosed()})).then((function(n){if(n)return e=!0,Jn(new Error("Detected component window close"))}))})).then((function(){return e}))},Vn=function(n){return j?j(n):h.try((function(){if(-1===E.indexOf(n))return E.push(n),_.asyncReject(n),C.trigger(Ue.ERROR,n)}))};kn.onError=Vn;var $n=function(n,e){return n({container:e.container,context:e.context,uid:e.uid,doc:e.doc,frame:e.frame,prerenderFrame:e.prerenderFrame,focus:Cn,close:Jn,state:W,props:D,tag:l,dimensions:v,event:C})},Gn=function(n,e){var r=e.context,t=e.uid;return Y?Y(n,{context:r,uid:t}):h.try((function(){if(d){var e=n.getWindow();if(e&&x(e)&&function(n){try{if(!n.location.href)return!0;if("about:blank"===n.location.href)return!0}catch(n){}return!1}(e)){var o=(e=P(e)).document,i=$n(d,{context:r,uid:t,doc:o});if(i){if(i.ownerDocument!==o)throw new Error("Expected prerender template to have been created with document from child window");!function(n,e){var r=e.tagName.toLowerCase();if("html"!==r)throw new Error("Expected element to be html, got "+r);for(var t=n.document.documentElement,o=0,i=pn(t.children);o<i.length;o++)t.removeChild(i[o]);for(var u=0,a=pn(e.children);u<a.length;u++)t.appendChild(a[u])}(e,i);var u=m.width,a=void 0!==u&&u,c=m.height,s=void 0!==c&&c,f=m.element,l=void 0===f?"body":f;if((l=Dn(l,o))&&(a||s)){var h=qn(l,(function(n){An({width:a?n.width:void 0,height:s?n.height:void 0})}),{width:a,height:s,win:e});C.on(Ue.RENDERED,h.cancel)}}}}}))},Xn=function(n,e){var r=e.proxyFrame,t=e.proxyPrerenderFrame,o=e.context,i=e.uid;return q?q(n,{proxyFrame:r,proxyPrerenderFrame:t,context:o,uid:i}):h.hash({container:n.get(),frame:r?r.get():null,prerenderFrame:t?t.get():null,internalState:en()}).then((function(n){var e=n.container,r=n.internalState.visible,t=$n(f,{context:o,uid:i,container:e,frame:n.frame,prerenderFrame:n.prerenderFrame,doc:document});if(t){r||Fn(t),Sn(e,t);var u=function(n,e){e=sn(e);var r,t,o,i=!1,u=[],a=function(){i=!0;for(var n=0;n<u.length;n++)u[n].disconnect();r&&r.cancel(),o&&o.removeEventListener("unload",c),t&&Mn(t)},c=function(){i||(e(),a())};if(Ln(n))return c(),{cancel:a};if(window.MutationObserver)for(var s=n.parentElement;s;){var f=new window.MutationObserver((function(){Ln(n)&&c()}));f.observe(s,{childList:!0}),u.push(f),s=s.parentElement}return(t=document.createElement("iframe")).setAttribute("name","__detect_close_"+Q()+"__"),t.style.display="none",zn(t).then((function(n){(o=P(n)).addEventListener("unload",c)})),n.appendChild(t),r=wn((function(){Ln(n)&&c()}),1e3),{cancel:a}}(t,(function(){return Jn(new Error("Detected container element removed from DOM"))}));return O.register((function(){return u.cancel()})),O.register((function(){return Mn(t)})),a=Fe(t)}}))},Kn=function(){return{state:W,event:C,close:Jn,focus:Cn,resize:An,onError:Vn,updateProps:ee,show:dn,hide:hn}},Qn=function(n,e){void 0===e&&(e=!1);var r=Kn();!function(n,e,r,t,o){void 0===o&&(o=!1),ln(e,r=r||{});for(var i=o?[]:[].concat(Object.keys(n)),u=0,a=Object.keys(r);u<a.length;u++){var c=a[u];-1===i.indexOf(c)&&i.push(c)}for(var s=[],f=t.state,d=t.close,l=t.focus,h=t.event,w=t.onError,p=0;p<i.length;p++){var v=i[p],m=n[v],y=r[v];if(m){var g=m.alias;if(g&&(!vn(y)&&vn(r[g])&&(y=r[g]),s.push(g)),m.value&&(y=m.value({props:e,state:f,close:d,focus:l,event:h,onError:w})),!vn(y)&&m.default&&(y=m.default({props:e,state:f,close:d,focus:l,event:h,onError:w})),vn(y)&&("array"===m.type?!Array.isArray(y):typeof y!==m.type))throw new TypeError("Prop is not of type "+m.type+": "+v);e[v]=y}}for(var _=0;_<s.length;_++)delete e[s[_]];for(var E=0,b=Object.keys(e);E<b.length;E++){var x=b[E],P=n[x],O=e[x];P&&vn(O)&&P.decorate&&(e[x]=P.decorate({value:O,props:e,state:f,close:d,focus:l,event:h,onError:w}))}for(var W=0,S=Object.keys(n);W<S.length;W++){var C=S[W];if(!1!==n[C].required&&!vn(e[C]))throw new Error('Expected prop "'+C+'" to be defined')}}(s,D,n,r,e)},ee=function(n){return Qn(n,!0),_.then((function(){var n=c,e=u;if(n&&e)return nn(bn()).then((function(r){return n.updateProps(r).catch((function(n){return Zn(e).then((function(e){if(!e)throw n}))}))}))}))};return{init:function(){C.on(Ue.RENDER,(function(){return D.onRender()})),C.on(Ue.DISPLAY,(function(){return D.onDisplay()})),C.on(Ue.RENDERED,(function(){return D.onRendered()})),C.on(Ue.CLOSE,(function(){return D.onClose()})),C.on(Ue.DESTROY,(function(){return D.onDestroy()})),C.on(Ue.RESIZE,(function(){return D.onResize()})),C.on(Ue.FOCUS,(function(){return D.onFocus()})),C.on(Ue.PROPS,(function(n){return D.onProps(n)})),C.on(Ue.ERROR,(function(n){return D&&D.onError?D.onError(n):_.reject(n).then((function(){setTimeout((function(){throw n}),1)}))})),O.register(C.reset)},render:function(n,e,r){return h.try((function(){var t="zoid-"+l+"-"+Q(),o=bn(),i=En();!function(n,e,r){if(n!==window){if(!N(window,n))throw new Error("Can only renderTo an adjacent frame");var t=b();if(!I(e,t)&&!x(n))throw new Error("Can not render remotely to "+e.toString()+" - can only render to "+t);if(r&&"string"!=typeof r)throw new Error("Container passed to renderTo must be a string selector, got "+typeof r+" }")}}(n,o,e);var a=h.try((function(){if(n!==window)return function(n,e){for(var r={},t=0,o=Object.keys(D);t<o.length;t++){var i=o[t],u=s[i];u&&u.allowDelegate&&(r[i]=D[i])}var a=Ae(e,"zoid_delegate_"+w,{overrides:{props:r,event:C,close:Jn,onError:Vn,getInternalState:en,setInternalState:rn}}).then((function(n){var r=n.data.parent;return O.register((function(n){if(!k(e))return r.destroy(n)})),r.getDelegateOverrides()})).catch((function(n){throw new Error("Unable to delegate rendering. Possibly the component is not loaded in the target window.\n\n"+fn(n))}));return R=function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];return a.then((function(n){return n.getProxyContainer.apply(n,e)}))},q=function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];return a.then((function(n){return n.renderContainer.apply(n,e)}))},A=function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];return a.then((function(n){return n.show.apply(n,e)}))},z=function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];return a.then((function(n){return n.hide.apply(n,e)}))},$=function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];return a.then((function(n){return n.watchForUnload.apply(n,e)}))},n===qe.IFRAME&&(U=function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];return a.then((function(n){return n.getProxyWindow.apply(n,e)}))},J=function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];return a.then((function(n){return n.openFrame.apply(n,e)}))},H=function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];return a.then((function(n){return n.openPrerenderFrame.apply(n,e)}))},Y=function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];return a.then((function(n){return n.prerender.apply(n,e)}))},Z=function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];return a.then((function(n){return n.open.apply(n,e)}))},V=function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];return a.then((function(n){return n.openPrerender.apply(n,e)}))}),a}(r,n)})),c=D.window,f=Yn(),d=function(n,e){var r={},t=Object.keys(e);return h.all(t.map((function(t){var o=n[t];if(o)return h.resolve().then((function(){var n=e[t];if(n&&o.queryParam)return n})).then((function(n){if(null!=n)return h.all([Ve(o,t,n),$e(o,0,n)]).then((function(n){var e,i=n[0],u=n[1];if("boolean"==typeof u)e=u.toString();else if("string"==typeof u)e=u.toString();else if("object"==typeof u&&null!==u){if(o.serialization===Le.JSON)e=JSON.stringify(u);else if(o.serialization===Le.BASE64)e=btoa(JSON.stringify(u));else if(o.serialization===Le.DOTIFY||!o.serialization){e=function n(e,r,t){for(var o in void 0===r&&(r=""),void 0===t&&(t={}),r=r?r+".":r,e)e.hasOwnProperty(o)&&null!=e[o]&&"function"!=typeof e[o]&&(e[o]&&Array.isArray(e[o])&&e[o].length&&e[o].every((function(n){return"object"!=typeof n}))?t[""+r+o+"[]"]=e[o].join(","):e[o]&&"object"==typeof e[o]?t=n(e[o],""+r+o,t):t[""+r+o]=e[o].toString());return t}(u,t);for(var a=0,c=Object.keys(e);a<c.length;a++){var s=c[a];r[s]=e[s]}return}}else"number"==typeof u&&(e=u.toString());r[i]=e}))}))}))).then((function(){return r}))}(s,D).then((function(n){return function(n,e){var r,t,o=e.query||{},i=e.hash||{},u=n.split("#");t=u[1];var a=(r=u[0]).split("?");r=a[0];var c=Wn(a[1],o),s=Wn(t,i);return c&&(r=r+"?"+c),s&&(r=r+"#"+s),r}(function(n){if(0!==F(n).indexOf("mock:"))return n;throw new Error("Mock urls not supported out of test mode")}(yn()),{query:n})})),p=C.trigger(Ue.RENDER),v=un(e),m=tn(),y=m.then((function(e){return function(n){var e=void 0===n?{}:n,r=e.proxyWin,t=e.childDomain,o=e.domain,i=(void 0===e.target&&window,e.context),u=e.uid;return function(n,e,r,t){return nn(r).then((function(o){var i=ze(n,r,o),u=e===b()?{type:"uid",uid:t}:{type:"raw",value:i};if("uid"===u.type){var a=Ie(window);a.props=a.props||{},a.props[t]=i,O.register((function(){delete a.props[t]}))}return u}))}(r,t,o,u).then((function(n){return{uid:u,context:i,tag:l,version:"9_0_63",childDomain:t,parentDomain:b(window),parent:Rn(0,t,u,i),props:n,exports:ze(r,o,(e=r,{init:kn,close:Jn,checkClose:function(){return Zn(e)},resize:An,onError:Vn,show:dn,hide:hn}))};var e}))}({proxyWin:(u={proxyWin:e,childDomain:i,domain:o,target:n,context:r,uid:t}).proxyWin,childDomain:u.childDomain,domain:u.domain,target:u.target,context:u.context,uid:u.uid}).then((function(n){return"__zoid__"+w+"__"+K(JSON.stringify(n))+"__"}));var u})),g=y.then((function(n){return xn(r,{windowName:n})})),E=Pn(r),P=h.hash({proxyContainer:v,proxyFrame:g,proxyPrerenderFrame:E}).then((function(n){return Xn(n.proxyContainer,{context:r,uid:t,proxyFrame:n.proxyFrame,proxyPrerenderFrame:n.proxyPrerenderFrame})})).then((function(n){return n})),W=h.hash({windowName:y,proxyFrame:g,proxyWin:m}).then((function(n){var e=n.proxyWin;return c?e:Hn(r,{windowName:n.windowName,proxyWin:e,proxyFrame:n.proxyFrame})})),S=h.hash({proxyWin:W,proxyPrerenderFrame:E}).then((function(n){return On(r,n.proxyWin,n.proxyPrerenderFrame)})),j=W.then((function(n){return u=n,an(n)})),T=h.hash({proxyPrerenderWin:S,state:j}).then((function(n){return Gn(n.proxyPrerenderWin,{context:r,uid:t})})),M=h.hash({proxyWin:W,windowName:y}).then((function(n){if(c)return n.proxyWin.setName(n.windowName)})),L=h.hash({proxyWin:W,builtUrl:d,windowName:M,prerender:T}).then((function(n){return n.proxyWin.setLocation(n.builtUrl)})),B=W.then((function(n){!function n(e,r){var t=!1;return O.register((function(){t=!0})),h.delay(2e3).then((function(){return e.isClosed()})).then((function(o){return o?Jn(new Error("Detected "+r+" close")):t?void 0:n(e,r)}))}(n,r)})),G=h.hash({container:P,prerender:T}).then((function(){return C.trigger(Ue.DISPLAY)})),X=W.then((function(n){})),on=L.then((function(){return h.try((function(){var n=D.timeout;if(n)return _.timeout(n,new Error("Loading component timed out after "+n+" milliseconds"))}))})),cn=_.then((function(){return C.trigger(Ue.RENDERED)}));return h.hash({initPromise:_,buildUrlPromise:d,onRenderPromise:p,getProxyContainerPromise:v,openFramePromise:g,openPrerenderFramePromise:E,renderContainerPromise:P,openPromise:W,openPrerenderPromise:S,setStatePromise:j,prerenderPromise:T,loadUrlPromise:L,buildWindowNamePromise:y,setWindowNamePromise:M,watchForClosePromise:B,onDisplayPromise:G,openBridgePromise:X,runTimeoutPromise:on,onRenderedPromise:cn,delegatePromise:a,watchForUnloadPromise:f})})).catch((function(n){return h.all([Vn(n),Bn(n)]).then((function(){throw n}),(function(){throw n}))})).then(cn)},destroy:Bn,setProps:Qn,getHelpers:Kn,getDelegateOverrides:function(){return h.try((function(){return{getProxyContainer:un,show:dn,hide:hn,renderContainer:Xn,getProxyWindow:tn,watchForUnload:Yn,openFrame:xn,openPrerenderFrame:Pn,prerender:Gn,open:Hn,openPrerender:On,setProxyWin:an}}))}}}function Xe(n){var e=n.uid,r=n.frame,t=n.prerenderFrame,o=n.doc,i=n.props,u=n.event,a=n.dimensions,c=a.width,s=a.height;if(r&&t){var f=o.createElement("div");f.setAttribute("id",e);var d=o.createElement("style");return i.cspNonce&&d.setAttribute("nonce",i.cspNonce),d.appendChild(o.createTextNode("\n            #"+e+" {\n                display: inline-block;\n                position: relative;\n                width: "+c+";\n                height: "+s+";\n            }\n\n            #"+e+" > iframe {\n                display: inline-block;\n                position: absolute;\n                width: 100%;\n                height: 100%;\n                top: 0;\n                left: 0;\n                transition: opacity .2s ease-in-out;\n            }\n\n            #"+e+" > iframe.zoid-invisible {\n                opacity: 0;\n            }\n\n            #"+e+" > iframe.zoid-visible {\n                opacity: 1;\n        }\n        ")),f.appendChild(r),f.appendChild(t),f.appendChild(d),t.classList.add("zoid-visible"),r.classList.add("zoid-invisible"),u.on(Ue.RENDERED,(function(){t.classList.remove("zoid-visible"),t.classList.add("zoid-invisible"),r.classList.remove("zoid-invisible"),r.classList.add("zoid-visible"),setTimeout((function(){Mn(t)}),1)})),u.on(Ue.RESIZE,(function(n){var e=n.width,r=n.height;"number"==typeof e&&(f.style.width=Zn(e)),"number"==typeof r&&(f.style.height=Zn(r))})),f}}var Ke=function(){return cn},Qe=function(n){return sn(n.value)},nr=gn(),er=gn();function rr(n){var e,r,t=function(n){var e=n.tag,r=n.url,t=n.domain,i=n.bridgeUrl,u=n.props,a=void 0===u?{}:u,c=n.dimensions,s=void 0===c?{}:c,f=n.autoResize,d=void 0===f?{}:f,l=n.allowedParentDomains,h=void 0===l?"*":l,w=n.attributes,p=void 0===w?{}:w,v=n.defaultContext,m=void 0===v?qe.IFRAME:v,y=n.containerTemplate,g=void 0===y?Xe:y,_=n.prerenderTemplate,E=void 0===_?null:_,b=n.validate,P=n.eligible,O=void 0===P?function(){return{eligible:!0}}:P,W=n.logger,S=void 0===W?{info:cn}:W,C=e.replace(/-/g,"_"),D=s.width,j=void 0===D?"300px":D,R=s.height,A=void 0===R?"150px":R;if(a=o({},{window:{type:"object",sendToChild:!1,required:!1,allowDelegate:!0,validate:function(n){var e=n.value;if(!L(e)&&!ve.isProxyWindow(e))throw new Error("Expected Window or ProxyWindow");if(L(e)){if(k(e))throw new Error("Window is closed");if(!x(e))throw new Error("Window is not same domain")}},decorate:function(n){return Ne(n.value)}},timeout:{type:"number",required:!1,sendToChild:!1},close:{type:"function",required:!1,sendToChild:!1,childDecorate:function(n){return n.close}},focus:{type:"function",required:!1,sendToChild:!1,childDecorate:function(n){return n.focus}},resize:{type:"function",required:!1,sendToChild:!1,childDecorate:function(n){return n.resize}},uid:{type:"string",required:!1,sendToChild:!1,childDecorate:function(n){return n.uid}},cspNonce:{type:"string",required:!1},getParent:{type:"function",required:!1,sendToChild:!1,childDecorate:function(n){return n.getParent}},getParentDomain:{type:"function",required:!1,sendToChild:!1,childDecorate:function(n){return n.getParentDomain}},show:{type:"function",required:!1,sendToChild:!1,childDecorate:function(n){return n.show}},hide:{type:"function",required:!1,sendToChild:!1,childDecorate:function(n){return n.hide}},onDisplay:{type:"function",required:!1,sendToChild:!1,allowDelegate:!0,default:Ke,decorate:Qe},onRendered:{type:"function",required:!1,sendToChild:!1,default:Ke,decorate:Qe},onRender:{type:"function",required:!1,sendToChild:!1,default:Ke,decorate:Qe},onClose:{type:"function",required:!1,sendToChild:!1,allowDelegate:!0,default:Ke,decorate:Qe},onDestroy:{type:"function",required:!1,sendToChild:!1,allowDelegate:!0,default:Ke,decorate:Qe},onResize:{type:"function",required:!1,sendToChild:!1,allowDelegate:!0,default:Ke},onFocus:{type:"function",required:!1,sendToChild:!1,allowDelegate:!0,default:Ke},onError:{type:"function",required:!1,sendToChild:!1,childDecorate:function(n){return n.onError}},onProps:{type:"function",required:!1,sendToChild:!1,default:Ke,childDecorate:function(n){return n.onProps}}},a),!g)throw new Error("Container template required");return{name:C,tag:e,url:r,domain:t,bridgeUrl:i,propsDef:a,dimensions:{width:j,height:A},autoResize:d,allowedParentDomains:h,attributes:p,defaultContext:m,containerTemplate:g,prerenderTemplate:E,validate:b,logger:S,eligible:O}}(n),i=t.name,u=t.tag,a=t.defaultContext,c=t.eligible,s=Ie(),f=[],d=function(){var n=He();return Boolean(n&&n.tag===u&&n.childDomain===b())},l=on((function(){if(d()){if(window.xprops)throw delete s.components[u],new Error("Can not register "+i+" as child - child already registered");var n=function(n){var e,r=n.propsDef,t=n.autoResize,o=n.allowedParentDomains,i=[],u=He();if(!u)throw new Error("No child payload found");if("9_0_63"!==u.version)throw new Error("Parent window has zoid version "+u.version+", child window has version 9_0_63");var a=u.uid,c=u.parentDomain,s=u.exports,f=u.context,d=u.props,l=function(n){var e,r,t=n.type;if("opener"===t)return _n("opener",g(window));if("parent"===t&&"number"==typeof n.distance)return _n("parent",(e=window,void 0===(r=n.distance)&&(r=1),function(n,e){void 0===e&&(e=1);for(var r=n,t=0;t<e;t++){if(!r)return;r=y(r)}return r}(e,T(e)-r)));if("global"===t&&n.uid&&"string"==typeof n.uid){var o=n.uid,i=A(window);if(!i)throw new Error("Can not find ancestor window");for(var u=0,a=D(i);u<a.length;u++){var c=a[u];if(x(c)){var s=Ie(c);if(s&&s.windows&&s.windows[o])return s.windows[o]}}}throw new Error("Unable to find "+t+" parent component window")}(u.parent),w=Te(l,c,s),p=w.show,v=w.hide,m=w.close,_=function(){return l},E=function(){return c},P=function(n){i.push(n)},O=function(n){return h.try((function(){if(w&&w.onError)return w.onError(n);throw n}))},W=function(n){return w.resize.fireAndForget({width:n.width,height:n.height})},S=function(n,t,o){void 0===o&&(o=!1);var u=function(n,e,r,t,o,i){void 0===i&&(i=!1);for(var u={},a=0,c=Object.keys(r);a<c.length;a++){var s=c[a],f=e[s];if(!f||!f.sameDomain||t===b(window)&&x(n)){var d=Be(e,0,s,r[s],o);u[s]=d,f&&f.alias&&!u[f.alias]&&(u[f.alias]=d)}}if(!i)for(var l=0,h=Object.keys(e);l<h.length;l++){var w=h[l];r.hasOwnProperty(w)||(u[w]=Be(e,0,w,void 0,o))}return u}(l,r,n,t,{show:p,hide:v,close:m,focus:Ye,onError:O,resize:W,onProps:P,getParent:_,getParentDomain:E,uid:a},o);e?ln(e,u):e=u;for(var c=0;c<i.length;c++)(0,i[c])(e)},C=function(n){return h.try((function(){return S(n,c,!0)}))};return{init:function(){return h.try((function(){return function(n,e){if(!I(n,e))throw new Error("Can not be rendered by domain: "+e)}(o,c),ie(l),window.addEventListener("beforeunload",(function(){w.checkClose.fireAndForget()})),window.addEventListener("unload",(function(){w.checkClose.fireAndForget()})),M(l,(function(){Ze()})),w.init({updateProps:C,close:Ze})})).then((function(){return(n=t.width,e=void 0!==n&&n,r=t.height,o=void 0!==r&&r,i=t.element,jn(void 0===i?"body":i).catch(cn).then((function(n){return{width:e,height:o,element:n}}))).then((function(n){var e=n.width,r=n.height,t=n.element;t&&(e||r)&&f!==qe.POPUP&&qn(t,(function(n){W({width:e?n.width:void 0,height:r?n.height:void 0})}),{width:e,height:r})}));var n,e,r,o,i})).catch((function(n){O(n)}))},getProps:function(){return e||(S(function(n,e,r){var t,o=r.type,i=r.uid;if("raw"===o)t=r.value;else if("uid"===o){if(!x(n))throw new Error("Parent component window is on a different domain - expected "+b()+" - can not retrieve props");var u=Ie(n);t=_n("props",u&&u.props[i])}if(!t)throw new Error("Could not find props");return Te(n,e,t)}(l,c,d),c),e)}}}(t);return n.init(),n}}));if(l(),e=ke("zoid_allow_delegate_"+i,(function(){return!0})),r=ke("zoid_delegate_"+i,(function(n){return{parent:Ge(t,n.data.overrides,n.source)}})),er.register(e.cancel),er.register(r.cancel),s.components=s.components||{},s.components[u])throw new Error("Can not register multiple components with the same tag: "+u);return s.components[u]=!0,{init:function n(e){var r,u=c({props:e=e||{}}),s=u.eligible,d=u.reason,l=e.onDestroy;e.onDestroy=function(){if(r&&s&&f.splice(f.indexOf(r),1),l)return l.apply(void 0,arguments)};var w=Ge(t);w.init(),s?w.setProps(e):e.onDestroy&&e.onDestroy(),nr.register((function(n){w.destroy(n||new Error("zoid destroyed all components"))}));var p=function(n,r,t){return h.try((function(){if(!s){var r=new Error(d||i+" component is not eligible");return w.destroy(r).then((function(){throw r}))}if(!L(n))throw new Error("Must pass window to renderTo");return function(n,e){return h.try((function(){if(n.window)return Ne(n.window).getType();if(e){if(e!==qe.IFRAME&&e!==qe.POPUP)throw new Error("Unrecognized context: "+e);return e}return a}))}(e,t)})).then((function(e){return r=function(n,e){if(e){if("string"!=typeof e&&!Cn(e))throw new TypeError("Expected string or element selector to be passed");return e}if(n===qe.POPUP)return"body";throw new Error("Expected element to be passed to render iframe")}(e,r),w.render(n,r,e)})).catch((function(n){return w.destroy(n).then((function(){throw n}))}))};return r=o({},w.getHelpers(),{isEligible:function(){return s},clone:function(r){var t=(void 0===r?{}:r).decorate;return n((void 0===t?hn:t)(e))},render:function(n,e){return p(window,n,e)},renderTo:function(n,e,r){return p(n,e,r)}}),s&&f.push(r),r},instances:f,driver:function(n,e){throw new Error("Driver support not enabled")},isChild:d,canRenderTo:function(n){return Ae(n,"zoid_allow_delegate_"+i).then((function(n){return n.data})).catch((function(){return!1}))},registerChild:l}}function tr(n){var e,r,t,o;Vn().initialized||(Vn().initialized=!0,r=(e={on:ke,send:Ae}).on,t=e.send,(o=Vn()).receiveMessage=o.receiveMessage||function(n){return Re(n,{on:r,send:t})},function(n){var e=n.on,r=n.send;Gn().getOrSet("postMessageListener",(function(){return Nn(window,"message",(function(n){!function(n,e){var r=e.on,t=e.send;h.try((function(){var e=n.source||n.sourceElement,o=n.origin||n.originalEvent&&n.originalEvent.origin,i=n.data;if("null"===o&&(o="file://"),e){if(!o)throw new Error("Post message did not have origin domain");Re({source:e,origin:o,data:i},{on:r,send:t})}}))}(n,{on:e,send:r})}))}))}({on:ke,send:Ae}),function(n){var e=n.on,r=n.send;Gn("builtinListeners").getOrSet("helloListener",(function(){var n=e("postrobot_hello",{domain:"*"},(function(n){return re(n.source,{domain:n.origin}),{instanceID:ee()}})),t=A();return t&&te(t,{send:r}).catch((function(n){})),n}))}({on:ke,send:Ae}));var i=rr(n),u=function(n){return i.init(n)};u.driver=function(n,e){return i.driver(n,e)},u.isChild=function(){return i.isChild()},u.canRenderTo=function(n){return i.canRenderTo(n)},u.instances=i.instances;var a=i.registerChild();return a&&(window.xprops=u.xprops=a.getProps()),u}function or(n){var e=nr.all(n);return nr=gn(),e}var ir=or;function ur(n){return ir(),delete window.__zoid_9_0_63__,function(){for(var n=Gn("responseListeners"),e=0,r=n.keys();e<r.length;e++){var t=r[e],o=n.get(t);o&&(o.cancelled=!0),n.del(t)}}(),(e=Gn().get("postMessageListener"))&&e.cancel(),delete window.__post_robot_10_0_42__,er.all(n);var e}}])}));
  //# sourceMappingURL=zoid.frame.min.js.map