@soyio/soyio-widget 2.8.0 → 2.8.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 CHANGED
@@ -1,45 +1,88 @@
1
- var _ = Object.defineProperty;
2
- var N = (e, t, n) => t in e ? _(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var l = (e, t, n) => (N(e, typeof t != "symbol" ? t + "" : t, n), n), L = (e, t, n) => {
4
- if (!t.has(e))
5
- throw TypeError("Cannot " + n);
1
+ var Qt = Object.defineProperty;
2
+ var vt = Object.getOwnPropertySymbols;
3
+ var en = Object.prototype.hasOwnProperty, tn = Object.prototype.propertyIsEnumerable;
4
+ var ze = (f, d, l) => d in f ? Qt(f, d, { enumerable: !0, configurable: !0, writable: !0, value: l }) : f[d] = l, wt = (f, d) => {
5
+ for (var l in d || (d = {}))
6
+ en.call(d, l) && ze(f, l, d[l]);
7
+ if (vt)
8
+ for (var l of vt(d))
9
+ tn.call(d, l) && ze(f, l, d[l]);
10
+ return f;
6
11
  };
7
- var g = (e, t, n) => {
8
- if (t.has(e))
12
+ var H = (f, d, l) => (ze(f, typeof d != "symbol" ? d + "" : d, l), l), nn = (f, d, l) => {
13
+ if (!d.has(f))
14
+ throw TypeError("Cannot " + l);
15
+ };
16
+ var gt = (f, d, l) => {
17
+ if (d.has(f))
9
18
  throw TypeError("Cannot add the same private member more than once");
10
- t instanceof WeakSet ? t.add(e) : t.set(e, n);
19
+ d instanceof WeakSet ? d.add(f) : d.set(f, l);
11
20
  };
12
- var w = (e, t, n) => (L(e, t, "access private method"), n);
13
- async function H(e, t, n) {
14
- if (!e.contentWindow)
15
- throw new Error("Invalid iframe: contentWindow is null");
16
- const o = await import("./index-yZw-yxuV.js").then((i) => i.i);
17
- try {
18
- await o.send(e.contentWindow, "SET_APPEARANCE", { appearance: t, identifier: n });
19
- } catch (i) {
20
- console.error("Failed to send appearance config:", i);
21
+ var yt = (f, d, l) => (nn(f, d, "access private method"), l);
22
+ var J = (f, d, l) => new Promise((v, g) => {
23
+ var y = (N) => {
24
+ try {
25
+ C(l.next(N));
26
+ } catch (M) {
27
+ g(M);
28
+ }
29
+ }, E = (N) => {
30
+ try {
31
+ C(l.throw(N));
32
+ } catch (M) {
33
+ g(M);
34
+ }
35
+ }, C = (N) => N.done ? v(N.value) : Promise.resolve(N.value).then(y, E);
36
+ C((l = l.apply(f, d)).next());
37
+ });
38
+ function rn(f, d) {
39
+ for (var l = 0; l < d.length; l++) {
40
+ const v = d[l];
41
+ if (typeof v != "string" && !Array.isArray(v)) {
42
+ for (const g in v)
43
+ if (g !== "default" && !(g in f)) {
44
+ const y = Object.getOwnPropertyDescriptor(v, g);
45
+ y && Object.defineProperty(f, g, y.get ? y : {
46
+ enumerable: !0,
47
+ get: () => v[g]
48
+ });
49
+ }
50
+ }
21
51
  }
52
+ return Object.freeze(Object.defineProperty(f, Symbol.toStringTag, { value: "Module" }));
53
+ }
54
+ function on(f, d, l) {
55
+ return J(this, null, function* () {
56
+ if (!f.contentWindow)
57
+ throw new Error("Invalid iframe: contentWindow is null");
58
+ const v = yield Promise.resolve().then(() => ke);
59
+ try {
60
+ yield v.send(f.contentWindow, "SET_APPEARANCE", { appearance: d, identifier: l });
61
+ } catch (g) {
62
+ console.error("Failed to send appearance config:", g);
63
+ }
64
+ });
22
65
  }
23
- const S = "https://app.soyio.id", b = "https://sandbox.soyio.id", A = [
66
+ const Wt = "https://app.soyio.id", Ct = "https://sandbox.soyio.id", an = [
24
67
  "DISCLOSURE_REQUEST_SUCCESSFUL",
25
68
  "IDENTITY_REGISTERED",
26
69
  "IDENTITY_SIGNATURE",
27
70
  "UNEXPECTED_ERROR",
28
71
  "DENIED_CAMERA_PERMISSION",
29
72
  "REJECTED_SIGNATURE"
30
- ], P = "WIDGET_CLOSED", D = 420, $ = 720, U = 500;
31
- function O(e) {
32
- const t = document.getElementById(e);
33
- t && (console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."), t.remove());
73
+ ], sn = "WIDGET_CLOSED", cn = 420, un = 720, dn = 500;
74
+ function fn(f) {
75
+ const d = document.getElementById(f);
76
+ d && (console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."), d.remove());
34
77
  }
35
- function G(e) {
36
- const t = document.querySelector(e);
37
- if (!t)
38
- throw new Error(`Iframe div container with id '${e}' not found`);
39
- if (t.tagName.toLowerCase() !== "div")
40
- throw new Error(`Iframe container with id '${e}' must be a <div> element`);
41
- const n = t;
42
- return n.style.position = "relative", n.style.cssText += `
78
+ function ln(f) {
79
+ const d = document.querySelector(f);
80
+ if (!d)
81
+ throw new Error(`Iframe div container with id '${f}' not found`);
82
+ if (d.tagName.toLowerCase() !== "div")
83
+ throw new Error(`Iframe container with id '${f}' must be a <div> element`);
84
+ const l = d;
85
+ return l.style.position = "relative", l.style.cssText += `
43
86
  padding: 0 !important;
44
87
  margin: 0 !important;
45
88
  display: flex !important;
@@ -48,11 +91,11 @@ function G(e) {
48
91
  border: none !important;
49
92
  transition: height 0.35s !important;
50
93
  opacity: 1 !important;
51
- `, n;
94
+ `, l;
52
95
  }
53
- function M(e, t) {
54
- const n = document.createElement("iframe");
55
- return n.id = t, n.src = e, n.style.cssText += `
96
+ function hn(f, d) {
97
+ const l = document.createElement("iframe");
98
+ return l.id = d, l.src = f, l.style.cssText += `
56
99
  width: 100% !important;
57
100
  min-width: 375px !important;
58
101
  max-width: 36rem !important;
@@ -62,70 +105,203 @@ function M(e, t) {
62
105
  opacity: 1;
63
106
  transition: height 0.35s,
64
107
  opacity 0.4s 0.1s;
65
- `, n;
108
+ `, l;
66
109
  }
67
- function q(e) {
68
- const t = ["actionToken", "entityId", "context"], n = e.isSandbox ?? !1, o = e.developmentUrl || (n ? b : S), i = new URLSearchParams();
69
- t.forEach((a) => {
70
- e[a] && i.set(a, e[a]);
110
+ function mn(f) {
111
+ var E;
112
+ const d = ["actionToken", "entityId", "context"], l = (E = f.isSandbox) != null ? E : !1, v = f.developmentUrl || (l ? Ct : Wt), g = new URLSearchParams();
113
+ d.forEach((C) => {
114
+ f[C] && g.set(C, f[C]);
71
115
  });
72
- const s = i.toString();
73
- return `${o}/embed/consents/${e.consentTemplateId}${s ? `?${s}` : ""}`;
116
+ const y = g.toString();
117
+ return `${v}/embed/consents/${f.consentTemplateId}${y ? `?${y}` : ""}`;
74
118
  }
75
- const W = "IFRAME_READY", k = "CONSENT_STATE_CHANGE", F = "IFRAME_HEIGHT_CHANGE", B = "TOOLTIP_STATE_CHANGE", r = {
119
+ const pn = "IFRAME_READY", vn = "CONSENT_STATE_CHANGE", wn = "IFRAME_HEIGHT_CHANGE", gn = "TOOLTIP_STATE_CHANGE", q = {
76
120
  onHeightChange: {},
77
121
  onIframeReady: {},
78
122
  onStateChange: {},
79
123
  onTooltipChange: {}
80
124
  };
81
- let C, T, y, I;
82
- async function X() {
83
- const e = await import("./index-yZw-yxuV.js").then((t) => t.i);
84
- C || T || y || I || (C = e.on(F, async (t) => {
85
- const n = t.data, o = r.onHeightChange[n.identifier];
86
- if (!o)
87
- throw new Error(`No height change listener found for identifier: ${n.identifier}`);
88
- o(n.height);
89
- }), T = e.on(W, async (t) => {
90
- const n = t.data, o = r.onIframeReady[n.identifier];
91
- if (!o)
92
- throw new Error(`No iframe ready listener found for identifier: ${n.identifier}`);
93
- o();
94
- }), y = e.on(k, async (t) => {
95
- const n = t.data, o = r.onStateChange[n.identifier];
96
- if (!o)
97
- throw new Error(`No state change listener found for identifier: ${n.identifier}`);
98
- o(n);
99
- }), I = e.on(B, async (t) => {
100
- const n = t.data, o = r.onTooltipChange[n.identifier];
101
- if (!o)
102
- throw new Error(`No tooltip change listener found for identifier: ${n.identifier}`);
103
- o(n);
104
- }));
125
+ let Et, xt, bt, St;
126
+ function yn() {
127
+ return J(this, null, function* () {
128
+ const f = yield Promise.resolve().then(() => ke);
129
+ Et || xt || bt || St || (Et = f.on(wn, (d) => J(this, null, function* () {
130
+ const l = d.data, v = q.onHeightChange[l.identifier];
131
+ if (!v)
132
+ throw new Error(`No height change listener found for identifier: ${l.identifier}`);
133
+ v(l.height);
134
+ })), xt = f.on(pn, (d) => J(this, null, function* () {
135
+ const l = d.data, v = q.onIframeReady[l.identifier];
136
+ if (!v)
137
+ throw new Error(`No iframe ready listener found for identifier: ${l.identifier}`);
138
+ v();
139
+ })), bt = f.on(vn, (d) => J(this, null, function* () {
140
+ const l = d.data, v = q.onStateChange[l.identifier];
141
+ if (!v)
142
+ throw new Error(`No state change listener found for identifier: ${l.identifier}`);
143
+ v(l);
144
+ })), St = f.on(gn, (d) => J(this, null, function* () {
145
+ const l = d.data, v = q.onTooltipChange[l.identifier];
146
+ if (!v)
147
+ throw new Error(`No tooltip change listener found for identifier: ${l.identifier}`);
148
+ v(l);
149
+ })));
150
+ });
105
151
  }
106
- function Y(e, t) {
152
+ function En(f, d) {
107
153
  const {
108
- onHeightChange: n,
109
- onIframeReady: o,
110
- onStateChange: i,
111
- onTooltipChange: s
112
- } = t;
113
- r.onHeightChange[e] = n, r.onIframeReady[e] = o, r.onStateChange[e] = i, r.onTooltipChange[e] = s;
154
+ onHeightChange: l,
155
+ onIframeReady: v,
156
+ onStateChange: g,
157
+ onTooltipChange: y
158
+ } = d;
159
+ q.onHeightChange[f] = l, q.onIframeReady[f] = v, q.onStateChange[f] = g, q.onTooltipChange[f] = y;
114
160
  }
115
- function j(e) {
116
- delete r.onHeightChange[e], delete r.onIframeReady[e], delete r.onStateChange[e], delete r.onTooltipChange[e];
161
+ function xn(f) {
162
+ delete q.onHeightChange[f], delete q.onIframeReady[f], delete q.onStateChange[f], delete q.onTooltipChange[f];
163
+ }
164
+ class bn {
165
+ constructor(d) {
166
+ H(this, "element");
167
+ H(this, "identifier");
168
+ this.identifier = `skeleton-${d}`, this.element = document.createElement("div"), this.element.id = this.identifier, this.element.style.cssText = `
169
+ position: absolute;
170
+ left: 50%;
171
+ top: 50%;
172
+ transform: translate(-50%, -50%);
173
+ width: 100%;
174
+ min-width: 375px;
175
+ max-width: 36rem;
176
+ height: 120px;
177
+ background: #FFFFFF;
178
+ border: 1px solid #E5E7EB;
179
+ border-radius: 0.25rem;
180
+ opacity: 1;
181
+ transition: opacity 0.3s ease-out;
182
+ display: flex;
183
+ flex-direction: column;
184
+ gap: 1rem;
185
+ `;
186
+ const l = document.createElement("div");
187
+ l.style.cssText = `
188
+ padding: 1rem;
189
+ height: 100%;
190
+ max-width: 100%;
191
+ display: flex;
192
+ flex-direction: column;
193
+ justify-content: space-between;
194
+ `;
195
+ const v = document.createElement("div");
196
+ v.style.cssText = `
197
+ display: flex;
198
+ align-items: center;
199
+ gap: 0.75rem;
200
+ `;
201
+ const g = document.createElement("div");
202
+ g.style.cssText = `
203
+ width: 2rem;
204
+ height: 2rem;
205
+ background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
206
+ background-size: 200% 100%;
207
+ animation: shimmer 1.5s infinite;
208
+ border-radius: 50%;
209
+ flex-shrink: 0;
210
+ `;
211
+ const y = document.createElement("div");
212
+ y.style.cssText = `
213
+ height: 1rem;
214
+ width: 30%;
215
+ background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
216
+ background-size: 200% 100%;
217
+ animation: shimmer 1.5s infinite;
218
+ border-radius: 0.125rem;
219
+ `;
220
+ const E = document.createElement("div");
221
+ E.style.cssText = `
222
+ width: 1.5rem;
223
+ height: 1.5rem;
224
+ background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
225
+ background-size: 200% 100%;
226
+ animation: shimmer 1.5s infinite;
227
+ border-radius: 50%;
228
+ margin-left: auto;
229
+ margin-right: 3px;
230
+ `;
231
+ const C = document.createElement("div");
232
+ C.style.cssText = `
233
+ display: flex;
234
+ align-items: center;
235
+ gap: 1rem;
236
+ `;
237
+ const N = document.createElement("div");
238
+ N.style.cssText = `
239
+ width: 1rem;
240
+ height: 1rem;
241
+ background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
242
+ background-size: 200% 100%;
243
+ animation: shimmer 1.5s infinite;
244
+ border-radius: 0.25rem;
245
+ flex-shrink: 0;
246
+ margin-left: 10px;
247
+ `;
248
+ const M = document.createElement("div");
249
+ M.style.cssText = `
250
+ flex-grow: 1;
251
+ display: flex;
252
+ flex-direction: column;
253
+ gap: 0.5rem;
254
+ `;
255
+ const B = document.createElement("div");
256
+ B.style.cssText = `
257
+ height: 0.875rem;
258
+ width: 80%;
259
+ background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
260
+ background-size: 200% 100%;
261
+ animation: shimmer 1.5s infinite;
262
+ border-radius: 0.125rem;
263
+ `;
264
+ const oe = document.createElement("div");
265
+ if (oe.style.cssText = `
266
+ height: 0.875rem;
267
+ width: 60%;
268
+ background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
269
+ background-size: 200% 100%;
270
+ animation: shimmer 1.5s infinite;
271
+ border-radius: 0.125rem;
272
+ `, !document.getElementById("skeleton-animation")) {
273
+ const V = document.createElement("style");
274
+ V.id = "skeleton-animation", V.textContent = `
275
+ @keyframes shimmer {
276
+ 0% { background-position: 200% 0; }
277
+ 100% { background-position: -200% 0; }
278
+ }
279
+ `, document.head.appendChild(V);
280
+ }
281
+ v.appendChild(g), v.appendChild(y), v.appendChild(E), M.appendChild(B), M.appendChild(oe), C.appendChild(N), C.appendChild(M), l.appendChild(v), l.appendChild(C), this.element.appendChild(l);
282
+ }
283
+ cleanupExistingSkeleton() {
284
+ const d = document.getElementById(this.identifier);
285
+ d && d.remove();
286
+ }
287
+ mount(d) {
288
+ this.cleanupExistingSkeleton(), d.appendChild(this.element);
289
+ }
290
+ hide() {
291
+ this.element.style.opacity = "0", setTimeout(() => this.element.remove(), 300);
292
+ }
117
293
  }
118
- class V {
294
+ class Sn {
119
295
  constructor() {
120
- l(this, "tooltipElement", null);
121
- l(this, "tooltipContent", null);
122
- l(this, "tooltipClass", "soyio-tooltip");
123
- l(this, "hideTimeout", null);
296
+ H(this, "tooltipElement", null);
297
+ H(this, "tooltipContent", null);
298
+ H(this, "tooltipClass", "soyio-tooltip");
299
+ H(this, "hideTimeout", null);
124
300
  this.createTooltipElement(), this.setupGlobalListeners();
125
301
  }
126
302
  createTooltipElement() {
127
- const t = document.querySelector(`.${this.tooltipClass}`);
128
- t == null || t.remove(), this.tooltipElement = document.createElement("div"), this.tooltipElement.className = this.tooltipClass, this.tooltipElement.style.cssText = `
303
+ const d = document.querySelector(`.${this.tooltipClass}`);
304
+ d == null || d.remove(), this.tooltipElement = document.createElement("div"), this.tooltipElement.className = this.tooltipClass, this.tooltipElement.style.cssText = `
129
305
  position: fixed;
130
306
  z-index: 99999;
131
307
  background: white;
@@ -142,8 +318,8 @@ class V {
142
318
  transform: translateX(-50%) translateY(-100%);
143
319
  margin-top: -8px;
144
320
  `, this.tooltipContent = document.createElement("div"), this.tooltipContent.style.cssText = "text-align: center;", this.tooltipElement.appendChild(this.tooltipContent);
145
- const n = document.createElement("div");
146
- n.style.cssText = `
321
+ const l = document.createElement("div");
322
+ l.style.cssText = `
147
323
  position: absolute;
148
324
  bottom: -4px;
149
325
  left: 50%;
@@ -152,72 +328,77 @@ class V {
152
328
  height: 8px;
153
329
  background: white;
154
330
  box-shadow: 2px 2px 2px rgba(0,0,0,0.1);
155
- `, this.tooltipElement.appendChild(n), document.body.appendChild(this.tooltipElement);
331
+ `, this.tooltipElement.appendChild(l), document.body.appendChild(this.tooltipElement);
156
332
  }
157
333
  setupGlobalListeners() {
158
334
  window.addEventListener("scroll", () => this.hide(), !0), window.addEventListener("resize", () => this.hide()), window.addEventListener("orientationchange", () => this.hide());
159
335
  }
160
- show(t, n, o) {
161
- !this.tooltipElement || !this.tooltipContent || (this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = null), this.tooltipContent.textContent = t, this.tooltipElement.style.left = `${n}px`, this.tooltipElement.style.top = `${o}px`, this.tooltipElement.style.opacity = "1");
336
+ show(d, l, v) {
337
+ !this.tooltipElement || !this.tooltipContent || (this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = null), this.tooltipContent.textContent = d, this.tooltipElement.style.left = `${l}px`, this.tooltipElement.style.top = `${v}px`, this.tooltipElement.style.opacity = "1");
162
338
  }
163
339
  hide() {
164
340
  this.tooltipElement && (this.tooltipElement.style.opacity = "0");
165
341
  }
166
342
  destroy() {
167
- var t;
168
- (t = this.tooltipElement) == null || t.remove(), this.tooltipElement = null, this.tooltipContent = null, this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = null);
343
+ var d;
344
+ (d = this.tooltipElement) == null || d.remove(), this.tooltipElement = null, this.tooltipContent = null, this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = null);
169
345
  }
170
346
  }
171
- class at {
172
- constructor(t) {
173
- l(this, "appearance");
174
- l(this, "options");
175
- l(this, "tooltipManager");
176
- l(this, "iframe", null);
177
- l(this, "state", {
347
+ class Hn {
348
+ constructor(d) {
349
+ H(this, "appearance");
350
+ H(this, "options");
351
+ H(this, "tooltipManager");
352
+ H(this, "skeleton");
353
+ H(this, "iframe", null);
354
+ H(this, "state", {
178
355
  isSelected: !1,
179
356
  actionToken: null
180
357
  });
181
- this.options = t, this.appearance = t.appearance || null, this.tooltipManager = new V(), this.setup();
358
+ this.options = d, this.appearance = d.appearance || null, this.tooltipManager = new Sn(), this.skeleton = new bn(this.uniqueIdentifier), this.setup();
182
359
  }
183
- handleHeightChange(t) {
184
- this.iframe && (this.iframe.style.height = `${t}px`);
360
+ handleHeightChange(d) {
361
+ this.iframe && (this.iframe.style.height = `${d}px`);
185
362
  }
186
- async handleIframeReady() {
187
- !this.iframe || !this.appearance || (this.options.onReady && this.options.onReady(), await H(this.iframe, this.appearance, this.uniqueIdentifier));
363
+ handleIframeReady() {
364
+ return J(this, null, function* () {
365
+ this.iframe && (this.skeleton.hide(), this.options.onReady && this.options.onReady(), this.appearance && on(this.iframe, this.appearance, this.uniqueIdentifier));
366
+ });
188
367
  }
189
- handleStateChange(t) {
190
- const { isSelected: n, actionToken: o } = t;
191
- this.state = { isSelected: n, actionToken: o }, this.options.onEvent({
368
+ handleStateChange(d) {
369
+ const { isSelected: l, actionToken: v } = d;
370
+ this.state = { isSelected: l, actionToken: v }, this.options.onEvent({
192
371
  eventName: "CONSENT_CHECKBOX_CHANGE",
193
- isSelected: n,
194
- actionToken: o
372
+ isSelected: l,
373
+ actionToken: v
195
374
  });
196
375
  }
197
- async setup() {
198
- await X(), Y(this.uniqueIdentifier, {
199
- onHeightChange: this.handleHeightChange.bind(this),
200
- onIframeReady: this.handleIframeReady.bind(this),
201
- onStateChange: this.handleStateChange.bind(this),
202
- onTooltipChange: this.handleTooltipChange.bind(this)
376
+ setup() {
377
+ return J(this, null, function* () {
378
+ yield yn(), En(this.uniqueIdentifier, {
379
+ onHeightChange: this.handleHeightChange.bind(this),
380
+ onIframeReady: this.handleIframeReady.bind(this),
381
+ onStateChange: this.handleStateChange.bind(this),
382
+ onTooltipChange: this.handleTooltipChange.bind(this)
383
+ });
203
384
  });
204
385
  }
205
- handleTooltipChange(t) {
386
+ handleTooltipChange(d) {
206
387
  if (!this.iframe)
207
388
  return;
208
- const n = this.iframe.getBoundingClientRect(), { text: o, coordinates: i, isVisible: s } = t, a = i.x + n.left, p = i.y + n.top;
209
- s ? this.tooltipManager.show(o, a, p) : this.tooltipManager.hide();
389
+ const l = this.iframe.getBoundingClientRect(), { text: v, coordinates: g, isVisible: y } = d, E = g.x + l.left, C = g.y + l.top;
390
+ y ? this.tooltipManager.show(v, E, C) : this.tooltipManager.hide();
210
391
  }
211
- mount(t) {
212
- O(this.iframeIdentifier);
213
- const n = G(t), o = q(this.options);
214
- return this.iframe = M(o, this.iframeIdentifier), n.appendChild(this.iframe), this;
392
+ mount(d) {
393
+ fn(this.iframeIdentifier);
394
+ const l = ln(d), v = mn(this.options);
395
+ return this.iframe = hn(v, this.iframeIdentifier), this.skeleton.mount(l), l.appendChild(this.iframe), this;
215
396
  }
216
397
  unmount() {
217
- j(this.uniqueIdentifier), this.iframe && (this.iframe.remove(), this.iframe = null);
398
+ xn(this.uniqueIdentifier), this.skeleton.hide(), this.iframe && (this.iframe.remove(), this.iframe = null);
218
399
  }
219
400
  getState() {
220
- return { ...this.state };
401
+ return wt({}, this.state);
221
402
  }
222
403
  get iframeIdentifier() {
223
404
  return `consent-box-${this.uniqueIdentifier}`;
@@ -226,76 +407,2238 @@ class at {
226
407
  return this.options.consentTemplateId;
227
408
  }
228
409
  }
229
- const rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
410
+ const Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
230
411
  __proto__: null
231
412
  }, Symbol.toStringTag, { value: "Module" }));
232
- function z(e) {
233
- let t = "widget/";
234
- return "disclosureRequestId" in e.configProps ? t += ["disclosures", e.configProps.disclosureRequestId].join("/") : t += e.request, t;
413
+ function Wn(f) {
414
+ let d = "widget/";
415
+ return "disclosureRequestId" in f.configProps ? d += ["disclosures", f.configProps.disclosureRequestId].join("/") : d += f.request, d;
235
416
  }
236
- function K(e) {
237
- const t = e.isSandbox ?? !1, n = e.developmentUrl || (t ? b : S), o = Object.entries(e.configProps).filter(([s, a]) => a || s === "disclosureRequestId").map(([s, a]) => `${s}=${encodeURIComponent(a)}`).join("&"), i = z(e);
238
- return `${n}/${i}?sdk=web&${o}`;
417
+ function Cn(f) {
418
+ var y;
419
+ const d = (y = f.isSandbox) != null ? y : !1, l = f.developmentUrl || (d ? Ct : Wt), v = Object.entries(f.configProps).filter(([E, C]) => C || E === "disclosureRequestId").map(([E, C]) => `${E}=${encodeURIComponent(C)}`).join("&"), g = Wn(f);
420
+ return `${l}/${g}?sdk=web&${v}`;
239
421
  }
240
- const J = !!(typeof window < "u" && window.document && window.document.createElement);
241
- let c = null, u = null;
242
- function m(e = null) {
243
- c && !c.closed && c.focus(), e == null || e.preventDefault();
422
+ const In = !!(typeof window != "undefined" && window.document && window.document.createElement);
423
+ let Z = null, je = null;
424
+ function Me(f = null) {
425
+ Z && !Z.closed && Z.focus(), f == null || f.preventDefault();
244
426
  }
245
- function f() {
246
- document.body.style.filter = "", document.body.removeEventListener("click", m);
427
+ function Le() {
428
+ document.body.style.filter = "", document.body.removeEventListener("click", Me);
247
429
  }
248
- function Q() {
249
- u = setInterval(() => {
250
- (!c || c.closed) && (u && clearInterval(u), f());
251
- }, U);
430
+ function Pn() {
431
+ je = setInterval(() => {
432
+ (!Z || Z.closed) && (je && clearInterval(je), Le());
433
+ }, dn);
252
434
  }
253
- function Z(e) {
254
- const t = K(e), n = D, o = $, i = window.screenLeft !== void 0 ? window.screenLeft : window.screenX, s = window.screenTop !== void 0 ? window.screenTop : window.screenY, a = window.innerWidth || document.documentElement.clientWidth || window.screen.width, p = window.innerHeight || document.documentElement.clientHeight || window.screen.height, E = a / window.screen.availWidth, x = (a - n) / 2 / E + i, R = (p - o) / 2 / E + s;
255
- document.body.style.filter = "blur(5px)", document.body.addEventListener("click", m), c = window.open(
256
- t,
435
+ function Tn(f) {
436
+ const d = Cn(f), l = cn, v = un, 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, C = window.innerHeight || document.documentElement.clientHeight || window.screen.height, N = E / window.screen.availWidth, M = (E - l) / 2 / N + g, B = (C - v) / 2 / N + y;
437
+ document.body.style.filter = "blur(5px)", document.body.addEventListener("click", Me), Z = window.open(
438
+ d,
257
439
  "Soyio",
258
440
  `scrollbars=yes,
259
- width=${n},
260
- height=${o},
261
- top=${R},
262
- left=${x}`
263
- ), m(), Q();
441
+ width=${l},
442
+ height=${v},
443
+ top=${B},
444
+ left=${M}`
445
+ ), Me(), Pn();
264
446
  }
265
- function tt() {
266
- c && (c.close(), c = null), f();
447
+ function On() {
448
+ Z && (Z.close(), Z = null), Le();
267
449
  }
268
- const et = "WIDGET_EVENT";
269
- let d = null;
270
- function nt() {
271
- d && (d.cancel(), d = null);
450
+ const Rn = "WIDGET_EVENT";
451
+ let me = null;
452
+ function An() {
453
+ me && (me.cancel(), me = null);
272
454
  }
273
- async function ot(e) {
274
- const { onEvent: t } = e, n = await import("./index-yZw-yxuV.js").then((o) => o.i);
275
- d && nt(), d = n.on(et, async (o) => {
276
- t(o.data), A.includes(o.data.eventName) ? tt() : o.data.eventName === P && f();
455
+ function Nn(f) {
456
+ return J(this, null, function* () {
457
+ const { onEvent: d } = f, l = yield Promise.resolve().then(() => ke);
458
+ me && An(), me = l.on(Rn, (v) => J(this, null, function* () {
459
+ d(v.data), an.includes(v.data.eventName) ? On() : v.data.eventName === sn && Le();
460
+ }));
277
461
  });
278
462
  }
279
- function it(e) {
280
- ot(e);
463
+ function Dn(f) {
464
+ Nn(f);
281
465
  }
282
- var h, v;
283
- class lt {
284
- constructor(t) {
285
- g(this, h);
286
- l(this, "onEvent");
287
- this.onEvent = t.onEvent, J && (Z(t), it({
288
- onEvent: w(this, h, v).bind(this)
466
+ var be, It;
467
+ class Un {
468
+ constructor(d) {
469
+ gt(this, be);
470
+ H(this, "onEvent");
471
+ this.onEvent = d.onEvent, In && (Tn(d), Dn({
472
+ onEvent: yt(this, be, It).bind(this)
289
473
  }));
290
474
  }
291
475
  }
292
- h = new WeakSet(), v = function(t) {
293
- this.onEvent(t);
476
+ be = new WeakSet(), It = function(d) {
477
+ this.onEvent(d);
294
478
  };
479
+ var zn = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
480
+ function jn(f) {
481
+ return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f;
482
+ }
483
+ var Pt = { exports: {} }, Tt = { exports: {} };
484
+ (function(f, d) {
485
+ (function(l, v) {
486
+ f.exports = v();
487
+ })(typeof self != "undefined" ? self : zn, function() {
488
+ return function(l) {
489
+ var v = {};
490
+ function g(y) {
491
+ if (v[y])
492
+ return v[y].exports;
493
+ var E = v[y] = {
494
+ i: y,
495
+ l: !1,
496
+ exports: {}
497
+ };
498
+ return l[y].call(E.exports, E, E.exports, g), E.l = !0, E.exports;
499
+ }
500
+ return g.m = l, g.c = v, g.d = function(y, E, C) {
501
+ g.o(y, E) || Object.defineProperty(y, E, {
502
+ enumerable: !0,
503
+ get: C
504
+ });
505
+ }, g.r = function(y) {
506
+ typeof Symbol != "undefined" && Symbol.toStringTag && Object.defineProperty(y, Symbol.toStringTag, {
507
+ value: "Module"
508
+ }), Object.defineProperty(y, "__esModule", {
509
+ value: !0
510
+ });
511
+ }, g.t = function(y, E) {
512
+ if (1 & E && (y = g(y)), 8 & E || 4 & E && typeof y == "object" && y && y.__esModule)
513
+ return y;
514
+ var C = /* @__PURE__ */ Object.create(null);
515
+ if (g.r(C), Object.defineProperty(C, "default", {
516
+ enumerable: !0,
517
+ value: y
518
+ }), 2 & E && typeof y != "string")
519
+ for (var N in y)
520
+ g.d(C, N, function(M) {
521
+ return y[M];
522
+ }.bind(null, N));
523
+ return C;
524
+ }, g.n = function(y) {
525
+ var E = y && y.__esModule ? function() {
526
+ return y.default;
527
+ } : function() {
528
+ return y;
529
+ };
530
+ return g.d(E, "a", E), E;
531
+ }, g.o = function(y, E) {
532
+ return {}.hasOwnProperty.call(y, E);
533
+ }, g.p = "", g(g.s = 0);
534
+ }([function(l, v, g) {
535
+ g.r(v), g.d(v, "Promise", function() {
536
+ return I;
537
+ }), g.d(v, "TYPES", function() {
538
+ return Xt;
539
+ }), g.d(v, "ProxyWindow", function() {
540
+ return G;
541
+ }), g.d(v, "setup", function() {
542
+ return pt;
543
+ }), g.d(v, "destroy", function() {
544
+ return Vt;
545
+ }), g.d(v, "serializeMessage", function() {
546
+ return qt;
547
+ }), g.d(v, "deserializeMessage", function() {
548
+ return Jt;
549
+ }), g.d(v, "createProxyWindow", function() {
550
+ return Yt;
551
+ }), g.d(v, "toProxyWindow", function() {
552
+ return Zt;
553
+ }), g.d(v, "on", function() {
554
+ return X;
555
+ }), g.d(v, "once", function() {
556
+ return _t;
557
+ }), g.d(v, "send", function() {
558
+ return K;
559
+ }), g.d(v, "markWindowKnown", function() {
560
+ return rt;
561
+ }), g.d(v, "cleanUpWindow", function() {
562
+ return Kt;
563
+ }), g.d(v, "bridge", function() {
564
+ });
565
+ function y(e) {
566
+ return {}.toString.call(e) === "[object RegExp]";
567
+ }
568
+ var E = `Call was rejected by callee.\r
569
+ `;
570
+ function C(e) {
571
+ return e === void 0 && (e = window), e.location.protocol;
572
+ }
573
+ function N(e) {
574
+ if (e === void 0 && (e = window), e.mockDomain) {
575
+ var n = e.mockDomain.split("//")[0];
576
+ if (n)
577
+ return n;
578
+ }
579
+ return C(e);
580
+ }
581
+ function M(e) {
582
+ return e === void 0 && (e = window), N(e) === "about:";
583
+ }
584
+ function B(e) {
585
+ if (e === void 0 && (e = window), e)
586
+ try {
587
+ if (e.parent && e.parent !== e)
588
+ return e.parent;
589
+ } catch (n) {
590
+ }
591
+ }
592
+ function oe(e) {
593
+ if (e === void 0 && (e = window), e && !B(e))
594
+ try {
595
+ return e.opener;
596
+ } catch (n) {
597
+ }
598
+ }
599
+ function V(e) {
600
+ try {
601
+ return !0;
602
+ } catch (n) {
603
+ }
604
+ return !1;
605
+ }
606
+ function pe(e) {
607
+ e === void 0 && (e = window);
608
+ var n = e.location;
609
+ if (!n)
610
+ throw new Error("Can not read window location");
611
+ var t = C(e);
612
+ if (!t)
613
+ throw new Error("Can not read window protocol");
614
+ if (t === "file:")
615
+ return "file://";
616
+ if (t === "about:") {
617
+ var r = B(e);
618
+ return r && V() ? pe(r) : "about://";
619
+ }
620
+ var o = n.host;
621
+ if (!o)
622
+ throw new Error("Can not read window host");
623
+ return t + "//" + o;
624
+ }
625
+ function L(e) {
626
+ e === void 0 && (e = window);
627
+ var n = pe(e);
628
+ return n && e.mockDomain && e.mockDomain.indexOf("mock:") === 0 ? e.mockDomain : n;
629
+ }
630
+ function Q(e) {
631
+ if (!function(n) {
632
+ try {
633
+ if (n === window)
634
+ return !0;
635
+ } catch (r) {
636
+ }
637
+ try {
638
+ var t = Object.getOwnPropertyDescriptor(n, "location");
639
+ if (t && t.enumerable === !1)
640
+ return !1;
641
+ } catch (r) {
642
+ }
643
+ try {
644
+ if (M(n) && V())
645
+ return !0;
646
+ } catch (r) {
647
+ }
648
+ try {
649
+ if (function(r) {
650
+ return r === void 0 && (r = window), N(r) === "mock:";
651
+ }(n) && V())
652
+ return !0;
653
+ } catch (r) {
654
+ }
655
+ try {
656
+ if (pe(n) === pe(window))
657
+ return !0;
658
+ } catch (r) {
659
+ }
660
+ return !1;
661
+ }(e))
662
+ return !1;
663
+ try {
664
+ if (e === window || M(e) && V() || L(window) === L(e))
665
+ return !0;
666
+ } catch (n) {
667
+ }
668
+ return !1;
669
+ }
670
+ function ve(e) {
671
+ if (!Q(e))
672
+ throw new Error("Expected window to be same domain");
673
+ return e;
674
+ }
675
+ function He(e, n) {
676
+ if (!e || !n)
677
+ return !1;
678
+ var t = B(n);
679
+ return t ? t === e : function(r) {
680
+ var o = [];
681
+ try {
682
+ for (; r.parent !== r; )
683
+ o.push(r.parent), r = r.parent;
684
+ } catch (i) {
685
+ }
686
+ return o;
687
+ }(n).indexOf(e) !== -1;
688
+ }
689
+ function Fe(e) {
690
+ var n = [], t;
691
+ try {
692
+ t = e.frames;
693
+ } catch (c) {
694
+ t = e;
695
+ }
696
+ var r;
697
+ try {
698
+ r = t.length;
699
+ } catch (c) {
700
+ }
701
+ if (r === 0)
702
+ return n;
703
+ if (r) {
704
+ for (var o = 0; o < r; o++) {
705
+ var i = void 0;
706
+ try {
707
+ i = t[o];
708
+ } catch (c) {
709
+ continue;
710
+ }
711
+ n.push(i);
712
+ }
713
+ return n;
714
+ }
715
+ for (var a = 0; a < 100; a++) {
716
+ var u = void 0;
717
+ try {
718
+ u = t[a];
719
+ } catch (c) {
720
+ return n;
721
+ }
722
+ if (!u)
723
+ return n;
724
+ n.push(u);
725
+ }
726
+ return n;
727
+ }
728
+ var Rt = [], At = [];
729
+ function $(e, n) {
730
+ n === void 0 && (n = !0);
731
+ try {
732
+ if (e === window)
733
+ return !1;
734
+ } catch (o) {
735
+ return !0;
736
+ }
737
+ try {
738
+ if (!e)
739
+ return !0;
740
+ } catch (o) {
741
+ return !0;
742
+ }
743
+ try {
744
+ if (e.closed)
745
+ return !0;
746
+ } catch (o) {
747
+ return !o || o.message !== E;
748
+ }
749
+ if (n && Q(e))
750
+ try {
751
+ if (e.mockclosed)
752
+ return !0;
753
+ } catch (o) {
754
+ }
755
+ try {
756
+ if (!e.parent || !e.top)
757
+ return !0;
758
+ } catch (o) {
759
+ }
760
+ var t = function(o, i) {
761
+ for (var a = 0; a < o.length; a++)
762
+ try {
763
+ if (o[a] === i)
764
+ return a;
765
+ } catch (u) {
766
+ }
767
+ return -1;
768
+ }(Rt, e);
769
+ if (t !== -1) {
770
+ var r = At[t];
771
+ if (r && function(o) {
772
+ if (!o.contentWindow || !o.parentNode)
773
+ return !0;
774
+ var i = o.ownerDocument;
775
+ if (i && i.documentElement && !i.documentElement.contains(o)) {
776
+ for (var a = o; a.parentNode && a.parentNode !== a; )
777
+ a = a.parentNode;
778
+ if (!a.host || !i.documentElement.contains(a.host))
779
+ return !0;
780
+ }
781
+ return !1;
782
+ }(r))
783
+ return !0;
784
+ }
785
+ return !1;
786
+ }
787
+ function Ue(e) {
788
+ return e === void 0 && (e = window), oe(e = e || window) || B(e) || void 0;
789
+ }
790
+ function re(e, n) {
791
+ if (typeof e == "string") {
792
+ if (typeof n == "string")
793
+ return e === "*" || n === e;
794
+ if (y(n) || Array.isArray(n))
795
+ return !1;
796
+ }
797
+ 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) {
798
+ return re(t, n);
799
+ }));
800
+ }
801
+ function we(e) {
802
+ try {
803
+ if (e === window)
804
+ return !0;
805
+ } catch (n) {
806
+ if (n && n.message === E)
807
+ return !0;
808
+ }
809
+ try {
810
+ if ({}.toString.call(e) === "[object Window]")
811
+ return !0;
812
+ } catch (n) {
813
+ if (n && n.message === E)
814
+ return !0;
815
+ }
816
+ try {
817
+ if (window.Window && e instanceof window.Window)
818
+ return !0;
819
+ } catch (n) {
820
+ if (n && n.message === E)
821
+ return !0;
822
+ }
823
+ try {
824
+ if (e && e.self === e)
825
+ return !0;
826
+ } catch (n) {
827
+ if (n && n.message === E)
828
+ return !0;
829
+ }
830
+ try {
831
+ if (e && e.parent === e)
832
+ return !0;
833
+ } catch (n) {
834
+ if (n && n.message === E)
835
+ return !0;
836
+ }
837
+ try {
838
+ if (e && e.top === e)
839
+ return !0;
840
+ } catch (n) {
841
+ if (n && n.message === E)
842
+ return !0;
843
+ }
844
+ try {
845
+ if (e && e.__cross_domain_utils_window_check__ === "__unlikely_value__")
846
+ return !1;
847
+ } catch (n) {
848
+ return !0;
849
+ }
850
+ try {
851
+ if ("postMessage" in e && "self" in e && "location" in e)
852
+ return !0;
853
+ } catch (n) {
854
+ }
855
+ return !1;
856
+ }
857
+ function Ge(e) {
858
+ if (Q(e))
859
+ return ve(e).frameElement;
860
+ for (var n = 0, t = document.querySelectorAll("iframe"); n < t.length; n++) {
861
+ var r = t[n];
862
+ if (r && r.contentWindow && r.contentWindow === e)
863
+ return r;
864
+ }
865
+ }
866
+ function Nt(e) {
867
+ if (function(t) {
868
+ return t === void 0 && (t = window), !!B(t);
869
+ }(e)) {
870
+ var n = Ge(e);
871
+ if (n && n.parentElement) {
872
+ n.parentElement.removeChild(n);
873
+ return;
874
+ }
875
+ }
876
+ try {
877
+ e.close();
878
+ } catch (t) {
879
+ }
880
+ }
881
+ function ee(e) {
882
+ try {
883
+ if (!e)
884
+ return !1;
885
+ if (typeof Promise != "undefined" && e instanceof Promise)
886
+ return !0;
887
+ if (typeof window != "undefined" && typeof window.Window == "function" && e instanceof window.Window || typeof window != "undefined" && typeof window.constructor == "function" && e instanceof window.constructor)
888
+ return !1;
889
+ var n = {}.toString;
890
+ if (n) {
891
+ var t = n.call(e);
892
+ if (t === "[object Window]" || t === "[object global]" || t === "[object DOMWindow]")
893
+ return !1;
894
+ }
895
+ if (typeof e.then == "function")
896
+ return !0;
897
+ } catch (r) {
898
+ return !1;
899
+ }
900
+ return !1;
901
+ }
902
+ var Be = [], ie = [], Se = 0, ae;
903
+ function $e() {
904
+ if (!Se && ae) {
905
+ var e = ae;
906
+ ae = null, e.resolve();
907
+ }
908
+ }
909
+ function We() {
910
+ Se += 1;
911
+ }
912
+ function se() {
913
+ Se -= 1, $e();
914
+ }
915
+ var I = function() {
916
+ function e(t) {
917
+ var r = this;
918
+ 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) {
919
+ var o, i, a = !1, u = !1, c = !1;
920
+ We();
921
+ try {
922
+ t(function(s) {
923
+ c ? r.resolve(s) : (a = !0, o = s);
924
+ }, function(s) {
925
+ c ? r.reject(s) : (u = !0, i = s);
926
+ });
927
+ } catch (s) {
928
+ se(), this.reject(s);
929
+ return;
930
+ }
931
+ se(), c = !0, a ? this.resolve(o) : u && this.reject(i);
932
+ }
933
+ }
934
+ var n = e.prototype;
935
+ return n.resolve = function(t) {
936
+ if (this.resolved || this.rejected)
937
+ return this;
938
+ if (ee(t))
939
+ throw new Error("Can not resolve promise with another promise");
940
+ return this.resolved = !0, this.value = t, this.dispatch(), this;
941
+ }, n.reject = function(t) {
942
+ var r = this;
943
+ if (this.resolved || this.rejected)
944
+ return this;
945
+ if (ee(t))
946
+ throw new Error("Can not reject promise with another promise");
947
+ if (!t) {
948
+ var o = t && typeof t.toString == "function" ? t.toString() : {}.toString.call(t);
949
+ t = new Error("Expected reject to be called with Error, got " + o);
950
+ }
951
+ return this.rejected = !0, this.error = t, this.errorHandled || setTimeout(function() {
952
+ r.errorHandled || function(i, a) {
953
+ if (Be.indexOf(i) === -1) {
954
+ Be.push(i), setTimeout(function() {
955
+ throw i;
956
+ }, 1);
957
+ for (var u = 0; u < ie.length; u++)
958
+ ie[u](i, a);
959
+ }
960
+ }(t, r);
961
+ }, 1), this.dispatch(), this;
962
+ }, n.asyncReject = function(t) {
963
+ return this.errorHandled = !0, this.reject(t), this;
964
+ }, n.dispatch = function() {
965
+ var t = this.resolved, r = this.rejected, o = this.handlers;
966
+ if (!this.dispatching && (t || r)) {
967
+ this.dispatching = !0, We();
968
+ for (var i = function(w, S) {
969
+ return w.then(function(x) {
970
+ S.resolve(x);
971
+ }, function(x) {
972
+ S.reject(x);
973
+ });
974
+ }, a = 0; a < o.length; a++) {
975
+ var u = o[a], c = u.onSuccess, s = u.onError, p = u.promise, h = void 0;
976
+ if (t)
977
+ try {
978
+ h = c ? c(this.value) : this.value;
979
+ } catch (w) {
980
+ p.reject(w);
981
+ continue;
982
+ }
983
+ else if (r) {
984
+ if (!s) {
985
+ p.reject(this.error);
986
+ continue;
987
+ }
988
+ try {
989
+ h = s(this.error);
990
+ } catch (w) {
991
+ p.reject(w);
992
+ continue;
993
+ }
994
+ }
995
+ if (h instanceof e && (h.resolved || h.rejected)) {
996
+ var m = h;
997
+ m.resolved ? p.resolve(m.value) : p.reject(m.error), m.errorHandled = !0;
998
+ } else
999
+ ee(h) ? h instanceof e && (h.resolved || h.rejected) ? h.resolved ? p.resolve(h.value) : p.reject(h.error) : i(h, p) : p.resolve(h);
1000
+ }
1001
+ o.length = 0, this.dispatching = !1, se();
1002
+ }
1003
+ }, n.then = function(t, r) {
1004
+ if (t && typeof t != "function" && !t.call)
1005
+ throw new Error("Promise.then expected a function for success handler");
1006
+ if (r && typeof r != "function" && !r.call)
1007
+ throw new Error("Promise.then expected a function for error handler");
1008
+ var o = new e();
1009
+ return this.handlers.push({
1010
+ promise: o,
1011
+ onSuccess: t,
1012
+ onError: r
1013
+ }), this.errorHandled = !0, this.dispatch(), o;
1014
+ }, n.catch = function(t) {
1015
+ return this.then(void 0, t);
1016
+ }, n.finally = function(t) {
1017
+ if (t && typeof t != "function" && !t.call)
1018
+ throw new Error("Promise.finally expected a function");
1019
+ return this.then(function(r) {
1020
+ return e.try(t).then(function() {
1021
+ return r;
1022
+ });
1023
+ }, function(r) {
1024
+ return e.try(t).then(function() {
1025
+ throw r;
1026
+ });
1027
+ });
1028
+ }, n.timeout = function(t, r) {
1029
+ var o = this;
1030
+ if (this.resolved || this.rejected)
1031
+ return this;
1032
+ var i = setTimeout(function() {
1033
+ o.resolved || o.rejected || o.reject(r || new Error("Promise timed out after " + t + "ms"));
1034
+ }, t);
1035
+ return this.then(function(a) {
1036
+ return clearTimeout(i), a;
1037
+ });
1038
+ }, n.toPromise = function() {
1039
+ if (typeof Promise == "undefined")
1040
+ throw new TypeError("Could not find Promise");
1041
+ return Promise.resolve(this);
1042
+ }, n.lazy = function() {
1043
+ return this.errorHandled = !0, this;
1044
+ }, e.resolve = function(t) {
1045
+ return t instanceof e ? t : ee(t) ? new e(function(r, o) {
1046
+ return t.then(r, o);
1047
+ }) : new e().resolve(t);
1048
+ }, e.reject = function(t) {
1049
+ return new e().reject(t);
1050
+ }, e.asyncReject = function(t) {
1051
+ return new e().asyncReject(t);
1052
+ }, e.all = function(t) {
1053
+ var r = new e(), o = t.length, i = [].slice();
1054
+ if (!o)
1055
+ return r.resolve(i), r;
1056
+ for (var a = function(s, p, h) {
1057
+ return p.then(function(m) {
1058
+ i[s] = m, (o -= 1) == 0 && r.resolve(i);
1059
+ }, function(m) {
1060
+ h.reject(m);
1061
+ });
1062
+ }, u = 0; u < t.length; u++) {
1063
+ var c = t[u];
1064
+ if (c instanceof e) {
1065
+ if (c.resolved) {
1066
+ i[u] = c.value, o -= 1;
1067
+ continue;
1068
+ }
1069
+ } else if (!ee(c)) {
1070
+ i[u] = c, o -= 1;
1071
+ continue;
1072
+ }
1073
+ a(u, e.resolve(c), r);
1074
+ }
1075
+ return o === 0 && r.resolve(i), r;
1076
+ }, e.hash = function(t) {
1077
+ var r = {}, o = [], i = function(u) {
1078
+ if (t.hasOwnProperty(u)) {
1079
+ var c = t[u];
1080
+ ee(c) ? o.push(c.then(function(s) {
1081
+ r[u] = s;
1082
+ })) : r[u] = c;
1083
+ }
1084
+ };
1085
+ for (var a in t)
1086
+ i(a);
1087
+ return e.all(o).then(function() {
1088
+ return r;
1089
+ });
1090
+ }, e.map = function(t, r) {
1091
+ return e.all(t.map(r));
1092
+ }, e.onPossiblyUnhandledException = function(t) {
1093
+ return function(r) {
1094
+ return ie.push(r), {
1095
+ cancel: function() {
1096
+ ie.splice(ie.indexOf(r), 1);
1097
+ }
1098
+ };
1099
+ }(t);
1100
+ }, e.try = function(t, r, o) {
1101
+ if (t && typeof t != "function" && !t.call)
1102
+ throw new Error("Promise.try expected a function");
1103
+ var i;
1104
+ We();
1105
+ try {
1106
+ i = t.apply(r, o || []);
1107
+ } catch (a) {
1108
+ return se(), e.reject(a);
1109
+ }
1110
+ return se(), e.resolve(i);
1111
+ }, e.delay = function(t) {
1112
+ return new e(function(r) {
1113
+ setTimeout(r, t);
1114
+ });
1115
+ }, e.isPromise = function(t) {
1116
+ return !!(t && t instanceof e) || ee(t);
1117
+ }, e.flush = function() {
1118
+ return function(t) {
1119
+ var r = ae = ae || new t();
1120
+ return $e(), r;
1121
+ }(e);
1122
+ }, e;
1123
+ }();
1124
+ function ge(e, n) {
1125
+ for (var t = 0; t < e.length; t++)
1126
+ try {
1127
+ if (e[t] === n)
1128
+ return t;
1129
+ } catch (r) {
1130
+ }
1131
+ return -1;
1132
+ }
1133
+ var Ce = function() {
1134
+ function e() {
1135
+ 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() {
1136
+ if (typeof WeakMap == "undefined" || Object.freeze === void 0)
1137
+ return !1;
1138
+ try {
1139
+ var t = /* @__PURE__ */ new WeakMap(), r = {};
1140
+ return Object.freeze(r), t.set(r, "__testvalue__"), t.get(r) === "__testvalue__";
1141
+ } catch (o) {
1142
+ return !1;
1143
+ }
1144
+ }())
1145
+ try {
1146
+ this.weakmap = /* @__PURE__ */ new WeakMap();
1147
+ } catch (t) {
1148
+ }
1149
+ this.keys = [], this.values = [];
1150
+ }
1151
+ var n = e.prototype;
1152
+ return n._cleanupClosedWindows = function() {
1153
+ for (var t = this.weakmap, r = this.keys, o = 0; o < r.length; o++) {
1154
+ var i = r[o];
1155
+ if (we(i) && $(i)) {
1156
+ if (t)
1157
+ try {
1158
+ t.delete(i);
1159
+ } catch (a) {
1160
+ }
1161
+ r.splice(o, 1), this.values.splice(o, 1), o -= 1;
1162
+ }
1163
+ }
1164
+ }, n.isSafeToReadWrite = function(t) {
1165
+ return !we(t);
1166
+ }, n.set = function(t, r) {
1167
+ if (!t)
1168
+ throw new Error("WeakMap expected key");
1169
+ var o = this.weakmap;
1170
+ if (o)
1171
+ try {
1172
+ o.set(t, r);
1173
+ } catch (p) {
1174
+ delete this.weakmap;
1175
+ }
1176
+ if (this.isSafeToReadWrite(t))
1177
+ try {
1178
+ var i = this.name, a = t[i];
1179
+ a && a[0] === t ? a[1] = r : Object.defineProperty(t, i, {
1180
+ value: [t, r],
1181
+ writable: !0
1182
+ });
1183
+ return;
1184
+ } catch (p) {
1185
+ }
1186
+ this._cleanupClosedWindows();
1187
+ var u = this.keys, c = this.values, s = ge(u, t);
1188
+ s === -1 ? (u.push(t), c.push(r)) : c[s] = r;
1189
+ }, n.get = function(t) {
1190
+ if (!t)
1191
+ throw new Error("WeakMap expected key");
1192
+ var r = this.weakmap;
1193
+ if (r)
1194
+ try {
1195
+ if (r.has(t))
1196
+ return r.get(t);
1197
+ } catch (a) {
1198
+ delete this.weakmap;
1199
+ }
1200
+ if (this.isSafeToReadWrite(t))
1201
+ try {
1202
+ var o = t[this.name];
1203
+ return o && o[0] === t ? o[1] : void 0;
1204
+ } catch (a) {
1205
+ }
1206
+ this._cleanupClosedWindows();
1207
+ var i = ge(this.keys, t);
1208
+ if (i !== -1)
1209
+ return this.values[i];
1210
+ }, n.delete = function(t) {
1211
+ if (!t)
1212
+ throw new Error("WeakMap expected key");
1213
+ var r = this.weakmap;
1214
+ if (r)
1215
+ try {
1216
+ r.delete(t);
1217
+ } catch (u) {
1218
+ delete this.weakmap;
1219
+ }
1220
+ if (this.isSafeToReadWrite(t))
1221
+ try {
1222
+ var o = t[this.name];
1223
+ o && o[0] === t && (o[0] = o[1] = void 0);
1224
+ } catch (u) {
1225
+ }
1226
+ this._cleanupClosedWindows();
1227
+ var i = this.keys, a = ge(i, t);
1228
+ a !== -1 && (i.splice(a, 1), this.values.splice(a, 1));
1229
+ }, n.has = function(t) {
1230
+ if (!t)
1231
+ throw new Error("WeakMap expected key");
1232
+ var r = this.weakmap;
1233
+ if (r)
1234
+ try {
1235
+ if (r.has(t))
1236
+ return !0;
1237
+ } catch (i) {
1238
+ delete this.weakmap;
1239
+ }
1240
+ if (this.isSafeToReadWrite(t))
1241
+ try {
1242
+ var o = t[this.name];
1243
+ return !(!o || o[0] !== t);
1244
+ } catch (i) {
1245
+ }
1246
+ return this._cleanupClosedWindows(), ge(this.keys, t) !== -1;
1247
+ }, n.getOrSet = function(t, r) {
1248
+ if (this.has(t))
1249
+ return this.get(t);
1250
+ var o = r();
1251
+ return this.set(t, o), o;
1252
+ }, e;
1253
+ }();
1254
+ function _e(e) {
1255
+ return e.name || e.__name__ || e.displayName || "anonymous";
1256
+ }
1257
+ function qe(e, n) {
1258
+ try {
1259
+ delete e.name, e.name = n;
1260
+ } catch (t) {
1261
+ }
1262
+ return e.__name__ = e.displayName = n, e;
1263
+ }
1264
+ function Y() {
1265
+ var e = "0123456789abcdef";
1266
+ return "uid_" + "xxxxxxxxxx".replace(/./g, function() {
1267
+ return e.charAt(Math.floor(Math.random() * e.length));
1268
+ }) + "_" + function(n) {
1269
+ if (typeof btoa == "function")
1270
+ return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g, function(t, r) {
1271
+ return String.fromCharCode(parseInt(r, 16));
1272
+ })).replace(/[=]/g, "");
1273
+ if (typeof Buffer != "undefined")
1274
+ return Buffer.from(n, "utf8").toString("base64").replace(/[=]/g, "");
1275
+ throw new Error("Can not find window.btoa or Buffer");
1276
+ }((/* @__PURE__ */ new Date()).toISOString().slice(11, 19).replace("T", ".")).replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
1277
+ }
1278
+ var ye;
1279
+ function Je(e) {
1280
+ try {
1281
+ return JSON.stringify([].slice.call(e), function(n, t) {
1282
+ return typeof t == "function" ? "memoize[" + function(r) {
1283
+ if (ye = ye || new Ce(), r == null || typeof r != "object" && typeof r != "function")
1284
+ throw new Error("Invalid object");
1285
+ var o = ye.get(r);
1286
+ return o || (o = typeof r + ":" + Y(), ye.set(r, o)), o;
1287
+ }(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;
1288
+ });
1289
+ } catch (n) {
1290
+ throw new Error("Arguments not serializable -- can not be used to memoize");
1291
+ }
1292
+ }
1293
+ function Dt() {
1294
+ return {};
1295
+ }
1296
+ var ce = 0, Ye = 0;
1297
+ function ue(e, n) {
1298
+ n === void 0 && (n = {});
1299
+ var t = n.thisNamespace, r = t !== void 0 && t, o = n.time, i, a, u = ce;
1300
+ ce += 1;
1301
+ var c = function() {
1302
+ for (var s = arguments.length, p = new Array(s), h = 0; h < s; h++)
1303
+ p[h] = arguments[h];
1304
+ u < Ye && (i = null, a = null, u = ce, ce += 1);
1305
+ var m;
1306
+ m = r ? (a = a || new Ce()).getOrSet(this, Dt) : i = i || {};
1307
+ var w;
1308
+ try {
1309
+ w = Je(p);
1310
+ } catch (P) {
1311
+ return e.apply(this, arguments);
1312
+ }
1313
+ var S = m[w];
1314
+ if (S && o && Date.now() - S.time < o && (delete m[w], S = null), S)
1315
+ return S.value;
1316
+ var x = Date.now(), b = e.apply(this, arguments);
1317
+ return m[w] = {
1318
+ time: x,
1319
+ value: b
1320
+ }, b;
1321
+ };
1322
+ return c.reset = function() {
1323
+ i = null, a = null;
1324
+ }, qe(c, (n.name || _e(e)) + "::memoized");
1325
+ }
1326
+ ue.clear = function() {
1327
+ Ye = ce;
1328
+ };
1329
+ function zt(e) {
1330
+ var n = {};
1331
+ function t() {
1332
+ for (var r = arguments, o = this, i = arguments.length, a = new Array(i), u = 0; u < i; u++)
1333
+ a[u] = arguments[u];
1334
+ var c = Je(a);
1335
+ return n.hasOwnProperty(c) || (n[c] = I.try(function() {
1336
+ return e.apply(o, r);
1337
+ }).finally(function() {
1338
+ delete n[c];
1339
+ })), n[c];
1340
+ }
1341
+ return t.reset = function() {
1342
+ n = {};
1343
+ }, qe(t, _e(e) + "::promiseMemoized");
1344
+ }
1345
+ function te() {
1346
+ }
1347
+ function de(e, n) {
1348
+ if (n === void 0 && (n = 1), n >= 3)
1349
+ return "stringifyError stack overflow";
1350
+ try {
1351
+ if (!e)
1352
+ return "<unknown error: " + {}.toString.call(e) + ">";
1353
+ if (typeof e == "string")
1354
+ return e;
1355
+ if (e instanceof Error) {
1356
+ var t = e && e.stack, r = e && e.message;
1357
+ if (t && r)
1358
+ return t.indexOf(r) !== -1 ? t : r + `
1359
+ ` + t;
1360
+ if (t)
1361
+ return t;
1362
+ if (r)
1363
+ return r;
1364
+ }
1365
+ return e && e.toString && typeof e.toString == "function" ? e.toString() : {}.toString.call(e);
1366
+ } catch (o) {
1367
+ return "Error while stringifying error: " + de(o, n + 1);
1368
+ }
1369
+ }
1370
+ function Ze(e) {
1371
+ return typeof e == "string" ? e : e && e.toString && typeof e.toString == "function" ? e.toString() : {}.toString.call(e);
1372
+ }
1373
+ ue(function(e) {
1374
+ if (Object.values)
1375
+ return Object.values(e);
1376
+ var n = [];
1377
+ for (var t in e)
1378
+ e.hasOwnProperty(t) && n.push(e[t]);
1379
+ return n;
1380
+ });
1381
+ function Ie(e) {
1382
+ return {}.toString.call(e) === "[object RegExp]";
1383
+ }
1384
+ function fe(e, n, t) {
1385
+ if (e.hasOwnProperty(n))
1386
+ return e[n];
1387
+ var r = t();
1388
+ return e[n] = r, r;
1389
+ }
1390
+ function Ve() {
1391
+ var e = document.body;
1392
+ if (!e)
1393
+ throw new Error("Body element not found");
1394
+ return e;
1395
+ }
1396
+ function Xe() {
1397
+ return !!document.body && document.readyState === "complete";
1398
+ }
1399
+ function Ke() {
1400
+ return !!document.body && document.readyState === "interactive";
1401
+ }
1402
+ ue(function() {
1403
+ return new I(function(e) {
1404
+ if (Xe() || Ke())
1405
+ return e();
1406
+ var n = setInterval(function() {
1407
+ if (Xe() || Ke())
1408
+ return clearInterval(n), e();
1409
+ }, 10);
1410
+ });
1411
+ });
1412
+ var Ee = typeof document != "undefined" ? document.currentScript : null, jt = ue(function() {
1413
+ if (Ee || (Ee = function() {
1414
+ try {
1415
+ var e = function() {
1416
+ try {
1417
+ throw new Error("_");
1418
+ } catch (a) {
1419
+ return a.stack || "";
1420
+ }
1421
+ }(), n = /.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(e), t = n && n[1];
1422
+ if (!t)
1423
+ return;
1424
+ for (var r = 0, o = [].slice.call(document.getElementsByTagName("script")).reverse(); r < o.length; r++) {
1425
+ var i = o[r];
1426
+ if (i.src && i.src === t)
1427
+ return i;
1428
+ }
1429
+ } catch (a) {
1430
+ }
1431
+ }()))
1432
+ return Ee;
1433
+ throw new Error("Can not determine current script");
1434
+ }), Mt = Y();
1435
+ ue(function() {
1436
+ var e;
1437
+ try {
1438
+ e = jt();
1439
+ } catch (r) {
1440
+ return Mt;
1441
+ }
1442
+ var n = e.getAttribute("data-uid");
1443
+ if (n && typeof n == "string" || (n = e.getAttribute("data-uid-auto")) && typeof n == "string")
1444
+ return n;
1445
+ if (e.src) {
1446
+ var t = function(r) {
1447
+ for (var o = "", i = 0; i < r.length; i++) {
1448
+ var a = r[i].charCodeAt(0) * i;
1449
+ r[i + 1] && (a += r[i + 1].charCodeAt(0) * (i - 1)), o += String.fromCharCode(97 + Math.abs(a) % 26);
1450
+ }
1451
+ return o;
1452
+ }(JSON.stringify({
1453
+ src: e.src,
1454
+ dataset: e.dataset
1455
+ }));
1456
+ n = "uid_" + t.slice(t.length - 30);
1457
+ } else
1458
+ n = Y();
1459
+ return e.setAttribute("data-uid-auto", n), n;
1460
+ });
1461
+ function le(e) {
1462
+ e === void 0 && (e = window);
1463
+ var n = "__post_robot_10_0_46__";
1464
+ return e !== window ? e[n] : e[n] = e[n] || {};
1465
+ }
1466
+ var Qe = function() {
1467
+ return {};
1468
+ };
1469
+ function z(e, n) {
1470
+ return e === void 0 && (e = "store"), n === void 0 && (n = Qe), fe(le(), e, function() {
1471
+ var t = n();
1472
+ return {
1473
+ has: function(r) {
1474
+ return t.hasOwnProperty(r);
1475
+ },
1476
+ get: function(r, o) {
1477
+ return t.hasOwnProperty(r) ? t[r] : o;
1478
+ },
1479
+ set: function(r, o) {
1480
+ return t[r] = o, o;
1481
+ },
1482
+ del: function(r) {
1483
+ delete t[r];
1484
+ },
1485
+ getOrSet: function(r, o) {
1486
+ return fe(t, r, o);
1487
+ },
1488
+ reset: function() {
1489
+ t = n();
1490
+ },
1491
+ keys: function() {
1492
+ return Object.keys(t);
1493
+ }
1494
+ };
1495
+ });
1496
+ }
1497
+ var Lt = function() {
1498
+ };
1499
+ function xe() {
1500
+ var e = le();
1501
+ return e.WINDOW_WILDCARD = e.WINDOW_WILDCARD || new Lt(), e.WINDOW_WILDCARD;
1502
+ }
1503
+ function k(e, n) {
1504
+ return e === void 0 && (e = "store"), n === void 0 && (n = Qe), z("windowStore").getOrSet(e, function() {
1505
+ var t = new Ce(), r = function(o) {
1506
+ return t.getOrSet(o, n);
1507
+ };
1508
+ return {
1509
+ has: function(o) {
1510
+ return r(o).hasOwnProperty(e);
1511
+ },
1512
+ get: function(o, i) {
1513
+ var a = r(o);
1514
+ return a.hasOwnProperty(e) ? a[e] : i;
1515
+ },
1516
+ set: function(o, i) {
1517
+ return r(o)[e] = i, i;
1518
+ },
1519
+ del: function(o) {
1520
+ delete r(o)[e];
1521
+ },
1522
+ getOrSet: function(o, i) {
1523
+ return fe(r(o), e, i);
1524
+ }
1525
+ };
1526
+ });
1527
+ }
1528
+ function et() {
1529
+ return z("instance").getOrSet("instanceID", Y);
1530
+ }
1531
+ function tt(e, n) {
1532
+ var t = n.domain, r = k("helloPromises"), o = r.get(e);
1533
+ o && o.resolve({
1534
+ domain: t
1535
+ });
1536
+ var i = I.resolve({
1537
+ domain: t
1538
+ });
1539
+ return r.set(e, i), i;
1540
+ }
1541
+ function Pe(e, n) {
1542
+ return (0, n.send)(e, "postrobot_hello", {
1543
+ instanceID: et()
1544
+ }, {
1545
+ domain: "*",
1546
+ timeout: -1
1547
+ }).then(function(t) {
1548
+ var r = t.origin, o = t.data.instanceID;
1549
+ return tt(e, {
1550
+ domain: r
1551
+ }), {
1552
+ win: e,
1553
+ domain: r,
1554
+ instanceID: o
1555
+ };
1556
+ });
1557
+ }
1558
+ function nt(e, n) {
1559
+ var t = n.send;
1560
+ return k("windowInstanceIDPromises").getOrSet(e, function() {
1561
+ return Pe(e, {
1562
+ send: t
1563
+ }).then(function(r) {
1564
+ return r.instanceID;
1565
+ });
1566
+ });
1567
+ }
1568
+ function rt(e) {
1569
+ k("knownWindows").set(e, !0);
1570
+ }
1571
+ function Te(e) {
1572
+ return typeof e == "object" && e !== null && typeof e.__type__ == "string";
1573
+ }
1574
+ function ot(e) {
1575
+ 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;
1576
+ }
1577
+ function ne(e, n) {
1578
+ return {
1579
+ __type__: e,
1580
+ __val__: n
1581
+ };
1582
+ }
1583
+ var F, kt = ((F = {}).function = function() {
1584
+ }, F.error = function(e) {
1585
+ return ne("error", {
1586
+ message: e.message,
1587
+ stack: e.stack,
1588
+ code: e.code,
1589
+ data: e.data
1590
+ });
1591
+ }, F.promise = function() {
1592
+ }, F.regex = function(e) {
1593
+ return ne("regex", e.source);
1594
+ }, F.date = function(e) {
1595
+ return ne("date", e.toJSON());
1596
+ }, F.array = function(e) {
1597
+ return e;
1598
+ }, F.object = function(e) {
1599
+ return e;
1600
+ }, F.string = function(e) {
1601
+ return e;
1602
+ }, F.number = function(e) {
1603
+ return e;
1604
+ }, F.boolean = function(e) {
1605
+ return e;
1606
+ }, F.null = function(e) {
1607
+ return e;
1608
+ }, F[void 0] = function(e) {
1609
+ return ne("undefined", e);
1610
+ }, F), Ht = {}, U, Ft = ((U = {}).function = function() {
1611
+ throw new Error("Function serialization is not implemented; nothing to deserialize");
1612
+ }, U.error = function(e) {
1613
+ var n = e.stack, t = e.code, r = e.data, o = new Error(e.message);
1614
+ return o.code = t, r && (o.data = r), o.stack = n + `
1615
+
1616
+ ` + o.stack, o;
1617
+ }, U.promise = function() {
1618
+ throw new Error("Promise serialization is not implemented; nothing to deserialize");
1619
+ }, U.regex = function(e) {
1620
+ return new RegExp(e);
1621
+ }, U.date = function(e) {
1622
+ return new Date(e);
1623
+ }, U.array = function(e) {
1624
+ return e;
1625
+ }, U.object = function(e) {
1626
+ return e;
1627
+ }, U.string = function(e) {
1628
+ return e;
1629
+ }, U.number = function(e) {
1630
+ return e;
1631
+ }, U.boolean = function(e) {
1632
+ return e;
1633
+ }, U.null = function(e) {
1634
+ return e;
1635
+ }, U[void 0] = function() {
1636
+ }, U), Ut = {};
1637
+ new I(function(e) {
1638
+ if (window.document && window.document.body)
1639
+ return e(window.document.body);
1640
+ var n = setInterval(function() {
1641
+ if (window.document && window.document.body)
1642
+ return clearInterval(n), e(window.document.body);
1643
+ }, 10);
1644
+ });
1645
+ function Oe() {
1646
+ for (var e = z("idToProxyWindow"), n = 0, t = e.keys(); n < t.length; n++) {
1647
+ var r = t[n];
1648
+ e.get(r).shouldClean() && e.del(r);
1649
+ }
1650
+ }
1651
+ function it(e, n) {
1652
+ var t = n.send, r = n.id, o = r === void 0 ? Y() : r, i = e.then(function(c) {
1653
+ if (Q(c))
1654
+ return ve(c).name;
1655
+ }), a = e.then(function(c) {
1656
+ if ($(c))
1657
+ throw new Error("Window is closed, can not determine type");
1658
+ return oe(c) ? "popup" : "iframe";
1659
+ });
1660
+ i.catch(te), a.catch(te);
1661
+ var u = function() {
1662
+ return e.then(function(c) {
1663
+ if (!$(c))
1664
+ return Q(c) ? ve(c).name : i;
1665
+ });
1666
+ };
1667
+ return {
1668
+ id: o,
1669
+ getType: function() {
1670
+ return a;
1671
+ },
1672
+ getInstanceID: zt(function() {
1673
+ return e.then(function(c) {
1674
+ return nt(c, {
1675
+ send: t
1676
+ });
1677
+ });
1678
+ }),
1679
+ close: function() {
1680
+ return e.then(Nt);
1681
+ },
1682
+ getName: u,
1683
+ focus: function() {
1684
+ return e.then(function(c) {
1685
+ c.focus();
1686
+ });
1687
+ },
1688
+ isClosed: function() {
1689
+ return e.then(function(c) {
1690
+ return $(c);
1691
+ });
1692
+ },
1693
+ setLocation: function(c, s) {
1694
+ return s === void 0 && (s = {}), e.then(function(p) {
1695
+ var h = window.location.protocol + "//" + window.location.host, m = s.method, w = m === void 0 ? "get" : m, S = s.body;
1696
+ if (c.indexOf("/") === 0)
1697
+ c = "" + h + c;
1698
+ else if (!c.match(/^https?:\/\//) && c.indexOf(h) !== 0)
1699
+ throw new Error("Expected url to be http or https url, or absolute path, got " + JSON.stringify(c));
1700
+ if (w === "post")
1701
+ return u().then(function(x) {
1702
+ if (!x)
1703
+ throw new Error("Can not post to window without target name");
1704
+ (function(b) {
1705
+ var P = b.url, D = b.target, O = b.body, T = b.method, j = T === void 0 ? "post" : T, W = document.createElement("form");
1706
+ if (W.setAttribute("target", D), W.setAttribute("method", j), W.setAttribute("action", P), W.style.display = "none", O)
1707
+ for (var R = 0, _ = Object.keys(O); R < _.length; R++) {
1708
+ var A, he = _[R], De = document.createElement("input");
1709
+ De.setAttribute("name", he), De.setAttribute("value", (A = O[he]) == null ? void 0 : A.toString()), W.appendChild(De);
1710
+ }
1711
+ Ve().appendChild(W), W.submit(), Ve().removeChild(W);
1712
+ })({
1713
+ url: c,
1714
+ target: x,
1715
+ method: w,
1716
+ body: S
1717
+ });
1718
+ });
1719
+ if (w !== "get")
1720
+ throw new Error("Unsupported method: " + w);
1721
+ if (Q(p))
1722
+ try {
1723
+ if (p.location && typeof p.location.replace == "function") {
1724
+ p.location.replace(c);
1725
+ return;
1726
+ }
1727
+ } catch (x) {
1728
+ }
1729
+ p.location = c;
1730
+ });
1731
+ },
1732
+ setName: function(c) {
1733
+ return e.then(function(s) {
1734
+ var p = Q(s), h = Ge(s);
1735
+ if (!p)
1736
+ throw new Error("Can not set name for cross-domain window: " + c);
1737
+ ve(s).name = c, h && h.setAttribute("name", c), i = I.resolve(c);
1738
+ });
1739
+ }
1740
+ };
1741
+ }
1742
+ var G = function() {
1743
+ function e(t) {
1744
+ var r = t.send, o = t.win, i = t.serializedWindow;
1745
+ 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 I(), this.serializedWindow = i || it(this.actualWindowPromise, {
1746
+ send: r
1747
+ }), z("idToProxyWindow").set(this.getID(), this), o && this.setWindow(o, {
1748
+ send: r
1749
+ });
1750
+ }
1751
+ var n = e.prototype;
1752
+ return n.getID = function() {
1753
+ return this.serializedWindow.id;
1754
+ }, n.getType = function() {
1755
+ return this.serializedWindow.getType();
1756
+ }, n.isPopup = function() {
1757
+ return this.getType().then(function(t) {
1758
+ return t === "popup";
1759
+ });
1760
+ }, n.setLocation = function(t, r) {
1761
+ var o = this;
1762
+ return this.serializedWindow.setLocation(t, r).then(function() {
1763
+ return o;
1764
+ });
1765
+ }, n.getName = function() {
1766
+ return this.serializedWindow.getName();
1767
+ }, n.setName = function(t) {
1768
+ var r = this;
1769
+ return this.serializedWindow.setName(t).then(function() {
1770
+ return r;
1771
+ });
1772
+ }, n.close = function() {
1773
+ var t = this;
1774
+ return this.serializedWindow.close().then(function() {
1775
+ return t;
1776
+ });
1777
+ }, n.focus = function() {
1778
+ var t = this, r = this.isPopup(), o = this.getName(), i = I.hash({
1779
+ isPopup: r,
1780
+ name: o
1781
+ }).then(function(u) {
1782
+ var c = u.name;
1783
+ u.isPopup && c && window.open("", c, "noopener");
1784
+ }), a = this.serializedWindow.focus();
1785
+ return I.all([i, a]).then(function() {
1786
+ return t;
1787
+ });
1788
+ }, n.isClosed = function() {
1789
+ return this.serializedWindow.isClosed();
1790
+ }, n.getWindow = function() {
1791
+ return this.actualWindow;
1792
+ }, n.setWindow = function(t, r) {
1793
+ var o = r.send;
1794
+ this.actualWindow = t, this.actualWindowPromise.resolve(this.actualWindow), this.serializedWindow = it(this.actualWindowPromise, {
1795
+ send: o,
1796
+ id: this.getID()
1797
+ }), k("winToProxyWindow").set(t, this);
1798
+ }, n.awaitWindow = function() {
1799
+ return this.actualWindowPromise;
1800
+ }, n.matchWindow = function(t, r) {
1801
+ var o = this, i = r.send;
1802
+ return I.try(function() {
1803
+ return o.actualWindow ? t === o.actualWindow : I.hash({
1804
+ proxyInstanceID: o.getInstanceID(),
1805
+ knownWindowInstanceID: nt(t, {
1806
+ send: i
1807
+ })
1808
+ }).then(function(a) {
1809
+ var u = a.proxyInstanceID === a.knownWindowInstanceID;
1810
+ return u && o.setWindow(t, {
1811
+ send: i
1812
+ }), u;
1813
+ });
1814
+ });
1815
+ }, n.unwrap = function() {
1816
+ return this.actualWindow || this;
1817
+ }, n.getInstanceID = function() {
1818
+ return this.serializedWindow.getInstanceID();
1819
+ }, n.shouldClean = function() {
1820
+ return !!(this.actualWindow && $(this.actualWindow));
1821
+ }, n.serialize = function() {
1822
+ return this.serializedWindow;
1823
+ }, e.unwrap = function(t) {
1824
+ return e.isProxyWindow(t) ? t.unwrap() : t;
1825
+ }, e.serialize = function(t, r) {
1826
+ var o = r.send;
1827
+ return Oe(), e.toProxyWindow(t, {
1828
+ send: o
1829
+ }).serialize();
1830
+ }, e.deserialize = function(t, r) {
1831
+ var o = r.send;
1832
+ return Oe(), z("idToProxyWindow").get(t.id) || new e({
1833
+ serializedWindow: t,
1834
+ send: o
1835
+ });
1836
+ }, e.isProxyWindow = function(t) {
1837
+ return !!(t && !we(t) && t.isProxyWindow);
1838
+ }, e.toProxyWindow = function(t, r) {
1839
+ var o = r.send;
1840
+ if (Oe(), e.isProxyWindow(t))
1841
+ return t;
1842
+ var i = t;
1843
+ return k("winToProxyWindow").get(i) || new e({
1844
+ win: i,
1845
+ send: o
1846
+ });
1847
+ }, e;
1848
+ }();
1849
+ function Re(e, n, t, r, o) {
1850
+ var i = k("methodStore"), a = z("proxyWindowMethods");
1851
+ G.isProxyWindow(r) ? a.set(e, {
1852
+ val: n,
1853
+ name: t,
1854
+ domain: o,
1855
+ source: r
1856
+ }) : (a.del(e), i.getOrSet(r, function() {
1857
+ return {};
1858
+ })[e] = {
1859
+ domain: o,
1860
+ name: t,
1861
+ val: n,
1862
+ source: r
1863
+ });
1864
+ }
1865
+ function at(e, n) {
1866
+ var t = k("methodStore"), r = z("proxyWindowMethods");
1867
+ return t.getOrSet(e, function() {
1868
+ return {};
1869
+ })[n] || r.get(n);
1870
+ }
1871
+ function st(e, n, t, r, o) {
1872
+ a = (i = {
1873
+ on: o.on,
1874
+ send: o.send
1875
+ }).on, u = i.send, z("builtinListeners").getOrSet("functionCalls", function() {
1876
+ return a("postrobot_method", {
1877
+ domain: "*"
1878
+ }, function(p) {
1879
+ var h = p.source, m = p.origin, w = p.data, S = w.id, x = w.name, b = at(h, S);
1880
+ if (!b)
1881
+ throw new Error("Could not find method '" + x + "' with id: " + w.id + " in " + L(window));
1882
+ var P = b.source, D = b.domain, O = b.val;
1883
+ return I.try(function() {
1884
+ if (!re(D, m))
1885
+ throw new Error("Method '" + w.name + "' domain " + JSON.stringify(Ie(b.domain) ? b.domain.source : b.domain) + " does not match origin " + m + " in " + L(window));
1886
+ if (G.isProxyWindow(P))
1887
+ return P.matchWindow(h, {
1888
+ send: u
1889
+ }).then(function(T) {
1890
+ if (!T)
1891
+ throw new Error("Method call '" + w.name + "' failed - proxy window does not match source in " + L(window));
1892
+ });
1893
+ }).then(function() {
1894
+ return O.apply({
1895
+ source: h,
1896
+ origin: m
1897
+ }, w.args);
1898
+ }, function(T) {
1899
+ return I.try(function() {
1900
+ if (O.onError)
1901
+ return O.onError(T);
1902
+ }).then(function() {
1903
+ throw T.stack && (T.stack = "Remote call to " + x + "(" + function(j) {
1904
+ return j === void 0 && (j = []), (W = j, [].slice.call(W)).map(function(R) {
1905
+ return typeof R == "string" ? "'" + R + "'" : R === void 0 ? "undefined" : R === null ? "null" : typeof R == "boolean" ? R.toString() : Array.isArray(R) ? "[ ... ]" : typeof R == "object" ? "{ ... }" : typeof R == "function" ? "() => { ... }" : "<" + typeof R + ">";
1906
+ }).join(", ");
1907
+ var W;
1908
+ }(w.args) + `) failed
1909
+
1910
+ ` + T.stack), T;
1911
+ });
1912
+ }).then(function(T) {
1913
+ return {
1914
+ result: T,
1915
+ id: S,
1916
+ name: x
1917
+ };
1918
+ });
1919
+ });
1920
+ });
1921
+ var i, a, u, c = t.__id__ || Y();
1922
+ e = G.unwrap(e);
1923
+ var s = t.__name__ || t.name || r;
1924
+ return typeof s == "string" && typeof s.indexOf == "function" && s.indexOf("anonymous::") === 0 && (s = s.replace("anonymous::", r + "::")), G.isProxyWindow(e) ? (Re(c, t, s, e, n), e.awaitWindow().then(function(p) {
1925
+ Re(c, t, s, p, n);
1926
+ })) : Re(c, t, s, e, n), ne("cross_domain_function", {
1927
+ id: c,
1928
+ name: s
1929
+ });
1930
+ }
1931
+ function ct(e, n, t, r) {
1932
+ var o, i = r.on, a = r.send;
1933
+ return function(u, c) {
1934
+ c === void 0 && (c = Ht);
1935
+ var s = JSON.stringify(u, function(p) {
1936
+ var h = this[p];
1937
+ if (Te(this))
1938
+ return h;
1939
+ var m = ot(h);
1940
+ if (!m)
1941
+ return h;
1942
+ var w = c[m] || kt[m];
1943
+ return w ? w(h, p) : h;
1944
+ });
1945
+ return s === void 0 ? "undefined" : s;
1946
+ }(t, ((o = {}).promise = function(u, c) {
1947
+ return function(s, p, h, m, w) {
1948
+ return ne("cross_domain_zalgo_promise", {
1949
+ then: st(s, p, function(S, x) {
1950
+ return h.then(S, x);
1951
+ }, m, {
1952
+ on: w.on,
1953
+ send: w.send
1954
+ })
1955
+ });
1956
+ }(e, n, u, c, {
1957
+ on: i,
1958
+ send: a
1959
+ });
1960
+ }, o.function = function(u, c) {
1961
+ return st(e, n, u, c, {
1962
+ on: i,
1963
+ send: a
1964
+ });
1965
+ }, o.object = function(u) {
1966
+ return we(u) || G.isProxyWindow(u) ? ne("cross_domain_window", G.serialize(u, {
1967
+ send: a
1968
+ })) : u;
1969
+ }, o));
1970
+ }
1971
+ function ut(e, n, t, r) {
1972
+ var o, i = r.send;
1973
+ return function(a, u) {
1974
+ if (u === void 0 && (u = Ut), a !== "undefined")
1975
+ return JSON.parse(a, function(c, s) {
1976
+ if (Te(this))
1977
+ return s;
1978
+ var p, h;
1979
+ if (Te(s) ? (p = s.__type__, h = s.__val__) : (p = ot(s), h = s), !p)
1980
+ return h;
1981
+ var m = u[p] || Ft[p];
1982
+ return m ? m(h, c) : h;
1983
+ });
1984
+ }(t, ((o = {}).cross_domain_zalgo_promise = function(a) {
1985
+ return function(u, c, s) {
1986
+ return new I(s.then);
1987
+ }(0, 0, a);
1988
+ }, o.cross_domain_function = function(a) {
1989
+ return function(u, c, s, p) {
1990
+ var h = s.id, m = s.name, w = p.send, S = function(b) {
1991
+ b === void 0 && (b = {});
1992
+ function P() {
1993
+ var D = arguments;
1994
+ return G.toProxyWindow(u, {
1995
+ send: w
1996
+ }).awaitWindow().then(function(O) {
1997
+ var T = at(O, h);
1998
+ if (T && T.val !== P)
1999
+ return T.val.apply({
2000
+ source: window,
2001
+ origin: L()
2002
+ }, D);
2003
+ var j = [].slice.call(D);
2004
+ return b.fireAndForget ? w(O, "postrobot_method", {
2005
+ id: h,
2006
+ name: m,
2007
+ args: j
2008
+ }, {
2009
+ domain: c,
2010
+ fireAndForget: !0
2011
+ }) : w(O, "postrobot_method", {
2012
+ id: h,
2013
+ name: m,
2014
+ args: j
2015
+ }, {
2016
+ domain: c,
2017
+ fireAndForget: !1
2018
+ }).then(function(W) {
2019
+ return W.data.result;
2020
+ });
2021
+ }).catch(function(O) {
2022
+ throw O;
2023
+ });
2024
+ }
2025
+ return P.__name__ = m, P.__origin__ = c, P.__source__ = u, P.__id__ = h, P.origin = c, P;
2026
+ }, x = S();
2027
+ return x.fireAndForget = S({
2028
+ fireAndForget: !0
2029
+ }), x;
2030
+ }(e, n, a, {
2031
+ send: i
2032
+ });
2033
+ }, o.cross_domain_window = function(a) {
2034
+ return G.deserialize(a, {
2035
+ send: i
2036
+ });
2037
+ }, o));
2038
+ }
2039
+ var Ae = {};
2040
+ Ae.postrobot_post_message = function(e, n, t) {
2041
+ t.indexOf("file:") === 0 && (t = "*"), e.postMessage(n, t);
2042
+ };
2043
+ function Ne(e, n, t, r) {
2044
+ var o = r.on, i = r.send;
2045
+ return I.try(function() {
2046
+ var a = k().getOrSet(e, function() {
2047
+ return {};
2048
+ });
2049
+ return a.buffer = a.buffer || [], a.buffer.push(t), a.flush = a.flush || I.flush().then(function() {
2050
+ if ($(e))
2051
+ throw new Error("Window is closed");
2052
+ var u = ct(e, n, ((c = {}).__post_robot_10_0_46__ = a.buffer || [], c), {
2053
+ on: o,
2054
+ send: i
2055
+ }), c;
2056
+ delete a.buffer;
2057
+ for (var s = Object.keys(Ae), p = [], h = 0; h < s.length; h++) {
2058
+ var m = s[h];
2059
+ try {
2060
+ Ae[m](e, u, n);
2061
+ } catch (w) {
2062
+ p.push(w);
2063
+ }
2064
+ }
2065
+ if (p.length === s.length)
2066
+ throw new Error(`All post-robot messaging strategies failed:
2067
+
2068
+ ` + p.map(function(w, S) {
2069
+ return S + ". " + de(w);
2070
+ }).join(`
2071
+
2072
+ `));
2073
+ }), a.flush.then(function() {
2074
+ delete a.flush;
2075
+ });
2076
+ }).then(te);
2077
+ }
2078
+ function dt(e) {
2079
+ return z("responseListeners").get(e);
2080
+ }
2081
+ function ft(e) {
2082
+ z("responseListeners").del(e);
2083
+ }
2084
+ function lt(e) {
2085
+ return z("erroredResponseListeners").has(e);
2086
+ }
2087
+ function ht(e) {
2088
+ var n = e.name, t = e.win, r = e.domain, o = k("requestListeners");
2089
+ if (t === "*" && (t = null), r === "*" && (r = null), !n)
2090
+ throw new Error("Name required to get request listener");
2091
+ for (var i = 0, a = [t, xe()]; i < a.length; i++) {
2092
+ var u = a[i];
2093
+ if (u) {
2094
+ var c = o.get(u);
2095
+ if (c) {
2096
+ var s = c[n];
2097
+ if (s) {
2098
+ if (r && typeof r == "string") {
2099
+ if (s[r])
2100
+ return s[r];
2101
+ if (s.__domain_regex__)
2102
+ for (var p = 0, h = s.__domain_regex__; p < h.length; p++) {
2103
+ var m = h[p], w = m.listener;
2104
+ if (re(m.regex, r))
2105
+ return w;
2106
+ }
2107
+ }
2108
+ if (s["*"])
2109
+ return s["*"];
2110
+ }
2111
+ }
2112
+ }
2113
+ }
2114
+ }
2115
+ function Gt(e, n, t, r) {
2116
+ var o = r.on, i = r.send, a = ht({
2117
+ name: t.name,
2118
+ win: e,
2119
+ domain: n
2120
+ }), u = t.name === "postrobot_method" && t.data && typeof t.data.name == "string" ? t.data.name + "()" : t.name;
2121
+ function c(s, p, h) {
2122
+ return I.flush().then(function() {
2123
+ if (!t.fireAndForget && !$(e))
2124
+ try {
2125
+ return Ne(e, n, {
2126
+ id: Y(),
2127
+ origin: L(window),
2128
+ type: "postrobot_message_response",
2129
+ hash: t.hash,
2130
+ name: t.name,
2131
+ ack: s,
2132
+ data: p,
2133
+ error: h
2134
+ }, {
2135
+ on: o,
2136
+ send: i
2137
+ });
2138
+ } catch (m) {
2139
+ throw new Error("Send response message failed for " + u + " in " + L() + `
2140
+
2141
+ ` + de(m));
2142
+ }
2143
+ });
2144
+ }
2145
+ return I.all([I.flush().then(function() {
2146
+ if (!t.fireAndForget && !$(e))
2147
+ try {
2148
+ return Ne(e, n, {
2149
+ id: Y(),
2150
+ origin: L(window),
2151
+ type: "postrobot_message_ack",
2152
+ hash: t.hash,
2153
+ name: t.name
2154
+ }, {
2155
+ on: o,
2156
+ send: i
2157
+ });
2158
+ } catch (s) {
2159
+ throw new Error("Send ack message failed for " + u + " in " + L() + `
2160
+
2161
+ ` + de(s));
2162
+ }
2163
+ }), I.try(function() {
2164
+ if (!a)
2165
+ throw new Error("No handler found for post message: " + t.name + " from " + n + " in " + window.location.protocol + "//" + window.location.host + window.location.pathname);
2166
+ return a.handler({
2167
+ source: e,
2168
+ origin: n,
2169
+ data: t.data
2170
+ });
2171
+ }).then(function(s) {
2172
+ return c("success", s);
2173
+ }, function(s) {
2174
+ return c("error", null, s);
2175
+ })]).then(te).catch(function(s) {
2176
+ if (a && a.handleError)
2177
+ return a.handleError(s);
2178
+ throw s;
2179
+ });
2180
+ }
2181
+ function Bt(e, n, t) {
2182
+ if (!lt(t.hash)) {
2183
+ var r = dt(t.hash);
2184
+ if (!r)
2185
+ 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);
2186
+ try {
2187
+ if (!re(r.domain, n))
2188
+ throw new Error("Ack origin " + n + " does not match domain " + r.domain.toString());
2189
+ if (e !== r.win)
2190
+ throw new Error("Ack source does not match registered window");
2191
+ } catch (o) {
2192
+ r.promise.reject(o);
2193
+ }
2194
+ r.ack = !0;
2195
+ }
2196
+ }
2197
+ function $t(e, n, t) {
2198
+ if (!lt(t.hash)) {
2199
+ var r = dt(t.hash);
2200
+ if (!r)
2201
+ 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);
2202
+ if (!re(r.domain, n))
2203
+ 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()));
2204
+ var o;
2205
+ if (e !== r.win)
2206
+ throw new Error("Response source does not match registered window");
2207
+ ft(t.hash), t.ack === "error" ? r.promise.reject(t.error) : t.ack === "success" && r.promise.resolve({
2208
+ source: e,
2209
+ origin: n,
2210
+ data: t.data
2211
+ });
2212
+ }
2213
+ }
2214
+ function mt(e, n) {
2215
+ var t = n.on, r = n.send, o = z("receivedMessages");
2216
+ try {
2217
+ if (!window || window.closed || !e.source)
2218
+ return;
2219
+ } catch (p) {
2220
+ return;
2221
+ }
2222
+ var i = e.source, a = e.origin, u = function(p, h, m, w) {
2223
+ var S = w.on, x = w.send, b;
2224
+ try {
2225
+ b = ut(h, m, p, {
2226
+ on: S,
2227
+ send: x
2228
+ });
2229
+ } catch (D) {
2230
+ return;
2231
+ }
2232
+ if (b && typeof b == "object" && b !== null) {
2233
+ var P = b.__post_robot_10_0_46__;
2234
+ if (Array.isArray(P))
2235
+ return P;
2236
+ }
2237
+ }(e.data, i, a, {
2238
+ on: t,
2239
+ send: r
2240
+ });
2241
+ if (u) {
2242
+ rt(i);
2243
+ for (var c = 0; c < u.length; c++) {
2244
+ var s = u[c];
2245
+ if (o.has(s.id) || (o.set(s.id, !0), $(i) && !s.fireAndForget))
2246
+ return;
2247
+ s.origin.indexOf("file:") === 0 && (a = "file://");
2248
+ try {
2249
+ s.type === "postrobot_message_request" ? Gt(i, a, s, {
2250
+ on: t,
2251
+ send: r
2252
+ }) : s.type === "postrobot_message_response" ? $t(i, a, s) : s.type === "postrobot_message_ack" && Bt(i, a, s);
2253
+ } catch (p) {
2254
+ setTimeout(function() {
2255
+ throw p;
2256
+ }, 0);
2257
+ }
2258
+ }
2259
+ }
2260
+ }
2261
+ function X(e, n, t) {
2262
+ if (!e)
2263
+ throw new Error("Expected name");
2264
+ if (typeof (n = n || {}) == "function" && (t = n, n = {}), !t)
2265
+ throw new Error("Expected handler");
2266
+ var r = function o(i, a) {
2267
+ var u = i.name, c = i.win, s = i.domain, p = k("requestListeners");
2268
+ if (!u || typeof u != "string")
2269
+ throw new Error("Name required to add request listener");
2270
+ if (c && c !== "*" && G.isProxyWindow(c)) {
2271
+ var h = c.awaitWindow().then(function(A) {
2272
+ return o({
2273
+ name: u,
2274
+ win: A,
2275
+ domain: s
2276
+ }, a);
2277
+ });
2278
+ return {
2279
+ cancel: function() {
2280
+ h.then(function(A) {
2281
+ return A.cancel();
2282
+ }, te);
2283
+ }
2284
+ };
2285
+ }
2286
+ var m = c;
2287
+ if (Array.isArray(m)) {
2288
+ for (var w = [], S = 0, x = m; S < x.length; S++)
2289
+ w.push(o({
2290
+ name: u,
2291
+ domain: s,
2292
+ win: x[S]
2293
+ }, a));
2294
+ return {
2295
+ cancel: function() {
2296
+ for (var A = 0; A < w.length; A++)
2297
+ w[A].cancel();
2298
+ }
2299
+ };
2300
+ }
2301
+ if (Array.isArray(s)) {
2302
+ for (var b = [], P = 0, D = s; P < D.length; P++)
2303
+ b.push(o({
2304
+ name: u,
2305
+ win: m,
2306
+ domain: D[P]
2307
+ }, a));
2308
+ return {
2309
+ cancel: function() {
2310
+ for (var A = 0; A < b.length; A++)
2311
+ b[A].cancel();
2312
+ }
2313
+ };
2314
+ }
2315
+ var O = ht({
2316
+ name: u,
2317
+ win: m,
2318
+ domain: s
2319
+ });
2320
+ m && m !== "*" || (m = xe());
2321
+ var T = (s = s || "*").toString();
2322
+ if (O)
2323
+ throw m && s ? new Error("Request listener already exists for " + u + " on domain " + s.toString() + " for " + (m === xe() ? "wildcard" : "specified") + " window") : m ? new Error("Request listener already exists for " + u + " for " + (m === xe() ? "wildcard" : "specified") + " window") : s ? new Error("Request listener already exists for " + u + " on domain " + s.toString()) : new Error("Request listener already exists for " + u);
2324
+ var j = p.getOrSet(m, function() {
2325
+ return {};
2326
+ }), W = fe(j, u, function() {
2327
+ return {};
2328
+ }), R, _;
2329
+ return Ie(s) ? (R = fe(W, "__domain_regex__", function() {
2330
+ return [];
2331
+ })).push(_ = {
2332
+ regex: s,
2333
+ listener: a
2334
+ }) : W[T] = a, {
2335
+ cancel: function() {
2336
+ delete W[T], _ && (R.splice(R.indexOf(_, 1)), R.length || delete W.__domain_regex__), Object.keys(W).length || delete j[u], m && !Object.keys(j).length && p.del(m);
2337
+ }
2338
+ };
2339
+ }({
2340
+ name: e,
2341
+ win: n.window,
2342
+ domain: n.domain || "*"
2343
+ }, {
2344
+ handler: t || n.handler,
2345
+ handleError: n.errorHandler || function(o) {
2346
+ throw o;
2347
+ }
2348
+ });
2349
+ return {
2350
+ cancel: function() {
2351
+ r.cancel();
2352
+ }
2353
+ };
2354
+ }
2355
+ function _t(e, n, t) {
2356
+ typeof (n = n || {}) == "function" && (t = n, n = {});
2357
+ var r = new I(), o;
2358
+ return n.errorHandler = function(i) {
2359
+ o.cancel(), r.reject(i);
2360
+ }, o = X(e, n, function(i) {
2361
+ if (o.cancel(), r.resolve(i), t)
2362
+ return t(i);
2363
+ }), r.cancel = o.cancel, r;
2364
+ }
2365
+ var K = function e(n, t, r, o) {
2366
+ var i = (o = o || {}).domain || "*", a = o.timeout || -1, u = o.timeout || 5e3, c = o.fireAndForget || !1;
2367
+ return G.toProxyWindow(n, {
2368
+ send: e
2369
+ }).awaitWindow().then(function(s) {
2370
+ return I.try(function() {
2371
+ if (function(p, h, m) {
2372
+ if (!p)
2373
+ throw new Error("Expected name");
2374
+ if (m && typeof m != "string" && !Array.isArray(m) && !Ie(m))
2375
+ throw new TypeError("Can not send " + p + ". Expected domain " + JSON.stringify(m) + " to be a string, array, or regex");
2376
+ if ($(h))
2377
+ throw new Error("Can not send " + p + ". Target window is closed");
2378
+ }(t, s, i), function(p, h) {
2379
+ var m = Ue(h);
2380
+ if (m)
2381
+ return m === p;
2382
+ if (h === p || function(x) {
2383
+ x === void 0 && (x = window);
2384
+ try {
2385
+ if (x.top)
2386
+ return x.top;
2387
+ } catch (O) {
2388
+ }
2389
+ if (B(x) === x)
2390
+ return x;
2391
+ try {
2392
+ if (He(window, x) && window.top)
2393
+ return window.top;
2394
+ } catch (O) {
2395
+ }
2396
+ try {
2397
+ if (He(x, window) && window.top)
2398
+ return window.top;
2399
+ } catch (O) {
2400
+ }
2401
+ for (var b = 0, P = function O(T) {
2402
+ for (var j = [], W = 0, R = Fe(T); W < R.length; W++) {
2403
+ var _ = R[W];
2404
+ j.push(_);
2405
+ for (var A = 0, he = O(_); A < he.length; A++)
2406
+ j.push(he[A]);
2407
+ }
2408
+ return j;
2409
+ }(x); b < P.length; b++) {
2410
+ var D = P[b];
2411
+ try {
2412
+ if (D.top)
2413
+ return D.top;
2414
+ } catch (O) {
2415
+ }
2416
+ if (B(D) === D)
2417
+ return D;
2418
+ }
2419
+ }(h) === h)
2420
+ return !1;
2421
+ for (var w = 0, S = Fe(p); w < S.length; w++)
2422
+ if (S[w] === h)
2423
+ return !0;
2424
+ return !1;
2425
+ }(window, s))
2426
+ return function(p, h, m) {
2427
+ h === void 0 && (h = 5e3), m === void 0 && (m = "Window");
2428
+ var w = function(S) {
2429
+ return k("helloPromises").getOrSet(S, function() {
2430
+ return new I();
2431
+ });
2432
+ }(p);
2433
+ return h !== -1 && (w = w.timeout(h, new Error(m + " did not load after " + h + "ms"))), w;
2434
+ }(s, u);
2435
+ }).then(function(p) {
2436
+ return function(h, m, w, S) {
2437
+ var x = S.send;
2438
+ return I.try(function() {
2439
+ return typeof m == "string" ? m : I.try(function() {
2440
+ return w || Pe(h, {
2441
+ send: x
2442
+ }).then(function(b) {
2443
+ return b.domain;
2444
+ });
2445
+ }).then(function(b) {
2446
+ if (!re(m, m))
2447
+ throw new Error("Domain " + Ze(m) + " does not match " + Ze(m));
2448
+ return b;
2449
+ });
2450
+ });
2451
+ }(s, i, (p === void 0 ? {} : p).domain, {
2452
+ send: e
2453
+ });
2454
+ }).then(function(p) {
2455
+ var h = p, m = t === "postrobot_method" && r && typeof r.name == "string" ? r.name + "()" : t, w = new I(), S = t + "_" + Y();
2456
+ if (!c) {
2457
+ var x = {
2458
+ name: t,
2459
+ win: s,
2460
+ domain: h,
2461
+ promise: w
2462
+ };
2463
+ (function(W, R) {
2464
+ z("responseListeners").set(W, R);
2465
+ })(S, x);
2466
+ var b = k("requestPromises").getOrSet(s, function() {
2467
+ return [];
2468
+ });
2469
+ b.push(w), w.catch(function() {
2470
+ (function(W) {
2471
+ z("erroredResponseListeners").set(W, !0);
2472
+ })(S), ft(S);
2473
+ });
2474
+ var P = function(W) {
2475
+ return k("knownWindows").get(W, !1);
2476
+ }(s) ? 1e4 : 2e3, D = a, O = P, T = D, j = function(W, R) {
2477
+ var _;
2478
+ return function A() {
2479
+ _ = setTimeout(function() {
2480
+ (function() {
2481
+ if ($(s))
2482
+ return w.reject(new Error("Window closed for " + t + " before " + (x.ack ? "response" : "ack")));
2483
+ if (x.cancelled)
2484
+ return w.reject(new Error("Response listener was cancelled for " + t));
2485
+ O = Math.max(O - 500, 0), T !== -1 && (T = Math.max(T - 500, 0)), x.ack || O !== 0 ? T === 0 && w.reject(new Error("No response for postMessage " + m + " in " + L() + " in " + D + "ms")) : w.reject(new Error("No ack for postMessage " + m + " in " + L() + " in " + P + "ms"));
2486
+ })(), A();
2487
+ }, 500);
2488
+ }(), {
2489
+ cancel: function() {
2490
+ clearTimeout(_);
2491
+ }
2492
+ };
2493
+ }();
2494
+ w.finally(function() {
2495
+ j.cancel(), b.splice(b.indexOf(w, 1));
2496
+ }).catch(te);
2497
+ }
2498
+ return Ne(s, h, {
2499
+ id: Y(),
2500
+ origin: L(window),
2501
+ type: "postrobot_message_request",
2502
+ hash: S,
2503
+ name: t,
2504
+ data: r,
2505
+ fireAndForget: c
2506
+ }, {
2507
+ on: X,
2508
+ send: e
2509
+ }).then(function() {
2510
+ return c ? w.resolve() : w;
2511
+ }, function(W) {
2512
+ throw new Error("Send request message failed for " + m + " in " + L() + `
2513
+
2514
+ ` + de(W));
2515
+ });
2516
+ });
2517
+ });
2518
+ };
2519
+ function qt(e, n, t) {
2520
+ return ct(e, n, t, {
2521
+ on: X,
2522
+ send: K
2523
+ });
2524
+ }
2525
+ function Jt(e, n, t) {
2526
+ return ut(e, n, t, {
2527
+ on: X,
2528
+ send: K
2529
+ });
2530
+ }
2531
+ function Yt(e) {
2532
+ return new G({
2533
+ send: K,
2534
+ win: e
2535
+ });
2536
+ }
2537
+ function Zt(e) {
2538
+ return G.toProxyWindow(e, {
2539
+ send: K
2540
+ });
2541
+ }
2542
+ function pt() {
2543
+ le().initialized || (le().initialized = !0, n = (e = {
2544
+ on: X,
2545
+ send: K
2546
+ }).on, t = e.send, (r = le()).receiveMessage = r.receiveMessage || function(o) {
2547
+ return mt(o, {
2548
+ on: n,
2549
+ send: t
2550
+ });
2551
+ }, function(o) {
2552
+ var i = o.on, a = o.send;
2553
+ z().getOrSet("postMessageListener", function() {
2554
+ return function(u, c, s) {
2555
+ return u.addEventListener("message", s), {
2556
+ cancel: function() {
2557
+ u.removeEventListener("message", s);
2558
+ }
2559
+ };
2560
+ }(window, 0, function(u) {
2561
+ (function(c, s) {
2562
+ var p = s.on, h = s.send;
2563
+ I.try(function() {
2564
+ var m = c.source || c.sourceElement, w = c.origin || c.originalEvent && c.originalEvent.origin, S = c.data;
2565
+ if (w === "null" && (w = "file://"), m) {
2566
+ if (!w)
2567
+ throw new Error("Post message did not have origin domain");
2568
+ mt({
2569
+ source: m,
2570
+ origin: w,
2571
+ data: S
2572
+ }, {
2573
+ on: p,
2574
+ send: h
2575
+ });
2576
+ }
2577
+ });
2578
+ })(u, {
2579
+ on: i,
2580
+ send: a
2581
+ });
2582
+ });
2583
+ });
2584
+ }({
2585
+ on: X,
2586
+ send: K
2587
+ }), function(o) {
2588
+ var i = o.on, a = o.send;
2589
+ z("builtinListeners").getOrSet("helloListener", function() {
2590
+ var u = i("postrobot_hello", {
2591
+ domain: "*"
2592
+ }, function(s) {
2593
+ return tt(s.source, {
2594
+ domain: s.origin
2595
+ }), {
2596
+ instanceID: et()
2597
+ };
2598
+ }), c = Ue();
2599
+ return c && Pe(c, {
2600
+ send: a
2601
+ }).catch(function(s) {
2602
+ }), u;
2603
+ });
2604
+ }({
2605
+ on: X,
2606
+ send: K
2607
+ }));
2608
+ var e, n, t, r;
2609
+ }
2610
+ function Vt() {
2611
+ (function() {
2612
+ for (var n = z("responseListeners"), t = 0, r = n.keys(); t < r.length; t++) {
2613
+ var o = r[t], i = n.get(o);
2614
+ i && (i.cancelled = !0), n.del(o);
2615
+ }
2616
+ })(), (e = z().get("postMessageListener")) && e.cancel();
2617
+ var e;
2618
+ delete window.__post_robot_10_0_46__;
2619
+ }
2620
+ var Xt = !0;
2621
+ function Kt(e) {
2622
+ for (var n = 0, t = k("requestPromises").get(e, []); n < t.length; n++)
2623
+ t[n].reject(new Error("Window " + ($(e) ? "closed" : "cleaned up") + " before response")).catch(te);
2624
+ }
2625
+ pt();
2626
+ }]);
2627
+ });
2628
+ })(Tt);
2629
+ var Mn = Tt.exports;
2630
+ (function(f) {
2631
+ f.exports = Mn, f.exports.default = f.exports;
2632
+ })(Pt);
2633
+ var Ot = Pt.exports;
2634
+ const Ln = /* @__PURE__ */ jn(Ot), ke = /* @__PURE__ */ rn({
2635
+ __proto__: null,
2636
+ default: Ln
2637
+ }, [Ot]);
295
2638
  export {
296
- at as ConsentBox,
297
- rt as SoyioTypes,
298
- lt as SoyioWidget,
299
- V as _TooltipManager,
300
- lt as default
2639
+ Hn as ConsentBox,
2640
+ Fn as SoyioTypes,
2641
+ Un as SoyioWidget,
2642
+ Sn as _TooltipManager,
2643
+ Un as default
301
2644
  };