@soyio/soyio-widget 1.0.5 → 1.0.7

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 CHANGED
@@ -30,7 +30,7 @@ Integrate the widget into your frontend framework using the script below. Ensure
30
30
 
31
31
  ```html
32
32
  <script>
33
- import Widget from '@soyio/soyio-widget';
33
+ import SoyioWidget from '@soyio/soyio-widget';
34
34
 
35
35
  // Widget configuration
36
36
  const widgetConfig = {
@@ -50,7 +50,7 @@ Integrate the widget into your frontend framework using the script below. Ensure
50
50
 
51
51
  // Create widget when needed. In this example, widget is created when page is loaded.
52
52
  document.addEventListener("DOMContentLoaded", function () {
53
- new Widget(widgetConfig);
53
+ new SoyioWidget(widgetConfig);
54
54
  });
55
55
  </script>
56
56
  ```
@@ -84,6 +84,8 @@ The `onEvent` callback is designed to handle various events that occur during wi
84
84
  - `identityId`: The unique identifier for the authenticated identity.
85
85
  - `userReference`: The reference identifier for the user, facilitating the association of the event with the user within the company's context.
86
86
 
87
+ - **`DENIED_CAMERA_PERMISSION`**: Event triggered when user denies camera permissions. It closes the widget.
88
+
87
89
  - **`WIDGET_CLOSED`**: This event occurs when the user closes the `Soyio` pop up. The event object is as follows:
88
90
 
89
91
  - `{ eventName: 'WIDGET_CLOSED' }`.
@@ -95,7 +97,9 @@ The `onEvent` callback is designed to handle various events that occur during wi
95
97
 
96
98
  The `forceError` parameter can simulate the following error conditions:
97
99
 
98
- - `'user_exists'`: Triggers an error indicating that a user with the given credentials already exists in the system.
100
+
99
101
  - `'facial_validation_error'`: Simulates a failure in the facial video liveness test, indicating the system could not verify the user's live presence.
100
102
  - `'document_validation_error'`: Indicates an issue with validating the photos of the documents provided by the user.
101
103
  - `'unknown_error'`: Generates a generic error, representing an unspecified problem.
