@soyio/soyio-widget 2.10.1 → 2.10.2
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 +362 -354
- package/dist/index.umd.cjs +20 -20
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(C,
|
|
1
|
+
(function(C,T){typeof exports=="object"&&typeof module!="undefined"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(C=typeof globalThis!="undefined"?globalThis:C||self,T(C["soyio-widget"]={}))})(this,function(C){"use strict";var Bn=Object.defineProperty;var Gn=Object.getPrototypeOf;var $n=Reflect.get;var Yn=(C,T,L)=>T in C?Bn(C,T,{enumerable:!0,configurable:!0,writable:!0,value:L}):C[T]=L;var N=(C,T,L)=>(Yn(C,typeof T!="symbol"?T+"":T,L),L),Jn=(C,T,L)=>{if(!T.has(C))throw TypeError("Cannot "+L)};var Mt=(C,T,L)=>{if(T.has(C))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(C):T.set(C,L)};var jt=(C,T,L)=>(Jn(C,T,"access private method"),L),kt=(C,T,L)=>$n(Gn(C),L,T);var J=(C,T,L)=>new Promise((Se,ue)=>{var De=K=>{try{ce(L.next(K))}catch(de){ue(de)}},Ne=K=>{try{ce(L.throw(K))}catch(de){ue(de)}},ce=K=>K.done?Se(K.value):Promise.resolve(K.value).then(De,Ne);ce((L=L.apply(C,T)).next())});var Ie,Ut;function T(m,p){for(var w=0;w<p.length;w++){const l=p[w];if(typeof l!="string"&&!Array.isArray(l)){for(const g in l)if(g!=="default"&&!(g in m)){const y=Object.getOwnPropertyDescriptor(l,g);y&&Object.defineProperty(m,g,y.get?y:{enumerable:!0,get:()=>l[g]})}}}return Object.freeze(Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}))}class L{constructor(){N(this,"tooltipElement",null);N(this,"tooltipContent",null);N(this,"tooltipClass","soyio-tooltip");N(this,"hideTimeout",null);this.createTooltipElement(),this.setupGlobalListeners()}createTooltipElement(){const p=document.querySelector(`.${this.tooltipClass}`);p==null||p.remove(),this.tooltipElement=document.createElement("div"),this.tooltipElement.className=this.tooltipClass,this.tooltipElement.style.cssText=`
|
|
2
2
|
position: fixed;
|
|
3
3
|
z-index: 99999;
|
|
4
4
|
background: white;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
height: 8px;
|
|
24
24
|
background: white;
|
|
25
25
|
box-shadow: 2px 2px 2px rgba(0,0,0,0.1);
|
|
26
|
-
`,this.tooltipElement.appendChild(w),document.body.appendChild(this.tooltipElement)}setupGlobalListeners(){window.addEventListener("scroll",()=>this.hide(),!0),window.addEventListener("resize",()=>this.hide()),window.addEventListener("orientationchange",()=>this.hide())}show(
|
|
26
|
+
`,this.tooltipElement.appendChild(w),document.body.appendChild(this.tooltipElement)}setupGlobalListeners(){window.addEventListener("scroll",()=>this.hide(),!0),window.addEventListener("resize",()=>this.hide()),window.addEventListener("orientationchange",()=>this.hide())}show(p,w,l){!this.tooltipElement||!this.tooltipContent||(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.tooltipContent.textContent=p,this.tooltipElement.style.left=`${w}px`,this.tooltipElement.style.top=`${l}px`,this.tooltipElement.style.opacity="1")}hide(){this.tooltipElement&&(this.tooltipElement.style.opacity="0")}destroy(){var p;(p=this.tooltipElement)==null||p.remove(),this.tooltipElement=null,this.tooltipContent=null,this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}}const Se="https://app.soyio.id",ue="https://sandbox.soyio.id",De="https://privacy.soyio.id",Ne="https://privacy-sandbox.soyio.id",ce=["DISCLOSURE_REQUEST_SUCCESSFUL","IDENTITY_REGISTERED","IDENTITY_SIGNATURE","UNEXPECTED_ERROR","DENIED_CAMERA_PERMISSION","REJECTED_SIGNATURE"],K="WIDGET_CLOSED",de=420,Ft=720,Ht=500,_t={minWidth:"375px",maxWidth:"50rem"},qt={minWidth:"375px",maxWidth:"36rem"},Bt={minWidth:"375px",maxWidth:"50rem"};function Gt(m,p,w){return J(this,null,function*(){if(!m.contentWindow)throw new Error("Invalid iframe: contentWindow is null");const l=yield Promise.resolve().then(()=>ke);try{yield l.send(m.contentWindow,"SET_APPEARANCE",{appearance:p,identifier:w})}catch(g){console.error("Failed to send appearance config:",g)}})}const $t="IFRAME_READY",Yt="IFRAME_HEIGHT_CHANGE",Jt="TOOLTIP_STATE_CHANGE",Vt="CONSENT_STATE_CHANGE",B={onHeightChange:{},onIframeReady:{},onTooltipChange:{},onStateChange:{}};let Xe,Ze,Ke,Qe;function Xt(){return J(this,null,function*(){const m=yield Promise.resolve().then(()=>ke);Xe||Ze||Ke||Qe||(Xe=m.on(Yt,p=>J(this,null,function*(){const w=p.data,l=B.onHeightChange[w.identifier];l&&l(w.height)})),Ze=m.on($t,p=>J(this,null,function*(){const w=p.data,l=B.onIframeReady[w.identifier];l&&l()})),Ke=m.on(Jt,p=>J(this,null,function*(){const w=p.data,l=B.onTooltipChange[w.identifier];l&&l(w)})),Qe=m.on(Vt,p=>J(this,null,function*(){const w=p.data,l=B.onStateChange[w.identifier];l&&l(w)})))})}function et(m,p){const{onHeightChange:w,onIframeReady:l,onTooltipChange:g,onStateChange:y}=p;w&&(B.onHeightChange[m]=w),l&&(B.onIframeReady[m]=l),g&&(B.onTooltipChange[m]=g),y&&(B.onStateChange[m]=y)}function Zt(m){delete B.onHeightChange[m],delete B.onIframeReady[m],delete B.onTooltipChange[m],delete B.onStateChange[m]}function Kt(m){const p=document.getElementById(m);p&&(console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."),p.remove())}function Qt(m){const p=document.querySelector(m);if(!p)throw new Error(`Iframe div container with id '${m}' not found`);if(p.tagName.toLowerCase()!=="div")throw new Error(`Iframe container with id '${m}' must be a <div> element`);const w=p;return w.style.position="relative",w.style.cssText+=`
|
|
27
27
|
padding: 0 !important;
|
|
28
28
|
margin: 0 !important;
|
|
29
29
|
display: flex !important;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
border: none !important;
|
|
33
33
|
transition: height 0.35s !important;
|
|
34
34
|
opacity: 1 !important;
|
|
35
|
-
`,w}function
|
|
35
|
+
`,w}function en(m,p,w){const l=document.createElement("iframe");return l.id=p,l.src=m,l.style.cssText+=`
|
|
36
36
|
width: 100% !important;
|
|
37
37
|
min-width: ${w.minWidth} !important;
|
|
38
38
|
max-width: ${w.maxWidth} !important;
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
opacity: 1;
|
|
42
42
|
transition: height 0.35s,
|
|
43
43
|
opacity 0.4s 0.1s;
|
|
44
|
-
`,l}function
|
|
44
|
+
`,l}function tn(){return Math.random().toString(36).substring(2,10)}class be{constructor(p){N(this,"iframe",null);N(this,"skeleton",null);N(this,"options");N(this,"appearance");N(this,"tooltipManager");N(this,"defaultIframeCSSConfig",_t);N(this,"Skeleton",null);N(this,"defaultUniqueId");this.options=p,this.appearance=p.appearance||null,this.tooltipManager=new L,this.defaultUniqueId=be.generateUniqueId()}static generateUniqueId(){return tn()}get uniqueIdentifier(){return this.defaultUniqueId}get iframeIdentifier(){return`${this.defaultIframePrefix}-${this.uniqueIdentifier}`}handleHeightChange(p){if(!this.iframe||(this.iframe.style.height=`${p}px`,p>0))return;const{parentElement:w}=this.iframe;w&&(w.style.display="none")}handleIframeReady(){this.iframe&&(this.options.onReady&&this.options.onReady(),Gt(this.iframe,this.appearance,this.uniqueIdentifier),this.skeleton&&this.skeleton.hide())}handleTooltipChange(p){if(!this.iframe)return;const w=this.iframe.getBoundingClientRect(),{text:l,coordinates:g,isVisible:y}=p,E=g.x+w.left,W=g.y+w.top;y?this.tooltipManager.show(l,E,W):this.tooltipManager.hide()}setupListeners(){return J(this,null,function*(){yield Xt();const p={onHeightChange:this.handleHeightChange.bind(this),onIframeReady:this.handleIframeReady.bind(this),onTooltipChange:this.handleTooltipChange.bind(this)};et(this.uniqueIdentifier,p)})}mount(p){return J(this,null,function*(){yield this.setupListeners(),Kt(this.iframeIdentifier);const w=Qt(p),l=this.iframeUrl();return this.iframe=en(l,this.iframeIdentifier,this.defaultIframeCSSConfig),this.Skeleton&&(this.skeleton=new this.Skeleton(this.uniqueIdentifier),this.skeleton.mount(w)),w.appendChild(this.iframe),this})}unmount(){Zt(this.uniqueIdentifier),this.skeleton&&(this.skeleton.hide(),this.skeleton=null),this.iframe&&(this.iframe.remove(),this.iframe=null)}}class nn{constructor(p){N(this,"element");N(this,"identifier");this.identifier=`skeleton-${p}`,this.element=document.createElement("div"),this.element.id=this.identifier,this.element.style.cssText=`
|
|
45
45
|
position: absolute;
|
|
46
46
|
left: 50%;
|
|
47
47
|
top: 50%;
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
border-radius: 50%;
|
|
94
94
|
margin-left: auto;
|
|
95
95
|
margin-right: 3px;
|
|
96
|
-
`;const
|
|
96
|
+
`;const W=document.createElement("div");W.style.cssText=`
|
|
97
97
|
display: flex;
|
|
98
98
|
align-items: center;
|
|
99
99
|
gap: 1rem;
|
|
@@ -106,19 +106,19 @@
|
|
|
106
106
|
border-radius: 0.25rem;
|
|
107
107
|
flex-shrink: 0;
|
|
108
108
|
margin-left: 10px;
|
|
109
|
-
`;const
|
|
109
|
+
`;const X=document.createElement("div");X.style.cssText=`
|
|
110
110
|
flex-grow: 1;
|
|
111
111
|
display: flex;
|
|
112
112
|
flex-direction: column;
|
|
113
113
|
gap: 0.5rem;
|
|
114
|
-
`;const
|
|
114
|
+
`;const G=document.createElement("div");G.style.cssText=`
|
|
115
115
|
height: 0.875rem;
|
|
116
116
|
width: 80%;
|
|
117
117
|
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
118
118
|
background-size: 200% 100%;
|
|
119
119
|
animation: shimmer 1.5s infinite;
|
|
120
120
|
border-radius: 0.125rem;
|
|
121
|
-
`;const
|
|
121
|
+
`;const le=document.createElement("div");if(le.style.cssText=`
|
|
122
122
|
height: 0.875rem;
|
|
123
123
|
width: 60%;
|
|
124
124
|
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
@@ -130,24 +130,24 @@
|
|
|
130
130
|
0% { background-position: 200% 0; }
|
|
131
131
|
100% { background-position: -200% 0; }
|
|
132
132
|
}
|
|
133
|
-
`,document.head.appendChild(ee)}l.appendChild(g),l.appendChild(y),l.appendChild(E),
|
|
133
|
+
`,document.head.appendChild(ee)}l.appendChild(g),l.appendChild(y),l.appendChild(E),X.appendChild(G),X.appendChild(le),W.appendChild(V),W.appendChild(X),w.appendChild(l),w.appendChild(W),this.element.appendChild(w)}cleanupExistingSkeleton(){const p=document.getElementById(this.identifier);p&&p.remove()}mount(p){this.cleanupExistingSkeleton(),p.appendChild(this.element)}hide(){this.element.style.opacity="0",setTimeout(()=>this.element.remove(),300)}}function rn(m){var E;const p=["actionToken","entityId","context","optionalReconsentBehavior","mandatoryReconsentBehavior"],w=(E=m.isSandbox)!=null?E:!1,l=m.developmentUrl||(w?ue:Se),g=new URLSearchParams;p.forEach(W=>{m[W]&&g.set(W,m[W])});const y=g.toString();return`${l}/embed/consents/${m.consentTemplateId}${y?`?${y}`:""}`}class Le extends be{constructor(w){super(w);N(this,"defaultIframePrefix","consent-box");N(this,"defaultIframeCSSConfig",qt);N(this,"state",{isSelected:!1,actionToken:null});this.Skeleton=nn}get uniqueIdentifier(){return this.options.consentTemplateId}iframeUrl(){return rn(this.options)}handleStateChange(w){const{isSelected:l,actionToken:g}=w;this.state={isSelected:l,actionToken:g},this.options.onEvent({eventName:"CONSENT_CHECKBOX_CHANGE",isSelected:l,actionToken:g})}setupListeners(){return J(this,null,function*(){yield kt(Le.prototype,this,"setupListeners").call(this),et(this.uniqueIdentifier,{onStateChange:this.handleStateChange.bind(this)})})}getState(){return this.state}}function on(m){var E;const p=["subjectId","companyId"],w=(E=m.isSandbox)!=null?E:!1,l=m.developmentUrl||(w?Ne:De),g=new URLSearchParams;p.forEach(W=>{m[W]&&g.set(W,m[W])});const y=g.toString();return`${l}/${y?`?${y}`:""}`}class an extends be{constructor(){super(...arguments);N(this,"defaultIframePrefix","privacy-center");N(this,"_uniqueIdentifier","privacy-center");N(this,"defaultIframeCSSConfig",Bt)}get uniqueIdentifier(){return this._uniqueIdentifier}iframeUrl(){return on(this.options)}}const sn=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function un(m){let p="widget/";return"disclosureRequestId"in m.configProps?p+=["disclosures",m.configProps.disclosureRequestId].join("/"):p+=m.request,p}function cn(m){var y;const p=(y=m.isSandbox)!=null?y:!1,w=m.developmentUrl||(p?ue:Se),l=Object.entries(m.configProps).filter(([E,W])=>W||E==="disclosureRequestId").map(([E,W])=>`${E}=${encodeURIComponent(W)}`).join("&"),g=un(m);return`${w}/${g}?sdk=web&${l}`}const dn=!!(typeof window!="undefined"&&window.document&&window.document.createElement);let Q=null,ze=null;function Me(m=null){Q&&!Q.closed&&Q.focus(),m==null||m.preventDefault()}function je(){document.body.style.filter="",document.body.removeEventListener("click",Me)}function fn(){ze=setInterval(()=>{(!Q||Q.closed)&&(ze&&clearInterval(ze),je())},Ht)}function ln(m){const p=cn(m),w=de,l=Ft,g=window.screenLeft!==void 0?window.screenLeft:window.screenX,y=window.screenTop!==void 0?window.screenTop:window.screenY,E=window.innerWidth||document.documentElement.clientWidth||window.screen.width,W=window.innerHeight||document.documentElement.clientHeight||window.screen.height,V=E/window.screen.availWidth,X=(E-w)/2/V+g,G=(W-l)/2/V+y;document.body.style.filter="blur(5px)",document.body.addEventListener("click",Me),Q=window.open(p,"Soyio",`scrollbars=yes,
|
|
134
134
|
width=${w},
|
|
135
135
|
height=${l},
|
|
136
|
-
top=${
|
|
137
|
-
left=${
|
|
138
|
-
`;function T(e){return e===void 0&&(e=window),e.location.protocol}function V(e){if(e===void 0&&(e=window),e.mockDomain){var n=e.mockDomain.split("//")[0];if(n)return n}return T(e)}function Z(e){return e===void 0&&(e=window),V(e)==="about:"}function B(e){if(e===void 0&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch(n){}}function he(e){if(e===void 0&&(e=window),e&&!B(e))try{return e.opener}catch(n){}}function ee(e){try{return!0}catch(n){}return!1}function Ce(e){e===void 0&&(e=window);var n=e.location;if(!n)throw new Error("Can not read window location");var t=T(e);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var r=B(e);return r&&ee()?Ce(r):"about://"}var o=n.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function U(e){e===void 0&&(e=window);var n=Ce(e);return n&&e.mockDomain&&e.mockDomain.indexOf("mock:")===0?e.mockDomain:n}function re(e){if(!function(n){try{if(n===window)return!0}catch(r){}try{var t=Object.getOwnPropertyDescriptor(n,"location");if(t&&t.enumerable===!1)return!1}catch(r){}try{if(Z(n)&&ee())return!0}catch(r){}try{if(function(r){return r===void 0&&(r=window),V(r)==="mock:"}(n)&&ee())return!0}catch(r){}try{if(Ce(n)===Ce(window))return!0}catch(r){}return!1}(e))return!1;try{if(e===window||Z(e)&&ee()||U(window)===U(e))return!0}catch(n){}return!1}function Ie(e){if(!re(e))throw new Error("Expected window to be same domain");return e}function it(e,n){if(!e||!n)return!1;var t=B(n);return t?t===e:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch(i){}return o}(n).indexOf(e)!==-1}function at(e){var n=[],t;try{t=e.frames}catch(u){t=e}var r;try{r=t.length}catch(u){}if(r===0)return n;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch(u){continue}n.push(i)}return n}for(var a=0;a<100;a++){var c=void 0;try{c=t[a]}catch(u){return n}if(!c)return n;n.push(c)}return n}var yn=[],En=[];function $(e,n){n===void 0&&(n=!0);try{if(e===window)return!1}catch(o){return!0}try{if(!e)return!0}catch(o){return!0}try{if(e.closed)return!0}catch(o){return!o||o.message!==E}if(n&&re(e))try{if(e.mockclosed)return!0}catch(o){}try{if(!e.parent||!e.top)return!0}catch(o){}var t=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch(c){}return-1}(yn,e);if(t!==-1){var r=En[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 st(e){return e===void 0&&(e=window),he(e=e||window)||B(e)||void 0}function ue(e,n){if(typeof e=="string"){if(typeof n=="string")return e==="*"||n===e;if(y(n)||Array.isArray(n))return!1}return y(e)?y(n)?e.toString()===n.toString():!Array.isArray(n)&&!!n.match(e):!!Array.isArray(e)&&(Array.isArray(n)?JSON.stringify(e)===JSON.stringify(n):!y(n)&&e.some(function(t){return ue(t,n)}))}function Pe(e){try{if(e===window)return!0}catch(n){if(n&&n.message===E)return!0}try{if({}.toString.call(e)==="[object Window]")return!0}catch(n){if(n&&n.message===E)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.self===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.parent===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.top===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch(n){return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch(n){}return!1}function ut(e){if(re(e))return Ie(e).frameElement;for(var n=0,t=document.querySelectorAll("iframe");n<t.length;n++){var r=t[n];if(r&&r.contentWindow&&r.contentWindow===e)return r}}function xn(e){if(function(t){return t===void 0&&(t=window),!!B(t)}(e)){var n=ut(e);if(n&&n.parentElement){n.parentElement.removeChild(n);return}}try{e.close()}catch(t){}}function oe(e){try{if(!e)return!1;if(typeof Promise!="undefined"&&e instanceof Promise)return!0;if(typeof window!="undefined"&&typeof window.Window=="function"&&e instanceof window.Window||typeof window!="undefined"&&typeof window.constructor=="function"&&e instanceof window.constructor)return!1;var n={}.toString;if(n){var t=n.call(e);if(t==="[object Window]"||t==="[object global]"||t==="[object DOMWindow]")return!1}if(typeof e.then=="function")return!0}catch(r){return!1}return!1}var ct=[],me=[],Ue=0,pe;function dt(){if(!Ue&&pe){var e=pe;pe=null,e.resolve()}}function Fe(){Ue+=1}function ve(){Ue-=1,dt()}var I=function(){function e(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,c=!1,u=!1;Fe();try{t(function(s){u?r.resolve(s):(a=!0,o=s)},function(s){u?r.reject(s):(c=!0,i=s)})}catch(s){ve(),this.reject(s);return}ve(),u=!0,a?this.resolve(o):c&&this.reject(i)}}var n=e.prototype;return n.resolve=function(t){if(this.resolved||this.rejected)return this;if(oe(t))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=t,this.dispatch(),this},n.reject=function(t){var r=this;if(this.resolved||this.rejected)return this;if(oe(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(ct.indexOf(i)===-1){ct.push(i),setTimeout(function(){throw i},1);for(var c=0;c<me.length;c++)me[c](i,a)}}(t,r)},1),this.dispatch(),this},n.asyncReject=function(t){return this.errorHandled=!0,this.reject(t),this},n.dispatch=function(){var t=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(t||r)){this.dispatching=!0,Fe();for(var i=function(p,b){return p.then(function(x){b.resolve(x)},function(x){b.reject(x)})},a=0;a<o.length;a++){var c=o[a],u=c.onSuccess,s=c.onError,h=c.promise,d=void 0;if(t)try{d=u?u(this.value):this.value}catch(p){h.reject(p);continue}else if(r){if(!s){h.reject(this.error);continue}try{d=s(this.error)}catch(p){h.reject(p);continue}}if(d instanceof e&&(d.resolved||d.rejected)){var f=d;f.resolved?h.resolve(f.value):h.reject(f.error),f.errorHandled=!0}else oe(d)?d instanceof e&&(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,ve()}},n.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 e;return this.handlers.push({promise:o,onSuccess:t,onError:r}),this.errorHandled=!0,this.dispatch(),o},n.catch=function(t){return this.then(void 0,t)},n.finally=function(t){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return e.try(t).then(function(){return r})},function(r){return e.try(t).then(function(){throw r})})},n.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})},n.toPromise=function(){if(typeof Promise=="undefined")throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.lazy=function(){return this.errorHandled=!0,this},e.resolve=function(t){return t instanceof e?t:oe(t)?new e(function(r,o){return t.then(r,o)}):new e().resolve(t)},e.reject=function(t){return new e().reject(t)},e.asyncReject=function(t){return new e().asyncReject(t)},e.all=function(t){var r=new e,o=t.length,i=[].slice();if(!o)return r.resolve(i),r;for(var a=function(s,h,d){return h.then(function(f){i[s]=f,(o-=1)==0&&r.resolve(i)},function(f){d.reject(f)})},c=0;c<t.length;c++){var u=t[c];if(u instanceof e){if(u.resolved){i[c]=u.value,o-=1;continue}}else if(!oe(u)){i[c]=u,o-=1;continue}a(c,e.resolve(u),r)}return o===0&&r.resolve(i),r},e.hash=function(t){var r={},o=[],i=function(c){if(t.hasOwnProperty(c)){var u=t[c];oe(u)?o.push(u.then(function(s){r[c]=s})):r[c]=u}};for(var a in t)i(a);return e.all(o).then(function(){return r})},e.map=function(t,r){return e.all(t.map(r))},e.onPossiblyUnhandledException=function(t){return function(r){return me.push(r),{cancel:function(){me.splice(me.indexOf(r),1)}}}(t)},e.try=function(t,r,o){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.try expected a function");var i;Fe();try{i=t.apply(r,o||[])}catch(a){return ve(),e.reject(a)}return ve(),e.resolve(i)},e.delay=function(t){return new e(function(r){setTimeout(r,t)})},e.isPromise=function(t){return!!(t&&t instanceof e)||oe(t)},e.flush=function(){return function(t){var r=pe=pe||new t;return dt(),r}(e)},e}();function Te(e,n){for(var t=0;t<e.length;t++)try{if(e[t]===n)return t}catch(r){}return-1}var He=function(){function e(){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=="undefined"||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(o){return!1}}())try{this.weakmap=new WeakMap}catch(t){}this.keys=[],this.values=[]}var n=e.prototype;return n._cleanupClosedWindows=function(){for(var t=this.weakmap,r=this.keys,o=0;o<r.length;o++){var i=r[o];if(Pe(i)&&$(i)){if(t)try{t.delete(i)}catch(a){}r.splice(o,1),this.values.splice(o,1),o-=1}}},n.isSafeToReadWrite=function(t){return!Pe(t)},n.set=function(t,r){if(!t)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(t,r)}catch(h){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(h){}this._cleanupClosedWindows();var c=this.keys,u=this.values,s=Te(c,t);s===-1?(c.push(t),u.push(r)):u[s]=r},n.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(a){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return o&&o[0]===t?o[1]:void 0}catch(a){}this._cleanupClosedWindows();var i=Te(this.keys,t);if(i!==-1)return this.values[i]},n.delete=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(t)}catch(c){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];o&&o[0]===t&&(o[0]=o[1]=void 0)}catch(c){}this._cleanupClosedWindows();var i=this.keys,a=Te(i,t);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},n.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(i){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return!(!o||o[0]!==t)}catch(i){}return this._cleanupClosedWindows(),Te(this.keys,t)!==-1},n.getOrSet=function(t,r){if(this.has(t))return this.get(t);var o=r();return this.set(t,o),o},e}();function ft(e){return e.name||e.__name__||e.displayName||"anonymous"}function lt(e,n){try{delete e.name,e.name=n}catch(t){}return e.__name__=e.displayName=n,e}function X(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+function(n){if(typeof btoa=="function")return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,function(t,r){return String.fromCharCode(parseInt(r,16))})).replace(/[=]/g,"");if(typeof Buffer!="undefined")return Buffer.from(n,"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 Re;function ht(e){try{return JSON.stringify([].slice.call(e),function(n,t){return typeof t=="function"?"memoize["+function(r){if(Re=Re||new He,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Re.get(r);return o||(o=typeof r+":"+X(),Re.set(r,o)),o}(t)+"]":typeof window!="undefined"&&t instanceof window.Element||t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object"?{}:t})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}function Sn(){return{}}var we=0,mt=0;function ge(e,n){n===void 0&&(n={});var t=n.thisNamespace,r=t!==void 0&&t,o=n.time,i,a,c=we;we+=1;var u=function(){for(var s=arguments.length,h=new Array(s),d=0;d<s;d++)h[d]=arguments[d];c<mt&&(i=null,a=null,c=we,we+=1);var f;f=r?(a=a||new He).getOrSet(this,Sn):i=i||{};var p;try{p=ht(h)}catch(R){return e.apply(this,arguments)}var b=f[p];if(b&&o&&Date.now()-b.time<o&&(delete f[p],b=null),b)return b.value;var x=Date.now(),S=e.apply(this,arguments);return f[p]={time:x,value:S},S};return u.reset=function(){i=null,a=null},lt(u,(n.name||ft(e))+"::memoized")}ge.clear=function(){mt=we};function bn(e){var n={};function t(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),c=0;c<i;c++)a[c]=arguments[c];var u=ht(a);return n.hasOwnProperty(u)||(n[u]=I.try(function(){return e.apply(o,r)}).finally(function(){delete n[u]})),n[u]}return t.reset=function(){n={}},lt(t,ft(e)+"::promiseMemoized")}function ie(){}function ye(e,n){if(n===void 0&&(n=1),n>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+{}.toString.call(e)+">";if(typeof e=="string")return e;if(e instanceof Error){var t=e&&e.stack,r=e&&e.message;if(t&&r)return t.indexOf(r)!==-1?t:r+`
|
|
139
|
-
`+t;if(t)return t;if(r)return r}return e&&e.toString&&typeof e.toString=="function"?e.toString():{}.toString.call(e)}catch(o){return"Error while stringifying error: "+
|
|
136
|
+
top=${G},
|
|
137
|
+
left=${X}`),Me(),fn()}function hn(){Q&&(Q.close(),Q=null),je()}const mn="WIDGET_EVENT";let fe=null;function pn(){fe&&(fe.cancel(),fe=null)}function vn(m){return J(this,null,function*(){const{onEvent:p}=m,w=yield Promise.resolve().then(()=>ke);fe&&pn(),fe=w.on(mn,l=>J(this,null,function*(){p(l.data),ce.includes(l.data.eventName)?hn():l.data.eventName===K&&je()}))})}function wn(m){vn(m)}class tt{constructor(p){Mt(this,Ie);N(this,"onEvent");this.onEvent=p.onEvent,dn&&(ln(p),wn({onEvent:jt(this,Ie,Ut).bind(this)}))}}Ie=new WeakSet,Ut=function(p){this.onEvent(p)};var gn=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function yn(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var nt={exports:{}},rt={exports:{}};(function(m,p){(function(w,l){m.exports=l()})(typeof self!="undefined"?self:gn,function(){return function(w){var l={};function g(y){if(l[y])return l[y].exports;var E=l[y]={i:y,l:!1,exports:{}};return w[y].call(E.exports,E,E.exports,g),E.l=!0,E.exports}return g.m=w,g.c=l,g.d=function(y,E,W){g.o(y,E)||Object.defineProperty(y,E,{enumerable:!0,get:W})},g.r=function(y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(y,"__esModule",{value:!0})},g.t=function(y,E){if(1&E&&(y=g(y)),8&E||4&E&&typeof y=="object"&&y&&y.__esModule)return y;var W=Object.create(null);if(g.r(W),Object.defineProperty(W,"default",{enumerable:!0,value:y}),2&E&&typeof y!="string")for(var V in y)g.d(W,V,function(X){return y[X]}.bind(null,V));return W},g.n=function(y){var E=y&&y.__esModule?function(){return y.default}:function(){return y};return g.d(E,"a",E),E},g.o=function(y,E){return{}.hasOwnProperty.call(y,E)},g.p="",g(g.s=0)}([function(w,l,g){g.r(l),g.d(l,"Promise",function(){return P}),g.d(l,"TYPES",function(){return _n}),g.d(l,"ProxyWindow",function(){return q}),g.d(l,"setup",function(){return zt}),g.d(l,"destroy",function(){return Hn}),g.d(l,"serializeMessage",function(){return jn}),g.d(l,"deserializeMessage",function(){return kn}),g.d(l,"createProxyWindow",function(){return Un}),g.d(l,"toProxyWindow",function(){return Fn}),g.d(l,"on",function(){return te}),g.d(l,"once",function(){return Mn}),g.d(l,"send",function(){return ne}),g.d(l,"markWindowKnown",function(){return bt}),g.d(l,"cleanUpWindow",function(){return qn}),g.d(l,"bridge",function(){});function y(e){return{}.toString.call(e)==="[object RegExp]"}var E=`Call was rejected by callee.\r
|
|
138
|
+
`;function W(e){return e===void 0&&(e=window),e.location.protocol}function V(e){if(e===void 0&&(e=window),e.mockDomain){var n=e.mockDomain.split("//")[0];if(n)return n}return W(e)}function X(e){return e===void 0&&(e=window),V(e)==="about:"}function G(e){if(e===void 0&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch(n){}}function le(e){if(e===void 0&&(e=window),e&&!G(e))try{return e.opener}catch(n){}}function ee(e){try{return!0}catch(n){}return!1}function We(e){e===void 0&&(e=window);var n=e.location;if(!n)throw new Error("Can not read window location");var t=W(e);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var r=G(e);return r&&ee()?We(r):"about://"}var o=n.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function U(e){e===void 0&&(e=window);var n=We(e);return n&&e.mockDomain&&e.mockDomain.indexOf("mock:")===0?e.mockDomain:n}function re(e){if(!function(n){try{if(n===window)return!0}catch(r){}try{var t=Object.getOwnPropertyDescriptor(n,"location");if(t&&t.enumerable===!1)return!1}catch(r){}try{if(X(n)&&ee())return!0}catch(r){}try{if(function(r){return r===void 0&&(r=window),V(r)==="mock:"}(n)&&ee())return!0}catch(r){}try{if(We(n)===We(window))return!0}catch(r){}return!1}(e))return!1;try{if(e===window||X(e)&&ee()||U(window)===U(e))return!0}catch(n){}return!1}function Ce(e){if(!re(e))throw new Error("Expected window to be same domain");return e}function it(e,n){if(!e||!n)return!1;var t=G(n);return t?t===e:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch(i){}return o}(n).indexOf(e)!==-1}function at(e){var n=[],t;try{t=e.frames}catch(u){t=e}var r;try{r=t.length}catch(u){}if(r===0)return n;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch(u){continue}n.push(i)}return n}for(var a=0;a<100;a++){var c=void 0;try{c=t[a]}catch(u){return n}if(!c)return n;n.push(c)}return n}var xn=[],Sn=[];function $(e,n){n===void 0&&(n=!0);try{if(e===window)return!1}catch(o){return!0}try{if(!e)return!0}catch(o){return!0}try{if(e.closed)return!0}catch(o){return!o||o.message!==E}if(n&&re(e))try{if(e.mockclosed)return!0}catch(o){}try{if(!e.parent||!e.top)return!0}catch(o){}var t=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch(c){}return-1}(xn,e);if(t!==-1){var r=Sn[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 st(e){return e===void 0&&(e=window),le(e=e||window)||G(e)||void 0}function se(e,n){if(typeof e=="string"){if(typeof n=="string")return e==="*"||n===e;if(y(n)||Array.isArray(n))return!1}return y(e)?y(n)?e.toString()===n.toString():!Array.isArray(n)&&!!n.match(e):!!Array.isArray(e)&&(Array.isArray(n)?JSON.stringify(e)===JSON.stringify(n):!y(n)&&e.some(function(t){return se(t,n)}))}function Pe(e){try{if(e===window)return!0}catch(n){if(n&&n.message===E)return!0}try{if({}.toString.call(e)==="[object Window]")return!0}catch(n){if(n&&n.message===E)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.self===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.parent===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.top===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch(n){return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch(n){}return!1}function ut(e){if(re(e))return Ce(e).frameElement;for(var n=0,t=document.querySelectorAll("iframe");n<t.length;n++){var r=t[n];if(r&&r.contentWindow&&r.contentWindow===e)return r}}function bn(e){if(function(t){return t===void 0&&(t=window),!!G(t)}(e)){var n=ut(e);if(n&&n.parentElement){n.parentElement.removeChild(n);return}}try{e.close()}catch(t){}}function oe(e){try{if(!e)return!1;if(typeof Promise!="undefined"&&e instanceof Promise)return!0;if(typeof window!="undefined"&&typeof window.Window=="function"&&e instanceof window.Window||typeof window!="undefined"&&typeof window.constructor=="function"&&e instanceof window.constructor)return!1;var n={}.toString;if(n){var t=n.call(e);if(t==="[object Window]"||t==="[object global]"||t==="[object DOMWindow]")return!1}if(typeof e.then=="function")return!0}catch(r){return!1}return!1}var ct=[],he=[],Ue=0,me;function dt(){if(!Ue&&me){var e=me;me=null,e.resolve()}}function Fe(){Ue+=1}function pe(){Ue-=1,dt()}var P=function(){function e(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,c=!1,u=!1;Fe();try{t(function(s){u?r.resolve(s):(a=!0,o=s)},function(s){u?r.reject(s):(c=!0,i=s)})}catch(s){pe(),this.reject(s);return}pe(),u=!0,a?this.resolve(o):c&&this.reject(i)}}var n=e.prototype;return n.resolve=function(t){if(this.resolved||this.rejected)return this;if(oe(t))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=t,this.dispatch(),this},n.reject=function(t){var r=this;if(this.resolved||this.rejected)return this;if(oe(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(ct.indexOf(i)===-1){ct.push(i),setTimeout(function(){throw i},1);for(var c=0;c<he.length;c++)he[c](i,a)}}(t,r)},1),this.dispatch(),this},n.asyncReject=function(t){return this.errorHandled=!0,this.reject(t),this},n.dispatch=function(){var t=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(t||r)){this.dispatching=!0,Fe();for(var i=function(v,b){return v.then(function(x){b.resolve(x)},function(x){b.reject(x)})},a=0;a<o.length;a++){var c=o[a],u=c.onSuccess,s=c.onError,h=c.promise,d=void 0;if(t)try{d=u?u(this.value):this.value}catch(v){h.reject(v);continue}else if(r){if(!s){h.reject(this.error);continue}try{d=s(this.error)}catch(v){h.reject(v);continue}}if(d instanceof e&&(d.resolved||d.rejected)){var f=d;f.resolved?h.resolve(f.value):h.reject(f.error),f.errorHandled=!0}else oe(d)?d instanceof e&&(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,pe()}},n.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 e;return this.handlers.push({promise:o,onSuccess:t,onError:r}),this.errorHandled=!0,this.dispatch(),o},n.catch=function(t){return this.then(void 0,t)},n.finally=function(t){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return e.try(t).then(function(){return r})},function(r){return e.try(t).then(function(){throw r})})},n.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})},n.toPromise=function(){if(typeof Promise=="undefined")throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.lazy=function(){return this.errorHandled=!0,this},e.resolve=function(t){return t instanceof e?t:oe(t)?new e(function(r,o){return t.then(r,o)}):new e().resolve(t)},e.reject=function(t){return new e().reject(t)},e.asyncReject=function(t){return new e().asyncReject(t)},e.all=function(t){var r=new e,o=t.length,i=[].slice();if(!o)return r.resolve(i),r;for(var a=function(s,h,d){return h.then(function(f){i[s]=f,(o-=1)==0&&r.resolve(i)},function(f){d.reject(f)})},c=0;c<t.length;c++){var u=t[c];if(u instanceof e){if(u.resolved){i[c]=u.value,o-=1;continue}}else if(!oe(u)){i[c]=u,o-=1;continue}a(c,e.resolve(u),r)}return o===0&&r.resolve(i),r},e.hash=function(t){var r={},o=[],i=function(c){if(t.hasOwnProperty(c)){var u=t[c];oe(u)?o.push(u.then(function(s){r[c]=s})):r[c]=u}};for(var a in t)i(a);return e.all(o).then(function(){return r})},e.map=function(t,r){return e.all(t.map(r))},e.onPossiblyUnhandledException=function(t){return function(r){return he.push(r),{cancel:function(){he.splice(he.indexOf(r),1)}}}(t)},e.try=function(t,r,o){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.try expected a function");var i;Fe();try{i=t.apply(r,o||[])}catch(a){return pe(),e.reject(a)}return pe(),e.resolve(i)},e.delay=function(t){return new e(function(r){setTimeout(r,t)})},e.isPromise=function(t){return!!(t&&t instanceof e)||oe(t)},e.flush=function(){return function(t){var r=me=me||new t;return dt(),r}(e)},e}();function Te(e,n){for(var t=0;t<e.length;t++)try{if(e[t]===n)return t}catch(r){}return-1}var He=function(){function e(){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=="undefined"||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(o){return!1}}())try{this.weakmap=new WeakMap}catch(t){}this.keys=[],this.values=[]}var n=e.prototype;return n._cleanupClosedWindows=function(){for(var t=this.weakmap,r=this.keys,o=0;o<r.length;o++){var i=r[o];if(Pe(i)&&$(i)){if(t)try{t.delete(i)}catch(a){}r.splice(o,1),this.values.splice(o,1),o-=1}}},n.isSafeToReadWrite=function(t){return!Pe(t)},n.set=function(t,r){if(!t)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(t,r)}catch(h){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(h){}this._cleanupClosedWindows();var c=this.keys,u=this.values,s=Te(c,t);s===-1?(c.push(t),u.push(r)):u[s]=r},n.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(a){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return o&&o[0]===t?o[1]:void 0}catch(a){}this._cleanupClosedWindows();var i=Te(this.keys,t);if(i!==-1)return this.values[i]},n.delete=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(t)}catch(c){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];o&&o[0]===t&&(o[0]=o[1]=void 0)}catch(c){}this._cleanupClosedWindows();var i=this.keys,a=Te(i,t);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},n.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(i){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return!(!o||o[0]!==t)}catch(i){}return this._cleanupClosedWindows(),Te(this.keys,t)!==-1},n.getOrSet=function(t,r){if(this.has(t))return this.get(t);var o=r();return this.set(t,o),o},e}();function ft(e){return e.name||e.__name__||e.displayName||"anonymous"}function lt(e,n){try{delete e.name,e.name=n}catch(t){}return e.__name__=e.displayName=n,e}function Z(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+function(n){if(typeof btoa=="function")return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,function(t,r){return String.fromCharCode(parseInt(r,16))})).replace(/[=]/g,"");if(typeof Buffer!="undefined")return Buffer.from(n,"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 Re;function ht(e){try{return JSON.stringify([].slice.call(e),function(n,t){return typeof t=="function"?"memoize["+function(r){if(Re=Re||new He,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Re.get(r);return o||(o=typeof r+":"+Z(),Re.set(r,o)),o}(t)+"]":typeof window!="undefined"&&t instanceof window.Element||t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object"?{}:t})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}function In(){return{}}var ve=0,mt=0;function we(e,n){n===void 0&&(n={});var t=n.thisNamespace,r=t!==void 0&&t,o=n.time,i,a,c=ve;ve+=1;var u=function(){for(var s=arguments.length,h=new Array(s),d=0;d<s;d++)h[d]=arguments[d];c<mt&&(i=null,a=null,c=ve,ve+=1);var f;f=r?(a=a||new He).getOrSet(this,In):i=i||{};var v;try{v=ht(h)}catch(R){return e.apply(this,arguments)}var b=f[v];if(b&&o&&Date.now()-b.time<o&&(delete f[v],b=null),b)return b.value;var x=Date.now(),S=e.apply(this,arguments);return f[v]={time:x,value:S},S};return u.reset=function(){i=null,a=null},lt(u,(n.name||ft(e))+"::memoized")}we.clear=function(){mt=ve};function Wn(e){var n={};function t(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),c=0;c<i;c++)a[c]=arguments[c];var u=ht(a);return n.hasOwnProperty(u)||(n[u]=P.try(function(){return e.apply(o,r)}).finally(function(){delete n[u]})),n[u]}return t.reset=function(){n={}},lt(t,ft(e)+"::promiseMemoized")}function ie(){}function ge(e,n){if(n===void 0&&(n=1),n>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+{}.toString.call(e)+">";if(typeof e=="string")return e;if(e instanceof Error){var t=e&&e.stack,r=e&&e.message;if(t&&r)return t.indexOf(r)!==-1?t:r+`
|
|
139
|
+
`+t;if(t)return t;if(r)return r}return e&&e.toString&&typeof e.toString=="function"?e.toString():{}.toString.call(e)}catch(o){return"Error while stringifying error: "+ge(o,n+1)}}function pt(e){return typeof e=="string"?e:e&&e.toString&&typeof e.toString=="function"?e.toString():{}.toString.call(e)}we(function(e){if(Object.values)return Object.values(e);var n=[];for(var t in e)e.hasOwnProperty(t)&&n.push(e[t]);return n});function _e(e){return{}.toString.call(e)==="[object RegExp]"}function ye(e,n,t){if(e.hasOwnProperty(n))return e[n];var r=t();return e[n]=r,r}function vt(){var e=document.body;if(!e)throw new Error("Body element not found");return e}function wt(){return!!document.body&&document.readyState==="complete"}function gt(){return!!document.body&&document.readyState==="interactive"}we(function(){return new P(function(e){if(wt()||gt())return e();var n=setInterval(function(){if(wt()||gt())return clearInterval(n),e()},10)})});var Ae=typeof document!="undefined"?document.currentScript:null,Cn=we(function(){if(Ae||(Ae=function(){try{var e=function(){try{throw new Error("_")}catch(a){return a.stack||""}}(),n=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(e),t=n&&n[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(a){}}()))return Ae;throw new Error("Can not determine current script")}),Pn=Z();we(function(){var e;try{e=Cn()}catch(r){return Pn}var n=e.getAttribute("data-uid");if(n&&typeof n=="string"||(n=e.getAttribute("data-uid-auto"))&&typeof n=="string")return n;if(e.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:e.src,dataset:e.dataset}));n="uid_"+t.slice(t.length-30)}else n=Z();return e.setAttribute("data-uid-auto",n),n});function Ee(e){e===void 0&&(e=window);var n="__post_robot_10_0_46__";return e!==window?e[n]:e[n]=e[n]||{}}var yt=function(){return{}};function j(e,n){return e===void 0&&(e="store"),n===void 0&&(n=yt),ye(Ee(),e,function(){var t=n();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 ye(t,r,o)},reset:function(){t=n()},keys:function(){return Object.keys(t)}}})}var Tn=function(){};function Oe(){var e=Ee();return e.WINDOW_WILDCARD=e.WINDOW_WILDCARD||new Tn,e.WINDOW_WILDCARD}function F(e,n){return e===void 0&&(e="store"),n===void 0&&(n=yt),j("windowStore").getOrSet(e,function(){var t=new He,r=function(o){return t.getOrSet(o,n)};return{has:function(o){return r(o).hasOwnProperty(e)},get:function(o,i){var a=r(o);return a.hasOwnProperty(e)?a[e]:i},set:function(o,i){return r(o)[e]=i,i},del:function(o){delete r(o)[e]},getOrSet:function(o,i){return ye(r(o),e,i)}}})}function Et(){return j("instance").getOrSet("instanceID",Z)}function xt(e,n){var t=n.domain,r=F("helloPromises"),o=r.get(e);o&&o.resolve({domain:t});var i=P.resolve({domain:t});return r.set(e,i),i}function qe(e,n){return(0,n.send)(e,"postrobot_hello",{instanceID:Et()},{domain:"*",timeout:-1}).then(function(t){var r=t.origin,o=t.data.instanceID;return xt(e,{domain:r}),{win:e,domain:r,instanceID:o}})}function St(e,n){var t=n.send;return F("windowInstanceIDPromises").getOrSet(e,function(){return qe(e,{send:t}).then(function(r){return r.instanceID})})}function bt(e){F("knownWindows").set(e,!0)}function Be(e){return typeof e=="object"&&e!==null&&typeof e.__type__=="string"}function It(e){return e===void 0?"undefined":e===null?"null":Array.isArray(e)?"array":typeof e=="function"?"function":typeof e=="object"?e instanceof Error?"error":typeof e.then=="function"?"promise":{}.toString.call(e)==="[object RegExp]"?"regex":{}.toString.call(e)==="[object Date]"?"date":"object":typeof e=="string"?"string":typeof e=="number"?"number":typeof e=="boolean"?"boolean":void 0}function ae(e,n){return{__type__:e,__val__:n}}var H,Rn=((H={}).function=function(){},H.error=function(e){return ae("error",{message:e.message,stack:e.stack,code:e.code,data:e.data})},H.promise=function(){},H.regex=function(e){return ae("regex",e.source)},H.date=function(e){return ae("date",e.toJSON())},H.array=function(e){return e},H.object=function(e){return e},H.string=function(e){return e},H.number=function(e){return e},H.boolean=function(e){return e},H.null=function(e){return e},H[void 0]=function(e){return ae("undefined",e)},H),An={},_,On=((_={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},_.error=function(e){var n=e.stack,t=e.code,r=e.data,o=new Error(e.message);return o.code=t,r&&(o.data=r),o.stack=n+`
|
|
140
140
|
|
|
141
|
-
`+o.stack,o},_.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},_.regex=function(e){return new RegExp(e)},_.date=function(e){return new Date(e)},_.array=function(e){return e},_.object=function(e){return e},_.string=function(e){return e},_.number=function(e){return e},_.boolean=function(e){return e},_.null=function(e){return e},_[void 0]=function(){},_),
|
|
141
|
+
`+o.stack,o},_.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},_.regex=function(e){return new RegExp(e)},_.date=function(e){return new Date(e)},_.array=function(e){return e},_.object=function(e){return e},_.string=function(e){return e},_.number=function(e){return e},_.boolean=function(e){return e},_.null=function(e){return e},_[void 0]=function(){},_),Dn={};new P(function(e){if(window.document&&window.document.body)return e(window.document.body);var n=setInterval(function(){if(window.document&&window.document.body)return clearInterval(n),e(window.document.body)},10)});function Ge(){for(var e=j("idToProxyWindow"),n=0,t=e.keys();n<t.length;n++){var r=t[n];e.get(r).shouldClean()&&e.del(r)}}function Wt(e,n){var t=n.send,r=n.id,o=r===void 0?Z():r,i=e.then(function(u){if(re(u))return Ce(u).name}),a=e.then(function(u){if($(u))throw new Error("Window is closed, can not determine type");return le(u)?"popup":"iframe"});i.catch(ie),a.catch(ie);var c=function(){return e.then(function(u){if(!$(u))return re(u)?Ce(u).name:i})};return{id:o,getType:function(){return a},getInstanceID:Wn(function(){return e.then(function(u){return St(u,{send:t})})}),close:function(){return e.then(bn)},getName:c,focus:function(){return e.then(function(u){u.focus()})},isClosed:function(){return e.then(function(u){return $(u)})},setLocation:function(u,s){return s===void 0&&(s={}),e.then(function(h){var d=window.location.protocol+"//"+window.location.host,f=s.method,v=f===void 0?"get":f,b=s.body;if(u.indexOf("/")===0)u=""+d+u;else if(!u.match(/^https?:\/\//)&&u.indexOf(d)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(u));if(v==="post")return c().then(function(x){if(!x)throw new Error("Can not post to window without target name");(function(S){var R=S.url,M=S.target,O=S.body,A=S.method,k=A===void 0?"post":A,I=document.createElement("form");if(I.setAttribute("target",M),I.setAttribute("method",k),I.setAttribute("action",R),I.style.display="none",O)for(var D=0,Y=Object.keys(O);D<Y.length;D++){var z,xe=Y[D],Ve=document.createElement("input");Ve.setAttribute("name",xe),Ve.setAttribute("value",(z=O[xe])==null?void 0:z.toString()),I.appendChild(Ve)}vt().appendChild(I),I.submit(),vt().removeChild(I)})({url:u,target:x,method:v,body:b})});if(v!=="get")throw new Error("Unsupported method: "+v);if(re(h))try{if(h.location&&typeof h.location.replace=="function"){h.location.replace(u);return}}catch(x){}h.location=u})},setName:function(u){return e.then(function(s){var h=re(s),d=ut(s);if(!h)throw new Error("Can not set name for cross-domain window: "+u);Ce(s).name=u,d&&d.setAttribute("name",u),i=P.resolve(u)})}}}var q=function(){function e(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 P,this.serializedWindow=i||Wt(this.actualWindowPromise,{send:r}),j("idToProxyWindow").set(this.getID(),this),o&&this.setWindow(o,{send:r})}var n=e.prototype;return n.getID=function(){return this.serializedWindow.id},n.getType=function(){return this.serializedWindow.getType()},n.isPopup=function(){return this.getType().then(function(t){return t==="popup"})},n.setLocation=function(t,r){var o=this;return this.serializedWindow.setLocation(t,r).then(function(){return o})},n.getName=function(){return this.serializedWindow.getName()},n.setName=function(t){var r=this;return this.serializedWindow.setName(t).then(function(){return r})},n.close=function(){var t=this;return this.serializedWindow.close().then(function(){return t})},n.focus=function(){var t=this,r=this.isPopup(),o=this.getName(),i=P.hash({isPopup:r,name:o}).then(function(c){var u=c.name;c.isPopup&&u&&window.open("",u,"noopener")}),a=this.serializedWindow.focus();return P.all([i,a]).then(function(){return t})},n.isClosed=function(){return this.serializedWindow.isClosed()},n.getWindow=function(){return this.actualWindow},n.setWindow=function(t,r){var o=r.send;this.actualWindow=t,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=Wt(this.actualWindowPromise,{send:o,id:this.getID()}),F("winToProxyWindow").set(t,this)},n.awaitWindow=function(){return this.actualWindowPromise},n.matchWindow=function(t,r){var o=this,i=r.send;return P.try(function(){return o.actualWindow?t===o.actualWindow:P.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:St(t,{send:i})}).then(function(a){var c=a.proxyInstanceID===a.knownWindowInstanceID;return c&&o.setWindow(t,{send:i}),c})})},n.unwrap=function(){return this.actualWindow||this},n.getInstanceID=function(){return this.serializedWindow.getInstanceID()},n.shouldClean=function(){return!!(this.actualWindow&&$(this.actualWindow))},n.serialize=function(){return this.serializedWindow},e.unwrap=function(t){return e.isProxyWindow(t)?t.unwrap():t},e.serialize=function(t,r){var o=r.send;return Ge(),e.toProxyWindow(t,{send:o}).serialize()},e.deserialize=function(t,r){var o=r.send;return Ge(),j("idToProxyWindow").get(t.id)||new e({serializedWindow:t,send:o})},e.isProxyWindow=function(t){return!!(t&&!Pe(t)&&t.isProxyWindow)},e.toProxyWindow=function(t,r){var o=r.send;if(Ge(),e.isProxyWindow(t))return t;var i=t;return F("winToProxyWindow").get(i)||new e({win:i,send:o})},e}();function $e(e,n,t,r,o){var i=F("methodStore"),a=j("proxyWindowMethods");q.isProxyWindow(r)?a.set(e,{val:n,name:t,domain:o,source:r}):(a.del(e),i.getOrSet(r,function(){return{}})[e]={domain:o,name:t,val:n,source:r})}function Ct(e,n){var t=F("methodStore"),r=j("proxyWindowMethods");return t.getOrSet(e,function(){return{}})[n]||r.get(n)}function Pt(e,n,t,r,o){a=(i={on:o.on,send:o.send}).on,c=i.send,j("builtinListeners").getOrSet("functionCalls",function(){return a("postrobot_method",{domain:"*"},function(h){var d=h.source,f=h.origin,v=h.data,b=v.id,x=v.name,S=Ct(d,b);if(!S)throw new Error("Could not find method '"+x+"' with id: "+v.id+" in "+U(window));var R=S.source,M=S.domain,O=S.val;return P.try(function(){if(!se(M,f))throw new Error("Method '"+v.name+"' domain "+JSON.stringify(_e(S.domain)?S.domain.source:S.domain)+" does not match origin "+f+" in "+U(window));if(q.isProxyWindow(R))return R.matchWindow(d,{send:c}).then(function(A){if(!A)throw new Error("Method call '"+v.name+"' failed - proxy window does not match source in "+U(window))})}).then(function(){return O.apply({source:d,origin:f},v.args)},function(A){return P.try(function(){if(O.onError)return O.onError(A)}).then(function(){throw A.stack&&(A.stack="Remote call to "+x+"("+function(k){return k===void 0&&(k=[]),(I=k,[].slice.call(I)).map(function(D){return typeof D=="string"?"'"+D+"'":D===void 0?"undefined":D===null?"null":typeof D=="boolean"?D.toString():Array.isArray(D)?"[ ... ]":typeof D=="object"?"{ ... }":typeof D=="function"?"() => { ... }":"<"+typeof D+">"}).join(", ");var I}(v.args)+`) failed
|
|
142
142
|
|
|
143
|
-
`+
|
|
143
|
+
`+A.stack),A})}).then(function(A){return{result:A,id:b,name:x}})})});var i,a,c,u=t.__id__||Z();e=q.unwrap(e);var s=t.__name__||t.name||r;return typeof s=="string"&&typeof s.indexOf=="function"&&s.indexOf("anonymous::")===0&&(s=s.replace("anonymous::",r+"::")),q.isProxyWindow(e)?($e(u,t,s,e,n),e.awaitWindow().then(function(h){$e(u,t,s,h,n)})):$e(u,t,s,e,n),ae("cross_domain_function",{id:u,name:s})}function Tt(e,n,t,r){var o,i=r.on,a=r.send;return function(c,u){u===void 0&&(u=An);var s=JSON.stringify(c,function(h){var d=this[h];if(Be(this))return d;var f=It(d);if(!f)return d;var v=u[f]||Rn[f];return v?v(d,h):d});return s===void 0?"undefined":s}(t,((o={}).promise=function(c,u){return function(s,h,d,f,v){return ae("cross_domain_zalgo_promise",{then:Pt(s,h,function(b,x){return d.then(b,x)},f,{on:v.on,send:v.send})})}(e,n,c,u,{on:i,send:a})},o.function=function(c,u){return Pt(e,n,c,u,{on:i,send:a})},o.object=function(c){return Pe(c)||q.isProxyWindow(c)?ae("cross_domain_window",q.serialize(c,{send:a})):c},o))}function Rt(e,n,t,r){var o,i=r.send;return function(a,c){if(c===void 0&&(c=Dn),a!=="undefined")return JSON.parse(a,function(u,s){if(Be(this))return s;var h,d;if(Be(s)?(h=s.__type__,d=s.__val__):(h=It(s),d=s),!h)return d;var f=c[h]||On[h];return f?f(d,u):d})}(t,((o={}).cross_domain_zalgo_promise=function(a){return function(c,u,s){return new P(s.then)}(0,0,a)},o.cross_domain_function=function(a){return function(c,u,s,h){var d=s.id,f=s.name,v=h.send,b=function(S){S===void 0&&(S={});function R(){var M=arguments;return q.toProxyWindow(c,{send:v}).awaitWindow().then(function(O){var A=Ct(O,d);if(A&&A.val!==R)return A.val.apply({source:window,origin:U()},M);var k=[].slice.call(M);return S.fireAndForget?v(O,"postrobot_method",{id:d,name:f,args:k},{domain:u,fireAndForget:!0}):v(O,"postrobot_method",{id:d,name:f,args:k},{domain:u,fireAndForget:!1}).then(function(I){return I.data.result})}).catch(function(O){throw O})}return R.__name__=f,R.__origin__=u,R.__source__=c,R.__id__=d,R.origin=u,R},x=b();return x.fireAndForget=b({fireAndForget:!0}),x}(e,n,a,{send:i})},o.cross_domain_window=function(a){return q.deserialize(a,{send:i})},o))}var Ye={};Ye.postrobot_post_message=function(e,n,t){t.indexOf("file:")===0&&(t="*"),e.postMessage(n,t)};function Je(e,n,t,r){var o=r.on,i=r.send;return P.try(function(){var a=F().getOrSet(e,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(t),a.flush=a.flush||P.flush().then(function(){if($(e))throw new Error("Window is closed");var c=Tt(e,n,((u={}).__post_robot_10_0_46__=a.buffer||[],u),{on:o,send:i}),u;delete a.buffer;for(var s=Object.keys(Ye),h=[],d=0;d<s.length;d++){var f=s[d];try{Ye[f](e,c,n)}catch(v){h.push(v)}}if(h.length===s.length)throw new Error(`All post-robot messaging strategies failed:
|
|
144
144
|
|
|
145
|
-
`+h.map(function(
|
|
145
|
+
`+h.map(function(v,b){return b+". "+ge(v)}).join(`
|
|
146
146
|
|
|
147
|
-
`))}),a.flush.then(function(){delete a.flush})}).then(ie)}function
|
|
147
|
+
`))}),a.flush.then(function(){delete a.flush})}).then(ie)}function At(e){return j("responseListeners").get(e)}function Ot(e){j("responseListeners").del(e)}function Dt(e){return j("erroredResponseListeners").has(e)}function Nt(e){var n=e.name,t=e.win,r=e.domain,o=F("requestListeners");if(t==="*"&&(t=null),r==="*"&&(r=null),!n)throw new Error("Name required to get request listener");for(var i=0,a=[t,Oe()];i<a.length;i++){var c=a[i];if(c){var u=o.get(c);if(u){var s=u[n];if(s){if(r&&typeof r=="string"){if(s[r])return s[r];if(s.__domain_regex__)for(var h=0,d=s.__domain_regex__;h<d.length;h++){var f=d[h],v=f.listener;if(se(f.regex,r))return v}}if(s["*"])return s["*"]}}}}}function Nn(e,n,t,r){var o=r.on,i=r.send,a=Nt({name:t.name,win:e,domain:n}),c=t.name==="postrobot_method"&&t.data&&typeof t.data.name=="string"?t.data.name+"()":t.name;function u(s,h,d){return P.flush().then(function(){if(!t.fireAndForget&&!$(e))try{return Je(e,n,{id:Z(),origin:U(window),type:"postrobot_message_response",hash:t.hash,name:t.name,ack:s,data:h,error:d},{on:o,send:i})}catch(f){throw new Error("Send response message failed for "+c+" in "+U()+`
|
|
148
148
|
|
|
149
|
-
`+
|
|
149
|
+
`+ge(f))}})}return P.all([P.flush().then(function(){if(!t.fireAndForget&&!$(e))try{return Je(e,n,{id:Z(),origin:U(window),type:"postrobot_message_ack",hash:t.hash,name:t.name},{on:o,send:i})}catch(s){throw new Error("Send ack message failed for "+c+" in "+U()+`
|
|
150
150
|
|
|
151
|
-
`+
|
|
151
|
+
`+ge(s))}}),P.try(function(){if(!a)throw new Error("No handler found for post message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:e,origin:n,data:t.data})}).then(function(s){return u("success",s)},function(s){return u("error",null,s)})]).then(ie).catch(function(s){if(a&&a.handleError)return a.handleError(s);throw s})}function Ln(e,n,t){if(!Dt(t.hash)){var r=At(t.hash);if(!r)throw new Error("No handler found for post message ack for message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!se(r.domain,n))throw new Error("Ack origin "+n+" does not match domain "+r.domain.toString());if(e!==r.win)throw new Error("Ack source does not match registered window")}catch(o){r.promise.reject(o)}r.ack=!0}}function zn(e,n,t){if(!Dt(t.hash)){var r=At(t.hash);if(!r)throw new Error("No handler found for post message response for message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!se(r.domain,n))throw new Error("Response origin "+n+" does not match domain "+(o=r.domain,Array.isArray(o)?"("+o.join(" | ")+")":y(o)?"RegExp("+o.toString()+")":o.toString()));var o;if(e!==r.win)throw new Error("Response source does not match registered window");Ot(t.hash),t.ack==="error"?r.promise.reject(t.error):t.ack==="success"&&r.promise.resolve({source:e,origin:n,data:t.data})}}function Lt(e,n){var t=n.on,r=n.send,o=j("receivedMessages");try{if(!window||window.closed||!e.source)return}catch(h){return}var i=e.source,a=e.origin,c=function(h,d,f,v){var b=v.on,x=v.send,S;try{S=Rt(d,f,h,{on:b,send:x})}catch(M){return}if(S&&typeof S=="object"&&S!==null){var R=S.__post_robot_10_0_46__;if(Array.isArray(R))return R}}(e.data,i,a,{on:t,send:r});if(c){bt(i);for(var u=0;u<c.length;u++){var s=c[u];if(o.has(s.id)||(o.set(s.id,!0),$(i)&&!s.fireAndForget))return;s.origin.indexOf("file:")===0&&(a="file://");try{s.type==="postrobot_message_request"?Nn(i,a,s,{on:t,send:r}):s.type==="postrobot_message_response"?zn(i,a,s):s.type==="postrobot_message_ack"&&Ln(i,a,s)}catch(h){setTimeout(function(){throw h},0)}}}}function te(e,n,t){if(!e)throw new Error("Expected name");if(typeof(n=n||{})=="function"&&(t=n,n={}),!t)throw new Error("Expected handler");var r=function o(i,a){var c=i.name,u=i.win,s=i.domain,h=F("requestListeners");if(!c||typeof c!="string")throw new Error("Name required to add request listener");if(u&&u!=="*"&&q.isProxyWindow(u)){var d=u.awaitWindow().then(function(z){return o({name:c,win:z,domain:s},a)});return{cancel:function(){d.then(function(z){return z.cancel()},ie)}}}var f=u;if(Array.isArray(f)){for(var v=[],b=0,x=f;b<x.length;b++)v.push(o({name:c,domain:s,win:x[b]},a));return{cancel:function(){for(var z=0;z<v.length;z++)v[z].cancel()}}}if(Array.isArray(s)){for(var S=[],R=0,M=s;R<M.length;R++)S.push(o({name:c,win:f,domain:M[R]},a));return{cancel:function(){for(var z=0;z<S.length;z++)S[z].cancel()}}}var O=Nt({name:c,win:f,domain:s});f&&f!=="*"||(f=Oe());var A=(s=s||"*").toString();if(O)throw f&&s?new Error("Request listener already exists for "+c+" on domain "+s.toString()+" for "+(f===Oe()?"wildcard":"specified")+" window"):f?new Error("Request listener already exists for "+c+" for "+(f===Oe()?"wildcard":"specified")+" window"):s?new Error("Request listener already exists for "+c+" on domain "+s.toString()):new Error("Request listener already exists for "+c);var k=h.getOrSet(f,function(){return{}}),I=ye(k,c,function(){return{}}),D,Y;return _e(s)?(D=ye(I,"__domain_regex__",function(){return[]})).push(Y={regex:s,listener:a}):I[A]=a,{cancel:function(){delete I[A],Y&&(D.splice(D.indexOf(Y,1)),D.length||delete I.__domain_regex__),Object.keys(I).length||delete k[c],f&&!Object.keys(k).length&&h.del(f)}}}({name:e,win:n.window,domain:n.domain||"*"},{handler:t||n.handler,handleError:n.errorHandler||function(o){throw o}});return{cancel:function(){r.cancel()}}}function Mn(e,n,t){typeof(n=n||{})=="function"&&(t=n,n={});var r=new P,o;return n.errorHandler=function(i){o.cancel(),r.reject(i)},o=te(e,n,function(i){if(o.cancel(),r.resolve(i),t)return t(i)}),r.cancel=o.cancel,r}var ne=function e(n,t,r,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,c=o.timeout||5e3,u=o.fireAndForget||!1;return q.toProxyWindow(n,{send:e}).awaitWindow().then(function(s){return P.try(function(){if(function(h,d,f){if(!h)throw new Error("Expected name");if(f&&typeof f!="string"&&!Array.isArray(f)&&!_e(f))throw new TypeError("Can not send "+h+". Expected domain "+JSON.stringify(f)+" to be a string, array, or regex");if($(d))throw new Error("Can not send "+h+". Target window is closed")}(t,s,i),function(h,d){var f=st(d);if(f)return f===h;if(d===h||function(x){x===void 0&&(x=window);try{if(x.top)return x.top}catch(O){}if(G(x)===x)return x;try{if(it(window,x)&&window.top)return window.top}catch(O){}try{if(it(x,window)&&window.top)return window.top}catch(O){}for(var S=0,R=function O(A){for(var k=[],I=0,D=at(A);I<D.length;I++){var Y=D[I];k.push(Y);for(var z=0,xe=O(Y);z<xe.length;z++)k.push(xe[z])}return k}(x);S<R.length;S++){var M=R[S];try{if(M.top)return M.top}catch(O){}if(G(M)===M)return M}}(d)===d)return!1;for(var v=0,b=at(h);v<b.length;v++)if(b[v]===d)return!0;return!1}(window,s))return function(h,d,f){d===void 0&&(d=5e3),f===void 0&&(f="Window");var v=function(b){return F("helloPromises").getOrSet(b,function(){return new P})}(h);return d!==-1&&(v=v.timeout(d,new Error(f+" did not load after "+d+"ms"))),v}(s,c)}).then(function(h){return function(d,f,v,b){var x=b.send;return P.try(function(){return typeof f=="string"?f:P.try(function(){return v||qe(d,{send:x}).then(function(S){return S.domain})}).then(function(S){if(!se(f,f))throw new Error("Domain "+pt(f)+" does not match "+pt(f));return S})})}(s,i,(h===void 0?{}:h).domain,{send:e})}).then(function(h){var d=h,f=t==="postrobot_method"&&r&&typeof r.name=="string"?r.name+"()":t,v=new P,b=t+"_"+Z();if(!u){var x={name:t,win:s,domain:d,promise:v};(function(I,D){j("responseListeners").set(I,D)})(b,x);var S=F("requestPromises").getOrSet(s,function(){return[]});S.push(v),v.catch(function(){(function(I){j("erroredResponseListeners").set(I,!0)})(b),Ot(b)});var R=function(I){return F("knownWindows").get(I,!1)}(s)?1e4:2e3,M=a,O=R,A=M,k=function(I,D){var Y;return function z(){Y=setTimeout(function(){(function(){if($(s))return v.reject(new Error("Window closed for "+t+" before "+(x.ack?"response":"ack")));if(x.cancelled)return v.reject(new Error("Response listener was cancelled for "+t));O=Math.max(O-500,0),A!==-1&&(A=Math.max(A-500,0)),x.ack||O!==0?A===0&&v.reject(new Error("No response for postMessage "+f+" in "+U()+" in "+M+"ms")):v.reject(new Error("No ack for postMessage "+f+" in "+U()+" in "+R+"ms"))})(),z()},500)}(),{cancel:function(){clearTimeout(Y)}}}();v.finally(function(){k.cancel(),S.splice(S.indexOf(v,1))}).catch(ie)}return Je(s,d,{id:Z(),origin:U(window),type:"postrobot_message_request",hash:b,name:t,data:r,fireAndForget:u},{on:te,send:e}).then(function(){return u?v.resolve():v},function(I){throw new Error("Send request message failed for "+f+" in "+U()+`
|
|
152
152
|
|
|
153
|
-
`+
|
|
153
|
+
`+ge(I))})})})};function jn(e,n,t){return Tt(e,n,t,{on:te,send:ne})}function kn(e,n,t){return Rt(e,n,t,{on:te,send:ne})}function Un(e){return new q({send:ne,win:e})}function Fn(e){return q.toProxyWindow(e,{send:ne})}function zt(){Ee().initialized||(Ee().initialized=!0,n=(e={on:te,send:ne}).on,t=e.send,(r=Ee()).receiveMessage=r.receiveMessage||function(o){return Lt(o,{on:n,send:t})},function(o){var i=o.on,a=o.send;j().getOrSet("postMessageListener",function(){return function(c,u,s){return c.addEventListener("message",s),{cancel:function(){c.removeEventListener("message",s)}}}(window,0,function(c){(function(u,s){var h=s.on,d=s.send;P.try(function(){var f=u.source||u.sourceElement,v=u.origin||u.originalEvent&&u.originalEvent.origin,b=u.data;if(v==="null"&&(v="file://"),f){if(!v)throw new Error("Post message did not have origin domain");Lt({source:f,origin:v,data:b},{on:h,send:d})}})})(c,{on:i,send:a})})})}({on:te,send:ne}),function(o){var i=o.on,a=o.send;j("builtinListeners").getOrSet("helloListener",function(){var c=i("postrobot_hello",{domain:"*"},function(s){return xt(s.source,{domain:s.origin}),{instanceID:Et()}}),u=st();return u&&qe(u,{send:a}).catch(function(s){}),c})}({on:te,send:ne}));var e,n,t,r}function Hn(){(function(){for(var n=j("responseListeners"),t=0,r=n.keys();t<r.length;t++){var o=r[t],i=n.get(o);i&&(i.cancelled=!0),n.del(o)}})(),(e=j().get("postMessageListener"))&&e.cancel();var e;delete window.__post_robot_10_0_46__}var _n=!0;function qn(e){for(var n=0,t=F("requestPromises").get(e,[]);n<t.length;n++)t[n].reject(new Error("Window "+($(e)?"closed":"cleaned up")+" before response")).catch(ie)}zt()}])})})(rt);var En=rt.exports;(function(m){m.exports=En,m.exports.default=m.exports})(nt);var ot=nt.exports;const ke=T({__proto__:null,default:yn(ot)},[ot]);C.ConsentBox=Le,C.PrivacyCenterBox=an,C.SoyioTypes=sn,C.SoyioWidget=tt,C._TooltipManager=L,C.default=tt,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|