@soyio/soyio-widget 0.0.39 → 0.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +9 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2185,7 +2185,7 @@ const Xr = /* @__PURE__ */ Vr(Kr), kr = "WIDGET_EVENT";
|
|
|
2185
2185
|
function Qr(y) {
|
|
2186
2186
|
const { onEvent: x } = y;
|
|
2187
2187
|
Xr.on(kr, (D) => {
|
|
2188
|
-
x(
|
|
2188
|
+
x(D.data), Gr.includes(D.data.eventName) && Zr();
|
|
2189
2189
|
});
|
|
2190
2190
|
}
|
|
2191
2191
|
function _r(y) {
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
(function(N,O){typeof exports=="object"&&typeof module<"u"?module.exports=O():typeof define=="function"&&define.amd?define(O):(N=typeof globalThis<"u"?globalThis:N||self,N["soyio-widget"]=O())})(this,function(){"use strict";var Qt=Object.defineProperty;var _t=(N,O,L)=>O in N?Qt(N,O,{enumerable:!0,configurable:!0,writable:!0,value:L}):N[O]=L;var ln=(N,O,L)=>(_t(N,typeof O!="symbol"?O+"":O,L),L),
|
|
2
|
-
`;function F(n){return n===void 0&&(n=window),n.location.protocol}function K(n){if(n===void 0&&(n=window),n.mockDomain){var e=n.mockDomain.split("//")[0];if(e)return e}return F(n)}function tn(n){return n===void 0&&(n=window),K(n)==="about:"}function $(n){if(n===void 0&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch{}}function Mn(n){if(n===void 0&&(n=window),n&&!$(n))try{return n.opener}catch{}}function wn(n){try{return!0}catch{}return!1}function mn(n){n===void 0&&(n=window);var e=n.location;if(!e)throw new Error("Can not read window location");var t=F(n);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var r=$(n);return r&&wn()?mn(r):"about://"}var o=e.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function C(n){n===void 0&&(n=window);var e=mn(n);return e&&n.mockDomain&&n.mockDomain.indexOf("mock:")===0?n.mockDomain:e}function X(n){if(!function(e){try{if(e===window)return!0}catch{}try{var t=Object.getOwnPropertyDescriptor(e,"location");if(t&&t.enumerable===!1)return!1}catch{}try{if(tn(e)&&wn())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),K(r)==="mock:"}(e)&&wn())return!0}catch{}try{if(mn(e)===mn(window))return!0}catch{}return!1}(n))return!1;try{if(n===window||tn(n)&&wn()||C(window)===C(n))return!0}catch{}return!1}function pn(n){if(!X(n))throw new Error("Expected window to be same domain");return n}function Ln(n,e){if(!n||!e)return!1;var t=$(e);return t?t===n:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch{}return o}(e).indexOf(n)!==-1}function Fn(n){var e=[],t;try{t=n.frames}catch{t=n}var r;try{r=t.length}catch{}if(r===0)return e;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch{continue}e.push(i)}return e}for(var a=0;a<100;a++){var s=void 0;try{s=t[a]}catch{return e}if(!s)return e;e.push(s)}return e}var Dt=[],Nt=[];function G(n,e){e===void 0&&(e=!0);try{if(n===window)return!1}catch{return!0}try{if(!n)return!0}catch{return!0}try{if(n.closed)return!0}catch(o){return!o||o.message!==y}if(e&&X(n))try{if(n.mockclosed)return!0}catch{}try{if(!n.parent||!n.top)return!0}catch{}var t=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch{}return-1}(Dt,n);if(t!==-1){var r=Nt[t];if(r&&function(o){if(!o.contentWindow||!o.parentNode)return!0;var i=o.ownerDocument;if(i&&i.documentElement&&!i.documentElement.contains(o)){for(var a=o;a.parentNode&&a.parentNode!==a;)a=a.parentNode;if(!a.host||!i.documentElement.contains(a.host))return!0}return!1}(r))return!0}return!1}function Hn(n){return n===void 0&&(n=window),Mn(n=n||window)||$(n)||void 0}function en(n,e){if(typeof n=="string"){if(typeof e=="string")return n==="*"||e===n;if(v(e)||Array.isArray(e))return!1}return v(n)?v(e)?n.toString()===e.toString():!Array.isArray(e)&&!!e.match(n):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!v(e)&&n.some(function(t){return en(t,e)}))}function gn(n){try{if(n===window)return!0}catch(e){if(e&&e.message===y)return!0}try{if({}.toString.call(n)==="[object Window]")return!0}catch(e){if(e&&e.message===y)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.self===n)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.parent===n)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.top===n)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in n&&"self"in n&&"location"in n)return!0}catch{}return!1}function Un(n){if(X(n))return pn(n).frameElement;for(var e=0,t=document.querySelectorAll("iframe");e<t.length;e++){var r=t[e];if(r&&r.contentWindow&&r.contentWindow===n)return r}}function Rt(n){if(function(t){return t===void 0&&(t=window),!!$(t)}(n)){var e=Un(n);if(e&&e.parentElement){e.parentElement.removeChild(e);return}}try{n.close()}catch{}}function k(n){try{if(!n)return!1;if(typeof Promise<"u"&&n instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&n instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&n instanceof window.constructor)return!1;var e={}.toString;if(e){var t=e.call(n);if(t==="[object Window]"||t==="[object global]"||t==="[object DOMWindow]")return!1}if(typeof n.then=="function")return!0}catch{return!1}return!1}var Bn=[],rn=[],Sn=0,on;function Gn(){if(!Sn&&on){var n=on;on=null,n.resolve()}}function Pn(){Sn+=1}function an(){Sn-=1,Gn()}var x=function(){function n(t){var r=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=[],t){var o,i,a=!1,s=!1,c=!1;Pn();try{t(function(u){c?r.resolve(u):(a=!0,o=u)},function(u){c?r.reject(u):(s=!0,i=u)})}catch(u){an(),this.reject(u);return}an(),c=!0,a?this.resolve(o):s&&this.reject(i)}}var e=n.prototype;return e.resolve=function(t){if(this.resolved||this.rejected)return this;if(k(t))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=t,this.dispatch(),this},e.reject=function(t){var r=this;if(this.resolved||this.rejected)return this;if(k(t))throw new Error("Can not reject promise with another promise");if(!t){var o=t&&typeof t.toString=="function"?t.toString():{}.toString.call(t);t=new Error("Expected reject to be called with Error, got "+o)}return this.rejected=!0,this.error=t,this.errorHandled||setTimeout(function(){r.errorHandled||function(i,a){if(Bn.indexOf(i)===-1){Bn.push(i),setTimeout(function(){throw i},1);for(var s=0;s<rn.length;s++)rn[s](i,a)}}(t,r)},1),this.dispatch(),this},e.asyncReject=function(t){return this.errorHandled=!0,this.reject(t),this},e.dispatch=function(){var t=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(t||r)){this.dispatching=!0,Pn();for(var i=function(l,p){return l.then(function(w){p.resolve(w)},function(w){p.reject(w)})},a=0;a<o.length;a++){var s=o[a],c=s.onSuccess,u=s.onError,h=s.promise,d=void 0;if(t)try{d=c?c(this.value):this.value}catch(l){h.reject(l);continue}else if(r){if(!u){h.reject(this.error);continue}try{d=u(this.error)}catch(l){h.reject(l);continue}}if(d instanceof n&&(d.resolved||d.rejected)){var f=d;f.resolved?h.resolve(f.value):h.reject(f.error),f.errorHandled=!0}else k(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?h.resolve(d.value):h.reject(d.error):i(d,h):h.resolve(d)}o.length=0,this.dispatching=!1,an()}},e.then=function(t,r){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.then expected a function for success handler");if(r&&typeof r!="function"&&!r.call)throw new Error("Promise.then expected a function for error handler");var o=new n;return this.handlers.push({promise:o,onSuccess:t,onError:r}),this.errorHandled=!0,this.dispatch(),o},e.catch=function(t){return this.then(void 0,t)},e.finally=function(t){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return n.try(t).then(function(){return r})},function(r){return n.try(t).then(function(){throw r})})},e.timeout=function(t,r){var o=this;if(this.resolved||this.rejected)return this;var i=setTimeout(function(){o.resolved||o.rejected||o.reject(r||new Error("Promise timed out after "+t+"ms"))},t);return this.then(function(a){return clearTimeout(i),a})},e.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.lazy=function(){return this.errorHandled=!0,this},n.resolve=function(t){return t instanceof n?t:k(t)?new n(function(r,o){return t.then(r,o)}):new n().resolve(t)},n.reject=function(t){return new n().reject(t)},n.asyncReject=function(t){return new n().asyncReject(t)},n.all=function(t){var r=new n,o=t.length,i=[].slice();if(!o)return r.resolve(i),r;for(var a=function(u,h,d){return h.then(function(f){i[u]=f,(o-=1)==0&&r.resolve(i)},function(f){d.reject(f)})},s=0;s<t.length;s++){var c=t[s];if(c instanceof n){if(c.resolved){i[s]=c.value,o-=1;continue}}else if(!k(c)){i[s]=c,o-=1;continue}a(s,n.resolve(c),r)}return o===0&&r.resolve(i),r},n.hash=function(t){var r={},o=[],i=function(s){if(t.hasOwnProperty(s)){var c=t[s];k(c)?o.push(c.then(function(u){r[s]=u})):r[s]=c}};for(var a in t)i(a);return n.all(o).then(function(){return r})},n.map=function(t,r){return n.all(t.map(r))},n.onPossiblyUnhandledException=function(t){return function(r){return rn.push(r),{cancel:function(){rn.splice(rn.indexOf(r),1)}}}(t)},n.try=function(t,r,o){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.try expected a function");var i;Pn();try{i=t.apply(r,o||[])}catch(a){return an(),n.reject(a)}return an(),n.resolve(i)},n.delay=function(t){return new n(function(r){setTimeout(r,t)})},n.isPromise=function(t){return!!(t&&t instanceof n)||k(t)},n.flush=function(){return function(t){var r=on=on||new t;return Gn(),r}(n)},n}();function yn(n,e){for(var t=0;t<n.length;t++)try{if(n[t]===e)return t}catch{}return-1}var bn=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(typeof WeakMap>"u"||Object.freeze===void 0)return!1;try{var t=new WeakMap,r={};return Object.freeze(r),t.set(r,"__testvalue__"),t.get(r)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var e=n.prototype;return e._cleanupClosedWindows=function(){for(var t=this.weakmap,r=this.keys,o=0;o<r.length;o++){var i=r[o];if(gn(i)&&G(i)){if(t)try{t.delete(i)}catch{}r.splice(o,1),this.values.splice(o,1),o-=1}}},e.isSafeToReadWrite=function(t){return!gn(t)},e.set=function(t,r){if(!t)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(t,r)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var i=this.name,a=t[i];a&&a[0]===t?a[1]=r:Object.defineProperty(t,i,{value:[t,r],writable:!0});return}catch{}this._cleanupClosedWindows();var s=this.keys,c=this.values,u=yn(s,t);u===-1?(s.push(t),c.push(r)):c[u]=r},e.get=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return r.get(t)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return o&&o[0]===t?o[1]:void 0}catch{}this._cleanupClosedWindows();var i=yn(this.keys,t);if(i!==-1)return this.values[i]},e.delete=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(t)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];o&&o[0]===t&&(o[0]=o[1]=void 0)}catch{}this._cleanupClosedWindows();var i=this.keys,a=yn(i,t);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},e.has=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return!(!o||o[0]!==t)}catch{}return this._cleanupClosedWindows(),yn(this.keys,t)!==-1},e.getOrSet=function(t,r){if(this.has(t))return this.get(t);var o=r();return this.set(t,o),o},n}();function Jn(n){return n.name||n.__name__||n.displayName||"anonymous"}function qn(n,e){try{delete n.name,n.name=e}catch{}return n.__name__=n.displayName=e,n}function Z(){var n="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(e){if(typeof btoa=="function")return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(t,r){return String.fromCharCode(parseInt(r,16))})).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(e,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var En;function Zn(n){try{return JSON.stringify([].slice.call(n),function(e,t){return typeof t=="function"?"memoize["+function(r){if(En=En||new bn,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=En.get(r);return o||(o=typeof r+":"+Z(),En.set(r,o)),o}(t)+"]":typeof window<"u"&&t instanceof window.Element||t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object"?{}:t})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function zt(){return{}}var un=0,$n=0;function cn(n,e){e===void 0&&(e={});var t=e.thisNamespace,r=t!==void 0&&t,o=e.time,i,a,s=un;un+=1;var c=function(){for(var u=arguments.length,h=new Array(u),d=0;d<u;d++)h[d]=arguments[d];s<$n&&(i=null,a=null,s=un,un+=1);var f;f=r?(a=a||new bn).getOrSet(this,zt):i=i||{};var l;try{l=Zn(h)}catch{return n.apply(this,arguments)}var p=f[l];if(p&&o&&Date.now()-p.time<o&&(delete f[l],p=null),p)return p.value;var w=Date.now(),m=n.apply(this,arguments);return f[l]={time:w,value:m},m};return c.reset=function(){i=null,a=null},qn(c,(e.name||Jn(n))+"::memoized")}cn.clear=function(){$n=un};function jt(n){var e={};function t(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var c=Zn(a);return e.hasOwnProperty(c)||(e[c]=x.try(function(){return n.apply(o,r)}).finally(function(){delete e[c]})),e[c]}return t.reset=function(){e={}},qn(t,Jn(n)+"::promiseMemoized")}function Q(){}function sn(n,e){if(e===void 0&&(e=1),e>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if(typeof n=="string")return n;if(n instanceof Error){var t=n&&n.stack,r=n&&n.message;if(t&&r)return t.indexOf(r)!==-1?t:r+`
|
|
3
|
-
`+t;if(t)return t;if(
|
|
1
|
+
(function(N,O){typeof exports=="object"&&typeof module<"u"?module.exports=O():typeof define=="function"&&define.amd?define(O):(N=typeof globalThis<"u"?globalThis:N||self,N["soyio-widget"]=O())})(this,function(){"use strict";var Qt=Object.defineProperty;var _t=(N,O,L)=>O in N?Qt(N,O,{enumerable:!0,configurable:!0,writable:!0,value:L}):N[O]=L;var ln=(N,O,L)=>(_t(N,typeof O!="symbol"?O+"":O,L),L),nr=(N,O,L)=>{if(!O.has(N))throw TypeError("Cannot "+L)};var vt=(N,O,L)=>{if(O.has(N))throw TypeError("Cannot add the same private member more than once");O instanceof WeakSet?O.add(N):O.set(N,L)};var wt=(N,O,L)=>(nr(N,O,"access private method"),L);var vn,mt;const N="https://app.soyio.id/widget",O="https://sandbox.soyio.id/widget",L=["IDENTITY_AUTHENTICATED","IDENTITY_REGISTERED"];function pt(A,T,q,W){const g=W||(q?O:N),v=Object.entries(T).filter(([,y])=>y!==void 0).map(([y,F])=>`${y}=${encodeURIComponent(F)}`).join("&");return`${g}/${A}?${v}`}let nn=null;function gt(A,T,q,W){const g=pt(A,T,q,W),v=710,y=720,F=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width,K=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height,tn=F/2-v/2,$=K/2-y/2;if(nn=window.open(g,"Soyio",`scrollbars=yes, width=${v}, height=${y}, top=${$}, left=${tn}`),nn)nn.focus();else throw new Error("Failed to open new window")}function yt(){nn&&(nn.close(),nn=null)}var Et=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wt(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var Tn={exports:{}},Cn={exports:{}};(function(A,T){(function(q,W){A.exports=W()})(typeof self<"u"?self:Et,function(){return function(q){var W={};function g(v){if(W[v])return W[v].exports;var y=W[v]={i:v,l:!1,exports:{}};return q[v].call(y.exports,y,y.exports,g),y.l=!0,y.exports}return g.m=q,g.c=W,g.d=function(v,y,F){g.o(v,y)||Object.defineProperty(v,y,{enumerable:!0,get:F})},g.r=function(v){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})},g.t=function(v,y){if(1&y&&(v=g(v)),8&y||4&y&&typeof v=="object"&&v&&v.__esModule)return v;var F=Object.create(null);if(g.r(F),Object.defineProperty(F,"default",{enumerable:!0,value:v}),2&y&&typeof v!="string")for(var K in v)g.d(F,K,(function(tn){return v[tn]}).bind(null,K));return F},g.n=function(v){var y=v&&v.__esModule?function(){return v.default}:function(){return v};return g.d(y,"a",y),y},g.o=function(v,y){return{}.hasOwnProperty.call(v,y)},g.p="",g(g.s=0)}([function(q,W,g){g.r(W),g.d(W,"Promise",function(){return x}),g.d(W,"TYPES",function(){return Xt}),g.d(W,"ProxyWindow",function(){return B}),g.d(W,"setup",function(){return lt}),g.d(W,"destroy",function(){return Kt}),g.d(W,"serializeMessage",function(){return Zt}),g.d(W,"deserializeMessage",function(){return $t}),g.d(W,"createProxyWindow",function(){return Vt}),g.d(W,"toProxyWindow",function(){return Yt}),g.d(W,"on",function(){return V}),g.d(W,"once",function(){return qt}),g.d(W,"send",function(){return Y}),g.d(W,"markWindowKnown",function(){return tt}),g.d(W,"cleanUpWindow",function(){return kt}),g.d(W,"bridge",function(){});function v(n){return{}.toString.call(n)==="[object RegExp]"}var y=`Call was rejected by callee.\r
|
|
2
|
+
`;function F(n){return n===void 0&&(n=window),n.location.protocol}function K(n){if(n===void 0&&(n=window),n.mockDomain){var r=n.mockDomain.split("//")[0];if(r)return r}return F(n)}function tn(n){return n===void 0&&(n=window),K(n)==="about:"}function $(n){if(n===void 0&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch{}}function Mn(n){if(n===void 0&&(n=window),n&&!$(n))try{return n.opener}catch{}}function wn(n){try{return!0}catch{}return!1}function mn(n){n===void 0&&(n=window);var r=n.location;if(!r)throw new Error("Can not read window location");var t=F(n);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var e=$(n);return e&&wn()?mn(e):"about://"}var o=r.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function C(n){n===void 0&&(n=window);var r=mn(n);return r&&n.mockDomain&&n.mockDomain.indexOf("mock:")===0?n.mockDomain:r}function X(n){if(!function(r){try{if(r===window)return!0}catch{}try{var t=Object.getOwnPropertyDescriptor(r,"location");if(t&&t.enumerable===!1)return!1}catch{}try{if(tn(r)&&wn())return!0}catch{}try{if(function(e){return e===void 0&&(e=window),K(e)==="mock:"}(r)&&wn())return!0}catch{}try{if(mn(r)===mn(window))return!0}catch{}return!1}(n))return!1;try{if(n===window||tn(n)&&wn()||C(window)===C(n))return!0}catch{}return!1}function pn(n){if(!X(n))throw new Error("Expected window to be same domain");return n}function Ln(n,r){if(!n||!r)return!1;var t=$(r);return t?t===n:function(e){var o=[];try{for(;e.parent!==e;)o.push(e.parent),e=e.parent}catch{}return o}(r).indexOf(n)!==-1}function Fn(n){var r=[],t;try{t=n.frames}catch{t=n}var e;try{e=t.length}catch{}if(e===0)return r;if(e){for(var o=0;o<e;o++){var i=void 0;try{i=t[o]}catch{continue}r.push(i)}return r}for(var a=0;a<100;a++){var s=void 0;try{s=t[a]}catch{return r}if(!s)return r;r.push(s)}return r}var Dt=[],Nt=[];function G(n,r){r===void 0&&(r=!0);try{if(n===window)return!1}catch{return!0}try{if(!n)return!0}catch{return!0}try{if(n.closed)return!0}catch(o){return!o||o.message!==y}if(r&&X(n))try{if(n.mockclosed)return!0}catch{}try{if(!n.parent||!n.top)return!0}catch{}var t=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch{}return-1}(Dt,n);if(t!==-1){var e=Nt[t];if(e&&function(o){if(!o.contentWindow||!o.parentNode)return!0;var i=o.ownerDocument;if(i&&i.documentElement&&!i.documentElement.contains(o)){for(var a=o;a.parentNode&&a.parentNode!==a;)a=a.parentNode;if(!a.host||!i.documentElement.contains(a.host))return!0}return!1}(e))return!0}return!1}function Hn(n){return n===void 0&&(n=window),Mn(n=n||window)||$(n)||void 0}function rn(n,r){if(typeof n=="string"){if(typeof r=="string")return n==="*"||r===n;if(v(r)||Array.isArray(r))return!1}return v(n)?v(r)?n.toString()===r.toString():!Array.isArray(r)&&!!r.match(n):!!Array.isArray(n)&&(Array.isArray(r)?JSON.stringify(n)===JSON.stringify(r):!v(r)&&n.some(function(t){return rn(t,r)}))}function gn(n){try{if(n===window)return!0}catch(r){if(r&&r.message===y)return!0}try{if({}.toString.call(n)==="[object Window]")return!0}catch(r){if(r&&r.message===y)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(r){if(r&&r.message===y)return!0}try{if(n&&n.self===n)return!0}catch(r){if(r&&r.message===y)return!0}try{if(n&&n.parent===n)return!0}catch(r){if(r&&r.message===y)return!0}try{if(n&&n.top===n)return!0}catch(r){if(r&&r.message===y)return!0}try{if(n&&n.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in n&&"self"in n&&"location"in n)return!0}catch{}return!1}function Un(n){if(X(n))return pn(n).frameElement;for(var r=0,t=document.querySelectorAll("iframe");r<t.length;r++){var e=t[r];if(e&&e.contentWindow&&e.contentWindow===n)return e}}function Rt(n){if(function(t){return t===void 0&&(t=window),!!$(t)}(n)){var r=Un(n);if(r&&r.parentElement){r.parentElement.removeChild(r);return}}try{n.close()}catch{}}function k(n){try{if(!n)return!1;if(typeof Promise<"u"&&n instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&n instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&n instanceof window.constructor)return!1;var r={}.toString;if(r){var t=r.call(n);if(t==="[object Window]"||t==="[object global]"||t==="[object DOMWindow]")return!1}if(typeof n.then=="function")return!0}catch{return!1}return!1}var Bn=[],en=[],Sn=0,on;function Gn(){if(!Sn&&on){var n=on;on=null,n.resolve()}}function Pn(){Sn+=1}function an(){Sn-=1,Gn()}var x=function(){function n(t){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=[],t){var o,i,a=!1,s=!1,c=!1;Pn();try{t(function(u){c?e.resolve(u):(a=!0,o=u)},function(u){c?e.reject(u):(s=!0,i=u)})}catch(u){an(),this.reject(u);return}an(),c=!0,a?this.resolve(o):s&&this.reject(i)}}var r=n.prototype;return r.resolve=function(t){if(this.resolved||this.rejected)return this;if(k(t))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=t,this.dispatch(),this},r.reject=function(t){var e=this;if(this.resolved||this.rejected)return this;if(k(t))throw new Error("Can not reject promise with another promise");if(!t){var o=t&&typeof t.toString=="function"?t.toString():{}.toString.call(t);t=new Error("Expected reject to be called with Error, got "+o)}return this.rejected=!0,this.error=t,this.errorHandled||setTimeout(function(){e.errorHandled||function(i,a){if(Bn.indexOf(i)===-1){Bn.push(i),setTimeout(function(){throw i},1);for(var s=0;s<en.length;s++)en[s](i,a)}}(t,e)},1),this.dispatch(),this},r.asyncReject=function(t){return this.errorHandled=!0,this.reject(t),this},r.dispatch=function(){var t=this.resolved,e=this.rejected,o=this.handlers;if(!this.dispatching&&(t||e)){this.dispatching=!0,Pn();for(var i=function(l,p){return l.then(function(w){p.resolve(w)},function(w){p.reject(w)})},a=0;a<o.length;a++){var s=o[a],c=s.onSuccess,u=s.onError,h=s.promise,d=void 0;if(t)try{d=c?c(this.value):this.value}catch(l){h.reject(l);continue}else if(e){if(!u){h.reject(this.error);continue}try{d=u(this.error)}catch(l){h.reject(l);continue}}if(d instanceof n&&(d.resolved||d.rejected)){var f=d;f.resolved?h.resolve(f.value):h.reject(f.error),f.errorHandled=!0}else k(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?h.resolve(d.value):h.reject(d.error):i(d,h):h.resolve(d)}o.length=0,this.dispatching=!1,an()}},r.then=function(t,e){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.then expected a function for success handler");if(e&&typeof e!="function"&&!e.call)throw new Error("Promise.then expected a function for error handler");var o=new n;return this.handlers.push({promise:o,onSuccess:t,onError:e}),this.errorHandled=!0,this.dispatch(),o},r.catch=function(t){return this.then(void 0,t)},r.finally=function(t){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(e){return n.try(t).then(function(){return e})},function(e){return n.try(t).then(function(){throw e})})},r.timeout=function(t,e){var o=this;if(this.resolved||this.rejected)return this;var i=setTimeout(function(){o.resolved||o.rejected||o.reject(e||new Error("Promise timed out after "+t+"ms"))},t);return this.then(function(a){return clearTimeout(i),a})},r.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},r.lazy=function(){return this.errorHandled=!0,this},n.resolve=function(t){return t instanceof n?t:k(t)?new n(function(e,o){return t.then(e,o)}):new n().resolve(t)},n.reject=function(t){return new n().reject(t)},n.asyncReject=function(t){return new n().asyncReject(t)},n.all=function(t){var e=new n,o=t.length,i=[].slice();if(!o)return e.resolve(i),e;for(var a=function(u,h,d){return h.then(function(f){i[u]=f,(o-=1)==0&&e.resolve(i)},function(f){d.reject(f)})},s=0;s<t.length;s++){var c=t[s];if(c instanceof n){if(c.resolved){i[s]=c.value,o-=1;continue}}else if(!k(c)){i[s]=c,o-=1;continue}a(s,n.resolve(c),e)}return o===0&&e.resolve(i),e},n.hash=function(t){var e={},o=[],i=function(s){if(t.hasOwnProperty(s)){var c=t[s];k(c)?o.push(c.then(function(u){e[s]=u})):e[s]=c}};for(var a in t)i(a);return n.all(o).then(function(){return e})},n.map=function(t,e){return n.all(t.map(e))},n.onPossiblyUnhandledException=function(t){return function(e){return en.push(e),{cancel:function(){en.splice(en.indexOf(e),1)}}}(t)},n.try=function(t,e,o){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.try expected a function");var i;Pn();try{i=t.apply(e,o||[])}catch(a){return an(),n.reject(a)}return an(),n.resolve(i)},n.delay=function(t){return new n(function(e){setTimeout(e,t)})},n.isPromise=function(t){return!!(t&&t instanceof n)||k(t)},n.flush=function(){return function(t){var e=on=on||new t;return Gn(),e}(n)},n}();function yn(n,r){for(var t=0;t<n.length;t++)try{if(n[t]===r)return t}catch{}return-1}var bn=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(typeof WeakMap>"u"||Object.freeze===void 0)return!1;try{var t=new WeakMap,e={};return Object.freeze(e),t.set(e,"__testvalue__"),t.get(e)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var r=n.prototype;return r._cleanupClosedWindows=function(){for(var t=this.weakmap,e=this.keys,o=0;o<e.length;o++){var i=e[o];if(gn(i)&&G(i)){if(t)try{t.delete(i)}catch{}e.splice(o,1),this.values.splice(o,1),o-=1}}},r.isSafeToReadWrite=function(t){return!gn(t)},r.set=function(t,e){if(!t)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(t,e)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var i=this.name,a=t[i];a&&a[0]===t?a[1]=e:Object.defineProperty(t,i,{value:[t,e],writable:!0});return}catch{}this._cleanupClosedWindows();var s=this.keys,c=this.values,u=yn(s,t);u===-1?(s.push(t),c.push(e)):c[u]=e},r.get=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(t))return e.get(t)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return o&&o[0]===t?o[1]:void 0}catch{}this._cleanupClosedWindows();var i=yn(this.keys,t);if(i!==-1)return this.values[i]},r.delete=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(t)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];o&&o[0]===t&&(o[0]=o[1]=void 0)}catch{}this._cleanupClosedWindows();var i=this.keys,a=yn(i,t);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},r.has=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(t))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return!(!o||o[0]!==t)}catch{}return this._cleanupClosedWindows(),yn(this.keys,t)!==-1},r.getOrSet=function(t,e){if(this.has(t))return this.get(t);var o=e();return this.set(t,o),o},n}();function Jn(n){return n.name||n.__name__||n.displayName||"anonymous"}function qn(n,r){try{delete n.name,n.name=r}catch{}return n.__name__=n.displayName=r,n}function Z(){var n="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(r){if(typeof btoa=="function")return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))})).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(r,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var En;function Zn(n){try{return JSON.stringify([].slice.call(n),function(r,t){return typeof t=="function"?"memoize["+function(e){if(En=En||new bn,e==null||typeof e!="object"&&typeof e!="function")throw new Error("Invalid object");var o=En.get(e);return o||(o=typeof e+":"+Z(),En.set(e,o)),o}(t)+"]":typeof window<"u"&&t instanceof window.Element||t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object"?{}:t})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function zt(){return{}}var un=0,$n=0;function cn(n,r){r===void 0&&(r={});var t=r.thisNamespace,e=t!==void 0&&t,o=r.time,i,a,s=un;un+=1;var c=function(){for(var u=arguments.length,h=new Array(u),d=0;d<u;d++)h[d]=arguments[d];s<$n&&(i=null,a=null,s=un,un+=1);var f;f=e?(a=a||new bn).getOrSet(this,zt):i=i||{};var l;try{l=Zn(h)}catch{return n.apply(this,arguments)}var p=f[l];if(p&&o&&Date.now()-p.time<o&&(delete f[l],p=null),p)return p.value;var w=Date.now(),m=n.apply(this,arguments);return f[l]={time:w,value:m},m};return c.reset=function(){i=null,a=null},qn(c,(r.name||Jn(n))+"::memoized")}cn.clear=function(){$n=un};function jt(n){var r={};function t(){for(var e=arguments,o=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var c=Zn(a);return r.hasOwnProperty(c)||(r[c]=x.try(function(){return n.apply(o,e)}).finally(function(){delete r[c]})),r[c]}return t.reset=function(){r={}},qn(t,Jn(n)+"::promiseMemoized")}function Q(){}function sn(n,r){if(r===void 0&&(r=1),r>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if(typeof n=="string")return n;if(n instanceof Error){var t=n&&n.stack,e=n&&n.message;if(t&&e)return t.indexOf(e)!==-1?t:e+`
|
|
3
|
+
`+t;if(t)return t;if(e)return e}return n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}catch(o){return"Error while stringifying error: "+sn(o,r+1)}}function Vn(n){return typeof n=="string"?n:n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}cn(function(n){if(Object.values)return Object.values(n);var r=[];for(var t in n)n.hasOwnProperty(t)&&r.push(n[t]);return r});function In(n){return{}.toString.call(n)==="[object RegExp]"}function dn(n,r,t){if(n.hasOwnProperty(r))return n[r];var e=t();return n[r]=e,e}function Yn(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function Kn(){return!!document.body&&document.readyState==="complete"}function Xn(){return!!document.body&&document.readyState==="interactive"}cn(function(){return new x(function(n){if(Kn()||Xn())return n();var r=setInterval(function(){if(Kn()||Xn())return clearInterval(r),n()},10)})});var Wn=typeof document<"u"?document.currentScript:null,Tt=cn(function(){if(Wn||(Wn=function(){try{var n=function(){try{throw new Error("_")}catch(a){return a.stack||""}}(),r=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n),t=r&&r[1];if(!t)return;for(var e=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();e<o.length;e++){var i=o[e];if(i.src&&i.src===t)return i}}catch{}}()))return Wn;throw new Error("Can not determine current script")}),Ct=Z();cn(function(){var n;try{n=Tt()}catch{return Ct}var r=n.getAttribute("data-uid");if(r&&typeof r=="string"||(r=n.getAttribute("data-uid-auto"))&&typeof r=="string")return r;if(n.src){var t=function(e){for(var o="",i=0;i<e.length;i++){var a=e[i].charCodeAt(0)*i;e[i+1]&&(a+=e[i+1].charCodeAt(0)*(i-1)),o+=String.fromCharCode(97+Math.abs(a)%26)}return o}(JSON.stringify({src:n.src,dataset:n.dataset}));r="uid_"+t.slice(t.length-30)}else r=Z();return n.setAttribute("data-uid-auto",r),r});function fn(n){n===void 0&&(n=window);var r="__post_robot_10_0_46__";return n!==window?n[r]:n[r]=n[r]||{}}var kn=function(){return{}};function z(n,r){return n===void 0&&(n="store"),r===void 0&&(r=kn),dn(fn(),n,function(){var t=r();return{has:function(e){return t.hasOwnProperty(e)},get:function(e,o){return t.hasOwnProperty(e)?t[e]:o},set:function(e,o){return t[e]=o,o},del:function(e){delete t[e]},getOrSet:function(e,o){return dn(t,e,o)},reset:function(){t=r()},keys:function(){return Object.keys(t)}}})}var Mt=function(){};function xn(){var n=fn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new Mt,n.WINDOW_WILDCARD}function M(n,r){return n===void 0&&(n="store"),r===void 0&&(r=kn),z("windowStore").getOrSet(n,function(){var t=new bn,e=function(o){return t.getOrSet(o,r)};return{has:function(o){return e(o).hasOwnProperty(n)},get:function(o,i){var a=e(o);return a.hasOwnProperty(n)?a[n]:i},set:function(o,i){return e(o)[n]=i,i},del:function(o){delete e(o)[n]},getOrSet:function(o,i){return dn(e(o),n,i)}}})}function Qn(){return z("instance").getOrSet("instanceID",Z)}function _n(n,r){var t=r.domain,e=M("helloPromises"),o=e.get(n);o&&o.resolve({domain:t});var i=x.resolve({domain:t});return e.set(n,i),i}function On(n,r){return(0,r.send)(n,"postrobot_hello",{instanceID:Qn()},{domain:"*",timeout:-1}).then(function(t){var e=t.origin,o=t.data.instanceID;return _n(n,{domain:e}),{win:n,domain:e,instanceID:o}})}function nt(n,r){var t=r.send;return M("windowInstanceIDPromises").getOrSet(n,function(){return On(n,{send:t}).then(function(e){return e.instanceID})})}function tt(n){M("knownWindows").set(n,!0)}function An(n){return typeof n=="object"&&n!==null&&typeof n.__type__=="string"}function rt(n){return n===void 0?"undefined":n===null?"null":Array.isArray(n)?"array":typeof n=="function"?"function":typeof n=="object"?n instanceof Error?"error":typeof n.then=="function"?"promise":{}.toString.call(n)==="[object RegExp]"?"regex":{}.toString.call(n)==="[object Date]"?"date":"object":typeof n=="string"?"string":typeof n=="number"?"number":typeof n=="boolean"?"boolean":void 0}function _(n,r){return{__type__:n,__val__:r}}var H,Lt=((H={}).function=function(){},H.error=function(n){return _("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},H.promise=function(){},H.regex=function(n){return _("regex",n.source)},H.date=function(n){return _("date",n.toJSON())},H.array=function(n){return n},H.object=function(n){return n},H.string=function(n){return n},H.number=function(n){return n},H.boolean=function(n){return n},H.null=function(n){return n},H[void 0]=function(n){return _("undefined",n)},H),Ft={},U,Ht=((U={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},U.error=function(n){var r=n.stack,t=n.code,e=n.data,o=new Error(n.message);return o.code=t,e&&(o.data=e),o.stack=r+`
|
|
4
4
|
|
|
5
|
-
`+o.stack,o},U.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},U.regex=function(n){return new RegExp(n)},U.date=function(n){return new Date(n)},U.array=function(n){return n},U.object=function(n){return n},U.string=function(n){return n},U.number=function(n){return n},U.boolean=function(n){return n},U.null=function(n){return n},U[void 0]=function(){},U),Ut={};new x(function(n){if(window.document&&window.document.body)return n(window.document.body);var
|
|
5
|
+
`+o.stack,o},U.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},U.regex=function(n){return new RegExp(n)},U.date=function(n){return new Date(n)},U.array=function(n){return n},U.object=function(n){return n},U.string=function(n){return n},U.number=function(n){return n},U.boolean=function(n){return n},U.null=function(n){return n},U[void 0]=function(){},U),Ut={};new x(function(n){if(window.document&&window.document.body)return n(window.document.body);var r=setInterval(function(){if(window.document&&window.document.body)return clearInterval(r),n(window.document.body)},10)});function Dn(){for(var n=z("idToProxyWindow"),r=0,t=n.keys();r<t.length;r++){var e=t[r];n.get(e).shouldClean()&&n.del(e)}}function et(n,r){var t=r.send,e=r.id,o=e===void 0?Z():e,i=n.then(function(c){if(X(c))return pn(c).name}),a=n.then(function(c){if(G(c))throw new Error("Window is closed, can not determine type");return Mn(c)?"popup":"iframe"});i.catch(Q),a.catch(Q);var s=function(){return n.then(function(c){if(!G(c))return X(c)?pn(c).name:i})};return{id:o,getType:function(){return a},getInstanceID:jt(function(){return n.then(function(c){return nt(c,{send:t})})}),close:function(){return n.then(Rt)},getName:s,focus:function(){return n.then(function(c){c.focus()})},isClosed:function(){return n.then(function(c){return G(c)})},setLocation:function(c,u){return u===void 0&&(u={}),n.then(function(h){var d=window.location.protocol+"//"+window.location.host,f=u.method,l=f===void 0?"get":f,p=u.body;if(c.indexOf("/")===0)c=""+d+c;else if(!c.match(/^https?:\/\//)&&c.indexOf(d)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(c));if(l==="post")return s().then(function(w){if(!w)throw new Error("Can not post to window without target name");(function(m){var S=m.url,R=m.target,b=m.body,P=m.method,j=P===void 0?"post":P,E=document.createElement("form");if(E.setAttribute("target",R),E.setAttribute("method",j),E.setAttribute("action",S),E.style.display="none",b)for(var I=0,J=Object.keys(b);I<J.length;I++){var D,hn=J[I],jn=document.createElement("input");jn.setAttribute("name",hn),jn.setAttribute("value",(D=b[hn])==null?void 0:D.toString()),E.appendChild(jn)}Yn().appendChild(E),E.submit(),Yn().removeChild(E)})({url:c,target:w,method:l,body:p})});if(l!=="get")throw new Error("Unsupported method: "+l);if(X(h))try{if(h.location&&typeof h.location.replace=="function"){h.location.replace(c);return}}catch{}h.location=c})},setName:function(c){return n.then(function(u){var h=X(u),d=Un(u);if(!h)throw new Error("Can not set name for cross-domain window: "+c);pn(u).name=c,d&&d.setAttribute("name",c),i=x.resolve(c)})}}}var B=function(){function n(t){var e=t.send,o=t.win,i=t.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 x,this.serializedWindow=i||et(this.actualWindowPromise,{send:e}),z("idToProxyWindow").set(this.getID(),this),o&&this.setWindow(o,{send:e})}var r=n.prototype;return r.getID=function(){return this.serializedWindow.id},r.getType=function(){return this.serializedWindow.getType()},r.isPopup=function(){return this.getType().then(function(t){return t==="popup"})},r.setLocation=function(t,e){var o=this;return this.serializedWindow.setLocation(t,e).then(function(){return o})},r.getName=function(){return this.serializedWindow.getName()},r.setName=function(t){var e=this;return this.serializedWindow.setName(t).then(function(){return e})},r.close=function(){var t=this;return this.serializedWindow.close().then(function(){return t})},r.focus=function(){var t=this,e=this.isPopup(),o=this.getName(),i=x.hash({isPopup:e,name:o}).then(function(s){var c=s.name;s.isPopup&&c&&window.open("",c,"noopener")}),a=this.serializedWindow.focus();return x.all([i,a]).then(function(){return t})},r.isClosed=function(){return this.serializedWindow.isClosed()},r.getWindow=function(){return this.actualWindow},r.setWindow=function(t,e){var o=e.send;this.actualWindow=t,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=et(this.actualWindowPromise,{send:o,id:this.getID()}),M("winToProxyWindow").set(t,this)},r.awaitWindow=function(){return this.actualWindowPromise},r.matchWindow=function(t,e){var o=this,i=e.send;return x.try(function(){return o.actualWindow?t===o.actualWindow:x.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:nt(t,{send:i})}).then(function(a){var s=a.proxyInstanceID===a.knownWindowInstanceID;return s&&o.setWindow(t,{send:i}),s})})},r.unwrap=function(){return this.actualWindow||this},r.getInstanceID=function(){return this.serializedWindow.getInstanceID()},r.shouldClean=function(){return!!(this.actualWindow&&G(this.actualWindow))},r.serialize=function(){return this.serializedWindow},n.unwrap=function(t){return n.isProxyWindow(t)?t.unwrap():t},n.serialize=function(t,e){var o=e.send;return Dn(),n.toProxyWindow(t,{send:o}).serialize()},n.deserialize=function(t,e){var o=e.send;return Dn(),z("idToProxyWindow").get(t.id)||new n({serializedWindow:t,send:o})},n.isProxyWindow=function(t){return!!(t&&!gn(t)&&t.isProxyWindow)},n.toProxyWindow=function(t,e){var o=e.send;if(Dn(),n.isProxyWindow(t))return t;var i=t;return M("winToProxyWindow").get(i)||new n({win:i,send:o})},n}();function Nn(n,r,t,e,o){var i=M("methodStore"),a=z("proxyWindowMethods");B.isProxyWindow(e)?a.set(n,{val:r,name:t,domain:o,source:e}):(a.del(n),i.getOrSet(e,function(){return{}})[n]={domain:o,name:t,val:r,source:e})}function ot(n,r){var t=M("methodStore"),e=z("proxyWindowMethods");return t.getOrSet(n,function(){return{}})[r]||e.get(r)}function it(n,r,t,e,o){a=(i={on:o.on,send:o.send}).on,s=i.send,z("builtinListeners").getOrSet("functionCalls",function(){return a("postrobot_method",{domain:"*"},function(h){var d=h.source,f=h.origin,l=h.data,p=l.id,w=l.name,m=ot(d,p);if(!m)throw new Error("Could not find method '"+w+"' with id: "+l.id+" in "+C(window));var S=m.source,R=m.domain,b=m.val;return x.try(function(){if(!rn(R,f))throw new Error("Method '"+l.name+"' domain "+JSON.stringify(In(m.domain)?m.domain.source:m.domain)+" does not match origin "+f+" in "+C(window));if(B.isProxyWindow(S))return S.matchWindow(d,{send:s}).then(function(P){if(!P)throw new Error("Method call '"+l.name+"' failed - proxy window does not match source in "+C(window))})}).then(function(){return b.apply({source:d,origin:f},l.args)},function(P){return x.try(function(){if(b.onError)return b.onError(P)}).then(function(){throw P.stack&&(P.stack="Remote call to "+w+"("+function(j){return j===void 0&&(j=[]),(E=j,[].slice.call(E)).map(function(I){return typeof I=="string"?"'"+I+"'":I===void 0?"undefined":I===null?"null":typeof I=="boolean"?I.toString():Array.isArray(I)?"[ ... ]":typeof I=="object"?"{ ... }":typeof I=="function"?"() => { ... }":"<"+typeof I+">"}).join(", ");var E}(l.args)+`) failed
|
|
6
6
|
|
|
7
|
-
`+P.stack),P})}).then(function(P){return{result:P,id:p,name:w}})})});var i,a,s,c=t.__id__||Z();n=B.unwrap(n);var u=t.__name__||t.name||
|
|
7
|
+
`+P.stack),P})}).then(function(P){return{result:P,id:p,name:w}})})});var i,a,s,c=t.__id__||Z();n=B.unwrap(n);var u=t.__name__||t.name||e;return typeof u=="string"&&typeof u.indexOf=="function"&&u.indexOf("anonymous::")===0&&(u=u.replace("anonymous::",e+"::")),B.isProxyWindow(n)?(Nn(c,t,u,n,r),n.awaitWindow().then(function(h){Nn(c,t,u,h,r)})):Nn(c,t,u,n,r),_("cross_domain_function",{id:c,name:u})}function at(n,r,t,e){var o,i=e.on,a=e.send;return function(s,c){c===void 0&&(c=Ft);var u=JSON.stringify(s,function(h){var d=this[h];if(An(this))return d;var f=rt(d);if(!f)return d;var l=c[f]||Lt[f];return l?l(d,h):d});return u===void 0?"undefined":u}(t,((o={}).promise=function(s,c){return function(u,h,d,f,l){return _("cross_domain_zalgo_promise",{then:it(u,h,function(p,w){return d.then(p,w)},f,{on:l.on,send:l.send})})}(n,r,s,c,{on:i,send:a})},o.function=function(s,c){return it(n,r,s,c,{on:i,send:a})},o.object=function(s){return gn(s)||B.isProxyWindow(s)?_("cross_domain_window",B.serialize(s,{send:a})):s},o))}function ut(n,r,t,e){var o,i=e.send;return function(a,s){if(s===void 0&&(s=Ut),a!=="undefined")return JSON.parse(a,function(c,u){if(An(this))return u;var h,d;if(An(u)?(h=u.__type__,d=u.__val__):(h=rt(u),d=u),!h)return d;var f=s[h]||Ht[h];return f?f(d,c):d})}(t,((o={}).cross_domain_zalgo_promise=function(a){return function(s,c,u){return new x(u.then)}(0,0,a)},o.cross_domain_function=function(a){return function(s,c,u,h){var d=u.id,f=u.name,l=h.send,p=function(m){m===void 0&&(m={});function S(){var R=arguments;return B.toProxyWindow(s,{send:l}).awaitWindow().then(function(b){var P=ot(b,d);if(P&&P.val!==S)return P.val.apply({source:window,origin:C()},R);var j=[].slice.call(R);return m.fireAndForget?l(b,"postrobot_method",{id:d,name:f,args:j},{domain:c,fireAndForget:!0}):l(b,"postrobot_method",{id:d,name:f,args:j},{domain:c,fireAndForget:!1}).then(function(E){return E.data.result})}).catch(function(b){throw b})}return S.__name__=f,S.__origin__=c,S.__source__=s,S.__id__=d,S.origin=c,S},w=p();return w.fireAndForget=p({fireAndForget:!0}),w}(n,r,a,{send:i})},o.cross_domain_window=function(a){return B.deserialize(a,{send:i})},o))}var Rn={};Rn.postrobot_post_message=function(n,r,t){t.indexOf("file:")===0&&(t="*"),n.postMessage(r,t)};function zn(n,r,t,e){var o=e.on,i=e.send;return x.try(function(){var a=M().getOrSet(n,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(t),a.flush=a.flush||x.flush().then(function(){if(G(n))throw new Error("Window is closed");var s=at(n,r,((c={}).__post_robot_10_0_46__=a.buffer||[],c),{on:o,send:i}),c;delete a.buffer;for(var u=Object.keys(Rn),h=[],d=0;d<u.length;d++){var f=u[d];try{Rn[f](n,s,r)}catch(l){h.push(l)}}if(h.length===u.length)throw new Error(`All post-robot messaging strategies failed:
|
|
8
8
|
|
|
9
9
|
`+h.map(function(l,p){return p+". "+sn(l)}).join(`
|
|
10
10
|
|
|
11
|
-
`))}),a.flush.then(function(){delete a.flush})}).then(Q)}function ct(n){return z("responseListeners").get(n)}function st(n){z("responseListeners").del(n)}function dt(n){return z("erroredResponseListeners").has(n)}function ft(n){var
|
|
11
|
+
`))}),a.flush.then(function(){delete a.flush})}).then(Q)}function ct(n){return z("responseListeners").get(n)}function st(n){z("responseListeners").del(n)}function dt(n){return z("erroredResponseListeners").has(n)}function ft(n){var r=n.name,t=n.win,e=n.domain,o=M("requestListeners");if(t==="*"&&(t=null),e==="*"&&(e=null),!r)throw new Error("Name required to get request listener");for(var i=0,a=[t,xn()];i<a.length;i++){var s=a[i];if(s){var c=o.get(s);if(c){var u=c[r];if(u){if(e&&typeof e=="string"){if(u[e])return u[e];if(u.__domain_regex__)for(var h=0,d=u.__domain_regex__;h<d.length;h++){var f=d[h],l=f.listener;if(rn(f.regex,e))return l}}if(u["*"])return u["*"]}}}}}function Bt(n,r,t,e){var o=e.on,i=e.send,a=ft({name:t.name,win:n,domain:r}),s=t.name==="postrobot_method"&&t.data&&typeof t.data.name=="string"?t.data.name+"()":t.name;function c(u,h,d){return x.flush().then(function(){if(!t.fireAndForget&&!G(n))try{return zn(n,r,{id:Z(),origin:C(window),type:"postrobot_message_response",hash:t.hash,name:t.name,ack:u,data:h,error:d},{on:o,send:i})}catch(f){throw new Error("Send response message failed for "+s+" in "+C()+`
|
|
12
12
|
|
|
13
|
-
`+sn(f))}})}return x.all([x.flush().then(function(){if(!t.fireAndForget&&!G(n))try{return zn(n,
|
|
13
|
+
`+sn(f))}})}return x.all([x.flush().then(function(){if(!t.fireAndForget&&!G(n))try{return zn(n,r,{id:Z(),origin:C(window),type:"postrobot_message_ack",hash:t.hash,name:t.name},{on:o,send:i})}catch(u){throw new Error("Send ack message failed for "+s+" in "+C()+`
|
|
14
14
|
|
|
15
|
-
`+sn(u))}}),x.try(function(){if(!a)throw new Error("No handler found for post message: "+t.name+" from "+
|
|
15
|
+
`+sn(u))}}),x.try(function(){if(!a)throw new Error("No handler found for post message: "+t.name+" from "+r+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:n,origin:r,data:t.data})}).then(function(u){return c("success",u)},function(u){return c("error",null,u)})]).then(Q).catch(function(u){if(a&&a.handleError)return a.handleError(u);throw u})}function Gt(n,r,t){if(!dt(t.hash)){var e=ct(t.hash);if(!e)throw new Error("No handler found for post message ack for message: "+t.name+" from "+r+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!rn(e.domain,r))throw new Error("Ack origin "+r+" does not match domain "+e.domain.toString());if(n!==e.win)throw new Error("Ack source does not match registered window")}catch(o){e.promise.reject(o)}e.ack=!0}}function Jt(n,r,t){if(!dt(t.hash)){var e=ct(t.hash);if(!e)throw new Error("No handler found for post message response for message: "+t.name+" from "+r+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!rn(e.domain,r))throw new Error("Response origin "+r+" does not match domain "+(o=e.domain,Array.isArray(o)?"("+o.join(" | ")+")":v(o)?"RegExp("+o.toString()+")":o.toString()));var o;if(n!==e.win)throw new Error("Response source does not match registered window");st(t.hash),t.ack==="error"?e.promise.reject(t.error):t.ack==="success"&&e.promise.resolve({source:n,origin:r,data:t.data})}}function ht(n,r){var t=r.on,e=r.send,o=z("receivedMessages");try{if(!window||window.closed||!n.source)return}catch{return}var i=n.source,a=n.origin,s=function(h,d,f,l){var p=l.on,w=l.send,m;try{m=ut(d,f,h,{on:p,send:w})}catch{return}if(m&&typeof m=="object"&&m!==null){var S=m.__post_robot_10_0_46__;if(Array.isArray(S))return S}}(n.data,i,a,{on:t,send:e});if(s){tt(i);for(var c=0;c<s.length;c++){var u=s[c];if(o.has(u.id)||(o.set(u.id,!0),G(i)&&!u.fireAndForget))return;u.origin.indexOf("file:")===0&&(a="file://");try{u.type==="postrobot_message_request"?Bt(i,a,u,{on:t,send:e}):u.type==="postrobot_message_response"?Jt(i,a,u):u.type==="postrobot_message_ack"&&Gt(i,a,u)}catch(h){setTimeout(function(){throw h},0)}}}}function V(n,r,t){if(!n)throw new Error("Expected name");if(typeof(r=r||{})=="function"&&(t=r,r={}),!t)throw new Error("Expected handler");var e=function o(i,a){var s=i.name,c=i.win,u=i.domain,h=M("requestListeners");if(!s||typeof s!="string")throw new Error("Name required to add request listener");if(c&&c!=="*"&&B.isProxyWindow(c)){var d=c.awaitWindow().then(function(D){return o({name:s,win:D,domain:u},a)});return{cancel:function(){d.then(function(D){return D.cancel()},Q)}}}var f=c;if(Array.isArray(f)){for(var l=[],p=0,w=f;p<w.length;p++)l.push(o({name:s,domain:u,win:w[p]},a));return{cancel:function(){for(var D=0;D<l.length;D++)l[D].cancel()}}}if(Array.isArray(u)){for(var m=[],S=0,R=u;S<R.length;S++)m.push(o({name:s,win:f,domain:R[S]},a));return{cancel:function(){for(var D=0;D<m.length;D++)m[D].cancel()}}}var b=ft({name:s,win:f,domain:u});f&&f!=="*"||(f=xn());var P=(u=u||"*").toString();if(b)throw f&&u?new Error("Request listener already exists for "+s+" on domain "+u.toString()+" for "+(f===xn()?"wildcard":"specified")+" window"):f?new Error("Request listener already exists for "+s+" for "+(f===xn()?"wildcard":"specified")+" window"):u?new Error("Request listener already exists for "+s+" on domain "+u.toString()):new Error("Request listener already exists for "+s);var j=h.getOrSet(f,function(){return{}}),E=dn(j,s,function(){return{}}),I,J;return In(u)?(I=dn(E,"__domain_regex__",function(){return[]})).push(J={regex:u,listener:a}):E[P]=a,{cancel:function(){delete E[P],J&&(I.splice(I.indexOf(J,1)),I.length||delete E.__domain_regex__),Object.keys(E).length||delete j[s],f&&!Object.keys(j).length&&h.del(f)}}}({name:n,win:r.window,domain:r.domain||"*"},{handler:t||r.handler,handleError:r.errorHandler||function(o){throw o}});return{cancel:function(){e.cancel()}}}function qt(n,r,t){typeof(r=r||{})=="function"&&(t=r,r={});var e=new x,o;return r.errorHandler=function(i){o.cancel(),e.reject(i)},o=V(n,r,function(i){if(o.cancel(),e.resolve(i),t)return t(i)}),e.cancel=o.cancel,e}var Y=function n(r,t,e,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,s=o.timeout||5e3,c=o.fireAndForget||!1;return B.toProxyWindow(r,{send:n}).awaitWindow().then(function(u){return x.try(function(){if(function(h,d,f){if(!h)throw new Error("Expected name");if(f&&typeof f!="string"&&!Array.isArray(f)&&!In(f))throw new TypeError("Can not send "+h+". Expected domain "+JSON.stringify(f)+" to be a string, array, or regex");if(G(d))throw new Error("Can not send "+h+". Target window is closed")}(t,u,i),function(h,d){var f=Hn(d);if(f)return f===h;if(d===h||function(w){w===void 0&&(w=window);try{if(w.top)return w.top}catch{}if($(w)===w)return w;try{if(Ln(window,w)&&window.top)return window.top}catch{}try{if(Ln(w,window)&&window.top)return window.top}catch{}for(var m=0,S=function b(P){for(var j=[],E=0,I=Fn(P);E<I.length;E++){var J=I[E];j.push(J);for(var D=0,hn=b(J);D<hn.length;D++)j.push(hn[D])}return j}(w);m<S.length;m++){var R=S[m];try{if(R.top)return R.top}catch{}if($(R)===R)return R}}(d)===d)return!1;for(var l=0,p=Fn(h);l<p.length;l++)if(p[l]===d)return!0;return!1}(window,u))return function(h,d,f){d===void 0&&(d=5e3),f===void 0&&(f="Window");var l=function(p){return M("helloPromises").getOrSet(p,function(){return new x})}(h);return d!==-1&&(l=l.timeout(d,new Error(f+" did not load after "+d+"ms"))),l}(u,s)}).then(function(h){return function(d,f,l,p){var w=p.send;return x.try(function(){return typeof f=="string"?f:x.try(function(){return l||On(d,{send:w}).then(function(m){return m.domain})}).then(function(m){if(!rn(f,f))throw new Error("Domain "+Vn(f)+" does not match "+Vn(f));return m})})}(u,i,(h===void 0?{}:h).domain,{send:n})}).then(function(h){var d=h,f=t==="postrobot_method"&&e&&typeof e.name=="string"?e.name+"()":t,l=new x,p=t+"_"+Z();if(!c){var w={name:t,win:u,domain:d,promise:l};(function(E,I){z("responseListeners").set(E,I)})(p,w);var m=M("requestPromises").getOrSet(u,function(){return[]});m.push(l),l.catch(function(){(function(E){z("erroredResponseListeners").set(E,!0)})(p),st(p)});var S=function(E){return M("knownWindows").get(E,!1)}(u)?1e4:2e3,R=a,b=S,P=R,j=function(E,I){var J;return function D(){J=setTimeout(function(){(function(){if(G(u))return l.reject(new Error("Window closed for "+t+" before "+(w.ack?"response":"ack")));if(w.cancelled)return l.reject(new Error("Response listener was cancelled for "+t));b=Math.max(b-500,0),P!==-1&&(P=Math.max(P-500,0)),w.ack||b!==0?P===0&&l.reject(new Error("No response for postMessage "+f+" in "+C()+" in "+R+"ms")):l.reject(new Error("No ack for postMessage "+f+" in "+C()+" in "+S+"ms"))})(),D()},500)}(),{cancel:function(){clearTimeout(J)}}}();l.finally(function(){j.cancel(),m.splice(m.indexOf(l,1))}).catch(Q)}return zn(u,d,{id:Z(),origin:C(window),type:"postrobot_message_request",hash:p,name:t,data:e,fireAndForget:c},{on:V,send:n}).then(function(){return c?l.resolve():l},function(E){throw new Error("Send request message failed for "+f+" in "+C()+`
|
|
16
16
|
|
|
17
|
-
`+sn(E))})})})};function Zt(n,
|
|
17
|
+
`+sn(E))})})})};function Zt(n,r,t){return at(n,r,t,{on:V,send:Y})}function $t(n,r,t){return ut(n,r,t,{on:V,send:Y})}function Vt(n){return new B({send:Y,win:n})}function Yt(n){return B.toProxyWindow(n,{send:Y})}function lt(){fn().initialized||(fn().initialized=!0,r=(n={on:V,send:Y}).on,t=n.send,(e=fn()).receiveMessage=e.receiveMessage||function(o){return ht(o,{on:r,send:t})},function(o){var i=o.on,a=o.send;z().getOrSet("postMessageListener",function(){return function(s,c,u){return s.addEventListener("message",u),{cancel:function(){s.removeEventListener("message",u)}}}(window,0,function(s){(function(c,u){var h=u.on,d=u.send;x.try(function(){var f=c.source||c.sourceElement,l=c.origin||c.originalEvent&&c.originalEvent.origin,p=c.data;if(l==="null"&&(l="file://"),f){if(!l)throw new Error("Post message did not have origin domain");ht({source:f,origin:l,data:p},{on:h,send:d})}})})(s,{on:i,send:a})})})}({on:V,send:Y}),function(o){var i=o.on,a=o.send;z("builtinListeners").getOrSet("helloListener",function(){var s=i("postrobot_hello",{domain:"*"},function(u){return _n(u.source,{domain:u.origin}),{instanceID:Qn()}}),c=Hn();return c&&On(c,{send:a}).catch(function(u){}),s})}({on:V,send:Y}));var n,r,t,e}function Kt(){(function(){for(var r=z("responseListeners"),t=0,e=r.keys();t<e.length;t++){var o=e[t],i=r.get(o);i&&(i.cancelled=!0),r.del(o)}})(),(n=z().get("postMessageListener"))&&n.cancel();var n;delete window.__post_robot_10_0_46__}var Xt=!0;function kt(n){for(var r=0,t=M("requestPromises").get(n,[]);r<t.length;r++)t[r].reject(new Error("Window "+(G(n)?"closed":"cleaned up")+" before response")).catch(Q)}lt()}])})})(Cn);var xt=Cn.exports;(function(A){A.exports=xt,A.exports.default=A.exports})(Tn);var St=Tn.exports;const Pt=Wt(St),bt="WIDGET_EVENT";function It(A){const{onEvent:T}=A;Pt.on(bt,q=>{T(q.data),L.includes(q.data.eventName)&&yt()})}function Ot(A){It(A)}class At{constructor(T){vt(this,vn);ln(this,"flow");ln(this,"configProps");ln(this,"onEvent");ln(this,"isSandbox");this.flow=T.flow,this.configProps=T.configProps,this.onEvent=T.onEvent,this.isSandbox=T.isSandbox??!1,this.validateProps(),gt(this.flow,this.configProps,this.isSandbox,T.developmentUrl),Ot({onEvent:wt(this,vn,mt).bind(this)})}validateProps(){if(this.flow==="authenticate"){if(!this.configProps.identityId)throw new Error("identityId is required");if(!this.configProps.companyId)throw new Error("companyId is required")}else if(this.flow==="register"){if(!this.configProps.flowTemplateId)throw new Error("flowTemplateId is required");if(!this.configProps.companyId)throw new Error("companyId is required")}}}return vn=new WeakSet,mt=function(T){this.onEvent(T)},At});
|