@sendity/client 0.1.5 → 0.1.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/dist/components/sendity.d.ts +14 -2
- package/dist/i18n/sendity.en.d.ts +1 -0
- package/dist/sendity-client.js +466 -358
- package/dist/tailwind.css +1 -1
- package/package.json +1 -1
package/dist/sendity-client.js
CHANGED
|
@@ -15,6 +15,10 @@ const pt = `<template id="sendity-tpl">
|
|
|
15
15
|
<div class="verifiers" role="group" aria-label="Send the code">
|
|
16
16
|
<!-- Channel options inserted by component -->
|
|
17
17
|
</div>
|
|
18
|
+
|
|
19
|
+
<div class="sendity-secondary-slot" hidden>
|
|
20
|
+
<slot name="secondary"></slot>
|
|
21
|
+
</div>
|
|
18
22
|
</div>
|
|
19
23
|
|
|
20
24
|
<footer class="sendity-footer" aria-live="polite" aria-atomic="true">
|
|
@@ -95,9 +99,10 @@ const pt = `<template id="sendity-tpl">
|
|
|
95
99
|
--sendity-whatsapp-bg-hover:#bbf3d6;
|
|
96
100
|
|
|
97
101
|
--sendity-btn-font-size: var(--sendity-font-size-sm);
|
|
98
|
-
--sendity-btn-
|
|
102
|
+
--sendity-btn-min-height: 2.25rem; /* 36 — Flux default button height */
|
|
103
|
+
--sendity-btn-padding: 0.5rem 0.875rem;
|
|
99
104
|
--sendity-btn-border-radius: 0.5625rem; /* 9 */
|
|
100
|
-
--sendity-btn-shadow: inset 0 1px 0 0 rgb(255 255 255 / 0.
|
|
105
|
+
--sendity-btn-shadow: inset 0 1px 0 0 rgb(255 255 255 / 0.2), 0 1px 2px 0 rgb(28 25 23 / 0.10);
|
|
101
106
|
|
|
102
107
|
--sendity-success-check-bg: var(--sendity-success-bg);
|
|
103
108
|
--sendity-success-check-color: var(--sendity-success-color);
|
|
@@ -110,15 +115,68 @@ const pt = `<template id="sendity-tpl">
|
|
|
110
115
|
|
|
111
116
|
/* Card layout */
|
|
112
117
|
--sendity-width: 320px;
|
|
113
|
-
--sendity-body-
|
|
118
|
+
--sendity-body-height: 14.125rem;
|
|
119
|
+
--sendity-footer-height: 2.75rem;
|
|
114
120
|
--sendity-crossfade-duration: 220ms;
|
|
115
121
|
|
|
116
122
|
color-scheme: light;
|
|
123
|
+
display: inline-flex;
|
|
124
|
+
max-width: 100%;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:host([variant="no-card"]),
|
|
128
|
+
:host([no-card]) {
|
|
129
|
+
display: flex;
|
|
130
|
+
width: 100%;
|
|
131
|
+
height: 100%;
|
|
132
|
+
max-width: 100%;
|
|
133
|
+
min-height: 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:host([variant="no-card"]) .sendity,
|
|
137
|
+
:host([no-card]) .sendity,
|
|
138
|
+
.sendity.sendity--no-card {
|
|
139
|
+
width: 100%;
|
|
140
|
+
height: 100%;
|
|
141
|
+
min-height: calc(var(--sendity-body-height) + var(--sendity-footer-height));
|
|
142
|
+
border: 0;
|
|
143
|
+
border-radius: 0;
|
|
144
|
+
box-shadow: none;
|
|
145
|
+
background: transparent;
|
|
146
|
+
overflow: visible;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:host([variant="no-card"]) .sendity.sendity--verified,
|
|
150
|
+
:host([variant="no-card"]) .sendity.sendity--expired,
|
|
151
|
+
:host([no-card]) .sendity.sendity--verified,
|
|
152
|
+
:host([no-card]) .sendity.sendity--expired,
|
|
153
|
+
.sendity.sendity--no-card.sendity--verified,
|
|
154
|
+
.sendity.sendity--no-card.sendity--expired {
|
|
155
|
+
box-shadow: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
:host([variant="no-card"]) .sendity-body,
|
|
159
|
+
:host([no-card]) .sendity-body,
|
|
160
|
+
.sendity.sendity--no-card .sendity-body {
|
|
161
|
+
flex: 1 1 auto;
|
|
162
|
+
height: auto;
|
|
163
|
+
min-height: 0;
|
|
164
|
+
padding: 0 0 1rem;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
:host([variant="no-card"]) .sendity-footer,
|
|
168
|
+
:host([no-card]) .sendity-footer,
|
|
169
|
+
.sendity.sendity--no-card .sendity-footer {
|
|
170
|
+
margin-top: auto;
|
|
171
|
+
flex: 0 0 var(--sendity-footer-height);
|
|
172
|
+
border-top-color: var(--sendity-border);
|
|
173
|
+
padding-inline: 0.625rem 0;
|
|
117
174
|
}
|
|
118
175
|
|
|
119
176
|
.sendity {
|
|
120
177
|
width: var(--sendity-width);
|
|
121
178
|
max-width: 100%;
|
|
179
|
+
box-sizing: border-box;
|
|
122
180
|
display: inline-flex;
|
|
123
181
|
flex-direction: column;
|
|
124
182
|
background: var(--sendity-surface);
|
|
@@ -142,10 +200,12 @@ const pt = `<template id="sendity-tpl">
|
|
|
142
200
|
|
|
143
201
|
.sendity-body {
|
|
144
202
|
position: relative;
|
|
203
|
+
box-sizing: border-box;
|
|
145
204
|
flex: 1;
|
|
146
205
|
display: flex;
|
|
147
206
|
flex-direction: column;
|
|
148
|
-
|
|
207
|
+
height: var(--sendity-body-height);
|
|
208
|
+
min-height: var(--sendity-body-height);
|
|
149
209
|
padding: 1.25rem 1.25rem 1rem;
|
|
150
210
|
gap: 0.875rem;
|
|
151
211
|
}
|
|
@@ -180,7 +240,7 @@ const pt = `<template id="sendity-tpl">
|
|
|
180
240
|
text-align: center;
|
|
181
241
|
gap: 0.5rem;
|
|
182
242
|
overflow: hidden;
|
|
183
|
-
transition: opacity var(--sendity-crossfade-duration) ease, transform var(--sendity-crossfade-duration) ease, background-color var(--sendity-crossfade-duration) ease, border-color var(--sendity-crossfade-duration) ease, color var(--sendity-crossfade-duration) ease
|
|
243
|
+
transition: opacity var(--sendity-crossfade-duration) ease, transform var(--sendity-crossfade-duration) ease, background-color var(--sendity-crossfade-duration) ease, border-color var(--sendity-crossfade-duration) ease, color var(--sendity-crossfade-duration) ease;
|
|
184
244
|
}
|
|
185
245
|
|
|
186
246
|
.sendity .code--exiting {
|
|
@@ -189,15 +249,6 @@ const pt = `<template id="sendity-tpl">
|
|
|
189
249
|
pointer-events: none;
|
|
190
250
|
}
|
|
191
251
|
|
|
192
|
-
.sendity .code--collapsed {
|
|
193
|
-
max-height: 0;
|
|
194
|
-
min-height: 0;
|
|
195
|
-
padding-top: 0;
|
|
196
|
-
padding-bottom: 0;
|
|
197
|
-
margin: 0;
|
|
198
|
-
border-width: 0;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
252
|
.sendity .spinner {
|
|
202
253
|
width: 1.125rem;
|
|
203
254
|
height: 1.125rem;
|
|
@@ -241,6 +292,27 @@ const pt = `<template id="sendity-tpl">
|
|
|
241
292
|
pointer-events: none;
|
|
242
293
|
}
|
|
243
294
|
|
|
295
|
+
.sendity .sendity-secondary-slot {
|
|
296
|
+
display: block;
|
|
297
|
+
min-width: 0;
|
|
298
|
+
font-size: var(--sendity-font-size-sm);
|
|
299
|
+
line-height: 1.45;
|
|
300
|
+
color: var(--sendity-fg-2);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.sendity .sendity-secondary-slot[hidden] {
|
|
304
|
+
display: none !important;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.sendity .sendity-secondary-slot--filled {
|
|
308
|
+
margin-top: 0.125rem;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.sendity .sendity-secondary-slot ::slotted(*) {
|
|
312
|
+
box-sizing: border-box;
|
|
313
|
+
max-width: 100%;
|
|
314
|
+
}
|
|
315
|
+
|
|
244
316
|
.sendity .verifiers.is-two {
|
|
245
317
|
grid-template-columns: 1fr 1px 1fr;
|
|
246
318
|
}
|
|
@@ -279,6 +351,7 @@ const pt = `<template id="sendity-tpl">
|
|
|
279
351
|
text-decoration: none;
|
|
280
352
|
border: 1px solid;
|
|
281
353
|
border-radius: var(--sendity-btn-border-radius);
|
|
354
|
+
min-height: var(--sendity-btn-min-height);
|
|
282
355
|
padding: var(--sendity-btn-padding);
|
|
283
356
|
box-shadow: var(--sendity-btn-shadow);
|
|
284
357
|
cursor: pointer;
|
|
@@ -454,6 +527,7 @@ const pt = `<template id="sendity-tpl">
|
|
|
454
527
|
}
|
|
455
528
|
|
|
456
529
|
.sendity .sendity-footer {
|
|
530
|
+
box-sizing: border-box;
|
|
457
531
|
border-top: 1px solid var(--sendity-border);
|
|
458
532
|
padding: 0.8125rem 1.125rem;
|
|
459
533
|
display: grid;
|
|
@@ -461,7 +535,8 @@ const pt = `<template id="sendity-tpl">
|
|
|
461
535
|
align-items: center;
|
|
462
536
|
justify-content: stretch;
|
|
463
537
|
gap: 0.5rem;
|
|
464
|
-
|
|
538
|
+
height: var(--sendity-footer-height);
|
|
539
|
+
min-height: var(--sendity-footer-height);
|
|
465
540
|
color: var(--sendity-fg-3);
|
|
466
541
|
font-size: var(--sendity-font-size-xs);
|
|
467
542
|
line-height: 1rem;
|
|
@@ -510,10 +585,24 @@ const pt = `<template id="sendity-tpl">
|
|
|
510
585
|
transform: translateY(0);
|
|
511
586
|
}
|
|
512
587
|
|
|
588
|
+
.sendity .sendity-footer.footer--verified .footer-status {
|
|
589
|
+
justify-content: center;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.sendity .sendity-footer.footer--verified .footer-status-left {
|
|
593
|
+
width: 100%;
|
|
594
|
+
justify-content: center;
|
|
595
|
+
}
|
|
596
|
+
|
|
513
597
|
.sendity .sendity-footer.footer--verified .footer-spinner {
|
|
514
598
|
display: none;
|
|
515
599
|
}
|
|
516
600
|
|
|
601
|
+
.sendity .sendity-footer.footer--verified .footer-message {
|
|
602
|
+
white-space: nowrap;
|
|
603
|
+
text-align: center;
|
|
604
|
+
}
|
|
605
|
+
|
|
517
606
|
.sendity .footer-status-left {
|
|
518
607
|
display: inline-flex;
|
|
519
608
|
align-items: center;
|
|
@@ -756,7 +845,7 @@ class Di extends Ue {
|
|
|
756
845
|
), this;
|
|
757
846
|
}
|
|
758
847
|
}
|
|
759
|
-
class
|
|
848
|
+
class Wi extends St {
|
|
760
849
|
/**
|
|
761
850
|
* Register a callback to be called anytime the member list changes.
|
|
762
851
|
*/
|
|
@@ -867,7 +956,7 @@ class Tt extends qe {
|
|
|
867
956
|
)), (!s || this.listeners[i].length === 0) && (this.events[i] && (this.socket.removeListener(i, this.events[i]), delete this.events[i]), delete this.listeners[i]);
|
|
868
957
|
}
|
|
869
958
|
}
|
|
870
|
-
class
|
|
959
|
+
class Et extends Tt {
|
|
871
960
|
/**
|
|
872
961
|
* Send a whisper event to other clients in the channel.
|
|
873
962
|
*/
|
|
@@ -879,7 +968,7 @@ class xt extends Tt {
|
|
|
879
968
|
}), this;
|
|
880
969
|
}
|
|
881
970
|
}
|
|
882
|
-
class
|
|
971
|
+
class Fi extends Et {
|
|
883
972
|
/**
|
|
884
973
|
* Register a callback to be called anytime the member list changes.
|
|
885
974
|
*/
|
|
@@ -965,7 +1054,7 @@ class ge extends qe {
|
|
|
965
1054
|
return this;
|
|
966
1055
|
}
|
|
967
1056
|
}
|
|
968
|
-
class
|
|
1057
|
+
class xt extends ge {
|
|
969
1058
|
/**
|
|
970
1059
|
* Send a whisper event to other clients in the channel.
|
|
971
1060
|
*/
|
|
@@ -981,7 +1070,7 @@ class Bi extends ge {
|
|
|
981
1070
|
return this;
|
|
982
1071
|
}
|
|
983
1072
|
}
|
|
984
|
-
class $i extends
|
|
1073
|
+
class $i extends xt {
|
|
985
1074
|
/**
|
|
986
1075
|
* Register a callback to be called anytime the member list changes.
|
|
987
1076
|
*/
|
|
@@ -1118,7 +1207,7 @@ class fe extends Ne {
|
|
|
1118
1207
|
* Get a presence channel instance by name.
|
|
1119
1208
|
*/
|
|
1120
1209
|
presenceChannel(i) {
|
|
1121
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1210
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Wi(
|
|
1122
1211
|
this.pusher,
|
|
1123
1212
|
"presence-" + i,
|
|
1124
1213
|
this.options
|
|
@@ -1187,7 +1276,7 @@ class fe extends Ne {
|
|
|
1187
1276
|
this.pusher.disconnect();
|
|
1188
1277
|
}
|
|
1189
1278
|
}
|
|
1190
|
-
class
|
|
1279
|
+
class Vi extends Ne {
|
|
1191
1280
|
constructor() {
|
|
1192
1281
|
super(...arguments), this.channels = {};
|
|
1193
1282
|
}
|
|
@@ -1237,7 +1326,7 @@ class Xi extends Ne {
|
|
|
1237
1326
|
* Get a private channel instance by name.
|
|
1238
1327
|
*/
|
|
1239
1328
|
privateChannel(i) {
|
|
1240
|
-
return this.channels["private-" + i] || (this.channels["private-" + i] = new
|
|
1329
|
+
return this.channels["private-" + i] || (this.channels["private-" + i] = new Et(
|
|
1241
1330
|
this.socket,
|
|
1242
1331
|
"private-" + i,
|
|
1243
1332
|
this.options
|
|
@@ -1247,7 +1336,7 @@ class Xi extends Ne {
|
|
|
1247
1336
|
* Get a presence channel instance by name.
|
|
1248
1337
|
*/
|
|
1249
1338
|
presenceChannel(i) {
|
|
1250
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1339
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Fi(
|
|
1251
1340
|
this.socket,
|
|
1252
1341
|
"presence-" + i,
|
|
1253
1342
|
this.options
|
|
@@ -1334,7 +1423,7 @@ class mt extends Ne {
|
|
|
1334
1423
|
* Get a private channel instance by name.
|
|
1335
1424
|
*/
|
|
1336
1425
|
privateChannel(i) {
|
|
1337
|
-
return new
|
|
1426
|
+
return new xt();
|
|
1338
1427
|
}
|
|
1339
1428
|
/**
|
|
1340
1429
|
* Get a private encrypted channel instance by name.
|
|
@@ -1383,7 +1472,7 @@ class mt extends Ne {
|
|
|
1383
1472
|
disconnect() {
|
|
1384
1473
|
}
|
|
1385
1474
|
}
|
|
1386
|
-
class
|
|
1475
|
+
class Xi {
|
|
1387
1476
|
/**
|
|
1388
1477
|
* Create a new class instance.
|
|
1389
1478
|
*/
|
|
@@ -1414,7 +1503,7 @@ class Vi {
|
|
|
1414
1503
|
broadcaster: "pusher"
|
|
1415
1504
|
});
|
|
1416
1505
|
else if (this.options.broadcaster === "socket.io")
|
|
1417
|
-
this.connector = new
|
|
1506
|
+
this.connector = new Vi(this.options);
|
|
1418
1507
|
else if (this.options.broadcaster === "null")
|
|
1419
1508
|
this.connector = new mt(this.options);
|
|
1420
1509
|
else if (typeof this.options.broadcaster == "function" && Hi(this.options.broadcaster))
|
|
@@ -1544,7 +1633,7 @@ class Vi {
|
|
|
1544
1633
|
function Ji(v) {
|
|
1545
1634
|
return v && v.__esModule && Object.prototype.hasOwnProperty.call(v, "default") ? v.default : v;
|
|
1546
1635
|
}
|
|
1547
|
-
var
|
|
1636
|
+
var Re = { exports: {} };
|
|
1548
1637
|
var gt;
|
|
1549
1638
|
function Gi() {
|
|
1550
1639
|
return gt || (gt = 1, (function(v, i) {
|
|
@@ -1557,158 +1646,158 @@ function Gi() {
|
|
|
1557
1646
|
/***/
|
|
1558
1647
|
594(m, g) {
|
|
1559
1648
|
var y = this && this.__extends || /* @__PURE__ */ (function() {
|
|
1560
|
-
var
|
|
1561
|
-
return
|
|
1562
|
-
|
|
1563
|
-
} || function(
|
|
1564
|
-
for (var q in L) L.hasOwnProperty(q) && (
|
|
1565
|
-
},
|
|
1649
|
+
var E = function(u, f) {
|
|
1650
|
+
return E = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(C, L) {
|
|
1651
|
+
C.__proto__ = L;
|
|
1652
|
+
} || function(C, L) {
|
|
1653
|
+
for (var q in L) L.hasOwnProperty(q) && (C[q] = L[q]);
|
|
1654
|
+
}, E(u, f);
|
|
1566
1655
|
};
|
|
1567
1656
|
return function(u, f) {
|
|
1568
|
-
|
|
1569
|
-
function
|
|
1657
|
+
E(u, f);
|
|
1658
|
+
function C() {
|
|
1570
1659
|
this.constructor = u;
|
|
1571
1660
|
}
|
|
1572
|
-
u.prototype = f === null ? Object.create(f) : (
|
|
1661
|
+
u.prototype = f === null ? Object.create(f) : (C.prototype = f.prototype, new C());
|
|
1573
1662
|
};
|
|
1574
1663
|
})();
|
|
1575
1664
|
Object.defineProperty(g, "__esModule", { value: !0 });
|
|
1576
|
-
var
|
|
1665
|
+
var x = 256, S = (
|
|
1577
1666
|
/** @class */
|
|
1578
1667
|
(function() {
|
|
1579
|
-
function
|
|
1668
|
+
function E(u) {
|
|
1580
1669
|
u === void 0 && (u = "="), this._paddingCharacter = u;
|
|
1581
1670
|
}
|
|
1582
|
-
return
|
|
1671
|
+
return E.prototype.encodedLength = function(u) {
|
|
1583
1672
|
return this._paddingCharacter ? (u + 2) / 3 * 4 | 0 : (u * 8 + 5) / 6 | 0;
|
|
1584
|
-
},
|
|
1585
|
-
for (var f = "",
|
|
1586
|
-
var L = u[
|
|
1673
|
+
}, E.prototype.encode = function(u) {
|
|
1674
|
+
for (var f = "", C = 0; C < u.length - 2; C += 3) {
|
|
1675
|
+
var L = u[C] << 16 | u[C + 1] << 8 | u[C + 2];
|
|
1587
1676
|
f += this._encodeByte(L >>> 18 & 63), f += this._encodeByte(L >>> 12 & 63), f += this._encodeByte(L >>> 6 & 63), f += this._encodeByte(L >>> 0 & 63);
|
|
1588
1677
|
}
|
|
1589
|
-
var q = u.length -
|
|
1678
|
+
var q = u.length - C;
|
|
1590
1679
|
if (q > 0) {
|
|
1591
|
-
var L = u[
|
|
1680
|
+
var L = u[C] << 16 | (q === 2 ? u[C + 1] << 8 : 0);
|
|
1592
1681
|
f += this._encodeByte(L >>> 18 & 63), f += this._encodeByte(L >>> 12 & 63), q === 2 ? f += this._encodeByte(L >>> 6 & 63) : f += this._paddingCharacter || "", f += this._paddingCharacter || "";
|
|
1593
1682
|
}
|
|
1594
1683
|
return f;
|
|
1595
|
-
},
|
|
1684
|
+
}, E.prototype.maxDecodedLength = function(u) {
|
|
1596
1685
|
return this._paddingCharacter ? u / 4 * 3 | 0 : (u * 6 + 7) / 8 | 0;
|
|
1597
|
-
},
|
|
1686
|
+
}, E.prototype.decodedLength = function(u) {
|
|
1598
1687
|
return this.maxDecodedLength(u.length - this._getPaddingLength(u));
|
|
1599
|
-
},
|
|
1688
|
+
}, E.prototype.decode = function(u) {
|
|
1600
1689
|
if (u.length === 0)
|
|
1601
1690
|
return new Uint8Array(0);
|
|
1602
|
-
for (var f = this._getPaddingLength(u),
|
|
1603
|
-
J = this._decodeChar(u.charCodeAt(M + 0)), D = this._decodeChar(u.charCodeAt(M + 1)), H = this._decodeChar(u.charCodeAt(M + 2)), G = this._decodeChar(u.charCodeAt(M + 3)), L[q++] = J << 2 | D >>> 4, L[q++] = D << 4 | H >>> 2, L[q++] = H << 6 | G, z |= J &
|
|
1604
|
-
if (M <
|
|
1691
|
+
for (var f = this._getPaddingLength(u), C = u.length - f, L = new Uint8Array(this.maxDecodedLength(C)), q = 0, M = 0, z = 0, J = 0, D = 0, H = 0, G = 0; M < C - 4; M += 4)
|
|
1692
|
+
J = this._decodeChar(u.charCodeAt(M + 0)), D = this._decodeChar(u.charCodeAt(M + 1)), H = this._decodeChar(u.charCodeAt(M + 2)), G = this._decodeChar(u.charCodeAt(M + 3)), L[q++] = J << 2 | D >>> 4, L[q++] = D << 4 | H >>> 2, L[q++] = H << 6 | G, z |= J & x, z |= D & x, z |= H & x, z |= G & x;
|
|
1693
|
+
if (M < C - 1 && (J = this._decodeChar(u.charCodeAt(M)), D = this._decodeChar(u.charCodeAt(M + 1)), L[q++] = J << 2 | D >>> 4, z |= J & x, z |= D & x), M < C - 2 && (H = this._decodeChar(u.charCodeAt(M + 2)), L[q++] = D << 4 | H >>> 2, z |= H & x), M < C - 3 && (G = this._decodeChar(u.charCodeAt(M + 3)), L[q++] = H << 6 | G, z |= G & x), z !== 0)
|
|
1605
1694
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
1606
1695
|
return L;
|
|
1607
|
-
},
|
|
1696
|
+
}, E.prototype._encodeByte = function(u) {
|
|
1608
1697
|
var f = u;
|
|
1609
1698
|
return f += 65, f += 25 - u >>> 8 & 6, f += 51 - u >>> 8 & -75, f += 61 - u >>> 8 & -15, f += 62 - u >>> 8 & 3, String.fromCharCode(f);
|
|
1610
|
-
},
|
|
1611
|
-
var f =
|
|
1612
|
-
return f += (42 - u & u - 44) >>> 8 & -
|
|
1613
|
-
},
|
|
1699
|
+
}, E.prototype._decodeChar = function(u) {
|
|
1700
|
+
var f = x;
|
|
1701
|
+
return f += (42 - u & u - 44) >>> 8 & -x + u - 43 + 62, f += (46 - u & u - 48) >>> 8 & -x + u - 47 + 63, f += (47 - u & u - 58) >>> 8 & -x + u - 48 + 52, f += (64 - u & u - 91) >>> 8 & -x + u - 65 + 0, f += (96 - u & u - 123) >>> 8 & -x + u - 97 + 26, f;
|
|
1702
|
+
}, E.prototype._getPaddingLength = function(u) {
|
|
1614
1703
|
var f = 0;
|
|
1615
1704
|
if (this._paddingCharacter) {
|
|
1616
|
-
for (var
|
|
1705
|
+
for (var C = u.length - 1; C >= 0 && u[C] === this._paddingCharacter; C--)
|
|
1617
1706
|
f++;
|
|
1618
1707
|
if (u.length < 4 || f > 2)
|
|
1619
1708
|
throw new Error("Base64Coder: incorrect padding");
|
|
1620
1709
|
}
|
|
1621
1710
|
return f;
|
|
1622
|
-
},
|
|
1711
|
+
}, E;
|
|
1623
1712
|
})()
|
|
1624
1713
|
);
|
|
1625
|
-
g.Coder =
|
|
1626
|
-
var
|
|
1627
|
-
function T(
|
|
1628
|
-
return
|
|
1714
|
+
g.Coder = S;
|
|
1715
|
+
var O = new S();
|
|
1716
|
+
function T(E) {
|
|
1717
|
+
return O.encode(E);
|
|
1629
1718
|
}
|
|
1630
1719
|
g.encode = T;
|
|
1631
|
-
function A(
|
|
1632
|
-
return
|
|
1720
|
+
function A(E) {
|
|
1721
|
+
return O.decode(E);
|
|
1633
1722
|
}
|
|
1634
1723
|
g.decode = A;
|
|
1635
|
-
var
|
|
1724
|
+
var W = (
|
|
1636
1725
|
/** @class */
|
|
1637
|
-
(function(
|
|
1638
|
-
y(u,
|
|
1726
|
+
(function(E) {
|
|
1727
|
+
y(u, E);
|
|
1639
1728
|
function u() {
|
|
1640
|
-
return
|
|
1729
|
+
return E !== null && E.apply(this, arguments) || this;
|
|
1641
1730
|
}
|
|
1642
1731
|
return u.prototype._encodeByte = function(f) {
|
|
1643
|
-
var
|
|
1644
|
-
return
|
|
1732
|
+
var C = f;
|
|
1733
|
+
return C += 65, C += 25 - f >>> 8 & 6, C += 51 - f >>> 8 & -75, C += 61 - f >>> 8 & -13, C += 62 - f >>> 8 & 49, String.fromCharCode(C);
|
|
1645
1734
|
}, u.prototype._decodeChar = function(f) {
|
|
1646
|
-
var
|
|
1647
|
-
return
|
|
1735
|
+
var C = x;
|
|
1736
|
+
return C += (44 - f & f - 46) >>> 8 & -x + f - 45 + 62, C += (94 - f & f - 96) >>> 8 & -x + f - 95 + 63, C += (47 - f & f - 58) >>> 8 & -x + f - 48 + 52, C += (64 - f & f - 91) >>> 8 & -x + f - 65 + 0, C += (96 - f & f - 123) >>> 8 & -x + f - 97 + 26, C;
|
|
1648
1737
|
}, u;
|
|
1649
|
-
})(
|
|
1738
|
+
})(S)
|
|
1650
1739
|
);
|
|
1651
|
-
g.URLSafeCoder =
|
|
1652
|
-
var N = new
|
|
1653
|
-
function
|
|
1654
|
-
return N.encode(
|
|
1740
|
+
g.URLSafeCoder = W;
|
|
1741
|
+
var N = new W();
|
|
1742
|
+
function F(E) {
|
|
1743
|
+
return N.encode(E);
|
|
1655
1744
|
}
|
|
1656
|
-
g.encodeURLSafe =
|
|
1657
|
-
function te(
|
|
1658
|
-
return N.decode(
|
|
1745
|
+
g.encodeURLSafe = F;
|
|
1746
|
+
function te(E) {
|
|
1747
|
+
return N.decode(E);
|
|
1659
1748
|
}
|
|
1660
|
-
g.decodeURLSafe = te, g.encodedLength = function(
|
|
1661
|
-
return
|
|
1662
|
-
}, g.maxDecodedLength = function(
|
|
1663
|
-
return
|
|
1664
|
-
}, g.decodedLength = function(
|
|
1665
|
-
return
|
|
1749
|
+
g.decodeURLSafe = te, g.encodedLength = function(E) {
|
|
1750
|
+
return O.encodedLength(E);
|
|
1751
|
+
}, g.maxDecodedLength = function(E) {
|
|
1752
|
+
return O.maxDecodedLength(E);
|
|
1753
|
+
}, g.decodedLength = function(E) {
|
|
1754
|
+
return O.decodedLength(E);
|
|
1666
1755
|
};
|
|
1667
1756
|
},
|
|
1668
1757
|
/***/
|
|
1669
1758
|
978(m, g) {
|
|
1670
1759
|
var y = "utf8: invalid source encoding";
|
|
1671
|
-
function
|
|
1672
|
-
for (var
|
|
1673
|
-
var A =
|
|
1760
|
+
function x(S) {
|
|
1761
|
+
for (var O = [], T = 0; T < S.length; T++) {
|
|
1762
|
+
var A = S[T];
|
|
1674
1763
|
if (A & 128) {
|
|
1675
|
-
var
|
|
1764
|
+
var W = void 0;
|
|
1676
1765
|
if (A < 224) {
|
|
1677
|
-
if (T >=
|
|
1766
|
+
if (T >= S.length)
|
|
1678
1767
|
throw new Error(y);
|
|
1679
|
-
var N =
|
|
1768
|
+
var N = S[++T];
|
|
1680
1769
|
if ((N & 192) !== 128)
|
|
1681
1770
|
throw new Error(y);
|
|
1682
|
-
A = (A & 31) << 6 | N & 63,
|
|
1771
|
+
A = (A & 31) << 6 | N & 63, W = 128;
|
|
1683
1772
|
} else if (A < 240) {
|
|
1684
|
-
if (T >=
|
|
1773
|
+
if (T >= S.length - 1)
|
|
1685
1774
|
throw new Error(y);
|
|
1686
|
-
var N =
|
|
1687
|
-
if ((N & 192) !== 128 || (
|
|
1775
|
+
var N = S[++T], F = S[++T];
|
|
1776
|
+
if ((N & 192) !== 128 || (F & 192) !== 128)
|
|
1688
1777
|
throw new Error(y);
|
|
1689
|
-
A = (A & 15) << 12 | (N & 63) << 6 |
|
|
1778
|
+
A = (A & 15) << 12 | (N & 63) << 6 | F & 63, W = 2048;
|
|
1690
1779
|
} else if (A < 248) {
|
|
1691
|
-
if (T >=
|
|
1780
|
+
if (T >= S.length - 2)
|
|
1692
1781
|
throw new Error(y);
|
|
1693
|
-
var N =
|
|
1694
|
-
if ((N & 192) !== 128 || (
|
|
1782
|
+
var N = S[++T], F = S[++T], te = S[++T];
|
|
1783
|
+
if ((N & 192) !== 128 || (F & 192) !== 128 || (te & 192) !== 128)
|
|
1695
1784
|
throw new Error(y);
|
|
1696
|
-
A = (A & 15) << 18 | (N & 63) << 12 | (
|
|
1785
|
+
A = (A & 15) << 18 | (N & 63) << 12 | (F & 63) << 6 | te & 63, W = 65536;
|
|
1697
1786
|
} else
|
|
1698
1787
|
throw new Error(y);
|
|
1699
|
-
if (A <
|
|
1788
|
+
if (A < W || A >= 55296 && A <= 57343)
|
|
1700
1789
|
throw new Error(y);
|
|
1701
1790
|
if (A >= 65536) {
|
|
1702
1791
|
if (A > 1114111)
|
|
1703
1792
|
throw new Error(y);
|
|
1704
|
-
A -= 65536,
|
|
1793
|
+
A -= 65536, O.push(String.fromCharCode(55296 | A >> 10)), A = 56320 | A & 1023;
|
|
1705
1794
|
}
|
|
1706
1795
|
}
|
|
1707
|
-
|
|
1796
|
+
O.push(String.fromCharCode(A));
|
|
1708
1797
|
}
|
|
1709
|
-
return
|
|
1798
|
+
return O.join("");
|
|
1710
1799
|
}
|
|
1711
|
-
g.D4 =
|
|
1800
|
+
g.D4 = x;
|
|
1712
1801
|
},
|
|
1713
1802
|
/***/
|
|
1714
1803
|
721(m, g, y) {
|
|
@@ -1722,7 +1811,7 @@ function Gi() {
|
|
|
1722
1811
|
de
|
|
1723
1812
|
)
|
|
1724
1813
|
});
|
|
1725
|
-
class
|
|
1814
|
+
class x {
|
|
1726
1815
|
constructor(e, t) {
|
|
1727
1816
|
this.lastId = 0, this.prefix = e, this.name = t;
|
|
1728
1817
|
}
|
|
@@ -1737,7 +1826,7 @@ function Gi() {
|
|
|
1737
1826
|
delete this[e.number];
|
|
1738
1827
|
}
|
|
1739
1828
|
}
|
|
1740
|
-
var
|
|
1829
|
+
var S = new x("_pusher_script_", "Pusher.ScriptReceivers"), O = {
|
|
1741
1830
|
VERSION: "8.5.0",
|
|
1742
1831
|
PROTOCOL: 7,
|
|
1743
1832
|
wsPort: 80,
|
|
@@ -1765,10 +1854,10 @@ function Gi() {
|
|
|
1765
1854
|
cdn_https: "https://js.pusher.com",
|
|
1766
1855
|
dependency_suffix: ""
|
|
1767
1856
|
};
|
|
1768
|
-
const T =
|
|
1857
|
+
const T = O;
|
|
1769
1858
|
class A {
|
|
1770
1859
|
constructor(e) {
|
|
1771
|
-
this.options = e, this.receivers = e.receivers ||
|
|
1860
|
+
this.options = e, this.receivers = e.receivers || S, this.loading = {};
|
|
1772
1861
|
}
|
|
1773
1862
|
load(e, t, r) {
|
|
1774
1863
|
var o = this;
|
|
@@ -1776,12 +1865,12 @@ function Gi() {
|
|
|
1776
1865
|
o.loading[e].push(r);
|
|
1777
1866
|
else {
|
|
1778
1867
|
o.loading[e] = [r];
|
|
1779
|
-
var c =
|
|
1868
|
+
var c = w.createScriptRequest(o.getPath(e, t)), l = o.receivers.create(function(p) {
|
|
1780
1869
|
if (o.receivers.remove(l), o.loading[e]) {
|
|
1781
1870
|
var b = o.loading[e];
|
|
1782
1871
|
delete o.loading[e];
|
|
1783
|
-
for (var _ = function(
|
|
1784
|
-
|
|
1872
|
+
for (var _ = function(P) {
|
|
1873
|
+
P || c.cleanup();
|
|
1785
1874
|
}, k = 0; k < b.length; k++)
|
|
1786
1875
|
b[k](p, _);
|
|
1787
1876
|
}
|
|
@@ -1790,21 +1879,21 @@ function Gi() {
|
|
|
1790
1879
|
}
|
|
1791
1880
|
}
|
|
1792
1881
|
getRoot(e) {
|
|
1793
|
-
var t, r =
|
|
1882
|
+
var t, r = w.getDocument().location.protocol;
|
|
1794
1883
|
return e && e.useTLS || r === "https:" ? t = this.options.cdn_https : t = this.options.cdn_http, t.replace(/\/*$/, "") + "/" + this.options.version;
|
|
1795
1884
|
}
|
|
1796
1885
|
getPath(e, t) {
|
|
1797
1886
|
return this.getRoot(t) + "/" + e + this.options.suffix + ".js";
|
|
1798
1887
|
}
|
|
1799
1888
|
}
|
|
1800
|
-
var
|
|
1889
|
+
var W = new x("_pusher_dependencies", "Pusher.DependenciesReceivers"), N = new A({
|
|
1801
1890
|
cdn_http: T.cdn_http,
|
|
1802
1891
|
cdn_https: T.cdn_https,
|
|
1803
1892
|
version: T.VERSION,
|
|
1804
1893
|
suffix: T.dependency_suffix,
|
|
1805
|
-
receivers:
|
|
1894
|
+
receivers: W
|
|
1806
1895
|
});
|
|
1807
|
-
const
|
|
1896
|
+
const F = {
|
|
1808
1897
|
baseUrl: "https://pusher.com",
|
|
1809
1898
|
urls: {
|
|
1810
1899
|
authenticationEndpoint: {
|
|
@@ -1823,12 +1912,12 @@ function Gi() {
|
|
|
1823
1912
|
fullUrl: "https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"
|
|
1824
1913
|
}
|
|
1825
1914
|
}
|
|
1826
|
-
},
|
|
1827
|
-
const e = "See:", t =
|
|
1915
|
+
}, E = { buildLogSuffix: function(n) {
|
|
1916
|
+
const e = "See:", t = F.urls[n];
|
|
1828
1917
|
if (!t)
|
|
1829
1918
|
return "";
|
|
1830
1919
|
let r;
|
|
1831
|
-
return t.fullUrl ? r = t.fullUrl : t.path && (r =
|
|
1920
|
+
return t.fullUrl ? r = t.fullUrl : t.path && (r = F.baseUrl + t.path), r ? `${e} ${r}` : "";
|
|
1832
1921
|
} };
|
|
1833
1922
|
var u;
|
|
1834
1923
|
(function(n) {
|
|
@@ -1839,7 +1928,7 @@ function Gi() {
|
|
|
1839
1928
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1840
1929
|
}
|
|
1841
1930
|
}
|
|
1842
|
-
class
|
|
1931
|
+
class C extends Error {
|
|
1843
1932
|
constructor(e) {
|
|
1844
1933
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1845
1934
|
}
|
|
@@ -1880,7 +1969,7 @@ function Gi() {
|
|
|
1880
1969
|
}
|
|
1881
1970
|
}
|
|
1882
1971
|
const Lt = function(n, e, t, r, o) {
|
|
1883
|
-
const c =
|
|
1972
|
+
const c = w.createXHR();
|
|
1884
1973
|
c.open("POST", t.endpoint, !0), c.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
1885
1974
|
for (var l in t.headers)
|
|
1886
1975
|
c.setRequestHeader(l, t.headers[l]);
|
|
@@ -1903,24 +1992,24 @@ function Gi() {
|
|
|
1903
1992
|
let p = "";
|
|
1904
1993
|
switch (r) {
|
|
1905
1994
|
case u.UserAuthentication:
|
|
1906
|
-
p =
|
|
1995
|
+
p = E.buildLogSuffix("authenticationEndpoint");
|
|
1907
1996
|
break;
|
|
1908
1997
|
case u.ChannelAuthorization:
|
|
1909
|
-
p = `Clients must be authorized to join private or presence channels. ${
|
|
1998
|
+
p = `Clients must be authorized to join private or presence channels. ${E.buildLogSuffix("authorizationEndpoint")}`;
|
|
1910
1999
|
break;
|
|
1911
2000
|
}
|
|
1912
2001
|
o(new H(c.status, `Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${c.status} from ${t.endpoint}. ${p}`), null);
|
|
1913
2002
|
}
|
|
1914
2003
|
}, c.send(e), c;
|
|
1915
2004
|
};
|
|
1916
|
-
function
|
|
2005
|
+
function Rt(n) {
|
|
1917
2006
|
return qt(It(n));
|
|
1918
2007
|
}
|
|
1919
|
-
var ne = String.fromCharCode, oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
2008
|
+
var ne = String.fromCharCode, oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Pt = function(n) {
|
|
1920
2009
|
var e = n.charCodeAt(0);
|
|
1921
2010
|
return e < 128 ? n : e < 2048 ? ne(192 | e >>> 6) + ne(128 | e & 63) : ne(224 | e >>> 12 & 15) + ne(128 | e >>> 6 & 63) + ne(128 | e & 63);
|
|
1922
2011
|
}, It = function(n) {
|
|
1923
|
-
return n.replace(/[^\x00-\x7F]/g,
|
|
2012
|
+
return n.replace(/[^\x00-\x7F]/g, Pt);
|
|
1924
2013
|
}, Ot = function(n) {
|
|
1925
2014
|
var e = [0, 2, 1][n.length % 3], t = n.charCodeAt(0) << 16 | (n.length > 1 ? n.charCodeAt(1) : 0) << 8 | (n.length > 2 ? n.charCodeAt(2) : 0), r = [
|
|
1926
2015
|
oe.charAt(t >>> 18),
|
|
@@ -2005,19 +2094,19 @@ function Gi() {
|
|
|
2005
2094
|
return r;
|
|
2006
2095
|
return -1;
|
|
2007
2096
|
}
|
|
2008
|
-
function
|
|
2097
|
+
function $(n, e) {
|
|
2009
2098
|
for (var t in n)
|
|
2010
2099
|
Object.prototype.hasOwnProperty.call(n, t) && e(n[t], t, n);
|
|
2011
2100
|
}
|
|
2012
2101
|
function De(n) {
|
|
2013
2102
|
var e = [];
|
|
2014
|
-
return
|
|
2103
|
+
return $(n, function(t, r) {
|
|
2015
2104
|
e.push(r);
|
|
2016
2105
|
}), e;
|
|
2017
2106
|
}
|
|
2018
2107
|
function Dt(n) {
|
|
2019
2108
|
var e = [];
|
|
2020
|
-
return
|
|
2109
|
+
return $(n, function(t) {
|
|
2021
2110
|
e.push(t);
|
|
2022
2111
|
}), e;
|
|
2023
2112
|
}
|
|
@@ -2025,18 +2114,18 @@ function Gi() {
|
|
|
2025
2114
|
for (var r = 0; r < n.length; r++)
|
|
2026
2115
|
e.call(t || window, n[r], r, n);
|
|
2027
2116
|
}
|
|
2028
|
-
function
|
|
2117
|
+
function We(n, e) {
|
|
2029
2118
|
for (var t = [], r = 0; r < n.length; r++)
|
|
2030
2119
|
t.push(e(n[r], r, n, t));
|
|
2031
2120
|
return t;
|
|
2032
2121
|
}
|
|
2033
|
-
function
|
|
2122
|
+
function Wt(n, e) {
|
|
2034
2123
|
var t = {};
|
|
2035
|
-
return
|
|
2124
|
+
return $(n, function(r, o) {
|
|
2036
2125
|
t[o] = e(r);
|
|
2037
2126
|
}), t;
|
|
2038
2127
|
}
|
|
2039
|
-
function
|
|
2128
|
+
function Fe(n, e) {
|
|
2040
2129
|
e = e || function(o) {
|
|
2041
2130
|
return !!o;
|
|
2042
2131
|
};
|
|
@@ -2046,13 +2135,13 @@ function Gi() {
|
|
|
2046
2135
|
}
|
|
2047
2136
|
function Be(n, e) {
|
|
2048
2137
|
var t = {};
|
|
2049
|
-
return
|
|
2138
|
+
return $(n, function(r, o) {
|
|
2050
2139
|
(e && e(r, o, n, t) || r) && (t[o] = r);
|
|
2051
2140
|
}), t;
|
|
2052
2141
|
}
|
|
2053
|
-
function
|
|
2142
|
+
function Ft(n) {
|
|
2054
2143
|
var e = [];
|
|
2055
|
-
return
|
|
2144
|
+
return $(n, function(t, r) {
|
|
2056
2145
|
e.push([r, t]);
|
|
2057
2146
|
}), e;
|
|
2058
2147
|
}
|
|
@@ -2069,17 +2158,17 @@ function Gi() {
|
|
|
2069
2158
|
return !0;
|
|
2070
2159
|
}
|
|
2071
2160
|
function $t(n) {
|
|
2072
|
-
return
|
|
2073
|
-
return typeof e == "object" && (e = ae(e)), encodeURIComponent(
|
|
2161
|
+
return Wt(n, function(e) {
|
|
2162
|
+
return typeof e == "object" && (e = ae(e)), encodeURIComponent(Rt(e.toString()));
|
|
2074
2163
|
});
|
|
2075
2164
|
}
|
|
2076
|
-
function
|
|
2165
|
+
function Vt(n) {
|
|
2077
2166
|
var e = Be(n, function(r) {
|
|
2078
2167
|
return r !== void 0;
|
|
2079
|
-
}), t =
|
|
2168
|
+
}), t = We(Ft($t(e)), U.method("join", "=")).join("&");
|
|
2080
2169
|
return t;
|
|
2081
2170
|
}
|
|
2082
|
-
function
|
|
2171
|
+
function Xt(n) {
|
|
2083
2172
|
var e = [], t = [];
|
|
2084
2173
|
return (function r(o, c) {
|
|
2085
2174
|
var l, p, b;
|
|
@@ -2110,7 +2199,7 @@ function Gi() {
|
|
|
2110
2199
|
try {
|
|
2111
2200
|
return JSON.stringify(n);
|
|
2112
2201
|
} catch {
|
|
2113
|
-
return JSON.stringify(
|
|
2202
|
+
return JSON.stringify(Xt(n));
|
|
2114
2203
|
}
|
|
2115
2204
|
}
|
|
2116
2205
|
class Jt {
|
|
@@ -2139,9 +2228,9 @@ function Gi() {
|
|
|
2139
2228
|
de.log ? de.log(r) : de.logToConsole && e.bind(this)(r);
|
|
2140
2229
|
}
|
|
2141
2230
|
}
|
|
2142
|
-
const
|
|
2231
|
+
const R = new Jt();
|
|
2143
2232
|
var Gt = function(n, e, t, r, o) {
|
|
2144
|
-
(t.headers !== void 0 || t.headersProvider != null) &&
|
|
2233
|
+
(t.headers !== void 0 || t.headersProvider != null) && R.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
2145
2234
|
var c = n.nextAuthCallbackID.toString();
|
|
2146
2235
|
n.nextAuthCallbackID++;
|
|
2147
2236
|
var l = n.getDocument(), p = l.createElement("script");
|
|
@@ -2180,8 +2269,8 @@ function Gi() {
|
|
|
2180
2269
|
}
|
|
2181
2270
|
send(e) {
|
|
2182
2271
|
if (!this.request) {
|
|
2183
|
-
var t =
|
|
2184
|
-
this.request =
|
|
2272
|
+
var t = Vt(this.data), r = this.url + "/" + e.number + "?" + t;
|
|
2273
|
+
this.request = w.createScriptRequest(r), this.request.send(e);
|
|
2185
2274
|
}
|
|
2186
2275
|
}
|
|
2187
2276
|
cleanup() {
|
|
@@ -2190,8 +2279,8 @@ function Gi() {
|
|
|
2190
2279
|
}
|
|
2191
2280
|
var Zt = function(n, e) {
|
|
2192
2281
|
return function(t, r) {
|
|
2193
|
-
var o = "http" + (e ? "s" : "") + "://", c = o + (n.host || n.options.host) + n.options.path, l =
|
|
2194
|
-
|
|
2282
|
+
var o = "http" + (e ? "s" : "") + "://", c = o + (n.host || n.options.host) + n.options.path, l = w.createJSONPRequest(c, t), p = w.ScriptReceivers.create(function(b, _) {
|
|
2283
|
+
S.remove(p), l.cleanup(), _ && _.host && (n.host = _.host), r && r(b, _);
|
|
2195
2284
|
});
|
|
2196
2285
|
l.send(p);
|
|
2197
2286
|
};
|
|
@@ -2250,7 +2339,7 @@ function Gi() {
|
|
|
2250
2339
|
}
|
|
2251
2340
|
removeCallback(e, t, r) {
|
|
2252
2341
|
ie(e, function(o) {
|
|
2253
|
-
this._callbacks[o] =
|
|
2342
|
+
this._callbacks[o] = Fe(this._callbacks[o] || [], function(c) {
|
|
2254
2343
|
return t && t !== c.fn || r && r !== c.context;
|
|
2255
2344
|
}), this._callbacks[o].length === 0 && delete this._callbacks[o];
|
|
2256
2345
|
}, this);
|
|
@@ -2264,7 +2353,7 @@ function Gi() {
|
|
|
2264
2353
|
function we(n) {
|
|
2265
2354
|
return "_" + n;
|
|
2266
2355
|
}
|
|
2267
|
-
class
|
|
2356
|
+
class V {
|
|
2268
2357
|
constructor(e) {
|
|
2269
2358
|
this.callbacks = new on(), this.global_callbacks = [], this.failThrough = e;
|
|
2270
2359
|
}
|
|
@@ -2278,7 +2367,7 @@ function Gi() {
|
|
|
2278
2367
|
return this.callbacks.remove(e, t, r), this;
|
|
2279
2368
|
}
|
|
2280
2369
|
unbind_global(e) {
|
|
2281
|
-
return e ? (this.global_callbacks =
|
|
2370
|
+
return e ? (this.global_callbacks = Fe(this.global_callbacks || [], (t) => t !== e), this) : (this.global_callbacks = [], this);
|
|
2282
2371
|
}
|
|
2283
2372
|
unbind_all() {
|
|
2284
2373
|
return this.unbind(), this.unbind_global(), this;
|
|
@@ -2294,9 +2383,9 @@ function Gi() {
|
|
|
2294
2383
|
return this;
|
|
2295
2384
|
}
|
|
2296
2385
|
}
|
|
2297
|
-
class an extends
|
|
2386
|
+
class an extends V {
|
|
2298
2387
|
constructor(e, t, r, o, c) {
|
|
2299
|
-
super(), this.initialize =
|
|
2388
|
+
super(), this.initialize = w.transportConnectionInitializer, this.hooks = e, this.name = t, this.priority = r, this.key = o, this.options = c, this.state = "new", this.timeline = c.timeline, this.activityTimeout = c.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
2300
2389
|
}
|
|
2301
2390
|
handlesActivityChecks() {
|
|
2302
2391
|
return !!this.hooks.handlesActivityChecks;
|
|
@@ -2315,7 +2404,7 @@ function Gi() {
|
|
|
2315
2404
|
this.onError(t), this.changeState("closed");
|
|
2316
2405
|
}), !1;
|
|
2317
2406
|
}
|
|
2318
|
-
return this.bindListeners(),
|
|
2407
|
+
return this.bindListeners(), R.debug("Connecting", { transport: this.name, url: e }), this.changeState("connecting"), !0;
|
|
2319
2408
|
}
|
|
2320
2409
|
close() {
|
|
2321
2410
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
@@ -2389,34 +2478,34 @@ function Gi() {
|
|
|
2389
2478
|
handlesActivityChecks: !1,
|
|
2390
2479
|
supportsPing: !1,
|
|
2391
2480
|
isInitialized: function() {
|
|
2392
|
-
return !!
|
|
2481
|
+
return !!w.getWebSocketAPI();
|
|
2393
2482
|
},
|
|
2394
2483
|
isSupported: function() {
|
|
2395
|
-
return !!
|
|
2484
|
+
return !!w.getWebSocketAPI();
|
|
2396
2485
|
},
|
|
2397
2486
|
getSocket: function(n) {
|
|
2398
|
-
return
|
|
2487
|
+
return w.createWebSocket(n);
|
|
2399
2488
|
}
|
|
2400
|
-
}),
|
|
2489
|
+
}), Ve = {
|
|
2401
2490
|
urls: rn,
|
|
2402
2491
|
handlesActivityChecks: !1,
|
|
2403
2492
|
supportsPing: !0,
|
|
2404
2493
|
isInitialized: function() {
|
|
2405
2494
|
return !0;
|
|
2406
2495
|
}
|
|
2407
|
-
},
|
|
2496
|
+
}, Xe = j({
|
|
2408
2497
|
getSocket: function(n) {
|
|
2409
|
-
return
|
|
2498
|
+
return w.HTTPFactory.createStreamingSocket(n);
|
|
2410
2499
|
}
|
|
2411
|
-
},
|
|
2500
|
+
}, Ve), Je = j({
|
|
2412
2501
|
getSocket: function(n) {
|
|
2413
|
-
return
|
|
2502
|
+
return w.HTTPFactory.createPollingSocket(n);
|
|
2414
2503
|
}
|
|
2415
|
-
},
|
|
2504
|
+
}, Ve), Ge = {
|
|
2416
2505
|
isSupported: function() {
|
|
2417
|
-
return
|
|
2506
|
+
return w.isXHRSupported();
|
|
2418
2507
|
}
|
|
2419
|
-
}, hn = new ee(j({},
|
|
2508
|
+
}, hn = new ee(j({}, Xe, Ge)), ln = new ee(j({}, Je, Ge)), dn = {
|
|
2420
2509
|
ws: cn,
|
|
2421
2510
|
xhr_streaming: hn,
|
|
2422
2511
|
xhr_polling: ln
|
|
@@ -2448,13 +2537,13 @@ function Gi() {
|
|
|
2448
2537
|
}
|
|
2449
2538
|
}), Ye = {
|
|
2450
2539
|
isSupported: function(n) {
|
|
2451
|
-
var e =
|
|
2540
|
+
var e = w.isXDRSupported(n.useTLS);
|
|
2452
2541
|
return e;
|
|
2453
2542
|
}
|
|
2454
|
-
}, fn = new ee(j({},
|
|
2543
|
+
}, fn = new ee(j({}, Xe, Ye)), pn = new ee(j({}, Je, Ye));
|
|
2455
2544
|
ce.xdr_streaming = fn, ce.xdr_polling = pn, ce.sockjs = un;
|
|
2456
2545
|
const mn = ce;
|
|
2457
|
-
class gn extends
|
|
2546
|
+
class gn extends V {
|
|
2458
2547
|
constructor() {
|
|
2459
2548
|
super();
|
|
2460
2549
|
var e = this;
|
|
@@ -2547,7 +2636,7 @@ function Gi() {
|
|
|
2547
2636
|
} : null;
|
|
2548
2637
|
}
|
|
2549
2638
|
}, K = Ke;
|
|
2550
|
-
class bn extends
|
|
2639
|
+
class bn extends V {
|
|
2551
2640
|
constructor(e, t) {
|
|
2552
2641
|
super(), this.id = e, this.transport = t, this.activityTimeout = t.activityTimeout, this.bindListeners();
|
|
2553
2642
|
}
|
|
@@ -2559,7 +2648,7 @@ function Gi() {
|
|
|
2559
2648
|
}
|
|
2560
2649
|
send_event(e, t, r) {
|
|
2561
2650
|
var o = { event: e, data: t };
|
|
2562
|
-
return r && (o.channel = r),
|
|
2651
|
+
return r && (o.channel = r), R.debug("Event sent", o), this.send(K.encodeMessage(o));
|
|
2563
2652
|
}
|
|
2564
2653
|
ping() {
|
|
2565
2654
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -2581,7 +2670,7 @@ function Gi() {
|
|
|
2581
2670
|
});
|
|
2582
2671
|
}
|
|
2583
2672
|
if (o !== void 0) {
|
|
2584
|
-
switch (
|
|
2673
|
+
switch (R.debug("Event recd", o), o.event) {
|
|
2585
2674
|
case "pusher:error":
|
|
2586
2675
|
this.emit("error", {
|
|
2587
2676
|
type: "PusherError",
|
|
@@ -2608,11 +2697,11 @@ function Gi() {
|
|
|
2608
2697
|
t(), r && r.code && this.handleCloseEvent(r), this.transport = null, this.emit("closed");
|
|
2609
2698
|
}
|
|
2610
2699
|
}, t = () => {
|
|
2611
|
-
|
|
2700
|
+
$(e, (r, o) => {
|
|
2612
2701
|
this.transport.unbind(o, r);
|
|
2613
2702
|
});
|
|
2614
2703
|
};
|
|
2615
|
-
|
|
2704
|
+
$(e, (r, o) => {
|
|
2616
2705
|
this.transport.bind(o, r);
|
|
2617
2706
|
});
|
|
2618
2707
|
}
|
|
@@ -2660,13 +2749,13 @@ function Gi() {
|
|
|
2660
2749
|
this.timeline = e, this.options = t || {};
|
|
2661
2750
|
}
|
|
2662
2751
|
send(e, t) {
|
|
2663
|
-
this.timeline.isEmpty() || this.timeline.send(
|
|
2752
|
+
this.timeline.isEmpty() || this.timeline.send(w.TimelineTransport.getAgent(this, e), t);
|
|
2664
2753
|
}
|
|
2665
2754
|
}
|
|
2666
|
-
class Ce extends
|
|
2755
|
+
class Ce extends V {
|
|
2667
2756
|
constructor(e, t) {
|
|
2668
2757
|
super(function(r, o) {
|
|
2669
|
-
|
|
2758
|
+
R.debug("No callbacks on " + e + " for " + r);
|
|
2670
2759
|
}), this.name = e, this.pusher = t, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
2671
2760
|
}
|
|
2672
2761
|
authorize(e, t) {
|
|
@@ -2676,8 +2765,8 @@ function Gi() {
|
|
|
2676
2765
|
if (e.indexOf("client-") !== 0)
|
|
2677
2766
|
throw new f("Event '" + e + "' does not start with 'client-'");
|
|
2678
2767
|
if (!this.subscribed) {
|
|
2679
|
-
var r =
|
|
2680
|
-
|
|
2768
|
+
var r = E.buildLogSuffix("triggeringClientEvents");
|
|
2769
|
+
R.warn(`Client event triggered before channel 'subscription_succeeded' event . ${r}`);
|
|
2681
2770
|
}
|
|
2682
2771
|
return this.pusher.send_event(e, t, this.name);
|
|
2683
2772
|
}
|
|
@@ -2703,7 +2792,7 @@ function Gi() {
|
|
|
2703
2792
|
}
|
|
2704
2793
|
subscribe() {
|
|
2705
2794
|
this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (e, t) => {
|
|
2706
|
-
e ? (this.subscriptionPending = !1,
|
|
2795
|
+
e ? (this.subscriptionPending = !1, R.error(e.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
|
|
2707
2796
|
type: "AuthError",
|
|
2708
2797
|
error: e.message
|
|
2709
2798
|
}, e instanceof H ? { status: e.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
|
|
@@ -2744,7 +2833,7 @@ function Gi() {
|
|
|
2744
2833
|
} : null;
|
|
2745
2834
|
}
|
|
2746
2835
|
each(e) {
|
|
2747
|
-
|
|
2836
|
+
$(this.members, (t, r) => {
|
|
2748
2837
|
e(this.get(r));
|
|
2749
2838
|
});
|
|
2750
2839
|
}
|
|
@@ -2775,15 +2864,15 @@ function Gi() {
|
|
|
2775
2864
|
function p(k) {
|
|
2776
2865
|
try {
|
|
2777
2866
|
_(r.next(k));
|
|
2778
|
-
} catch (
|
|
2779
|
-
l(
|
|
2867
|
+
} catch (P) {
|
|
2868
|
+
l(P);
|
|
2780
2869
|
}
|
|
2781
2870
|
}
|
|
2782
2871
|
function b(k) {
|
|
2783
2872
|
try {
|
|
2784
2873
|
_(r.throw(k));
|
|
2785
|
-
} catch (
|
|
2786
|
-
l(
|
|
2874
|
+
} catch (P) {
|
|
2875
|
+
l(P);
|
|
2787
2876
|
}
|
|
2788
2877
|
}
|
|
2789
2878
|
function _(k) {
|
|
@@ -2792,7 +2881,7 @@ function Gi() {
|
|
|
2792
2881
|
_((r = r.apply(n, e || [])).next());
|
|
2793
2882
|
});
|
|
2794
2883
|
};
|
|
2795
|
-
class
|
|
2884
|
+
class En extends Se {
|
|
2796
2885
|
constructor(e, t) {
|
|
2797
2886
|
super(e, t), this.members = new Sn();
|
|
2798
2887
|
}
|
|
@@ -2805,8 +2894,8 @@ function Gi() {
|
|
|
2805
2894
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
2806
2895
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
2807
2896
|
else {
|
|
2808
|
-
let l =
|
|
2809
|
-
|
|
2897
|
+
let l = E.buildLogSuffix("authorizationEndpoint");
|
|
2898
|
+
R.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${l}, or the user should be signed in.`), t("Invalid auth response");
|
|
2810
2899
|
return;
|
|
2811
2900
|
}
|
|
2812
2901
|
t(r, o);
|
|
@@ -2847,7 +2936,7 @@ function Gi() {
|
|
|
2847
2936
|
this.members.reset(), super.disconnect();
|
|
2848
2937
|
}
|
|
2849
2938
|
}
|
|
2850
|
-
var
|
|
2939
|
+
var xn = y(978), Te = y(594);
|
|
2851
2940
|
class _n extends Se {
|
|
2852
2941
|
constructor(e, t, r) {
|
|
2853
2942
|
super(e, t), this.key = null, this.nacl = r;
|
|
@@ -2879,32 +2968,32 @@ function Gi() {
|
|
|
2879
2968
|
}
|
|
2880
2969
|
handleEncryptedEvent(e, t) {
|
|
2881
2970
|
if (!this.key) {
|
|
2882
|
-
|
|
2971
|
+
R.debug("Received encrypted event before key has been retrieved from the authEndpoint");
|
|
2883
2972
|
return;
|
|
2884
2973
|
}
|
|
2885
2974
|
if (!t.ciphertext || !t.nonce) {
|
|
2886
|
-
|
|
2975
|
+
R.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + t);
|
|
2887
2976
|
return;
|
|
2888
2977
|
}
|
|
2889
2978
|
let r = (0, Te.decode)(t.ciphertext);
|
|
2890
2979
|
if (r.length < this.nacl.secretbox.overheadLength) {
|
|
2891
|
-
|
|
2980
|
+
R.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${r.length}`);
|
|
2892
2981
|
return;
|
|
2893
2982
|
}
|
|
2894
2983
|
let o = (0, Te.decode)(t.nonce);
|
|
2895
2984
|
if (o.length < this.nacl.secretbox.nonceLength) {
|
|
2896
|
-
|
|
2985
|
+
R.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${o.length}`);
|
|
2897
2986
|
return;
|
|
2898
2987
|
}
|
|
2899
2988
|
let c = this.nacl.secretbox.open(r, o, this.key);
|
|
2900
2989
|
if (c === null) {
|
|
2901
|
-
|
|
2990
|
+
R.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (l, p) => {
|
|
2902
2991
|
if (l) {
|
|
2903
|
-
|
|
2992
|
+
R.error(`Failed to make a request to the authEndpoint: ${p}. Unable to fetch new key, so dropping encrypted event`);
|
|
2904
2993
|
return;
|
|
2905
2994
|
}
|
|
2906
2995
|
if (c = this.nacl.secretbox.open(r, o, this.key), c === null) {
|
|
2907
|
-
|
|
2996
|
+
R.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
2908
2997
|
return;
|
|
2909
2998
|
}
|
|
2910
2999
|
this.emit(e, this.getDataToEmit(c));
|
|
@@ -2914,7 +3003,7 @@ function Gi() {
|
|
|
2914
3003
|
this.emit(e, this.getDataToEmit(c));
|
|
2915
3004
|
}
|
|
2916
3005
|
getDataToEmit(e) {
|
|
2917
|
-
let t = (0,
|
|
3006
|
+
let t = (0, xn.D4)(e);
|
|
2918
3007
|
try {
|
|
2919
3008
|
return JSON.parse(t);
|
|
2920
3009
|
} catch {
|
|
@@ -2922,10 +3011,10 @@ function Gi() {
|
|
|
2922
3011
|
}
|
|
2923
3012
|
}
|
|
2924
3013
|
}
|
|
2925
|
-
class kn extends
|
|
3014
|
+
class kn extends V {
|
|
2926
3015
|
constructor(e, t) {
|
|
2927
3016
|
super(), this.state = "initialized", this.connection = null, this.key = e, this.options = t, this.timeline = this.options.timeline, this.usingTLS = this.options.useTLS, this.errorCallbacks = this.buildErrorCallbacks(), this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks), this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
|
|
2928
|
-
var r =
|
|
3017
|
+
var r = w.getNetwork();
|
|
2929
3018
|
r.bind("online", () => {
|
|
2930
3019
|
this.timeline.info({ netinfo: "online" }), (this.state === "connecting" || this.state === "unavailable") && this.retryIn(0);
|
|
2931
3020
|
}), r.bind("offline", () => {
|
|
@@ -3074,7 +3163,7 @@ function Gi() {
|
|
|
3074
3163
|
var r = this.state;
|
|
3075
3164
|
if (this.state = e, r !== e) {
|
|
3076
3165
|
var o = e;
|
|
3077
|
-
o === "connected" && (o += " with new socket ID " + t.socket_id),
|
|
3166
|
+
o === "connected" && (o += " with new socket ID " + t.socket_id), R.debug("State changed", r + " -> " + o), this.timeline.info({ state: e, params: t }), this.emit("state_change", { previous: r, current: e }), this.emit(e, t);
|
|
3078
3167
|
}
|
|
3079
3168
|
}
|
|
3080
3169
|
shouldRetry() {
|
|
@@ -3099,7 +3188,7 @@ function Gi() {
|
|
|
3099
3188
|
return delete this.channels[e], t;
|
|
3100
3189
|
}
|
|
3101
3190
|
disconnect() {
|
|
3102
|
-
|
|
3191
|
+
$(this.channels, function(e) {
|
|
3103
3192
|
e.disconnect();
|
|
3104
3193
|
});
|
|
3105
3194
|
}
|
|
@@ -3108,7 +3197,7 @@ function Gi() {
|
|
|
3108
3197
|
if (n.indexOf("private-encrypted-") === 0) {
|
|
3109
3198
|
if (e.config.nacl)
|
|
3110
3199
|
return X.createEncryptedChannel(n, e, e.config.nacl);
|
|
3111
|
-
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r =
|
|
3200
|
+
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r = E.buildLogSuffix("encryptedChannelSupport");
|
|
3112
3201
|
throw new z(`${t}. ${r}`);
|
|
3113
3202
|
} else {
|
|
3114
3203
|
if (n.indexOf("private-") === 0)
|
|
@@ -3116,11 +3205,11 @@ function Gi() {
|
|
|
3116
3205
|
if (n.indexOf("presence-") === 0)
|
|
3117
3206
|
return X.createPresenceChannel(n, e);
|
|
3118
3207
|
if (n.indexOf("#") === 0)
|
|
3119
|
-
throw new
|
|
3208
|
+
throw new C('Cannot create a channel with name "' + n + '".');
|
|
3120
3209
|
return X.createChannel(n, e);
|
|
3121
3210
|
}
|
|
3122
3211
|
}
|
|
3123
|
-
var
|
|
3212
|
+
var Rn = {
|
|
3124
3213
|
createChannels() {
|
|
3125
3214
|
return new An();
|
|
3126
3215
|
},
|
|
@@ -3134,7 +3223,7 @@ function Gi() {
|
|
|
3134
3223
|
return new Se(n, e);
|
|
3135
3224
|
},
|
|
3136
3225
|
createPresenceChannel(n, e) {
|
|
3137
|
-
return new
|
|
3226
|
+
return new En(n, e);
|
|
3138
3227
|
},
|
|
3139
3228
|
createEncryptedChannel(n, e, t) {
|
|
3140
3229
|
return new _n(n, e, t);
|
|
@@ -3149,7 +3238,7 @@ function Gi() {
|
|
|
3149
3238
|
return new yn(n, e, t);
|
|
3150
3239
|
}
|
|
3151
3240
|
};
|
|
3152
|
-
const X =
|
|
3241
|
+
const X = Rn;
|
|
3153
3242
|
class Qe {
|
|
3154
3243
|
constructor(e) {
|
|
3155
3244
|
this.options = e || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
@@ -3203,7 +3292,7 @@ function Gi() {
|
|
|
3203
3292
|
};
|
|
3204
3293
|
}
|
|
3205
3294
|
}
|
|
3206
|
-
class
|
|
3295
|
+
class Ee {
|
|
3207
3296
|
constructor(e) {
|
|
3208
3297
|
this.strategies = e;
|
|
3209
3298
|
}
|
|
@@ -3211,7 +3300,7 @@ function Gi() {
|
|
|
3211
3300
|
return $e(this.strategies, U.method("isSupported"));
|
|
3212
3301
|
}
|
|
3213
3302
|
connect(e, t) {
|
|
3214
|
-
return
|
|
3303
|
+
return Pn(this.strategies, e, function(r, o) {
|
|
3215
3304
|
return function(c, l) {
|
|
3216
3305
|
if (o[r].error = c, c) {
|
|
3217
3306
|
In(o) && t(!0);
|
|
@@ -3224,8 +3313,8 @@ function Gi() {
|
|
|
3224
3313
|
});
|
|
3225
3314
|
}
|
|
3226
3315
|
}
|
|
3227
|
-
function
|
|
3228
|
-
var r =
|
|
3316
|
+
function Pn(n, e, t) {
|
|
3317
|
+
var r = We(n, function(o, c, l, p) {
|
|
3229
3318
|
return o.connect(e, t(c, p));
|
|
3230
3319
|
});
|
|
3231
3320
|
return {
|
|
@@ -3267,8 +3356,8 @@ function Gi() {
|
|
|
3267
3356
|
failFast: !0
|
|
3268
3357
|
}))) : c++);
|
|
3269
3358
|
}
|
|
3270
|
-
var b = U.now(), _ = l.pop().connect(e, function k(
|
|
3271
|
-
|
|
3359
|
+
var b = U.now(), _ = l.pop().connect(e, function k(P, ue) {
|
|
3360
|
+
P ? (Ze(r), l.length > 0 ? (b = U.now(), _ = l.pop().connect(e, k)) : t(P)) : (Nn(r, ue.transport.name, U.now() - b, c), t(null, ue));
|
|
3272
3361
|
});
|
|
3273
3362
|
return {
|
|
3274
3363
|
abort: function() {
|
|
@@ -3280,14 +3369,14 @@ function Gi() {
|
|
|
3280
3369
|
};
|
|
3281
3370
|
}
|
|
3282
3371
|
}
|
|
3283
|
-
function
|
|
3372
|
+
function xe(n) {
|
|
3284
3373
|
return "pusherTransport" + (n ? "TLS" : "NonTLS");
|
|
3285
3374
|
}
|
|
3286
3375
|
function Un(n) {
|
|
3287
|
-
var e =
|
|
3376
|
+
var e = w.getLocalStorage();
|
|
3288
3377
|
if (e)
|
|
3289
3378
|
try {
|
|
3290
|
-
var t = e[
|
|
3379
|
+
var t = e[xe(n)];
|
|
3291
3380
|
if (t)
|
|
3292
3381
|
return JSON.parse(t);
|
|
3293
3382
|
} catch {
|
|
@@ -3296,10 +3385,10 @@ function Gi() {
|
|
|
3296
3385
|
return null;
|
|
3297
3386
|
}
|
|
3298
3387
|
function Nn(n, e, t, r) {
|
|
3299
|
-
var o =
|
|
3388
|
+
var o = w.getLocalStorage();
|
|
3300
3389
|
if (o)
|
|
3301
3390
|
try {
|
|
3302
|
-
o[
|
|
3391
|
+
o[xe(n)] = ae({
|
|
3303
3392
|
timestamp: U.now(),
|
|
3304
3393
|
transport: e,
|
|
3305
3394
|
latency: t,
|
|
@@ -3309,10 +3398,10 @@ function Gi() {
|
|
|
3309
3398
|
}
|
|
3310
3399
|
}
|
|
3311
3400
|
function Ze(n) {
|
|
3312
|
-
var e =
|
|
3401
|
+
var e = w.getLocalStorage();
|
|
3313
3402
|
if (e)
|
|
3314
3403
|
try {
|
|
3315
|
-
delete e[
|
|
3404
|
+
delete e[xe(n)];
|
|
3316
3405
|
} catch {
|
|
3317
3406
|
}
|
|
3318
3407
|
}
|
|
@@ -3396,24 +3485,24 @@ function Gi() {
|
|
|
3396
3485
|
lives: 2,
|
|
3397
3486
|
minPingDelay: 1e4,
|
|
3398
3487
|
maxPingDelay: n.activityTimeout
|
|
3399
|
-
}),
|
|
3400
|
-
new re(se(ot), ot,
|
|
3488
|
+
}), P = o("ws", "ws", 3, c, _), ue = o("wss", "ws", 3, l, _), Ri = o("sockjs", "sockjs", 1, p), ot = o("xhr_streaming", "xhr_streaming", 1, p, k), Pi = o("xdr_streaming", "xdr_streaming", 1, p, k), at = o("xhr_polling", "xhr_polling", 1, p), Ii = o("xdr_polling", "xdr_polling", 1, p), ct = new Q([P], b), Oi = new Q([ue], b), qi = new Q([Ri], b), ht = new Q([
|
|
3489
|
+
new re(se(ot), ot, Pi)
|
|
3401
3490
|
], b), lt = new Q([
|
|
3402
3491
|
new re(se(at), at, Ii)
|
|
3403
3492
|
], b), dt = new Q([
|
|
3404
|
-
new re(se(ht), new
|
|
3493
|
+
new re(se(ht), new Ee([
|
|
3405
3494
|
ht,
|
|
3406
3495
|
new he(lt, { delay: 4e3 })
|
|
3407
3496
|
]), lt)
|
|
3408
3497
|
], b), Ae = new re(se(dt), dt, qi), Le;
|
|
3409
|
-
return e.useTLS ? Le = new
|
|
3498
|
+
return e.useTLS ? Le = new Ee([
|
|
3410
3499
|
ct,
|
|
3411
3500
|
new he(Ae, { delay: 2e3 })
|
|
3412
|
-
]) : Le = new
|
|
3501
|
+
]) : Le = new Ee([
|
|
3413
3502
|
ct,
|
|
3414
3503
|
new he(Oi, { delay: 2e3 }),
|
|
3415
3504
|
new he(Ae, { delay: 5e3 })
|
|
3416
|
-
]), new qn(new Mn(new re(se(
|
|
3505
|
+
]), new qn(new Mn(new re(se(P), Le, Ae)), r, {
|
|
3417
3506
|
ttl: 18e5,
|
|
3418
3507
|
timeline: e.timeline,
|
|
3419
3508
|
useTLS: e.useTLS
|
|
@@ -3445,18 +3534,18 @@ function Gi() {
|
|
|
3445
3534
|
n.ontimeout = n.onerror = n.onprogress = n.onload = null, n.abort();
|
|
3446
3535
|
}
|
|
3447
3536
|
};
|
|
3448
|
-
const
|
|
3449
|
-
class Bn extends
|
|
3537
|
+
const Wn = Dn, Fn = 256 * 1024;
|
|
3538
|
+
class Bn extends V {
|
|
3450
3539
|
constructor(e, t, r) {
|
|
3451
3540
|
super(), this.hooks = e, this.method = t, this.url = r;
|
|
3452
3541
|
}
|
|
3453
3542
|
start(e) {
|
|
3454
3543
|
this.position = 0, this.xhr = this.hooks.getRequest(this), this.unloader = () => {
|
|
3455
3544
|
this.close();
|
|
3456
|
-
},
|
|
3545
|
+
}, w.addUnloadListener(this.unloader), this.xhr.open(this.method, this.url, !0), this.xhr.setRequestHeader && this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.send(e);
|
|
3457
3546
|
}
|
|
3458
3547
|
close() {
|
|
3459
|
-
this.unloader && (
|
|
3548
|
+
this.unloader && (w.removeUnloadListener(this.unloader), this.unloader = null), this.xhr && (this.hooks.abortRequest(this.xhr), this.xhr = null);
|
|
3460
3549
|
}
|
|
3461
3550
|
onChunk(e, t) {
|
|
3462
3551
|
for (; ; ) {
|
|
@@ -3474,7 +3563,7 @@ function Gi() {
|
|
|
3474
3563
|
return r !== -1 ? (this.position += r + 1, t.slice(0, r)) : null;
|
|
3475
3564
|
}
|
|
3476
3565
|
isBufferTooLong(e) {
|
|
3477
|
-
return this.position === e.length && e.length >
|
|
3566
|
+
return this.position === e.length && e.length > Fn;
|
|
3478
3567
|
}
|
|
3479
3568
|
}
|
|
3480
3569
|
var _e;
|
|
@@ -3483,9 +3572,9 @@ function Gi() {
|
|
|
3483
3572
|
})(_e || (_e = {}));
|
|
3484
3573
|
const Z = _e;
|
|
3485
3574
|
var $n = 1;
|
|
3486
|
-
class
|
|
3575
|
+
class Vn {
|
|
3487
3576
|
constructor(e, t) {
|
|
3488
|
-
this.hooks = e, this.session = tt(1e3) + "/" + Yn(8), this.location =
|
|
3577
|
+
this.hooks = e, this.session = tt(1e3) + "/" + Yn(8), this.location = Xn(t), this.readyState = Z.CONNECTING, this.openStream();
|
|
3489
3578
|
}
|
|
3490
3579
|
send(e) {
|
|
3491
3580
|
return this.sendRaw(JSON.stringify([e]));
|
|
@@ -3499,7 +3588,7 @@ function Gi() {
|
|
|
3499
3588
|
sendRaw(e) {
|
|
3500
3589
|
if (this.readyState === Z.OPEN)
|
|
3501
3590
|
try {
|
|
3502
|
-
return
|
|
3591
|
+
return w.createSocketRequest("POST", et(Jn(this.location, this.session))).start(e), !0;
|
|
3503
3592
|
} catch {
|
|
3504
3593
|
return !1;
|
|
3505
3594
|
}
|
|
@@ -3554,7 +3643,7 @@ function Gi() {
|
|
|
3554
3643
|
this.onerror && this.onerror(e);
|
|
3555
3644
|
}
|
|
3556
3645
|
openStream() {
|
|
3557
|
-
this.stream =
|
|
3646
|
+
this.stream = w.createSocketRequest("POST", et(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (e) => {
|
|
3558
3647
|
this.onChunk(e);
|
|
3559
3648
|
}), this.stream.bind("finished", (e) => {
|
|
3560
3649
|
this.hooks.onFinished(this, e);
|
|
@@ -3573,7 +3662,7 @@ function Gi() {
|
|
|
3573
3662
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
3574
3663
|
}
|
|
3575
3664
|
}
|
|
3576
|
-
function
|
|
3665
|
+
function Xn(n) {
|
|
3577
3666
|
var e = /([^\?]*)\/*(\??.*)/.exec(n);
|
|
3578
3667
|
return {
|
|
3579
3668
|
base: e[1],
|
|
@@ -3592,14 +3681,14 @@ function Gi() {
|
|
|
3592
3681
|
return t[1] + e + t[3];
|
|
3593
3682
|
}
|
|
3594
3683
|
function tt(n) {
|
|
3595
|
-
return
|
|
3684
|
+
return w.randomInt(n);
|
|
3596
3685
|
}
|
|
3597
3686
|
function Yn(n) {
|
|
3598
3687
|
for (var e = [], t = 0; t < n; t++)
|
|
3599
3688
|
e.push(tt(32).toString(32));
|
|
3600
3689
|
return e.join("");
|
|
3601
3690
|
}
|
|
3602
|
-
const Kn =
|
|
3691
|
+
const Kn = Vn;
|
|
3603
3692
|
var Qn = {
|
|
3604
3693
|
getReceiveURL: function(n, e) {
|
|
3605
3694
|
return n.base + "/" + e + "/xhr_streaming" + n.queryString;
|
|
@@ -3631,7 +3720,7 @@ function Gi() {
|
|
|
3631
3720
|
const ti = ei;
|
|
3632
3721
|
var ni = {
|
|
3633
3722
|
getRequest: function(n) {
|
|
3634
|
-
var e =
|
|
3723
|
+
var e = w.getXHRAPI(), t = new e();
|
|
3635
3724
|
return t.onreadystatechange = t.onprogress = function() {
|
|
3636
3725
|
switch (t.readyState) {
|
|
3637
3726
|
case 3:
|
|
@@ -3667,13 +3756,13 @@ function Gi() {
|
|
|
3667
3756
|
};
|
|
3668
3757
|
const nt = ri;
|
|
3669
3758
|
nt.createXDR = function(n, e) {
|
|
3670
|
-
return this.createRequest(
|
|
3759
|
+
return this.createRequest(Wn, n, e);
|
|
3671
3760
|
};
|
|
3672
3761
|
var si = {
|
|
3673
3762
|
nextAuthCallbackID: 1,
|
|
3674
3763
|
auth_callbacks: {},
|
|
3675
|
-
ScriptReceivers:
|
|
3676
|
-
DependenciesReceivers:
|
|
3764
|
+
ScriptReceivers: S,
|
|
3765
|
+
DependenciesReceivers: W,
|
|
3677
3766
|
getDefaultStrategy: zn,
|
|
3678
3767
|
Transports: mn,
|
|
3679
3768
|
transportConnectionInitializer: Hn,
|
|
@@ -3763,7 +3852,7 @@ function Gi() {
|
|
|
3763
3852
|
}() * n);
|
|
3764
3853
|
}
|
|
3765
3854
|
};
|
|
3766
|
-
const
|
|
3855
|
+
const w = si;
|
|
3767
3856
|
var ke;
|
|
3768
3857
|
(function(n) {
|
|
3769
3858
|
n[n.ERROR = 3] = "ERROR", n[n.INFO = 6] = "INFO", n[n.DEBUG = 7] = "DEBUG";
|
|
@@ -3824,15 +3913,15 @@ function Gi() {
|
|
|
3824
3913
|
var r = !1, o = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), c = null, l = function() {
|
|
3825
3914
|
o.unbind("initialized", l), o.connect();
|
|
3826
3915
|
}, p = function() {
|
|
3827
|
-
c = X.createHandshake(o, function(
|
|
3828
|
-
r = !0, k(), t(null,
|
|
3916
|
+
c = X.createHandshake(o, function(P) {
|
|
3917
|
+
r = !0, k(), t(null, P);
|
|
3829
3918
|
});
|
|
3830
|
-
}, b = function(
|
|
3831
|
-
k(), t(
|
|
3919
|
+
}, b = function(P) {
|
|
3920
|
+
k(), t(P);
|
|
3832
3921
|
}, _ = function() {
|
|
3833
3922
|
k();
|
|
3834
|
-
var
|
|
3835
|
-
|
|
3923
|
+
var P;
|
|
3924
|
+
P = ae(o), t(new M(P));
|
|
3836
3925
|
}, k = function() {
|
|
3837
3926
|
o.unbind("initialized", l), o.unbind("open", p), o.unbind("error", b), o.unbind("closed", _);
|
|
3838
3927
|
};
|
|
@@ -3840,8 +3929,8 @@ function Gi() {
|
|
|
3840
3929
|
abort: () => {
|
|
3841
3930
|
r || (k(), c ? c.close() : o.close());
|
|
3842
3931
|
},
|
|
3843
|
-
forceMinPriority: (
|
|
3844
|
-
r || this.priority <
|
|
3932
|
+
forceMinPriority: (P) => {
|
|
3933
|
+
r || this.priority < P && (c ? c.close() : o.close());
|
|
3845
3934
|
}
|
|
3846
3935
|
};
|
|
3847
3936
|
}
|
|
@@ -3856,7 +3945,7 @@ function Gi() {
|
|
|
3856
3945
|
}
|
|
3857
3946
|
};
|
|
3858
3947
|
}
|
|
3859
|
-
const { Transports: ci } =
|
|
3948
|
+
const { Transports: ci } = w;
|
|
3860
3949
|
var hi = function(n, e, t, r, o, c) {
|
|
3861
3950
|
var l = ci[t];
|
|
3862
3951
|
if (!l)
|
|
@@ -3885,7 +3974,7 @@ function Gi() {
|
|
|
3885
3974
|
throw "You must pass an options object";
|
|
3886
3975
|
if (n.cluster == null)
|
|
3887
3976
|
throw "Options object must provide a cluster";
|
|
3888
|
-
"disableStats" in n &&
|
|
3977
|
+
"disableStats" in n && R.warn("The disableStats option is deprecated in favor of enableStats");
|
|
3889
3978
|
}
|
|
3890
3979
|
const ui = (n, e) => {
|
|
3891
3980
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
@@ -3898,11 +3987,11 @@ function Gi() {
|
|
|
3898
3987
|
}
|
|
3899
3988
|
return t;
|
|
3900
3989
|
}, fi = (n) => {
|
|
3901
|
-
if (typeof
|
|
3990
|
+
if (typeof w.getAuthorizers()[n.transport] > "u")
|
|
3902
3991
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3903
3992
|
return (e, t) => {
|
|
3904
3993
|
const r = ui(e, n);
|
|
3905
|
-
|
|
3994
|
+
w.getAuthorizers()[n.transport](w, r, n, u.UserAuthentication, t);
|
|
3906
3995
|
};
|
|
3907
3996
|
}, pi = (n, e) => {
|
|
3908
3997
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
@@ -3916,11 +4005,11 @@ function Gi() {
|
|
|
3916
4005
|
}
|
|
3917
4006
|
return t;
|
|
3918
4007
|
}, mi = (n) => {
|
|
3919
|
-
if (typeof
|
|
4008
|
+
if (typeof w.getAuthorizers()[n.transport] > "u")
|
|
3920
4009
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3921
4010
|
return (e, t) => {
|
|
3922
4011
|
const r = pi(e, n);
|
|
3923
|
-
|
|
4012
|
+
w.getAuthorizers()[n.transport](w, r, n, u.ChannelAuthorization, t);
|
|
3924
4013
|
};
|
|
3925
4014
|
}, gi = (n, e, t) => {
|
|
3926
4015
|
const r = {
|
|
@@ -3954,7 +4043,7 @@ function Gi() {
|
|
|
3954
4043
|
useTLS: wi(n),
|
|
3955
4044
|
wsHost: yi(n),
|
|
3956
4045
|
userAuthenticator: Si(n),
|
|
3957
|
-
channelAuthorizer:
|
|
4046
|
+
channelAuthorizer: Ei(n, e)
|
|
3958
4047
|
};
|
|
3959
4048
|
return "disabledTransports" in n && (t.disabledTransports = n.disabledTransports), "enabledTransports" in n && (t.enabledTransports = n.enabledTransports), "ignoreNullOrigin" in n && (t.ignoreNullOrigin = n.ignoreNullOrigin), "timelineParams" in n && (t.timelineParams = n.timelineParams), "nacl" in n && (t.nacl = n.nacl), t;
|
|
3960
4049
|
}
|
|
@@ -3968,7 +4057,7 @@ function Gi() {
|
|
|
3968
4057
|
return `ws-${n}.pusher.com`;
|
|
3969
4058
|
}
|
|
3970
4059
|
function wi(n) {
|
|
3971
|
-
return
|
|
4060
|
+
return w.getProtocol() === "https:" ? !0 : n.forceTLS !== !1;
|
|
3972
4061
|
}
|
|
3973
4062
|
function Ci(n) {
|
|
3974
4063
|
return "enableStats" in n ? n.enableStats : "disableStats" in n ? !n.disableStats : !1;
|
|
@@ -3991,14 +4080,14 @@ function Gi() {
|
|
|
3991
4080
|
};
|
|
3992
4081
|
return t;
|
|
3993
4082
|
}
|
|
3994
|
-
function
|
|
4083
|
+
function Ei(n, e) {
|
|
3995
4084
|
const t = Ti(n, e);
|
|
3996
4085
|
return st(t) ? t.customHandler : mi(t);
|
|
3997
4086
|
}
|
|
3998
|
-
class
|
|
4087
|
+
class xi extends V {
|
|
3999
4088
|
constructor(e) {
|
|
4000
4089
|
super(function(t, r) {
|
|
4001
|
-
|
|
4090
|
+
R.debug(`No callbacks on watchlist events for ${t}`);
|
|
4002
4091
|
}), this.pusher = e, this.bindWatchlistInternalEvent();
|
|
4003
4092
|
}
|
|
4004
4093
|
handleEvent(e) {
|
|
@@ -4020,13 +4109,13 @@ function Gi() {
|
|
|
4020
4109
|
}), resolve: n, reject: e };
|
|
4021
4110
|
}
|
|
4022
4111
|
const ki = _i;
|
|
4023
|
-
class Ai extends
|
|
4112
|
+
class Ai extends V {
|
|
4024
4113
|
constructor(e) {
|
|
4025
4114
|
super(function(t, r) {
|
|
4026
|
-
|
|
4115
|
+
R.debug("No callbacks on user for " + t);
|
|
4027
4116
|
}), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (t, r) => {
|
|
4028
4117
|
if (t) {
|
|
4029
|
-
|
|
4118
|
+
R.warn(`Error during signin: ${t}`), this._cleanup();
|
|
4030
4119
|
return;
|
|
4031
4120
|
}
|
|
4032
4121
|
this.pusher.send_event("pusher:signin", {
|
|
@@ -4035,7 +4124,7 @@ function Gi() {
|
|
|
4035
4124
|
});
|
|
4036
4125
|
}, this.pusher = e, this.pusher.connection.bind("state_change", ({ previous: t, current: r }) => {
|
|
4037
4126
|
t !== "connected" && r === "connected" && this._signin(), t === "connected" && r !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
4038
|
-
}), this.watchlist = new
|
|
4127
|
+
}), this.watchlist = new xi(e), this.pusher.connection.bind("message", (t) => {
|
|
4039
4128
|
var r = t.event;
|
|
4040
4129
|
r === "pusher:signin_success" && this._onSigninSuccess(t.data), this.serverToUserChannel && this.serverToUserChannel.name === t.channel && this.serverToUserChannel.handleEvent(t);
|
|
4041
4130
|
});
|
|
@@ -4052,11 +4141,11 @@ function Gi() {
|
|
|
4052
4141
|
try {
|
|
4053
4142
|
this.user_data = JSON.parse(e.user_data);
|
|
4054
4143
|
} catch {
|
|
4055
|
-
|
|
4144
|
+
R.error(`Failed parsing user data after signin: ${e.user_data}`), this._cleanup();
|
|
4056
4145
|
return;
|
|
4057
4146
|
}
|
|
4058
4147
|
if (typeof this.user_data.id != "string" || this.user_data.id === "") {
|
|
4059
|
-
|
|
4148
|
+
R.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
|
|
4060
4149
|
return;
|
|
4061
4150
|
}
|
|
4062
4151
|
this._signinDoneResolve(), this._subscribeChannels();
|
|
@@ -4083,30 +4172,30 @@ function Gi() {
|
|
|
4083
4172
|
e.then(r).catch(r), this.signinDonePromise = e, this._signinDoneResolve = t;
|
|
4084
4173
|
}
|
|
4085
4174
|
}
|
|
4086
|
-
class
|
|
4175
|
+
class I {
|
|
4087
4176
|
static ready() {
|
|
4088
|
-
|
|
4089
|
-
for (var e = 0, t =
|
|
4090
|
-
|
|
4177
|
+
I.isReady = !0;
|
|
4178
|
+
for (var e = 0, t = I.instances.length; e < t; e++)
|
|
4179
|
+
I.instances[e].connect();
|
|
4091
4180
|
}
|
|
4092
4181
|
static getClientFeatures() {
|
|
4093
|
-
return De(Be({ ws:
|
|
4182
|
+
return De(Be({ ws: w.Transports.ws }, function(e) {
|
|
4094
4183
|
return e.isSupported({});
|
|
4095
4184
|
}));
|
|
4096
4185
|
}
|
|
4097
4186
|
constructor(e, t) {
|
|
4098
|
-
Li(e), di(t), this.key = e, this.options = t, this.config = rt(this.options, this), this.channels = X.createChannels(), this.global_emitter = new
|
|
4187
|
+
Li(e), di(t), this.key = e, this.options = t, this.config = rt(this.options, this), this.channels = X.createChannels(), this.global_emitter = new V(), this.sessionID = w.randomInt(1e9), this.timeline = new oi(this.key, this.sessionID, {
|
|
4099
4188
|
cluster: this.config.cluster,
|
|
4100
|
-
features:
|
|
4189
|
+
features: I.getClientFeatures(),
|
|
4101
4190
|
params: this.config.timelineParams || {},
|
|
4102
4191
|
limit: 50,
|
|
4103
4192
|
level: le.INFO,
|
|
4104
4193
|
version: T.VERSION
|
|
4105
4194
|
}), this.config.enableStats && (this.timelineSender = X.createTimelineSender(this.timeline, {
|
|
4106
4195
|
host: this.config.statsHost,
|
|
4107
|
-
path: "/timeline/v2/" +
|
|
4196
|
+
path: "/timeline/v2/" + w.TimelineTransport.name
|
|
4108
4197
|
}));
|
|
4109
|
-
var r = (o) =>
|
|
4198
|
+
var r = (o) => w.getDefaultStrategy(this.config, o, hi);
|
|
4110
4199
|
this.connection = X.createConnectionManager(this.key, {
|
|
4111
4200
|
getStrategy: r,
|
|
4112
4201
|
timeline: this.timeline,
|
|
@@ -4128,8 +4217,8 @@ function Gi() {
|
|
|
4128
4217
|
}), this.connection.bind("disconnected", () => {
|
|
4129
4218
|
this.channels.disconnect();
|
|
4130
4219
|
}), this.connection.bind("error", (o) => {
|
|
4131
|
-
|
|
4132
|
-
}),
|
|
4220
|
+
R.warn(o);
|
|
4221
|
+
}), I.instances.push(this), this.timeline.info({ instances: I.instances.length }), this.user = new Ai(this), I.isReady && this.connect();
|
|
4133
4222
|
}
|
|
4134
4223
|
switchCluster(e) {
|
|
4135
4224
|
const { appKey: t, cluster: r } = e;
|
|
@@ -4190,13 +4279,13 @@ function Gi() {
|
|
|
4190
4279
|
this.user.signin();
|
|
4191
4280
|
}
|
|
4192
4281
|
}
|
|
4193
|
-
|
|
4194
|
-
const de =
|
|
4282
|
+
I.instances = [], I.isReady = !1, I.logToConsole = !1, I.Runtime = w, I.ScriptReceivers = w.ScriptReceivers, I.DependenciesReceivers = w.DependenciesReceivers, I.auth_callbacks = w.auth_callbacks;
|
|
4283
|
+
const de = I;
|
|
4195
4284
|
function Li(n) {
|
|
4196
4285
|
if (n == null)
|
|
4197
4286
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
4198
4287
|
}
|
|
4199
|
-
|
|
4288
|
+
w.setup(I);
|
|
4200
4289
|
}
|
|
4201
4290
|
/******/
|
|
4202
4291
|
}, a = {};
|
|
@@ -4223,10 +4312,10 @@ function Gi() {
|
|
|
4223
4312
|
return d;
|
|
4224
4313
|
})()
|
|
4225
4314
|
));
|
|
4226
|
-
})(
|
|
4315
|
+
})(Re)), Re.exports;
|
|
4227
4316
|
}
|
|
4228
4317
|
var Yi = Gi();
|
|
4229
|
-
const Ki = /* @__PURE__ */ Ji(Yi),
|
|
4318
|
+
const Ki = /* @__PURE__ */ Ji(Yi), Pe = "/vendor/sendity-client/tailwind.css", Qi = {
|
|
4230
4319
|
labels: {
|
|
4231
4320
|
email: "Email",
|
|
4232
4321
|
whatsapp: "WhatsApp"
|
|
@@ -4238,6 +4327,7 @@ const Ki = /* @__PURE__ */ Ji(Yi), Re = "/vendor/sendity-client/tailwind.css", Q
|
|
|
4238
4327
|
toPrefix: "to",
|
|
4239
4328
|
footerWaiting: "Ready to receive your code…",
|
|
4240
4329
|
footerWaitingUntil: "Ready to receive your code…",
|
|
4330
|
+
footerReturnedWaiting: "Waiting for your message to arrive…",
|
|
4241
4331
|
codeExpired: "Code expired, request a new one.",
|
|
4242
4332
|
getNewCode: "Get new code"
|
|
4243
4333
|
},
|
|
@@ -4260,6 +4350,7 @@ Code: (Code)`,
|
|
|
4260
4350
|
toPrefix: "an",
|
|
4261
4351
|
footerWaiting: "Bereit zum Empfangen Deines Codes …",
|
|
4262
4352
|
footerWaitingUntil: "Bereit zum Empfangen Deines Codes …",
|
|
4353
|
+
footerReturnedWaiting: "Warte darauf, dass Deine Nachricht ankommt …",
|
|
4263
4354
|
codeExpired: "Code abgelaufen, fordere einen neuen an.",
|
|
4264
4355
|
getNewCode: "Neuen Code anfordern"
|
|
4265
4356
|
},
|
|
@@ -4282,6 +4373,7 @@ Code: (Code)`,
|
|
|
4282
4373
|
toPrefix: "à",
|
|
4283
4374
|
footerWaiting: "Prêt à recevoir votre code…",
|
|
4284
4375
|
footerWaitingUntil: "Prêt à recevoir votre code…",
|
|
4376
|
+
footerReturnedWaiting: "En attente de l’arrivée de votre message…",
|
|
4285
4377
|
codeExpired: "Code expiré, demandez-en un nouveau.",
|
|
4286
4378
|
getNewCode: "Nouveau code"
|
|
4287
4379
|
},
|
|
@@ -4293,7 +4385,7 @@ Code : (Code)`,
|
|
|
4293
4385
|
whatsappText: "Connectez-moi à (Host) avec ce code : (Code)"
|
|
4294
4386
|
}
|
|
4295
4387
|
};
|
|
4296
|
-
function
|
|
4388
|
+
function B(v) {
|
|
4297
4389
|
switch (v) {
|
|
4298
4390
|
case "de":
|
|
4299
4391
|
return Zi;
|
|
@@ -4304,7 +4396,7 @@ function V(v) {
|
|
|
4304
4396
|
}
|
|
4305
4397
|
}
|
|
4306
4398
|
const vt = `<svg role="img" viewBox="0 0 512 512" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>Email</title><path d="M64 112c-8.8 0-16 7.2-16 16l0 22.1L220.5 291.7c20.7 17 50.4 17 71.1 0L464 150.1l0-22.1c0-8.8-7.2-16-16-16L64 112zM48 212.2L48 384c0 8.8 7.2 16 16 16l384 0c8.8 0 16-7.2 16-16l0-171.8L322 328.8c-38.4 31.5-93.7 31.5-132 0L48 212.2zM0 128C0 92.7 28.7 64 64 64l384 0c35.3 0 64 28.7 64 64l0 256c0 35.3-28.7 64-64 64L64 448c-35.3 0-64-28.7-64-64L0 128z"/></svg>
|
|
4307
|
-
`, yt = '<svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>WhatsApp</title><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>', tr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.998 9.332A5.002 5.002 0 0 1 13.2 5.5H11a1 1 0 1 0 0 2h4.5a1 1 0 0 0 1-1V2a1 1 0 1 0-2 0v1.74A7.002 7.002 0 0 0 3 9.332a1 1 0 1 0 1.998 0ZM15.002 10.668A5.002 5.002 0 0 1 6.8 14.5H9a1 1 0 1 0 0-2H4.5a1 1 0 0 0-1 1V18a1 1 0 1 0 2 0v-1.74a7.002 7.002 0 0 0 11.5-5.592 1 1 0 1 0-1.998 0Z" clip-rule="evenodd" /></svg>', nr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM7.22 6.22a.75.75 0 0 0-1.06 1.06L8.88 10l-2.72 2.72a.75.75 0 1 0 1.06 1.06L9.94 11.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L11 10l2.72-2.72a.75.75 0 0 0-1.06-1.06L9.94 8.94 7.22 6.22Z" clip-rule="evenodd" /></svg>', Me = "sendityAuthRequest", ir = "https://sendity.io/api", rr =
|
|
4399
|
+
`, yt = '<svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>WhatsApp</title><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>', tr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.998 9.332A5.002 5.002 0 0 1 13.2 5.5H11a1 1 0 1 0 0 2h4.5a1 1 0 0 0 1-1V2a1 1 0 1 0-2 0v1.74A7.002 7.002 0 0 0 3 9.332a1 1 0 1 0 1.998 0ZM15.002 10.668A5.002 5.002 0 0 1 6.8 14.5H9a1 1 0 1 0 0-2H4.5a1 1 0 0 0-1 1V18a1 1 0 1 0 2 0v-1.74a7.002 7.002 0 0 0 11.5-5.592 1 1 0 1 0-1.998 0Z" clip-rule="evenodd" /></svg>', nr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM7.22 6.22a.75.75 0 0 0-1.06 1.06L8.88 10l-2.72 2.72a.75.75 0 1 0 1.06 1.06L9.94 11.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L11 10l2.72-2.72a.75.75 0 0 0-1.06-1.06L9.94 8.94 7.22 6.22Z" clip-rule="evenodd" /></svg>', Me = "sendityAuthRequest", ir = "https://sendity.io/api/sendity", rr = 600 * 1e3, sr = 5e3, or = 15e3, ar = 1e3, Ie = 2e3, pe = 220, At = 0;
|
|
4308
4400
|
function je(v, i) {
|
|
4309
4401
|
return `sendity:auth-request:${encodeURIComponent(v)}:${encodeURIComponent(i)}`;
|
|
4310
4402
|
}
|
|
@@ -4316,7 +4408,7 @@ function bt(v, i, s, a = Date.now()) {
|
|
|
4316
4408
|
const m = JSON.parse(d);
|
|
4317
4409
|
if (typeof m.id != "string" || typeof m.clientSecret != "string" || typeof m.createdAt != "number")
|
|
4318
4410
|
throw new Error("invalid stored auth request");
|
|
4319
|
-
return a - m.createdAt >=
|
|
4411
|
+
return a - m.createdAt >= rr ? (v.removeItem(h), null) : { id: m.id, clientSecret: m.clientSecret };
|
|
4320
4412
|
} catch {
|
|
4321
4413
|
return v.removeItem(h), null;
|
|
4322
4414
|
}
|
|
@@ -4346,7 +4438,9 @@ function dr(v, i, s) {
|
|
|
4346
4438
|
}
|
|
4347
4439
|
const ve = class ve extends HTMLElement {
|
|
4348
4440
|
constructor() {
|
|
4349
|
-
super(), this.pollTimer = null, this.fallbackPollTimer = null, this.authenticatedEventTimer = null, this.rootEl = null, this.codeContainerEl = null, this.codeEl = null, this.promptEl = null, this.successEl = null, this.spinnerEl = null, this.verifiersEl = null, this.footerEl = null, this.footerBrandEl = null, this.footerStatusEl = null, this.footerMessageEl = null, this.footerTimerEl = null, this.footerIndicatorEl = null, this.footerObserver = null, this.authStartObserver = null, this.authFlowStarted = !1, this.footerWaitTimer = null, this.footerTransitionTimer = null, this.successTransitionTimer = null, this.timerInterval = null, this.currentConfig = null, this.destroyed = !1, this.lastCode = void 0, this.echo = null, this.authenticated = !1
|
|
4441
|
+
super(), this.pollTimer = null, this.fallbackPollTimer = null, this.authenticatedEventTimer = null, this.rootEl = null, this.codeContainerEl = null, this.codeEl = null, this.promptEl = null, this.successEl = null, this.spinnerEl = null, this.verifiersEl = null, this.footerEl = null, this.footerBrandEl = null, this.footerStatusEl = null, this.footerMessageEl = null, this.footerTimerEl = null, this.footerIndicatorEl = null, this.secondarySlotContainerEl = null, this.secondarySlotEl = null, this.footerObserver = null, this.authStartObserver = null, this.authFlowStarted = !1, this.footerWaitTimer = null, this.returnWaitTimer = null, this.footerTransitionTimer = null, this.successTransitionTimer = null, this.timerInterval = null, this.currentConfig = null, this.destroyed = !1, this.lastCode = void 0, this.echo = null, this.activeVerifyUrls = [], this.authenticated = !1, this.handleBrowserReturn = () => {
|
|
4442
|
+
this.scheduleBrowserReturnCheck();
|
|
4443
|
+
}, this.handleSecondarySlotChange = () => this.syncSecondarySlotState();
|
|
4350
4444
|
const i = this.attachShadow({ mode: "open" });
|
|
4351
4445
|
this.injectTailwind(i);
|
|
4352
4446
|
const s = document.createElement("div");
|
|
@@ -4355,26 +4449,32 @@ const ve = class ve extends HTMLElement {
|
|
|
4355
4449
|
d.textContent = zi, i.appendChild(d), i.appendChild(h);
|
|
4356
4450
|
}
|
|
4357
4451
|
static get observedAttributes() {
|
|
4358
|
-
return ["server-url", "public-key", "
|
|
4452
|
+
return ["server-url", "public-key", "lang", "transport", "hide-footer", "footer", "authenticated-event-delay-ms", "variant", "no-card"];
|
|
4359
4453
|
}
|
|
4360
4454
|
connectedCallback() {
|
|
4361
|
-
this.rootEl = this.shadowRoot?.querySelector(".sendity"), this.codeContainerEl = this.shadowRoot?.querySelector(".code"), this.codeEl = this.shadowRoot?.querySelector(".formatted-code"), this.promptEl = this.shadowRoot?.querySelector(".prompt"), this.successEl = this.shadowRoot?.querySelector(".success"), this.spinnerEl = this.shadowRoot?.querySelector(".spinner"), this.verifiersEl = this.shadowRoot?.querySelector(".verifiers"), this.footerEl = this.shadowRoot?.querySelector(".sendity-footer"), this.footerBrandEl = this.shadowRoot?.querySelector(".footer-brand"), this.footerStatusEl = this.shadowRoot?.querySelector(".footer-status"), this.footerMessageEl = this.shadowRoot?.querySelector(".footer-message"), this.footerTimerEl = this.shadowRoot?.querySelector(".footer-timer"), this.footerIndicatorEl = this.shadowRoot?.querySelector(".footer-spinner");
|
|
4455
|
+
this.rootEl = this.shadowRoot?.querySelector(".sendity"), this.codeContainerEl = this.shadowRoot?.querySelector(".code"), this.codeEl = this.shadowRoot?.querySelector(".formatted-code"), this.promptEl = this.shadowRoot?.querySelector(".prompt"), this.successEl = this.shadowRoot?.querySelector(".success"), this.spinnerEl = this.shadowRoot?.querySelector(".spinner"), this.verifiersEl = this.shadowRoot?.querySelector(".verifiers"), this.footerEl = this.shadowRoot?.querySelector(".sendity-footer"), this.footerBrandEl = this.shadowRoot?.querySelector(".footer-brand"), this.footerStatusEl = this.shadowRoot?.querySelector(".footer-status"), this.footerMessageEl = this.shadowRoot?.querySelector(".footer-message"), this.footerTimerEl = this.shadowRoot?.querySelector(".footer-timer"), this.footerIndicatorEl = this.shadowRoot?.querySelector(".footer-spinner"), this.secondarySlotContainerEl = this.shadowRoot?.querySelector(".sendity-secondary-slot"), this.secondarySlotEl = this.shadowRoot?.querySelector('slot[name="secondary"]'), this.secondarySlotEl?.addEventListener("slotchange", this.handleSecondarySlotChange), this.syncSecondarySlotState(), this.syncLayoutVariant();
|
|
4362
4456
|
try {
|
|
4363
4457
|
this.currentConfig = this.resolveConfig();
|
|
4364
4458
|
} catch (i) {
|
|
4365
4459
|
this.handleInitialError(i);
|
|
4366
4460
|
return;
|
|
4367
4461
|
}
|
|
4368
|
-
this.configureFooter(), this.dispatchPublicEvent("sendity:ready", {
|
|
4462
|
+
this.configureFooter(), this.bindBrowserReturnListeners(), this.dispatchPublicEvent("sendity:ready", {
|
|
4369
4463
|
transport: this.currentConfig.transport,
|
|
4370
|
-
channel: this.primaryChannel(this.
|
|
4371
|
-
}), this.showPlaceholderCode(), this.
|
|
4464
|
+
channel: this.primaryChannel(this.activeVerifyUrls)
|
|
4465
|
+
}), this.showPlaceholderCode(), this.startWhenVisible();
|
|
4372
4466
|
}
|
|
4373
4467
|
disconnectedCallback() {
|
|
4374
4468
|
this.stop(), this.destroyed = !0;
|
|
4375
4469
|
}
|
|
4376
4470
|
attributeChangedCallback() {
|
|
4377
|
-
this.isConnected && (this.currentConfig = this.resolveConfig(), this.configureFooter()
|
|
4471
|
+
this.isConnected && (this.syncLayoutVariant(), this.currentConfig = this.resolveConfig(), this.configureFooter());
|
|
4472
|
+
}
|
|
4473
|
+
isNoCardVariant() {
|
|
4474
|
+
return this.getAttribute("variant") === "no-card" || this.hasAttribute("no-card");
|
|
4475
|
+
}
|
|
4476
|
+
syncLayoutVariant() {
|
|
4477
|
+
this.rootEl?.classList.toggle("sendity--no-card", this.isNoCardVariant());
|
|
4378
4478
|
}
|
|
4379
4479
|
startWhenVisible() {
|
|
4380
4480
|
if (!(this.authFlowStarted || this.destroyed)) {
|
|
@@ -4395,7 +4495,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4395
4495
|
}));
|
|
4396
4496
|
}
|
|
4397
4497
|
stop() {
|
|
4398
|
-
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null), this.fallbackPollTimer !== null && (clearTimeout(this.fallbackPollTimer), this.fallbackPollTimer = null), this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.authenticatedEventTimer !== null && (clearTimeout(this.authenticatedEventTimer), this.authenticatedEventTimer = null), this.footerTransitionTimer !== null && (clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = null), this.successTransitionTimer !== null && (clearTimeout(this.successTransitionTimer), this.successTransitionTimer = null), this.stopCountdown(), this.footerObserver?.disconnect(), this.footerObserver = null, this.authStartObserver?.disconnect(), this.authStartObserver = null, this.echo && this.activeAuthRequestId && this.echo.leave(`sendity.auth-requests.${this.activeAuthRequestId}`), this.echo?.disconnect(), this.echo = null;
|
|
4498
|
+
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null), this.fallbackPollTimer !== null && (clearTimeout(this.fallbackPollTimer), this.fallbackPollTimer = null), this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.returnWaitTimer !== null && (clearTimeout(this.returnWaitTimer), this.returnWaitTimer = null), this.authenticatedEventTimer !== null && (clearTimeout(this.authenticatedEventTimer), this.authenticatedEventTimer = null), this.footerTransitionTimer !== null && (clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = null), this.successTransitionTimer !== null && (clearTimeout(this.successTransitionTimer), this.successTransitionTimer = null), this.stopCountdown(), this.footerObserver?.disconnect(), this.footerObserver = null, this.authStartObserver?.disconnect(), this.authStartObserver = null, this.echo && this.activeAuthRequestId && this.echo.leave(`sendity.auth-requests.${this.activeAuthRequestId}`), this.echo?.disconnect(), this.echo = null, window.removeEventListener("focus", this.handleBrowserReturn), window.removeEventListener("pageshow", this.handleBrowserReturn), document.removeEventListener("visibilitychange", this.handleBrowserReturn), this.secondarySlotEl?.removeEventListener("slotchange", this.handleSecondarySlotChange), this.secondarySlotEl = null, this.secondarySlotContainerEl = null;
|
|
4499
|
+
}
|
|
4500
|
+
syncSecondarySlotState() {
|
|
4501
|
+
const i = (this.secondarySlotEl?.assignedNodes({ flatten: !0 }) ?? []).some((s) => s.nodeType === Node.TEXT_NODE ? (s.textContent ?? "").trim() !== "" : s.nodeType === Node.ELEMENT_NODE);
|
|
4502
|
+
this.secondarySlotContainerEl?.classList.toggle("sendity-secondary-slot--filled", i), this.secondarySlotContainerEl && (this.secondarySlotContainerEl.hidden = !i);
|
|
4399
4503
|
}
|
|
4400
4504
|
// Inject Tailwind CSS into the Shadow DOM so Tailwind utility classes
|
|
4401
4505
|
// used in sendity.html work within the component. We cache the processed
|
|
@@ -4410,11 +4514,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4410
4514
|
s.textContent = a.tailwindCssText;
|
|
4411
4515
|
else {
|
|
4412
4516
|
const h = document.createElement("link");
|
|
4413
|
-
h.rel = "stylesheet", h.href =
|
|
4517
|
+
h.rel = "stylesheet", h.href = Pe, i.insertBefore(h, s);
|
|
4414
4518
|
}
|
|
4415
4519
|
return;
|
|
4416
4520
|
}
|
|
4417
|
-
a.tailwindLoading || (a.tailwindLoading = fetch(
|
|
4521
|
+
a.tailwindLoading || (a.tailwindLoading = fetch(Pe).then((h) => h.ok ? h.text() : Promise.reject(new Error(`HTTP ${h.status}`))).then((h) => {
|
|
4418
4522
|
a.tailwindCssText = h;
|
|
4419
4523
|
}).catch((h) => {
|
|
4420
4524
|
console.warn("[sendity-auth] Failed to load Tailwind CSS for Shadow DOM", h), a.tailwindCssText = "";
|
|
@@ -4424,7 +4528,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4424
4528
|
s.textContent = a.tailwindCssText;
|
|
4425
4529
|
else {
|
|
4426
4530
|
const h = document.createElement("link");
|
|
4427
|
-
h.rel = "stylesheet", h.href =
|
|
4531
|
+
h.rel = "stylesheet", h.href = Pe, i.insertBefore(h, s);
|
|
4428
4532
|
}
|
|
4429
4533
|
});
|
|
4430
4534
|
}
|
|
@@ -4437,6 +4541,14 @@ const ve = class ve extends HTMLElement {
|
|
|
4437
4541
|
this.footerEl.hidden = !1, this.footerEl.classList.remove("footer--waiting", "footer--transitioning", "footer--leaving", "footer--verified"), this.setFooterIndicatorWaiting(), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.setAttribute("hidden", ""), this.observeFooterVisibility();
|
|
4438
4542
|
}
|
|
4439
4543
|
}
|
|
4544
|
+
bindBrowserReturnListeners() {
|
|
4545
|
+
window.removeEventListener("focus", this.handleBrowserReturn), window.removeEventListener("pageshow", this.handleBrowserReturn), document.removeEventListener("visibilitychange", this.handleBrowserReturn), window.addEventListener("focus", this.handleBrowserReturn), window.addEventListener("pageshow", this.handleBrowserReturn), document.addEventListener("visibilitychange", this.handleBrowserReturn);
|
|
4546
|
+
}
|
|
4547
|
+
scheduleBrowserReturnCheck() {
|
|
4548
|
+
this.destroyed || this.authenticated || !this.activeAuthRequestId || !this.activeAuthRequestSecret || document.visibilityState && document.visibilityState !== "visible" || (this.returnWaitTimer !== null && clearTimeout(this.returnWaitTimer), this.returnWaitTimer = window.setTimeout(() => {
|
|
4549
|
+
this.returnWaitTimer = null, !(this.destroyed || this.authenticated) && (this.showFooterWaitingState({ returnedFromClient: !0 }), this.step().catch((i) => console.warn("[sendity-auth] return check failed", i)));
|
|
4550
|
+
}, ar));
|
|
4551
|
+
}
|
|
4440
4552
|
isFooterHidden() {
|
|
4441
4553
|
const i = (this.getAttribute("footer") ?? "").trim().toLowerCase();
|
|
4442
4554
|
return this.hasAttribute("hide-footer") || ["false", "hidden", "none", "off", "0"].includes(i);
|
|
@@ -4449,7 +4561,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4449
4561
|
scheduleFooterWaitingState() {
|
|
4450
4562
|
this.footerWaitTimer !== null || this.isFooterHidden() || (this.footerWaitTimer = window.setTimeout(() => {
|
|
4451
4563
|
this.footerWaitTimer = null, this.showFooterWaitingState();
|
|
4452
|
-
},
|
|
4564
|
+
}, or));
|
|
4453
4565
|
}
|
|
4454
4566
|
setFooterIndicatorWaiting() {
|
|
4455
4567
|
this.footerIndicatorEl && (this.footerIndicatorEl.classList.remove("footer-indicator--error"), this.footerIndicatorEl.innerHTML = "", this.footerIndicatorEl.removeAttribute("hidden"));
|
|
@@ -4457,8 +4569,8 @@ const ve = class ve extends HTMLElement {
|
|
|
4457
4569
|
setFooterIndicatorError() {
|
|
4458
4570
|
this.footerIndicatorEl && (this.footerIndicatorEl.classList.add("footer-indicator--error"), this.footerIndicatorEl.innerHTML = nr, this.footerIndicatorEl.removeAttribute("hidden"));
|
|
4459
4571
|
}
|
|
4460
|
-
showFooterWaitingState() {
|
|
4461
|
-
this.isFooterHidden() || (this.currentConfig && this.footerMessageEl && (this.footerMessageEl.textContent = this.waitingFooterMessage()), this.setFooterIndicatorWaiting(), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4572
|
+
showFooterWaitingState(i = {}) {
|
|
4573
|
+
this.isFooterHidden() || (this.currentConfig && this.footerMessageEl && (this.footerMessageEl.textContent = i.returnedFromClient ? B(this.currentConfig.lang).ui.footerReturnedWaiting : this.waitingFooterMessage()), this.setFooterIndicatorWaiting(), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4462
4574
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4463
4575
|
}, pe), this.startCountdown());
|
|
4464
4576
|
}
|
|
@@ -4486,7 +4598,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4486
4598
|
showExpiredState() {
|
|
4487
4599
|
if (!(this.authenticated || this.destroyed || !this.currentConfig)) {
|
|
4488
4600
|
if (this.stopAuthTransports(), this.rootEl?.classList.remove("sendity--verified"), this.rootEl?.classList.add("sendity--expired"), this.codeContainerEl?.classList.remove("code--active", "code--placeholder"), this.codeContainerEl?.classList.add("code--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.codeEl?.removeAttribute("hidden"), !this.isFooterHidden()) {
|
|
4489
|
-
const i =
|
|
4601
|
+
const i = B(this.currentConfig.lang);
|
|
4490
4602
|
this.footerMessageEl && (this.footerMessageEl.textContent = i.ui.codeExpired), this.setFooterIndicatorError(), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTimerEl?.setAttribute("hidden", ""), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4491
4603
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4492
4604
|
}, pe);
|
|
@@ -4496,7 +4608,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4496
4608
|
}
|
|
4497
4609
|
renderExpiredAction() {
|
|
4498
4610
|
if (!this.verifiersEl || !this.currentConfig) return;
|
|
4499
|
-
const i =
|
|
4611
|
+
const i = B(this.currentConfig.lang);
|
|
4500
4612
|
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden");
|
|
4501
4613
|
const s = document.createElement("button");
|
|
4502
4614
|
s.type = "button", s.className = "chan error", s.addEventListener("click", () => {
|
|
@@ -4514,7 +4626,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4514
4626
|
const i = this.currentConfig;
|
|
4515
4627
|
this.stopAuthTransports(), this.stopCountdown(), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.setFooterIndicatorWaiting(), this.codeContainerEl?.classList.remove("code--expired");
|
|
4516
4628
|
const s = await this.createAuthRequest(i.serverUrl, i.publicKey, me());
|
|
4517
|
-
this.
|
|
4629
|
+
this.showFooterWaitingState(), this.configureRealtime(s);
|
|
4518
4630
|
}
|
|
4519
4631
|
handleInitialError(i) {
|
|
4520
4632
|
console.error("[sendity-auth] Unable to initialize authentication", i), this.renderError("Unable to initialize authentication, see console for details"), this.dispatchEvent(
|
|
@@ -4529,24 +4641,13 @@ const ve = class ve extends HTMLElement {
|
|
|
4529
4641
|
const i = {
|
|
4530
4642
|
lang: navigator.language?.startsWith("de") ? "de" : navigator.language?.startsWith("fr") ? "fr" : "en",
|
|
4531
4643
|
transport: "auto"
|
|
4532
|
-
}, s = (
|
|
4644
|
+
}, s = (x) => this.getAttribute(x) ?? void 0, a = s("server-url")?.trim() || ir, h = s("public-key")?.trim();
|
|
4533
4645
|
if (!h)
|
|
4534
4646
|
throw new Error("Missing required sendity-auth attribute: public-key");
|
|
4535
|
-
let d =
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
if (d = JSON.parse(m), !Array.isArray(d)) throw new Error("verify-urls not array");
|
|
4540
|
-
d = d.map(String);
|
|
4541
|
-
} catch {
|
|
4542
|
-
d = m.split(",").map((R) => R.trim()).filter(Boolean);
|
|
4543
|
-
}
|
|
4544
|
-
if (d = hr(d), d.length === 0)
|
|
4545
|
-
throw new Error("Missing required sendity-auth attribute: verify-urls");
|
|
4546
|
-
let g = s("lang") || i.lang;
|
|
4547
|
-
g !== "en" && g !== "de" && g !== "fr" && (g = i.lang);
|
|
4548
|
-
const y = s("transport"), E = y === "push" || y === "polling" ? y : i.transport, w = this.parseAuthenticatedEventDelayMs(s("authenticated-event-delay-ms"));
|
|
4549
|
-
return { serverUrl: a, publicKey: h, verifyUrls: d, lang: g, transport: E, authenticatedEventDelayMs: w };
|
|
4647
|
+
let d = s("lang") || i.lang;
|
|
4648
|
+
d !== "en" && d !== "de" && d !== "fr" && (d = i.lang);
|
|
4649
|
+
const m = s("transport"), g = m === "push" || m === "polling" ? m : i.transport, y = this.parseAuthenticatedEventDelayMs(s("authenticated-event-delay-ms"));
|
|
4650
|
+
return { serverUrl: a, publicKey: h, lang: d, transport: g, authenticatedEventDelayMs: y };
|
|
4550
4651
|
}
|
|
4551
4652
|
parseAuthenticatedEventDelayMs(i) {
|
|
4552
4653
|
if (i === void 0 || i.trim() === "") return Ie;
|
|
@@ -4568,10 +4669,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4568
4669
|
if (!d.id) throw new Error("Missing id from server response");
|
|
4569
4670
|
const m = this.extractClientSecret(d);
|
|
4570
4671
|
if (!m) throw new Error("Missing client secret from server response");
|
|
4571
|
-
return cr(a, i, s, { id: String(d.id), clientSecret: m }), this.activeAuthRequestId = String(d.id), this.activeAuthRequestSecret = m, this.updateActiveAuthRequestExpiry(d), this.updateCode(d.formattedCode ?? d.code), this.dispatchPublicEvent("sendity:challenge-created", {
|
|
4672
|
+
return cr(a, i, s, { id: String(d.id), clientSecret: m }), this.activeAuthRequestId = String(d.id), this.activeAuthRequestSecret = m, this.updateActiveAuthRequestExpiry(d), this.applyVerifyUrlsFromResponse(d), this.updateCode(d.formattedCode ?? d.code), this.dispatchPublicEvent("sendity:challenge-created", {
|
|
4572
4673
|
verificationId: String(d.id),
|
|
4573
4674
|
code: d.formattedCode ?? d.code ?? "",
|
|
4574
|
-
channel: this.primaryChannel(this.
|
|
4675
|
+
channel: this.primaryChannel(this.activeVerifyUrls)
|
|
4575
4676
|
}), d;
|
|
4576
4677
|
}
|
|
4577
4678
|
async step() {
|
|
@@ -4587,7 +4688,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4587
4688
|
if (m.status !== 200)
|
|
4588
4689
|
return wt(a, i, s), await this.step();
|
|
4589
4690
|
const g = await m.json();
|
|
4590
|
-
if (g.status === "verified")
|
|
4691
|
+
if (this.applyVerifyUrlsFromResponse(g), g.status === "verified")
|
|
4591
4692
|
return this.handleAuthenticated(g), g;
|
|
4592
4693
|
if (g.status === "expired")
|
|
4593
4694
|
return this.updateActiveAuthRequestExpiry(g), this.updateCode(g.formattedCode ?? g.code), this.showExpiredState(), g;
|
|
@@ -4608,7 +4709,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4608
4709
|
try {
|
|
4609
4710
|
window.Pusher = Ki;
|
|
4610
4711
|
const s = (i.scheme ?? "https") === "https", a = i.port ?? (s ? 443 : 80);
|
|
4611
|
-
return this.echo = new
|
|
4712
|
+
return this.echo = new Xi({
|
|
4612
4713
|
broadcaster: "reverb",
|
|
4613
4714
|
key: i.key,
|
|
4614
4715
|
wsHost: i.host ?? new URL(this.currentConfig.serverUrl).hostname,
|
|
@@ -4639,7 +4740,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4639
4740
|
const s = () => {
|
|
4640
4741
|
this.pollTimer !== null || this.authenticated || this.destroyed || (this.pollTimer = window.setInterval(() => {
|
|
4641
4742
|
this.step().catch((a) => console.warn("[sendity-auth] poll failed", a));
|
|
4642
|
-
},
|
|
4743
|
+
}, sr));
|
|
4643
4744
|
};
|
|
4644
4745
|
i > 0 ? this.fallbackPollTimer = window.setTimeout(() => {
|
|
4645
4746
|
this.fallbackPollTimer = null, s();
|
|
@@ -4666,7 +4767,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4666
4767
|
this.dispatchEvent(new CustomEvent(i, { bubbles: !0, composed: !0, detail: s }));
|
|
4667
4768
|
}
|
|
4668
4769
|
toPublicAuthenticatedDetail(i) {
|
|
4669
|
-
const s = String(i.auth_request_id ?? i.authRequestId ?? this.activeAuthRequestId ?? ""), a = i.channel ?? this.primaryChannel(this.
|
|
4770
|
+
const s = String(i.auth_request_id ?? i.authRequestId ?? this.activeAuthRequestId ?? ""), a = i.channel ?? this.primaryChannel(this.activeVerifyUrls), h = i.expires_at ?? i.expiresAt;
|
|
4670
4771
|
return {
|
|
4671
4772
|
sessionId: s,
|
|
4672
4773
|
channel: a,
|
|
@@ -4680,6 +4781,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4680
4781
|
const s = i[0] ?? "";
|
|
4681
4782
|
return s.startsWith("mailto:") ? "email" : s.startsWith("whatsapp:") || s.startsWith("whatsapp://") ? "whatsapp" : "unknown";
|
|
4682
4783
|
}
|
|
4784
|
+
applyVerifyUrlsFromResponse(i) {
|
|
4785
|
+
const s = Array.isArray(i.verify_urls) ? i.verify_urls : Array.isArray(i.verifyUrls) ? i.verifyUrls : [], a = Array.isArray(i.verification_endpoints) ? i.verification_endpoints.map((d) => typeof d.url == "string" ? d.url : typeof d.scheme == "string" && typeof d.recipient == "string" ? `${d.scheme}:${d.recipient}` : "") : [], h = hr([...s, ...a].map(String));
|
|
4786
|
+
h.length !== 0 && (this.activeVerifyUrls = [...new Set(h)], this.renderVerifiers(this.activeVerifyUrls));
|
|
4787
|
+
}
|
|
4683
4788
|
authRequestStatusUrl(i, s) {
|
|
4684
4789
|
return new URL(this.joinUrl(i, `/auth-requests/${encodeURIComponent(s)}`)).toString();
|
|
4685
4790
|
}
|
|
@@ -4702,7 +4807,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4702
4807
|
}
|
|
4703
4808
|
waitingFooterMessage() {
|
|
4704
4809
|
if (!this.currentConfig) return "";
|
|
4705
|
-
const i =
|
|
4810
|
+
const i = B(this.currentConfig.lang), s = this.formatExpiryTime(this.activeAuthRequestExpiresAt, this.currentConfig.lang);
|
|
4706
4811
|
return s ? i.ui.footerWaitingUntil.replace("(Time)", s) : i.ui.footerWaiting;
|
|
4707
4812
|
}
|
|
4708
4813
|
formatExpiryTime(i, s) {
|
|
@@ -4745,24 +4850,24 @@ const ve = class ve extends HTMLElement {
|
|
|
4745
4850
|
this.lastCode = a, this.codeEl.textContent = a, this.codeContainerEl?.classList.remove("code--expired", "code--placeholder"), this.showCodeState();
|
|
4746
4851
|
} else
|
|
4747
4852
|
this.lastCode = void 0, this.showPlaceholderCode();
|
|
4748
|
-
this.currentConfig && this.renderVerifiers(this.
|
|
4853
|
+
this.currentConfig && this.renderVerifiers(this.activeVerifyUrls);
|
|
4749
4854
|
}
|
|
4750
4855
|
showPlaceholderCode() {
|
|
4751
|
-
this.codeEl && (this.lastCode = void 0, this.spinnerEl?.setAttribute("hidden", ""), this.codeEl.textContent = this.randomPlaceholderCode(), this.codeEl.removeAttribute("hidden"), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired", "code--exiting"
|
|
4856
|
+
this.codeEl && (this.lastCode = void 0, this.spinnerEl?.setAttribute("hidden", ""), this.codeEl.textContent = this.randomPlaceholderCode(), this.codeEl.removeAttribute("hidden"), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired", "code--exiting"), this.codeContainerEl?.classList.add("code--placeholder"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", ""));
|
|
4752
4857
|
}
|
|
4753
4858
|
randomPlaceholderCode() {
|
|
4754
4859
|
const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", s = () => i[Math.floor(Math.random() * i.length)], a = () => `${s()}${s()}${s()}`;
|
|
4755
4860
|
return `SDY-${a()}-${a()}`;
|
|
4756
4861
|
}
|
|
4757
4862
|
renderError(i) {
|
|
4758
|
-
this.codeEl && (this.codeEl.textContent = i), this.verifiersEl && (this.verifiersEl.innerHTML = "");
|
|
4863
|
+
this.rootEl?.classList.remove("sendity--verified"), this.rootEl?.classList.add("sendity--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--placeholder", "code--exiting"), this.codeContainerEl?.classList.add("code--expired"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.codeEl && (this.codeEl.textContent = i, this.codeEl.removeAttribute("hidden")), this.verifiersEl && (this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden")), this.isFooterHidden() || (this.setFooterIndicatorError(), this.footerMessageEl && (this.footerMessageEl.textContent = i), this.footerEl?.classList.add("footer--waiting"), this.footerBrandEl?.setAttribute("hidden", ""), this.footerStatusEl?.removeAttribute("hidden"), this.footerTimerEl?.setAttribute("hidden", ""));
|
|
4759
4864
|
}
|
|
4760
4865
|
showLoading() {
|
|
4761
4866
|
this.spinnerEl?.removeAttribute("hidden"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired", "code--placeholder"), this.codeEl?.setAttribute("hidden", ""), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", "");
|
|
4762
4867
|
}
|
|
4763
4868
|
showCodeState() {
|
|
4764
|
-
if (this.spinnerEl?.setAttribute("hidden", ""), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.codeContainerEl?.classList.remove("code--verified", "code--placeholder"), this.codeContainerEl?.classList.remove("code--exiting"
|
|
4765
|
-
const i =
|
|
4869
|
+
if (this.spinnerEl?.setAttribute("hidden", ""), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.codeContainerEl?.classList.remove("code--verified", "code--placeholder"), this.codeContainerEl?.classList.remove("code--exiting"), this.codeContainerEl?.classList.add("code--active"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.verifiersEl?.classList.remove("verifiers--exiting"), this.verifiersEl?.removeAttribute("aria-hidden"), this.codeEl?.removeAttribute("hidden"), this.currentConfig && this.promptEl) {
|
|
4870
|
+
const i = B(this.currentConfig.lang);
|
|
4766
4871
|
this.promptEl.textContent = i.ui.sendCodePrompt, this.promptEl.classList.remove("prompt--exiting"), this.promptEl.removeAttribute("aria-hidden"), this.promptEl.removeAttribute("hidden");
|
|
4767
4872
|
}
|
|
4768
4873
|
this.successEl?.setAttribute("hidden", "");
|
|
@@ -4773,11 +4878,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4773
4878
|
if (this.footerEl && (this.footerEl.hidden = s, this.footerEl.classList.remove("footer--leaving"), s || (this.footerEl.classList.add("footer--waiting", "footer--transitioning", "footer--verified"), window.setTimeout(() => {
|
|
4774
4879
|
this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl && (this.footerBrandEl.hidden = !0);
|
|
4775
4880
|
}, pe))), this.footerStatusEl && (this.footerStatusEl.hidden = s), this.footerMessageEl) {
|
|
4776
|
-
const a = i.
|
|
4777
|
-
this.footerMessageEl.textContent = a
|
|
4881
|
+
const a = i.channel ?? this.primaryChannel(this.activeVerifyUrls);
|
|
4882
|
+
this.footerMessageEl.textContent = this.verifiedSigningInMessage(a);
|
|
4778
4883
|
}
|
|
4779
|
-
if (this.footerTimerEl && (this.footerTimerEl.hidden = !
|
|
4780
|
-
const a =
|
|
4884
|
+
if (this.footerTimerEl && (this.footerTimerEl.hidden = !0, this.footerTimerEl.classList.remove("low"), this.footerTimerEl.textContent = ""), this.verifiersEl?.classList.add("verifiers--exiting"), this.currentConfig && this.successEl) {
|
|
4885
|
+
const a = B(this.currentConfig.lang), h = i.name && i.name.trim().length > 0 ? a.ui.successGreeting.replace("(Name)", i.name) : "You're in!";
|
|
4781
4886
|
this.successEl.innerHTML = `
|
|
4782
4887
|
<span class="success-check" aria-hidden="true">
|
|
4783
4888
|
<svg viewBox="0 0 512 512"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>
|
|
@@ -4789,8 +4894,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4789
4894
|
this.successTransitionTimer = null, this.verifiersEl && this.verifiersEl.setAttribute("aria-hidden", "true"), this.codeContainerEl?.setAttribute("aria-hidden", "true"), this.promptEl?.setAttribute("aria-hidden", "true");
|
|
4790
4895
|
}, pe);
|
|
4791
4896
|
}
|
|
4897
|
+
verifiedSigningInMessage(i) {
|
|
4898
|
+
return `Verified ${i === "whatsapp" ? "your phone number" : "your email address"} · signing you in...`;
|
|
4899
|
+
}
|
|
4792
4900
|
destinationAddressForChannel(i) {
|
|
4793
|
-
const s = this.
|
|
4901
|
+
const s = this.activeVerifyUrls, a = s.find((h) => this.channelClass(h) === i) ?? s[0];
|
|
4794
4902
|
if (!a) return null;
|
|
4795
4903
|
try {
|
|
4796
4904
|
const h = new URL(a, window.location.origin);
|
|
@@ -4815,10 +4923,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4815
4923
|
const s = this.currentConfig;
|
|
4816
4924
|
i.forEach((a, h) => {
|
|
4817
4925
|
if (h > 0 && i.length === 2) {
|
|
4818
|
-
const
|
|
4819
|
-
|
|
4820
|
-
const
|
|
4821
|
-
|
|
4926
|
+
const S = document.createElement("div");
|
|
4927
|
+
S.className = "divider", S.setAttribute("aria-hidden", "true");
|
|
4928
|
+
const O = document.createElement("span");
|
|
4929
|
+
O.textContent = s.lang === "de" ? "oder" : s.lang === "fr" ? "ou" : "or", S.appendChild(O), this.verifiersEl.appendChild(S);
|
|
4822
4930
|
}
|
|
4823
4931
|
const d = document.createElement("div");
|
|
4824
4932
|
d.className = "opt";
|
|
@@ -4828,15 +4936,15 @@ const ve = class ve extends HTMLElement {
|
|
|
4828
4936
|
});
|
|
4829
4937
|
const g = this.iconForUrl(a);
|
|
4830
4938
|
if (g) {
|
|
4831
|
-
const
|
|
4832
|
-
|
|
4939
|
+
const S = document.createElement("span");
|
|
4940
|
+
S.className = "icon", S.setAttribute("aria-hidden", "true"), S.innerHTML = g, m.appendChild(S);
|
|
4833
4941
|
}
|
|
4834
4942
|
const y = document.createElement("span");
|
|
4835
4943
|
y.className = "label", y.textContent = this.channelLabel(a, s.lang), m.appendChild(y), d.appendChild(m);
|
|
4836
|
-
const
|
|
4837
|
-
if (
|
|
4838
|
-
const
|
|
4839
|
-
|
|
4944
|
+
const x = this.destinationText(a, s.lang);
|
|
4945
|
+
if (x) {
|
|
4946
|
+
const S = document.createElement("a");
|
|
4947
|
+
S.className = "dest", S.href = m.href, S.target = "_blank", S.rel = "noopener noreferrer", S.textContent = x, d.appendChild(S);
|
|
4840
4948
|
}
|
|
4841
4949
|
this.verifiersEl.appendChild(d);
|
|
4842
4950
|
});
|
|
@@ -4853,7 +4961,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4853
4961
|
return "generic";
|
|
4854
4962
|
}
|
|
4855
4963
|
channelLabel(i, s) {
|
|
4856
|
-
const a =
|
|
4964
|
+
const a = B(s), h = this.channelClass(i);
|
|
4857
4965
|
if (h === "email") return a.labels.email;
|
|
4858
4966
|
if (h === "whatsapp") return a.labels.whatsapp;
|
|
4859
4967
|
try {
|
|
@@ -4864,7 +4972,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4864
4972
|
}
|
|
4865
4973
|
}
|
|
4866
4974
|
destinationText(i, s) {
|
|
4867
|
-
const h =
|
|
4975
|
+
const h = B(s).ui.toPrefix ?? "to";
|
|
4868
4976
|
try {
|
|
4869
4977
|
const d = new URL(i, window.location.origin);
|
|
4870
4978
|
if (d.protocol === "mailto:") {
|
|
@@ -4895,7 +5003,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4895
5003
|
return null;
|
|
4896
5004
|
}
|
|
4897
5005
|
labelForUrl(i, s) {
|
|
4898
|
-
const a =
|
|
5006
|
+
const a = B(s);
|
|
4899
5007
|
try {
|
|
4900
5008
|
const h = new URL(i, window.location.origin);
|
|
4901
5009
|
return h.protocol === "mailto:" ? `${a.ui.by} ${a.labels.email}` : h.protocol.startsWith("http") ? h.hostname : h.protocol === "whatsapp:" ? `${a.ui.by} ${a.labels.whatsapp}` : h.protocol.replace(":", "");
|
|
@@ -4904,19 +5012,19 @@ const ve = class ve extends HTMLElement {
|
|
|
4904
5012
|
}
|
|
4905
5013
|
}
|
|
4906
5014
|
buildLink(i, s) {
|
|
4907
|
-
const a = this.lastCode, h =
|
|
5015
|
+
const a = this.lastCode, h = B(s), d = window.location.host;
|
|
4908
5016
|
if (!a) return i;
|
|
4909
5017
|
if (i.startsWith("mailto:")) {
|
|
4910
|
-
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g),
|
|
4911
|
-
y.set("subject",
|
|
4912
|
-
const
|
|
4913
|
-
return `${m}?${
|
|
5018
|
+
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), x = this.applyTemplate(h.templates.emailSubject, d, a), S = this.applyTemplate(h.templates.emailBody, d, a);
|
|
5019
|
+
y.set("subject", x), y.set("body", S);
|
|
5020
|
+
const O = this.toQuery(y);
|
|
5021
|
+
return `${m}?${O}`;
|
|
4914
5022
|
}
|
|
4915
5023
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) {
|
|
4916
|
-
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g),
|
|
4917
|
-
y.set("text",
|
|
4918
|
-
const
|
|
4919
|
-
return `${m}?${
|
|
5024
|
+
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), x = this.applyTemplate(h.templates.whatsappText, d, a);
|
|
5025
|
+
y.set("text", x);
|
|
5026
|
+
const S = this.toQuery(y);
|
|
5027
|
+
return `${m}?${S}`;
|
|
4920
5028
|
}
|
|
4921
5029
|
return i;
|
|
4922
5030
|
}
|