104
+ - `'expiration_error'`: Occurs when there is an issue with the identity provider that prevents the validation of one or both documents provided by the user, due to unspecified problems in the validation process.
105
+ - `'camera_permission_error'`: Happens when the user does not grant the necessary permissions to access the camera, preventing the completion of the validation flow.
package/dist/index.d.ts CHANGED
@@ -1,22 +1,44 @@
1
- declare type ConfigProps = {
1
+ declare type AuthAttemptProps = {
2
2
  companyId: string;
3
+ identityId: string;
3
4
  userReference?: string;
4
- flowTemplateId?: string;
5
- userEmail?: string;
6
- identityId?: string;
7
- forceError?: SoyioErrors;
5
+ forceError?: ForceErrors;
8
6
  customColor?: string;
9
7
  };
10
8
 
9
+ declare type ConfigProps = AuthAttemptProps | ValidationAttemptProps;
10
+
11
11
  declare type EventData = {
12
- eventName: 'IDENTITY_REGISTERED' | 'IDENTITY_AUTHENTICATED';
12
+ eventName: 'IDENTITY_REGISTERED' | 'IDENTITY_AUTHENTICATED' | 'DENIED_CAMERA_PERMISSION';
13
13
  identityId: string;
14
14
  userReference?: string;
15
15
  };
16
16
 
17
17
  declare type Flow = 'authenticate' | 'register';
18
18
 
19
- declare type SoyioErrors = 'user_exists' | 'facial_validation_error' | 'document_validation_error' | 'unknown_error';
19
+ declare type ForceErrors = 'facial_validation_error' | 'document_validation_error' | 'unknown_error' | 'expiration_error' | 'camera_permission_error';
20
+
21
+ declare namespace SoyioTypes {
22
+ export {
23
+ ForceErrors,
24
+ Flow,
25
+ AuthAttemptProps,
26
+ ValidationAttemptProps,
27
+ ConfigProps,
28
+ EventData,
29
+ WidgetConfig
30
+ }
31
+ }
32
+ export { SoyioTypes }
33
+
34
+ declare type ValidationAttemptProps = {
35
+ companyId: string;
36
+ flowTemplateId: string;
37
+ userReference?: string;
38
+ userEmail?: string;
39
+ forceError?: ForceErrors;
40
+ customColor?: string;
41
+ };
20
42
 
21
43
  declare class Widget {
22
44
  #private;
@@ -24,14 +46,14 @@ declare class Widget {
24
46
  private configProps;
25
47
  private onEvent;
26
48
  private isSandbox;
27
- constructor(options: WidgetConfig);
49
+ constructor(options: SoyioTypes.WidgetConfig);
28
50
  validateProps(): void;
29
51
  }
30
52
  export default Widget;
31
53
 
32
54
  declare type WidgetConfig = {
33
55
  flow: Flow;
34
- configProps: Partial<ConfigProps>;
56
+ configProps: ConfigProps;
35
57
  onEvent: (data: EventData) => void;
36
58
  isSandbox?: boolean;
37
59
  developmentUrl?: string;
package/dist/index.js CHANGED
@@ -67,7 +67,7 @@ var ht = { exports: {} }, lt = { exports: {} };
67
67
  }, g.p = "", g(g.s = 0);
68
68
  }([function(A, S, g) {
69
69
  g.r(S), g.d(S, "Promise", function() {
70
- return b;
70
+ return P;
71
71
  }), g.d(S, "TYPES", function() {
72
72
  return Lt;
73
73
  }), g.d(S, "ProxyWindow", function() {
@@ -446,7 +446,7 @@ var ht = { exports: {} }, lt = { exports: {} };
446
446
  function rn() {
447
447
  Wn -= 1, Fn();
448
448
  }
449
- var b = function() {
449
+ var P = function() {
450
450
  function n(t) {
451
451
  var e = this;
452
452
  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) {
@@ -866,7 +866,7 @@ var ht = { exports: {} }, lt = { exports: {} };
866
866
  for (var e = arguments, o = this, i = arguments.length, a = new Array(i), s = 0; s < i; s++)
867
867
  a[s] = arguments[s];
868
868
  var c = Bn(a);
869
- return r.hasOwnProperty(c) || (r[c] = b.try(function() {
869
+ return r.hasOwnProperty(c) || (r[c] = P.try(function() {
870
870
  return n.apply(o, e);
871
871
  }).finally(function() {
872
872
  delete r[c];
@@ -912,7 +912,7 @@ var ht = { exports: {} }, lt = { exports: {} };
912
912
  n.hasOwnProperty(t) && r.push(n[t]);
913
913
  return r;
914
914
  });
915
- function bn(n) {
915
+ function Pn(n) {
916
916
  return {}.toString.call(n) === "[object RegExp]";
917
917
  }
918
918
  function un(n, r, t) {
@@ -934,7 +934,7 @@ var ht = { exports: {} }, lt = { exports: {} };
934
934
  return !!document.body && document.readyState === "interactive";
935
935
  }
936
936
  on(function() {
937
- return new b(function(n) {
937
+ return new P(function(n) {
938
938
  if (Zn() || Vn())
939
939
  return n();
940
940
  var r = setInterval(function() {
@@ -1067,12 +1067,12 @@ var ht = { exports: {} }, lt = { exports: {} };
1067
1067
  o && o.resolve({
1068
1068
  domain: t
1069
1069
  });
1070
- var i = b.resolve({
1070
+ var i = P.resolve({
1071
1071
  domain: t
1072
1072
  });
1073
1073
  return e.set(n, i), i;
1074
1074
  }
1075
- function Pn(n, r) {
1075
+ function bn(n, r) {
1076
1076
  return (0, r.send)(n, "postrobot_hello", {
1077
1077
  instanceID: Yn()
1078
1078
  }, {
@@ -1092,7 +1092,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1092
1092
  function Kn(n, r) {
1093
1093
  var t = r.send;
1094
1094
  return C("windowInstanceIDPromises").getOrSet(n, function() {
1095
- return Pn(n, {
1095
+ return bn(n, {
1096
1096
  send: t
1097
1097
  }).then(function(e) {
1098
1098
  return e.instanceID;
@@ -1114,7 +1114,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1114
1114
  __val__: r
1115
1115
  };
1116
1116
  }
1117
- var L, bt = ((L = {}).function = function() {
1117
+ var L, Pt = ((L = {}).function = function() {
1118
1118
  }, L.error = function(n) {
1119
1119
  return K("error", {
1120
1120
  message: n.message,
@@ -1141,7 +1141,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1141
1141
  return n;
1142
1142
  }, L[void 0] = function(n) {
1143
1143
  return K("undefined", n);
1144
- }, L), Pt = {}, F, It = ((F = {}).function = function() {
1144
+ }, L), bt = {}, F, It = ((F = {}).function = function() {
1145
1145
  throw new Error("Function serialization is not implemented; nothing to deserialize");
1146
1146
  }, F.error = function(n) {
1147
1147
  var r = n.stack, t = n.code, e = n.data, o = new Error(n.message);
@@ -1168,7 +1168,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1168
1168
  return n;
1169
1169
  }, F[void 0] = function() {
1170
1170
  }, F), Ot = {};
1171
- new b(function(n) {
1171
+ new P(function(n) {
1172
1172
  if (window.document && window.document.body)
1173
1173
  return n(window.document.body);
1174
1174
  var r = setInterval(function() {
@@ -1236,8 +1236,8 @@ var ht = { exports: {} }, lt = { exports: {} };
1236
1236
  if (!w)
1237
1237
  throw new Error("Can not post to window without target name");
1238
1238
  (function(m) {
1239
- var P = m.url, R = m.target, O = m.body, I = m.method, j = I === void 0 ? "post" : I, W = document.createElement("form");
1240
- if (W.setAttribute("target", R), W.setAttribute("method", j), W.setAttribute("action", P), W.style.display = "none", O)
1239
+ var b = m.url, R = m.target, O = m.body, I = m.method, j = I === void 0 ? "post" : I, W = document.createElement("form");
1240
+ if (W.setAttribute("target", R), W.setAttribute("method", j), W.setAttribute("action", b), W.style.display = "none", O)
1241
1241
  for (var D = 0, B = Object.keys(O); D < B.length; D++) {
1242
1242
  var N, sn = B[D], Rn = document.createElement("input");
1243
1243
  Rn.setAttribute("name", sn), Rn.setAttribute("value", (N = O[sn]) == null ? void 0 : N.toString()), W.appendChild(Rn);
@@ -1268,7 +1268,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1268
1268
  var h = $(u), d = Mn(u);
1269
1269
  if (!h)
1270
1270
  throw new Error("Can not set name for cross-domain window: " + c);
1271
- vn(u).name = c, d && d.setAttribute("name", c), i = b.resolve(c);
1271
+ vn(u).name = c, d && d.setAttribute("name", c), i = P.resolve(c);
1272
1272
  });
1273
1273
  }
1274
1274
  };
@@ -1276,7 +1276,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1276
1276
  var H = function() {
1277
1277
  function n(t) {
1278
1278
  var e = t.send, o = t.win, i = t.serializedWindow;
1279
- 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 b(), this.serializedWindow = i || _n(this.actualWindowPromise, {
1279
+ this.id = void 0, this.isProxyWindow = !0, this.serializedWindow = void 0, this.actualWindow = void 0, this.actualWindowPromise = void 0, this.send = void 0, this.name = void 0, this.actualWindowPromise = new P(), this.serializedWindow = i || _n(this.actualWindowPromise, {
1280
1280
  send: e
1281
1281
  }), z("idToProxyWindow").set(this.getID(), this), o && this.setWindow(o, {
1282
1282
  send: e
@@ -1309,14 +1309,14 @@ var ht = { exports: {} }, lt = { exports: {} };
1309
1309
  return t;
1310
1310
  });
1311
1311
  }, r.focus = function() {
1312
- var t = this, e = this.isPopup(), o = this.getName(), i = b.hash({
1312
+ var t = this, e = this.isPopup(), o = this.getName(), i = P.hash({
1313
1313
  isPopup: e,
1314
1314
  name: o
1315
1315
  }).then(function(s) {
1316
1316
  var c = s.name;
1317
1317
  s.isPopup && c && window.open("", c, "noopener");
1318
1318
  }), a = this.serializedWindow.focus();
1319
- return b.all([i, a]).then(function() {
1319
+ return P.all([i, a]).then(function() {
1320
1320
  return t;
1321
1321
  });
1322
1322
  }, r.isClosed = function() {
@@ -1333,8 +1333,8 @@ var ht = { exports: {} }, lt = { exports: {} };
1333
1333
  return this.actualWindowPromise;
1334
1334
  }, r.matchWindow = function(t, e) {
1335
1335
  var o = this, i = e.send;
1336
- return b.try(function() {
1337
- return o.actualWindow ? t === o.actualWindow : b.hash({
1336
+ return P.try(function() {
1337
+ return o.actualWindow ? t === o.actualWindow : P.hash({
1338
1338
  proxyInstanceID: o.getInstanceID(),
1339
1339
  knownWindowInstanceID: Kn(t, {
1340
1340
  send: i
@@ -1413,12 +1413,12 @@ var ht = { exports: {} }, lt = { exports: {} };
1413
1413
  var d = h.source, f = h.origin, l = h.data, p = l.id, w = l.name, m = nt(d, p);
1414
1414
  if (!m)
1415
1415
  throw new Error("Could not find method '" + w + "' with id: " + l.id + " in " + T(window));
1416
- var P = m.source, R = m.domain, O = m.val;
1417
- return b.try(function() {
1416
+ var b = m.source, R = m.domain, O = m.val;
1417
+ return P.try(function() {
1418
1418
  if (!_(R, f))
1419
- throw new Error("Method '" + l.name + "' domain " + JSON.stringify(bn(m.domain) ? m.domain.source : m.domain) + " does not match origin " + f + " in " + T(window));
1420
- if (H.isProxyWindow(P))
1421
- return P.matchWindow(d, {
1419
+ throw new Error("Method '" + l.name + "' domain " + JSON.stringify(Pn(m.domain) ? m.domain.source : m.domain) + " does not match origin " + f + " in " + T(window));
1420
+ if (H.isProxyWindow(b))
1421
+ return b.matchWindow(d, {
1422
1422
  send: s
1423
1423
  }).then(function(I) {
1424
1424
  if (!I)
@@ -1430,7 +1430,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1430
1430
  origin: f
1431
1431
  }, l.args);
1432
1432
  }, function(I) {
1433
- return b.try(function() {
1433
+ return P.try(function() {
1434
1434
  if (O.onError)
1435
1435
  return O.onError(I);
1436
1436
  }).then(function() {
@@ -1465,7 +1465,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1465
1465
  function rt(n, r, t, e) {
1466
1466
  var o, i = e.on, a = e.send;
1467
1467
  return function(s, c) {
1468
- c === void 0 && (c = Pt);
1468
+ c === void 0 && (c = bt);
1469
1469
  var u = JSON.stringify(s, function(h) {
1470
1470
  var d = this[h];
1471
1471
  if (In(this))
@@ -1473,7 +1473,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1473
1473
  var f = Qn(d);
1474
1474
  if (!f)
1475
1475
  return d;
1476
- var l = c[f] || bt[f];
1476
+ var l = c[f] || Pt[f];
1477
1477
  return l ? l(d, h) : d;
1478
1478
  });
1479
1479
  return u === void 0 ? "undefined" : u;
@@ -1517,19 +1517,19 @@ var ht = { exports: {} }, lt = { exports: {} };
1517
1517
  });
1518
1518
  }(t, ((o = {}).cross_domain_zalgo_promise = function(a) {
1519
1519
  return function(s, c, u) {
1520
- return new b(u.then);
1520
+ return new P(u.then);
1521
1521
  }(0, 0, a);
1522
1522
  }, o.cross_domain_function = function(a) {
1523
1523
  return function(s, c, u, h) {
1524
1524
  var d = u.id, f = u.name, l = h.send, p = function(m) {
1525
1525
  m === void 0 && (m = {});
1526
- function P() {
1526
+ function b() {
1527
1527
  var R = arguments;
1528
1528
  return H.toProxyWindow(s, {
1529
1529
  send: l
1530
1530
  }).awaitWindow().then(function(O) {
1531
1531
  var I = nt(O, d);
1532
- if (I && I.val !== P)
1532
+ if (I && I.val !== b)
1533
1533
  return I.val.apply({
1534
1534
  source: window,
1535
1535
  origin: T()
@@ -1556,7 +1556,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1556
1556
  throw O;
1557
1557
  });
1558
1558
  }
1559
- return P.__name__ = f, P.__origin__ = c, P.__source__ = s, P.__id__ = d, P.origin = c, P;
1559
+ return b.__name__ = f, b.__origin__ = c, b.__source__ = s, b.__id__ = d, b.origin = c, b;
1560
1560
  }, w = p();
1561
1561
  return w.fireAndForget = p({
1562
1562
  fireAndForget: !0
@@ -1576,11 +1576,11 @@ var ht = { exports: {} }, lt = { exports: {} };
1576
1576
  };
1577
1577
  function Nn(n, r, t, e) {
1578
1578
  var o = e.on, i = e.send;
1579
- return b.try(function() {
1579
+ return P.try(function() {
1580
1580
  var a = C().getOrSet(n, function() {
1581
1581
  return {};
1582
1582
  });
1583
- return a.buffer = a.buffer || [], a.buffer.push(t), a.flush = a.flush || b.flush().then(function() {
1583
+ return a.buffer = a.buffer || [], a.buffer.push(t), a.flush = a.flush || P.flush().then(function() {
1584
1584
  if (U(n))
1585
1585
  throw new Error("Window is closed");
1586
1586
  var s = rt(n, r, ((c = {}).__post_robot_10_0_46__ = a.buffer || [], c), {
@@ -1653,7 +1653,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1653
1653
  domain: r
1654
1654
  }), s = t.name === "postrobot_method" && t.data && typeof t.data.name == "string" ? t.data.name + "()" : t.name;
1655
1655
  function c(u, h, d) {
1656
- return b.flush().then(function() {
1656
+ return P.flush().then(function() {
1657
1657
  if (!t.fireAndForget && !U(n))
1658
1658
  try {
1659
1659
  return Nn(n, r, {
@@ -1676,7 +1676,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1676
1676
  }
1677
1677
  });
1678
1678
  }
1679
- return b.all([b.flush().then(function() {
1679
+ return P.all([P.flush().then(function() {
1680
1680
  if (!t.fireAndForget && !U(n))
1681
1681
  try {
1682
1682
  return Nn(n, r, {
@@ -1694,7 +1694,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1694
1694
 
1695
1695
  ` + an(u));
1696
1696
  }
1697
- }), b.try(function() {
1697
+ }), P.try(function() {
1698
1698
  if (!a)
1699
1699
  throw new Error("No handler found for post message: " + t.name + " from " + r + " in " + window.location.protocol + "//" + window.location.host + window.location.pathname);
1700
1700
  return a.handler({
@@ -1764,9 +1764,9 @@ var ht = { exports: {} }, lt = { exports: {} };
1764
1764
  return;
1765
1765
  }
1766
1766
  if (m && typeof m == "object" && m !== null) {
1767
- var P = m.__post_robot_10_0_46__;
1768
- if (Array.isArray(P))
1769
- return P;
1767
+ var b = m.__post_robot_10_0_46__;
1768
+ if (Array.isArray(b))
1769
+ return b;
1770
1770
  }
1771
1771
  }(n.data, i, a, {
1772
1772
  on: t,
@@ -1833,11 +1833,11 @@ var ht = { exports: {} }, lt = { exports: {} };
1833
1833
  };
1834
1834
  }
1835
1835
  if (Array.isArray(u)) {
1836
- for (var m = [], P = 0, R = u; P < R.length; P++)
1836
+ for (var m = [], b = 0, R = u; b < R.length; b++)
1837
1837
  m.push(o({
1838
1838
  name: s,
1839
1839
  win: f,
1840
- domain: R[P]
1840
+ domain: R[b]
1841
1841
  }, a));
1842
1842
  return {
1843
1843
  cancel: function() {
@@ -1860,7 +1860,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1860
1860
  }), W = un(j, s, function() {
1861
1861
  return {};
1862
1862
  }), D, B;
1863
- return bn(u) ? (D = un(W, "__domain_regex__", function() {
1863
+ return Pn(u) ? (D = un(W, "__domain_regex__", function() {
1864
1864
  return [];
1865
1865
  })).push(B = {
1866
1866
  regex: u,
@@ -1888,7 +1888,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1888
1888
  }
1889
1889
  function Rt(n, r, t) {
1890
1890
  typeof (r = r || {}) == "function" && (t = r, r = {});
1891
- var e = new b(), o;
1891
+ var e = new P(), o;
1892
1892
  return r.errorHandler = function(i) {
1893
1893
  o.cancel(), e.reject(i);
1894
1894
  }, o = q(n, r, function(i) {
@@ -1901,11 +1901,11 @@ var ht = { exports: {} }, lt = { exports: {} };
1901
1901
  return H.toProxyWindow(r, {
1902
1902
  send: n
1903
1903
  }).awaitWindow().then(function(u) {
1904
- return b.try(function() {
1904
+ return P.try(function() {
1905
1905
  if (function(h, d, f) {
1906
1906
  if (!h)
1907
1907
  throw new Error("Expected name");
1908
- if (f && typeof f != "string" && !Array.isArray(f) && !bn(f))
1908
+ if (f && typeof f != "string" && !Array.isArray(f) && !Pn(f))
1909
1909
  throw new TypeError("Can not send " + h + ". Expected domain " + JSON.stringify(f) + " to be a string, array, or regex");
1910
1910
  if (U(d))
1911
1911
  throw new Error("Can not send " + h + ". Target window is closed");
@@ -1932,7 +1932,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1932
1932
  return window.top;
1933
1933
  } catch {
1934
1934
  }
1935
- for (var m = 0, P = function O(I) {
1935
+ for (var m = 0, b = function O(I) {
1936
1936
  for (var j = [], W = 0, D = Tn(I); W < D.length; W++) {
1937
1937
  var B = D[W];
1938
1938
  j.push(B);
@@ -1940,8 +1940,8 @@ var ht = { exports: {} }, lt = { exports: {} };
1940
1940
  j.push(sn[N]);
1941
1941
  }
1942
1942
  return j;
1943
- }(w); m < P.length; m++) {
1944
- var R = P[m];
1943
+ }(w); m < b.length; m++) {
1944
+ var R = b[m];
1945
1945
  try {
1946
1946
  if (R.top)
1947
1947
  return R.top;
@@ -1961,7 +1961,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1961
1961
  d === void 0 && (d = 5e3), f === void 0 && (f = "Window");
1962
1962
  var l = function(p) {
1963
1963
  return C("helloPromises").getOrSet(p, function() {
1964
- return new b();
1964
+ return new P();
1965
1965
  });
1966
1966
  }(h);
1967
1967
  return d !== -1 && (l = l.timeout(d, new Error(f + " did not load after " + d + "ms"))), l;
@@ -1969,9 +1969,9 @@ var ht = { exports: {} }, lt = { exports: {} };
1969
1969
  }).then(function(h) {
1970
1970
  return function(d, f, l, p) {
1971
1971
  var w = p.send;
1972
- return b.try(function() {
1973
- return typeof f == "string" ? f : b.try(function() {
1974
- return l || Pn(d, {
1972
+ return P.try(function() {
1973
+ return typeof f == "string" ? f : P.try(function() {
1974
+ return l || bn(d, {
1975
1975
  send: w
1976
1976
  }).then(function(m) {
1977
1977
  return m.domain;
@@ -1986,7 +1986,7 @@ var ht = { exports: {} }, lt = { exports: {} };
1986
1986
  send: n
1987
1987
  });
1988
1988
  }).then(function(h) {
1989
- var d = h, f = t === "postrobot_method" && e && typeof e.name == "string" ? e.name + "()" : t, l = new b(), p = t + "_" + G();
1989
+ var d = h, f = t === "postrobot_method" && e && typeof e.name == "string" ? e.name + "()" : t, l = new P(), p = t + "_" + G();
1990
1990
  if (!c) {
1991
1991
  var w = {
1992
1992
  name: t,
@@ -2005,9 +2005,9 @@ var ht = { exports: {} }, lt = { exports: {} };
2005
2005
  z("erroredResponseListeners").set(W, !0);
2006
2006
  })(p), it(p);
2007
2007
  });
2008
- var P = function(W) {
2008
+ var b = function(W) {
2009
2009
  return C("knownWindows").get(W, !1);
2010
- }(u) ? 1e4 : 2e3, R = a, O = P, I = R, j = function(W, D) {
2010
+ }(u) ? 1e4 : 2e3, R = a, O = b, I = R, j = function(W, D) {
2011
2011
  var B;
2012
2012
  return function N() {
2013
2013
  B = setTimeout(function() {
@@ -2016,7 +2016,7 @@ var ht = { exports: {} }, lt = { exports: {} };
2016
2016
  return l.reject(new Error("Window closed for " + t + " before " + (w.ack ? "response" : "ack")));
2017
2017
  if (w.cancelled)
2018
2018
  return l.reject(new Error("Response listener was cancelled for " + t));
2019
- O = Math.max(O - 500, 0), I !== -1 && (I = Math.max(I - 500, 0)), w.ack || O !== 0 ? I === 0 && l.reject(new Error("No response for postMessage " + f + " in " + T() + " in " + R + "ms")) : l.reject(new Error("No ack for postMessage " + f + " in " + T() + " in " + P + "ms"));
2019
+ O = Math.max(O - 500, 0), I !== -1 && (I = Math.max(I - 500, 0)), w.ack || O !== 0 ? I === 0 && l.reject(new Error("No response for postMessage " + f + " in " + T() + " in " + R + "ms")) : l.reject(new Error("No ack for postMessage " + f + " in " + T() + " in " + b + "ms"));
2020
2020
  })(), N();
2021
2021
  }, 500);
2022
2022
  }(), {
@@ -2094,7 +2094,7 @@ var ht = { exports: {} }, lt = { exports: {} };
2094
2094
  }(window, 0, function(s) {
2095
2095
  (function(c, u) {
2096
2096
  var h = u.on, d = u.send;
2097
- b.try(function() {
2097
+ P.try(function() {
2098
2098
  var f = c.source || c.sourceElement, l = c.origin || c.originalEvent && c.originalEvent.origin, p = c.data;
2099
2099
  if (l === "null" && (l = "file://"), f) {
2100
2100
  if (!l)
@@ -2130,7 +2130,7 @@ var ht = { exports: {} }, lt = { exports: {} };
2130
2130
  instanceID: Yn()
2131
2131
  };
2132
2132
  }), c = Cn();
2133
- return c && Pn(c, {
2133
+ return c && bn(c, {
2134
2134
  send: a
2135
2135
  }).catch(function(u) {
2136
2136
  }), s;
@@ -2165,10 +2165,10 @@ var qt = lt.exports;
2165
2165
  y.exports = qt, y.exports.default = y.exports;
2166
2166
  })(ht);
2167
2167
  var Zt = ht.exports;
2168
- const Vt = /* @__PURE__ */ Jt(Zt), $t = "WIDGET_EVENT", Yt = "https://app.soyio.id/widget", kt = "https://sandbox.soyio.id/widget", Kt = ["IDENTITY_AUTHENTICATED", "IDENTITY_REGISTERED"], Xt = "WIDGET_CLOSED";
2168
+ const Vt = /* @__PURE__ */ Jt(Zt), $t = "WIDGET_EVENT", Yt = "https://app.soyio.id/widget", kt = "https://sandbox.soyio.id/widget", Kt = ["IDENTITY_AUTHENTICATED", "IDENTITY_REGISTERED", "DENIED_CAMERA_PERMISSION"], Xt = "WIDGET_CLOSED";
2169
2169
  function Qt(y, x, A, S) {
2170
2170
  const g = S || (A ? kt : Yt), v = Object.entries(x).filter(([, E]) => E).map(([E, M]) => `${E}=${encodeURIComponent(M)}`).join("&");
2171
- return `${g}/${y}?platform=web&${v}`;
2171
+ return `${g}/${y}?sdk=web&${v}`;
2172
2172
  }
2173
2173
  let X = null;
2174
2174
  function zn() {
@@ -2198,8 +2198,11 @@ function tr(y) {
2198
2198
  function rr(y) {
2199
2199
  tr(y);
2200
2200
  }
2201
+ const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2202
+ __proto__: null
2203
+ }, Symbol.toStringTag, { value: "Module" }));
2201
2204
  var En, wt;
2202
- class or {
2205
+ class ir {
2203
2206
  constructor(x) {
2204
2207
  dt(this, En);
2205
2208
  dn(this, "flow");
@@ -2217,12 +2220,12 @@ class or {
2217
2220
  }
2218
2221
  validateProps() {
2219
2222
  if (this.flow === "authenticate") {
2220
- if (!this.configProps.identityId)
2223
+ if (this.configProps = this.configProps, !this.configProps.identityId)
2221
2224
  throw new Error("identityId is required");
2222
2225
  if (!this.configProps.companyId)
2223
2226
  throw new Error("companyId is required");
2224
2227
  } else if (this.flow === "register") {
2225
- if (!this.configProps.flowTemplateId)
2228
+ if (this.configProps = this.configProps, !this.configProps.flowTemplateId)
2226
2229
  throw new Error("flowTemplateId is required");
2227
2230
  if (!this.configProps.companyId)
2228
2231
  throw new Error("companyId is required");
@@ -2233,5 +2236,6 @@ En = new WeakSet(), wt = function(x) {
2233
2236
  this.onEvent(x);
2234
2237
  };
2235
2238
  export {
2236
- or as default
2239
+ or as SoyioTypes,
2240
+ ir as default
2237
2241
  };
@@ -1,17 +1,17 @@
1
- (function(N,O){typeof exports=="object"&&typeof module<"u"?module.exports=O():typeof define=="function"&&define.amd?define(O):(N=typeof globalThis<"u"?globalThis:N||self,N["soyio-widget"]=O())})(this,function(){"use strict";var te=Object.defineProperty;var ee=(N,O,T)=>O in N?te(N,O,{enumerable:!0,configurable:!0,writable:!0,value:T}):N[O]=T;var ln=(N,O,T)=>(ee(N,typeof O!="symbol"?O+"":O,T),T),re=(N,O,T)=>{if(!O.has(N))throw TypeError("Cannot "+T)};var wt=(N,O,T)=>{if(O.has(N))throw TypeError("Cannot add the same private member more than once");O instanceof WeakSet?O.add(N):O.set(N,T)};var mt=(N,O,T)=>(re(N,O,"access private method"),T);var vn,pt;var N=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function O(D){return D&&D.__esModule&&Object.prototype.hasOwnProperty.call(D,"default")?D.default:D}var T={exports:{}},Mn={exports:{}};(function(D,C){(function(G,W){D.exports=W()})(typeof self<"u"?self:N,function(){return function(G){var W={};function g(v){if(W[v])return W[v].exports;var y=W[v]={i:v,l:!1,exports:{}};return G[v].call(y.exports,y,y.exports,g),y.l=!0,y.exports}return g.m=G,g.c=W,g.d=function(v,y,F){g.o(v,y)||Object.defineProperty(v,y,{enumerable:!0,get:F})},g.r=function(v){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})},g.t=function(v,y){if(1&y&&(v=g(v)),8&y||4&y&&typeof v=="object"&&v&&v.__esModule)return v;var F=Object.create(null);if(g.r(F),Object.defineProperty(F,"default",{enumerable:!0,value:v}),2&y&&typeof v!="string")for(var K in v)g.d(F,K,(function(tn){return v[tn]}).bind(null,K));return F},g.n=function(v){var y=v&&v.__esModule?function(){return v.default}:function(){return v};return g.d(y,"a",y),y},g.o=function(v,y){return{}.hasOwnProperty.call(v,y)},g.p="",g(g.s=0)}([function(G,W,g){g.r(W),g.d(W,"Promise",function(){return x}),g.d(W,"TYPES",function(){return _t}),g.d(W,"ProxyWindow",function(){return B}),g.d(W,"setup",function(){return vt}),g.d(W,"destroy",function(){return Qt}),g.d(W,"serializeMessage",function(){return Yt}),g.d(W,"deserializeMessage",function(){return kt}),g.d(W,"createProxyWindow",function(){return Kt}),g.d(W,"toProxyWindow",function(){return Xt}),g.d(W,"on",function(){return $}),g.d(W,"once",function(){return $t}),g.d(W,"send",function(){return Y}),g.d(W,"markWindowKnown",function(){return et}),g.d(W,"cleanUpWindow",function(){return ne}),g.d(W,"bridge",function(){});function v(n){return{}.toString.call(n)==="[object RegExp]"}var y=`Call was rejected by callee.\r
2
- `;function F(n){return n===void 0&&(n=window),n.location.protocol}function K(n){if(n===void 0&&(n=window),n.mockDomain){var e=n.mockDomain.split("//")[0];if(e)return e}return F(n)}function tn(n){return n===void 0&&(n=window),K(n)==="about:"}function V(n){if(n===void 0&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch{}}function wn(n){if(n===void 0&&(n=window),n&&!V(n))try{return n.opener}catch{}}function mn(n){try{return!0}catch{}return!1}function pn(n){n===void 0&&(n=window);var e=n.location;if(!e)throw new Error("Can not read window location");var t=F(n);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var r=V(n);return r&&mn()?pn(r):"about://"}var o=e.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function M(n){n===void 0&&(n=window);var e=pn(n);return e&&n.mockDomain&&n.mockDomain.indexOf("mock:")===0?n.mockDomain:e}function X(n){if(!function(e){try{if(e===window)return!0}catch{}try{var t=Object.getOwnPropertyDescriptor(e,"location");if(t&&t.enumerable===!1)return!1}catch{}try{if(tn(e)&&mn())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),K(r)==="mock:"}(e)&&mn())return!0}catch{}try{if(pn(e)===pn(window))return!0}catch{}return!1}(n))return!1;try{if(n===window||tn(n)&&mn()||M(window)===M(n))return!0}catch{}return!1}function gn(n){if(!X(n))throw new Error("Expected window to be same domain");return n}function Fn(n,e){if(!n||!e)return!1;var t=V(e);return t?t===n:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch{}return o}(e).indexOf(n)!==-1}function Hn(n){var e=[],t;try{t=n.frames}catch{t=n}var r;try{r=t.length}catch{}if(r===0)return e;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch{continue}e.push(i)}return e}for(var a=0;a<100;a++){var s=void 0;try{s=t[a]}catch{return e}if(!s)return e;e.push(s)}return e}var zt=[],jt=[];function J(n,e){e===void 0&&(e=!0);try{if(n===window)return!1}catch{return!0}try{if(!n)return!0}catch{return!0}try{if(n.closed)return!0}catch(o){return!o||o.message!==y}if(e&&X(n))try{if(n.mockclosed)return!0}catch{}try{if(!n.parent||!n.top)return!0}catch{}var t=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch{}return-1}(zt,n);if(t!==-1){var r=jt[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 Un(n){return n===void 0&&(n=window),wn(n=n||window)||V(n)||void 0}function en(n,e){if(typeof n=="string"){if(typeof e=="string")return n==="*"||e===n;if(v(e)||Array.isArray(e))return!1}return v(n)?v(e)?n.toString()===e.toString():!Array.isArray(e)&&!!e.match(n):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!v(e)&&n.some(function(t){return en(t,e)}))}function yn(n){try{if(n===window)return!0}catch(e){if(e&&e.message===y)return!0}try{if({}.toString.call(n)==="[object Window]")return!0}catch(e){if(e&&e.message===y)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.self===n)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.parent===n)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.top===n)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in n&&"self"in n&&"location"in n)return!0}catch{}return!1}function Bn(n){if(X(n))return gn(n).frameElement;for(var e=0,t=document.querySelectorAll("iframe");e<t.length;e++){var r=t[e];if(r&&r.contentWindow&&r.contentWindow===n)return r}}function Tt(n){if(function(t){return t===void 0&&(t=window),!!V(t)}(n)){var e=Bn(n);if(e&&e.parentElement){e.parentElement.removeChild(e);return}}try{n.close()}catch{}}function Q(n){try{if(!n)return!1;if(typeof Promise<"u"&&n instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&n instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&n instanceof window.constructor)return!1;var e={}.toString;if(e){var t=e.call(n);if(t==="[object Window]"||t==="[object global]"||t==="[object DOMWindow]")return!1}if(typeof n.then=="function")return!0}catch{return!1}return!1}var Gn=[],rn=[],Pn=0,on;function Jn(){if(!Pn&&on){var n=on;on=null,n.resolve()}}function In(){Pn+=1}function an(){Pn-=1,Jn()}var x=function(){function n(t){var r=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],t){var o,i,a=!1,s=!1,c=!1;In();try{t(function(u){c?r.resolve(u):(a=!0,o=u)},function(u){c?r.reject(u):(s=!0,i=u)})}catch(u){an(),this.reject(u);return}an(),c=!0,a?this.resolve(o):s&&this.reject(i)}}var e=n.prototype;return e.resolve=function(t){if(this.resolved||this.rejected)return this;if(Q(t))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=t,this.dispatch(),this},e.reject=function(t){var r=this;if(this.resolved||this.rejected)return this;if(Q(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(Gn.indexOf(i)===-1){Gn.push(i),setTimeout(function(){throw i},1);for(var s=0;s<rn.length;s++)rn[s](i,a)}}(t,r)},1),this.dispatch(),this},e.asyncReject=function(t){return this.errorHandled=!0,this.reject(t),this},e.dispatch=function(){var t=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(t||r)){this.dispatching=!0,In();for(var i=function(l,p){return l.then(function(w){p.resolve(w)},function(w){p.reject(w)})},a=0;a<o.length;a++){var s=o[a],c=s.onSuccess,u=s.onError,h=s.promise,d=void 0;if(t)try{d=c?c(this.value):this.value}catch(l){h.reject(l);continue}else if(r){if(!u){h.reject(this.error);continue}try{d=u(this.error)}catch(l){h.reject(l);continue}}if(d instanceof n&&(d.resolved||d.rejected)){var f=d;f.resolved?h.resolve(f.value):h.reject(f.error),f.errorHandled=!0}else Q(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?h.resolve(d.value):h.reject(d.error):i(d,h):h.resolve(d)}o.length=0,this.dispatching=!1,an()}},e.then=function(t,r){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.then expected a function for success handler");if(r&&typeof r!="function"&&!r.call)throw new Error("Promise.then expected a function for error handler");var o=new n;return this.handlers.push({promise:o,onSuccess:t,onError:r}),this.errorHandled=!0,this.dispatch(),o},e.catch=function(t){return this.then(void 0,t)},e.finally=function(t){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return n.try(t).then(function(){return r})},function(r){return n.try(t).then(function(){throw r})})},e.timeout=function(t,r){var o=this;if(this.resolved||this.rejected)return this;var i=setTimeout(function(){o.resolved||o.rejected||o.reject(r||new Error("Promise timed out after "+t+"ms"))},t);return this.then(function(a){return clearTimeout(i),a})},e.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.lazy=function(){return this.errorHandled=!0,this},n.resolve=function(t){return t instanceof n?t:Q(t)?new n(function(r,o){return t.then(r,o)}):new n().resolve(t)},n.reject=function(t){return new n().reject(t)},n.asyncReject=function(t){return new n().asyncReject(t)},n.all=function(t){var r=new n,o=t.length,i=[].slice();if(!o)return r.resolve(i),r;for(var a=function(u,h,d){return h.then(function(f){i[u]=f,(o-=1)==0&&r.resolve(i)},function(f){d.reject(f)})},s=0;s<t.length;s++){var c=t[s];if(c instanceof n){if(c.resolved){i[s]=c.value,o-=1;continue}}else if(!Q(c)){i[s]=c,o-=1;continue}a(s,n.resolve(c),r)}return o===0&&r.resolve(i),r},n.hash=function(t){var r={},o=[],i=function(s){if(t.hasOwnProperty(s)){var c=t[s];Q(c)?o.push(c.then(function(u){r[s]=u})):r[s]=c}};for(var a in t)i(a);return n.all(o).then(function(){return r})},n.map=function(t,r){return n.all(t.map(r))},n.onPossiblyUnhandledException=function(t){return function(r){return rn.push(r),{cancel:function(){rn.splice(rn.indexOf(r),1)}}}(t)},n.try=function(t,r,o){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.try expected a function");var i;In();try{i=t.apply(r,o||[])}catch(a){return an(),n.reject(a)}return an(),n.resolve(i)},n.delay=function(t){return new n(function(r){setTimeout(r,t)})},n.isPromise=function(t){return!!(t&&t instanceof n)||Q(t)},n.flush=function(){return function(t){var r=on=on||new t;return Jn(),r}(n)},n}();function En(n,e){for(var t=0;t<n.length;t++)try{if(n[t]===e)return t}catch{}return-1}var On=function(){function n(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if(typeof WeakMap>"u"||Object.freeze===void 0)return!1;try{var t=new WeakMap,r={};return Object.freeze(r),t.set(r,"__testvalue__"),t.get(r)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var e=n.prototype;return e._cleanupClosedWindows=function(){for(var t=this.weakmap,r=this.keys,o=0;o<r.length;o++){var i=r[o];if(yn(i)&&J(i)){if(t)try{t.delete(i)}catch{}r.splice(o,1),this.values.splice(o,1),o-=1}}},e.isSafeToReadWrite=function(t){return!yn(t)},e.set=function(t,r){if(!t)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(t,r)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var i=this.name,a=t[i];a&&a[0]===t?a[1]=r:Object.defineProperty(t,i,{value:[t,r],writable:!0});return}catch{}this._cleanupClosedWindows();var s=this.keys,c=this.values,u=En(s,t);u===-1?(s.push(t),c.push(r)):c[u]=r},e.get=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return r.get(t)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return o&&o[0]===t?o[1]:void 0}catch{}this._cleanupClosedWindows();var i=En(this.keys,t);if(i!==-1)return this.values[i]},e.delete=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(t)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];o&&o[0]===t&&(o[0]=o[1]=void 0)}catch{}this._cleanupClosedWindows();var i=this.keys,a=En(i,t);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},e.has=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return!(!o||o[0]!==t)}catch{}return this._cleanupClosedWindows(),En(this.keys,t)!==-1},e.getOrSet=function(t,r){if(this.has(t))return this.get(t);var o=r();return this.set(t,o),o},n}();function qn(n){return n.name||n.__name__||n.displayName||"anonymous"}function Zn(n,e){try{delete n.name,n.name=e}catch{}return n.__name__=n.displayName=e,n}function Z(){var n="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(e){if(typeof btoa=="function")return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(t,r){return String.fromCharCode(parseInt(r,16))})).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(e,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var Wn;function Vn(n){try{return JSON.stringify([].slice.call(n),function(e,t){return typeof t=="function"?"memoize["+function(r){if(Wn=Wn||new On,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Wn.get(r);return o||(o=typeof r+":"+Z(),Wn.set(r,o)),o}(t)+"]":typeof window<"u"&&t instanceof window.Element||t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object"?{}:t})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function Ct(){return{}}var un=0,$n=0;function cn(n,e){e===void 0&&(e={});var t=e.thisNamespace,r=t!==void 0&&t,o=e.time,i,a,s=un;un+=1;var c=function(){for(var u=arguments.length,h=new Array(u),d=0;d<u;d++)h[d]=arguments[d];s<$n&&(i=null,a=null,s=un,un+=1);var f;f=r?(a=a||new On).getOrSet(this,Ct):i=i||{};var l;try{l=Vn(h)}catch{return n.apply(this,arguments)}var p=f[l];if(p&&o&&Date.now()-p.time<o&&(delete f[l],p=null),p)return p.value;var w=Date.now(),m=n.apply(this,arguments);return f[l]={time:w,value:m},m};return c.reset=function(){i=null,a=null},Zn(c,(e.name||qn(n))+"::memoized")}cn.clear=function(){$n=un};function Mt(n){var e={};function t(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var c=Vn(a);return e.hasOwnProperty(c)||(e[c]=x.try(function(){return n.apply(o,r)}).finally(function(){delete e[c]})),e[c]}return t.reset=function(){e={}},Zn(t,qn(n)+"::promiseMemoized")}function _(){}function sn(n,e){if(e===void 0&&(e=1),e>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if(typeof n=="string")return n;if(n instanceof Error){var t=n&&n.stack,r=n&&n.message;if(t&&r)return t.indexOf(r)!==-1?t:r+`
3
- `+t;if(t)return t;if(r)return r}return n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}catch(o){return"Error while stringifying error: "+sn(o,e+1)}}function Yn(n){return typeof n=="string"?n:n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}cn(function(n){if(Object.values)return Object.values(n);var e=[];for(var t in n)n.hasOwnProperty(t)&&e.push(n[t]);return e});function Dn(n){return{}.toString.call(n)==="[object RegExp]"}function dn(n,e,t){if(n.hasOwnProperty(e))return n[e];var r=t();return n[e]=r,r}function kn(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function Kn(){return!!document.body&&document.readyState==="complete"}function Xn(){return!!document.body&&document.readyState==="interactive"}cn(function(){return new x(function(n){if(Kn()||Xn())return n();var e=setInterval(function(){if(Kn()||Xn())return clearInterval(e),n()},10)})});var xn=typeof document<"u"?document.currentScript:null,Lt=cn(function(){if(xn||(xn=function(){try{var n=function(){try{throw new Error("_")}catch(a){return a.stack||""}}(),e=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n),t=e&&e[1];if(!t)return;for(var r=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();r<o.length;r++){var i=o[r];if(i.src&&i.src===t)return i}}catch{}}()))return xn;throw new Error("Can not determine current script")}),Ft=Z();cn(function(){var n;try{n=Lt()}catch{return Ft}var e=n.getAttribute("data-uid");if(e&&typeof e=="string"||(e=n.getAttribute("data-uid-auto"))&&typeof e=="string")return e;if(n.src){var t=function(r){for(var o="",i=0;i<r.length;i++){var a=r[i].charCodeAt(0)*i;r[i+1]&&(a+=r[i+1].charCodeAt(0)*(i-1)),o+=String.fromCharCode(97+Math.abs(a)%26)}return o}(JSON.stringify({src:n.src,dataset:n.dataset}));e="uid_"+t.slice(t.length-30)}else e=Z();return n.setAttribute("data-uid-auto",e),e});function fn(n){n===void 0&&(n=window);var e="__post_robot_10_0_46__";return n!==window?n[e]:n[e]=n[e]||{}}var Qn=function(){return{}};function z(n,e){return n===void 0&&(n="store"),e===void 0&&(e=Qn),dn(fn(),n,function(){var t=e();return{has:function(r){return t.hasOwnProperty(r)},get:function(r,o){return t.hasOwnProperty(r)?t[r]:o},set:function(r,o){return t[r]=o,o},del:function(r){delete t[r]},getOrSet:function(r,o){return dn(t,r,o)},reset:function(){t=e()},keys:function(){return Object.keys(t)}}})}var Ht=function(){};function Sn(){var n=fn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new Ht,n.WINDOW_WILDCARD}function L(n,e){return n===void 0&&(n="store"),e===void 0&&(e=Qn),z("windowStore").getOrSet(n,function(){var t=new On,r=function(o){return t.getOrSet(o,e)};return{has:function(o){return r(o).hasOwnProperty(n)},get:function(o,i){var a=r(o);return a.hasOwnProperty(n)?a[n]:i},set:function(o,i){return r(o)[n]=i,i},del:function(o){delete r(o)[n]},getOrSet:function(o,i){return dn(r(o),n,i)}}})}function _n(){return z("instance").getOrSet("instanceID",Z)}function nt(n,e){var t=e.domain,r=L("helloPromises"),o=r.get(n);o&&o.resolve({domain:t});var i=x.resolve({domain:t});return r.set(n,i),i}function An(n,e){return(0,e.send)(n,"postrobot_hello",{instanceID:_n()},{domain:"*",timeout:-1}).then(function(t){var r=t.origin,o=t.data.instanceID;return nt(n,{domain:r}),{win:n,domain:r,instanceID:o}})}function tt(n,e){var t=e.send;return L("windowInstanceIDPromises").getOrSet(n,function(){return An(n,{send:t}).then(function(r){return r.instanceID})})}function et(n){L("knownWindows").set(n,!0)}function Nn(n){return typeof n=="object"&&n!==null&&typeof n.__type__=="string"}function rt(n){return n===void 0?"undefined":n===null?"null":Array.isArray(n)?"array":typeof n=="function"?"function":typeof n=="object"?n instanceof Error?"error":typeof n.then=="function"?"promise":{}.toString.call(n)==="[object RegExp]"?"regex":{}.toString.call(n)==="[object Date]"?"date":"object":typeof n=="string"?"string":typeof n=="number"?"number":typeof n=="boolean"?"boolean":void 0}function nn(n,e){return{__type__:n,__val__:e}}var H,Ut=((H={}).function=function(){},H.error=function(n){return nn("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},H.promise=function(){},H.regex=function(n){return nn("regex",n.source)},H.date=function(n){return nn("date",n.toJSON())},H.array=function(n){return n},H.object=function(n){return n},H.string=function(n){return n},H.number=function(n){return n},H.boolean=function(n){return n},H.null=function(n){return n},H[void 0]=function(n){return nn("undefined",n)},H),Bt={},U,Gt=((U={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},U.error=function(n){var e=n.stack,t=n.code,r=n.data,o=new Error(n.message);return o.code=t,r&&(o.data=r),o.stack=e+`
1
+ (function(D,O){typeof exports=="object"&&typeof module<"u"?O(exports):typeof define=="function"&&define.amd?define(["exports"],O):(D=typeof globalThis<"u"?globalThis:D||self,O(D["soyio-widget"]={}))})(this,function(D){"use strict";var rt=Object.defineProperty;var ot=(D,O,L)=>O in D?rt(D,O,{enumerable:!0,configurable:!0,writable:!0,value:L}):D[O]=L;var ln=(D,O,L)=>(ot(D,typeof O!="symbol"?O+"":O,L),L),it=(D,O,L)=>{if(!O.has(D))throw TypeError("Cannot "+L)};var pe=(D,O,L)=>{if(O.has(D))throw TypeError("Cannot add the same private member more than once");O instanceof WeakSet?O.add(D):O.set(D,L)};var me=(D,O,L)=>(it(D,O,"access private method"),L);var vn,ge;var O=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function L(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var Cn={exports:{}},Ln={exports:{}};(function(A,T){(function(G,W){A.exports=W()})(typeof self<"u"?self:O,function(){return function(G){var W={};function g(v){if(W[v])return W[v].exports;var y=W[v]={i:v,l:!1,exports:{}};return G[v].call(y.exports,y,y.exports,g),y.l=!0,y.exports}return g.m=G,g.c=W,g.d=function(v,y,F){g.o(v,y)||Object.defineProperty(v,y,{enumerable:!0,get:F})},g.r=function(v){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})},g.t=function(v,y){if(1&y&&(v=g(v)),8&y||4&y&&typeof v=="object"&&v&&v.__esModule)return v;var F=Object.create(null);if(g.r(F),Object.defineProperty(F,"default",{enumerable:!0,value:v}),2&y&&typeof v!="string")for(var K in v)g.d(F,K,(function(en){return v[en]}).bind(null,K));return F},g.n=function(v){var y=v&&v.__esModule?function(){return v.default}:function(){return v};return g.d(y,"a",y),y},g.o=function(v,y){return{}.hasOwnProperty.call(v,y)},g.p="",g(g.s=0)}([function(G,W,g){g.r(W),g.d(W,"Promise",function(){return S}),g.d(W,"TYPES",function(){return et}),g.d(W,"ProxyWindow",function(){return B}),g.d(W,"setup",function(){return we}),g.d(W,"destroy",function(){return nt}),g.d(W,"serializeMessage",function(){return Ke}),g.d(W,"deserializeMessage",function(){return Xe}),g.d(W,"createProxyWindow",function(){return Qe}),g.d(W,"toProxyWindow",function(){return _e}),g.d(W,"on",function(){return $}),g.d(W,"once",function(){return ke}),g.d(W,"send",function(){return Y}),g.d(W,"markWindowKnown",function(){return re}),g.d(W,"cleanUpWindow",function(){return tt}),g.d(W,"bridge",function(){});function v(n){return{}.toString.call(n)==="[object RegExp]"}var y=`Call was rejected by callee.\r
2
+ `;function F(n){return n===void 0&&(n=window),n.location.protocol}function K(n){if(n===void 0&&(n=window),n.mockDomain){var t=n.mockDomain.split("//")[0];if(t)return t}return F(n)}function en(n){return n===void 0&&(n=window),K(n)==="about:"}function V(n){if(n===void 0&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch{}}function wn(n){if(n===void 0&&(n=window),n&&!V(n))try{return n.opener}catch{}}function pn(n){try{return!0}catch{}return!1}function mn(n){n===void 0&&(n=window);var t=n.location;if(!t)throw new Error("Can not read window location");var e=F(n);if(!e)throw new Error("Can not read window protocol");if(e==="file:")return"file://";if(e==="about:"){var r=V(n);return r&&pn()?mn(r):"about://"}var o=t.host;if(!o)throw new Error("Can not read window host");return e+"//"+o}function M(n){n===void 0&&(n=window);var t=mn(n);return t&&n.mockDomain&&n.mockDomain.indexOf("mock:")===0?n.mockDomain:t}function X(n){if(!function(t){try{if(t===window)return!0}catch{}try{var e=Object.getOwnPropertyDescriptor(t,"location");if(e&&e.enumerable===!1)return!1}catch{}try{if(en(t)&&pn())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),K(r)==="mock:"}(t)&&pn())return!0}catch{}try{if(mn(t)===mn(window))return!0}catch{}return!1}(n))return!1;try{if(n===window||en(n)&&pn()||M(window)===M(n))return!0}catch{}return!1}function gn(n){if(!X(n))throw new Error("Expected window to be same domain");return n}function Hn(n,t){if(!n||!t)return!1;var e=V(t);return e?e===n:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch{}return o}(t).indexOf(n)!==-1}function Un(n){var t=[],e;try{e=n.frames}catch{e=n}var r;try{r=e.length}catch{}if(r===0)return t;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=e[o]}catch{continue}t.push(i)}return t}for(var a=0;a<100;a++){var s=void 0;try{s=e[a]}catch{return t}if(!s)return t;t.push(s)}return t}var Te=[],Me=[];function J(n,t){t===void 0&&(t=!0);try{if(n===window)return!1}catch{return!0}try{if(!n)return!0}catch{return!0}try{if(n.closed)return!0}catch(o){return!o||o.message!==y}if(t&&X(n))try{if(n.mockclosed)return!0}catch{}try{if(!n.parent||!n.top)return!0}catch{}var e=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch{}return-1}(Te,n);if(e!==-1){var r=Me[e];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 Bn(n){return n===void 0&&(n=window),wn(n=n||window)||V(n)||void 0}function tn(n,t){if(typeof n=="string"){if(typeof t=="string")return n==="*"||t===n;if(v(t)||Array.isArray(t))return!1}return v(n)?v(t)?n.toString()===t.toString():!Array.isArray(t)&&!!t.match(n):!!Array.isArray(n)&&(Array.isArray(t)?JSON.stringify(n)===JSON.stringify(t):!v(t)&&n.some(function(e){return tn(e,t)}))}function yn(n){try{if(n===window)return!0}catch(t){if(t&&t.message===y)return!0}try{if({}.toString.call(n)==="[object Window]")return!0}catch(t){if(t&&t.message===y)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(t){if(t&&t.message===y)return!0}try{if(n&&n.self===n)return!0}catch(t){if(t&&t.message===y)return!0}try{if(n&&n.parent===n)return!0}catch(t){if(t&&t.message===y)return!0}try{if(n&&n.top===n)return!0}catch(t){if(t&&t.message===y)return!0}try{if(n&&n.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in n&&"self"in n&&"location"in n)return!0}catch{}return!1}function Gn(n){if(X(n))return gn(n).frameElement;for(var t=0,e=document.querySelectorAll("iframe");t<e.length;t++){var r=e[t];if(r&&r.contentWindow&&r.contentWindow===n)return r}}function Ce(n){if(function(e){return e===void 0&&(e=window),!!V(e)}(n)){var t=Gn(n);if(t&&t.parentElement){t.parentElement.removeChild(t);return}}try{n.close()}catch{}}function Q(n){try{if(!n)return!1;if(typeof Promise<"u"&&n instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&n instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&n instanceof window.constructor)return!1;var t={}.toString;if(t){var e=t.call(n);if(e==="[object Window]"||e==="[object global]"||e==="[object DOMWindow]")return!1}if(typeof n.then=="function")return!0}catch{return!1}return!1}var Jn=[],rn=[],bn=0,on;function qn(){if(!bn&&on){var n=on;on=null,n.resolve()}}function In(){bn+=1}function an(){bn-=1,qn()}var S=function(){function n(e){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=[],e){var o,i,a=!1,s=!1,c=!1;In();try{e(function(u){c?r.resolve(u):(a=!0,o=u)},function(u){c?r.reject(u):(s=!0,i=u)})}catch(u){an(),this.reject(u);return}an(),c=!0,a?this.resolve(o):s&&this.reject(i)}}var t=n.prototype;return t.resolve=function(e){if(this.resolved||this.rejected)return this;if(Q(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},t.reject=function(e){var r=this;if(this.resolved||this.rejected)return this;if(Q(e))throw new Error("Can not reject promise with another promise");if(!e){var o=e&&typeof e.toString=="function"?e.toString():{}.toString.call(e);e=new Error("Expected reject to be called with Error, got "+o)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout(function(){r.errorHandled||function(i,a){if(Jn.indexOf(i)===-1){Jn.push(i),setTimeout(function(){throw i},1);for(var s=0;s<rn.length;s++)rn[s](i,a)}}(e,r)},1),this.dispatch(),this},t.asyncReject=function(e){return this.errorHandled=!0,this.reject(e),this},t.dispatch=function(){var e=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(e||r)){this.dispatching=!0,In();for(var i=function(l,m){return l.then(function(w){m.resolve(w)},function(w){m.reject(w)})},a=0;a<o.length;a++){var s=o[a],c=s.onSuccess,u=s.onError,h=s.promise,d=void 0;if(e)try{d=c?c(this.value):this.value}catch(l){h.reject(l);continue}else if(r){if(!u){h.reject(this.error);continue}try{d=u(this.error)}catch(l){h.reject(l);continue}}if(d instanceof n&&(d.resolved||d.rejected)){var f=d;f.resolved?h.resolve(f.value):h.reject(f.error),f.errorHandled=!0}else Q(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?h.resolve(d.value):h.reject(d.error):i(d,h):h.resolve(d)}o.length=0,this.dispatching=!1,an()}},t.then=function(e,r){if(e&&typeof e!="function"&&!e.call)throw new Error("Promise.then expected a function for success handler");if(r&&typeof r!="function"&&!r.call)throw new Error("Promise.then expected a function for error handler");var o=new n;return this.handlers.push({promise:o,onSuccess:e,onError:r}),this.errorHandled=!0,this.dispatch(),o},t.catch=function(e){return this.then(void 0,e)},t.finally=function(e){if(e&&typeof e!="function"&&!e.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return n.try(e).then(function(){return r})},function(r){return n.try(e).then(function(){throw r})})},t.timeout=function(e,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 "+e+"ms"))},e);return this.then(function(a){return clearTimeout(i),a})},t.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},t.lazy=function(){return this.errorHandled=!0,this},n.resolve=function(e){return e instanceof n?e:Q(e)?new n(function(r,o){return e.then(r,o)}):new n().resolve(e)},n.reject=function(e){return new n().reject(e)},n.asyncReject=function(e){return new n().asyncReject(e)},n.all=function(e){var r=new n,o=e.length,i=[].slice();if(!o)return r.resolve(i),r;for(var a=function(u,h,d){return h.then(function(f){i[u]=f,(o-=1)==0&&r.resolve(i)},function(f){d.reject(f)})},s=0;s<e.length;s++){var c=e[s];if(c instanceof n){if(c.resolved){i[s]=c.value,o-=1;continue}}else if(!Q(c)){i[s]=c,o-=1;continue}a(s,n.resolve(c),r)}return o===0&&r.resolve(i),r},n.hash=function(e){var r={},o=[],i=function(s){if(e.hasOwnProperty(s)){var c=e[s];Q(c)?o.push(c.then(function(u){r[s]=u})):r[s]=c}};for(var a in e)i(a);return n.all(o).then(function(){return r})},n.map=function(e,r){return n.all(e.map(r))},n.onPossiblyUnhandledException=function(e){return function(r){return rn.push(r),{cancel:function(){rn.splice(rn.indexOf(r),1)}}}(e)},n.try=function(e,r,o){if(e&&typeof e!="function"&&!e.call)throw new Error("Promise.try expected a function");var i;In();try{i=e.apply(r,o||[])}catch(a){return an(),n.reject(a)}return an(),n.resolve(i)},n.delay=function(e){return new n(function(r){setTimeout(r,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||Q(e)},n.flush=function(){return function(e){var r=on=on||new e;return qn(),r}(n)},n}();function En(n,t){for(var e=0;e<n.length;e++)try{if(n[e]===t)return e}catch{}return-1}var On=function(){function n(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if(typeof WeakMap>"u"||Object.freeze===void 0)return!1;try{var e=new WeakMap,r={};return Object.freeze(r),e.set(r,"__testvalue__"),e.get(r)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var t=n.prototype;return t._cleanupClosedWindows=function(){for(var e=this.weakmap,r=this.keys,o=0;o<r.length;o++){var i=r[o];if(yn(i)&&J(i)){if(e)try{e.delete(i)}catch{}r.splice(o,1),this.values.splice(o,1),o-=1}}},t.isSafeToReadWrite=function(e){return!yn(e)},t.set=function(e,r){if(!e)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(e,r)}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var i=this.name,a=e[i];a&&a[0]===e?a[1]=r:Object.defineProperty(e,i,{value:[e,r],writable:!0});return}catch{}this._cleanupClosedWindows();var s=this.keys,c=this.values,u=En(s,e);u===-1?(s.push(e),c.push(r)):c[u]=r},t.get=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(e))return r.get(e)}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var o=e[this.name];return o&&o[0]===e?o[1]:void 0}catch{}this._cleanupClosedWindows();var i=En(this.keys,e);if(i!==-1)return this.values[i]},t.delete=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(e)}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var o=e[this.name];o&&o[0]===e&&(o[0]=o[1]=void 0)}catch{}this._cleanupClosedWindows();var i=this.keys,a=En(i,e);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},t.has=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(e))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var o=e[this.name];return!(!o||o[0]!==e)}catch{}return this._cleanupClosedWindows(),En(this.keys,e)!==-1},t.getOrSet=function(e,r){if(this.has(e))return this.get(e);var o=r();return this.set(e,o),o},n}();function Zn(n){return n.name||n.__name__||n.displayName||"anonymous"}function Vn(n,t){try{delete n.name,n.name=t}catch{}return n.__name__=n.displayName=t,n}function Z(){var n="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(t){if(typeof btoa=="function")return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(e,r){return String.fromCharCode(parseInt(r,16))})).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(t,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var Wn;function $n(n){try{return JSON.stringify([].slice.call(n),function(t,e){return typeof e=="function"?"memoize["+function(r){if(Wn=Wn||new On,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Wn.get(r);return o||(o=typeof r+":"+Z(),Wn.set(r,o)),o}(e)+"]":typeof window<"u"&&e instanceof window.Element||e!==null&&typeof e=="object"&&e.nodeType===1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"?{}:e})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function Le(){return{}}var un=0,Yn=0;function cn(n,t){t===void 0&&(t={});var e=t.thisNamespace,r=e!==void 0&&e,o=t.time,i,a,s=un;un+=1;var c=function(){for(var u=arguments.length,h=new Array(u),d=0;d<u;d++)h[d]=arguments[d];s<Yn&&(i=null,a=null,s=un,un+=1);var f;f=r?(a=a||new On).getOrSet(this,Le):i=i||{};var l;try{l=$n(h)}catch{return n.apply(this,arguments)}var m=f[l];if(m&&o&&Date.now()-m.time<o&&(delete f[l],m=null),m)return m.value;var w=Date.now(),p=n.apply(this,arguments);return f[l]={time:w,value:p},p};return c.reset=function(){i=null,a=null},Vn(c,(t.name||Zn(n))+"::memoized")}cn.clear=function(){Yn=un};function Fe(n){var t={};function e(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var c=$n(a);return t.hasOwnProperty(c)||(t[c]=S.try(function(){return n.apply(o,r)}).finally(function(){delete t[c]})),t[c]}return e.reset=function(){t={}},Vn(e,Zn(n)+"::promiseMemoized")}function _(){}function sn(n,t){if(t===void 0&&(t=1),t>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if(typeof n=="string")return n;if(n instanceof Error){var e=n&&n.stack,r=n&&n.message;if(e&&r)return e.indexOf(r)!==-1?e:r+`
3
+ `+e;if(e)return e;if(r)return r}return n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}catch(o){return"Error while stringifying error: "+sn(o,t+1)}}function kn(n){return typeof n=="string"?n:n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}cn(function(n){if(Object.values)return Object.values(n);var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(n[e]);return t});function Dn(n){return{}.toString.call(n)==="[object RegExp]"}function dn(n,t,e){if(n.hasOwnProperty(t))return n[t];var r=e();return n[t]=r,r}function Kn(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function Xn(){return!!document.body&&document.readyState==="complete"}function Qn(){return!!document.body&&document.readyState==="interactive"}cn(function(){return new S(function(n){if(Xn()||Qn())return n();var t=setInterval(function(){if(Xn()||Qn())return clearInterval(t),n()},10)})});var Sn=typeof document<"u"?document.currentScript:null,He=cn(function(){if(Sn||(Sn=function(){try{var n=function(){try{throw new Error("_")}catch(a){return a.stack||""}}(),t=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n),e=t&&t[1];if(!e)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===e)return i}}catch{}}()))return Sn;throw new Error("Can not determine current script")}),Ue=Z();cn(function(){var n;try{n=He()}catch{return Ue}var t=n.getAttribute("data-uid");if(t&&typeof t=="string"||(t=n.getAttribute("data-uid-auto"))&&typeof t=="string")return t;if(n.src){var e=function(r){for(var o="",i=0;i<r.length;i++){var a=r[i].charCodeAt(0)*i;r[i+1]&&(a+=r[i+1].charCodeAt(0)*(i-1)),o+=String.fromCharCode(97+Math.abs(a)%26)}return o}(JSON.stringify({src:n.src,dataset:n.dataset}));t="uid_"+e.slice(e.length-30)}else t=Z();return n.setAttribute("data-uid-auto",t),t});function fn(n){n===void 0&&(n=window);var t="__post_robot_10_0_46__";return n!==window?n[t]:n[t]=n[t]||{}}var _n=function(){return{}};function j(n,t){return n===void 0&&(n="store"),t===void 0&&(t=_n),dn(fn(),n,function(){var e=t();return{has:function(r){return e.hasOwnProperty(r)},get:function(r,o){return e.hasOwnProperty(r)?e[r]:o},set:function(r,o){return e[r]=o,o},del:function(r){delete e[r]},getOrSet:function(r,o){return dn(e,r,o)},reset:function(){e=t()},keys:function(){return Object.keys(e)}}})}var Be=function(){};function xn(){var n=fn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new Be,n.WINDOW_WILDCARD}function C(n,t){return n===void 0&&(n="store"),t===void 0&&(t=_n),j("windowStore").getOrSet(n,function(){var e=new On,r=function(o){return e.getOrSet(o,t)};return{has:function(o){return r(o).hasOwnProperty(n)},get:function(o,i){var a=r(o);return a.hasOwnProperty(n)?a[n]:i},set:function(o,i){return r(o)[n]=i,i},del:function(o){delete r(o)[n]},getOrSet:function(o,i){return dn(r(o),n,i)}}})}function ne(){return j("instance").getOrSet("instanceID",Z)}function ee(n,t){var e=t.domain,r=C("helloPromises"),o=r.get(n);o&&o.resolve({domain:e});var i=S.resolve({domain:e});return r.set(n,i),i}function An(n,t){return(0,t.send)(n,"postrobot_hello",{instanceID:ne()},{domain:"*",timeout:-1}).then(function(e){var r=e.origin,o=e.data.instanceID;return ee(n,{domain:r}),{win:n,domain:r,instanceID:o}})}function te(n,t){var e=t.send;return C("windowInstanceIDPromises").getOrSet(n,function(){return An(n,{send:e}).then(function(r){return r.instanceID})})}function re(n){C("knownWindows").set(n,!0)}function Nn(n){return typeof n=="object"&&n!==null&&typeof n.__type__=="string"}function oe(n){return n===void 0?"undefined":n===null?"null":Array.isArray(n)?"array":typeof n=="function"?"function":typeof n=="object"?n instanceof Error?"error":typeof n.then=="function"?"promise":{}.toString.call(n)==="[object RegExp]"?"regex":{}.toString.call(n)==="[object Date]"?"date":"object":typeof n=="string"?"string":typeof n=="number"?"number":typeof n=="boolean"?"boolean":void 0}function nn(n,t){return{__type__:n,__val__:t}}var H,Ge=((H={}).function=function(){},H.error=function(n){return nn("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},H.promise=function(){},H.regex=function(n){return nn("regex",n.source)},H.date=function(n){return nn("date",n.toJSON())},H.array=function(n){return n},H.object=function(n){return n},H.string=function(n){return n},H.number=function(n){return n},H.boolean=function(n){return n},H.null=function(n){return n},H[void 0]=function(n){return nn("undefined",n)},H),Je={},U,qe=((U={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},U.error=function(n){var t=n.stack,e=n.code,r=n.data,o=new Error(n.message);return o.code=e,r&&(o.data=r),o.stack=t+`
4
4
 
5
- `+o.stack,o},U.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},U.regex=function(n){return new RegExp(n)},U.date=function(n){return new Date(n)},U.array=function(n){return n},U.object=function(n){return n},U.string=function(n){return n},U.number=function(n){return n},U.boolean=function(n){return n},U.null=function(n){return n},U[void 0]=function(){},U),Jt={};new x(function(n){if(window.document&&window.document.body)return n(window.document.body);var e=setInterval(function(){if(window.document&&window.document.body)return clearInterval(e),n(window.document.body)},10)});function Rn(){for(var n=z("idToProxyWindow"),e=0,t=n.keys();e<t.length;e++){var r=t[e];n.get(r).shouldClean()&&n.del(r)}}function ot(n,e){var t=e.send,r=e.id,o=r===void 0?Z():r,i=n.then(function(c){if(X(c))return gn(c).name}),a=n.then(function(c){if(J(c))throw new Error("Window is closed, can not determine type");return wn(c)?"popup":"iframe"});i.catch(_),a.catch(_);var s=function(){return n.then(function(c){if(!J(c))return X(c)?gn(c).name:i})};return{id:o,getType:function(){return a},getInstanceID:Mt(function(){return n.then(function(c){return tt(c,{send:t})})}),close:function(){return n.then(Tt)},getName:s,focus:function(){return n.then(function(c){c.focus()})},isClosed:function(){return n.then(function(c){return J(c)})},setLocation:function(c,u){return u===void 0&&(u={}),n.then(function(h){var d=window.location.protocol+"//"+window.location.host,f=u.method,l=f===void 0?"get":f,p=u.body;if(c.indexOf("/")===0)c=""+d+c;else if(!c.match(/^https?:\/\//)&&c.indexOf(d)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(c));if(l==="post")return s().then(function(w){if(!w)throw new Error("Can not post to window without target name");(function(m){var S=m.url,R=m.target,P=m.body,b=m.method,j=b===void 0?"post":b,E=document.createElement("form");if(E.setAttribute("target",R),E.setAttribute("method",j),E.setAttribute("action",S),E.style.display="none",P)for(var I=0,q=Object.keys(P);I<q.length;I++){var A,hn=q[I],Cn=document.createElement("input");Cn.setAttribute("name",hn),Cn.setAttribute("value",(A=P[hn])==null?void 0:A.toString()),E.appendChild(Cn)}kn().appendChild(E),E.submit(),kn().removeChild(E)})({url:c,target:w,method:l,body:p})});if(l!=="get")throw new Error("Unsupported method: "+l);if(X(h))try{if(h.location&&typeof h.location.replace=="function"){h.location.replace(c);return}}catch{}h.location=c})},setName:function(c){return n.then(function(u){var h=X(u),d=Bn(u);if(!h)throw new Error("Can not set name for cross-domain window: "+c);gn(u).name=c,d&&d.setAttribute("name",c),i=x.resolve(c)})}}}var B=function(){function n(t){var r=t.send,o=t.win,i=t.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new x,this.serializedWindow=i||ot(this.actualWindowPromise,{send:r}),z("idToProxyWindow").set(this.getID(),this),o&&this.setWindow(o,{send:r})}var e=n.prototype;return e.getID=function(){return this.serializedWindow.id},e.getType=function(){return this.serializedWindow.getType()},e.isPopup=function(){return this.getType().then(function(t){return t==="popup"})},e.setLocation=function(t,r){var o=this;return this.serializedWindow.setLocation(t,r).then(function(){return o})},e.getName=function(){return this.serializedWindow.getName()},e.setName=function(t){var r=this;return this.serializedWindow.setName(t).then(function(){return r})},e.close=function(){var t=this;return this.serializedWindow.close().then(function(){return t})},e.focus=function(){var t=this,r=this.isPopup(),o=this.getName(),i=x.hash({isPopup:r,name:o}).then(function(s){var c=s.name;s.isPopup&&c&&window.open("",c,"noopener")}),a=this.serializedWindow.focus();return x.all([i,a]).then(function(){return t})},e.isClosed=function(){return this.serializedWindow.isClosed()},e.getWindow=function(){return this.actualWindow},e.setWindow=function(t,r){var o=r.send;this.actualWindow=t,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=ot(this.actualWindowPromise,{send:o,id:this.getID()}),L("winToProxyWindow").set(t,this)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(t,r){var o=this,i=r.send;return x.try(function(){return o.actualWindow?t===o.actualWindow:x.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:tt(t,{send:i})}).then(function(a){var s=a.proxyInstanceID===a.knownWindowInstanceID;return s&&o.setWindow(t,{send:i}),s})})},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return this.serializedWindow.getInstanceID()},e.shouldClean=function(){return!!(this.actualWindow&&J(this.actualWindow))},e.serialize=function(){return this.serializedWindow},n.unwrap=function(t){return n.isProxyWindow(t)?t.unwrap():t},n.serialize=function(t,r){var o=r.send;return Rn(),n.toProxyWindow(t,{send:o}).serialize()},n.deserialize=function(t,r){var o=r.send;return Rn(),z("idToProxyWindow").get(t.id)||new n({serializedWindow:t,send:o})},n.isProxyWindow=function(t){return!!(t&&!yn(t)&&t.isProxyWindow)},n.toProxyWindow=function(t,r){var o=r.send;if(Rn(),n.isProxyWindow(t))return t;var i=t;return L("winToProxyWindow").get(i)||new n({win:i,send:o})},n}();function zn(n,e,t,r,o){var i=L("methodStore"),a=z("proxyWindowMethods");B.isProxyWindow(r)?a.set(n,{val:e,name:t,domain:o,source:r}):(a.del(n),i.getOrSet(r,function(){return{}})[n]={domain:o,name:t,val:e,source:r})}function it(n,e){var t=L("methodStore"),r=z("proxyWindowMethods");return t.getOrSet(n,function(){return{}})[e]||r.get(e)}function at(n,e,t,r,o){a=(i={on:o.on,send:o.send}).on,s=i.send,z("builtinListeners").getOrSet("functionCalls",function(){return a("postrobot_method",{domain:"*"},function(h){var d=h.source,f=h.origin,l=h.data,p=l.id,w=l.name,m=it(d,p);if(!m)throw new Error("Could not find method '"+w+"' with id: "+l.id+" in "+M(window));var S=m.source,R=m.domain,P=m.val;return x.try(function(){if(!en(R,f))throw new Error("Method '"+l.name+"' domain "+JSON.stringify(Dn(m.domain)?m.domain.source:m.domain)+" does not match origin "+f+" in "+M(window));if(B.isProxyWindow(S))return S.matchWindow(d,{send:s}).then(function(b){if(!b)throw new Error("Method call '"+l.name+"' failed - proxy window does not match source in "+M(window))})}).then(function(){return P.apply({source:d,origin:f},l.args)},function(b){return x.try(function(){if(P.onError)return P.onError(b)}).then(function(){throw b.stack&&(b.stack="Remote call to "+w+"("+function(j){return j===void 0&&(j=[]),(E=j,[].slice.call(E)).map(function(I){return typeof I=="string"?"'"+I+"'":I===void 0?"undefined":I===null?"null":typeof I=="boolean"?I.toString():Array.isArray(I)?"[ ... ]":typeof I=="object"?"{ ... }":typeof I=="function"?"() => { ... }":"<"+typeof I+">"}).join(", ");var E}(l.args)+`) failed
5
+ `+o.stack,o},U.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},U.regex=function(n){return new RegExp(n)},U.date=function(n){return new Date(n)},U.array=function(n){return n},U.object=function(n){return n},U.string=function(n){return n},U.number=function(n){return n},U.boolean=function(n){return n},U.null=function(n){return n},U[void 0]=function(){},U),Ze={};new S(function(n){if(window.document&&window.document.body)return n(window.document.body);var t=setInterval(function(){if(window.document&&window.document.body)return clearInterval(t),n(window.document.body)},10)});function Rn(){for(var n=j("idToProxyWindow"),t=0,e=n.keys();t<e.length;t++){var r=e[t];n.get(r).shouldClean()&&n.del(r)}}function ie(n,t){var e=t.send,r=t.id,o=r===void 0?Z():r,i=n.then(function(c){if(X(c))return gn(c).name}),a=n.then(function(c){if(J(c))throw new Error("Window is closed, can not determine type");return wn(c)?"popup":"iframe"});i.catch(_),a.catch(_);var s=function(){return n.then(function(c){if(!J(c))return X(c)?gn(c).name:i})};return{id:o,getType:function(){return a},getInstanceID:Fe(function(){return n.then(function(c){return te(c,{send:e})})}),close:function(){return n.then(Ce)},getName:s,focus:function(){return n.then(function(c){c.focus()})},isClosed:function(){return n.then(function(c){return J(c)})},setLocation:function(c,u){return u===void 0&&(u={}),n.then(function(h){var d=window.location.protocol+"//"+window.location.host,f=u.method,l=f===void 0?"get":f,m=u.body;if(c.indexOf("/")===0)c=""+d+c;else if(!c.match(/^https?:\/\//)&&c.indexOf(d)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(c));if(l==="post")return s().then(function(w){if(!w)throw new Error("Can not post to window without target name");(function(p){var x=p.url,R=p.target,b=p.body,P=p.method,z=P===void 0?"post":P,E=document.createElement("form");if(E.setAttribute("target",R),E.setAttribute("method",z),E.setAttribute("action",x),E.style.display="none",b)for(var I=0,q=Object.keys(b);I<q.length;I++){var N,hn=q[I],Mn=document.createElement("input");Mn.setAttribute("name",hn),Mn.setAttribute("value",(N=b[hn])==null?void 0:N.toString()),E.appendChild(Mn)}Kn().appendChild(E),E.submit(),Kn().removeChild(E)})({url:c,target:w,method:l,body:m})});if(l!=="get")throw new Error("Unsupported method: "+l);if(X(h))try{if(h.location&&typeof h.location.replace=="function"){h.location.replace(c);return}}catch{}h.location=c})},setName:function(c){return n.then(function(u){var h=X(u),d=Gn(u);if(!h)throw new Error("Can not set name for cross-domain window: "+c);gn(u).name=c,d&&d.setAttribute("name",c),i=S.resolve(c)})}}}var B=function(){function n(e){var r=e.send,o=e.win,i=e.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new S,this.serializedWindow=i||ie(this.actualWindowPromise,{send:r}),j("idToProxyWindow").set(this.getID(),this),o&&this.setWindow(o,{send:r})}var t=n.prototype;return t.getID=function(){return this.serializedWindow.id},t.getType=function(){return this.serializedWindow.getType()},t.isPopup=function(){return this.getType().then(function(e){return e==="popup"})},t.setLocation=function(e,r){var o=this;return this.serializedWindow.setLocation(e,r).then(function(){return o})},t.getName=function(){return this.serializedWindow.getName()},t.setName=function(e){var r=this;return this.serializedWindow.setName(e).then(function(){return r})},t.close=function(){var e=this;return this.serializedWindow.close().then(function(){return e})},t.focus=function(){var e=this,r=this.isPopup(),o=this.getName(),i=S.hash({isPopup:r,name:o}).then(function(s){var c=s.name;s.isPopup&&c&&window.open("",c,"noopener")}),a=this.serializedWindow.focus();return S.all([i,a]).then(function(){return e})},t.isClosed=function(){return this.serializedWindow.isClosed()},t.getWindow=function(){return this.actualWindow},t.setWindow=function(e,r){var o=r.send;this.actualWindow=e,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=ie(this.actualWindowPromise,{send:o,id:this.getID()}),C("winToProxyWindow").set(e,this)},t.awaitWindow=function(){return this.actualWindowPromise},t.matchWindow=function(e,r){var o=this,i=r.send;return S.try(function(){return o.actualWindow?e===o.actualWindow:S.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:te(e,{send:i})}).then(function(a){var s=a.proxyInstanceID===a.knownWindowInstanceID;return s&&o.setWindow(e,{send:i}),s})})},t.unwrap=function(){return this.actualWindow||this},t.getInstanceID=function(){return this.serializedWindow.getInstanceID()},t.shouldClean=function(){return!!(this.actualWindow&&J(this.actualWindow))},t.serialize=function(){return this.serializedWindow},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e,r){var o=r.send;return Rn(),n.toProxyWindow(e,{send:o}).serialize()},n.deserialize=function(e,r){var o=r.send;return Rn(),j("idToProxyWindow").get(e.id)||new n({serializedWindow:e,send:o})},n.isProxyWindow=function(e){return!!(e&&!yn(e)&&e.isProxyWindow)},n.toProxyWindow=function(e,r){var o=r.send;if(Rn(),n.isProxyWindow(e))return e;var i=e;return C("winToProxyWindow").get(i)||new n({win:i,send:o})},n}();function jn(n,t,e,r,o){var i=C("methodStore"),a=j("proxyWindowMethods");B.isProxyWindow(r)?a.set(n,{val:t,name:e,domain:o,source:r}):(a.del(n),i.getOrSet(r,function(){return{}})[n]={domain:o,name:e,val:t,source:r})}function ae(n,t){var e=C("methodStore"),r=j("proxyWindowMethods");return e.getOrSet(n,function(){return{}})[t]||r.get(t)}function ue(n,t,e,r,o){a=(i={on:o.on,send:o.send}).on,s=i.send,j("builtinListeners").getOrSet("functionCalls",function(){return a("postrobot_method",{domain:"*"},function(h){var d=h.source,f=h.origin,l=h.data,m=l.id,w=l.name,p=ae(d,m);if(!p)throw new Error("Could not find method '"+w+"' with id: "+l.id+" in "+M(window));var x=p.source,R=p.domain,b=p.val;return S.try(function(){if(!tn(R,f))throw new Error("Method '"+l.name+"' domain "+JSON.stringify(Dn(p.domain)?p.domain.source:p.domain)+" does not match origin "+f+" in "+M(window));if(B.isProxyWindow(x))return x.matchWindow(d,{send:s}).then(function(P){if(!P)throw new Error("Method call '"+l.name+"' failed - proxy window does not match source in "+M(window))})}).then(function(){return b.apply({source:d,origin:f},l.args)},function(P){return S.try(function(){if(b.onError)return b.onError(P)}).then(function(){throw P.stack&&(P.stack="Remote call to "+w+"("+function(z){return z===void 0&&(z=[]),(E=z,[].slice.call(E)).map(function(I){return typeof I=="string"?"'"+I+"'":I===void 0?"undefined":I===null?"null":typeof I=="boolean"?I.toString():Array.isArray(I)?"[ ... ]":typeof I=="object"?"{ ... }":typeof I=="function"?"() => { ... }":"<"+typeof I+">"}).join(", ");var E}(l.args)+`) failed
6
6
 
7
- `+b.stack),b})}).then(function(b){return{result:b,id:p,name:w}})})});var i,a,s,c=t.__id__||Z();n=B.unwrap(n);var u=t.__name__||t.name||r;return typeof u=="string"&&typeof u.indexOf=="function"&&u.indexOf("anonymous::")===0&&(u=u.replace("anonymous::",r+"::")),B.isProxyWindow(n)?(zn(c,t,u,n,e),n.awaitWindow().then(function(h){zn(c,t,u,h,e)})):zn(c,t,u,n,e),nn("cross_domain_function",{id:c,name:u})}function ut(n,e,t,r){var o,i=r.on,a=r.send;return function(s,c){c===void 0&&(c=Bt);var u=JSON.stringify(s,function(h){var d=this[h];if(Nn(this))return d;var f=rt(d);if(!f)return d;var l=c[f]||Ut[f];return l?l(d,h):d});return u===void 0?"undefined":u}(t,((o={}).promise=function(s,c){return function(u,h,d,f,l){return nn("cross_domain_zalgo_promise",{then:at(u,h,function(p,w){return d.then(p,w)},f,{on:l.on,send:l.send})})}(n,e,s,c,{on:i,send:a})},o.function=function(s,c){return at(n,e,s,c,{on:i,send:a})},o.object=function(s){return yn(s)||B.isProxyWindow(s)?nn("cross_domain_window",B.serialize(s,{send:a})):s},o))}function ct(n,e,t,r){var o,i=r.send;return function(a,s){if(s===void 0&&(s=Jt),a!=="undefined")return JSON.parse(a,function(c,u){if(Nn(this))return u;var h,d;if(Nn(u)?(h=u.__type__,d=u.__val__):(h=rt(u),d=u),!h)return d;var f=s[h]||Gt[h];return f?f(d,c):d})}(t,((o={}).cross_domain_zalgo_promise=function(a){return function(s,c,u){return new x(u.then)}(0,0,a)},o.cross_domain_function=function(a){return function(s,c,u,h){var d=u.id,f=u.name,l=h.send,p=function(m){m===void 0&&(m={});function S(){var R=arguments;return B.toProxyWindow(s,{send:l}).awaitWindow().then(function(P){var b=it(P,d);if(b&&b.val!==S)return b.val.apply({source:window,origin:M()},R);var j=[].slice.call(R);return m.fireAndForget?l(P,"postrobot_method",{id:d,name:f,args:j},{domain:c,fireAndForget:!0}):l(P,"postrobot_method",{id:d,name:f,args:j},{domain:c,fireAndForget:!1}).then(function(E){return E.data.result})}).catch(function(P){throw P})}return S.__name__=f,S.__origin__=c,S.__source__=s,S.__id__=d,S.origin=c,S},w=p();return w.fireAndForget=p({fireAndForget:!0}),w}(n,e,a,{send:i})},o.cross_domain_window=function(a){return B.deserialize(a,{send:i})},o))}var jn={};jn.postrobot_post_message=function(n,e,t){t.indexOf("file:")===0&&(t="*"),n.postMessage(e,t)};function Tn(n,e,t,r){var o=r.on,i=r.send;return x.try(function(){var a=L().getOrSet(n,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(t),a.flush=a.flush||x.flush().then(function(){if(J(n))throw new Error("Window is closed");var s=ut(n,e,((c={}).__post_robot_10_0_46__=a.buffer||[],c),{on:o,send:i}),c;delete a.buffer;for(var u=Object.keys(jn),h=[],d=0;d<u.length;d++){var f=u[d];try{jn[f](n,s,e)}catch(l){h.push(l)}}if(h.length===u.length)throw new Error(`All post-robot messaging strategies failed:
7
+ `+P.stack),P})}).then(function(P){return{result:P,id:m,name:w}})})});var i,a,s,c=e.__id__||Z();n=B.unwrap(n);var u=e.__name__||e.name||r;return typeof u=="string"&&typeof u.indexOf=="function"&&u.indexOf("anonymous::")===0&&(u=u.replace("anonymous::",r+"::")),B.isProxyWindow(n)?(jn(c,e,u,n,t),n.awaitWindow().then(function(h){jn(c,e,u,h,t)})):jn(c,e,u,n,t),nn("cross_domain_function",{id:c,name:u})}function ce(n,t,e,r){var o,i=r.on,a=r.send;return function(s,c){c===void 0&&(c=Je);var u=JSON.stringify(s,function(h){var d=this[h];if(Nn(this))return d;var f=oe(d);if(!f)return d;var l=c[f]||Ge[f];return l?l(d,h):d});return u===void 0?"undefined":u}(e,((o={}).promise=function(s,c){return function(u,h,d,f,l){return nn("cross_domain_zalgo_promise",{then:ue(u,h,function(m,w){return d.then(m,w)},f,{on:l.on,send:l.send})})}(n,t,s,c,{on:i,send:a})},o.function=function(s,c){return ue(n,t,s,c,{on:i,send:a})},o.object=function(s){return yn(s)||B.isProxyWindow(s)?nn("cross_domain_window",B.serialize(s,{send:a})):s},o))}function se(n,t,e,r){var o,i=r.send;return function(a,s){if(s===void 0&&(s=Ze),a!=="undefined")return JSON.parse(a,function(c,u){if(Nn(this))return u;var h,d;if(Nn(u)?(h=u.__type__,d=u.__val__):(h=oe(u),d=u),!h)return d;var f=s[h]||qe[h];return f?f(d,c):d})}(e,((o={}).cross_domain_zalgo_promise=function(a){return function(s,c,u){return new S(u.then)}(0,0,a)},o.cross_domain_function=function(a){return function(s,c,u,h){var d=u.id,f=u.name,l=h.send,m=function(p){p===void 0&&(p={});function x(){var R=arguments;return B.toProxyWindow(s,{send:l}).awaitWindow().then(function(b){var P=ae(b,d);if(P&&P.val!==x)return P.val.apply({source:window,origin:M()},R);var z=[].slice.call(R);return p.fireAndForget?l(b,"postrobot_method",{id:d,name:f,args:z},{domain:c,fireAndForget:!0}):l(b,"postrobot_method",{id:d,name:f,args:z},{domain:c,fireAndForget:!1}).then(function(E){return E.data.result})}).catch(function(b){throw b})}return x.__name__=f,x.__origin__=c,x.__source__=s,x.__id__=d,x.origin=c,x},w=m();return w.fireAndForget=m({fireAndForget:!0}),w}(n,t,a,{send:i})},o.cross_domain_window=function(a){return B.deserialize(a,{send:i})},o))}var zn={};zn.postrobot_post_message=function(n,t,e){e.indexOf("file:")===0&&(e="*"),n.postMessage(t,e)};function Tn(n,t,e,r){var o=r.on,i=r.send;return S.try(function(){var a=C().getOrSet(n,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(e),a.flush=a.flush||S.flush().then(function(){if(J(n))throw new Error("Window is closed");var s=ce(n,t,((c={}).__post_robot_10_0_46__=a.buffer||[],c),{on:o,send:i}),c;delete a.buffer;for(var u=Object.keys(zn),h=[],d=0;d<u.length;d++){var f=u[d];try{zn[f](n,s,t)}catch(l){h.push(l)}}if(h.length===u.length)throw new Error(`All post-robot messaging strategies failed:
8
8
 
9
- `+h.map(function(l,p){return p+". "+sn(l)}).join(`
9
+ `+h.map(function(l,m){return m+". "+sn(l)}).join(`
10
10
 
11
- `))}),a.flush.then(function(){delete a.flush})}).then(_)}function st(n){return z("responseListeners").get(n)}function dt(n){z("responseListeners").del(n)}function ft(n){return z("erroredResponseListeners").has(n)}function ht(n){var e=n.name,t=n.win,r=n.domain,o=L("requestListeners");if(t==="*"&&(t=null),r==="*"&&(r=null),!e)throw new Error("Name required to get request listener");for(var i=0,a=[t,Sn()];i<a.length;i++){var s=a[i];if(s){var c=o.get(s);if(c){var u=c[e];if(u){if(r&&typeof r=="string"){if(u[r])return u[r];if(u.__domain_regex__)for(var h=0,d=u.__domain_regex__;h<d.length;h++){var f=d[h],l=f.listener;if(en(f.regex,r))return l}}if(u["*"])return u["*"]}}}}}function qt(n,e,t,r){var o=r.on,i=r.send,a=ht({name:t.name,win:n,domain:e}),s=t.name==="postrobot_method"&&t.data&&typeof t.data.name=="string"?t.data.name+"()":t.name;function c(u,h,d){return x.flush().then(function(){if(!t.fireAndForget&&!J(n))try{return Tn(n,e,{id:Z(),origin:M(window),type:"postrobot_message_response",hash:t.hash,name:t.name,ack:u,data:h,error:d},{on:o,send:i})}catch(f){throw new Error("Send response message failed for "+s+" in "+M()+`
11
+ `))}),a.flush.then(function(){delete a.flush})}).then(_)}function de(n){return j("responseListeners").get(n)}function fe(n){j("responseListeners").del(n)}function he(n){return j("erroredResponseListeners").has(n)}function le(n){var t=n.name,e=n.win,r=n.domain,o=C("requestListeners");if(e==="*"&&(e=null),r==="*"&&(r=null),!t)throw new Error("Name required to get request listener");for(var i=0,a=[e,xn()];i<a.length;i++){var s=a[i];if(s){var c=o.get(s);if(c){var u=c[t];if(u){if(r&&typeof r=="string"){if(u[r])return u[r];if(u.__domain_regex__)for(var h=0,d=u.__domain_regex__;h<d.length;h++){var f=d[h],l=f.listener;if(tn(f.regex,r))return l}}if(u["*"])return u["*"]}}}}}function Ve(n,t,e,r){var o=r.on,i=r.send,a=le({name:e.name,win:n,domain:t}),s=e.name==="postrobot_method"&&e.data&&typeof e.data.name=="string"?e.data.name+"()":e.name;function c(u,h,d){return S.flush().then(function(){if(!e.fireAndForget&&!J(n))try{return Tn(n,t,{id:Z(),origin:M(window),type:"postrobot_message_response",hash:e.hash,name:e.name,ack:u,data:h,error:d},{on:o,send:i})}catch(f){throw new Error("Send response message failed for "+s+" in "+M()+`
12
12
 
13
- `+sn(f))}})}return x.all([x.flush().then(function(){if(!t.fireAndForget&&!J(n))try{return Tn(n,e,{id:Z(),origin:M(window),type:"postrobot_message_ack",hash:t.hash,name:t.name},{on:o,send:i})}catch(u){throw new Error("Send ack message failed for "+s+" in "+M()+`
13
+ `+sn(f))}})}return S.all([S.flush().then(function(){if(!e.fireAndForget&&!J(n))try{return Tn(n,t,{id:Z(),origin:M(window),type:"postrobot_message_ack",hash:e.hash,name:e.name},{on:o,send:i})}catch(u){throw new Error("Send ack message failed for "+s+" in "+M()+`
14
14
 
15
- `+sn(u))}}),x.try(function(){if(!a)throw new Error("No handler found for post message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:n,origin:e,data:t.data})}).then(function(u){return c("success",u)},function(u){return c("error",null,u)})]).then(_).catch(function(u){if(a&&a.handleError)return a.handleError(u);throw u})}function Zt(n,e,t){if(!ft(t.hash)){var r=st(t.hash);if(!r)throw new Error("No handler found for post message ack for message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!en(r.domain,e))throw new Error("Ack origin "+e+" does not match domain "+r.domain.toString());if(n!==r.win)throw new Error("Ack source does not match registered window")}catch(o){r.promise.reject(o)}r.ack=!0}}function Vt(n,e,t){if(!ft(t.hash)){var r=st(t.hash);if(!r)throw new Error("No handler found for post message response for message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!en(r.domain,e))throw new Error("Response origin "+e+" does not match domain "+(o=r.domain,Array.isArray(o)?"("+o.join(" | ")+")":v(o)?"RegExp("+o.toString()+")":o.toString()));var o;if(n!==r.win)throw new Error("Response source does not match registered window");dt(t.hash),t.ack==="error"?r.promise.reject(t.error):t.ack==="success"&&r.promise.resolve({source:n,origin:e,data:t.data})}}function lt(n,e){var t=e.on,r=e.send,o=z("receivedMessages");try{if(!window||window.closed||!n.source)return}catch{return}var i=n.source,a=n.origin,s=function(h,d,f,l){var p=l.on,w=l.send,m;try{m=ct(d,f,h,{on:p,send:w})}catch{return}if(m&&typeof m=="object"&&m!==null){var S=m.__post_robot_10_0_46__;if(Array.isArray(S))return S}}(n.data,i,a,{on:t,send:r});if(s){et(i);for(var c=0;c<s.length;c++){var u=s[c];if(o.has(u.id)||(o.set(u.id,!0),J(i)&&!u.fireAndForget))return;u.origin.indexOf("file:")===0&&(a="file://");try{u.type==="postrobot_message_request"?qt(i,a,u,{on:t,send:r}):u.type==="postrobot_message_response"?Vt(i,a,u):u.type==="postrobot_message_ack"&&Zt(i,a,u)}catch(h){setTimeout(function(){throw h},0)}}}}function $(n,e,t){if(!n)throw new Error("Expected name");if(typeof(e=e||{})=="function"&&(t=e,e={}),!t)throw new Error("Expected handler");var r=function o(i,a){var s=i.name,c=i.win,u=i.domain,h=L("requestListeners");if(!s||typeof s!="string")throw new Error("Name required to add request listener");if(c&&c!=="*"&&B.isProxyWindow(c)){var d=c.awaitWindow().then(function(A){return o({name:s,win:A,domain:u},a)});return{cancel:function(){d.then(function(A){return A.cancel()},_)}}}var f=c;if(Array.isArray(f)){for(var l=[],p=0,w=f;p<w.length;p++)l.push(o({name:s,domain:u,win:w[p]},a));return{cancel:function(){for(var A=0;A<l.length;A++)l[A].cancel()}}}if(Array.isArray(u)){for(var m=[],S=0,R=u;S<R.length;S++)m.push(o({name:s,win:f,domain:R[S]},a));return{cancel:function(){for(var A=0;A<m.length;A++)m[A].cancel()}}}var P=ht({name:s,win:f,domain:u});f&&f!=="*"||(f=Sn());var b=(u=u||"*").toString();if(P)throw f&&u?new Error("Request listener already exists for "+s+" on domain "+u.toString()+" for "+(f===Sn()?"wildcard":"specified")+" window"):f?new Error("Request listener already exists for "+s+" for "+(f===Sn()?"wildcard":"specified")+" window"):u?new Error("Request listener already exists for "+s+" on domain "+u.toString()):new Error("Request listener already exists for "+s);var j=h.getOrSet(f,function(){return{}}),E=dn(j,s,function(){return{}}),I,q;return Dn(u)?(I=dn(E,"__domain_regex__",function(){return[]})).push(q={regex:u,listener:a}):E[b]=a,{cancel:function(){delete E[b],q&&(I.splice(I.indexOf(q,1)),I.length||delete E.__domain_regex__),Object.keys(E).length||delete j[s],f&&!Object.keys(j).length&&h.del(f)}}}({name:n,win:e.window,domain:e.domain||"*"},{handler:t||e.handler,handleError:e.errorHandler||function(o){throw o}});return{cancel:function(){r.cancel()}}}function $t(n,e,t){typeof(e=e||{})=="function"&&(t=e,e={});var r=new x,o;return e.errorHandler=function(i){o.cancel(),r.reject(i)},o=$(n,e,function(i){if(o.cancel(),r.resolve(i),t)return t(i)}),r.cancel=o.cancel,r}var Y=function n(e,t,r,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,s=o.timeout||5e3,c=o.fireAndForget||!1;return B.toProxyWindow(e,{send:n}).awaitWindow().then(function(u){return x.try(function(){if(function(h,d,f){if(!h)throw new Error("Expected name");if(f&&typeof f!="string"&&!Array.isArray(f)&&!Dn(f))throw new TypeError("Can not send "+h+". Expected domain "+JSON.stringify(f)+" to be a string, array, or regex");if(J(d))throw new Error("Can not send "+h+". Target window is closed")}(t,u,i),function(h,d){var f=Un(d);if(f)return f===h;if(d===h||function(w){w===void 0&&(w=window);try{if(w.top)return w.top}catch{}if(V(w)===w)return w;try{if(Fn(window,w)&&window.top)return window.top}catch{}try{if(Fn(w,window)&&window.top)return window.top}catch{}for(var m=0,S=function P(b){for(var j=[],E=0,I=Hn(b);E<I.length;E++){var q=I[E];j.push(q);for(var A=0,hn=P(q);A<hn.length;A++)j.push(hn[A])}return j}(w);m<S.length;m++){var R=S[m];try{if(R.top)return R.top}catch{}if(V(R)===R)return R}}(d)===d)return!1;for(var l=0,p=Hn(h);l<p.length;l++)if(p[l]===d)return!0;return!1}(window,u))return function(h,d,f){d===void 0&&(d=5e3),f===void 0&&(f="Window");var l=function(p){return L("helloPromises").getOrSet(p,function(){return new x})}(h);return d!==-1&&(l=l.timeout(d,new Error(f+" did not load after "+d+"ms"))),l}(u,s)}).then(function(h){return function(d,f,l,p){var w=p.send;return x.try(function(){return typeof f=="string"?f:x.try(function(){return l||An(d,{send:w}).then(function(m){return m.domain})}).then(function(m){if(!en(f,f))throw new Error("Domain "+Yn(f)+" does not match "+Yn(f));return m})})}(u,i,(h===void 0?{}:h).domain,{send:n})}).then(function(h){var d=h,f=t==="postrobot_method"&&r&&typeof r.name=="string"?r.name+"()":t,l=new x,p=t+"_"+Z();if(!c){var w={name:t,win:u,domain:d,promise:l};(function(E,I){z("responseListeners").set(E,I)})(p,w);var m=L("requestPromises").getOrSet(u,function(){return[]});m.push(l),l.catch(function(){(function(E){z("erroredResponseListeners").set(E,!0)})(p),dt(p)});var S=function(E){return L("knownWindows").get(E,!1)}(u)?1e4:2e3,R=a,P=S,b=R,j=function(E,I){var q;return function A(){q=setTimeout(function(){(function(){if(J(u))return l.reject(new Error("Window closed for "+t+" before "+(w.ack?"response":"ack")));if(w.cancelled)return l.reject(new Error("Response listener was cancelled for "+t));P=Math.max(P-500,0),b!==-1&&(b=Math.max(b-500,0)),w.ack||P!==0?b===0&&l.reject(new Error("No response for postMessage "+f+" in "+M()+" in "+R+"ms")):l.reject(new Error("No ack for postMessage "+f+" in "+M()+" in "+S+"ms"))})(),A()},500)}(),{cancel:function(){clearTimeout(q)}}}();l.finally(function(){j.cancel(),m.splice(m.indexOf(l,1))}).catch(_)}return Tn(u,d,{id:Z(),origin:M(window),type:"postrobot_message_request",hash:p,name:t,data:r,fireAndForget:c},{on:$,send:n}).then(function(){return c?l.resolve():l},function(E){throw new Error("Send request message failed for "+f+" in "+M()+`
15
+ `+sn(u))}}),S.try(function(){if(!a)throw new Error("No handler found for post message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:n,origin:t,data:e.data})}).then(function(u){return c("success",u)},function(u){return c("error",null,u)})]).then(_).catch(function(u){if(a&&a.handleError)return a.handleError(u);throw u})}function $e(n,t,e){if(!he(e.hash)){var r=de(e.hash);if(!r)throw new Error("No handler found for post message ack for message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!tn(r.domain,t))throw new Error("Ack origin "+t+" does not match domain "+r.domain.toString());if(n!==r.win)throw new Error("Ack source does not match registered window")}catch(o){r.promise.reject(o)}r.ack=!0}}function Ye(n,t,e){if(!he(e.hash)){var r=de(e.hash);if(!r)throw new Error("No handler found for post message response for message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!tn(r.domain,t))throw new Error("Response origin "+t+" does not match domain "+(o=r.domain,Array.isArray(o)?"("+o.join(" | ")+")":v(o)?"RegExp("+o.toString()+")":o.toString()));var o;if(n!==r.win)throw new Error("Response source does not match registered window");fe(e.hash),e.ack==="error"?r.promise.reject(e.error):e.ack==="success"&&r.promise.resolve({source:n,origin:t,data:e.data})}}function ve(n,t){var e=t.on,r=t.send,o=j("receivedMessages");try{if(!window||window.closed||!n.source)return}catch{return}var i=n.source,a=n.origin,s=function(h,d,f,l){var m=l.on,w=l.send,p;try{p=se(d,f,h,{on:m,send:w})}catch{return}if(p&&typeof p=="object"&&p!==null){var x=p.__post_robot_10_0_46__;if(Array.isArray(x))return x}}(n.data,i,a,{on:e,send:r});if(s){re(i);for(var c=0;c<s.length;c++){var u=s[c];if(o.has(u.id)||(o.set(u.id,!0),J(i)&&!u.fireAndForget))return;u.origin.indexOf("file:")===0&&(a="file://");try{u.type==="postrobot_message_request"?Ve(i,a,u,{on:e,send:r}):u.type==="postrobot_message_response"?Ye(i,a,u):u.type==="postrobot_message_ack"&&$e(i,a,u)}catch(h){setTimeout(function(){throw h},0)}}}}function $(n,t,e){if(!n)throw new Error("Expected name");if(typeof(t=t||{})=="function"&&(e=t,t={}),!e)throw new Error("Expected handler");var r=function o(i,a){var s=i.name,c=i.win,u=i.domain,h=C("requestListeners");if(!s||typeof s!="string")throw new Error("Name required to add request listener");if(c&&c!=="*"&&B.isProxyWindow(c)){var d=c.awaitWindow().then(function(N){return o({name:s,win:N,domain:u},a)});return{cancel:function(){d.then(function(N){return N.cancel()},_)}}}var f=c;if(Array.isArray(f)){for(var l=[],m=0,w=f;m<w.length;m++)l.push(o({name:s,domain:u,win:w[m]},a));return{cancel:function(){for(var N=0;N<l.length;N++)l[N].cancel()}}}if(Array.isArray(u)){for(var p=[],x=0,R=u;x<R.length;x++)p.push(o({name:s,win:f,domain:R[x]},a));return{cancel:function(){for(var N=0;N<p.length;N++)p[N].cancel()}}}var b=le({name:s,win:f,domain:u});f&&f!=="*"||(f=xn());var P=(u=u||"*").toString();if(b)throw f&&u?new Error("Request listener already exists for "+s+" on domain "+u.toString()+" for "+(f===xn()?"wildcard":"specified")+" window"):f?new Error("Request listener already exists for "+s+" for "+(f===xn()?"wildcard":"specified")+" window"):u?new Error("Request listener already exists for "+s+" on domain "+u.toString()):new Error("Request listener already exists for "+s);var z=h.getOrSet(f,function(){return{}}),E=dn(z,s,function(){return{}}),I,q;return Dn(u)?(I=dn(E,"__domain_regex__",function(){return[]})).push(q={regex:u,listener:a}):E[P]=a,{cancel:function(){delete E[P],q&&(I.splice(I.indexOf(q,1)),I.length||delete E.__domain_regex__),Object.keys(E).length||delete z[s],f&&!Object.keys(z).length&&h.del(f)}}}({name:n,win:t.window,domain:t.domain||"*"},{handler:e||t.handler,handleError:t.errorHandler||function(o){throw o}});return{cancel:function(){r.cancel()}}}function ke(n,t,e){typeof(t=t||{})=="function"&&(e=t,t={});var r=new S,o;return t.errorHandler=function(i){o.cancel(),r.reject(i)},o=$(n,t,function(i){if(o.cancel(),r.resolve(i),e)return e(i)}),r.cancel=o.cancel,r}var Y=function n(t,e,r,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,s=o.timeout||5e3,c=o.fireAndForget||!1;return B.toProxyWindow(t,{send:n}).awaitWindow().then(function(u){return S.try(function(){if(function(h,d,f){if(!h)throw new Error("Expected name");if(f&&typeof f!="string"&&!Array.isArray(f)&&!Dn(f))throw new TypeError("Can not send "+h+". Expected domain "+JSON.stringify(f)+" to be a string, array, or regex");if(J(d))throw new Error("Can not send "+h+". Target window is closed")}(e,u,i),function(h,d){var f=Bn(d);if(f)return f===h;if(d===h||function(w){w===void 0&&(w=window);try{if(w.top)return w.top}catch{}if(V(w)===w)return w;try{if(Hn(window,w)&&window.top)return window.top}catch{}try{if(Hn(w,window)&&window.top)return window.top}catch{}for(var p=0,x=function b(P){for(var z=[],E=0,I=Un(P);E<I.length;E++){var q=I[E];z.push(q);for(var N=0,hn=b(q);N<hn.length;N++)z.push(hn[N])}return z}(w);p<x.length;p++){var R=x[p];try{if(R.top)return R.top}catch{}if(V(R)===R)return R}}(d)===d)return!1;for(var l=0,m=Un(h);l<m.length;l++)if(m[l]===d)return!0;return!1}(window,u))return function(h,d,f){d===void 0&&(d=5e3),f===void 0&&(f="Window");var l=function(m){return C("helloPromises").getOrSet(m,function(){return new S})}(h);return d!==-1&&(l=l.timeout(d,new Error(f+" did not load after "+d+"ms"))),l}(u,s)}).then(function(h){return function(d,f,l,m){var w=m.send;return S.try(function(){return typeof f=="string"?f:S.try(function(){return l||An(d,{send:w}).then(function(p){return p.domain})}).then(function(p){if(!tn(f,f))throw new Error("Domain "+kn(f)+" does not match "+kn(f));return p})})}(u,i,(h===void 0?{}:h).domain,{send:n})}).then(function(h){var d=h,f=e==="postrobot_method"&&r&&typeof r.name=="string"?r.name+"()":e,l=new S,m=e+"_"+Z();if(!c){var w={name:e,win:u,domain:d,promise:l};(function(E,I){j("responseListeners").set(E,I)})(m,w);var p=C("requestPromises").getOrSet(u,function(){return[]});p.push(l),l.catch(function(){(function(E){j("erroredResponseListeners").set(E,!0)})(m),fe(m)});var x=function(E){return C("knownWindows").get(E,!1)}(u)?1e4:2e3,R=a,b=x,P=R,z=function(E,I){var q;return function N(){q=setTimeout(function(){(function(){if(J(u))return l.reject(new Error("Window closed for "+e+" before "+(w.ack?"response":"ack")));if(w.cancelled)return l.reject(new Error("Response listener was cancelled for "+e));b=Math.max(b-500,0),P!==-1&&(P=Math.max(P-500,0)),w.ack||b!==0?P===0&&l.reject(new Error("No response for postMessage "+f+" in "+M()+" in "+R+"ms")):l.reject(new Error("No ack for postMessage "+f+" in "+M()+" in "+x+"ms"))})(),N()},500)}(),{cancel:function(){clearTimeout(q)}}}();l.finally(function(){z.cancel(),p.splice(p.indexOf(l,1))}).catch(_)}return Tn(u,d,{id:Z(),origin:M(window),type:"postrobot_message_request",hash:m,name:e,data:r,fireAndForget:c},{on:$,send:n}).then(function(){return c?l.resolve():l},function(E){throw new Error("Send request message failed for "+f+" in "+M()+`
16
16
 
17
- `+sn(E))})})})};function Yt(n,e,t){return ut(n,e,t,{on:$,send:Y})}function kt(n,e,t){return ct(n,e,t,{on:$,send:Y})}function Kt(n){return new B({send:Y,win:n})}function Xt(n){return B.toProxyWindow(n,{send:Y})}function vt(){fn().initialized||(fn().initialized=!0,e=(n={on:$,send:Y}).on,t=n.send,(r=fn()).receiveMessage=r.receiveMessage||function(o){return lt(o,{on:e,send:t})},function(o){var i=o.on,a=o.send;z().getOrSet("postMessageListener",function(){return function(s,c,u){return s.addEventListener("message",u),{cancel:function(){s.removeEventListener("message",u)}}}(window,0,function(s){(function(c,u){var h=u.on,d=u.send;x.try(function(){var f=c.source||c.sourceElement,l=c.origin||c.originalEvent&&c.originalEvent.origin,p=c.data;if(l==="null"&&(l="file://"),f){if(!l)throw new Error("Post message did not have origin domain");lt({source:f,origin:l,data:p},{on:h,send:d})}})})(s,{on:i,send:a})})})}({on:$,send:Y}),function(o){var i=o.on,a=o.send;z("builtinListeners").getOrSet("helloListener",function(){var s=i("postrobot_hello",{domain:"*"},function(u){return nt(u.source,{domain:u.origin}),{instanceID:_n()}}),c=Un();return c&&An(c,{send:a}).catch(function(u){}),s})}({on:$,send:Y}));var n,e,t,r}function Qt(){(function(){for(var e=z("responseListeners"),t=0,r=e.keys();t<r.length;t++){var o=r[t],i=e.get(o);i&&(i.cancelled=!0),e.del(o)}})(),(n=z().get("postMessageListener"))&&n.cancel();var n;delete window.__post_robot_10_0_46__}var _t=!0;function ne(n){for(var e=0,t=L("requestPromises").get(n,[]);e<t.length;e++)t[e].reject(new Error("Window "+(J(n)?"closed":"cleaned up")+" before response")).catch(_)}vt()}])})})(Mn);var gt=Mn.exports;(function(D){D.exports=gt,D.exports.default=D.exports})(T);var yt=T.exports;const Et=O(yt),Wt="WIDGET_EVENT",xt="https://app.soyio.id/widget",St="https://sandbox.soyio.id/widget",bt=["IDENTITY_AUTHENTICATED","IDENTITY_REGISTERED"],Pt="WIDGET_CLOSED";function It(D,C,G,W){const g=W||(G?St:xt),v=Object.entries(C).filter(([,y])=>y).map(([y,F])=>`${y}=${encodeURIComponent(F)}`).join("&");return`${g}/${D}?platform=web&${v}`}let k=null;function bn(){if(k&&!k.closed)k.focus();else throw new Error("Popup window does not exist or is closed.")}function Ot(D,C,G,W){const g=It(D,C,G,W),v=510,y=720,F=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width,K=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height,tn=F/2-v/2,V=K/2-y/2;document.body.style.filter="blur(5px)",document.body.addEventListener("click",wn=>{bn(),wn.preventDefault()}),k=window.open(g,"Soyio",`scrollbars=yes, width=${v}, height=${y}, top=${V}, left=${tn}`),bn()}function Ln(){document.body.style.filter="",document.body.removeEventListener("click",bn)}function Dt(){k&&(k.close(),k=null),Ln()}function At(D){const{onEvent:C}=D;Et.on(Wt,G=>{C(G.data),bt.includes(G.data.eventName)?Dt():G.data.eventName===Pt&&Ln()})}function Nt(D){At(D)}class Rt{constructor(C){wt(this,vn);ln(this,"flow");ln(this,"configProps");ln(this,"onEvent");ln(this,"isSandbox");this.flow=C.flow,this.configProps=C.configProps,this.onEvent=C.onEvent,this.isSandbox=C.isSandbox??!1,this.validateProps(),Ot(this.flow,this.configProps,this.isSandbox,C.developmentUrl),Nt({onEvent:mt(this,vn,pt).bind(this)})}validateProps(){if(this.flow==="authenticate"){if(!this.configProps.identityId)throw new Error("identityId is required");if(!this.configProps.companyId)throw new Error("companyId is required")}else if(this.flow==="register"){if(!this.configProps.flowTemplateId)throw new Error("flowTemplateId is required");if(!this.configProps.companyId)throw new Error("companyId is required")}}}return vn=new WeakSet,pt=function(C){this.onEvent(C)},Rt});
17
+ `+sn(E))})})})};function Ke(n,t,e){return ce(n,t,e,{on:$,send:Y})}function Xe(n,t,e){return se(n,t,e,{on:$,send:Y})}function Qe(n){return new B({send:Y,win:n})}function _e(n){return B.toProxyWindow(n,{send:Y})}function we(){fn().initialized||(fn().initialized=!0,t=(n={on:$,send:Y}).on,e=n.send,(r=fn()).receiveMessage=r.receiveMessage||function(o){return ve(o,{on:t,send:e})},function(o){var i=o.on,a=o.send;j().getOrSet("postMessageListener",function(){return function(s,c,u){return s.addEventListener("message",u),{cancel:function(){s.removeEventListener("message",u)}}}(window,0,function(s){(function(c,u){var h=u.on,d=u.send;S.try(function(){var f=c.source||c.sourceElement,l=c.origin||c.originalEvent&&c.originalEvent.origin,m=c.data;if(l==="null"&&(l="file://"),f){if(!l)throw new Error("Post message did not have origin domain");ve({source:f,origin:l,data:m},{on:h,send:d})}})})(s,{on:i,send:a})})})}({on:$,send:Y}),function(o){var i=o.on,a=o.send;j("builtinListeners").getOrSet("helloListener",function(){var s=i("postrobot_hello",{domain:"*"},function(u){return ee(u.source,{domain:u.origin}),{instanceID:ne()}}),c=Bn();return c&&An(c,{send:a}).catch(function(u){}),s})}({on:$,send:Y}));var n,t,e,r}function nt(){(function(){for(var t=j("responseListeners"),e=0,r=t.keys();e<r.length;e++){var o=r[e],i=t.get(o);i&&(i.cancelled=!0),t.del(o)}})(),(n=j().get("postMessageListener"))&&n.cancel();var n;delete window.__post_robot_10_0_46__}var et=!0;function tt(n){for(var t=0,e=C("requestPromises").get(n,[]);t<e.length;t++)e[t].reject(new Error("Window "+(J(n)?"closed":"cleaned up")+" before response")).catch(_)}we()}])})})(Ln);var ye=Ln.exports;(function(A){A.exports=ye,A.exports.default=A.exports})(Cn);var Ee=Cn.exports;const We=L(Ee),Se="WIDGET_EVENT",xe="https://app.soyio.id/widget",Pe="https://sandbox.soyio.id/widget",be=["IDENTITY_AUTHENTICATED","IDENTITY_REGISTERED","DENIED_CAMERA_PERMISSION"],Ie="WIDGET_CLOSED";function Oe(A,T,G,W){const g=W||(G?Pe:xe),v=Object.entries(T).filter(([,y])=>y).map(([y,F])=>`${y}=${encodeURIComponent(F)}`).join("&");return`${g}/${A}?sdk=web&${v}`}let k=null;function Pn(){if(k&&!k.closed)k.focus();else throw new Error("Popup window does not exist or is closed.")}function De(A,T,G,W){const g=Oe(A,T,G,W),v=510,y=720,F=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width,K=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height,en=F/2-v/2,V=K/2-y/2;document.body.style.filter="blur(5px)",document.body.addEventListener("click",wn=>{Pn(),wn.preventDefault()}),k=window.open(g,"Soyio",`scrollbars=yes, width=${v}, height=${y}, top=${V}, left=${en}`),Pn()}function Fn(){document.body.style.filter="",document.body.removeEventListener("click",Pn)}function Ae(){k&&(k.close(),k=null),Fn()}function Ne(A){const{onEvent:T}=A;We.on(Se,G=>{T(G.data),be.includes(G.data.eventName)?Ae():G.data.eventName===Ie&&Fn()})}function Re(A){Ne(A)}const je=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class ze{constructor(T){pe(this,vn);ln(this,"flow");ln(this,"configProps");ln(this,"onEvent");ln(this,"isSandbox");this.flow=T.flow,this.configProps=T.configProps,this.onEvent=T.onEvent,this.isSandbox=T.isSandbox??!1,this.validateProps(),De(this.flow,this.configProps,this.isSandbox,T.developmentUrl),Re({onEvent:me(this,vn,ge).bind(this)})}validateProps(){if(this.flow==="authenticate"){if(this.configProps=this.configProps,!this.configProps.identityId)throw new Error("identityId is required");if(!this.configProps.companyId)throw new Error("companyId is required")}else if(this.flow==="register"){if(this.configProps=this.configProps,!this.configProps.flowTemplateId)throw new Error("flowTemplateId is required");if(!this.configProps.companyId)throw new Error("companyId is required")}}}vn=new WeakSet,ge=function(T){this.onEvent(T)},D.SoyioTypes=je,D.default=ze,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soyio/soyio-widget",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "module": "./dist/index.js",