@soyio/soyio-widget 0.0.14 → 0.0.15

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.
@@ -1,17 +1,17 @@
1
- (function(U,j){typeof exports=="object"&&typeof module<"u"?module.exports=j():typeof define=="function"&&define.amd?define(j):(U=typeof globalThis<"u"?globalThis:U||self,U["soyio-widget"]=j())})(this,function(){"use strict";var Xr=Object.defineProperty;var $r=(U,j,Y)=>j in U?Xr(U,j,{enumerable:!0,configurable:!0,writable:!0,value:Y}):U[j]=Y;var En=(U,j,Y)=>($r(U,typeof j!="symbol"?j+"":j,Y),Y);const U="soyio-widget-iframe-container",j="soyio-widget-iframe",Y="https://staging.soyio.id/widget";function lr(S,M,T){let y=T??Y;return y+=`/${S}?`,S==="authenticate"?y+=`isMobile=true&companyId=${M.companyId}&identityId=${M.identityId}`:S==="register"?y+=`isMobile=true&companyId=${M.companyId}&flowTemplateId=${M.flowTemplateId}`:y+="INVALID PARAMS: ",y}function vr(){return!!document.getElementById(j)}function wr(){return document.getElementById(U)}function mr(S,M,T){const y=wr();if(!y)throw new Error("Iframe container does not exist");const v=document.createElement("iframe");return v.src=lr(S,M,T),v.id=j,v.style.zIndex=String(Number.MAX_SAFE_INTEGER),v.style.width="100%",v.style.height="100%",y.appendChild(v),v}function pr(S,M,T){return vr()?document.getElementById(j):mr(S,M,T)}var gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yr(S){return S&&S.__esModule&&Object.prototype.hasOwnProperty.call(S,"default")?S.default:S}var Mn={exports:{}},Nn={exports:{}};(function(S,M){(function(T,y){S.exports=y()})(typeof self<"u"?self:gr,function(){return function(T){var y={};function v(g){if(y[g])return y[g].exports;var W=y[g]={i:g,l:!1,exports:{}};return T[g].call(W.exports,W,W.exports,v),W.l=!0,W.exports}return v.m=T,v.c=y,v.d=function(g,W,Z){v.o(g,W)||Object.defineProperty(g,W,{enumerable:!0,get:Z})},v.r=function(g){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(g,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(g,"__esModule",{value:!0})},v.t=function(g,W){if(1&W&&(g=v(g)),8&W||4&W&&typeof g=="object"&&g&&g.__esModule)return g;var Z=Object.create(null);if(v.r(Z),Object.defineProperty(Z,"default",{enumerable:!0,value:g}),2&W&&typeof g!="string")for(var nn in g)v.d(Z,nn,(function(dn){return g[dn]}).bind(null,nn));return Z},v.n=function(g){var W=g&&g.__esModule?function(){return g.default}:function(){return g};return v.d(W,"a",W),W},v.o=function(g,W){return{}.hasOwnProperty.call(g,W)},v.p="",v(v.s=0)}([function(T,y,v){v.r(y),v.d(y,"Promise",function(){return x}),v.d(y,"TYPES",function(){return Yr}),v.d(y,"ProxyWindow",function(){return B}),v.d(y,"setup",function(){return hr}),v.d(y,"destroy",function(){return Vr}),v.d(y,"serializeMessage",function(){return Ur}),v.d(y,"deserializeMessage",function(){return Gr}),v.d(y,"createProxyWindow",function(){return Zr}),v.d(y,"toProxyWindow",function(){return qr}),v.d(y,"on",function(){return q}),v.d(y,"once",function(){return Jr}),v.d(y,"send",function(){return V}),v.d(y,"markWindowKnown",function(){return nr}),v.d(y,"cleanUpWindow",function(){return Kr}),v.d(y,"bridge",function(){});function g(n){return{}.toString.call(n)==="[object RegExp]"}var W=`Call was rejected by callee.\r
2
- `;function Z(n){return n===void 0&&(n=window),n.location.protocol}function nn(n){if(n===void 0&&(n=window),n.mockDomain){var t=n.mockDomain.split("//")[0];if(t)return t}return Z(n)}function dn(n){return n===void 0&&(n=window),nn(n)==="about:"}function K(n){if(n===void 0&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch{}}function Cn(n){if(n===void 0&&(n=window),n&&!K(n))try{return n.opener}catch{}}function hn(n){try{return!0}catch{}return!1}function ln(n){n===void 0&&(n=window);var t=n.location;if(!t)throw new Error("Can not read window location");var r=Z(n);if(!r)throw new Error("Can not read window protocol");if(r==="file:")return"file://";if(r==="about:"){var e=K(n);return e&&hn()?ln(e):"about://"}var o=t.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function N(n){n===void 0&&(n=window);var t=ln(n);return t&&n.mockDomain&&n.mockDomain.indexOf("mock:")===0?n.mockDomain:t}function X(n){if(!function(t){try{if(t===window)return!0}catch{}try{var r=Object.getOwnPropertyDescriptor(t,"location");if(r&&r.enumerable===!1)return!1}catch{}try{if(dn(t)&&hn())return!0}catch{}try{if(function(e){return e===void 0&&(e=window),nn(e)==="mock:"}(t)&&hn())return!0}catch{}try{if(ln(t)===ln(window))return!0}catch{}return!1}(n))return!1;try{if(n===window||dn(n)&&hn()||N(window)===N(n))return!0}catch{}return!1}function vn(n){if(!X(n))throw new Error("Expected window to be same domain");return n}function Tn(n,t){if(!n||!t)return!1;var r=K(t);return r?r===n:function(e){var o=[];try{for(;e.parent!==e;)o.push(e.parent),e=e.parent}catch{}return o}(t).indexOf(n)!==-1}function Ln(n){var t=[],r;try{r=n.frames}catch{r=n}var e;try{e=r.length}catch{}if(e===0)return t;if(e){for(var o=0;o<e;o++){var i=void 0;try{i=r[o]}catch{continue}t.push(i)}return t}for(var a=0;a<100;a++){var s=void 0;try{s=r[a]}catch{return t}if(!s)return t;t.push(s)}return t}var Ir=[],Ar=[];function H(n,t){t===void 0&&(t=!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!==W}if(t&&X(n))try{if(n.mockclosed)return!0}catch{}try{if(!n.parent||!n.top)return!0}catch{}var r=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch{}return-1}(Ir,n);if(r!==-1){var e=Ar[r];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 Fn(n){return n===void 0&&(n=window),Cn(n=n||window)||K(n)||void 0}function _(n,t){if(typeof n=="string"){if(typeof t=="string")return n==="*"||t===n;if(g(t)||Array.isArray(t))return!1}return g(n)?g(t)?n.toString()===t.toString():!Array.isArray(t)&&!!t.match(n):!!Array.isArray(n)&&(Array.isArray(t)?JSON.stringify(n)===JSON.stringify(t):!g(t)&&n.some(function(r){return _(r,t)}))}function wn(n){try{if(n===window)return!0}catch(t){if(t&&t.message===W)return!0}try{if({}.toString.call(n)==="[object Window]")return!0}catch(t){if(t&&t.message===W)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(t){if(t&&t.message===W)return!0}try{if(n&&n.self===n)return!0}catch(t){if(t&&t.message===W)return!0}try{if(n&&n.parent===n)return!0}catch(t){if(t&&t.message===W)return!0}try{if(n&&n.top===n)return!0}catch(t){if(t&&t.message===W)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 Bn(n){if(X(n))return vn(n).frameElement;for(var t=0,r=document.querySelectorAll("iframe");t<r.length;t++){var e=r[t];if(e&&e.contentWindow&&e.contentWindow===n)return e}}function Or(n){if(function(r){return r===void 0&&(r=window),!!K(r)}(n)){var t=Bn(n);if(t&&t.parentElement){t.parentElement.removeChild(t);return}}try{n.close()}catch{}}function $(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 t={}.toString;if(t){var r=t.call(n);if(r==="[object Window]"||r==="[object global]"||r==="[object DOMWindow]")return!1}if(typeof n.then=="function")return!0}catch{return!1}return!1}var Hn=[],rn=[],xn=0,tn;function Jn(){if(!xn&&tn){var n=tn;tn=null,n.resolve()}}function Sn(){xn+=1}function en(){xn-=1,Jn()}var x=function(){function n(r){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=[],r){var o,i,a=!1,s=!1,c=!1;Sn();try{r(function(u){c?e.resolve(u):(a=!0,o=u)},function(u){c?e.reject(u):(s=!0,i=u)})}catch(u){en(),this.reject(u);return}en(),c=!0,a?this.resolve(o):s&&this.reject(i)}}var t=n.prototype;return t.resolve=function(r){if(this.resolved||this.rejected)return this;if($(r))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=r,this.dispatch(),this},t.reject=function(r){var e=this;if(this.resolved||this.rejected)return this;if($(r))throw new Error("Can not reject promise with another promise");if(!r){var o=r&&typeof r.toString=="function"?r.toString():{}.toString.call(r);r=new Error("Expected reject to be called with Error, got "+o)}return this.rejected=!0,this.error=r,this.errorHandled||setTimeout(function(){e.errorHandled||function(i,a){if(Hn.indexOf(i)===-1){Hn.push(i),setTimeout(function(){throw i},1);for(var s=0;s<rn.length;s++)rn[s](i,a)}}(r,e)},1),this.dispatch(),this},t.asyncReject=function(r){return this.errorHandled=!0,this.reject(r),this},t.dispatch=function(){var r=this.resolved,e=this.rejected,o=this.handlers;if(!this.dispatching&&(r||e)){this.dispatching=!0,Sn();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,f=void 0;if(r)try{f=c?c(this.value):this.value}catch(l){h.reject(l);continue}else if(e){if(!u){h.reject(this.error);continue}try{f=u(this.error)}catch(l){h.reject(l);continue}}if(f instanceof n&&(f.resolved||f.rejected)){var d=f;d.resolved?h.resolve(d.value):h.reject(d.error),d.errorHandled=!0}else $(f)?f instanceof n&&(f.resolved||f.rejected)?f.resolved?h.resolve(f.value):h.reject(f.error):i(f,h):h.resolve(f)}o.length=0,this.dispatching=!1,en()}},t.then=function(r,e){if(r&&typeof r!="function"&&!r.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:r,onError:e}),this.errorHandled=!0,this.dispatch(),o},t.catch=function(r){return this.then(void 0,r)},t.finally=function(r){if(r&&typeof r!="function"&&!r.call)throw new Error("Promise.finally expected a function");return this.then(function(e){return n.try(r).then(function(){return e})},function(e){return n.try(r).then(function(){throw e})})},t.timeout=function(r,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 "+r+"ms"))},r);return this.then(function(a){return clearTimeout(i),a})},t.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},t.lazy=function(){return this.errorHandled=!0,this},n.resolve=function(r){return r instanceof n?r:$(r)?new n(function(e,o){return r.then(e,o)}):new n().resolve(r)},n.reject=function(r){return new n().reject(r)},n.asyncReject=function(r){return new n().asyncReject(r)},n.all=function(r){var e=new n,o=r.length,i=[].slice();if(!o)return e.resolve(i),e;for(var a=function(u,h,f){return h.then(function(d){i[u]=d,(o-=1)==0&&e.resolve(i)},function(d){f.reject(d)})},s=0;s<r.length;s++){var c=r[s];if(c instanceof n){if(c.resolved){i[s]=c.value,o-=1;continue}}else if(!$(c)){i[s]=c,o-=1;continue}a(s,n.resolve(c),e)}return o===0&&e.resolve(i),e},n.hash=function(r){var e={},o=[],i=function(s){if(r.hasOwnProperty(s)){var c=r[s];$(c)?o.push(c.then(function(u){e[s]=u})):e[s]=c}};for(var a in r)i(a);return n.all(o).then(function(){return e})},n.map=function(r,e){return n.all(r.map(e))},n.onPossiblyUnhandledException=function(r){return function(e){return rn.push(e),{cancel:function(){rn.splice(rn.indexOf(e),1)}}}(r)},n.try=function(r,e,o){if(r&&typeof r!="function"&&!r.call)throw new Error("Promise.try expected a function");var i;Sn();try{i=r.apply(e,o||[])}catch(a){return en(),n.reject(a)}return en(),n.resolve(i)},n.delay=function(r){return new n(function(e){setTimeout(e,r)})},n.isPromise=function(r){return!!(r&&r instanceof n)||$(r)},n.flush=function(){return function(r){var e=tn=tn||new r;return Jn(),e}(n)},n}();function mn(n,t){for(var r=0;r<n.length;r++)try{if(n[r]===t)return r}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 r=new WeakMap,e={};return Object.freeze(e),r.set(e,"__testvalue__"),r.get(e)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var t=n.prototype;return t._cleanupClosedWindows=function(){for(var r=this.weakmap,e=this.keys,o=0;o<e.length;o++){var i=e[o];if(wn(i)&&H(i)){if(r)try{r.delete(i)}catch{}e.splice(o,1),this.values.splice(o,1),o-=1}}},t.isSafeToReadWrite=function(r){return!wn(r)},t.set=function(r,e){if(!r)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(r,e)}catch{delete this.weakmap}if(this.isSafeToReadWrite(r))try{var i=this.name,a=r[i];a&&a[0]===r?a[1]=e:Object.defineProperty(r,i,{value:[r,e],writable:!0});return}catch{}this._cleanupClosedWindows();var s=this.keys,c=this.values,u=mn(s,r);u===-1?(s.push(r),c.push(e)):c[u]=e},t.get=function(r){if(!r)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(r))return e.get(r)}catch{delete this.weakmap}if(this.isSafeToReadWrite(r))try{var o=r[this.name];return o&&o[0]===r?o[1]:void 0}catch{}this._cleanupClosedWindows();var i=mn(this.keys,r);if(i!==-1)return this.values[i]},t.delete=function(r){if(!r)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(r)}catch{delete this.weakmap}if(this.isSafeToReadWrite(r))try{var o=r[this.name];o&&o[0]===r&&(o[0]=o[1]=void 0)}catch{}this._cleanupClosedWindows();var i=this.keys,a=mn(i,r);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},t.has=function(r){if(!r)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(r))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(r))try{var o=r[this.name];return!(!o||o[0]!==r)}catch{}return this._cleanupClosedWindows(),mn(this.keys,r)!==-1},t.getOrSet=function(r,e){if(this.has(r))return this.get(r);var o=e();return this.set(r,o),o},n}();function Un(n){return n.name||n.__name__||n.displayName||"anonymous"}function Gn(n,t){try{delete n.name,n.name=t}catch{}return n.__name__=n.displayName=t,n}function G(){var n="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(t){if(typeof btoa=="function")return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(r,e){return String.fromCharCode(parseInt(e,16))})).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(t,"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 pn;function Zn(n){try{return JSON.stringify([].slice.call(n),function(t,r){return typeof r=="function"?"memoize["+function(e){if(pn=pn||new bn,e==null||typeof e!="object"&&typeof e!="function")throw new Error("Invalid object");var o=pn.get(e);return o||(o=typeof e+":"+G(),pn.set(e,o)),o}(r)+"]":typeof window<"u"&&r instanceof window.Element||r!==null&&typeof r=="object"&&r.nodeType===1&&typeof r.style=="object"&&typeof r.ownerDocument=="object"?{}:r})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function Dr(){return{}}var on=0,qn=0;function an(n,t){t===void 0&&(t={});var r=t.thisNamespace,e=r!==void 0&&r,o=t.time,i,a,s=on;on+=1;var c=function(){for(var u=arguments.length,h=new Array(u),f=0;f<u;f++)h[f]=arguments[f];s<qn&&(i=null,a=null,s=on,on+=1);var d;d=e?(a=a||new bn).getOrSet(this,Dr):i=i||{};var l;try{l=Zn(h)}catch{return n.apply(this,arguments)}var p=d[l];if(p&&o&&Date.now()-p.time<o&&(delete d[l],p=null),p)return p.value;var w=Date.now(),m=n.apply(this,arguments);return d[l]={time:w,value:m},m};return c.reset=function(){i=null,a=null},Gn(c,(t.name||Un(n))+"::memoized")}an.clear=function(){qn=on};function zr(n){var t={};function r(){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 t.hasOwnProperty(c)||(t[c]=x.try(function(){return n.apply(o,e)}).finally(function(){delete t[c]})),t[c]}return r.reset=function(){t={}},Gn(r,Un(n)+"::promiseMemoized")}function k(){}function un(n,t){if(t===void 0&&(t=1),t>=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 r=n&&n.stack,e=n&&n.message;if(r&&e)return r.indexOf(e)!==-1?r:e+`
3
- `+r;if(r)return r;if(e)return e}return n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}catch(o){return"Error while stringifying error: "+un(o,t+1)}}function Vn(n){return typeof n=="string"?n:n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}an(function(n){if(Object.values)return Object.values(n);var t=[];for(var r in n)n.hasOwnProperty(r)&&t.push(n[r]);return t});function Pn(n){return{}.toString.call(n)==="[object RegExp]"}function cn(n,t,r){if(n.hasOwnProperty(t))return n[t];var e=r();return n[t]=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"}an(function(){return new x(function(n){if(Kn()||Xn())return n();var t=setInterval(function(){if(Kn()||Xn())return clearInterval(t),n()},10)})});var gn=typeof document<"u"?document.currentScript:null,Rr=an(function(){if(gn||(gn=function(){try{var n=function(){try{throw new Error("_")}catch(a){return a.stack||""}}(),t=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n),r=t&&t[1];if(!r)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===r)return i}}catch{}}()))return gn;throw new Error("Can not determine current script")}),jr=G();an(function(){var n;try{n=Rr()}catch{return jr}var t=n.getAttribute("data-uid");if(t&&typeof t=="string"||(t=n.getAttribute("data-uid-auto"))&&typeof t=="string")return t;if(n.src){var r=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}));t="uid_"+r.slice(r.length-30)}else t=G();return n.setAttribute("data-uid-auto",t),t});function sn(n){n===void 0&&(n=window);var t="__post_robot_10_0_46__";return n!==window?n[t]:n[t]=n[t]||{}}var $n=function(){return{}};function z(n,t){return n===void 0&&(n="store"),t===void 0&&(t=$n),cn(sn(),n,function(){var r=t();return{has:function(e){return r.hasOwnProperty(e)},get:function(e,o){return r.hasOwnProperty(e)?r[e]:o},set:function(e,o){return r[e]=o,o},del:function(e){delete r[e]},getOrSet:function(e,o){return cn(r,e,o)},reset:function(){r=t()},keys:function(){return Object.keys(r)}}})}var Mr=function(){};function yn(){var n=sn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new Mr,n.WINDOW_WILDCARD}function C(n,t){return n===void 0&&(n="store"),t===void 0&&(t=$n),z("windowStore").getOrSet(n,function(){var r=new bn,e=function(o){return r.getOrSet(o,t)};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 cn(e(o),n,i)}}})}function kn(){return z("instance").getOrSet("instanceID",G)}function Qn(n,t){var r=t.domain,e=C("helloPromises"),o=e.get(n);o&&o.resolve({domain:r});var i=x.resolve({domain:r});return e.set(n,i),i}function In(n,t){return(0,t.send)(n,"postrobot_hello",{instanceID:kn()},{domain:"*",timeout:-1}).then(function(r){var e=r.origin,o=r.data.instanceID;return Qn(n,{domain:e}),{win:n,domain:e,instanceID:o}})}function _n(n,t){var r=t.send;return C("windowInstanceIDPromises").getOrSet(n,function(){return In(n,{send:r}).then(function(e){return e.instanceID})})}function nr(n){C("knownWindows").set(n,!0)}function An(n){return typeof n=="object"&&n!==null&&typeof n.__type__=="string"}function rr(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 Q(n,t){return{__type__:n,__val__:t}}var L,Nr=((L={}).function=function(){},L.error=function(n){return Q("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},L.promise=function(){},L.regex=function(n){return Q("regex",n.source)},L.date=function(n){return Q("date",n.toJSON())},L.array=function(n){return n},L.object=function(n){return n},L.string=function(n){return n},L.number=function(n){return n},L.boolean=function(n){return n},L.null=function(n){return n},L[void 0]=function(n){return Q("undefined",n)},L),Cr={},F,Tr=((F={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},F.error=function(n){var t=n.stack,r=n.code,e=n.data,o=new Error(n.message);return o.code=r,e&&(o.data=e),o.stack=t+`
1
+ (function(N,P){typeof exports=="object"&&typeof module<"u"?module.exports=P():typeof define=="function"&&define.amd?define(P):(N=typeof globalThis<"u"?globalThis:N||self,N["soyio-widget"]=P())})(this,function(){"use strict";var ae=Object.defineProperty;var ue=(N,P,F)=>P in N?ae(N,P,{enumerable:!0,configurable:!0,writable:!0,value:F}):N[P]=F;var dn=(N,P,F)=>(ue(N,typeof P!="symbol"?P+"":P,F),F),ce=(N,P,F)=>{if(!P.has(N))throw TypeError("Cannot "+F)};var Mn=(N,P,F)=>{if(P.has(N))throw TypeError("Cannot add the same private member more than once");P instanceof WeakSet?P.add(N):P.set(N,F)};var Cn=(N,P,F)=>(ce(N,P,"access private method"),F);var ln,gt,vn,yt;const N="soyio-widget-iframe-container",P="soyio-widget-iframe",F="https://staging.soyio.id/widget",Et=["IDENTITY_AUTHENTICATED","IDENTITY_REGISTERED"];function Wt(W,j,M){let g=M??F;return g+=`/${W}?isWeb=true&companyId=${j.companyId}`,W==="authenticate"?g+=`&identityId=${j.identityId}`:W==="register"?g+=`&flowTemplateId=${j.flowTemplateId}`:g+="INVALID PARAMS: ",g}function xt(){return!!document.getElementById(P)}function St(){return document.getElementById(N)}function It(W,j,M){const g=St();if(!g)throw new Error("Iframe container does not exist");const v=document.createElement("iframe");return v.src=Wt(W,j,M),v.id=P,v.style.zIndex=String(Number.MAX_SAFE_INTEGER),v.style.width="100%",v.style.height="100%",g.appendChild(v),v}function bt(W,j,M){return xt()?document.getElementById(P):It(W,j,M)}function Ln(){const W=document.getElementById(P);W&&W.remove()}var Pt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function At(W){return W&&W.__esModule&&Object.prototype.hasOwnProperty.call(W,"default")?W.default:W}var Fn={exports:{}},Bn={exports:{}};(function(W,j){(function(M,g){W.exports=g()})(typeof self<"u"?self:Pt,function(){return function(M){var g={};function v(y){if(g[y])return g[y].exports;var x=g[y]={i:y,l:!1,exports:{}};return M[y].call(x.exports,x,x.exports,v),x.l=!0,x.exports}return v.m=M,v.c=g,v.d=function(y,x,Z){v.o(y,x)||Object.defineProperty(y,x,{enumerable:!0,get:Z})},v.r=function(y){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(y,"__esModule",{value:!0})},v.t=function(y,x){if(1&x&&(y=v(y)),8&x||4&x&&typeof y=="object"&&y&&y.__esModule)return y;var Z=Object.create(null);if(v.r(Z),Object.defineProperty(Z,"default",{enumerable:!0,value:y}),2&x&&typeof y!="string")for(var nn in y)v.d(Z,nn,(function(wn){return y[wn]}).bind(null,nn));return Z},v.n=function(y){var x=y&&y.__esModule?function(){return y.default}:function(){return y};return v.d(x,"a",x),x},v.o=function(y,x){return{}.hasOwnProperty.call(y,x)},v.p="",v(v.s=0)}([function(M,g,v){v.r(g),v.d(g,"Promise",function(){return S}),v.d(g,"TYPES",function(){return oe}),v.d(g,"ProxyWindow",function(){return G}),v.d(g,"setup",function(){return pt}),v.d(g,"destroy",function(){return re}),v.d(g,"serializeMessage",function(){return _t}),v.d(g,"deserializeMessage",function(){return ne}),v.d(g,"createProxyWindow",function(){return te}),v.d(g,"toProxyWindow",function(){return ee}),v.d(g,"on",function(){return q}),v.d(g,"once",function(){return Qt}),v.d(g,"send",function(){return Y}),v.d(g,"markWindowKnown",function(){return it}),v.d(g,"cleanUpWindow",function(){return ie}),v.d(g,"bridge",function(){});function y(n){return{}.toString.call(n)==="[object RegExp]"}var x=`Call was rejected by callee.\r
2
+ `;function Z(n){return n===void 0&&(n=window),n.location.protocol}function nn(n){if(n===void 0&&(n=window),n.mockDomain){var e=n.mockDomain.split("//")[0];if(e)return e}return Z(n)}function wn(n){return n===void 0&&(n=window),nn(n)==="about:"}function K(n){if(n===void 0&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch{}}function Hn(n){if(n===void 0&&(n=window),n&&!K(n))try{return n.opener}catch{}}function mn(n){try{return!0}catch{}return!1}function pn(n){n===void 0&&(n=window);var e=n.location;if(!e)throw new Error("Can not read window location");var t=Z(n);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var r=K(n);return r&&mn()?pn(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=pn(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(wn(e)&&mn())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),nn(r)==="mock:"}(e)&&mn())return!0}catch{}try{if(pn(e)===pn(window))return!0}catch{}return!1}(n))return!1;try{if(n===window||wn(n)&&mn()||C(window)===C(n))return!0}catch{}return!1}function gn(n){if(!X(n))throw new Error("Expected window to be same domain");return n}function Gn(n,e){if(!n||!e)return!1;var t=K(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 Un(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 Lt=[],Ft=[];function U(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!==x}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}(Lt,n);if(t!==-1){var r=Ft[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 Jn(n){return n===void 0&&(n=window),Hn(n=n||window)||K(n)||void 0}function _(n,e){if(typeof n=="string"){if(typeof e=="string")return n==="*"||e===n;if(y(e)||Array.isArray(e))return!1}return y(n)?y(e)?n.toString()===e.toString():!Array.isArray(e)&&!!e.match(n):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!y(e)&&n.some(function(t){return _(t,e)}))}function yn(n){try{if(n===window)return!0}catch(e){if(e&&e.message===x)return!0}try{if({}.toString.call(n)==="[object Window]")return!0}catch(e){if(e&&e.message===x)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(e){if(e&&e.message===x)return!0}try{if(n&&n.self===n)return!0}catch(e){if(e&&e.message===x)return!0}try{if(n&&n.parent===n)return!0}catch(e){if(e&&e.message===x)return!0}try{if(n&&n.top===n)return!0}catch(e){if(e&&e.message===x)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 Vn(n){if(X(n))return gn(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 Bt(n){if(function(t){return t===void 0&&(t=window),!!K(t)}(n)){var e=Vn(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 Zn=[],tn=[],In=0,en;function qn(){if(!In&&en){var n=en;en=null,n.resolve()}}function bn(){In+=1}function rn(){In-=1,qn()}var S=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;bn();try{t(function(u){c?r.resolve(u):(a=!0,o=u)},function(u){c?r.reject(u):(s=!0,i=u)})}catch(u){rn(),this.reject(u);return}rn(),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(Zn.indexOf(i)===-1){Zn.push(i),setTimeout(function(){throw i},1);for(var s=0;s<tn.length;s++)tn[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,bn();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,f=void 0;if(t)try{f=c?c(this.value):this.value}catch(l){h.reject(l);continue}else if(r){if(!u){h.reject(this.error);continue}try{f=u(this.error)}catch(l){h.reject(l);continue}}if(f instanceof n&&(f.resolved||f.rejected)){var d=f;d.resolved?h.resolve(d.value):h.reject(d.error),d.errorHandled=!0}else k(f)?f instanceof n&&(f.resolved||f.rejected)?f.resolved?h.resolve(f.value):h.reject(f.error):i(f,h):h.resolve(f)}o.length=0,this.dispatching=!1,rn()}},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,f){return h.then(function(d){i[u]=d,(o-=1)==0&&r.resolve(i)},function(d){f.reject(d)})},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 tn.push(r),{cancel:function(){tn.splice(tn.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;bn();try{i=t.apply(r,o||[])}catch(a){return rn(),n.reject(a)}return rn(),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=en=en||new t;return qn(),r}(n)},n}();function En(n,e){for(var t=0;t<n.length;t++)try{if(n[t]===e)return t}catch{}return-1}var Pn=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(yn(i)&&U(i)){if(t)try{t.delete(i)}catch{}r.splice(o,1),this.values.splice(o,1),o-=1}}},e.isSafeToReadWrite=function(t){return!yn(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=En(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=En(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=En(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(),En(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 Yn(n){return n.name||n.__name__||n.displayName||"anonymous"}function Kn(n,e){try{delete n.name,n.name=e}catch{}return n.__name__=n.displayName=e,n}function V(){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 Wn;function Xn(n){try{return JSON.stringify([].slice.call(n),function(e,t){return typeof t=="function"?"memoize["+function(r){if(Wn=Wn||new Pn,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Wn.get(r);return o||(o=typeof r+":"+V(),Wn.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 Ht(){return{}}var on=0,kn=0;function an(n,e){e===void 0&&(e={});var t=e.thisNamespace,r=t!==void 0&&t,o=e.time,i,a,s=on;on+=1;var c=function(){for(var u=arguments.length,h=new Array(u),f=0;f<u;f++)h[f]=arguments[f];s<kn&&(i=null,a=null,s=on,on+=1);var d;d=r?(a=a||new Pn).getOrSet(this,Ht):i=i||{};var l;try{l=Xn(h)}catch{return n.apply(this,arguments)}var p=d[l];if(p&&o&&Date.now()-p.time<o&&(delete d[l],p=null),p)return p.value;var w=Date.now(),m=n.apply(this,arguments);return d[l]={time:w,value:m},m};return c.reset=function(){i=null,a=null},Kn(c,(e.name||Yn(n))+"::memoized")}an.clear=function(){kn=on};function Gt(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=Xn(a);return e.hasOwnProperty(c)||(e[c]=S.try(function(){return n.apply(o,r)}).finally(function(){delete e[c]})),e[c]}return t.reset=function(){e={}},Kn(t,Yn(n)+"::promiseMemoized")}function $(){}function un(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(r)return r}return n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}catch(o){return"Error while stringifying error: "+un(o,e+1)}}function $n(n){return typeof n=="string"?n:n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}an(function(n){if(Object.values)return Object.values(n);var e=[];for(var t in n)n.hasOwnProperty(t)&&e.push(n[t]);return e});function An(n){return{}.toString.call(n)==="[object RegExp]"}function cn(n,e,t){if(n.hasOwnProperty(e))return n[e];var r=t();return n[e]=r,r}function Qn(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function _n(){return!!document.body&&document.readyState==="complete"}function nt(){return!!document.body&&document.readyState==="interactive"}an(function(){return new S(function(n){if(_n()||nt())return n();var e=setInterval(function(){if(_n()||nt())return clearInterval(e),n()},10)})});var xn=typeof document<"u"?document.currentScript:null,Ut=an(function(){if(xn||(xn=function(){try{var n=function(){try{throw new Error("_")}catch(a){return a.stack||""}}(),e=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n),t=e&&e[1];if(!t)return;for(var r=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();r<o.length;r++){var i=o[r];if(i.src&&i.src===t)return i}}catch{}}()))return xn;throw new Error("Can not determine current script")}),Jt=V();an(function(){var n;try{n=Ut()}catch{return Jt}var e=n.getAttribute("data-uid");if(e&&typeof e=="string"||(e=n.getAttribute("data-uid-auto"))&&typeof e=="string")return e;if(n.src){var t=function(r){for(var o="",i=0;i<r.length;i++){var a=r[i].charCodeAt(0)*i;r[i+1]&&(a+=r[i+1].charCodeAt(0)*(i-1)),o+=String.fromCharCode(97+Math.abs(a)%26)}return o}(JSON.stringify({src:n.src,dataset:n.dataset}));e="uid_"+t.slice(t.length-30)}else e=V();return n.setAttribute("data-uid-auto",e),e});function sn(n){n===void 0&&(n=window);var e="__post_robot_10_0_46__";return n!==window?n[e]:n[e]=n[e]||{}}var tt=function(){return{}};function z(n,e){return n===void 0&&(n="store"),e===void 0&&(e=tt),cn(sn(),n,function(){var t=e();return{has:function(r){return t.hasOwnProperty(r)},get:function(r,o){return t.hasOwnProperty(r)?t[r]:o},set:function(r,o){return t[r]=o,o},del:function(r){delete t[r]},getOrSet:function(r,o){return cn(t,r,o)},reset:function(){t=e()},keys:function(){return Object.keys(t)}}})}var Vt=function(){};function Sn(){var n=sn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new Vt,n.WINDOW_WILDCARD}function L(n,e){return n===void 0&&(n="store"),e===void 0&&(e=tt),z("windowStore").getOrSet(n,function(){var t=new Pn,r=function(o){return t.getOrSet(o,e)};return{has:function(o){return r(o).hasOwnProperty(n)},get:function(o,i){var a=r(o);return a.hasOwnProperty(n)?a[n]:i},set:function(o,i){return r(o)[n]=i,i},del:function(o){delete r(o)[n]},getOrSet:function(o,i){return cn(r(o),n,i)}}})}function et(){return z("instance").getOrSet("instanceID",V)}function rt(n,e){var t=e.domain,r=L("helloPromises"),o=r.get(n);o&&o.resolve({domain:t});var i=S.resolve({domain:t});return r.set(n,i),i}function On(n,e){return(0,e.send)(n,"postrobot_hello",{instanceID:et()},{domain:"*",timeout:-1}).then(function(t){var r=t.origin,o=t.data.instanceID;return rt(n,{domain:r}),{win:n,domain:r,instanceID:o}})}function ot(n,e){var t=e.send;return L("windowInstanceIDPromises").getOrSet(n,function(){return On(n,{send:t}).then(function(r){return r.instanceID})})}function it(n){L("knownWindows").set(n,!0)}function Dn(n){return typeof n=="object"&&n!==null&&typeof n.__type__=="string"}function at(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 Q(n,e){return{__type__:n,__val__:e}}var B,Zt=((B={}).function=function(){},B.error=function(n){return Q("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},B.promise=function(){},B.regex=function(n){return Q("regex",n.source)},B.date=function(n){return Q("date",n.toJSON())},B.array=function(n){return n},B.object=function(n){return n},B.string=function(n){return n},B.number=function(n){return n},B.boolean=function(n){return n},B.null=function(n){return n},B[void 0]=function(n){return Q("undefined",n)},B),qt={},H,Yt=((H={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},H.error=function(n){var e=n.stack,t=n.code,r=n.data,o=new Error(n.message);return o.code=t,r&&(o.data=r),o.stack=e+`
4
4
 
5
- `+o.stack,o},F.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},F.regex=function(n){return new RegExp(n)},F.date=function(n){return new Date(n)},F.array=function(n){return n},F.object=function(n){return n},F.string=function(n){return n},F.number=function(n){return n},F.boolean=function(n){return n},F.null=function(n){return n},F[void 0]=function(){},F),Lr={};new x(function(n){if(window.document&&window.document.body)return n(window.document.body);var t=setInterval(function(){if(window.document&&window.document.body)return clearInterval(t),n(window.document.body)},10)});function On(){for(var n=z("idToProxyWindow"),t=0,r=n.keys();t<r.length;t++){var e=r[t];n.get(e).shouldClean()&&n.del(e)}}function tr(n,t){var r=t.send,e=t.id,o=e===void 0?G():e,i=n.then(function(c){if(X(c))return vn(c).name}),a=n.then(function(c){if(H(c))throw new Error("Window is closed, can not determine type");return Cn(c)?"popup":"iframe"});i.catch(k),a.catch(k);var s=function(){return n.then(function(c){if(!H(c))return X(c)?vn(c).name:i})};return{id:o,getType:function(){return a},getInstanceID:zr(function(){return n.then(function(c){return _n(c,{send:r})})}),close:function(){return n.then(Or)},getName:s,focus:function(){return n.then(function(c){c.focus()})},isClosed:function(){return n.then(function(c){return H(c)})},setLocation:function(c,u){return u===void 0&&(u={}),n.then(function(h){var f=window.location.protocol+"//"+window.location.host,d=u.method,l=d===void 0?"get":d,p=u.body;if(c.indexOf("/")===0)c=""+f+c;else if(!c.match(/^https?:\/\//)&&c.indexOf(f)!==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 b=m.url,D=m.target,I=m.body,P=m.method,R=P===void 0?"post":P,E=document.createElement("form");if(E.setAttribute("target",D),E.setAttribute("method",R),E.setAttribute("action",b),E.style.display="none",I)for(var A=0,J=Object.keys(I);A<J.length;A++){var O,fn=J[A],jn=document.createElement("input");jn.setAttribute("name",fn),jn.setAttribute("value",(O=I[fn])==null?void 0:O.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),f=Bn(u);if(!h)throw new Error("Can not set name for cross-domain window: "+c);vn(u).name=c,f&&f.setAttribute("name",c),i=x.resolve(c)})}}}var B=function(){function n(r){var e=r.send,o=r.win,i=r.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||tr(this.actualWindowPromise,{send:e}),z("idToProxyWindow").set(this.getID(),this),o&&this.setWindow(o,{send:e})}var t=n.prototype;return t.getID=function(){return this.serializedWindow.id},t.getType=function(){return this.serializedWindow.getType()},t.isPopup=function(){return this.getType().then(function(r){return r==="popup"})},t.setLocation=function(r,e){var o=this;return this.serializedWindow.setLocation(r,e).then(function(){return o})},t.getName=function(){return this.serializedWindow.getName()},t.setName=function(r){var e=this;return this.serializedWindow.setName(r).then(function(){return e})},t.close=function(){var r=this;return this.serializedWindow.close().then(function(){return r})},t.focus=function(){var r=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 r})},t.isClosed=function(){return this.serializedWindow.isClosed()},t.getWindow=function(){return this.actualWindow},t.setWindow=function(r,e){var o=e.send;this.actualWindow=r,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=tr(this.actualWindowPromise,{send:o,id:this.getID()}),C("winToProxyWindow").set(r,this)},t.awaitWindow=function(){return this.actualWindowPromise},t.matchWindow=function(r,e){var o=this,i=e.send;return x.try(function(){return o.actualWindow?r===o.actualWindow:x.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:_n(r,{send:i})}).then(function(a){var s=a.proxyInstanceID===a.knownWindowInstanceID;return s&&o.setWindow(r,{send:i}),s})})},t.unwrap=function(){return this.actualWindow||this},t.getInstanceID=function(){return this.serializedWindow.getInstanceID()},t.shouldClean=function(){return!!(this.actualWindow&&H(this.actualWindow))},t.serialize=function(){return this.serializedWindow},n.unwrap=function(r){return n.isProxyWindow(r)?r.unwrap():r},n.serialize=function(r,e){var o=e.send;return On(),n.toProxyWindow(r,{send:o}).serialize()},n.deserialize=function(r,e){var o=e.send;return On(),z("idToProxyWindow").get(r.id)||new n({serializedWindow:r,send:o})},n.isProxyWindow=function(r){return!!(r&&!wn(r)&&r.isProxyWindow)},n.toProxyWindow=function(r,e){var o=e.send;if(On(),n.isProxyWindow(r))return r;var i=r;return C("winToProxyWindow").get(i)||new n({win:i,send:o})},n}();function Dn(n,t,r,e,o){var i=C("methodStore"),a=z("proxyWindowMethods");B.isProxyWindow(e)?a.set(n,{val:t,name:r,domain:o,source:e}):(a.del(n),i.getOrSet(e,function(){return{}})[n]={domain:o,name:r,val:t,source:e})}function er(n,t){var r=C("methodStore"),e=z("proxyWindowMethods");return r.getOrSet(n,function(){return{}})[t]||e.get(t)}function or(n,t,r,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 f=h.source,d=h.origin,l=h.data,p=l.id,w=l.name,m=er(f,p);if(!m)throw new Error("Could not find method '"+w+"' with id: "+l.id+" in "+N(window));var b=m.source,D=m.domain,I=m.val;return x.try(function(){if(!_(D,d))throw new Error("Method '"+l.name+"' domain "+JSON.stringify(Pn(m.domain)?m.domain.source:m.domain)+" does not match origin "+d+" in "+N(window));if(B.isProxyWindow(b))return b.matchWindow(f,{send:s}).then(function(P){if(!P)throw new Error("Method call '"+l.name+"' failed - proxy window does not match source in "+N(window))})}).then(function(){return I.apply({source:f,origin:d},l.args)},function(P){return x.try(function(){if(I.onError)return I.onError(P)}).then(function(){throw P.stack&&(P.stack="Remote call to "+w+"("+function(R){return R===void 0&&(R=[]),(E=R,[].slice.call(E)).map(function(A){return typeof A=="string"?"'"+A+"'":A===void 0?"undefined":A===null?"null":typeof A=="boolean"?A.toString():Array.isArray(A)?"[ ... ]":typeof A=="object"?"{ ... }":typeof A=="function"?"() => { ... }":"<"+typeof A+">"}).join(", ");var E}(l.args)+`) failed
5
+ `+o.stack,o},H.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},H.regex=function(n){return new RegExp(n)},H.date=function(n){return new Date(n)},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(){},H),Kt={};new S(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)});function Nn(){for(var n=z("idToProxyWindow"),e=0,t=n.keys();e<t.length;e++){var r=t[e];n.get(r).shouldClean()&&n.del(r)}}function ut(n,e){var t=e.send,r=e.id,o=r===void 0?V():r,i=n.then(function(c){if(X(c))return gn(c).name}),a=n.then(function(c){if(U(c))throw new Error("Window is closed, can not determine type");return Hn(c)?"popup":"iframe"});i.catch($),a.catch($);var s=function(){return n.then(function(c){if(!U(c))return X(c)?gn(c).name:i})};return{id:o,getType:function(){return a},getInstanceID:Gt(function(){return n.then(function(c){return ot(c,{send:t})})}),close:function(){return n.then(Bt)},getName:s,focus:function(){return n.then(function(c){c.focus()})},isClosed:function(){return n.then(function(c){return U(c)})},setLocation:function(c,u){return u===void 0&&(u={}),n.then(function(h){var f=window.location.protocol+"//"+window.location.host,d=u.method,l=d===void 0?"get":d,p=u.body;if(c.indexOf("/")===0)c=""+f+c;else if(!c.match(/^https?:\/\//)&&c.indexOf(f)!==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 I=m.url,R=m.target,A=m.body,b=m.method,T=b===void 0?"post":b,E=document.createElement("form");if(E.setAttribute("target",R),E.setAttribute("method",T),E.setAttribute("action",I),E.style.display="none",A)for(var O=0,J=Object.keys(A);O<J.length;O++){var D,fn=J[O],jn=document.createElement("input");jn.setAttribute("name",fn),jn.setAttribute("value",(D=A[fn])==null?void 0:D.toString()),E.appendChild(jn)}Qn().appendChild(E),E.submit(),Qn().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),f=Vn(u);if(!h)throw new Error("Can not set name for cross-domain window: "+c);gn(u).name=c,f&&f.setAttribute("name",c),i=S.resolve(c)})}}}var G=function(){function n(t){var r=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 S,this.serializedWindow=i||ut(this.actualWindowPromise,{send:r}),z("idToProxyWindow").set(this.getID(),this),o&&this.setWindow(o,{send:r})}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(t){return t==="popup"})},e.setLocation=function(t,r){var o=this;return this.serializedWindow.setLocation(t,r).then(function(){return o})},e.getName=function(){return this.serializedWindow.getName()},e.setName=function(t){var r=this;return this.serializedWindow.setName(t).then(function(){return r})},e.close=function(){var t=this;return this.serializedWindow.close().then(function(){return t})},e.focus=function(){var t=this,r=this.isPopup(),o=this.getName(),i=S.hash({isPopup:r,name:o}).then(function(s){var c=s.name;s.isPopup&&c&&window.open("",c,"noopener")}),a=this.serializedWindow.focus();return S.all([i,a]).then(function(){return t})},e.isClosed=function(){return this.serializedWindow.isClosed()},e.getWindow=function(){return this.actualWindow},e.setWindow=function(t,r){var o=r.send;this.actualWindow=t,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=ut(this.actualWindowPromise,{send:o,id:this.getID()}),L("winToProxyWindow").set(t,this)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(t,r){var o=this,i=r.send;return S.try(function(){return o.actualWindow?t===o.actualWindow:S.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:ot(t,{send:i})}).then(function(a){var s=a.proxyInstanceID===a.knownWindowInstanceID;return s&&o.setWindow(t,{send:i}),s})})},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return this.serializedWindow.getInstanceID()},e.shouldClean=function(){return!!(this.actualWindow&&U(this.actualWindow))},e.serialize=function(){return this.serializedWindow},n.unwrap=function(t){return n.isProxyWindow(t)?t.unwrap():t},n.serialize=function(t,r){var o=r.send;return Nn(),n.toProxyWindow(t,{send:o}).serialize()},n.deserialize=function(t,r){var o=r.send;return Nn(),z("idToProxyWindow").get(t.id)||new n({serializedWindow:t,send:o})},n.isProxyWindow=function(t){return!!(t&&!yn(t)&&t.isProxyWindow)},n.toProxyWindow=function(t,r){var o=r.send;if(Nn(),n.isProxyWindow(t))return t;var i=t;return L("winToProxyWindow").get(i)||new n({win:i,send:o})},n}();function Rn(n,e,t,r,o){var i=L("methodStore"),a=z("proxyWindowMethods");G.isProxyWindow(r)?a.set(n,{val:e,name:t,domain:o,source:r}):(a.del(n),i.getOrSet(r,function(){return{}})[n]={domain:o,name:t,val:e,source:r})}function ct(n,e){var t=L("methodStore"),r=z("proxyWindowMethods");return t.getOrSet(n,function(){return{}})[e]||r.get(e)}function st(n,e,t,r,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 f=h.source,d=h.origin,l=h.data,p=l.id,w=l.name,m=ct(f,p);if(!m)throw new Error("Could not find method '"+w+"' with id: "+l.id+" in "+C(window));var I=m.source,R=m.domain,A=m.val;return S.try(function(){if(!_(R,d))throw new Error("Method '"+l.name+"' domain "+JSON.stringify(An(m.domain)?m.domain.source:m.domain)+" does not match origin "+d+" in "+C(window));if(G.isProxyWindow(I))return I.matchWindow(f,{send:s}).then(function(b){if(!b)throw new Error("Method call '"+l.name+"' failed - proxy window does not match source in "+C(window))})}).then(function(){return A.apply({source:f,origin:d},l.args)},function(b){return S.try(function(){if(A.onError)return A.onError(b)}).then(function(){throw b.stack&&(b.stack="Remote call to "+w+"("+function(T){return T===void 0&&(T=[]),(E=T,[].slice.call(E)).map(function(O){return typeof O=="string"?"'"+O+"'":O===void 0?"undefined":O===null?"null":typeof O=="boolean"?O.toString():Array.isArray(O)?"[ ... ]":typeof O=="object"?"{ ... }":typeof O=="function"?"() => { ... }":"<"+typeof O+">"}).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=r.__id__||G();n=B.unwrap(n);var u=r.__name__||r.name||e;return typeof u=="string"&&typeof u.indexOf=="function"&&u.indexOf("anonymous::")===0&&(u=u.replace("anonymous::",e+"::")),B.isProxyWindow(n)?(Dn(c,r,u,n,t),n.awaitWindow().then(function(h){Dn(c,r,u,h,t)})):Dn(c,r,u,n,t),Q("cross_domain_function",{id:c,name:u})}function ir(n,t,r,e){var o,i=e.on,a=e.send;return function(s,c){c===void 0&&(c=Cr);var u=JSON.stringify(s,function(h){var f=this[h];if(An(this))return f;var d=rr(f);if(!d)return f;var l=c[d]||Nr[d];return l?l(f,h):f});return u===void 0?"undefined":u}(r,((o={}).promise=function(s,c){return function(u,h,f,d,l){return Q("cross_domain_zalgo_promise",{then:or(u,h,function(p,w){return f.then(p,w)},d,{on:l.on,send:l.send})})}(n,t,s,c,{on:i,send:a})},o.function=function(s,c){return or(n,t,s,c,{on:i,send:a})},o.object=function(s){return wn(s)||B.isProxyWindow(s)?Q("cross_domain_window",B.serialize(s,{send:a})):s},o))}function ar(n,t,r,e){var o,i=e.send;return function(a,s){if(s===void 0&&(s=Lr),a!=="undefined")return JSON.parse(a,function(c,u){if(An(this))return u;var h,f;if(An(u)?(h=u.__type__,f=u.__val__):(h=rr(u),f=u),!h)return f;var d=s[h]||Tr[h];return d?d(f,c):f})}(r,((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 f=u.id,d=u.name,l=h.send,p=function(m){m===void 0&&(m={});function b(){var D=arguments;return B.toProxyWindow(s,{send:l}).awaitWindow().then(function(I){var P=er(I,f);if(P&&P.val!==b)return P.val.apply({source:window,origin:N()},D);var R=[].slice.call(D);return m.fireAndForget?l(I,"postrobot_method",{id:f,name:d,args:R},{domain:c,fireAndForget:!0}):l(I,"postrobot_method",{id:f,name:d,args:R},{domain:c,fireAndForget:!1}).then(function(E){return E.data.result})}).catch(function(I){throw I})}return b.__name__=d,b.__origin__=c,b.__source__=s,b.__id__=f,b.origin=c,b},w=p();return w.fireAndForget=p({fireAndForget:!0}),w}(n,t,a,{send:i})},o.cross_domain_window=function(a){return B.deserialize(a,{send:i})},o))}var zn={};zn.postrobot_post_message=function(n,t,r){r.indexOf("file:")===0&&(r="*"),n.postMessage(t,r)};function Rn(n,t,r,e){var o=e.on,i=e.send;return x.try(function(){var a=C().getOrSet(n,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(r),a.flush=a.flush||x.flush().then(function(){if(H(n))throw new Error("Window is closed");var s=ir(n,t,((c={}).__post_robot_10_0_46__=a.buffer||[],c),{on:o,send:i}),c;delete a.buffer;for(var u=Object.keys(zn),h=[],f=0;f<u.length;f++){var d=u[f];try{zn[d](n,s,t)}catch(l){h.push(l)}}if(h.length===u.length)throw new Error(`All post-robot messaging strategies failed:
7
+ `+b.stack),b})}).then(function(b){return{result:b,id:p,name:w}})})});var i,a,s,c=t.__id__||V();n=G.unwrap(n);var u=t.__name__||t.name||r;return typeof u=="string"&&typeof u.indexOf=="function"&&u.indexOf("anonymous::")===0&&(u=u.replace("anonymous::",r+"::")),G.isProxyWindow(n)?(Rn(c,t,u,n,e),n.awaitWindow().then(function(h){Rn(c,t,u,h,e)})):Rn(c,t,u,n,e),Q("cross_domain_function",{id:c,name:u})}function ft(n,e,t,r){var o,i=r.on,a=r.send;return function(s,c){c===void 0&&(c=qt);var u=JSON.stringify(s,function(h){var f=this[h];if(Dn(this))return f;var d=at(f);if(!d)return f;var l=c[d]||Zt[d];return l?l(f,h):f});return u===void 0?"undefined":u}(t,((o={}).promise=function(s,c){return function(u,h,f,d,l){return Q("cross_domain_zalgo_promise",{then:st(u,h,function(p,w){return f.then(p,w)},d,{on:l.on,send:l.send})})}(n,e,s,c,{on:i,send:a})},o.function=function(s,c){return st(n,e,s,c,{on:i,send:a})},o.object=function(s){return yn(s)||G.isProxyWindow(s)?Q("cross_domain_window",G.serialize(s,{send:a})):s},o))}function dt(n,e,t,r){var o,i=r.send;return function(a,s){if(s===void 0&&(s=Kt),a!=="undefined")return JSON.parse(a,function(c,u){if(Dn(this))return u;var h,f;if(Dn(u)?(h=u.__type__,f=u.__val__):(h=at(u),f=u),!h)return f;var d=s[h]||Yt[h];return d?d(f,c):f})}(t,((o={}).cross_domain_zalgo_promise=function(a){return function(s,c,u){return new S(u.then)}(0,0,a)},o.cross_domain_function=function(a){return function(s,c,u,h){var f=u.id,d=u.name,l=h.send,p=function(m){m===void 0&&(m={});function I(){var R=arguments;return G.toProxyWindow(s,{send:l}).awaitWindow().then(function(A){var b=ct(A,f);if(b&&b.val!==I)return b.val.apply({source:window,origin:C()},R);var T=[].slice.call(R);return m.fireAndForget?l(A,"postrobot_method",{id:f,name:d,args:T},{domain:c,fireAndForget:!0}):l(A,"postrobot_method",{id:f,name:d,args:T},{domain:c,fireAndForget:!1}).then(function(E){return E.data.result})}).catch(function(A){throw A})}return I.__name__=d,I.__origin__=c,I.__source__=s,I.__id__=f,I.origin=c,I},w=p();return w.fireAndForget=p({fireAndForget:!0}),w}(n,e,a,{send:i})},o.cross_domain_window=function(a){return G.deserialize(a,{send:i})},o))}var zn={};zn.postrobot_post_message=function(n,e,t){t.indexOf("file:")===0&&(t="*"),n.postMessage(e,t)};function Tn(n,e,t,r){var o=r.on,i=r.send;return S.try(function(){var a=L().getOrSet(n,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(t),a.flush=a.flush||S.flush().then(function(){if(U(n))throw new Error("Window is closed");var s=ft(n,e,((c={}).__post_robot_10_0_46__=a.buffer||[],c),{on:o,send:i}),c;delete a.buffer;for(var u=Object.keys(zn),h=[],f=0;f<u.length;f++){var d=u[f];try{zn[d](n,s,e)}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+". "+un(l)}).join(`
10
10
 
11
- `))}),a.flush.then(function(){delete a.flush})}).then(k)}function ur(n){return z("responseListeners").get(n)}function cr(n){z("responseListeners").del(n)}function sr(n){return z("erroredResponseListeners").has(n)}function fr(n){var t=n.name,r=n.win,e=n.domain,o=C("requestListeners");if(r==="*"&&(r=null),e==="*"&&(e=null),!t)throw new Error("Name required to get request listener");for(var i=0,a=[r,yn()];i<a.length;i++){var s=a[i];if(s){var c=o.get(s);if(c){var u=c[t];if(u){if(e&&typeof e=="string"){if(u[e])return u[e];if(u.__domain_regex__)for(var h=0,f=u.__domain_regex__;h<f.length;h++){var d=f[h],l=d.listener;if(_(d.regex,e))return l}}if(u["*"])return u["*"]}}}}}function Fr(n,t,r,e){var o=e.on,i=e.send,a=fr({name:r.name,win:n,domain:t}),s=r.name==="postrobot_method"&&r.data&&typeof r.data.name=="string"?r.data.name+"()":r.name;function c(u,h,f){return x.flush().then(function(){if(!r.fireAndForget&&!H(n))try{return Rn(n,t,{id:G(),origin:N(window),type:"postrobot_message_response",hash:r.hash,name:r.name,ack:u,data:h,error:f},{on:o,send:i})}catch(d){throw new Error("Send response message failed for "+s+" in "+N()+`
11
+ `))}),a.flush.then(function(){delete a.flush})}).then($)}function ht(n){return z("responseListeners").get(n)}function lt(n){z("responseListeners").del(n)}function vt(n){return z("erroredResponseListeners").has(n)}function wt(n){var e=n.name,t=n.win,r=n.domain,o=L("requestListeners");if(t==="*"&&(t=null),r==="*"&&(r=null),!e)throw new Error("Name required to get request listener");for(var i=0,a=[t,Sn()];i<a.length;i++){var s=a[i];if(s){var c=o.get(s);if(c){var u=c[e];if(u){if(r&&typeof r=="string"){if(u[r])return u[r];if(u.__domain_regex__)for(var h=0,f=u.__domain_regex__;h<f.length;h++){var d=f[h],l=d.listener;if(_(d.regex,r))return l}}if(u["*"])return u["*"]}}}}}function Xt(n,e,t,r){var o=r.on,i=r.send,a=wt({name:t.name,win:n,domain:e}),s=t.name==="postrobot_method"&&t.data&&typeof t.data.name=="string"?t.data.name+"()":t.name;function c(u,h,f){return S.flush().then(function(){if(!t.fireAndForget&&!U(n))try{return Tn(n,e,{id:V(),origin:C(window),type:"postrobot_message_response",hash:t.hash,name:t.name,ack:u,data:h,error:f},{on:o,send:i})}catch(d){throw new Error("Send response message failed for "+s+" in "+C()+`
12
12
 
13
- `+un(d))}})}return x.all([x.flush().then(function(){if(!r.fireAndForget&&!H(n))try{return Rn(n,t,{id:G(),origin:N(window),type:"postrobot_message_ack",hash:r.hash,name:r.name},{on:o,send:i})}catch(u){throw new Error("Send ack message failed for "+s+" in "+N()+`
13
+ `+un(d))}})}return S.all([S.flush().then(function(){if(!t.fireAndForget&&!U(n))try{return Tn(n,e,{id:V(),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
- `+un(u))}}),x.try(function(){if(!a)throw new Error("No handler found for post message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:n,origin:t,data:r.data})}).then(function(u){return c("success",u)},function(u){return c("error",null,u)})]).then(k).catch(function(u){if(a&&a.handleError)return a.handleError(u);throw u})}function Br(n,t,r){if(!sr(r.hash)){var e=ur(r.hash);if(!e)throw new Error("No handler found for post message ack for message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!_(e.domain,t))throw new Error("Ack origin "+t+" 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 Hr(n,t,r){if(!sr(r.hash)){var e=ur(r.hash);if(!e)throw new Error("No handler found for post message response for message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!_(e.domain,t))throw new Error("Response origin "+t+" does not match domain "+(o=e.domain,Array.isArray(o)?"("+o.join(" | ")+")":g(o)?"RegExp("+o.toString()+")":o.toString()));var o;if(n!==e.win)throw new Error("Response source does not match registered window");cr(r.hash),r.ack==="error"?e.promise.reject(r.error):r.ack==="success"&&e.promise.resolve({source:n,origin:t,data:r.data})}}function dr(n,t){var r=t.on,e=t.send,o=z("receivedMessages");try{if(!window||window.closed||!n.source)return}catch{return}var i=n.source,a=n.origin,s=function(h,f,d,l){var p=l.on,w=l.send,m;try{m=ar(f,d,h,{on:p,send:w})}catch{return}if(m&&typeof m=="object"&&m!==null){var b=m.__post_robot_10_0_46__;if(Array.isArray(b))return b}}(n.data,i,a,{on:r,send:e});if(s){nr(i);for(var c=0;c<s.length;c++){var u=s[c];if(o.has(u.id)||(o.set(u.id,!0),H(i)&&!u.fireAndForget))return;u.origin.indexOf("file:")===0&&(a="file://");try{u.type==="postrobot_message_request"?Fr(i,a,u,{on:r,send:e}):u.type==="postrobot_message_response"?Hr(i,a,u):u.type==="postrobot_message_ack"&&Br(i,a,u)}catch(h){setTimeout(function(){throw h},0)}}}}function q(n,t,r){if(!n)throw new Error("Expected name");if(typeof(t=t||{})=="function"&&(r=t,t={}),!r)throw new Error("Expected handler");var e=function o(i,a){var s=i.name,c=i.win,u=i.domain,h=C("requestListeners");if(!s||typeof s!="string")throw new Error("Name required to add request listener");if(c&&c!=="*"&&B.isProxyWindow(c)){var f=c.awaitWindow().then(function(O){return o({name:s,win:O,domain:u},a)});return{cancel:function(){f.then(function(O){return O.cancel()},k)}}}var d=c;if(Array.isArray(d)){for(var l=[],p=0,w=d;p<w.length;p++)l.push(o({name:s,domain:u,win:w[p]},a));return{cancel:function(){for(var O=0;O<l.length;O++)l[O].cancel()}}}if(Array.isArray(u)){for(var m=[],b=0,D=u;b<D.length;b++)m.push(o({name:s,win:d,domain:D[b]},a));return{cancel:function(){for(var O=0;O<m.length;O++)m[O].cancel()}}}var I=fr({name:s,win:d,domain:u});d&&d!=="*"||(d=yn());var P=(u=u||"*").toString();if(I)throw d&&u?new Error("Request listener already exists for "+s+" on domain "+u.toString()+" for "+(d===yn()?"wildcard":"specified")+" window"):d?new Error("Request listener already exists for "+s+" for "+(d===yn()?"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 R=h.getOrSet(d,function(){return{}}),E=cn(R,s,function(){return{}}),A,J;return Pn(u)?(A=cn(E,"__domain_regex__",function(){return[]})).push(J={regex:u,listener:a}):E[P]=a,{cancel:function(){delete E[P],J&&(A.splice(A.indexOf(J,1)),A.length||delete E.__domain_regex__),Object.keys(E).length||delete R[s],d&&!Object.keys(R).length&&h.del(d)}}}({name:n,win:t.window,domain:t.domain||"*"},{handler:r||t.handler,handleError:t.errorHandler||function(o){throw o}});return{cancel:function(){e.cancel()}}}function Jr(n,t,r){typeof(t=t||{})=="function"&&(r=t,t={});var e=new x,o;return t.errorHandler=function(i){o.cancel(),e.reject(i)},o=q(n,t,function(i){if(o.cancel(),e.resolve(i),r)return r(i)}),e.cancel=o.cancel,e}var V=function n(t,r,e,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,s=o.timeout||5e3,c=o.fireAndForget||!1;return B.toProxyWindow(t,{send:n}).awaitWindow().then(function(u){return x.try(function(){if(function(h,f,d){if(!h)throw new Error("Expected name");if(d&&typeof d!="string"&&!Array.isArray(d)&&!Pn(d))throw new TypeError("Can not send "+h+". Expected domain "+JSON.stringify(d)+" to be a string, array, or regex");if(H(f))throw new Error("Can not send "+h+". Target window is closed")}(r,u,i),function(h,f){var d=Fn(f);if(d)return d===h;if(f===h||function(w){w===void 0&&(w=window);try{if(w.top)return w.top}catch{}if(K(w)===w)return w;try{if(Tn(window,w)&&window.top)return window.top}catch{}try{if(Tn(w,window)&&window.top)return window.top}catch{}for(var m=0,b=function I(P){for(var R=[],E=0,A=Ln(P);E<A.length;E++){var J=A[E];R.push(J);for(var O=0,fn=I(J);O<fn.length;O++)R.push(fn[O])}return R}(w);m<b.length;m++){var D=b[m];try{if(D.top)return D.top}catch{}if(K(D)===D)return D}}(f)===f)return!1;for(var l=0,p=Ln(h);l<p.length;l++)if(p[l]===f)return!0;return!1}(window,u))return function(h,f,d){f===void 0&&(f=5e3),d===void 0&&(d="Window");var l=function(p){return C("helloPromises").getOrSet(p,function(){return new x})}(h);return f!==-1&&(l=l.timeout(f,new Error(d+" did not load after "+f+"ms"))),l}(u,s)}).then(function(h){return function(f,d,l,p){var w=p.send;return x.try(function(){return typeof d=="string"?d:x.try(function(){return l||In(f,{send:w}).then(function(m){return m.domain})}).then(function(m){if(!_(d,d))throw new Error("Domain "+Vn(d)+" does not match "+Vn(d));return m})})}(u,i,(h===void 0?{}:h).domain,{send:n})}).then(function(h){var f=h,d=r==="postrobot_method"&&e&&typeof e.name=="string"?e.name+"()":r,l=new x,p=r+"_"+G();if(!c){var w={name:r,win:u,domain:f,promise:l};(function(E,A){z("responseListeners").set(E,A)})(p,w);var m=C("requestPromises").getOrSet(u,function(){return[]});m.push(l),l.catch(function(){(function(E){z("erroredResponseListeners").set(E,!0)})(p),cr(p)});var b=function(E){return C("knownWindows").get(E,!1)}(u)?1e4:2e3,D=a,I=b,P=D,R=function(E,A){var J;return function O(){J=setTimeout(function(){(function(){if(H(u))return l.reject(new Error("Window closed for "+r+" before "+(w.ack?"response":"ack")));if(w.cancelled)return l.reject(new Error("Response listener was cancelled for "+r));I=Math.max(I-500,0),P!==-1&&(P=Math.max(P-500,0)),w.ack||I!==0?P===0&&l.reject(new Error("No response for postMessage "+d+" in "+N()+" in "+D+"ms")):l.reject(new Error("No ack for postMessage "+d+" in "+N()+" in "+b+"ms"))})(),O()},500)}(),{cancel:function(){clearTimeout(J)}}}();l.finally(function(){R.cancel(),m.splice(m.indexOf(l,1))}).catch(k)}return Rn(u,f,{id:G(),origin:N(window),type:"postrobot_message_request",hash:p,name:r,data:e,fireAndForget:c},{on:q,send:n}).then(function(){return c?l.resolve():l},function(E){throw new Error("Send request message failed for "+d+" in "+N()+`
15
+ `+un(u))}}),S.try(function(){if(!a)throw new Error("No handler found for post message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:n,origin:e,data:t.data})}).then(function(u){return c("success",u)},function(u){return c("error",null,u)})]).then($).catch(function(u){if(a&&a.handleError)return a.handleError(u);throw u})}function kt(n,e,t){if(!vt(t.hash)){var r=ht(t.hash);if(!r)throw new Error("No handler found for post message ack for message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!_(r.domain,e))throw new Error("Ack origin "+e+" does not match domain "+r.domain.toString());if(n!==r.win)throw new Error("Ack source does not match registered window")}catch(o){r.promise.reject(o)}r.ack=!0}}function $t(n,e,t){if(!vt(t.hash)){var r=ht(t.hash);if(!r)throw new Error("No handler found for post message response for message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!_(r.domain,e))throw new Error("Response origin "+e+" does not match domain "+(o=r.domain,Array.isArray(o)?"("+o.join(" | ")+")":y(o)?"RegExp("+o.toString()+")":o.toString()));var o;if(n!==r.win)throw new Error("Response source does not match registered window");lt(t.hash),t.ack==="error"?r.promise.reject(t.error):t.ack==="success"&&r.promise.resolve({source:n,origin:e,data:t.data})}}function mt(n,e){var t=e.on,r=e.send,o=z("receivedMessages");try{if(!window||window.closed||!n.source)return}catch{return}var i=n.source,a=n.origin,s=function(h,f,d,l){var p=l.on,w=l.send,m;try{m=dt(f,d,h,{on:p,send:w})}catch{return}if(m&&typeof m=="object"&&m!==null){var I=m.__post_robot_10_0_46__;if(Array.isArray(I))return I}}(n.data,i,a,{on:t,send:r});if(s){it(i);for(var c=0;c<s.length;c++){var u=s[c];if(o.has(u.id)||(o.set(u.id,!0),U(i)&&!u.fireAndForget))return;u.origin.indexOf("file:")===0&&(a="file://");try{u.type==="postrobot_message_request"?Xt(i,a,u,{on:t,send:r}):u.type==="postrobot_message_response"?$t(i,a,u):u.type==="postrobot_message_ack"&&kt(i,a,u)}catch(h){setTimeout(function(){throw h},0)}}}}function q(n,e,t){if(!n)throw new Error("Expected name");if(typeof(e=e||{})=="function"&&(t=e,e={}),!t)throw new Error("Expected handler");var r=function o(i,a){var s=i.name,c=i.win,u=i.domain,h=L("requestListeners");if(!s||typeof s!="string")throw new Error("Name required to add request listener");if(c&&c!=="*"&&G.isProxyWindow(c)){var f=c.awaitWindow().then(function(D){return o({name:s,win:D,domain:u},a)});return{cancel:function(){f.then(function(D){return D.cancel()},$)}}}var d=c;if(Array.isArray(d)){for(var l=[],p=0,w=d;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=[],I=0,R=u;I<R.length;I++)m.push(o({name:s,win:d,domain:R[I]},a));return{cancel:function(){for(var D=0;D<m.length;D++)m[D].cancel()}}}var A=wt({name:s,win:d,domain:u});d&&d!=="*"||(d=Sn());var b=(u=u||"*").toString();if(A)throw d&&u?new Error("Request listener already exists for "+s+" on domain "+u.toString()+" for "+(d===Sn()?"wildcard":"specified")+" window"):d?new Error("Request listener already exists for "+s+" for "+(d===Sn()?"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 T=h.getOrSet(d,function(){return{}}),E=cn(T,s,function(){return{}}),O,J;return An(u)?(O=cn(E,"__domain_regex__",function(){return[]})).push(J={regex:u,listener:a}):E[b]=a,{cancel:function(){delete E[b],J&&(O.splice(O.indexOf(J,1)),O.length||delete E.__domain_regex__),Object.keys(E).length||delete T[s],d&&!Object.keys(T).length&&h.del(d)}}}({name:n,win:e.window,domain:e.domain||"*"},{handler:t||e.handler,handleError:e.errorHandler||function(o){throw o}});return{cancel:function(){r.cancel()}}}function Qt(n,e,t){typeof(e=e||{})=="function"&&(t=e,e={});var r=new S,o;return e.errorHandler=function(i){o.cancel(),r.reject(i)},o=q(n,e,function(i){if(o.cancel(),r.resolve(i),t)return t(i)}),r.cancel=o.cancel,r}var Y=function n(e,t,r,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,s=o.timeout||5e3,c=o.fireAndForget||!1;return G.toProxyWindow(e,{send:n}).awaitWindow().then(function(u){return S.try(function(){if(function(h,f,d){if(!h)throw new Error("Expected name");if(d&&typeof d!="string"&&!Array.isArray(d)&&!An(d))throw new TypeError("Can not send "+h+". Expected domain "+JSON.stringify(d)+" to be a string, array, or regex");if(U(f))throw new Error("Can not send "+h+". Target window is closed")}(t,u,i),function(h,f){var d=Jn(f);if(d)return d===h;if(f===h||function(w){w===void 0&&(w=window);try{if(w.top)return w.top}catch{}if(K(w)===w)return w;try{if(Gn(window,w)&&window.top)return window.top}catch{}try{if(Gn(w,window)&&window.top)return window.top}catch{}for(var m=0,I=function A(b){for(var T=[],E=0,O=Un(b);E<O.length;E++){var J=O[E];T.push(J);for(var D=0,fn=A(J);D<fn.length;D++)T.push(fn[D])}return T}(w);m<I.length;m++){var R=I[m];try{if(R.top)return R.top}catch{}if(K(R)===R)return R}}(f)===f)return!1;for(var l=0,p=Un(h);l<p.length;l++)if(p[l]===f)return!0;return!1}(window,u))return function(h,f,d){f===void 0&&(f=5e3),d===void 0&&(d="Window");var l=function(p){return L("helloPromises").getOrSet(p,function(){return new S})}(h);return f!==-1&&(l=l.timeout(f,new Error(d+" did not load after "+f+"ms"))),l}(u,s)}).then(function(h){return function(f,d,l,p){var w=p.send;return S.try(function(){return typeof d=="string"?d:S.try(function(){return l||On(f,{send:w}).then(function(m){return m.domain})}).then(function(m){if(!_(d,d))throw new Error("Domain "+$n(d)+" does not match "+$n(d));return m})})}(u,i,(h===void 0?{}:h).domain,{send:n})}).then(function(h){var f=h,d=t==="postrobot_method"&&r&&typeof r.name=="string"?r.name+"()":t,l=new S,p=t+"_"+V();if(!c){var w={name:t,win:u,domain:f,promise:l};(function(E,O){z("responseListeners").set(E,O)})(p,w);var m=L("requestPromises").getOrSet(u,function(){return[]});m.push(l),l.catch(function(){(function(E){z("erroredResponseListeners").set(E,!0)})(p),lt(p)});var I=function(E){return L("knownWindows").get(E,!1)}(u)?1e4:2e3,R=a,A=I,b=R,T=function(E,O){var J;return function D(){J=setTimeout(function(){(function(){if(U(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));A=Math.max(A-500,0),b!==-1&&(b=Math.max(b-500,0)),w.ack||A!==0?b===0&&l.reject(new Error("No response for postMessage "+d+" in "+C()+" in "+R+"ms")):l.reject(new Error("No ack for postMessage "+d+" in "+C()+" in "+I+"ms"))})(),D()},500)}(),{cancel:function(){clearTimeout(J)}}}();l.finally(function(){T.cancel(),m.splice(m.indexOf(l,1))}).catch($)}return Tn(u,f,{id:V(),origin:C(window),type:"postrobot_message_request",hash:p,name:t,data:r,fireAndForget:c},{on:q,send:n}).then(function(){return c?l.resolve():l},function(E){throw new Error("Send request message failed for "+d+" in "+C()+`
16
16
 
17
- `+un(E))})})})};function Ur(n,t,r){return ir(n,t,r,{on:q,send:V})}function Gr(n,t,r){return ar(n,t,r,{on:q,send:V})}function Zr(n){return new B({send:V,win:n})}function qr(n){return B.toProxyWindow(n,{send:V})}function hr(){sn().initialized||(sn().initialized=!0,t=(n={on:q,send:V}).on,r=n.send,(e=sn()).receiveMessage=e.receiveMessage||function(o){return dr(o,{on:t,send:r})},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,f=u.send;x.try(function(){var d=c.source||c.sourceElement,l=c.origin||c.originalEvent&&c.originalEvent.origin,p=c.data;if(l==="null"&&(l="file://"),d){if(!l)throw new Error("Post message did not have origin domain");dr({source:d,origin:l,data:p},{on:h,send:f})}})})(s,{on:i,send:a})})})}({on:q,send:V}),function(o){var i=o.on,a=o.send;z("builtinListeners").getOrSet("helloListener",function(){var s=i("postrobot_hello",{domain:"*"},function(u){return Qn(u.source,{domain:u.origin}),{instanceID:kn()}}),c=Fn();return c&&In(c,{send:a}).catch(function(u){}),s})}({on:q,send:V}));var n,t,r,e}function Vr(){(function(){for(var t=z("responseListeners"),r=0,e=t.keys();r<e.length;r++){var o=e[r],i=t.get(o);i&&(i.cancelled=!0),t.del(o)}})(),(n=z().get("postMessageListener"))&&n.cancel();var n;delete window.__post_robot_10_0_46__}var Yr=!0;function Kr(n){for(var t=0,r=C("requestPromises").get(n,[]);t<r.length;t++)r[t].reject(new Error("Window "+(H(n)?"closed":"cleaned up")+" before response")).catch(k)}hr()}])})})(Nn);var Er=Nn.exports;(function(S){S.exports=Er,S.exports.default=S.exports})(Mn);var Wr=Mn.exports;const Wn=yr(Wr);function xr(S){Wn.on("mounted",()=>{S()})}function Sr(S){Wn.send(S.contentWindow,"ready")}function br(S,M){Wn.send(S.contentWindow,"config",M)}class Pr{constructor(M,T,y){En(this,"iframe");En(this,"flow");En(this,"configProps");if(this.flow=M,this.configProps=T,!this.propsAreValid())throw new Error("Invalid props");this.iframe=pr(M,T,y),xr(this.initialize.bind(this))}initialize(){this.iframe.addEventListener("load",()=>{Sr(this.iframe),br(this.iframe,this.configProps)})}propsAreValid(){return this.flow==="authenticate"?this.configProps.companyId&&this.configProps.identityId:this.flow==="register"?this.configProps.companyId&&this.configProps.flowTemplateId:!1}}return Pr});
17
+ `+un(E))})})})};function _t(n,e,t){return ft(n,e,t,{on:q,send:Y})}function ne(n,e,t){return dt(n,e,t,{on:q,send:Y})}function te(n){return new G({send:Y,win:n})}function ee(n){return G.toProxyWindow(n,{send:Y})}function pt(){sn().initialized||(sn().initialized=!0,e=(n={on:q,send:Y}).on,t=n.send,(r=sn()).receiveMessage=r.receiveMessage||function(o){return mt(o,{on:e,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,f=u.send;S.try(function(){var d=c.source||c.sourceElement,l=c.origin||c.originalEvent&&c.originalEvent.origin,p=c.data;if(l==="null"&&(l="file://"),d){if(!l)throw new Error("Post message did not have origin domain");mt({source:d,origin:l,data:p},{on:h,send:f})}})})(s,{on:i,send:a})})})}({on:q,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 rt(u.source,{domain:u.origin}),{instanceID:et()}}),c=Jn();return c&&On(c,{send:a}).catch(function(u){}),s})}({on:q,send:Y}));var n,e,t,r}function re(){(function(){for(var e=z("responseListeners"),t=0,r=e.keys();t<r.length;t++){var o=r[t],i=e.get(o);i&&(i.cancelled=!0),e.del(o)}})(),(n=z().get("postMessageListener"))&&n.cancel();var n;delete window.__post_robot_10_0_46__}var oe=!0;function ie(n){for(var e=0,t=L("requestPromises").get(n,[]);e<t.length;e++)t[e].reject(new Error("Window "+(U(n)?"closed":"cleaned up")+" before response")).catch($)}pt()}])})})(Bn);var Ot=Bn.exports;(function(W){W.exports=Ot,W.exports.default=W.exports})(Fn);var Dt=Fn.exports;const hn=At(Dt),Nt="WIDGET_MOUNTED",Rt="WIDGET_EVENT";function zt(W){const{configure:j,onEvent:M}=W;hn.on(Nt,()=>{j()}),hn.on(Rt,g=>{M(g.data),Et.includes(g.data.eventType)&&Ln()})}function Tt(W){zt(W)}function jt(W){hn.send(W.contentWindow,"ready")}function Mt(W,j){hn.send(W.contentWindow,"config",j)}class Ct{constructor(j,M,g,v){Mn(this,ln);Mn(this,vn);dn(this,"iframe");dn(this,"flow");dn(this,"configProps");dn(this,"onEvent");if(this.flow=j,this.configProps=M,this.onEvent=g,!this.propsAreValid())throw new Error("Invalid props");this.iframe=bt(j,M,v),Tt({configure:Cn(this,ln,gt).bind(this),onEvent:Cn(this,vn,yt).bind(this)})}propsAreValid(){return this.flow==="authenticate"?this.configProps.companyId&&this.configProps.identityId:this.flow==="register"?this.configProps.companyId&&this.configProps.flowTemplateId:!1}close(){Ln()}}return ln=new WeakSet,gt=function(){jt(this.iframe),Mt(this.iframe,this.configProps)},vn=new WeakSet,yt=function(j){this.onEvent(j)},Ct});
@@ -1,3 +1,4 @@
1
1
  export declare const CONTAINER_ID = "soyio-widget-iframe-container";
2
2
  export declare const IFRAME_ID = "soyio-widget-iframe";
3
3
  export declare const BASE_URL = "https://staging.soyio.id/widget";
4
+ export declare const FINISHING_EVENTS: string[];
@@ -0,0 +1,11 @@
1
+ declare class Widget {
2
+ #private;
3
+ private iframe;
4
+ private flow;
5
+ private configProps;
6
+ private onEvent;
7
+ constructor(flow: Flow, configProps: ConfigProps, onEvent: (data: any) => void, developmentUrl?: string);
8
+ propsAreValid(): string | false | undefined;
9
+ close(): void;
10
+ }
11
+ export default Widget;
@@ -0,0 +1,6 @@
1
+ type Hooks = {
2
+ configure: () => void;
3
+ onEvent: (event: any) => void;
4
+ };
5
+ export declare function setListeners(hooks: Hooks): void;
6
+ export {};
@@ -1 +1,2 @@
1
1
  export declare function mountIframeToDOM(flow: Flow, configProps: ConfigProps, developmentUrl?: string): HTMLIFrameElement;
2
+ export declare function removeWidget(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soyio/soyio-widget",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "module": "./dist/index.js",
package/dist/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- declare class Widget {
2
- private iframe;
3
- private flow;
4
- private configProps;
5
- constructor(flow: Flow, configProps: ConfigProps, developmentUrl?: string);
6
- initialize(): void;
7
- propsAreValid(): string | false | undefined;
8
- }
9
- export default Widget;
@@ -1,3 +0,0 @@
1
- type ListenerCallback = () => void;
2
- declare function onMounted(configure: ListenerCallback): void;
3
- export { onMounted };
File without changes