@soyio/soyio-widget 2.7.4 → 2.8.1
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/README.md +2 -0
- package/dist/index.js +276 -145
- package/dist/index.umd.cjs +107 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -305,6 +305,7 @@ The **`ConsentBox`** is a component that allows you to embed a consent request d
|
|
|
305
305
|
actionToken: "<action token>", // Optional
|
|
306
306
|
entityId: "<entity id>", // Optional
|
|
307
307
|
context: "<context>", // Optional
|
|
308
|
+
onReady: () => console.log("ConsentBox is ready"), // Optional
|
|
308
309
|
};
|
|
309
310
|
|
|
310
311
|
// Wait for DOM to be fully loaded
|
|
@@ -349,6 +350,7 @@ The `onEvent` follows the following format:
|
|
|
349
350
|
- **`actionToken`**: In case of losing the state of the consent (i.e. page reload), you can use a previously generated `actionToken` to restore the state of the consent.
|
|
350
351
|
- **`entityId`**: Identifier of the `entity` associated with a `ConsentAction`. If provided and a consent was previously granted by this entity, the UI will display a message indicating that consent has already been given.
|
|
351
352
|
- **`context`**: Additional information that will be saved with the consent. Useful when you want to track the consent from a specific context.
|
|
353
|
+
- **`onReady`**: Optional callback that executes when the consent box is ready to use. You can use this to handle logic when the iframe is not mounted yet.
|
|
352
354
|
|
|
353
355
|
# Appearance
|
|
354
356
|
|
package/dist/index.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
if (!
|
|
1
|
+
var N = Object.defineProperty;
|
|
2
|
+
var L = (t, e, n) => e in t ? N(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var r = (t, e, n) => (L(t, typeof e != "symbol" ? e + "" : e, n), n), H = (t, e, n) => {
|
|
4
|
+
if (!e.has(t))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
8
|
-
if (
|
|
7
|
+
var T = (t, e, n) => {
|
|
8
|
+
if (e.has(t))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
|
-
|
|
10
|
+
e instanceof WeakSet ? e.add(t) : e.set(t, n);
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
async function
|
|
14
|
-
if (!
|
|
12
|
+
var x = (t, e, n) => (H(t, e, "access private method"), n);
|
|
13
|
+
async function A(t, e, n) {
|
|
14
|
+
if (!t.contentWindow)
|
|
15
15
|
throw new Error("Invalid iframe: contentWindow is null");
|
|
16
|
-
const
|
|
16
|
+
const i = await import("./index-yZw-yxuV.js").then((o) => o.i);
|
|
17
17
|
try {
|
|
18
|
-
await
|
|
19
|
-
} catch (
|
|
20
|
-
console.error("Failed to send appearance config:",
|
|
18
|
+
await i.send(t.contentWindow, "SET_APPEARANCE", { appearance: e, identifier: n });
|
|
19
|
+
} catch (o) {
|
|
20
|
+
console.error("Failed to send appearance config:", o);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const R = "https://app.soyio.id", k = "https://sandbox.soyio.id", P = [
|
|
24
24
|
"DISCLOSURE_REQUEST_SUCCESSFUL",
|
|
25
25
|
"IDENTITY_REGISTERED",
|
|
26
26
|
"IDENTITY_SIGNATURE",
|
|
27
27
|
"UNEXPECTED_ERROR",
|
|
28
28
|
"DENIED_CAMERA_PERMISSION",
|
|
29
29
|
"REJECTED_SIGNATURE"
|
|
30
|
-
],
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
|
|
30
|
+
], D = "WIDGET_CLOSED", $ = 420, U = 720, O = 500;
|
|
31
|
+
function G(t) {
|
|
32
|
+
const e = document.getElementById(t);
|
|
33
|
+
e && (console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."), e.remove());
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
38
|
-
throw new Error(`Iframe div container with id '${
|
|
39
|
-
if (
|
|
40
|
-
throw new Error(`Iframe container with id '${
|
|
41
|
-
const n =
|
|
35
|
+
function F(t) {
|
|
36
|
+
const e = document.querySelector(t);
|
|
37
|
+
if (!e)
|
|
38
|
+
throw new Error(`Iframe div container with id '${t}' not found`);
|
|
39
|
+
if (e.tagName.toLowerCase() !== "div")
|
|
40
|
+
throw new Error(`Iframe container with id '${t}' must be a <div> element`);
|
|
41
|
+
const n = e;
|
|
42
42
|
return n.style.position = "relative", n.style.cssText += `
|
|
43
43
|
padding: 0 !important;
|
|
44
44
|
margin: 0 !important;
|
|
@@ -50,9 +50,9 @@ function G(e) {
|
|
|
50
50
|
opacity: 1 !important;
|
|
51
51
|
`, n;
|
|
52
52
|
}
|
|
53
|
-
function M(
|
|
53
|
+
function M(t, e) {
|
|
54
54
|
const n = document.createElement("iframe");
|
|
55
|
-
return n.id =
|
|
55
|
+
return n.id = e, n.src = t, n.style.cssText += `
|
|
56
56
|
width: 100% !important;
|
|
57
57
|
min-width: 375px !important;
|
|
58
58
|
max-width: 36rem !important;
|
|
@@ -64,68 +64,198 @@ function M(e, t) {
|
|
|
64
64
|
opacity 0.4s 0.1s;
|
|
65
65
|
`, n;
|
|
66
66
|
}
|
|
67
|
-
function q(
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
function q(t) {
|
|
68
|
+
const e = ["actionToken", "entityId", "context"], n = t.isSandbox ?? !1, i = t.developmentUrl || (n ? k : R), o = new URLSearchParams();
|
|
69
|
+
e.forEach((a) => {
|
|
70
|
+
t[a] && o.set(a, t[a]);
|
|
71
71
|
});
|
|
72
|
-
const s =
|
|
73
|
-
return `${
|
|
72
|
+
const s = o.toString();
|
|
73
|
+
return `${i}/embed/consents/${t.consentTemplateId}${s ? `?${s}` : ""}`;
|
|
74
74
|
}
|
|
75
|
-
const W = "IFRAME_READY",
|
|
75
|
+
const W = "IFRAME_READY", z = "CONSENT_STATE_CHANGE", B = "IFRAME_HEIGHT_CHANGE", j = "TOOLTIP_STATE_CHANGE", l = {
|
|
76
76
|
onHeightChange: {},
|
|
77
77
|
onIframeReady: {},
|
|
78
78
|
onStateChange: {},
|
|
79
79
|
onTooltipChange: {}
|
|
80
80
|
};
|
|
81
|
-
let
|
|
81
|
+
let b, I, v, S;
|
|
82
82
|
async function X() {
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
const n =
|
|
86
|
-
if (!
|
|
83
|
+
const t = await import("./index-yZw-yxuV.js").then((e) => e.i);
|
|
84
|
+
b || I || v || S || (b = t.on(B, async (e) => {
|
|
85
|
+
const n = e.data, i = l.onHeightChange[n.identifier];
|
|
86
|
+
if (!i)
|
|
87
87
|
throw new Error(`No height change listener found for identifier: ${n.identifier}`);
|
|
88
|
-
|
|
89
|
-
}),
|
|
90
|
-
const n =
|
|
91
|
-
if (!
|
|
88
|
+
i(n.height);
|
|
89
|
+
}), I = t.on(W, async (e) => {
|
|
90
|
+
const n = e.data, i = l.onIframeReady[n.identifier];
|
|
91
|
+
if (!i)
|
|
92
92
|
throw new Error(`No iframe ready listener found for identifier: ${n.identifier}`);
|
|
93
|
-
|
|
94
|
-
}),
|
|
95
|
-
const n =
|
|
96
|
-
if (!
|
|
93
|
+
i();
|
|
94
|
+
}), v = t.on(z, async (e) => {
|
|
95
|
+
const n = e.data, i = l.onStateChange[n.identifier];
|
|
96
|
+
if (!i)
|
|
97
97
|
throw new Error(`No state change listener found for identifier: ${n.identifier}`);
|
|
98
|
-
|
|
99
|
-
}),
|
|
100
|
-
const n =
|
|
101
|
-
if (!
|
|
98
|
+
i(n);
|
|
99
|
+
}), S = t.on(j, async (e) => {
|
|
100
|
+
const n = e.data, i = l.onTooltipChange[n.identifier];
|
|
101
|
+
if (!i)
|
|
102
102
|
throw new Error(`No tooltip change listener found for identifier: ${n.identifier}`);
|
|
103
|
-
|
|
103
|
+
i(n);
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
|
-
function Y(
|
|
106
|
+
function Y(t, e) {
|
|
107
107
|
const {
|
|
108
108
|
onHeightChange: n,
|
|
109
|
-
onIframeReady:
|
|
110
|
-
onStateChange:
|
|
109
|
+
onIframeReady: i,
|
|
110
|
+
onStateChange: o,
|
|
111
111
|
onTooltipChange: s
|
|
112
|
-
} =
|
|
113
|
-
|
|
112
|
+
} = e;
|
|
113
|
+
l.onHeightChange[t] = n, l.onIframeReady[t] = i, l.onStateChange[t] = o, l.onTooltipChange[t] = s;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
delete
|
|
115
|
+
function V(t) {
|
|
116
|
+
delete l.onHeightChange[t], delete l.onIframeReady[t], delete l.onStateChange[t], delete l.onTooltipChange[t];
|
|
117
117
|
}
|
|
118
|
-
class
|
|
118
|
+
class K {
|
|
119
|
+
constructor(e) {
|
|
120
|
+
r(this, "element");
|
|
121
|
+
r(this, "identifier");
|
|
122
|
+
this.identifier = `skeleton-${e}`, this.element = document.createElement("div"), this.element.id = this.identifier, this.element.style.cssText = `
|
|
123
|
+
position: absolute;
|
|
124
|
+
left: 50%;
|
|
125
|
+
top: 50%;
|
|
126
|
+
transform: translate(-50%, -50%);
|
|
127
|
+
width: 100%;
|
|
128
|
+
min-width: 375px;
|
|
129
|
+
max-width: 36rem;
|
|
130
|
+
height: 120px;
|
|
131
|
+
background: #FFFFFF;
|
|
132
|
+
border: 1px solid #E5E7EB;
|
|
133
|
+
border-radius: 0.25rem;
|
|
134
|
+
opacity: 1;
|
|
135
|
+
transition: opacity 0.3s ease-out;
|
|
136
|
+
display: flex;
|
|
137
|
+
flex-direction: column;
|
|
138
|
+
gap: 1rem;
|
|
139
|
+
`;
|
|
140
|
+
const n = document.createElement("div");
|
|
141
|
+
n.style.cssText = `
|
|
142
|
+
padding: 1rem;
|
|
143
|
+
height: 100%;
|
|
144
|
+
max-width: 100%;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
justify-content: space-between;
|
|
148
|
+
`;
|
|
149
|
+
const i = document.createElement("div");
|
|
150
|
+
i.style.cssText = `
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
gap: 0.75rem;
|
|
154
|
+
`;
|
|
155
|
+
const o = document.createElement("div");
|
|
156
|
+
o.style.cssText = `
|
|
157
|
+
width: 2rem;
|
|
158
|
+
height: 2rem;
|
|
159
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
160
|
+
background-size: 200% 100%;
|
|
161
|
+
animation: shimmer 1.5s infinite;
|
|
162
|
+
border-radius: 50%;
|
|
163
|
+
flex-shrink: 0;
|
|
164
|
+
`;
|
|
165
|
+
const s = document.createElement("div");
|
|
166
|
+
s.style.cssText = `
|
|
167
|
+
height: 1rem;
|
|
168
|
+
width: 30%;
|
|
169
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
170
|
+
background-size: 200% 100%;
|
|
171
|
+
animation: shimmer 1.5s infinite;
|
|
172
|
+
border-radius: 0.125rem;
|
|
173
|
+
`;
|
|
174
|
+
const a = document.createElement("div");
|
|
175
|
+
a.style.cssText = `
|
|
176
|
+
width: 1.5rem;
|
|
177
|
+
height: 1.5rem;
|
|
178
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
179
|
+
background-size: 200% 100%;
|
|
180
|
+
animation: shimmer 1.5s infinite;
|
|
181
|
+
border-radius: 50%;
|
|
182
|
+
margin-left: auto;
|
|
183
|
+
margin-right: 3px;
|
|
184
|
+
`;
|
|
185
|
+
const c = document.createElement("div");
|
|
186
|
+
c.style.cssText = `
|
|
187
|
+
display: flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
gap: 1rem;
|
|
190
|
+
`;
|
|
191
|
+
const m = document.createElement("div");
|
|
192
|
+
m.style.cssText = `
|
|
193
|
+
width: 1rem;
|
|
194
|
+
height: 1rem;
|
|
195
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
196
|
+
background-size: 200% 100%;
|
|
197
|
+
animation: shimmer 1.5s infinite;
|
|
198
|
+
border-radius: 0.25rem;
|
|
199
|
+
flex-shrink: 0;
|
|
200
|
+
margin-left: 10px;
|
|
201
|
+
`;
|
|
202
|
+
const h = document.createElement("div");
|
|
203
|
+
h.style.cssText = `
|
|
204
|
+
flex-grow: 1;
|
|
205
|
+
display: flex;
|
|
206
|
+
flex-direction: column;
|
|
207
|
+
gap: 0.5rem;
|
|
208
|
+
`;
|
|
209
|
+
const f = document.createElement("div");
|
|
210
|
+
f.style.cssText = `
|
|
211
|
+
height: 0.875rem;
|
|
212
|
+
width: 80%;
|
|
213
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
214
|
+
background-size: 200% 100%;
|
|
215
|
+
animation: shimmer 1.5s infinite;
|
|
216
|
+
border-radius: 0.125rem;
|
|
217
|
+
`;
|
|
218
|
+
const C = document.createElement("div");
|
|
219
|
+
if (C.style.cssText = `
|
|
220
|
+
height: 0.875rem;
|
|
221
|
+
width: 60%;
|
|
222
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
223
|
+
background-size: 200% 100%;
|
|
224
|
+
animation: shimmer 1.5s infinite;
|
|
225
|
+
border-radius: 0.125rem;
|
|
226
|
+
`, !document.getElementById("skeleton-animation")) {
|
|
227
|
+
const g = document.createElement("style");
|
|
228
|
+
g.id = "skeleton-animation", g.textContent = `
|
|
229
|
+
@keyframes shimmer {
|
|
230
|
+
0% { background-position: 200% 0; }
|
|
231
|
+
100% { background-position: -200% 0; }
|
|
232
|
+
}
|
|
233
|
+
`, document.head.appendChild(g);
|
|
234
|
+
}
|
|
235
|
+
i.appendChild(o), i.appendChild(s), i.appendChild(a), h.appendChild(f), h.appendChild(C), c.appendChild(m), c.appendChild(h), n.appendChild(i), n.appendChild(c), this.element.appendChild(n);
|
|
236
|
+
}
|
|
237
|
+
cleanupExistingSkeleton() {
|
|
238
|
+
const e = document.getElementById(this.identifier);
|
|
239
|
+
e && e.remove();
|
|
240
|
+
}
|
|
241
|
+
mount(e) {
|
|
242
|
+
this.cleanupExistingSkeleton(), e.appendChild(this.element);
|
|
243
|
+
}
|
|
244
|
+
hide() {
|
|
245
|
+
this.element.style.opacity = "0", setTimeout(() => this.element.remove(), 300);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
class J {
|
|
119
249
|
constructor() {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
250
|
+
r(this, "tooltipElement", null);
|
|
251
|
+
r(this, "tooltipContent", null);
|
|
252
|
+
r(this, "tooltipClass", "soyio-tooltip");
|
|
253
|
+
r(this, "hideTimeout", null);
|
|
124
254
|
this.createTooltipElement(), this.setupGlobalListeners();
|
|
125
255
|
}
|
|
126
256
|
createTooltipElement() {
|
|
127
|
-
const
|
|
128
|
-
|
|
257
|
+
const e = document.querySelector(`.${this.tooltipClass}`);
|
|
258
|
+
e == null || e.remove(), this.tooltipElement = document.createElement("div"), this.tooltipElement.className = this.tooltipClass, this.tooltipElement.style.cssText = `
|
|
129
259
|
position: fixed;
|
|
130
260
|
z-index: 99999;
|
|
131
261
|
background: white;
|
|
@@ -157,41 +287,42 @@ class V {
|
|
|
157
287
|
setupGlobalListeners() {
|
|
158
288
|
window.addEventListener("scroll", () => this.hide(), !0), window.addEventListener("resize", () => this.hide()), window.addEventListener("orientationchange", () => this.hide());
|
|
159
289
|
}
|
|
160
|
-
show(
|
|
161
|
-
!this.tooltipElement || !this.tooltipContent || (this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = null), this.tooltipContent.textContent =
|
|
290
|
+
show(e, n, i) {
|
|
291
|
+
!this.tooltipElement || !this.tooltipContent || (this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = null), this.tooltipContent.textContent = e, this.tooltipElement.style.left = `${n}px`, this.tooltipElement.style.top = `${i}px`, this.tooltipElement.style.opacity = "1");
|
|
162
292
|
}
|
|
163
293
|
hide() {
|
|
164
294
|
this.tooltipElement && (this.tooltipElement.style.opacity = "0");
|
|
165
295
|
}
|
|
166
296
|
destroy() {
|
|
167
|
-
var
|
|
168
|
-
(
|
|
297
|
+
var e;
|
|
298
|
+
(e = this.tooltipElement) == null || e.remove(), this.tooltipElement = null, this.tooltipContent = null, this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = null);
|
|
169
299
|
}
|
|
170
300
|
}
|
|
171
|
-
class
|
|
172
|
-
constructor(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
301
|
+
class de {
|
|
302
|
+
constructor(e) {
|
|
303
|
+
r(this, "appearance");
|
|
304
|
+
r(this, "options");
|
|
305
|
+
r(this, "tooltipManager");
|
|
306
|
+
r(this, "skeleton");
|
|
307
|
+
r(this, "iframe", null);
|
|
308
|
+
r(this, "state", {
|
|
178
309
|
isSelected: !1,
|
|
179
310
|
actionToken: null
|
|
180
311
|
});
|
|
181
|
-
this.options =
|
|
312
|
+
this.options = e, this.appearance = e.appearance || null, this.tooltipManager = new J(), this.skeleton = new K(this.uniqueIdentifier), this.setup();
|
|
182
313
|
}
|
|
183
|
-
handleHeightChange(
|
|
184
|
-
this.iframe && (this.iframe.style.height = `${
|
|
314
|
+
handleHeightChange(e) {
|
|
315
|
+
this.iframe && (this.iframe.style.height = `${e}px`);
|
|
185
316
|
}
|
|
186
317
|
async handleIframeReady() {
|
|
187
|
-
|
|
318
|
+
this.iframe && (this.skeleton.hide(), this.options.onReady && this.options.onReady(), this.appearance && A(this.iframe, this.appearance, this.uniqueIdentifier));
|
|
188
319
|
}
|
|
189
|
-
handleStateChange(
|
|
190
|
-
const { isSelected: n, actionToken:
|
|
191
|
-
this.state = { isSelected: n, actionToken:
|
|
320
|
+
handleStateChange(e) {
|
|
321
|
+
const { isSelected: n, actionToken: i } = e;
|
|
322
|
+
this.state = { isSelected: n, actionToken: i }, this.options.onEvent({
|
|
192
323
|
eventName: "CONSENT_CHECKBOX_CHANGE",
|
|
193
324
|
isSelected: n,
|
|
194
|
-
actionToken:
|
|
325
|
+
actionToken: i
|
|
195
326
|
});
|
|
196
327
|
}
|
|
197
328
|
async setup() {
|
|
@@ -202,19 +333,19 @@ class at {
|
|
|
202
333
|
onTooltipChange: this.handleTooltipChange.bind(this)
|
|
203
334
|
});
|
|
204
335
|
}
|
|
205
|
-
handleTooltipChange(
|
|
336
|
+
handleTooltipChange(e) {
|
|
206
337
|
if (!this.iframe)
|
|
207
338
|
return;
|
|
208
|
-
const n = this.iframe.getBoundingClientRect(), { text:
|
|
209
|
-
s ? this.tooltipManager.show(
|
|
339
|
+
const n = this.iframe.getBoundingClientRect(), { text: i, coordinates: o, isVisible: s } = e, a = o.x + n.left, c = o.y + n.top;
|
|
340
|
+
s ? this.tooltipManager.show(i, a, c) : this.tooltipManager.hide();
|
|
210
341
|
}
|
|
211
|
-
mount(
|
|
212
|
-
|
|
213
|
-
const n =
|
|
214
|
-
return this.iframe = M(
|
|
342
|
+
mount(e) {
|
|
343
|
+
G(this.iframeIdentifier);
|
|
344
|
+
const n = F(e), i = q(this.options);
|
|
345
|
+
return this.iframe = M(i, this.iframeIdentifier), this.skeleton.mount(n), n.appendChild(this.iframe), this;
|
|
215
346
|
}
|
|
216
347
|
unmount() {
|
|
217
|
-
|
|
348
|
+
V(this.uniqueIdentifier), this.skeleton.hide(), this.iframe && (this.iframe.remove(), this.iframe = null);
|
|
218
349
|
}
|
|
219
350
|
getState() {
|
|
220
351
|
return { ...this.state };
|
|
@@ -226,76 +357,76 @@ class at {
|
|
|
226
357
|
return this.options.consentTemplateId;
|
|
227
358
|
}
|
|
228
359
|
}
|
|
229
|
-
const
|
|
360
|
+
const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
230
361
|
__proto__: null
|
|
231
362
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
232
|
-
function
|
|
233
|
-
let
|
|
234
|
-
return "disclosureRequestId" in
|
|
363
|
+
function Q(t) {
|
|
364
|
+
let e = "widget/";
|
|
365
|
+
return "disclosureRequestId" in t.configProps ? e += ["disclosures", t.configProps.disclosureRequestId].join("/") : e += t.request, e;
|
|
235
366
|
}
|
|
236
|
-
function
|
|
237
|
-
const
|
|
238
|
-
return `${n}/${
|
|
367
|
+
function Z(t) {
|
|
368
|
+
const e = t.isSandbox ?? !1, n = t.developmentUrl || (e ? k : R), i = Object.entries(t.configProps).filter(([s, a]) => a || s === "disclosureRequestId").map(([s, a]) => `${s}=${encodeURIComponent(a)}`).join("&"), o = Q(t);
|
|
369
|
+
return `${n}/${o}?sdk=web&${i}`;
|
|
239
370
|
}
|
|
240
|
-
const
|
|
241
|
-
let
|
|
242
|
-
function
|
|
243
|
-
|
|
371
|
+
const ee = !!(typeof window < "u" && window.document && window.document.createElement);
|
|
372
|
+
let d = null, E = null;
|
|
373
|
+
function w(t = null) {
|
|
374
|
+
d && !d.closed && d.focus(), t == null || t.preventDefault();
|
|
244
375
|
}
|
|
245
|
-
function
|
|
246
|
-
document.body.style.filter = "", document.body.removeEventListener("click",
|
|
376
|
+
function y() {
|
|
377
|
+
document.body.style.filter = "", document.body.removeEventListener("click", w);
|
|
247
378
|
}
|
|
248
|
-
function
|
|
249
|
-
|
|
250
|
-
(!
|
|
251
|
-
},
|
|
379
|
+
function te() {
|
|
380
|
+
E = setInterval(() => {
|
|
381
|
+
(!d || d.closed) && (E && clearInterval(E), y());
|
|
382
|
+
}, O);
|
|
252
383
|
}
|
|
253
|
-
function
|
|
254
|
-
const
|
|
255
|
-
document.body.style.filter = "blur(5px)", document.body.addEventListener("click",
|
|
256
|
-
|
|
384
|
+
function ne(t) {
|
|
385
|
+
const e = Z(t), n = $, i = U, o = 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, c = window.innerHeight || document.documentElement.clientHeight || window.screen.height, m = a / window.screen.availWidth, h = (a - n) / 2 / m + o, f = (c - i) / 2 / m + s;
|
|
386
|
+
document.body.style.filter = "blur(5px)", document.body.addEventListener("click", w), d = window.open(
|
|
387
|
+
e,
|
|
257
388
|
"Soyio",
|
|
258
389
|
`scrollbars=yes,
|
|
259
390
|
width=${n},
|
|
260
|
-
height=${
|
|
261
|
-
top=${
|
|
262
|
-
left=${
|
|
263
|
-
),
|
|
391
|
+
height=${i},
|
|
392
|
+
top=${f},
|
|
393
|
+
left=${h}`
|
|
394
|
+
), w(), te();
|
|
264
395
|
}
|
|
265
|
-
function
|
|
266
|
-
|
|
396
|
+
function ie() {
|
|
397
|
+
d && (d.close(), d = null), y();
|
|
267
398
|
}
|
|
268
|
-
const
|
|
269
|
-
let
|
|
270
|
-
function
|
|
271
|
-
|
|
399
|
+
const oe = "WIDGET_EVENT";
|
|
400
|
+
let p = null;
|
|
401
|
+
function se() {
|
|
402
|
+
p && (p.cancel(), p = null);
|
|
272
403
|
}
|
|
273
|
-
async function
|
|
274
|
-
const { onEvent:
|
|
275
|
-
|
|
276
|
-
|
|
404
|
+
async function ae(t) {
|
|
405
|
+
const { onEvent: e } = t, n = await import("./index-yZw-yxuV.js").then((i) => i.i);
|
|
406
|
+
p && se(), p = n.on(oe, async (i) => {
|
|
407
|
+
e(i.data), P.includes(i.data.eventName) ? ie() : i.data.eventName === D && y();
|
|
277
408
|
});
|
|
278
409
|
}
|
|
279
|
-
function
|
|
280
|
-
|
|
410
|
+
function re(t) {
|
|
411
|
+
ae(t);
|
|
281
412
|
}
|
|
282
|
-
var
|
|
283
|
-
class
|
|
284
|
-
constructor(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
this.onEvent =
|
|
288
|
-
onEvent:
|
|
413
|
+
var u, _;
|
|
414
|
+
class he {
|
|
415
|
+
constructor(e) {
|
|
416
|
+
T(this, u);
|
|
417
|
+
r(this, "onEvent");
|
|
418
|
+
this.onEvent = e.onEvent, ee && (ne(e), re({
|
|
419
|
+
onEvent: x(this, u, _).bind(this)
|
|
289
420
|
}));
|
|
290
421
|
}
|
|
291
422
|
}
|
|
292
|
-
|
|
293
|
-
this.onEvent(
|
|
423
|
+
u = new WeakSet(), _ = function(e) {
|
|
424
|
+
this.onEvent(e);
|
|
294
425
|
};
|
|
295
426
|
export {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
427
|
+
de as ConsentBox,
|
|
428
|
+
ce as SoyioTypes,
|
|
429
|
+
he as SoyioWidget,
|
|
430
|
+
J as _TooltipManager,
|
|
431
|
+
he as default
|
|
301
432
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(A
|
|
1
|
+
(function(R,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(R=typeof globalThis<"u"?globalThis:R||self,A(R["soyio-widget"]={}))})(this,function(R){"use strict";var Dn=Object.defineProperty;var zn=(R,A,F)=>A in R?Dn(R,A,{enumerable:!0,configurable:!0,writable:!0,value:F}):R[A]=F;var H=(R,A,F)=>(zn(R,typeof A!="symbol"?A+"":A,F),F),jn=(R,A,F)=>{if(!A.has(R))throw TypeError("Cannot "+F)};var Pt=(R,A,F)=>{if(A.has(R))throw TypeError("Cannot add the same private member more than once");A instanceof WeakSet?A.add(R):A.set(R,F)};var Ot=(R,A,F)=>(jn(R,A,"access private method"),F);var we,Rt;function A(p,v){for(var w=0;w<v.length;w++){const m=v[w];if(typeof m!="string"&&!Array.isArray(m)){for(const g in m)if(g!=="default"&&!(g in p)){const y=Object.getOwnPropertyDescriptor(m,g);y&&Object.defineProperty(p,g,y.get?y:{enumerable:!0,get:()=>m[g]})}}}return Object.freeze(Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}))}async function F(p,v,w){if(!p.contentWindow)throw new Error("Invalid iframe: contentWindow is null");const m=await Promise.resolve().then(()=>Pe);try{await m.send(p.contentWindow,"SET_APPEARANCE",{appearance:v,identifier:w})}catch(g){console.error("Failed to send appearance config:",g)}}const Fe="https://app.soyio.id",Ue="https://sandbox.soyio.id",At=["DISCLOSURE_REQUEST_SUCCESSFUL","IDENTITY_REGISTERED","IDENTITY_SIGNATURE","UNEXPECTED_ERROR","DENIED_CAMERA_PERMISSION","REJECTED_SIGNATURE"],Nt="WIDGET_CLOSED",Dt=420,zt=720,jt=500;function Mt(p){const v=document.getElementById(p);v&&(console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."),v.remove())}function Lt(p){const v=document.querySelector(p);if(!v)throw new Error(`Iframe div container with id '${p}' not found`);if(v.tagName.toLowerCase()!=="div")throw new Error(`Iframe container with id '${p}' must be a <div> element`);const w=v;return w.style.position="relative",w.style.cssText+=`
|
|
2
2
|
padding: 0 !important;
|
|
3
3
|
margin: 0 !important;
|
|
4
4
|
display: flex !important;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
border: none !important;
|
|
8
8
|
transition: height 0.35s !important;
|
|
9
9
|
opacity: 1 !important;
|
|
10
|
-
`,
|
|
10
|
+
`,w}function kt(p,v){const w=document.createElement("iframe");return w.id=v,w.src=p,w.style.cssText+=`
|
|
11
11
|
width: 100% !important;
|
|
12
12
|
min-width: 375px !important;
|
|
13
13
|
max-width: 36rem !important;
|
|
@@ -17,7 +17,96 @@
|
|
|
17
17
|
opacity: 1;
|
|
18
18
|
transition: height 0.35s,
|
|
19
19
|
opacity 0.4s 0.1s;
|
|
20
|
-
`,
|
|
20
|
+
`,w}function Ht(p){const v=["actionToken","entityId","context"],w=p.isSandbox??!1,m=p.developmentUrl||(w?Ue:Fe),g=new URLSearchParams;v.forEach(E=>{p[E]&&g.set(E,p[E])});const y=g.toString();return`${m}/embed/consents/${p.consentTemplateId}${y?`?${y}`:""}`}const Ft="IFRAME_READY",Ut="CONSENT_STATE_CHANGE",Bt="IFRAME_HEIGHT_CHANGE",Gt="TOOLTIP_STATE_CHANGE",_={onHeightChange:{},onIframeReady:{},onStateChange:{},onTooltipChange:{}};let Be,Ge,_e,$e;async function _t(){const p=await Promise.resolve().then(()=>Pe);Be||Ge||_e||$e||(Be=p.on(Bt,async v=>{const w=v.data,m=_.onHeightChange[w.identifier];if(!m)throw new Error(`No height change listener found for identifier: ${w.identifier}`);m(w.height)}),Ge=p.on(Ft,async v=>{const w=v.data,m=_.onIframeReady[w.identifier];if(!m)throw new Error(`No iframe ready listener found for identifier: ${w.identifier}`);m()}),_e=p.on(Ut,async v=>{const w=v.data,m=_.onStateChange[w.identifier];if(!m)throw new Error(`No state change listener found for identifier: ${w.identifier}`);m(w)}),$e=p.on(Gt,async v=>{const w=v.data,m=_.onTooltipChange[w.identifier];if(!m)throw new Error(`No tooltip change listener found for identifier: ${w.identifier}`);m(w)}))}function $t(p,v){const{onHeightChange:w,onIframeReady:m,onStateChange:g,onTooltipChange:y}=v;_.onHeightChange[p]=w,_.onIframeReady[p]=m,_.onStateChange[p]=g,_.onTooltipChange[p]=y}function qt(p){delete _.onHeightChange[p],delete _.onIframeReady[p],delete _.onStateChange[p],delete _.onTooltipChange[p]}class Jt{constructor(v){H(this,"element");H(this,"identifier");this.identifier=`skeleton-${v}`,this.element=document.createElement("div"),this.element.id=this.identifier,this.element.style.cssText=`
|
|
21
|
+
position: absolute;
|
|
22
|
+
left: 50%;
|
|
23
|
+
top: 50%;
|
|
24
|
+
transform: translate(-50%, -50%);
|
|
25
|
+
width: 100%;
|
|
26
|
+
min-width: 375px;
|
|
27
|
+
max-width: 36rem;
|
|
28
|
+
height: 120px;
|
|
29
|
+
background: #FFFFFF;
|
|
30
|
+
border: 1px solid #E5E7EB;
|
|
31
|
+
border-radius: 0.25rem;
|
|
32
|
+
opacity: 1;
|
|
33
|
+
transition: opacity 0.3s ease-out;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
gap: 1rem;
|
|
37
|
+
`;const w=document.createElement("div");w.style.cssText=`
|
|
38
|
+
padding: 1rem;
|
|
39
|
+
height: 100%;
|
|
40
|
+
max-width: 100%;
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
`;const m=document.createElement("div");m.style.cssText=`
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: 0.75rem;
|
|
48
|
+
`;const g=document.createElement("div");g.style.cssText=`
|
|
49
|
+
width: 2rem;
|
|
50
|
+
height: 2rem;
|
|
51
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
52
|
+
background-size: 200% 100%;
|
|
53
|
+
animation: shimmer 1.5s infinite;
|
|
54
|
+
border-radius: 50%;
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
`;const y=document.createElement("div");y.style.cssText=`
|
|
57
|
+
height: 1rem;
|
|
58
|
+
width: 30%;
|
|
59
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
60
|
+
background-size: 200% 100%;
|
|
61
|
+
animation: shimmer 1.5s infinite;
|
|
62
|
+
border-radius: 0.125rem;
|
|
63
|
+
`;const E=document.createElement("div");E.style.cssText=`
|
|
64
|
+
width: 1.5rem;
|
|
65
|
+
height: 1.5rem;
|
|
66
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
67
|
+
background-size: 200% 100%;
|
|
68
|
+
animation: shimmer 1.5s infinite;
|
|
69
|
+
border-radius: 50%;
|
|
70
|
+
margin-left: auto;
|
|
71
|
+
margin-right: 3px;
|
|
72
|
+
`;const z=document.createElement("div");z.style.cssText=`
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: 1rem;
|
|
76
|
+
`;const Y=document.createElement("div");Y.style.cssText=`
|
|
77
|
+
width: 1rem;
|
|
78
|
+
height: 1rem;
|
|
79
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
80
|
+
background-size: 200% 100%;
|
|
81
|
+
animation: shimmer 1.5s infinite;
|
|
82
|
+
border-radius: 0.25rem;
|
|
83
|
+
flex-shrink: 0;
|
|
84
|
+
margin-left: 10px;
|
|
85
|
+
`;const Z=document.createElement("div");Z.style.cssText=`
|
|
86
|
+
flex-grow: 1;
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
gap: 0.5rem;
|
|
90
|
+
`;const $=document.createElement("div");$.style.cssText=`
|
|
91
|
+
height: 0.875rem;
|
|
92
|
+
width: 80%;
|
|
93
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
94
|
+
background-size: 200% 100%;
|
|
95
|
+
animation: shimmer 1.5s infinite;
|
|
96
|
+
border-radius: 0.125rem;
|
|
97
|
+
`;const se=document.createElement("div");if(se.style.cssText=`
|
|
98
|
+
height: 0.875rem;
|
|
99
|
+
width: 60%;
|
|
100
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
101
|
+
background-size: 200% 100%;
|
|
102
|
+
animation: shimmer 1.5s infinite;
|
|
103
|
+
border-radius: 0.125rem;
|
|
104
|
+
`,!document.getElementById("skeleton-animation")){const K=document.createElement("style");K.id="skeleton-animation",K.textContent=`
|
|
105
|
+
@keyframes shimmer {
|
|
106
|
+
0% { background-position: 200% 0; }
|
|
107
|
+
100% { background-position: -200% 0; }
|
|
108
|
+
}
|
|
109
|
+
`,document.head.appendChild(K)}m.appendChild(g),m.appendChild(y),m.appendChild(E),Z.appendChild($),Z.appendChild(se),z.appendChild(Y),z.appendChild(Z),w.appendChild(m),w.appendChild(z),this.element.appendChild(w)}cleanupExistingSkeleton(){const v=document.getElementById(this.identifier);v&&v.remove()}mount(v){this.cleanupExistingSkeleton(),v.appendChild(this.element)}hide(){this.element.style.opacity="0",setTimeout(()=>this.element.remove(),300)}}class qe{constructor(){H(this,"tooltipElement",null);H(this,"tooltipContent",null);H(this,"tooltipClass","soyio-tooltip");H(this,"hideTimeout",null);this.createTooltipElement(),this.setupGlobalListeners()}createTooltipElement(){const v=document.querySelector(`.${this.tooltipClass}`);v==null||v.remove(),this.tooltipElement=document.createElement("div"),this.tooltipElement.className=this.tooltipClass,this.tooltipElement.style.cssText=`
|
|
21
110
|
position: fixed;
|
|
22
111
|
z-index: 99999;
|
|
23
112
|
background: white;
|
|
@@ -33,7 +122,7 @@
|
|
|
33
122
|
transition: opacity 0.2s ease-in-out;
|
|
34
123
|
transform: translateX(-50%) translateY(-100%);
|
|
35
124
|
margin-top: -8px;
|
|
36
|
-
`,this.tooltipContent=document.createElement("div"),this.tooltipContent.style.cssText="text-align: center;",this.tooltipElement.appendChild(this.tooltipContent);const
|
|
125
|
+
`,this.tooltipContent=document.createElement("div"),this.tooltipContent.style.cssText="text-align: center;",this.tooltipElement.appendChild(this.tooltipContent);const w=document.createElement("div");w.style.cssText=`
|
|
37
126
|
position: absolute;
|
|
38
127
|
bottom: -4px;
|
|
39
128
|
left: 50%;
|
|
@@ -42,24 +131,24 @@
|
|
|
42
131
|
height: 8px;
|
|
43
132
|
background: white;
|
|
44
133
|
box-shadow: 2px 2px 2px rgba(0,0,0,0.1);
|
|
45
|
-
`,this.tooltipElement.appendChild(
|
|
46
|
-
width=${
|
|
47
|
-
height=${
|
|
48
|
-
top=${
|
|
49
|
-
left=${
|
|
50
|
-
`;function U(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 U(e)}function re(e){return e===void 0&&(e=window),V(e)==="about:"}function Z(e){if(e===void 0&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch{}}function Ve(e){if(e===void 0&&(e=window),e&&!Z(e))try{return e.opener}catch{}}function we(e){try{return!0}catch{}return!1}function me(e){e===void 0&&(e=window);var n=e.location;if(!n)throw new Error("Can not read window location");var t=U(e);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var r=Z(e);return r&&we()?me(r):"about://"}var o=n.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function z(e){e===void 0&&(e=window);var n=me(e);return n&&e.mockDomain&&e.mockDomain.indexOf("mock:")===0?e.mockDomain:n}function Q(e){if(!function(n){try{if(n===window)return!0}catch{}try{var t=Object.getOwnPropertyDescriptor(n,"location");if(t&&t.enumerable===!1)return!1}catch{}try{if(re(n)&&we())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),V(r)==="mock:"}(n)&&we())return!0}catch{}try{if(me(n)===me(window))return!0}catch{}return!1}(e))return!1;try{if(e===window||re(e)&&we()||z(window)===z(e))return!0}catch{}return!1}function ge(e){if(!Q(e))throw new Error("Expected window to be same domain");return e}function Xe(e,n){if(!e||!n)return!1;var t=Z(n);return t?t===e:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch{}return o}(n).indexOf(e)!==-1}function Ke(e){var n=[],t;try{t=e.frames}catch{t=e}var r;try{r=t.length}catch{}if(r===0)return n;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch{continue}n.push(i)}return n}for(var a=0;a<100;a++){var c=void 0;try{c=t[a]}catch{return n}if(!c)return n;n.push(c)}return n}var cn=[],dn=[];function $(e,n){n===void 0&&(n=!0);try{if(e===window)return!1}catch{return!0}try{if(!e)return!0}catch{return!0}try{if(e.closed)return!0}catch(o){return!o||o.message!==x}if(n&&Q(e))try{if(e.mockclosed)return!0}catch{}try{if(!e.parent||!e.top)return!0}catch{}var t=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch{}return-1}(cn,e);if(t!==-1){var r=dn[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 Qe(e){return e===void 0&&(e=window),Ve(e=e||window)||Z(e)||void 0}function oe(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 oe(t,n)}))}function ye(e){try{if(e===window)return!0}catch(n){if(n&&n.message===x)return!0}try{if({}.toString.call(e)==="[object Window]")return!0}catch(n){if(n&&n.message===x)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(n){if(n&&n.message===x)return!0}try{if(e&&e.self===e)return!0}catch(n){if(n&&n.message===x)return!0}try{if(e&&e.parent===e)return!0}catch(n){if(n&&n.message===x)return!0}try{if(e&&e.top===e)return!0}catch(n){if(n&&n.message===x)return!0}try{if(e&&e.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch{}return!1}function et(e){if(Q(e))return ge(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 fn(e){if(function(t){return t===void 0&&(t=window),!!Z(t)}(e)){var n=et(e);if(n&&n.parentElement){n.parentElement.removeChild(n);return}}try{e.close()}catch{}}function ee(e){try{if(!e)return!1;if(typeof Promise<"u"&&e instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&e instanceof window.Window||typeof window<"u"&&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{return!1}return!1}var tt=[],ae=[],Te=0,se;function nt(){if(!Te&&se){var e=se;se=null,e.resolve()}}function Oe(){Te+=1}function ue(){Te-=1,nt()}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;Oe();try{t(function(s){u?r.resolve(s):(a=!0,o=s)},function(s){u?r.reject(s):(c=!0,i=s)})}catch(s){ue(),this.reject(s);return}ue(),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(ee(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(ee(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(tt.indexOf(i)===-1){tt.push(i),setTimeout(function(){throw i},1);for(var c=0;c<ae.length;c++)ae[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,Oe();for(var i=function(h,b){return h.then(function(E){b.resolve(E)},function(E){b.reject(E)})},a=0;a<o.length;a++){var c=o[a],u=c.onSuccess,s=c.onError,l=c.promise,d=void 0;if(t)try{d=u?u(this.value):this.value}catch(h){l.reject(h);continue}else if(r){if(!s){l.reject(this.error);continue}try{d=s(this.error)}catch(h){l.reject(h);continue}}if(d instanceof e&&(d.resolved||d.rejected)){var f=d;f.resolved?l.resolve(f.value):l.reject(f.error),f.errorHandled=!0}else ee(d)?d instanceof e&&(d.resolved||d.rejected)?d.resolved?l.resolve(d.value):l.reject(d.error):i(d,l):l.resolve(d)}o.length=0,this.dispatching=!1,ue()}},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>"u")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:ee(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,l,d){return l.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(!ee(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];ee(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 ae.push(r),{cancel:function(){ae.splice(ae.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;Oe();try{i=t.apply(r,o||[])}catch(a){return ue(),e.reject(a)}return ue(),e.resolve(i)},e.delay=function(t){return new e(function(r){setTimeout(r,t)})},e.isPromise=function(t){return!!(t&&t instanceof e)||ee(t)},e.flush=function(){return function(t){var r=se=se||new t;return nt(),r}(e)},e}();function Ee(e,n){for(var t=0;t<e.length;t++)try{if(e[t]===n)return t}catch{}return-1}var Ae=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>"u"||Object.freeze===void 0)return!1;try{var t=new WeakMap,r={};return Object.freeze(r),t.set(r,"__testvalue__"),t.get(r)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var 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(ye(i)&&$(i)){if(t)try{t.delete(i)}catch{}r.splice(o,1),this.values.splice(o,1),o-=1}}},n.isSafeToReadWrite=function(t){return!ye(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{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var i=this.name,a=t[i];a&&a[0]===t?a[1]=r:Object.defineProperty(t,i,{value:[t,r],writable:!0});return}catch{}this._cleanupClosedWindows();var c=this.keys,u=this.values,s=Ee(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{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return o&&o[0]===t?o[1]:void 0}catch{}this._cleanupClosedWindows();var i=Ee(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{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];o&&o[0]===t&&(o[0]=o[1]=void 0)}catch{}this._cleanupClosedWindows();var i=this.keys,a=Ee(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{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return!(!o||o[0]!==t)}catch{}return this._cleanupClosedWindows(),Ee(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 rt(e){return e.name||e.__name__||e.displayName||"anonymous"}function ot(e,n){try{delete e.name,e.name=n}catch{}return e.__name__=e.displayName=n,e}function J(){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<"u")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 Se;function it(e){try{return JSON.stringify([].slice.call(e),function(n,t){return typeof t=="function"?"memoize["+function(r){if(Se=Se||new Ae,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Se.get(r);return o||(o=typeof r+":"+J(),Se.set(r,o)),o}(t)+"]":typeof window<"u"&&t instanceof window.Element||t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object"?{}:t})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function ln(){return{}}var ce=0,at=0;function de(e,n){n===void 0&&(n={});var t=n.thisNamespace,r=t!==void 0&&t,o=n.time,i,a,c=ce;ce+=1;var u=function(){for(var s=arguments.length,l=new Array(s),d=0;d<s;d++)l[d]=arguments[d];c<at&&(i=null,a=null,c=ce,ce+=1);var f;f=r?(a=a||new Ae).getOrSet(this,ln):i=i||{};var h;try{h=it(l)}catch{return e.apply(this,arguments)}var b=f[h];if(b&&o&&Date.now()-b.time<o&&(delete f[h],b=null),b)return b.value;var E=Date.now(),S=e.apply(this,arguments);return f[h]={time:E,value:S},S};return u.reset=function(){i=null,a=null},ot(u,(n.name||rt(e))+"::memoized")}de.clear=function(){at=ce};function hn(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=it(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={}},ot(t,rt(e)+"::promiseMemoized")}function te(){}function fe(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+`
|
|
51
|
-
`+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: "+
|
|
134
|
+
`,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(v,w,m){!this.tooltipElement||!this.tooltipContent||(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.tooltipContent.textContent=v,this.tooltipElement.style.left=`${w}px`,this.tooltipElement.style.top=`${m}px`,this.tooltipElement.style.opacity="1")}hide(){this.tooltipElement&&(this.tooltipElement.style.opacity="0")}destroy(){var v;(v=this.tooltipElement)==null||v.remove(),this.tooltipElement=null,this.tooltipContent=null,this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}}class Yt{constructor(v){H(this,"appearance");H(this,"options");H(this,"tooltipManager");H(this,"skeleton");H(this,"iframe",null);H(this,"state",{isSelected:!1,actionToken:null});this.options=v,this.appearance=v.appearance||null,this.tooltipManager=new qe,this.skeleton=new Jt(this.uniqueIdentifier),this.setup()}handleHeightChange(v){this.iframe&&(this.iframe.style.height=`${v}px`)}async handleIframeReady(){this.iframe&&(this.skeleton.hide(),this.options.onReady&&this.options.onReady(),this.appearance&&F(this.iframe,this.appearance,this.uniqueIdentifier))}handleStateChange(v){const{isSelected:w,actionToken:m}=v;this.state={isSelected:w,actionToken:m},this.options.onEvent({eventName:"CONSENT_CHECKBOX_CHANGE",isSelected:w,actionToken:m})}async setup(){await _t(),$t(this.uniqueIdentifier,{onHeightChange:this.handleHeightChange.bind(this),onIframeReady:this.handleIframeReady.bind(this),onStateChange:this.handleStateChange.bind(this),onTooltipChange:this.handleTooltipChange.bind(this)})}handleTooltipChange(v){if(!this.iframe)return;const w=this.iframe.getBoundingClientRect(),{text:m,coordinates:g,isVisible:y}=v,E=g.x+w.left,z=g.y+w.top;y?this.tooltipManager.show(m,E,z):this.tooltipManager.hide()}mount(v){Mt(this.iframeIdentifier);const w=Lt(v),m=Ht(this.options);return this.iframe=kt(m,this.iframeIdentifier),this.skeleton.mount(w),w.appendChild(this.iframe),this}unmount(){qt(this.uniqueIdentifier),this.skeleton.hide(),this.iframe&&(this.iframe.remove(),this.iframe=null)}getState(){return{...this.state}}get iframeIdentifier(){return`consent-box-${this.uniqueIdentifier}`}get uniqueIdentifier(){return this.options.consentTemplateId}}const Zt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function Vt(p){let v="widget/";return"disclosureRequestId"in p.configProps?v+=["disclosures",p.configProps.disclosureRequestId].join("/"):v+=p.request,v}function Xt(p){const v=p.isSandbox??!1,w=p.developmentUrl||(v?Ue:Fe),m=Object.entries(p.configProps).filter(([y,E])=>E||y==="disclosureRequestId").map(([y,E])=>`${y}=${encodeURIComponent(E)}`).join("&"),g=Vt(p);return`${w}/${g}?sdk=web&${m}`}const Kt=!!(typeof window<"u"&&window.document&&window.document.createElement);let X=null,Ce=null;function Ie(p=null){X&&!X.closed&&X.focus(),p==null||p.preventDefault()}function Te(){document.body.style.filter="",document.body.removeEventListener("click",Ie)}function Qt(){Ce=setInterval(()=>{(!X||X.closed)&&(Ce&&clearInterval(Ce),Te())},jt)}function en(p){const v=Xt(p),w=Dt,m=zt,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,z=window.innerHeight||document.documentElement.clientHeight||window.screen.height,Y=E/window.screen.availWidth,Z=(E-w)/2/Y+g,$=(z-m)/2/Y+y;document.body.style.filter="blur(5px)",document.body.addEventListener("click",Ie),X=window.open(v,"Soyio",`scrollbars=yes,
|
|
135
|
+
width=${w},
|
|
136
|
+
height=${m},
|
|
137
|
+
top=${$},
|
|
138
|
+
left=${Z}`),Ie(),Qt()}function tn(){X&&(X.close(),X=null),Te()}const nn="WIDGET_EVENT";let ae=null;function rn(){ae&&(ae.cancel(),ae=null)}async function on(p){const{onEvent:v}=p,w=await Promise.resolve().then(()=>Pe);ae&&rn(),ae=w.on(nn,async m=>{v(m.data),At.includes(m.data.eventName)?tn():m.data.eventName===Nt&&Te()})}function an(p){on(p)}class Je{constructor(v){Pt(this,we);H(this,"onEvent");this.onEvent=v.onEvent,Kt&&(en(v),an({onEvent:Ot(this,we,Rt).bind(this)}))}}we=new WeakSet,Rt=function(v){this.onEvent(v)};var sn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cn(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}var Ye={exports:{}},Ze={exports:{}};(function(p,v){(function(w,m){p.exports=m()})(typeof self<"u"?self:sn,function(){return function(w){var m={};function g(y){if(m[y])return m[y].exports;var E=m[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=m,g.d=function(y,E,z){g.o(y,E)||Object.defineProperty(y,E,{enumerable:!0,get:z})},g.r=function(y){typeof Symbol<"u"&&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 z=Object.create(null);if(g.r(z),Object.defineProperty(z,"default",{enumerable:!0,value:y}),2&E&&typeof y!="string")for(var Y in y)g.d(z,Y,(function(Z){return y[Z]}).bind(null,Y));return z},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,m,g){g.r(m),g.d(m,"Promise",function(){return C}),g.d(m,"TYPES",function(){return An}),g.d(m,"ProxyWindow",function(){return G}),g.d(m,"setup",function(){return Tt}),g.d(m,"destroy",function(){return Rn}),g.d(m,"serializeMessage",function(){return In}),g.d(m,"deserializeMessage",function(){return Tn}),g.d(m,"createProxyWindow",function(){return Pn}),g.d(m,"toProxyWindow",function(){return On}),g.d(m,"on",function(){return Q}),g.d(m,"once",function(){return Cn}),g.d(m,"send",function(){return ee}),g.d(m,"markWindowKnown",function(){return pt}),g.d(m,"cleanUpWindow",function(){return Nn}),g.d(m,"bridge",function(){});function y(e){return{}.toString.call(e)==="[object RegExp]"}var E=`Call was rejected by callee.\r
|
|
139
|
+
`;function z(e){return e===void 0&&(e=window),e.location.protocol}function Y(e){if(e===void 0&&(e=window),e.mockDomain){var n=e.mockDomain.split("//")[0];if(n)return n}return z(e)}function Z(e){return e===void 0&&(e=window),Y(e)==="about:"}function $(e){if(e===void 0&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch{}}function se(e){if(e===void 0&&(e=window),e&&!$(e))try{return e.opener}catch{}}function K(e){try{return!0}catch{}return!1}function ge(e){e===void 0&&(e=window);var n=e.location;if(!n)throw new Error("Can not read window location");var t=z(e);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var r=$(e);return r&&K()?ge(r):"about://"}var o=n.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function L(e){e===void 0&&(e=window);var n=ge(e);return n&&e.mockDomain&&e.mockDomain.indexOf("mock:")===0?e.mockDomain:n}function te(e){if(!function(n){try{if(n===window)return!0}catch{}try{var t=Object.getOwnPropertyDescriptor(n,"location");if(t&&t.enumerable===!1)return!1}catch{}try{if(Z(n)&&K())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),Y(r)==="mock:"}(n)&&K())return!0}catch{}try{if(ge(n)===ge(window))return!0}catch{}return!1}(e))return!1;try{if(e===window||Z(e)&&K()||L(window)===L(e))return!0}catch{}return!1}function ye(e){if(!te(e))throw new Error("Expected window to be same domain");return e}function Xe(e,n){if(!e||!n)return!1;var t=$(n);return t?t===e:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch{}return o}(n).indexOf(e)!==-1}function Ke(e){var n=[],t;try{t=e.frames}catch{t=e}var r;try{r=t.length}catch{}if(r===0)return n;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch{continue}n.push(i)}return n}for(var a=0;a<100;a++){var u=void 0;try{u=t[a]}catch{return n}if(!u)return n;n.push(u)}return n}var dn=[],fn=[];function q(e,n){n===void 0&&(n=!0);try{if(e===window)return!1}catch{return!0}try{if(!e)return!0}catch{return!0}try{if(e.closed)return!0}catch(o){return!o||o.message!==E}if(n&&te(e))try{if(e.mockclosed)return!0}catch{}try{if(!e.parent||!e.top)return!0}catch{}var t=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch{}return-1}(dn,e);if(t!==-1){var r=fn[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 Qe(e){return e===void 0&&(e=window),se(e=e||window)||$(e)||void 0}function ie(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 ie(t,n)}))}function Ee(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{return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch{}return!1}function et(e){if(te(e))return ye(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 ln(e){if(function(t){return t===void 0&&(t=window),!!$(t)}(e)){var n=et(e);if(n&&n.parentElement){n.parentElement.removeChild(n);return}}try{e.close()}catch{}}function ne(e){try{if(!e)return!1;if(typeof Promise<"u"&&e instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&e instanceof window.Window||typeof window<"u"&&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{return!1}return!1}var tt=[],ce=[],Oe=0,ue;function nt(){if(!Oe&&ue){var e=ue;ue=null,e.resolve()}}function Re(){Oe+=1}function de(){Oe-=1,nt()}var C=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,u=!1,c=!1;Re();try{t(function(s){c?r.resolve(s):(a=!0,o=s)},function(s){c?r.reject(s):(u=!0,i=s)})}catch(s){de(),this.reject(s);return}de(),c=!0,a?this.resolve(o):u&&this.reject(i)}}var n=e.prototype;return n.resolve=function(t){if(this.resolved||this.rejected)return this;if(ne(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(ne(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(tt.indexOf(i)===-1){tt.push(i),setTimeout(function(){throw i},1);for(var u=0;u<ce.length;u++)ce[u](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,Re();for(var i=function(h,S){return h.then(function(x){S.resolve(x)},function(x){S.reject(x)})},a=0;a<o.length;a++){var u=o[a],c=u.onSuccess,s=u.onError,l=u.promise,d=void 0;if(t)try{d=c?c(this.value):this.value}catch(h){l.reject(h);continue}else if(r){if(!s){l.reject(this.error);continue}try{d=s(this.error)}catch(h){l.reject(h);continue}}if(d instanceof e&&(d.resolved||d.rejected)){var f=d;f.resolved?l.resolve(f.value):l.reject(f.error),f.errorHandled=!0}else ne(d)?d instanceof e&&(d.resolved||d.rejected)?d.resolved?l.resolve(d.value):l.reject(d.error):i(d,l):l.resolve(d)}o.length=0,this.dispatching=!1,de()}},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>"u")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:ne(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,l,d){return l.then(function(f){i[s]=f,(o-=1)==0&&r.resolve(i)},function(f){d.reject(f)})},u=0;u<t.length;u++){var c=t[u];if(c instanceof e){if(c.resolved){i[u]=c.value,o-=1;continue}}else if(!ne(c)){i[u]=c,o-=1;continue}a(u,e.resolve(c),r)}return o===0&&r.resolve(i),r},e.hash=function(t){var r={},o=[],i=function(u){if(t.hasOwnProperty(u)){var c=t[u];ne(c)?o.push(c.then(function(s){r[u]=s})):r[u]=c}};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 ce.push(r),{cancel:function(){ce.splice(ce.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;Re();try{i=t.apply(r,o||[])}catch(a){return de(),e.reject(a)}return de(),e.resolve(i)},e.delay=function(t){return new e(function(r){setTimeout(r,t)})},e.isPromise=function(t){return!!(t&&t instanceof e)||ne(t)},e.flush=function(){return function(t){var r=ue=ue||new t;return nt(),r}(e)},e}();function xe(e,n){for(var t=0;t<e.length;t++)try{if(e[t]===n)return t}catch{}return-1}var Ae=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>"u"||Object.freeze===void 0)return!1;try{var t=new WeakMap,r={};return Object.freeze(r),t.set(r,"__testvalue__"),t.get(r)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var 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(Ee(i)&&q(i)){if(t)try{t.delete(i)}catch{}r.splice(o,1),this.values.splice(o,1),o-=1}}},n.isSafeToReadWrite=function(t){return!Ee(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{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var i=this.name,a=t[i];a&&a[0]===t?a[1]=r:Object.defineProperty(t,i,{value:[t,r],writable:!0});return}catch{}this._cleanupClosedWindows();var u=this.keys,c=this.values,s=xe(u,t);s===-1?(u.push(t),c.push(r)):c[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{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return o&&o[0]===t?o[1]:void 0}catch{}this._cleanupClosedWindows();var i=xe(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{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];o&&o[0]===t&&(o[0]=o[1]=void 0)}catch{}this._cleanupClosedWindows();var i=this.keys,a=xe(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{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return!(!o||o[0]!==t)}catch{}return this._cleanupClosedWindows(),xe(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 rt(e){return e.name||e.__name__||e.displayName||"anonymous"}function ot(e,n){try{delete e.name,e.name=n}catch{}return e.__name__=e.displayName=n,e}function V(){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<"u")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 be;function it(e){try{return JSON.stringify([].slice.call(e),function(n,t){return typeof t=="function"?"memoize["+function(r){if(be=be||new Ae,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=be.get(r);return o||(o=typeof r+":"+V(),be.set(r,o)),o}(t)+"]":typeof window<"u"&&t instanceof window.Element||t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object"?{}:t})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function hn(){return{}}var fe=0,at=0;function le(e,n){n===void 0&&(n={});var t=n.thisNamespace,r=t!==void 0&&t,o=n.time,i,a,u=fe;fe+=1;var c=function(){for(var s=arguments.length,l=new Array(s),d=0;d<s;d++)l[d]=arguments[d];u<at&&(i=null,a=null,u=fe,fe+=1);var f;f=r?(a=a||new Ae).getOrSet(this,hn):i=i||{};var h;try{h=it(l)}catch{return e.apply(this,arguments)}var S=f[h];if(S&&o&&Date.now()-S.time<o&&(delete f[h],S=null),S)return S.value;var x=Date.now(),b=e.apply(this,arguments);return f[h]={time:x,value:b},b};return c.reset=function(){i=null,a=null},ot(c,(n.name||rt(e))+"::memoized")}le.clear=function(){at=fe};function mn(e){var n={};function t(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];var c=it(a);return n.hasOwnProperty(c)||(n[c]=C.try(function(){return e.apply(o,r)}).finally(function(){delete n[c]})),n[c]}return t.reset=function(){n={}},ot(t,rt(e)+"::promiseMemoized")}function re(){}function he(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+`
|
|
140
|
+
`+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: "+he(o,n+1)}}function st(e){return typeof e=="string"?e:e&&e.toString&&typeof e.toString=="function"?e.toString():{}.toString.call(e)}le(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 Ne(e){return{}.toString.call(e)==="[object RegExp]"}function me(e,n,t){if(e.hasOwnProperty(n))return e[n];var r=t();return e[n]=r,r}function ct(){var e=document.body;if(!e)throw new Error("Body element not found");return e}function ut(){return!!document.body&&document.readyState==="complete"}function dt(){return!!document.body&&document.readyState==="interactive"}le(function(){return new C(function(e){if(ut()||dt())return e();var n=setInterval(function(){if(ut()||dt())return clearInterval(n),e()},10)})});var Se=typeof document<"u"?document.currentScript:null,pn=le(function(){if(Se||(Se=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{}}()))return Se;throw new Error("Can not determine current script")}),vn=V();le(function(){var e;try{e=pn()}catch{return vn}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=V();return e.setAttribute("data-uid-auto",n),n});function pe(e){e===void 0&&(e=window);var n="__post_robot_10_0_46__";return e!==window?e[n]:e[n]=e[n]||{}}var ft=function(){return{}};function j(e,n){return e===void 0&&(e="store"),n===void 0&&(n=ft),me(pe(),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 me(t,r,o)},reset:function(){t=n()},keys:function(){return Object.keys(t)}}})}var wn=function(){};function We(){var e=pe();return e.WINDOW_WILDCARD=e.WINDOW_WILDCARD||new wn,e.WINDOW_WILDCARD}function k(e,n){return e===void 0&&(e="store"),n===void 0&&(n=ft),j("windowStore").getOrSet(e,function(){var t=new Ae,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 me(r(o),e,i)}}})}function lt(){return j("instance").getOrSet("instanceID",V)}function ht(e,n){var t=n.domain,r=k("helloPromises"),o=r.get(e);o&&o.resolve({domain:t});var i=C.resolve({domain:t});return r.set(e,i),i}function De(e,n){return(0,n.send)(e,"postrobot_hello",{instanceID:lt()},{domain:"*",timeout:-1}).then(function(t){var r=t.origin,o=t.data.instanceID;return ht(e,{domain:r}),{win:e,domain:r,instanceID:o}})}function mt(e,n){var t=n.send;return k("windowInstanceIDPromises").getOrSet(e,function(){return De(e,{send:t}).then(function(r){return r.instanceID})})}function pt(e){k("knownWindows").set(e,!0)}function ze(e){return typeof e=="object"&&e!==null&&typeof e.__type__=="string"}function vt(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 oe(e,n){return{__type__:e,__val__:n}}var U,gn=((U={}).function=function(){},U.error=function(e){return oe("error",{message:e.message,stack:e.stack,code:e.code,data:e.data})},U.promise=function(){},U.regex=function(e){return oe("regex",e.source)},U.date=function(e){return oe("date",e.toJSON())},U.array=function(e){return e},U.object=function(e){return e},U.string=function(e){return e},U.number=function(e){return e},U.boolean=function(e){return e},U.null=function(e){return e},U[void 0]=function(e){return oe("undefined",e)},U),yn={},B,En=((B={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},B.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+`
|
|
52
141
|
|
|
53
|
-
`+o.stack,o},
|
|
142
|
+
`+o.stack,o},B.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},B.regex=function(e){return new RegExp(e)},B.date=function(e){return new Date(e)},B.array=function(e){return e},B.object=function(e){return e},B.string=function(e){return e},B.number=function(e){return e},B.boolean=function(e){return e},B.null=function(e){return e},B[void 0]=function(){},B),xn={};new C(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 je(){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?V():r,i=e.then(function(c){if(te(c))return ye(c).name}),a=e.then(function(c){if(q(c))throw new Error("Window is closed, can not determine type");return se(c)?"popup":"iframe"});i.catch(re),a.catch(re);var u=function(){return e.then(function(c){if(!q(c))return te(c)?ye(c).name:i})};return{id:o,getType:function(){return a},getInstanceID:mn(function(){return e.then(function(c){return mt(c,{send:t})})}),close:function(){return e.then(ln)},getName:u,focus:function(){return e.then(function(c){c.focus()})},isClosed:function(){return e.then(function(c){return q(c)})},setLocation:function(c,s){return s===void 0&&(s={}),e.then(function(l){var d=window.location.protocol+"//"+window.location.host,f=s.method,h=f===void 0?"get":f,S=s.body;if(c.indexOf("/")===0)c=""+d+c;else if(!c.match(/^https?:\/\//)&&c.indexOf(d)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(c));if(h==="post")return u().then(function(x){if(!x)throw new Error("Can not post to window without target name");(function(b){var I=b.url,D=b.target,P=b.body,T=b.method,M=T===void 0?"post":T,W=document.createElement("form");if(W.setAttribute("target",D),W.setAttribute("method",M),W.setAttribute("action",I),W.style.display="none",P)for(var O=0,J=Object.keys(P);O<J.length;O++){var N,ve=J[O],He=document.createElement("input");He.setAttribute("name",ve),He.setAttribute("value",(N=P[ve])==null?void 0:N.toString()),W.appendChild(He)}ct().appendChild(W),W.submit(),ct().removeChild(W)})({url:c,target:x,method:h,body:S})});if(h!=="get")throw new Error("Unsupported method: "+h);if(te(l))try{if(l.location&&typeof l.location.replace=="function"){l.location.replace(c);return}}catch{}l.location=c})},setName:function(c){return e.then(function(s){var l=te(s),d=et(s);if(!l)throw new Error("Can not set name for cross-domain window: "+c);ye(s).name=c,d&&d.setAttribute("name",c),i=C.resolve(c)})}}}var G=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 C,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=C.hash({isPopup:r,name:o}).then(function(u){var c=u.name;u.isPopup&&c&&window.open("",c,"noopener")}),a=this.serializedWindow.focus();return C.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()}),k("winToProxyWindow").set(t,this)},n.awaitWindow=function(){return this.actualWindowPromise},n.matchWindow=function(t,r){var o=this,i=r.send;return C.try(function(){return o.actualWindow?t===o.actualWindow:C.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:mt(t,{send:i})}).then(function(a){var u=a.proxyInstanceID===a.knownWindowInstanceID;return u&&o.setWindow(t,{send:i}),u})})},n.unwrap=function(){return this.actualWindow||this},n.getInstanceID=function(){return this.serializedWindow.getInstanceID()},n.shouldClean=function(){return!!(this.actualWindow&&q(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 je(),e.toProxyWindow(t,{send:o}).serialize()},e.deserialize=function(t,r){var o=r.send;return je(),j("idToProxyWindow").get(t.id)||new e({serializedWindow:t,send:o})},e.isProxyWindow=function(t){return!!(t&&!Ee(t)&&t.isProxyWindow)},e.toProxyWindow=function(t,r){var o=r.send;if(je(),e.isProxyWindow(t))return t;var i=t;return k("winToProxyWindow").get(i)||new e({win:i,send:o})},e}();function Me(e,n,t,r,o){var i=k("methodStore"),a=j("proxyWindowMethods");G.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 gt(e,n){var t=k("methodStore"),r=j("proxyWindowMethods");return t.getOrSet(e,function(){return{}})[n]||r.get(n)}function yt(e,n,t,r,o){a=(i={on:o.on,send:o.send}).on,u=i.send,j("builtinListeners").getOrSet("functionCalls",function(){return a("postrobot_method",{domain:"*"},function(l){var d=l.source,f=l.origin,h=l.data,S=h.id,x=h.name,b=gt(d,S);if(!b)throw new Error("Could not find method '"+x+"' with id: "+h.id+" in "+L(window));var I=b.source,D=b.domain,P=b.val;return C.try(function(){if(!ie(D,f))throw new Error("Method '"+h.name+"' domain "+JSON.stringify(Ne(b.domain)?b.domain.source:b.domain)+" does not match origin "+f+" in "+L(window));if(G.isProxyWindow(I))return I.matchWindow(d,{send:u}).then(function(T){if(!T)throw new Error("Method call '"+h.name+"' failed - proxy window does not match source in "+L(window))})}).then(function(){return P.apply({source:d,origin:f},h.args)},function(T){return C.try(function(){if(P.onError)return P.onError(T)}).then(function(){throw T.stack&&(T.stack="Remote call to "+x+"("+function(M){return M===void 0&&(M=[]),(W=M,[].slice.call(W)).map(function(O){return typeof O=="string"?"'"+O+"'":O===void 0?"undefined":O===null?"null":typeof O=="boolean"?O.toString():Array.isArray(O)?"[ ... ]":typeof O=="object"?"{ ... }":typeof O=="function"?"() => { ... }":"<"+typeof O+">"}).join(", ");var W}(h.args)+`) failed
|
|
54
143
|
|
|
55
|
-
`+
|
|
144
|
+
`+T.stack),T})}).then(function(T){return{result:T,id:S,name:x}})})});var i,a,u,c=t.__id__||V();e=G.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+"::")),G.isProxyWindow(e)?(Me(c,t,s,e,n),e.awaitWindow().then(function(l){Me(c,t,s,l,n)})):Me(c,t,s,e,n),oe("cross_domain_function",{id:c,name:s})}function Et(e,n,t,r){var o,i=r.on,a=r.send;return function(u,c){c===void 0&&(c=yn);var s=JSON.stringify(u,function(l){var d=this[l];if(ze(this))return d;var f=vt(d);if(!f)return d;var h=c[f]||gn[f];return h?h(d,l):d});return s===void 0?"undefined":s}(t,((o={}).promise=function(u,c){return function(s,l,d,f,h){return oe("cross_domain_zalgo_promise",{then:yt(s,l,function(S,x){return d.then(S,x)},f,{on:h.on,send:h.send})})}(e,n,u,c,{on:i,send:a})},o.function=function(u,c){return yt(e,n,u,c,{on:i,send:a})},o.object=function(u){return Ee(u)||G.isProxyWindow(u)?oe("cross_domain_window",G.serialize(u,{send:a})):u},o))}function xt(e,n,t,r){var o,i=r.send;return function(a,u){if(u===void 0&&(u=xn),a!=="undefined")return JSON.parse(a,function(c,s){if(ze(this))return s;var l,d;if(ze(s)?(l=s.__type__,d=s.__val__):(l=vt(s),d=s),!l)return d;var f=u[l]||En[l];return f?f(d,c):d})}(t,((o={}).cross_domain_zalgo_promise=function(a){return function(u,c,s){return new C(s.then)}(0,0,a)},o.cross_domain_function=function(a){return function(u,c,s,l){var d=s.id,f=s.name,h=l.send,S=function(b){b===void 0&&(b={});function I(){var D=arguments;return G.toProxyWindow(u,{send:h}).awaitWindow().then(function(P){var T=gt(P,d);if(T&&T.val!==I)return T.val.apply({source:window,origin:L()},D);var M=[].slice.call(D);return b.fireAndForget?h(P,"postrobot_method",{id:d,name:f,args:M},{domain:c,fireAndForget:!0}):h(P,"postrobot_method",{id:d,name:f,args:M},{domain:c,fireAndForget:!1}).then(function(W){return W.data.result})}).catch(function(P){throw P})}return I.__name__=f,I.__origin__=c,I.__source__=u,I.__id__=d,I.origin=c,I},x=S();return x.fireAndForget=S({fireAndForget:!0}),x}(e,n,a,{send:i})},o.cross_domain_window=function(a){return G.deserialize(a,{send:i})},o))}var Le={};Le.postrobot_post_message=function(e,n,t){t.indexOf("file:")===0&&(t="*"),e.postMessage(n,t)};function ke(e,n,t,r){var o=r.on,i=r.send;return C.try(function(){var a=k().getOrSet(e,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(t),a.flush=a.flush||C.flush().then(function(){if(q(e))throw new Error("Window is closed");var u=Et(e,n,((c={}).__post_robot_10_0_46__=a.buffer||[],c),{on:o,send:i}),c;delete a.buffer;for(var s=Object.keys(Le),l=[],d=0;d<s.length;d++){var f=s[d];try{Le[f](e,u,n)}catch(h){l.push(h)}}if(l.length===s.length)throw new Error(`All post-robot messaging strategies failed:
|
|
56
145
|
|
|
57
|
-
`+l.map(function(h,
|
|
146
|
+
`+l.map(function(h,S){return S+". "+he(h)}).join(`
|
|
58
147
|
|
|
59
|
-
`))}),a.flush.then(function(){delete a.flush})}).then(
|
|
148
|
+
`))}),a.flush.then(function(){delete a.flush})}).then(re)}function bt(e){return j("responseListeners").get(e)}function St(e){j("responseListeners").del(e)}function Wt(e){return j("erroredResponseListeners").has(e)}function Ct(e){var n=e.name,t=e.win,r=e.domain,o=k("requestListeners");if(t==="*"&&(t=null),r==="*"&&(r=null),!n)throw new Error("Name required to get request listener");for(var i=0,a=[t,We()];i<a.length;i++){var u=a[i];if(u){var c=o.get(u);if(c){var s=c[n];if(s){if(r&&typeof r=="string"){if(s[r])return s[r];if(s.__domain_regex__)for(var l=0,d=s.__domain_regex__;l<d.length;l++){var f=d[l],h=f.listener;if(ie(f.regex,r))return h}}if(s["*"])return s["*"]}}}}}function bn(e,n,t,r){var o=r.on,i=r.send,a=Ct({name:t.name,win:e,domain:n}),u=t.name==="postrobot_method"&&t.data&&typeof t.data.name=="string"?t.data.name+"()":t.name;function c(s,l,d){return C.flush().then(function(){if(!t.fireAndForget&&!q(e))try{return ke(e,n,{id:V(),origin:L(window),type:"postrobot_message_response",hash:t.hash,name:t.name,ack:s,data:l,error:d},{on:o,send:i})}catch(f){throw new Error("Send response message failed for "+u+" in "+L()+`
|
|
60
149
|
|
|
61
|
-
`+
|
|
150
|
+
`+he(f))}})}return C.all([C.flush().then(function(){if(!t.fireAndForget&&!q(e))try{return ke(e,n,{id:V(),origin:L(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 "+u+" in "+L()+`
|
|
62
151
|
|
|
63
|
-
`+
|
|
152
|
+
`+he(s))}}),C.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 c("success",s)},function(s){return c("error",null,s)})]).then(re).catch(function(s){if(a&&a.handleError)return a.handleError(s);throw s})}function Sn(e,n,t){if(!Wt(t.hash)){var r=bt(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(!ie(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 Wn(e,n,t){if(!Wt(t.hash)){var r=bt(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(!ie(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");St(t.hash),t.ack==="error"?r.promise.reject(t.error):t.ack==="success"&&r.promise.resolve({source:e,origin:n,data:t.data})}}function It(e,n){var t=n.on,r=n.send,o=j("receivedMessages");try{if(!window||window.closed||!e.source)return}catch{return}var i=e.source,a=e.origin,u=function(l,d,f,h){var S=h.on,x=h.send,b;try{b=xt(d,f,l,{on:S,send:x})}catch{return}if(b&&typeof b=="object"&&b!==null){var I=b.__post_robot_10_0_46__;if(Array.isArray(I))return I}}(e.data,i,a,{on:t,send:r});if(u){pt(i);for(var c=0;c<u.length;c++){var s=u[c];if(o.has(s.id)||(o.set(s.id,!0),q(i)&&!s.fireAndForget))return;s.origin.indexOf("file:")===0&&(a="file://");try{s.type==="postrobot_message_request"?bn(i,a,s,{on:t,send:r}):s.type==="postrobot_message_response"?Wn(i,a,s):s.type==="postrobot_message_ack"&&Sn(i,a,s)}catch(l){setTimeout(function(){throw l},0)}}}}function Q(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 u=i.name,c=i.win,s=i.domain,l=k("requestListeners");if(!u||typeof u!="string")throw new Error("Name required to add request listener");if(c&&c!=="*"&&G.isProxyWindow(c)){var d=c.awaitWindow().then(function(N){return o({name:u,win:N,domain:s},a)});return{cancel:function(){d.then(function(N){return N.cancel()},re)}}}var f=c;if(Array.isArray(f)){for(var h=[],S=0,x=f;S<x.length;S++)h.push(o({name:u,domain:s,win:x[S]},a));return{cancel:function(){for(var N=0;N<h.length;N++)h[N].cancel()}}}if(Array.isArray(s)){for(var b=[],I=0,D=s;I<D.length;I++)b.push(o({name:u,win:f,domain:D[I]},a));return{cancel:function(){for(var N=0;N<b.length;N++)b[N].cancel()}}}var P=Ct({name:u,win:f,domain:s});f&&f!=="*"||(f=We());var T=(s=s||"*").toString();if(P)throw f&&s?new Error("Request listener already exists for "+u+" on domain "+s.toString()+" for "+(f===We()?"wildcard":"specified")+" window"):f?new Error("Request listener already exists for "+u+" for "+(f===We()?"wildcard":"specified")+" window"):s?new Error("Request listener already exists for "+u+" on domain "+s.toString()):new Error("Request listener already exists for "+u);var M=l.getOrSet(f,function(){return{}}),W=me(M,u,function(){return{}}),O,J;return Ne(s)?(O=me(W,"__domain_regex__",function(){return[]})).push(J={regex:s,listener:a}):W[T]=a,{cancel:function(){delete W[T],J&&(O.splice(O.indexOf(J,1)),O.length||delete W.__domain_regex__),Object.keys(W).length||delete M[u],f&&!Object.keys(M).length&&l.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 Cn(e,n,t){typeof(n=n||{})=="function"&&(t=n,n={});var r=new C,o;return n.errorHandler=function(i){o.cancel(),r.reject(i)},o=Q(e,n,function(i){if(o.cancel(),r.resolve(i),t)return t(i)}),r.cancel=o.cancel,r}var ee=function e(n,t,r,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,u=o.timeout||5e3,c=o.fireAndForget||!1;return G.toProxyWindow(n,{send:e}).awaitWindow().then(function(s){return C.try(function(){if(function(l,d,f){if(!l)throw new Error("Expected name");if(f&&typeof f!="string"&&!Array.isArray(f)&&!Ne(f))throw new TypeError("Can not send "+l+". Expected domain "+JSON.stringify(f)+" to be a string, array, or regex");if(q(d))throw new Error("Can not send "+l+". Target window is closed")}(t,s,i),function(l,d){var f=Qe(d);if(f)return f===l;if(d===l||function(x){x===void 0&&(x=window);try{if(x.top)return x.top}catch{}if($(x)===x)return x;try{if(Xe(window,x)&&window.top)return window.top}catch{}try{if(Xe(x,window)&&window.top)return window.top}catch{}for(var b=0,I=function P(T){for(var M=[],W=0,O=Ke(T);W<O.length;W++){var J=O[W];M.push(J);for(var N=0,ve=P(J);N<ve.length;N++)M.push(ve[N])}return M}(x);b<I.length;b++){var D=I[b];try{if(D.top)return D.top}catch{}if($(D)===D)return D}}(d)===d)return!1;for(var h=0,S=Ke(l);h<S.length;h++)if(S[h]===d)return!0;return!1}(window,s))return function(l,d,f){d===void 0&&(d=5e3),f===void 0&&(f="Window");var h=function(S){return k("helloPromises").getOrSet(S,function(){return new C})}(l);return d!==-1&&(h=h.timeout(d,new Error(f+" did not load after "+d+"ms"))),h}(s,u)}).then(function(l){return function(d,f,h,S){var x=S.send;return C.try(function(){return typeof f=="string"?f:C.try(function(){return h||De(d,{send:x}).then(function(b){return b.domain})}).then(function(b){if(!ie(f,f))throw new Error("Domain "+st(f)+" does not match "+st(f));return b})})}(s,i,(l===void 0?{}:l).domain,{send:e})}).then(function(l){var d=l,f=t==="postrobot_method"&&r&&typeof r.name=="string"?r.name+"()":t,h=new C,S=t+"_"+V();if(!c){var x={name:t,win:s,domain:d,promise:h};(function(W,O){j("responseListeners").set(W,O)})(S,x);var b=k("requestPromises").getOrSet(s,function(){return[]});b.push(h),h.catch(function(){(function(W){j("erroredResponseListeners").set(W,!0)})(S),St(S)});var I=function(W){return k("knownWindows").get(W,!1)}(s)?1e4:2e3,D=a,P=I,T=D,M=function(W,O){var J;return function N(){J=setTimeout(function(){(function(){if(q(s))return h.reject(new Error("Window closed for "+t+" before "+(x.ack?"response":"ack")));if(x.cancelled)return h.reject(new Error("Response listener was cancelled for "+t));P=Math.max(P-500,0),T!==-1&&(T=Math.max(T-500,0)),x.ack||P!==0?T===0&&h.reject(new Error("No response for postMessage "+f+" in "+L()+" in "+D+"ms")):h.reject(new Error("No ack for postMessage "+f+" in "+L()+" in "+I+"ms"))})(),N()},500)}(),{cancel:function(){clearTimeout(J)}}}();h.finally(function(){M.cancel(),b.splice(b.indexOf(h,1))}).catch(re)}return ke(s,d,{id:V(),origin:L(window),type:"postrobot_message_request",hash:S,name:t,data:r,fireAndForget:c},{on:Q,send:e}).then(function(){return c?h.resolve():h},function(W){throw new Error("Send request message failed for "+f+" in "+L()+`
|
|
64
153
|
|
|
65
|
-
`+
|
|
154
|
+
`+he(W))})})})};function In(e,n,t){return Et(e,n,t,{on:Q,send:ee})}function Tn(e,n,t){return xt(e,n,t,{on:Q,send:ee})}function Pn(e){return new G({send:ee,win:e})}function On(e){return G.toProxyWindow(e,{send:ee})}function Tt(){pe().initialized||(pe().initialized=!0,n=(e={on:Q,send:ee}).on,t=e.send,(r=pe()).receiveMessage=r.receiveMessage||function(o){return It(o,{on:n,send:t})},function(o){var i=o.on,a=o.send;j().getOrSet("postMessageListener",function(){return function(u,c,s){return u.addEventListener("message",s),{cancel:function(){u.removeEventListener("message",s)}}}(window,0,function(u){(function(c,s){var l=s.on,d=s.send;C.try(function(){var f=c.source||c.sourceElement,h=c.origin||c.originalEvent&&c.originalEvent.origin,S=c.data;if(h==="null"&&(h="file://"),f){if(!h)throw new Error("Post message did not have origin domain");It({source:f,origin:h,data:S},{on:l,send:d})}})})(u,{on:i,send:a})})})}({on:Q,send:ee}),function(o){var i=o.on,a=o.send;j("builtinListeners").getOrSet("helloListener",function(){var u=i("postrobot_hello",{domain:"*"},function(s){return ht(s.source,{domain:s.origin}),{instanceID:lt()}}),c=Qe();return c&&De(c,{send:a}).catch(function(s){}),u})}({on:Q,send:ee}));var e,n,t,r}function Rn(){(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 An=!0;function Nn(e){for(var n=0,t=k("requestPromises").get(e,[]);n<t.length;n++)t[n].reject(new Error("Window "+(q(e)?"closed":"cleaned up")+" before response")).catch(re)}Tt()}])})})(Ze);var un=Ze.exports;(function(p){p.exports=un,p.exports.default=p.exports})(Ye);var Ve=Ye.exports;const Pe=A({__proto__:null,default:cn(Ve)},[Ve]);R.ConsentBox=Yt,R.SoyioTypes=Zt,R.SoyioWidget=Je,R._TooltipManager=qe,R.default=Je,Object.defineProperties(R,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|