@sendity/client 0.1.3 → 0.1.4
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 +5 -0
- package/dist/sendity-client.js +612 -587
- package/dist/tailwind.css +1 -1
- package/package.json +1 -1
package/dist/sendity-client.js
CHANGED
|
@@ -210,6 +210,16 @@ const pt = `<template id="sendity-tpl">
|
|
|
210
210
|
font-family: var(--sendity-code-font-family);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
.sendity .code--placeholder .formatted-code {
|
|
214
|
+
filter: blur(0.45rem);
|
|
215
|
+
opacity: 0.55;
|
|
216
|
+
user-select: none;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.sendity .code--placeholder {
|
|
220
|
+
pointer-events: none;
|
|
221
|
+
}
|
|
222
|
+
|
|
213
223
|
.sendity .verifiers {
|
|
214
224
|
display: grid;
|
|
215
225
|
grid-template-columns: 1fr;
|
|
@@ -560,8 +570,8 @@ class qe {
|
|
|
560
570
|
/**
|
|
561
571
|
* Listen for a whisper event on the channel instance.
|
|
562
572
|
*/
|
|
563
|
-
listenForWhisper(i,
|
|
564
|
-
return this.listen(".client-" + i,
|
|
573
|
+
listenForWhisper(i, s) {
|
|
574
|
+
return this.listen(".client-" + i, s);
|
|
565
575
|
}
|
|
566
576
|
/**
|
|
567
577
|
* Listen for an event on the channel instance.
|
|
@@ -578,8 +588,8 @@ class qe {
|
|
|
578
588
|
/**
|
|
579
589
|
* Stop listening for a whisper event on the channel instance.
|
|
580
590
|
*/
|
|
581
|
-
stopListeningForWhisper(i,
|
|
582
|
-
return this.stopListening(".client-" + i,
|
|
591
|
+
stopListeningForWhisper(i, s) {
|
|
592
|
+
return this.stopListening(".client-" + i, s);
|
|
583
593
|
}
|
|
584
594
|
}
|
|
585
595
|
class Ct {
|
|
@@ -613,8 +623,8 @@ class Ue extends qe {
|
|
|
613
623
|
/**
|
|
614
624
|
* Create a new class instance.
|
|
615
625
|
*/
|
|
616
|
-
constructor(i,
|
|
617
|
-
super(), this.name =
|
|
626
|
+
constructor(i, s, a) {
|
|
627
|
+
super(), this.name = s, this.pusher = i, this.options = a, this.eventFormatter = new Ct(this.options.namespace), this.subscribe();
|
|
618
628
|
}
|
|
619
629
|
/**
|
|
620
630
|
* Subscribe to a Pusher channel.
|
|
@@ -631,30 +641,30 @@ class Ue extends qe {
|
|
|
631
641
|
/**
|
|
632
642
|
* Listen for an event on the channel instance.
|
|
633
643
|
*/
|
|
634
|
-
listen(i,
|
|
635
|
-
return this.on(this.eventFormatter.format(i),
|
|
644
|
+
listen(i, s) {
|
|
645
|
+
return this.on(this.eventFormatter.format(i), s), this;
|
|
636
646
|
}
|
|
637
647
|
/**
|
|
638
648
|
* Listen for all events on the channel instance.
|
|
639
649
|
*/
|
|
640
650
|
listenToAll(i) {
|
|
641
|
-
return this.subscription.bind_global((
|
|
642
|
-
if (
|
|
651
|
+
return this.subscription.bind_global((s, a) => {
|
|
652
|
+
if (s.startsWith("pusher:"))
|
|
643
653
|
return;
|
|
644
654
|
let h = String(this.options.namespace ?? "").replace(
|
|
645
655
|
/\./g,
|
|
646
656
|
"\\"
|
|
647
|
-
), u =
|
|
657
|
+
), u = s.startsWith(h) ? s.substring(h.length + 1) : "." + s;
|
|
648
658
|
i(u, a);
|
|
649
659
|
}), this;
|
|
650
660
|
}
|
|
651
661
|
/**
|
|
652
662
|
* Stop listening for an event on the channel instance.
|
|
653
663
|
*/
|
|
654
|
-
stopListening(i,
|
|
655
|
-
return
|
|
664
|
+
stopListening(i, s) {
|
|
665
|
+
return s ? this.subscription.unbind(
|
|
656
666
|
this.eventFormatter.format(i),
|
|
657
|
-
|
|
667
|
+
s
|
|
658
668
|
) : this.subscription.unbind(this.eventFormatter.format(i)), this;
|
|
659
669
|
}
|
|
660
670
|
/**
|
|
@@ -675,25 +685,25 @@ class Ue extends qe {
|
|
|
675
685
|
* Register a callback to be called anytime a subscription error occurs.
|
|
676
686
|
*/
|
|
677
687
|
error(i) {
|
|
678
|
-
return this.on("pusher:subscription_error", (
|
|
679
|
-
i(
|
|
688
|
+
return this.on("pusher:subscription_error", (s) => {
|
|
689
|
+
i(s);
|
|
680
690
|
}), this;
|
|
681
691
|
}
|
|
682
692
|
/**
|
|
683
693
|
* Bind a channel to an event.
|
|
684
694
|
*/
|
|
685
|
-
on(i,
|
|
686
|
-
return this.subscription.bind(i,
|
|
695
|
+
on(i, s) {
|
|
696
|
+
return this.subscription.bind(i, s), this;
|
|
687
697
|
}
|
|
688
698
|
}
|
|
689
699
|
class St extends Ue {
|
|
690
700
|
/**
|
|
691
701
|
* Send a whisper event to other clients in the channel.
|
|
692
702
|
*/
|
|
693
|
-
whisper(i,
|
|
703
|
+
whisper(i, s) {
|
|
694
704
|
return this.pusher.channels.channels[this.name].trigger(
|
|
695
705
|
`client-${i}`,
|
|
696
|
-
|
|
706
|
+
s
|
|
697
707
|
), this;
|
|
698
708
|
}
|
|
699
709
|
}
|
|
@@ -701,45 +711,45 @@ class Di extends Ue {
|
|
|
701
711
|
/**
|
|
702
712
|
* Send a whisper event to other clients in the channel.
|
|
703
713
|
*/
|
|
704
|
-
whisper(i,
|
|
714
|
+
whisper(i, s) {
|
|
705
715
|
return this.pusher.channels.channels[this.name].trigger(
|
|
706
716
|
`client-${i}`,
|
|
707
|
-
|
|
717
|
+
s
|
|
708
718
|
), this;
|
|
709
719
|
}
|
|
710
720
|
}
|
|
711
|
-
class
|
|
721
|
+
class Fi extends St {
|
|
712
722
|
/**
|
|
713
723
|
* Register a callback to be called anytime the member list changes.
|
|
714
724
|
*/
|
|
715
725
|
here(i) {
|
|
716
|
-
return this.on("pusher:subscription_succeeded", (
|
|
717
|
-
i(Object.keys(
|
|
726
|
+
return this.on("pusher:subscription_succeeded", (s) => {
|
|
727
|
+
i(Object.keys(s.members).map((a) => s.members[a]));
|
|
718
728
|
}), this;
|
|
719
729
|
}
|
|
720
730
|
/**
|
|
721
731
|
* Listen for someone joining the channel.
|
|
722
732
|
*/
|
|
723
733
|
joining(i) {
|
|
724
|
-
return this.on("pusher:member_added", (
|
|
725
|
-
i(
|
|
734
|
+
return this.on("pusher:member_added", (s) => {
|
|
735
|
+
i(s.info);
|
|
726
736
|
}), this;
|
|
727
737
|
}
|
|
728
738
|
/**
|
|
729
739
|
* Send a whisper event to other clients in the channel.
|
|
730
740
|
*/
|
|
731
|
-
whisper(i,
|
|
741
|
+
whisper(i, s) {
|
|
732
742
|
return this.pusher.channels.channels[this.name].trigger(
|
|
733
743
|
`client-${i}`,
|
|
734
|
-
|
|
744
|
+
s
|
|
735
745
|
), this;
|
|
736
746
|
}
|
|
737
747
|
/**
|
|
738
748
|
* Listen for someone leaving the channel.
|
|
739
749
|
*/
|
|
740
750
|
leaving(i) {
|
|
741
|
-
return this.on("pusher:member_removed", (
|
|
742
|
-
i(
|
|
751
|
+
return this.on("pusher:member_removed", (s) => {
|
|
752
|
+
i(s.info);
|
|
743
753
|
}), this;
|
|
744
754
|
}
|
|
745
755
|
}
|
|
@@ -747,8 +757,8 @@ class Tt extends qe {
|
|
|
747
757
|
/**
|
|
748
758
|
* Create a new class instance.
|
|
749
759
|
*/
|
|
750
|
-
constructor(i,
|
|
751
|
-
super(), this.events = {}, this.listeners = {}, this.name =
|
|
760
|
+
constructor(i, s, a) {
|
|
761
|
+
super(), this.events = {}, this.listeners = {}, this.name = s, this.socket = i, this.options = a, this.eventFormatter = new Ct(this.options.namespace), this.subscribe();
|
|
752
762
|
}
|
|
753
763
|
/**
|
|
754
764
|
* Subscribe to a Socket.io channel.
|
|
@@ -771,21 +781,21 @@ class Tt extends qe {
|
|
|
771
781
|
/**
|
|
772
782
|
* Listen for an event on the channel instance.
|
|
773
783
|
*/
|
|
774
|
-
listen(i,
|
|
775
|
-
return this.on(this.eventFormatter.format(i),
|
|
784
|
+
listen(i, s) {
|
|
785
|
+
return this.on(this.eventFormatter.format(i), s), this;
|
|
776
786
|
}
|
|
777
787
|
/**
|
|
778
788
|
* Stop listening for an event on the channel instance.
|
|
779
789
|
*/
|
|
780
|
-
stopListening(i,
|
|
781
|
-
return this.unbindEvent(this.eventFormatter.format(i),
|
|
790
|
+
stopListening(i, s) {
|
|
791
|
+
return this.unbindEvent(this.eventFormatter.format(i), s), this;
|
|
782
792
|
}
|
|
783
793
|
/**
|
|
784
794
|
* Register a callback to be called anytime a subscription succeeds.
|
|
785
795
|
*/
|
|
786
796
|
subscribed(i) {
|
|
787
|
-
return this.on("connect", (
|
|
788
|
-
i(
|
|
797
|
+
return this.on("connect", (s) => {
|
|
798
|
+
i(s);
|
|
789
799
|
}), this;
|
|
790
800
|
}
|
|
791
801
|
/**
|
|
@@ -797,10 +807,10 @@ class Tt extends qe {
|
|
|
797
807
|
/**
|
|
798
808
|
* Bind the channel's socket to an event and store the callback.
|
|
799
809
|
*/
|
|
800
|
-
on(i,
|
|
810
|
+
on(i, s) {
|
|
801
811
|
return this.listeners[i] = this.listeners[i] || [], this.events[i] || (this.events[i] = (a, h) => {
|
|
802
812
|
this.name === a && this.listeners[i] && this.listeners[i].forEach((u) => u(h));
|
|
803
|
-
}, this.socket.on(i, this.events[i])), this.listeners[i].push(
|
|
813
|
+
}, this.socket.on(i, this.events[i])), this.listeners[i].push(s), this;
|
|
804
814
|
}
|
|
805
815
|
/**
|
|
806
816
|
* Unbind the channel's socket from all stored event callbacks.
|
|
@@ -813,31 +823,31 @@ class Tt extends qe {
|
|
|
813
823
|
/**
|
|
814
824
|
* Unbind the listeners for the given event.
|
|
815
825
|
*/
|
|
816
|
-
unbindEvent(i,
|
|
817
|
-
this.listeners[i] = this.listeners[i] || [],
|
|
818
|
-
(a) => a !==
|
|
819
|
-
)), (!
|
|
826
|
+
unbindEvent(i, s) {
|
|
827
|
+
this.listeners[i] = this.listeners[i] || [], s && (this.listeners[i] = this.listeners[i].filter(
|
|
828
|
+
(a) => a !== s
|
|
829
|
+
)), (!s || this.listeners[i].length === 0) && (this.events[i] && (this.socket.removeListener(i, this.events[i]), delete this.events[i]), delete this.listeners[i]);
|
|
820
830
|
}
|
|
821
831
|
}
|
|
822
|
-
class
|
|
832
|
+
class xt extends Tt {
|
|
823
833
|
/**
|
|
824
834
|
* Send a whisper event to other clients in the channel.
|
|
825
835
|
*/
|
|
826
|
-
whisper(i,
|
|
836
|
+
whisper(i, s) {
|
|
827
837
|
return this.socket.emit("client event", {
|
|
828
838
|
channel: this.name,
|
|
829
839
|
event: `client-${i}`,
|
|
830
|
-
data:
|
|
840
|
+
data: s
|
|
831
841
|
}), this;
|
|
832
842
|
}
|
|
833
843
|
}
|
|
834
|
-
class
|
|
844
|
+
class Wi extends xt {
|
|
835
845
|
/**
|
|
836
846
|
* Register a callback to be called anytime the member list changes.
|
|
837
847
|
*/
|
|
838
848
|
here(i) {
|
|
839
|
-
return this.on("presence:subscribed", (
|
|
840
|
-
i(
|
|
849
|
+
return this.on("presence:subscribed", (s) => {
|
|
850
|
+
i(s.map((a) => a.user_info));
|
|
841
851
|
}), this;
|
|
842
852
|
}
|
|
843
853
|
/**
|
|
@@ -846,17 +856,17 @@ class Fi extends _t {
|
|
|
846
856
|
joining(i) {
|
|
847
857
|
return this.on(
|
|
848
858
|
"presence:joining",
|
|
849
|
-
(
|
|
859
|
+
(s) => i(s.user_info)
|
|
850
860
|
), this;
|
|
851
861
|
}
|
|
852
862
|
/**
|
|
853
863
|
* Send a whisper event to other clients in the channel.
|
|
854
864
|
*/
|
|
855
|
-
whisper(i,
|
|
865
|
+
whisper(i, s) {
|
|
856
866
|
return this.socket.emit("client event", {
|
|
857
867
|
channel: this.name,
|
|
858
868
|
event: `client-${i}`,
|
|
859
|
-
data:
|
|
869
|
+
data: s
|
|
860
870
|
}), this;
|
|
861
871
|
}
|
|
862
872
|
/**
|
|
@@ -865,7 +875,7 @@ class Fi extends _t {
|
|
|
865
875
|
leaving(i) {
|
|
866
876
|
return this.on(
|
|
867
877
|
"presence:leaving",
|
|
868
|
-
(
|
|
878
|
+
(s) => i(s.user_info)
|
|
869
879
|
), this;
|
|
870
880
|
}
|
|
871
881
|
}
|
|
@@ -883,7 +893,7 @@ class ge extends qe {
|
|
|
883
893
|
/**
|
|
884
894
|
* Listen for an event on the channel instance.
|
|
885
895
|
*/
|
|
886
|
-
listen(i,
|
|
896
|
+
listen(i, s) {
|
|
887
897
|
return this;
|
|
888
898
|
}
|
|
889
899
|
/**
|
|
@@ -895,7 +905,7 @@ class ge extends qe {
|
|
|
895
905
|
/**
|
|
896
906
|
* Stop listening for an event on the channel instance.
|
|
897
907
|
*/
|
|
898
|
-
stopListening(i,
|
|
908
|
+
stopListening(i, s) {
|
|
899
909
|
return this;
|
|
900
910
|
}
|
|
901
911
|
/**
|
|
@@ -913,15 +923,15 @@ class ge extends qe {
|
|
|
913
923
|
/**
|
|
914
924
|
* Bind a channel to an event.
|
|
915
925
|
*/
|
|
916
|
-
on(i,
|
|
926
|
+
on(i, s) {
|
|
917
927
|
return this;
|
|
918
928
|
}
|
|
919
929
|
}
|
|
920
|
-
class
|
|
930
|
+
class _t extends ge {
|
|
921
931
|
/**
|
|
922
932
|
* Send a whisper event to other clients in the channel.
|
|
923
933
|
*/
|
|
924
|
-
whisper(i,
|
|
934
|
+
whisper(i, s) {
|
|
925
935
|
return this;
|
|
926
936
|
}
|
|
927
937
|
}
|
|
@@ -929,11 +939,11 @@ class Bi extends ge {
|
|
|
929
939
|
/**
|
|
930
940
|
* Send a whisper event to other clients in the channel.
|
|
931
941
|
*/
|
|
932
|
-
whisper(i,
|
|
942
|
+
whisper(i, s) {
|
|
933
943
|
return this;
|
|
934
944
|
}
|
|
935
945
|
}
|
|
936
|
-
class $i extends
|
|
946
|
+
class $i extends _t {
|
|
937
947
|
/**
|
|
938
948
|
* Register a callback to be called anytime the member list changes.
|
|
939
949
|
*/
|
|
@@ -949,7 +959,7 @@ class $i extends xt {
|
|
|
949
959
|
/**
|
|
950
960
|
* Send a whisper event to other clients in the channel.
|
|
951
961
|
*/
|
|
952
|
-
whisper(i,
|
|
962
|
+
whisper(i, s) {
|
|
953
963
|
return this;
|
|
954
964
|
}
|
|
955
965
|
/**
|
|
@@ -975,15 +985,15 @@ const Et = class kt {
|
|
|
975
985
|
...i,
|
|
976
986
|
broadcaster: i.broadcaster
|
|
977
987
|
};
|
|
978
|
-
let
|
|
979
|
-
|
|
988
|
+
let s = this.csrfToken();
|
|
989
|
+
s && (this.options.auth.headers["X-CSRF-TOKEN"] = s, this.options.userAuthentication.headers["X-CSRF-TOKEN"] = s), s = this.options.bearerToken, s && (this.options.auth.headers.Authorization = "Bearer " + s, this.options.userAuthentication.headers.Authorization = "Bearer " + s);
|
|
980
990
|
}
|
|
981
991
|
/**
|
|
982
992
|
* Extract the CSRF token from the page.
|
|
983
993
|
*/
|
|
984
994
|
csrfToken() {
|
|
985
|
-
var i,
|
|
986
|
-
return typeof window < "u" && (i = window.Laravel) != null && i.csrfToken ? window.Laravel.csrfToken : this.options.csrfToken ? this.options.csrfToken : typeof document < "u" && typeof document.querySelector == "function" ? ((
|
|
995
|
+
var i, s;
|
|
996
|
+
return typeof window < "u" && (i = window.Laravel) != null && i.csrfToken ? window.Laravel.csrfToken : this.options.csrfToken ? this.options.csrfToken : typeof document < "u" && typeof document.querySelector == "function" ? ((s = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : s.getAttribute("content")) ?? null : null;
|
|
987
997
|
}
|
|
988
998
|
};
|
|
989
999
|
Et._defaultOptions = {
|
|
@@ -1033,8 +1043,8 @@ class fe extends Ne {
|
|
|
1033
1043
|
/**
|
|
1034
1044
|
* Listen for an event on a channel instance.
|
|
1035
1045
|
*/
|
|
1036
|
-
listen(i,
|
|
1037
|
-
return this.channel(i).listen(
|
|
1046
|
+
listen(i, s, a) {
|
|
1047
|
+
return this.channel(i).listen(s, a);
|
|
1038
1048
|
}
|
|
1039
1049
|
/**
|
|
1040
1050
|
* Get a channel instance by name.
|
|
@@ -1070,7 +1080,7 @@ class fe extends Ne {
|
|
|
1070
1080
|
* Get a presence channel instance by name.
|
|
1071
1081
|
*/
|
|
1072
1082
|
presenceChannel(i) {
|
|
1073
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1083
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Fi(
|
|
1074
1084
|
this.pusher,
|
|
1075
1085
|
"presence-" + i,
|
|
1076
1086
|
this.options
|
|
@@ -1085,8 +1095,8 @@ class fe extends Ne {
|
|
|
1085
1095
|
"private-" + i,
|
|
1086
1096
|
"private-encrypted-" + i,
|
|
1087
1097
|
"presence-" + i
|
|
1088
|
-
].forEach((
|
|
1089
|
-
this.leaveChannel(
|
|
1098
|
+
].forEach((s) => {
|
|
1099
|
+
this.leaveChannel(s);
|
|
1090
1100
|
});
|
|
1091
1101
|
}
|
|
1092
1102
|
/**
|
|
@@ -1121,14 +1131,14 @@ class fe extends Ne {
|
|
|
1121
1131
|
* Subscribe to connection status changes.
|
|
1122
1132
|
*/
|
|
1123
1133
|
onConnectionChange(i) {
|
|
1124
|
-
const
|
|
1134
|
+
const s = () => {
|
|
1125
1135
|
i(this.connectionStatus());
|
|
1126
1136
|
}, a = ["state_change", "connected", "disconnected"];
|
|
1127
1137
|
return a.forEach((h) => {
|
|
1128
|
-
this.pusher.connection.bind(h,
|
|
1138
|
+
this.pusher.connection.bind(h, s);
|
|
1129
1139
|
}), () => {
|
|
1130
1140
|
a.forEach((h) => {
|
|
1131
|
-
this.pusher.connection.unbind(h,
|
|
1141
|
+
this.pusher.connection.unbind(h, s);
|
|
1132
1142
|
});
|
|
1133
1143
|
};
|
|
1134
1144
|
}
|
|
@@ -1152,8 +1162,8 @@ class Xi extends Ne {
|
|
|
1152
1162
|
this.options.host ?? void 0,
|
|
1153
1163
|
this.options
|
|
1154
1164
|
), this.socket.io.on("reconnect", () => {
|
|
1155
|
-
Object.values(this.channels).forEach((
|
|
1156
|
-
|
|
1165
|
+
Object.values(this.channels).forEach((s) => {
|
|
1166
|
+
s.subscribe();
|
|
1157
1167
|
});
|
|
1158
1168
|
});
|
|
1159
1169
|
}
|
|
@@ -1172,8 +1182,8 @@ class Xi extends Ne {
|
|
|
1172
1182
|
/**
|
|
1173
1183
|
* Listen for an event on a channel instance.
|
|
1174
1184
|
*/
|
|
1175
|
-
listen(i,
|
|
1176
|
-
return this.channel(i).listen(
|
|
1185
|
+
listen(i, s, a) {
|
|
1186
|
+
return this.channel(i).listen(s, a);
|
|
1177
1187
|
}
|
|
1178
1188
|
/**
|
|
1179
1189
|
* Get a channel instance by name.
|
|
@@ -1189,7 +1199,7 @@ class Xi extends Ne {
|
|
|
1189
1199
|
* Get a private channel instance by name.
|
|
1190
1200
|
*/
|
|
1191
1201
|
privateChannel(i) {
|
|
1192
|
-
return this.channels["private-" + i] || (this.channels["private-" + i] = new
|
|
1202
|
+
return this.channels["private-" + i] || (this.channels["private-" + i] = new xt(
|
|
1193
1203
|
this.socket,
|
|
1194
1204
|
"private-" + i,
|
|
1195
1205
|
this.options
|
|
@@ -1199,7 +1209,7 @@ class Xi extends Ne {
|
|
|
1199
1209
|
* Get a presence channel instance by name.
|
|
1200
1210
|
*/
|
|
1201
1211
|
presenceChannel(i) {
|
|
1202
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1212
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Wi(
|
|
1203
1213
|
this.socket,
|
|
1204
1214
|
"presence-" + i,
|
|
1205
1215
|
this.options
|
|
@@ -1209,8 +1219,8 @@ class Xi extends Ne {
|
|
|
1209
1219
|
* Leave the given channel, as well as its private and presence variants.
|
|
1210
1220
|
*/
|
|
1211
1221
|
leave(i) {
|
|
1212
|
-
[i, "private-" + i, "presence-" + i].forEach((
|
|
1213
|
-
this.leaveChannel(
|
|
1222
|
+
[i, "private-" + i, "presence-" + i].forEach((s) => {
|
|
1223
|
+
this.leaveChannel(s);
|
|
1214
1224
|
});
|
|
1215
1225
|
}
|
|
1216
1226
|
/**
|
|
@@ -1235,7 +1245,7 @@ class Xi extends Ne {
|
|
|
1235
1245
|
* Subscribe to connection status changes.
|
|
1236
1246
|
*/
|
|
1237
1247
|
onConnectionChange(i) {
|
|
1238
|
-
const
|
|
1248
|
+
const s = () => {
|
|
1239
1249
|
i(this.connectionStatus());
|
|
1240
1250
|
}, a = [
|
|
1241
1251
|
"connect",
|
|
@@ -1247,10 +1257,10 @@ class Xi extends Ne {
|
|
|
1247
1257
|
"reconnect_failed"
|
|
1248
1258
|
];
|
|
1249
1259
|
return a.forEach((h) => {
|
|
1250
|
-
this.socket.on(h,
|
|
1260
|
+
this.socket.on(h, s);
|
|
1251
1261
|
}), () => {
|
|
1252
1262
|
a.forEach((h) => {
|
|
1253
|
-
this.socket.off(h,
|
|
1263
|
+
this.socket.off(h, s);
|
|
1254
1264
|
});
|
|
1255
1265
|
};
|
|
1256
1266
|
}
|
|
@@ -1273,7 +1283,7 @@ class mt extends Ne {
|
|
|
1273
1283
|
/**
|
|
1274
1284
|
* Listen for an event on a channel instance.
|
|
1275
1285
|
*/
|
|
1276
|
-
listen(i,
|
|
1286
|
+
listen(i, s, a) {
|
|
1277
1287
|
return new ge();
|
|
1278
1288
|
}
|
|
1279
1289
|
/**
|
|
@@ -1286,7 +1296,7 @@ class mt extends Ne {
|
|
|
1286
1296
|
* Get a private channel instance by name.
|
|
1287
1297
|
*/
|
|
1288
1298
|
privateChannel(i) {
|
|
1289
|
-
return new
|
|
1299
|
+
return new _t();
|
|
1290
1300
|
}
|
|
1291
1301
|
/**
|
|
1292
1302
|
* Get a private encrypted channel instance by name.
|
|
@@ -1410,8 +1420,8 @@ class Vi {
|
|
|
1410
1420
|
/**
|
|
1411
1421
|
* Listen for an event on a channel instance.
|
|
1412
1422
|
*/
|
|
1413
|
-
listen(i,
|
|
1414
|
-
return this.connector.listen(i,
|
|
1423
|
+
listen(i, s, a) {
|
|
1424
|
+
return this.connector.listen(i, s, a);
|
|
1415
1425
|
}
|
|
1416
1426
|
/**
|
|
1417
1427
|
* Get a private channel instance by name.
|
|
@@ -1458,8 +1468,8 @@ class Vi {
|
|
|
1458
1468
|
*/
|
|
1459
1469
|
registerVueRequestInterceptor() {
|
|
1460
1470
|
Vue.http.interceptors.push(
|
|
1461
|
-
(i,
|
|
1462
|
-
this.socketId() && i.headers.set("X-Socket-ID", this.socketId()),
|
|
1471
|
+
(i, s) => {
|
|
1472
|
+
this.socketId() && i.headers.set("X-Socket-ID", this.socketId()), s();
|
|
1463
1473
|
}
|
|
1464
1474
|
);
|
|
1465
1475
|
}
|
|
@@ -1476,7 +1486,7 @@ class Vi {
|
|
|
1476
1486
|
*/
|
|
1477
1487
|
registerjQueryAjaxSetup() {
|
|
1478
1488
|
typeof jQuery.ajax < "u" && jQuery.ajaxPrefilter(
|
|
1479
|
-
(i,
|
|
1489
|
+
(i, s, a) => {
|
|
1480
1490
|
this.socketId() && a.setRequestHeader("X-Socket-Id", this.socketId());
|
|
1481
1491
|
}
|
|
1482
1492
|
);
|
|
@@ -1496,7 +1506,7 @@ class Vi {
|
|
|
1496
1506
|
function Ji(v) {
|
|
1497
1507
|
return v && v.__esModule && Object.prototype.hasOwnProperty.call(v, "default") ? v.default : v;
|
|
1498
1508
|
}
|
|
1499
|
-
var
|
|
1509
|
+
var Le = { exports: {} };
|
|
1500
1510
|
var gt;
|
|
1501
1511
|
function Gi() {
|
|
1502
1512
|
return gt || (gt = 1, (function(v, i) {
|
|
@@ -1505,19 +1515,19 @@ function Gi() {
|
|
|
1505
1515
|
})(self, () => (
|
|
1506
1516
|
/******/
|
|
1507
1517
|
(() => {
|
|
1508
|
-
var
|
|
1518
|
+
var s = {
|
|
1509
1519
|
/***/
|
|
1510
1520
|
594(m, g) {
|
|
1511
|
-
var
|
|
1512
|
-
var
|
|
1513
|
-
return
|
|
1514
|
-
S.__proto__ =
|
|
1515
|
-
} || function(S,
|
|
1516
|
-
for (var q in
|
|
1517
|
-
},
|
|
1521
|
+
var b = this && this.__extends || /* @__PURE__ */ (function() {
|
|
1522
|
+
var x = function(d, f) {
|
|
1523
|
+
return x = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(S, P) {
|
|
1524
|
+
S.__proto__ = P;
|
|
1525
|
+
} || function(S, P) {
|
|
1526
|
+
for (var q in P) P.hasOwnProperty(q) && (S[q] = P[q]);
|
|
1527
|
+
}, x(d, f);
|
|
1518
1528
|
};
|
|
1519
1529
|
return function(d, f) {
|
|
1520
|
-
|
|
1530
|
+
x(d, f);
|
|
1521
1531
|
function S() {
|
|
1522
1532
|
this.constructor = d;
|
|
1523
1533
|
}
|
|
@@ -1525,44 +1535,44 @@ function Gi() {
|
|
|
1525
1535
|
};
|
|
1526
1536
|
})();
|
|
1527
1537
|
Object.defineProperty(g, "__esModule", { value: !0 });
|
|
1528
|
-
var
|
|
1538
|
+
var _ = 256, w = (
|
|
1529
1539
|
/** @class */
|
|
1530
1540
|
(function() {
|
|
1531
|
-
function
|
|
1541
|
+
function x(d) {
|
|
1532
1542
|
d === void 0 && (d = "="), this._paddingCharacter = d;
|
|
1533
1543
|
}
|
|
1534
|
-
return
|
|
1544
|
+
return x.prototype.encodedLength = function(d) {
|
|
1535
1545
|
return this._paddingCharacter ? (d + 2) / 3 * 4 | 0 : (d * 8 + 5) / 6 | 0;
|
|
1536
|
-
},
|
|
1546
|
+
}, x.prototype.encode = function(d) {
|
|
1537
1547
|
for (var f = "", S = 0; S < d.length - 2; S += 3) {
|
|
1538
|
-
var
|
|
1539
|
-
f += this._encodeByte(
|
|
1548
|
+
var P = d[S] << 16 | d[S + 1] << 8 | d[S + 2];
|
|
1549
|
+
f += this._encodeByte(P >>> 18 & 63), f += this._encodeByte(P >>> 12 & 63), f += this._encodeByte(P >>> 6 & 63), f += this._encodeByte(P >>> 0 & 63);
|
|
1540
1550
|
}
|
|
1541
1551
|
var q = d.length - S;
|
|
1542
1552
|
if (q > 0) {
|
|
1543
|
-
var
|
|
1544
|
-
f += this._encodeByte(
|
|
1553
|
+
var P = d[S] << 16 | (q === 2 ? d[S + 1] << 8 : 0);
|
|
1554
|
+
f += this._encodeByte(P >>> 18 & 63), f += this._encodeByte(P >>> 12 & 63), q === 2 ? f += this._encodeByte(P >>> 6 & 63) : f += this._paddingCharacter || "", f += this._paddingCharacter || "";
|
|
1545
1555
|
}
|
|
1546
1556
|
return f;
|
|
1547
|
-
},
|
|
1557
|
+
}, x.prototype.maxDecodedLength = function(d) {
|
|
1548
1558
|
return this._paddingCharacter ? d / 4 * 3 | 0 : (d * 6 + 7) / 8 | 0;
|
|
1549
|
-
},
|
|
1559
|
+
}, x.prototype.decodedLength = function(d) {
|
|
1550
1560
|
return this.maxDecodedLength(d.length - this._getPaddingLength(d));
|
|
1551
|
-
},
|
|
1561
|
+
}, x.prototype.decode = function(d) {
|
|
1552
1562
|
if (d.length === 0)
|
|
1553
1563
|
return new Uint8Array(0);
|
|
1554
|
-
for (var f = this._getPaddingLength(d), S = d.length - f,
|
|
1555
|
-
J = this._decodeChar(d.charCodeAt(j + 0)), D = this._decodeChar(d.charCodeAt(j + 1)), H = this._decodeChar(d.charCodeAt(j + 2)), G = this._decodeChar(d.charCodeAt(j + 3)),
|
|
1556
|
-
if (j < S - 1 && (J = this._decodeChar(d.charCodeAt(j)), D = this._decodeChar(d.charCodeAt(j + 1)),
|
|
1564
|
+
for (var f = this._getPaddingLength(d), S = d.length - f, P = new Uint8Array(this.maxDecodedLength(S)), q = 0, j = 0, z = 0, J = 0, D = 0, H = 0, G = 0; j < S - 4; j += 4)
|
|
1565
|
+
J = this._decodeChar(d.charCodeAt(j + 0)), D = this._decodeChar(d.charCodeAt(j + 1)), H = this._decodeChar(d.charCodeAt(j + 2)), G = this._decodeChar(d.charCodeAt(j + 3)), P[q++] = J << 2 | D >>> 4, P[q++] = D << 4 | H >>> 2, P[q++] = H << 6 | G, z |= J & _, z |= D & _, z |= H & _, z |= G & _;
|
|
1566
|
+
if (j < S - 1 && (J = this._decodeChar(d.charCodeAt(j)), D = this._decodeChar(d.charCodeAt(j + 1)), P[q++] = J << 2 | D >>> 4, z |= J & _, z |= D & _), j < S - 2 && (H = this._decodeChar(d.charCodeAt(j + 2)), P[q++] = D << 4 | H >>> 2, z |= H & _), j < S - 3 && (G = this._decodeChar(d.charCodeAt(j + 3)), P[q++] = H << 6 | G, z |= G & _), z !== 0)
|
|
1557
1567
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
1558
|
-
return
|
|
1559
|
-
},
|
|
1568
|
+
return P;
|
|
1569
|
+
}, x.prototype._encodeByte = function(d) {
|
|
1560
1570
|
var f = d;
|
|
1561
1571
|
return f += 65, f += 25 - d >>> 8 & 6, f += 51 - d >>> 8 & -75, f += 61 - d >>> 8 & -15, f += 62 - d >>> 8 & 3, String.fromCharCode(f);
|
|
1562
|
-
},
|
|
1563
|
-
var f =
|
|
1564
|
-
return f += (42 - d & d - 44) >>> 8 & -
|
|
1565
|
-
},
|
|
1572
|
+
}, x.prototype._decodeChar = function(d) {
|
|
1573
|
+
var f = _;
|
|
1574
|
+
return f += (42 - d & d - 44) >>> 8 & -_ + d - 43 + 62, f += (46 - d & d - 48) >>> 8 & -_ + d - 47 + 63, f += (47 - d & d - 58) >>> 8 & -_ + d - 48 + 52, f += (64 - d & d - 91) >>> 8 & -_ + d - 65 + 0, f += (96 - d & d - 123) >>> 8 & -_ + d - 97 + 26, f;
|
|
1575
|
+
}, x.prototype._getPaddingLength = function(d) {
|
|
1566
1576
|
var f = 0;
|
|
1567
1577
|
if (this._paddingCharacter) {
|
|
1568
1578
|
for (var S = d.length - 1; S >= 0 && d[S] === this._paddingCharacter; S--)
|
|
@@ -1571,88 +1581,88 @@ function Gi() {
|
|
|
1571
1581
|
throw new Error("Base64Coder: incorrect padding");
|
|
1572
1582
|
}
|
|
1573
1583
|
return f;
|
|
1574
|
-
},
|
|
1584
|
+
}, x;
|
|
1575
1585
|
})()
|
|
1576
1586
|
);
|
|
1577
1587
|
g.Coder = w;
|
|
1578
1588
|
var R = new w();
|
|
1579
|
-
function T(
|
|
1580
|
-
return R.encode(
|
|
1589
|
+
function T(x) {
|
|
1590
|
+
return R.encode(x);
|
|
1581
1591
|
}
|
|
1582
1592
|
g.encode = T;
|
|
1583
|
-
function A(
|
|
1584
|
-
return R.decode(
|
|
1593
|
+
function A(x) {
|
|
1594
|
+
return R.decode(x);
|
|
1585
1595
|
}
|
|
1586
1596
|
g.decode = A;
|
|
1587
|
-
var
|
|
1597
|
+
var F = (
|
|
1588
1598
|
/** @class */
|
|
1589
|
-
(function(
|
|
1590
|
-
|
|
1599
|
+
(function(x) {
|
|
1600
|
+
b(d, x);
|
|
1591
1601
|
function d() {
|
|
1592
|
-
return
|
|
1602
|
+
return x !== null && x.apply(this, arguments) || this;
|
|
1593
1603
|
}
|
|
1594
1604
|
return d.prototype._encodeByte = function(f) {
|
|
1595
1605
|
var S = f;
|
|
1596
1606
|
return S += 65, S += 25 - f >>> 8 & 6, S += 51 - f >>> 8 & -75, S += 61 - f >>> 8 & -13, S += 62 - f >>> 8 & 49, String.fromCharCode(S);
|
|
1597
1607
|
}, d.prototype._decodeChar = function(f) {
|
|
1598
|
-
var S =
|
|
1599
|
-
return S += (44 - f & f - 46) >>> 8 & -
|
|
1608
|
+
var S = _;
|
|
1609
|
+
return S += (44 - f & f - 46) >>> 8 & -_ + f - 45 + 62, S += (94 - f & f - 96) >>> 8 & -_ + f - 95 + 63, S += (47 - f & f - 58) >>> 8 & -_ + f - 48 + 52, S += (64 - f & f - 91) >>> 8 & -_ + f - 65 + 0, S += (96 - f & f - 123) >>> 8 & -_ + f - 97 + 26, S;
|
|
1600
1610
|
}, d;
|
|
1601
1611
|
})(w)
|
|
1602
1612
|
);
|
|
1603
|
-
g.URLSafeCoder =
|
|
1604
|
-
var N = new
|
|
1605
|
-
function
|
|
1606
|
-
return N.encode(
|
|
1613
|
+
g.URLSafeCoder = F;
|
|
1614
|
+
var N = new F();
|
|
1615
|
+
function W(x) {
|
|
1616
|
+
return N.encode(x);
|
|
1607
1617
|
}
|
|
1608
|
-
g.encodeURLSafe =
|
|
1609
|
-
function te(
|
|
1610
|
-
return N.decode(
|
|
1618
|
+
g.encodeURLSafe = W;
|
|
1619
|
+
function te(x) {
|
|
1620
|
+
return N.decode(x);
|
|
1611
1621
|
}
|
|
1612
|
-
g.decodeURLSafe = te, g.encodedLength = function(
|
|
1613
|
-
return R.encodedLength(
|
|
1614
|
-
}, g.maxDecodedLength = function(
|
|
1615
|
-
return R.maxDecodedLength(
|
|
1616
|
-
}, g.decodedLength = function(
|
|
1617
|
-
return R.decodedLength(
|
|
1622
|
+
g.decodeURLSafe = te, g.encodedLength = function(x) {
|
|
1623
|
+
return R.encodedLength(x);
|
|
1624
|
+
}, g.maxDecodedLength = function(x) {
|
|
1625
|
+
return R.maxDecodedLength(x);
|
|
1626
|
+
}, g.decodedLength = function(x) {
|
|
1627
|
+
return R.decodedLength(x);
|
|
1618
1628
|
};
|
|
1619
1629
|
},
|
|
1620
1630
|
/***/
|
|
1621
1631
|
978(m, g) {
|
|
1622
|
-
var
|
|
1623
|
-
function
|
|
1632
|
+
var b = "utf8: invalid source encoding";
|
|
1633
|
+
function _(w) {
|
|
1624
1634
|
for (var R = [], T = 0; T < w.length; T++) {
|
|
1625
1635
|
var A = w[T];
|
|
1626
1636
|
if (A & 128) {
|
|
1627
|
-
var
|
|
1637
|
+
var F = void 0;
|
|
1628
1638
|
if (A < 224) {
|
|
1629
1639
|
if (T >= w.length)
|
|
1630
|
-
throw new Error(
|
|
1640
|
+
throw new Error(b);
|
|
1631
1641
|
var N = w[++T];
|
|
1632
1642
|
if ((N & 192) !== 128)
|
|
1633
|
-
throw new Error(
|
|
1634
|
-
A = (A & 31) << 6 | N & 63,
|
|
1643
|
+
throw new Error(b);
|
|
1644
|
+
A = (A & 31) << 6 | N & 63, F = 128;
|
|
1635
1645
|
} else if (A < 240) {
|
|
1636
1646
|
if (T >= w.length - 1)
|
|
1637
|
-
throw new Error(
|
|
1638
|
-
var N = w[++T],
|
|
1639
|
-
if ((N & 192) !== 128 || (
|
|
1640
|
-
throw new Error(
|
|
1641
|
-
A = (A & 15) << 12 | (N & 63) << 6 |
|
|
1647
|
+
throw new Error(b);
|
|
1648
|
+
var N = w[++T], W = w[++T];
|
|
1649
|
+
if ((N & 192) !== 128 || (W & 192) !== 128)
|
|
1650
|
+
throw new Error(b);
|
|
1651
|
+
A = (A & 15) << 12 | (N & 63) << 6 | W & 63, F = 2048;
|
|
1642
1652
|
} else if (A < 248) {
|
|
1643
1653
|
if (T >= w.length - 2)
|
|
1644
|
-
throw new Error(
|
|
1645
|
-
var N = w[++T],
|
|
1646
|
-
if ((N & 192) !== 128 || (
|
|
1647
|
-
throw new Error(
|
|
1648
|
-
A = (A & 15) << 18 | (N & 63) << 12 | (
|
|
1654
|
+
throw new Error(b);
|
|
1655
|
+
var N = w[++T], W = w[++T], te = w[++T];
|
|
1656
|
+
if ((N & 192) !== 128 || (W & 192) !== 128 || (te & 192) !== 128)
|
|
1657
|
+
throw new Error(b);
|
|
1658
|
+
A = (A & 15) << 18 | (N & 63) << 12 | (W & 63) << 6 | te & 63, F = 65536;
|
|
1649
1659
|
} else
|
|
1650
|
-
throw new Error(
|
|
1651
|
-
if (A <
|
|
1652
|
-
throw new Error(
|
|
1660
|
+
throw new Error(b);
|
|
1661
|
+
if (A < F || A >= 55296 && A <= 57343)
|
|
1662
|
+
throw new Error(b);
|
|
1653
1663
|
if (A >= 65536) {
|
|
1654
1664
|
if (A > 1114111)
|
|
1655
|
-
throw new Error(
|
|
1665
|
+
throw new Error(b);
|
|
1656
1666
|
A -= 65536, R.push(String.fromCharCode(55296 | A >> 10)), A = 56320 | A & 1023;
|
|
1657
1667
|
}
|
|
1658
1668
|
}
|
|
@@ -1660,36 +1670,36 @@ function Gi() {
|
|
|
1660
1670
|
}
|
|
1661
1671
|
return R.join("");
|
|
1662
1672
|
}
|
|
1663
|
-
g.D4 =
|
|
1673
|
+
g.D4 = _;
|
|
1664
1674
|
},
|
|
1665
1675
|
/***/
|
|
1666
|
-
721(m, g,
|
|
1667
|
-
m.exports =
|
|
1676
|
+
721(m, g, b) {
|
|
1677
|
+
m.exports = b(207).default;
|
|
1668
1678
|
},
|
|
1669
1679
|
/***/
|
|
1670
|
-
207(m, g,
|
|
1671
|
-
|
|
1680
|
+
207(m, g, b) {
|
|
1681
|
+
b.d(g, {
|
|
1672
1682
|
default: () => (
|
|
1673
1683
|
/* binding */
|
|
1674
1684
|
ue
|
|
1675
1685
|
)
|
|
1676
1686
|
});
|
|
1677
|
-
class
|
|
1687
|
+
class _ {
|
|
1678
1688
|
constructor(e, t) {
|
|
1679
1689
|
this.lastId = 0, this.prefix = e, this.name = t;
|
|
1680
1690
|
}
|
|
1681
1691
|
create(e) {
|
|
1682
1692
|
this.lastId++;
|
|
1683
|
-
var t = this.lastId, r = this.prefix + t,
|
|
1693
|
+
var t = this.lastId, r = this.prefix + t, o = this.name + "[" + t + "]", c = !1, l = function() {
|
|
1684
1694
|
c || (e.apply(null, arguments), c = !0);
|
|
1685
1695
|
};
|
|
1686
|
-
return this[t] = l, { number: t, id: r, name:
|
|
1696
|
+
return this[t] = l, { number: t, id: r, name: o, callback: l };
|
|
1687
1697
|
}
|
|
1688
1698
|
remove(e) {
|
|
1689
1699
|
delete this[e.number];
|
|
1690
1700
|
}
|
|
1691
1701
|
}
|
|
1692
|
-
var w = new
|
|
1702
|
+
var w = new _("_pusher_script_", "Pusher.ScriptReceivers"), R = {
|
|
1693
1703
|
VERSION: "8.5.0",
|
|
1694
1704
|
PROTOCOL: 7,
|
|
1695
1705
|
wsPort: 80,
|
|
@@ -1723,19 +1733,19 @@ function Gi() {
|
|
|
1723
1733
|
this.options = e, this.receivers = e.receivers || w, this.loading = {};
|
|
1724
1734
|
}
|
|
1725
1735
|
load(e, t, r) {
|
|
1726
|
-
var
|
|
1727
|
-
if (
|
|
1728
|
-
|
|
1736
|
+
var o = this;
|
|
1737
|
+
if (o.loading[e] && o.loading[e].length > 0)
|
|
1738
|
+
o.loading[e].push(r);
|
|
1729
1739
|
else {
|
|
1730
|
-
|
|
1731
|
-
var c = C.createScriptRequest(
|
|
1732
|
-
if (
|
|
1733
|
-
var
|
|
1734
|
-
delete
|
|
1740
|
+
o.loading[e] = [r];
|
|
1741
|
+
var c = C.createScriptRequest(o.getPath(e, t)), l = o.receivers.create(function(p) {
|
|
1742
|
+
if (o.receivers.remove(l), o.loading[e]) {
|
|
1743
|
+
var y = o.loading[e];
|
|
1744
|
+
delete o.loading[e];
|
|
1735
1745
|
for (var E = function(I) {
|
|
1736
1746
|
I || c.cleanup();
|
|
1737
|
-
}, k = 0; k <
|
|
1738
|
-
|
|
1747
|
+
}, k = 0; k < y.length; k++)
|
|
1748
|
+
y[k](p, E);
|
|
1739
1749
|
}
|
|
1740
1750
|
});
|
|
1741
1751
|
c.send(l);
|
|
@@ -1749,14 +1759,14 @@ function Gi() {
|
|
|
1749
1759
|
return this.getRoot(t) + "/" + e + this.options.suffix + ".js";
|
|
1750
1760
|
}
|
|
1751
1761
|
}
|
|
1752
|
-
var
|
|
1762
|
+
var F = new _("_pusher_dependencies", "Pusher.DependenciesReceivers"), N = new A({
|
|
1753
1763
|
cdn_http: T.cdn_http,
|
|
1754
1764
|
cdn_https: T.cdn_https,
|
|
1755
1765
|
version: T.VERSION,
|
|
1756
1766
|
suffix: T.dependency_suffix,
|
|
1757
|
-
receivers:
|
|
1767
|
+
receivers: F
|
|
1758
1768
|
});
|
|
1759
|
-
const
|
|
1769
|
+
const W = {
|
|
1760
1770
|
baseUrl: "https://pusher.com",
|
|
1761
1771
|
urls: {
|
|
1762
1772
|
authenticationEndpoint: {
|
|
@@ -1775,12 +1785,12 @@ function Gi() {
|
|
|
1775
1785
|
fullUrl: "https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"
|
|
1776
1786
|
}
|
|
1777
1787
|
}
|
|
1778
|
-
},
|
|
1779
|
-
const e = "See:", t =
|
|
1788
|
+
}, x = { buildLogSuffix: function(n) {
|
|
1789
|
+
const e = "See:", t = W.urls[n];
|
|
1780
1790
|
if (!t)
|
|
1781
1791
|
return "";
|
|
1782
1792
|
let r;
|
|
1783
|
-
return t.fullUrl ? r = t.fullUrl : t.path && (r =
|
|
1793
|
+
return t.fullUrl ? r = t.fullUrl : t.path && (r = W.baseUrl + t.path), r ? `${e} ${r}` : "";
|
|
1784
1794
|
} };
|
|
1785
1795
|
var d;
|
|
1786
1796
|
(function(n) {
|
|
@@ -1796,7 +1806,7 @@ function Gi() {
|
|
|
1796
1806
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1797
1807
|
}
|
|
1798
1808
|
}
|
|
1799
|
-
class
|
|
1809
|
+
class P extends Error {
|
|
1800
1810
|
constructor(e) {
|
|
1801
1811
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1802
1812
|
}
|
|
@@ -1831,7 +1841,7 @@ function Gi() {
|
|
|
1831
1841
|
super(t), this.status = e, Object.setPrototypeOf(this, new.target.prototype);
|
|
1832
1842
|
}
|
|
1833
1843
|
}
|
|
1834
|
-
const
|
|
1844
|
+
const Pt = function(n, e, t, r, o) {
|
|
1835
1845
|
const c = C.createXHR();
|
|
1836
1846
|
c.open("POST", t.endpoint, !0), c.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
1837
1847
|
for (var l in t.headers)
|
|
@@ -1844,28 +1854,28 @@ function Gi() {
|
|
|
1844
1854
|
return c.onreadystatechange = function() {
|
|
1845
1855
|
if (c.readyState === 4)
|
|
1846
1856
|
if (c.status === 200) {
|
|
1847
|
-
let p,
|
|
1857
|
+
let p, y = !1;
|
|
1848
1858
|
try {
|
|
1849
|
-
p = JSON.parse(c.responseText),
|
|
1859
|
+
p = JSON.parse(c.responseText), y = !0;
|
|
1850
1860
|
} catch {
|
|
1851
|
-
|
|
1861
|
+
o(new H(200, `JSON returned from ${r.toString()} endpoint was invalid, yet status code was 200. Data was: ${c.responseText}`), null);
|
|
1852
1862
|
}
|
|
1853
|
-
|
|
1863
|
+
y && o(null, p);
|
|
1854
1864
|
} else {
|
|
1855
1865
|
let p = "";
|
|
1856
1866
|
switch (r) {
|
|
1857
1867
|
case d.UserAuthentication:
|
|
1858
|
-
p =
|
|
1868
|
+
p = x.buildLogSuffix("authenticationEndpoint");
|
|
1859
1869
|
break;
|
|
1860
1870
|
case d.ChannelAuthorization:
|
|
1861
|
-
p = `Clients must be authorized to join private or presence channels. ${
|
|
1871
|
+
p = `Clients must be authorized to join private or presence channels. ${x.buildLogSuffix("authorizationEndpoint")}`;
|
|
1862
1872
|
break;
|
|
1863
1873
|
}
|
|
1864
|
-
|
|
1874
|
+
o(new H(c.status, `Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${c.status} from ${t.endpoint}. ${p}`), null);
|
|
1865
1875
|
}
|
|
1866
1876
|
}, c.send(e), c;
|
|
1867
1877
|
};
|
|
1868
|
-
function
|
|
1878
|
+
function Lt(n) {
|
|
1869
1879
|
return qt(It(n));
|
|
1870
1880
|
}
|
|
1871
1881
|
var ne = String.fromCharCode, oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Rt = function(n) {
|
|
@@ -1885,9 +1895,9 @@ function Gi() {
|
|
|
1885
1895
|
return n.replace(/[\s\S]{1,3}/g, Ot);
|
|
1886
1896
|
};
|
|
1887
1897
|
class Ut {
|
|
1888
|
-
constructor(e, t, r,
|
|
1898
|
+
constructor(e, t, r, o) {
|
|
1889
1899
|
this.clear = t, this.timer = e(() => {
|
|
1890
|
-
this.timer && (this.timer =
|
|
1900
|
+
this.timer && (this.timer = o(this.timer));
|
|
1891
1901
|
}, r);
|
|
1892
1902
|
}
|
|
1893
1903
|
isRunning() {
|
|
@@ -1936,8 +1946,8 @@ function Gi() {
|
|
|
1936
1946
|
function M(n, ...e) {
|
|
1937
1947
|
for (var t = 0; t < e.length; t++) {
|
|
1938
1948
|
var r = e[t];
|
|
1939
|
-
for (var
|
|
1940
|
-
r[
|
|
1949
|
+
for (var o in r)
|
|
1950
|
+
r[o] && r[o].constructor && r[o].constructor === Object ? n[o] = M(n[o] || {}, r[o]) : n[o] = r[o];
|
|
1941
1951
|
}
|
|
1942
1952
|
return n;
|
|
1943
1953
|
}
|
|
@@ -1952,7 +1962,7 @@ function Gi() {
|
|
|
1952
1962
|
return -1;
|
|
1953
1963
|
if (t && n.indexOf === t)
|
|
1954
1964
|
return n.indexOf(e);
|
|
1955
|
-
for (var r = 0,
|
|
1965
|
+
for (var r = 0, o = n.length; r < o; r++)
|
|
1956
1966
|
if (n[r] === e)
|
|
1957
1967
|
return r;
|
|
1958
1968
|
return -1;
|
|
@@ -1977,20 +1987,20 @@ function Gi() {
|
|
|
1977
1987
|
for (var r = 0; r < n.length; r++)
|
|
1978
1988
|
e.call(t || window, n[r], r, n);
|
|
1979
1989
|
}
|
|
1980
|
-
function
|
|
1990
|
+
function Fe(n, e) {
|
|
1981
1991
|
for (var t = [], r = 0; r < n.length; r++)
|
|
1982
1992
|
t.push(e(n[r], r, n, t));
|
|
1983
1993
|
return t;
|
|
1984
1994
|
}
|
|
1985
|
-
function
|
|
1995
|
+
function Ft(n, e) {
|
|
1986
1996
|
var t = {};
|
|
1987
|
-
return B(n, function(r,
|
|
1988
|
-
t[
|
|
1997
|
+
return B(n, function(r, o) {
|
|
1998
|
+
t[o] = e(r);
|
|
1989
1999
|
}), t;
|
|
1990
2000
|
}
|
|
1991
|
-
function
|
|
1992
|
-
e = e || function(
|
|
1993
|
-
return !!
|
|
2001
|
+
function We(n, e) {
|
|
2002
|
+
e = e || function(o) {
|
|
2003
|
+
return !!o;
|
|
1994
2004
|
};
|
|
1995
2005
|
for (var t = [], r = 0; r < n.length; r++)
|
|
1996
2006
|
e(n[r], r, n, t) && t.push(n[r]);
|
|
@@ -1998,11 +2008,11 @@ function Gi() {
|
|
|
1998
2008
|
}
|
|
1999
2009
|
function Be(n, e) {
|
|
2000
2010
|
var t = {};
|
|
2001
|
-
return B(n, function(r,
|
|
2002
|
-
(e && e(r,
|
|
2011
|
+
return B(n, function(r, o) {
|
|
2012
|
+
(e && e(r, o, n, t) || r) && (t[o] = r);
|
|
2003
2013
|
}), t;
|
|
2004
2014
|
}
|
|
2005
|
-
function
|
|
2015
|
+
function Wt(n) {
|
|
2006
2016
|
var e = [];
|
|
2007
2017
|
return B(n, function(t, r) {
|
|
2008
2018
|
e.push([r, t]);
|
|
@@ -2021,40 +2031,40 @@ function Gi() {
|
|
|
2021
2031
|
return !0;
|
|
2022
2032
|
}
|
|
2023
2033
|
function $t(n) {
|
|
2024
|
-
return
|
|
2025
|
-
return typeof e == "object" && (e = ae(e)), encodeURIComponent(
|
|
2034
|
+
return Ft(n, function(e) {
|
|
2035
|
+
return typeof e == "object" && (e = ae(e)), encodeURIComponent(Lt(e.toString()));
|
|
2026
2036
|
});
|
|
2027
2037
|
}
|
|
2028
2038
|
function Xt(n) {
|
|
2029
2039
|
var e = Be(n, function(r) {
|
|
2030
2040
|
return r !== void 0;
|
|
2031
|
-
}), t =
|
|
2041
|
+
}), t = Fe(Wt($t(e)), U.method("join", "=")).join("&");
|
|
2032
2042
|
return t;
|
|
2033
2043
|
}
|
|
2034
2044
|
function Vt(n) {
|
|
2035
2045
|
var e = [], t = [];
|
|
2036
|
-
return (function r(
|
|
2037
|
-
var l, p,
|
|
2038
|
-
switch (typeof
|
|
2046
|
+
return (function r(o, c) {
|
|
2047
|
+
var l, p, y;
|
|
2048
|
+
switch (typeof o) {
|
|
2039
2049
|
case "object":
|
|
2040
|
-
if (!
|
|
2050
|
+
if (!o)
|
|
2041
2051
|
return null;
|
|
2042
2052
|
for (l = 0; l < e.length; l += 1)
|
|
2043
|
-
if (e[l] ===
|
|
2053
|
+
if (e[l] === o)
|
|
2044
2054
|
return { $ref: t[l] };
|
|
2045
|
-
if (e.push(
|
|
2046
|
-
for (
|
|
2047
|
-
|
|
2055
|
+
if (e.push(o), t.push(c), Object.prototype.toString.apply(o) === "[object Array]")
|
|
2056
|
+
for (y = [], l = 0; l < o.length; l += 1)
|
|
2057
|
+
y[l] = r(o[l], c + "[" + l + "]");
|
|
2048
2058
|
else {
|
|
2049
|
-
|
|
2050
|
-
for (p in
|
|
2051
|
-
Object.prototype.hasOwnProperty.call(
|
|
2059
|
+
y = {};
|
|
2060
|
+
for (p in o)
|
|
2061
|
+
Object.prototype.hasOwnProperty.call(o, p) && (y[p] = r(o[p], c + "[" + JSON.stringify(p) + "]"));
|
|
2052
2062
|
}
|
|
2053
|
-
return
|
|
2063
|
+
return y;
|
|
2054
2064
|
case "number":
|
|
2055
2065
|
case "string":
|
|
2056
2066
|
case "boolean":
|
|
2057
|
-
return
|
|
2067
|
+
return o;
|
|
2058
2068
|
}
|
|
2059
2069
|
})(n, "$");
|
|
2060
2070
|
}
|
|
@@ -2091,17 +2101,17 @@ function Gi() {
|
|
|
2091
2101
|
ue.log ? ue.log(r) : ue.logToConsole && e.bind(this)(r);
|
|
2092
2102
|
}
|
|
2093
2103
|
}
|
|
2094
|
-
const
|
|
2095
|
-
var Gt = function(n, e, t, r,
|
|
2096
|
-
(t.headers !== void 0 || t.headersProvider != null) &&
|
|
2104
|
+
const L = new Jt();
|
|
2105
|
+
var Gt = function(n, e, t, r, o) {
|
|
2106
|
+
(t.headers !== void 0 || t.headersProvider != null) && L.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
2097
2107
|
var c = n.nextAuthCallbackID.toString();
|
|
2098
2108
|
n.nextAuthCallbackID++;
|
|
2099
2109
|
var l = n.getDocument(), p = l.createElement("script");
|
|
2100
2110
|
n.auth_callbacks[c] = function(k) {
|
|
2101
|
-
|
|
2111
|
+
o(null, k);
|
|
2102
2112
|
};
|
|
2103
|
-
var
|
|
2104
|
-
p.src = t.endpoint + "?callback=" + encodeURIComponent(
|
|
2113
|
+
var y = "Pusher.auth_callbacks['" + c + "']";
|
|
2114
|
+
p.src = t.endpoint + "?callback=" + encodeURIComponent(y) + "&" + e;
|
|
2105
2115
|
var E = l.getElementsByTagName("head")[0] || l.documentElement;
|
|
2106
2116
|
E.insertBefore(p, E.firstChild);
|
|
2107
2117
|
};
|
|
@@ -2119,8 +2129,8 @@ function Gi() {
|
|
|
2119
2129
|
}) : t.script.onreadystatechange = function() {
|
|
2120
2130
|
(t.script.readyState === "loaded" || t.script.readyState === "complete") && e.callback(null);
|
|
2121
2131
|
}, t.script.async === void 0 && document.attachEvent && /opera/i.test(navigator.userAgent) ? (t.errorScript = document.createElement("script"), t.errorScript.id = e.id + "_error", t.errorScript.text = e.name + "('" + r + "');", t.script.async = t.errorScript.async = !1) : t.script.async = !0;
|
|
2122
|
-
var
|
|
2123
|
-
|
|
2132
|
+
var o = document.getElementsByTagName("head")[0];
|
|
2133
|
+
o.insertBefore(t.script, o.firstChild), t.errorScript && o.insertBefore(t.errorScript, t.script.nextSibling);
|
|
2124
2134
|
}
|
|
2125
2135
|
cleanup() {
|
|
2126
2136
|
this.script && (this.script.onload = this.script.onerror = null, this.script.onreadystatechange = null), this.script && this.script.parentNode && this.script.parentNode.removeChild(this.script), this.errorScript && this.errorScript.parentNode && this.errorScript.parentNode.removeChild(this.errorScript), this.script = null, this.errorScript = null;
|
|
@@ -2142,8 +2152,8 @@ function Gi() {
|
|
|
2142
2152
|
}
|
|
2143
2153
|
var Zt = function(n, e) {
|
|
2144
2154
|
return function(t, r) {
|
|
2145
|
-
var
|
|
2146
|
-
w.remove(p), l.cleanup(), E && E.host && (n.host = E.host), r && r(
|
|
2155
|
+
var o = "http" + (e ? "s" : "") + "://", c = o + (n.host || n.options.host) + n.options.path, l = C.createJSONPRequest(c, t), p = C.ScriptReceivers.create(function(y, E) {
|
|
2156
|
+
w.remove(p), l.cleanup(), E && E.host && (n.host = E.host), r && r(y, E);
|
|
2147
2157
|
});
|
|
2148
2158
|
l.send(p);
|
|
2149
2159
|
};
|
|
@@ -2152,30 +2162,30 @@ function Gi() {
|
|
|
2152
2162
|
getAgent: Zt
|
|
2153
2163
|
};
|
|
2154
2164
|
const tn = en;
|
|
2155
|
-
function
|
|
2156
|
-
var r = n + (e.useTLS ? "s" : ""),
|
|
2157
|
-
return r + "://" +
|
|
2165
|
+
function be(n, e, t) {
|
|
2166
|
+
var r = n + (e.useTLS ? "s" : ""), o = e.useTLS ? e.hostTLS : e.hostNonTLS;
|
|
2167
|
+
return r + "://" + o + t;
|
|
2158
2168
|
}
|
|
2159
|
-
function
|
|
2169
|
+
function ye(n, e) {
|
|
2160
2170
|
var t = "/app/" + n, r = "?protocol=" + T.PROTOCOL + "&client=js&version=" + T.VERSION + (e ? "&" + e : "");
|
|
2161
2171
|
return t + r;
|
|
2162
2172
|
}
|
|
2163
2173
|
var nn = {
|
|
2164
2174
|
getInitial: function(n, e) {
|
|
2165
|
-
var t = (e.httpPath || "") +
|
|
2166
|
-
return
|
|
2175
|
+
var t = (e.httpPath || "") + ye(n, "flash=false");
|
|
2176
|
+
return be("ws", e, t);
|
|
2167
2177
|
}
|
|
2168
2178
|
}, rn = {
|
|
2169
2179
|
getInitial: function(n, e) {
|
|
2170
|
-
var t = (e.httpPath || "/pusher") +
|
|
2171
|
-
return
|
|
2180
|
+
var t = (e.httpPath || "/pusher") + ye(n);
|
|
2181
|
+
return be("http", e, t);
|
|
2172
2182
|
}
|
|
2173
2183
|
}, sn = {
|
|
2174
2184
|
getInitial: function(n, e) {
|
|
2175
|
-
return
|
|
2185
|
+
return be("http", e, e.httpPath || "/pusher");
|
|
2176
2186
|
},
|
|
2177
2187
|
getPath: function(n, e) {
|
|
2178
|
-
return
|
|
2188
|
+
return ye(n);
|
|
2179
2189
|
}
|
|
2180
2190
|
};
|
|
2181
2191
|
class on {
|
|
@@ -2186,8 +2196,8 @@ function Gi() {
|
|
|
2186
2196
|
return this._callbacks[we(e)];
|
|
2187
2197
|
}
|
|
2188
2198
|
add(e, t, r) {
|
|
2189
|
-
var
|
|
2190
|
-
this._callbacks[
|
|
2199
|
+
var o = we(e);
|
|
2200
|
+
this._callbacks[o] = this._callbacks[o] || [], this._callbacks[o].push({
|
|
2191
2201
|
fn: t,
|
|
2192
2202
|
context: r
|
|
2193
2203
|
});
|
|
@@ -2197,14 +2207,14 @@ function Gi() {
|
|
|
2197
2207
|
this._callbacks = {};
|
|
2198
2208
|
return;
|
|
2199
2209
|
}
|
|
2200
|
-
var
|
|
2201
|
-
t || r ? this.removeCallback(
|
|
2210
|
+
var o = e ? [we(e)] : De(this._callbacks);
|
|
2211
|
+
t || r ? this.removeCallback(o, t, r) : this.removeAllCallbacks(o);
|
|
2202
2212
|
}
|
|
2203
2213
|
removeCallback(e, t, r) {
|
|
2204
|
-
ie(e, function(
|
|
2205
|
-
this._callbacks[
|
|
2214
|
+
ie(e, function(o) {
|
|
2215
|
+
this._callbacks[o] = We(this._callbacks[o] || [], function(c) {
|
|
2206
2216
|
return t && t !== c.fn || r && r !== c.context;
|
|
2207
|
-
}), this._callbacks[
|
|
2217
|
+
}), this._callbacks[o].length === 0 && delete this._callbacks[o];
|
|
2208
2218
|
}, this);
|
|
2209
2219
|
}
|
|
2210
2220
|
removeAllCallbacks(e) {
|
|
@@ -2230,25 +2240,25 @@ function Gi() {
|
|
|
2230
2240
|
return this.callbacks.remove(e, t, r), this;
|
|
2231
2241
|
}
|
|
2232
2242
|
unbind_global(e) {
|
|
2233
|
-
return e ? (this.global_callbacks =
|
|
2243
|
+
return e ? (this.global_callbacks = We(this.global_callbacks || [], (t) => t !== e), this) : (this.global_callbacks = [], this);
|
|
2234
2244
|
}
|
|
2235
2245
|
unbind_all() {
|
|
2236
2246
|
return this.unbind(), this.unbind_global(), this;
|
|
2237
2247
|
}
|
|
2238
2248
|
emit(e, t, r) {
|
|
2239
|
-
for (var
|
|
2240
|
-
this.global_callbacks[
|
|
2249
|
+
for (var o = 0; o < this.global_callbacks.length; o++)
|
|
2250
|
+
this.global_callbacks[o](e, t);
|
|
2241
2251
|
var c = this.callbacks.get(e), l = [];
|
|
2242
2252
|
if (r ? l.push(t, r) : t && l.push(t), c && c.length > 0)
|
|
2243
|
-
for (var
|
|
2244
|
-
c[
|
|
2253
|
+
for (var o = 0; o < c.length; o++)
|
|
2254
|
+
c[o].fn.apply(c[o].context || window, l);
|
|
2245
2255
|
else this.failThrough && this.failThrough(e, t);
|
|
2246
2256
|
return this;
|
|
2247
2257
|
}
|
|
2248
2258
|
}
|
|
2249
2259
|
class an extends $ {
|
|
2250
|
-
constructor(e, t, r,
|
|
2251
|
-
super(), this.initialize = C.transportConnectionInitializer, this.hooks = e, this.name = t, this.priority = r, this.key =
|
|
2260
|
+
constructor(e, t, r, o, c) {
|
|
2261
|
+
super(), this.initialize = C.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();
|
|
2252
2262
|
}
|
|
2253
2263
|
handlesActivityChecks() {
|
|
2254
2264
|
return !!this.hooks.handlesActivityChecks;
|
|
@@ -2267,7 +2277,7 @@ function Gi() {
|
|
|
2267
2277
|
this.onError(t), this.changeState("closed");
|
|
2268
2278
|
}), !1;
|
|
2269
2279
|
}
|
|
2270
|
-
return this.bindListeners(),
|
|
2280
|
+
return this.bindListeners(), L.debug("Connecting", { transport: this.name, url: e }), this.changeState("connecting"), !0;
|
|
2271
2281
|
}
|
|
2272
2282
|
close() {
|
|
2273
2283
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
@@ -2332,8 +2342,8 @@ function Gi() {
|
|
|
2332
2342
|
isSupported(e) {
|
|
2333
2343
|
return this.hooks.isSupported(e);
|
|
2334
2344
|
}
|
|
2335
|
-
createConnection(e, t, r,
|
|
2336
|
-
return new an(this.hooks, e, t, r,
|
|
2345
|
+
createConnection(e, t, r, o) {
|
|
2346
|
+
return new an(this.hooks, e, t, r, o);
|
|
2337
2347
|
}
|
|
2338
2348
|
}
|
|
2339
2349
|
var cn = new ee({
|
|
@@ -2421,18 +2431,18 @@ function Gi() {
|
|
|
2421
2431
|
}
|
|
2422
2432
|
}
|
|
2423
2433
|
var vn = new gn();
|
|
2424
|
-
class
|
|
2434
|
+
class bn {
|
|
2425
2435
|
constructor(e, t, r) {
|
|
2426
2436
|
this.manager = e, this.transport = t, this.minPingDelay = r.minPingDelay, this.maxPingDelay = r.maxPingDelay, this.pingDelay = void 0;
|
|
2427
2437
|
}
|
|
2428
|
-
createConnection(e, t, r,
|
|
2429
|
-
|
|
2438
|
+
createConnection(e, t, r, o) {
|
|
2439
|
+
o = M({}, o, {
|
|
2430
2440
|
activityTimeout: this.pingDelay
|
|
2431
2441
|
});
|
|
2432
|
-
var c = this.transport.createConnection(e, t, r,
|
|
2433
|
-
c.unbind("open", p), c.bind("closed",
|
|
2434
|
-
},
|
|
2435
|
-
if (c.unbind("closed",
|
|
2442
|
+
var c = this.transport.createConnection(e, t, r, o), l = null, p = function() {
|
|
2443
|
+
c.unbind("open", p), c.bind("closed", y), l = U.now();
|
|
2444
|
+
}, y = (E) => {
|
|
2445
|
+
if (c.unbind("closed", y), E.code === 1002 || E.code === 1003)
|
|
2436
2446
|
this.manager.reportDeath();
|
|
2437
2447
|
else if (!E.wasClean && l) {
|
|
2438
2448
|
var k = U.now() - l;
|
|
@@ -2460,8 +2470,8 @@ function Gi() {
|
|
|
2460
2470
|
data: t
|
|
2461
2471
|
};
|
|
2462
2472
|
return e.user_id && (r.user_id = e.user_id), r;
|
|
2463
|
-
} catch (
|
|
2464
|
-
throw { type: "MessageParseError", error:
|
|
2473
|
+
} catch (o) {
|
|
2474
|
+
throw { type: "MessageParseError", error: o, data: n.data };
|
|
2465
2475
|
}
|
|
2466
2476
|
},
|
|
2467
2477
|
encodeMessage: function(n) {
|
|
@@ -2499,7 +2509,7 @@ function Gi() {
|
|
|
2499
2509
|
} : null;
|
|
2500
2510
|
}
|
|
2501
2511
|
}, K = Ke;
|
|
2502
|
-
class
|
|
2512
|
+
class yn extends $ {
|
|
2503
2513
|
constructor(e, t) {
|
|
2504
2514
|
super(), this.id = e, this.transport = t, this.activityTimeout = t.activityTimeout, this.bindListeners();
|
|
2505
2515
|
}
|
|
@@ -2510,8 +2520,8 @@ function Gi() {
|
|
|
2510
2520
|
return this.transport.send(e);
|
|
2511
2521
|
}
|
|
2512
2522
|
send_event(e, t, r) {
|
|
2513
|
-
var
|
|
2514
|
-
return r && (
|
|
2523
|
+
var o = { event: e, data: t };
|
|
2524
|
+
return r && (o.channel = r), L.debug("Event sent", o), this.send(K.encodeMessage(o));
|
|
2515
2525
|
}
|
|
2516
2526
|
ping() {
|
|
2517
2527
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -2522,9 +2532,9 @@ function Gi() {
|
|
|
2522
2532
|
bindListeners() {
|
|
2523
2533
|
var e = {
|
|
2524
2534
|
message: (r) => {
|
|
2525
|
-
var
|
|
2535
|
+
var o;
|
|
2526
2536
|
try {
|
|
2527
|
-
|
|
2537
|
+
o = K.decodeMessage(r);
|
|
2528
2538
|
} catch (c) {
|
|
2529
2539
|
this.emit("error", {
|
|
2530
2540
|
type: "MessageParseError",
|
|
@@ -2532,12 +2542,12 @@ function Gi() {
|
|
|
2532
2542
|
data: r.data
|
|
2533
2543
|
});
|
|
2534
2544
|
}
|
|
2535
|
-
if (
|
|
2536
|
-
switch (
|
|
2545
|
+
if (o !== void 0) {
|
|
2546
|
+
switch (L.debug("Event recd", o), o.event) {
|
|
2537
2547
|
case "pusher:error":
|
|
2538
2548
|
this.emit("error", {
|
|
2539
2549
|
type: "PusherError",
|
|
2540
|
-
data:
|
|
2550
|
+
data: o.data
|
|
2541
2551
|
});
|
|
2542
2552
|
break;
|
|
2543
2553
|
case "pusher:ping":
|
|
@@ -2547,7 +2557,7 @@ function Gi() {
|
|
|
2547
2557
|
this.emit("pong");
|
|
2548
2558
|
break;
|
|
2549
2559
|
}
|
|
2550
|
-
this.emit("message",
|
|
2560
|
+
this.emit("message", o);
|
|
2551
2561
|
}
|
|
2552
2562
|
},
|
|
2553
2563
|
activity: () => {
|
|
@@ -2560,12 +2570,12 @@ function Gi() {
|
|
|
2560
2570
|
t(), r && r.code && this.handleCloseEvent(r), this.transport = null, this.emit("closed");
|
|
2561
2571
|
}
|
|
2562
2572
|
}, t = () => {
|
|
2563
|
-
B(e, (r,
|
|
2564
|
-
this.transport.unbind(
|
|
2573
|
+
B(e, (r, o) => {
|
|
2574
|
+
this.transport.unbind(o, r);
|
|
2565
2575
|
});
|
|
2566
2576
|
};
|
|
2567
|
-
B(e, (r,
|
|
2568
|
-
this.transport.bind(
|
|
2577
|
+
B(e, (r, o) => {
|
|
2578
|
+
this.transport.bind(o, r);
|
|
2569
2579
|
});
|
|
2570
2580
|
}
|
|
2571
2581
|
handleCloseEvent(e) {
|
|
@@ -2591,7 +2601,7 @@ function Gi() {
|
|
|
2591
2601
|
return;
|
|
2592
2602
|
}
|
|
2593
2603
|
t.action === "connected" ? this.finish("connected", {
|
|
2594
|
-
connection: new
|
|
2604
|
+
connection: new yn(t.id, this.transport),
|
|
2595
2605
|
activityTimeout: t.activityTimeout
|
|
2596
2606
|
}) : (this.finish(t.action, { error: t.error }), this.transport.close());
|
|
2597
2607
|
}, this.onClosed = (e) => {
|
|
@@ -2617,8 +2627,8 @@ function Gi() {
|
|
|
2617
2627
|
}
|
|
2618
2628
|
class Ce extends $ {
|
|
2619
2629
|
constructor(e, t) {
|
|
2620
|
-
super(function(r,
|
|
2621
|
-
|
|
2630
|
+
super(function(r, o) {
|
|
2631
|
+
L.debug("No callbacks on " + e + " for " + r);
|
|
2622
2632
|
}), this.name = e, this.pusher = t, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
2623
2633
|
}
|
|
2624
2634
|
authorize(e, t) {
|
|
@@ -2628,8 +2638,8 @@ function Gi() {
|
|
|
2628
2638
|
if (e.indexOf("client-") !== 0)
|
|
2629
2639
|
throw new f("Event '" + e + "' does not start with 'client-'");
|
|
2630
2640
|
if (!this.subscribed) {
|
|
2631
|
-
var r =
|
|
2632
|
-
|
|
2641
|
+
var r = x.buildLogSuffix("triggeringClientEvents");
|
|
2642
|
+
L.warn(`Client event triggered before channel 'subscription_succeeded' event . ${r}`);
|
|
2633
2643
|
}
|
|
2634
2644
|
return this.pusher.send_event(e, t, this.name);
|
|
2635
2645
|
}
|
|
@@ -2643,8 +2653,8 @@ function Gi() {
|
|
|
2643
2653
|
else if (t === "pusher_internal:subscription_count")
|
|
2644
2654
|
this.handleSubscriptionCountEvent(e);
|
|
2645
2655
|
else if (t.indexOf("pusher_internal:") !== 0) {
|
|
2646
|
-
var
|
|
2647
|
-
this.emit(t, r,
|
|
2656
|
+
var o = {};
|
|
2657
|
+
this.emit(t, r, o);
|
|
2648
2658
|
}
|
|
2649
2659
|
}
|
|
2650
2660
|
handleSubscriptionSucceededEvent(e) {
|
|
@@ -2655,7 +2665,7 @@ function Gi() {
|
|
|
2655
2665
|
}
|
|
2656
2666
|
subscribe() {
|
|
2657
2667
|
this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (e, t) => {
|
|
2658
|
-
e ? (this.subscriptionPending = !1,
|
|
2668
|
+
e ? (this.subscriptionPending = !1, L.error(e.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
|
|
2659
2669
|
type: "AuthError",
|
|
2660
2670
|
error: e.message
|
|
2661
2671
|
}, e instanceof H ? { status: e.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
|
|
@@ -2718,7 +2728,7 @@ function Gi() {
|
|
|
2718
2728
|
}
|
|
2719
2729
|
}
|
|
2720
2730
|
var Tn = function(n, e, t, r) {
|
|
2721
|
-
function
|
|
2731
|
+
function o(c) {
|
|
2722
2732
|
return c instanceof t ? c : new t(function(l) {
|
|
2723
2733
|
l(c);
|
|
2724
2734
|
});
|
|
@@ -2731,7 +2741,7 @@ function Gi() {
|
|
|
2731
2741
|
l(I);
|
|
2732
2742
|
}
|
|
2733
2743
|
}
|
|
2734
|
-
function
|
|
2744
|
+
function y(k) {
|
|
2735
2745
|
try {
|
|
2736
2746
|
E(r.throw(k));
|
|
2737
2747
|
} catch (I) {
|
|
@@ -2739,29 +2749,29 @@ function Gi() {
|
|
|
2739
2749
|
}
|
|
2740
2750
|
}
|
|
2741
2751
|
function E(k) {
|
|
2742
|
-
k.done ? c(k.value) :
|
|
2752
|
+
k.done ? c(k.value) : o(k.value).then(p, y);
|
|
2743
2753
|
}
|
|
2744
2754
|
E((r = r.apply(n, e || [])).next());
|
|
2745
2755
|
});
|
|
2746
2756
|
};
|
|
2747
|
-
class
|
|
2757
|
+
class xn extends Se {
|
|
2748
2758
|
constructor(e, t) {
|
|
2749
2759
|
super(e, t), this.members = new Sn();
|
|
2750
2760
|
}
|
|
2751
2761
|
authorize(e, t) {
|
|
2752
|
-
super.authorize(e, (r,
|
|
2762
|
+
super.authorize(e, (r, o) => Tn(this, void 0, void 0, function* () {
|
|
2753
2763
|
if (!r)
|
|
2754
|
-
if (
|
|
2755
|
-
var c = JSON.parse(
|
|
2764
|
+
if (o = o, o.channel_data != null) {
|
|
2765
|
+
var c = JSON.parse(o.channel_data);
|
|
2756
2766
|
this.members.setMyID(c.user_id);
|
|
2757
2767
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
2758
2768
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
2759
2769
|
else {
|
|
2760
|
-
let l =
|
|
2761
|
-
|
|
2770
|
+
let l = x.buildLogSuffix("authorizationEndpoint");
|
|
2771
|
+
L.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${l}, or the user should be signed in.`), t("Invalid auth response");
|
|
2762
2772
|
return;
|
|
2763
2773
|
}
|
|
2764
|
-
t(r,
|
|
2774
|
+
t(r, o);
|
|
2765
2775
|
}));
|
|
2766
2776
|
}
|
|
2767
2777
|
handleEvent(e) {
|
|
@@ -2769,8 +2779,8 @@ function Gi() {
|
|
|
2769
2779
|
if (t.indexOf("pusher_internal:") === 0)
|
|
2770
2780
|
this.handleInternalEvent(e);
|
|
2771
2781
|
else {
|
|
2772
|
-
var r = e.data,
|
|
2773
|
-
e.user_id && (
|
|
2782
|
+
var r = e.data, o = {};
|
|
2783
|
+
e.user_id && (o.user_id = e.user_id), this.emit(t, r, o);
|
|
2774
2784
|
}
|
|
2775
2785
|
}
|
|
2776
2786
|
handleInternalEvent(e) {
|
|
@@ -2783,8 +2793,8 @@ function Gi() {
|
|
|
2783
2793
|
this.handleSubscriptionCountEvent(e);
|
|
2784
2794
|
break;
|
|
2785
2795
|
case "pusher_internal:member_added":
|
|
2786
|
-
var
|
|
2787
|
-
this.emit("pusher:member_added",
|
|
2796
|
+
var o = this.members.addMember(r);
|
|
2797
|
+
this.emit("pusher:member_added", o);
|
|
2788
2798
|
break;
|
|
2789
2799
|
case "pusher_internal:member_removed":
|
|
2790
2800
|
var c = this.members.removeMember(r);
|
|
@@ -2799,23 +2809,23 @@ function Gi() {
|
|
|
2799
2809
|
this.members.reset(), super.disconnect();
|
|
2800
2810
|
}
|
|
2801
2811
|
}
|
|
2802
|
-
var
|
|
2812
|
+
var _n = b(978), Te = b(594);
|
|
2803
2813
|
class En extends Se {
|
|
2804
2814
|
constructor(e, t, r) {
|
|
2805
2815
|
super(e, t), this.key = null, this.nacl = r;
|
|
2806
2816
|
}
|
|
2807
2817
|
authorize(e, t) {
|
|
2808
|
-
super.authorize(e, (r,
|
|
2818
|
+
super.authorize(e, (r, o) => {
|
|
2809
2819
|
if (r) {
|
|
2810
|
-
t(r,
|
|
2820
|
+
t(r, o);
|
|
2811
2821
|
return;
|
|
2812
2822
|
}
|
|
2813
|
-
let c =
|
|
2823
|
+
let c = o.shared_secret;
|
|
2814
2824
|
if (!c) {
|
|
2815
2825
|
t(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2816
2826
|
return;
|
|
2817
2827
|
}
|
|
2818
|
-
this.key = (0, Te.decode)(c), delete
|
|
2828
|
+
this.key = (0, Te.decode)(c), delete o.shared_secret, t(null, o);
|
|
2819
2829
|
});
|
|
2820
2830
|
}
|
|
2821
2831
|
trigger(e, t) {
|
|
@@ -2831,32 +2841,32 @@ function Gi() {
|
|
|
2831
2841
|
}
|
|
2832
2842
|
handleEncryptedEvent(e, t) {
|
|
2833
2843
|
if (!this.key) {
|
|
2834
|
-
|
|
2844
|
+
L.debug("Received encrypted event before key has been retrieved from the authEndpoint");
|
|
2835
2845
|
return;
|
|
2836
2846
|
}
|
|
2837
2847
|
if (!t.ciphertext || !t.nonce) {
|
|
2838
|
-
|
|
2848
|
+
L.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + t);
|
|
2839
2849
|
return;
|
|
2840
2850
|
}
|
|
2841
2851
|
let r = (0, Te.decode)(t.ciphertext);
|
|
2842
2852
|
if (r.length < this.nacl.secretbox.overheadLength) {
|
|
2843
|
-
|
|
2853
|
+
L.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${r.length}`);
|
|
2844
2854
|
return;
|
|
2845
2855
|
}
|
|
2846
|
-
let
|
|
2847
|
-
if (
|
|
2848
|
-
|
|
2856
|
+
let o = (0, Te.decode)(t.nonce);
|
|
2857
|
+
if (o.length < this.nacl.secretbox.nonceLength) {
|
|
2858
|
+
L.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${o.length}`);
|
|
2849
2859
|
return;
|
|
2850
2860
|
}
|
|
2851
|
-
let c = this.nacl.secretbox.open(r,
|
|
2861
|
+
let c = this.nacl.secretbox.open(r, o, this.key);
|
|
2852
2862
|
if (c === null) {
|
|
2853
|
-
|
|
2863
|
+
L.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) => {
|
|
2854
2864
|
if (l) {
|
|
2855
|
-
|
|
2865
|
+
L.error(`Failed to make a request to the authEndpoint: ${p}. Unable to fetch new key, so dropping encrypted event`);
|
|
2856
2866
|
return;
|
|
2857
2867
|
}
|
|
2858
|
-
if (c = this.nacl.secretbox.open(r,
|
|
2859
|
-
|
|
2868
|
+
if (c = this.nacl.secretbox.open(r, o, this.key), c === null) {
|
|
2869
|
+
L.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
2860
2870
|
return;
|
|
2861
2871
|
}
|
|
2862
2872
|
this.emit(e, this.getDataToEmit(c));
|
|
@@ -2866,7 +2876,7 @@ function Gi() {
|
|
|
2866
2876
|
this.emit(e, this.getDataToEmit(c));
|
|
2867
2877
|
}
|
|
2868
2878
|
getDataToEmit(e) {
|
|
2869
|
-
let t = (0,
|
|
2879
|
+
let t = (0, _n.D4)(e);
|
|
2870
2880
|
try {
|
|
2871
2881
|
return JSON.parse(t);
|
|
2872
2882
|
} catch {
|
|
@@ -3025,8 +3035,8 @@ function Gi() {
|
|
|
3025
3035
|
updateState(e, t) {
|
|
3026
3036
|
var r = this.state;
|
|
3027
3037
|
if (this.state = e, r !== e) {
|
|
3028
|
-
var
|
|
3029
|
-
|
|
3038
|
+
var o = e;
|
|
3039
|
+
o === "connected" && (o += " with new socket ID " + t.socket_id), L.debug("State changed", r + " -> " + o), this.timeline.info({ state: e, params: t }), this.emit("state_change", { previous: r, current: e }), this.emit(e, t);
|
|
3030
3040
|
}
|
|
3031
3041
|
}
|
|
3032
3042
|
shouldRetry() {
|
|
@@ -3038,7 +3048,7 @@ function Gi() {
|
|
|
3038
3048
|
this.channels = {};
|
|
3039
3049
|
}
|
|
3040
3050
|
add(e, t) {
|
|
3041
|
-
return this.channels[e] || (this.channels[e] =
|
|
3051
|
+
return this.channels[e] || (this.channels[e] = Pn(e, t)), this.channels[e];
|
|
3042
3052
|
}
|
|
3043
3053
|
all() {
|
|
3044
3054
|
return Dt(this.channels);
|
|
@@ -3056,11 +3066,11 @@ function Gi() {
|
|
|
3056
3066
|
});
|
|
3057
3067
|
}
|
|
3058
3068
|
}
|
|
3059
|
-
function
|
|
3069
|
+
function Pn(n, e) {
|
|
3060
3070
|
if (n.indexOf("private-encrypted-") === 0) {
|
|
3061
3071
|
if (e.config.nacl)
|
|
3062
3072
|
return X.createEncryptedChannel(n, e, e.config.nacl);
|
|
3063
|
-
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r =
|
|
3073
|
+
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r = x.buildLogSuffix("encryptedChannelSupport");
|
|
3064
3074
|
throw new z(`${t}. ${r}`);
|
|
3065
3075
|
} else {
|
|
3066
3076
|
if (n.indexOf("private-") === 0)
|
|
@@ -3072,7 +3082,7 @@ function Gi() {
|
|
|
3072
3082
|
return X.createChannel(n, e);
|
|
3073
3083
|
}
|
|
3074
3084
|
}
|
|
3075
|
-
var
|
|
3085
|
+
var Ln = {
|
|
3076
3086
|
createChannels() {
|
|
3077
3087
|
return new An();
|
|
3078
3088
|
},
|
|
@@ -3086,7 +3096,7 @@ function Gi() {
|
|
|
3086
3096
|
return new Se(n, e);
|
|
3087
3097
|
},
|
|
3088
3098
|
createPresenceChannel(n, e) {
|
|
3089
|
-
return new
|
|
3099
|
+
return new xn(n, e);
|
|
3090
3100
|
},
|
|
3091
3101
|
createEncryptedChannel(n, e, t) {
|
|
3092
3102
|
return new En(n, e, t);
|
|
@@ -3098,10 +3108,10 @@ function Gi() {
|
|
|
3098
3108
|
return new wn(n, e);
|
|
3099
3109
|
},
|
|
3100
3110
|
createAssistantToTheTransportManager(n, e, t) {
|
|
3101
|
-
return new
|
|
3111
|
+
return new bn(n, e, t);
|
|
3102
3112
|
}
|
|
3103
3113
|
};
|
|
3104
|
-
const X =
|
|
3114
|
+
const X = Ln;
|
|
3105
3115
|
class Qe {
|
|
3106
3116
|
constructor(e) {
|
|
3107
3117
|
this.options = e || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
@@ -3127,24 +3137,24 @@ function Gi() {
|
|
|
3127
3137
|
return $e(this.strategies, U.method("isSupported"));
|
|
3128
3138
|
}
|
|
3129
3139
|
connect(e, t) {
|
|
3130
|
-
var r = this.strategies,
|
|
3131
|
-
E ? t(null, E) : (
|
|
3140
|
+
var r = this.strategies, o = 0, c = this.timeout, l = null, p = (y, E) => {
|
|
3141
|
+
E ? t(null, E) : (o = o + 1, this.loop && (o = o % r.length), o < r.length ? (c && (c = c * 2, this.timeoutLimit && (c = Math.min(c, this.timeoutLimit))), l = this.tryStrategy(r[o], e, { timeout: c, failFast: this.failFast }, p)) : t(!0));
|
|
3132
3142
|
};
|
|
3133
|
-
return l = this.tryStrategy(r[
|
|
3143
|
+
return l = this.tryStrategy(r[o], e, { timeout: c, failFast: this.failFast }, p), {
|
|
3134
3144
|
abort: function() {
|
|
3135
3145
|
l.abort();
|
|
3136
3146
|
},
|
|
3137
|
-
forceMinPriority: function(
|
|
3138
|
-
e =
|
|
3147
|
+
forceMinPriority: function(y) {
|
|
3148
|
+
e = y, l && l.forceMinPriority(y);
|
|
3139
3149
|
}
|
|
3140
3150
|
};
|
|
3141
3151
|
}
|
|
3142
|
-
tryStrategy(e, t, r,
|
|
3152
|
+
tryStrategy(e, t, r, o) {
|
|
3143
3153
|
var c = null, l = null;
|
|
3144
3154
|
return r.timeout > 0 && (c = new Y(r.timeout, function() {
|
|
3145
|
-
l.abort(),
|
|
3146
|
-
})), l = e.connect(t, function(p,
|
|
3147
|
-
p && c && c.isRunning() && !r.failFast || (c && c.ensureAborted(),
|
|
3155
|
+
l.abort(), o(!0);
|
|
3156
|
+
})), l = e.connect(t, function(p, y) {
|
|
3157
|
+
p && c && c.isRunning() && !r.failFast || (c && c.ensureAborted(), o(p, y));
|
|
3148
3158
|
}), {
|
|
3149
3159
|
abort: function() {
|
|
3150
3160
|
c && c.ensureAborted(), l.abort();
|
|
@@ -3155,7 +3165,7 @@ function Gi() {
|
|
|
3155
3165
|
};
|
|
3156
3166
|
}
|
|
3157
3167
|
}
|
|
3158
|
-
class
|
|
3168
|
+
class xe {
|
|
3159
3169
|
constructor(e) {
|
|
3160
3170
|
this.strategies = e;
|
|
3161
3171
|
}
|
|
@@ -3163,13 +3173,13 @@ function Gi() {
|
|
|
3163
3173
|
return $e(this.strategies, U.method("isSupported"));
|
|
3164
3174
|
}
|
|
3165
3175
|
connect(e, t) {
|
|
3166
|
-
return Rn(this.strategies, e, function(r,
|
|
3176
|
+
return Rn(this.strategies, e, function(r, o) {
|
|
3167
3177
|
return function(c, l) {
|
|
3168
|
-
if (
|
|
3169
|
-
In(
|
|
3178
|
+
if (o[r].error = c, c) {
|
|
3179
|
+
In(o) && t(!0);
|
|
3170
3180
|
return;
|
|
3171
3181
|
}
|
|
3172
|
-
ie(
|
|
3182
|
+
ie(o, function(p) {
|
|
3173
3183
|
p.forceMinPriority(l.transport.priority);
|
|
3174
3184
|
}), t(null, l);
|
|
3175
3185
|
};
|
|
@@ -3177,16 +3187,16 @@ function Gi() {
|
|
|
3177
3187
|
}
|
|
3178
3188
|
}
|
|
3179
3189
|
function Rn(n, e, t) {
|
|
3180
|
-
var r =
|
|
3181
|
-
return
|
|
3190
|
+
var r = Fe(n, function(o, c, l, p) {
|
|
3191
|
+
return o.connect(e, t(c, p));
|
|
3182
3192
|
});
|
|
3183
3193
|
return {
|
|
3184
3194
|
abort: function() {
|
|
3185
3195
|
ie(r, On);
|
|
3186
3196
|
},
|
|
3187
|
-
forceMinPriority: function(
|
|
3197
|
+
forceMinPriority: function(o) {
|
|
3188
3198
|
ie(r, function(c) {
|
|
3189
|
-
c.forceMinPriority(
|
|
3199
|
+
c.forceMinPriority(o);
|
|
3190
3200
|
});
|
|
3191
3201
|
}
|
|
3192
3202
|
};
|
|
@@ -3207,20 +3217,20 @@ function Gi() {
|
|
|
3207
3217
|
return this.strategy.isSupported();
|
|
3208
3218
|
}
|
|
3209
3219
|
connect(e, t) {
|
|
3210
|
-
var r = this.usingTLS,
|
|
3211
|
-
if (
|
|
3212
|
-
var p = this.transports[
|
|
3213
|
-
p && (["ws", "wss"].includes(
|
|
3220
|
+
var r = this.usingTLS, o = Un(r), c = o && o.cacheSkipCount ? o.cacheSkipCount : 0, l = [this.strategy];
|
|
3221
|
+
if (o && o.timestamp + this.ttl >= U.now()) {
|
|
3222
|
+
var p = this.transports[o.transport];
|
|
3223
|
+
p && (["ws", "wss"].includes(o.transport) || c > 3 ? (this.timeline.info({
|
|
3214
3224
|
cached: !0,
|
|
3215
|
-
transport:
|
|
3216
|
-
latency:
|
|
3225
|
+
transport: o.transport,
|
|
3226
|
+
latency: o.latency
|
|
3217
3227
|
}), l.push(new Q([p], {
|
|
3218
|
-
timeout:
|
|
3228
|
+
timeout: o.latency * 2 + 1e3,
|
|
3219
3229
|
failFast: !0
|
|
3220
3230
|
}))) : c++);
|
|
3221
3231
|
}
|
|
3222
|
-
var
|
|
3223
|
-
I ? (Ze(r), l.length > 0 ? (
|
|
3232
|
+
var y = U.now(), E = l.pop().connect(e, function k(I, de) {
|
|
3233
|
+
I ? (Ze(r), l.length > 0 ? (y = U.now(), E = l.pop().connect(e, k)) : t(I)) : (Nn(r, de.transport.name, U.now() - y, c), t(null, de));
|
|
3224
3234
|
});
|
|
3225
3235
|
return {
|
|
3226
3236
|
abort: function() {
|
|
@@ -3232,14 +3242,14 @@ function Gi() {
|
|
|
3232
3242
|
};
|
|
3233
3243
|
}
|
|
3234
3244
|
}
|
|
3235
|
-
function
|
|
3245
|
+
function _e(n) {
|
|
3236
3246
|
return "pusherTransport" + (n ? "TLS" : "NonTLS");
|
|
3237
3247
|
}
|
|
3238
3248
|
function Un(n) {
|
|
3239
3249
|
var e = C.getLocalStorage();
|
|
3240
3250
|
if (e)
|
|
3241
3251
|
try {
|
|
3242
|
-
var t = e[
|
|
3252
|
+
var t = e[_e(n)];
|
|
3243
3253
|
if (t)
|
|
3244
3254
|
return JSON.parse(t);
|
|
3245
3255
|
} catch {
|
|
@@ -3248,10 +3258,10 @@ function Gi() {
|
|
|
3248
3258
|
return null;
|
|
3249
3259
|
}
|
|
3250
3260
|
function Nn(n, e, t, r) {
|
|
3251
|
-
var
|
|
3252
|
-
if (
|
|
3261
|
+
var o = C.getLocalStorage();
|
|
3262
|
+
if (o)
|
|
3253
3263
|
try {
|
|
3254
|
-
|
|
3264
|
+
o[_e(n)] = ae({
|
|
3255
3265
|
timestamp: U.now(),
|
|
3256
3266
|
transport: e,
|
|
3257
3267
|
latency: t,
|
|
@@ -3264,7 +3274,7 @@ function Gi() {
|
|
|
3264
3274
|
var e = C.getLocalStorage();
|
|
3265
3275
|
if (e)
|
|
3266
3276
|
try {
|
|
3267
|
-
delete e[
|
|
3277
|
+
delete e[_e(n)];
|
|
3268
3278
|
} catch {
|
|
3269
3279
|
}
|
|
3270
3280
|
}
|
|
@@ -3276,15 +3286,15 @@ function Gi() {
|
|
|
3276
3286
|
return this.strategy.isSupported();
|
|
3277
3287
|
}
|
|
3278
3288
|
connect(e, t) {
|
|
3279
|
-
var r = this.strategy,
|
|
3280
|
-
|
|
3289
|
+
var r = this.strategy, o, c = new Y(this.options.delay, function() {
|
|
3290
|
+
o = r.connect(e, t);
|
|
3281
3291
|
});
|
|
3282
3292
|
return {
|
|
3283
3293
|
abort: function() {
|
|
3284
|
-
c.ensureAborted(),
|
|
3294
|
+
c.ensureAborted(), o && o.abort();
|
|
3285
3295
|
},
|
|
3286
3296
|
forceMinPriority: function(l) {
|
|
3287
|
-
e = l,
|
|
3297
|
+
e = l, o && o.forceMinPriority(l);
|
|
3288
3298
|
}
|
|
3289
3299
|
};
|
|
3290
3300
|
}
|
|
@@ -3310,8 +3320,8 @@ function Gi() {
|
|
|
3310
3320
|
return this.strategy.isSupported();
|
|
3311
3321
|
}
|
|
3312
3322
|
connect(e, t) {
|
|
3313
|
-
var r = this.strategy.connect(e, function(
|
|
3314
|
-
c && r.abort(), t(
|
|
3323
|
+
var r = this.strategy.connect(e, function(o, c) {
|
|
3324
|
+
c && r.abort(), t(o, c);
|
|
3315
3325
|
});
|
|
3316
3326
|
return r;
|
|
3317
3327
|
}
|
|
@@ -3323,7 +3333,7 @@ function Gi() {
|
|
|
3323
3333
|
}
|
|
3324
3334
|
var Mn = function(n, e, t) {
|
|
3325
3335
|
var r = {};
|
|
3326
|
-
function
|
|
3336
|
+
function o(dt, Ui, Ni, ji, Mi) {
|
|
3327
3337
|
var ft = t(n, dt, Ui, Ni, ji, Mi);
|
|
3328
3338
|
return r[dt] = ft, ft;
|
|
3329
3339
|
}
|
|
@@ -3337,7 +3347,7 @@ function Gi() {
|
|
|
3337
3347
|
hostNonTLS: n.httpHost + ":" + n.httpPort,
|
|
3338
3348
|
hostTLS: n.httpHost + ":" + n.httpsPort,
|
|
3339
3349
|
httpPath: n.httpPath
|
|
3340
|
-
}),
|
|
3350
|
+
}), y = {
|
|
3341
3351
|
loop: !0,
|
|
3342
3352
|
timeout: 15e3,
|
|
3343
3353
|
timeoutLimit: 6e4
|
|
@@ -3348,24 +3358,24 @@ function Gi() {
|
|
|
3348
3358
|
lives: 2,
|
|
3349
3359
|
minPingDelay: 1e4,
|
|
3350
3360
|
maxPingDelay: n.activityTimeout
|
|
3351
|
-
}), I =
|
|
3361
|
+
}), I = o("ws", "ws", 3, c, E), de = o("wss", "ws", 3, l, E), Li = o("sockjs", "sockjs", 1, p), ot = o("xhr_streaming", "xhr_streaming", 1, p, k), Ri = 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([I], y), Oi = new Q([de], y), qi = new Q([Li], y), ht = new Q([
|
|
3352
3362
|
new re(se(ot), ot, Ri)
|
|
3353
|
-
],
|
|
3363
|
+
], y), lt = new Q([
|
|
3354
3364
|
new re(se(at), at, Ii)
|
|
3355
|
-
],
|
|
3356
|
-
new re(se(ht), new
|
|
3365
|
+
], y), ut = new Q([
|
|
3366
|
+
new re(se(ht), new xe([
|
|
3357
3367
|
ht,
|
|
3358
3368
|
new he(lt, { delay: 4e3 })
|
|
3359
3369
|
]), lt)
|
|
3360
|
-
],
|
|
3361
|
-
return e.useTLS ?
|
|
3370
|
+
], y), Ae = new re(se(ut), ut, qi), Pe;
|
|
3371
|
+
return e.useTLS ? Pe = new xe([
|
|
3362
3372
|
ct,
|
|
3363
3373
|
new he(Ae, { delay: 2e3 })
|
|
3364
|
-
]) :
|
|
3374
|
+
]) : Pe = new xe([
|
|
3365
3375
|
ct,
|
|
3366
3376
|
new he(Oi, { delay: 2e3 }),
|
|
3367
3377
|
new he(Ae, { delay: 5e3 })
|
|
3368
|
-
]), new qn(new jn(new re(se(I),
|
|
3378
|
+
]), new qn(new jn(new re(se(I), Pe, Ae)), r, {
|
|
3369
3379
|
ttl: 18e5,
|
|
3370
3380
|
timeline: e.timeline,
|
|
3371
3381
|
useTLS: e.useTLS
|
|
@@ -3384,7 +3394,7 @@ function Gi() {
|
|
|
3384
3394
|
getRequest: function(n) {
|
|
3385
3395
|
var e = new window.XDomainRequest();
|
|
3386
3396
|
return e.ontimeout = function() {
|
|
3387
|
-
n.emit("error", new
|
|
3397
|
+
n.emit("error", new P()), n.close();
|
|
3388
3398
|
}, e.onerror = function(t) {
|
|
3389
3399
|
n.emit("error", t), n.close();
|
|
3390
3400
|
}, e.onprogress = function() {
|
|
@@ -3397,7 +3407,7 @@ function Gi() {
|
|
|
3397
3407
|
n.ontimeout = n.onerror = n.onprogress = n.onload = null, n.abort();
|
|
3398
3408
|
}
|
|
3399
3409
|
};
|
|
3400
|
-
const
|
|
3410
|
+
const Fn = Dn, Wn = 256 * 1024;
|
|
3401
3411
|
class Bn extends $ {
|
|
3402
3412
|
constructor(e, t, r) {
|
|
3403
3413
|
super(), this.hooks = e, this.method = t, this.url = r;
|
|
@@ -3426,7 +3436,7 @@ function Gi() {
|
|
|
3426
3436
|
return r !== -1 ? (this.position += r + 1, t.slice(0, r)) : null;
|
|
3427
3437
|
}
|
|
3428
3438
|
isBufferTooLong(e) {
|
|
3429
|
-
return this.position === e.length && e.length >
|
|
3439
|
+
return this.position === e.length && e.length > Wn;
|
|
3430
3440
|
}
|
|
3431
3441
|
}
|
|
3432
3442
|
var Ee;
|
|
@@ -3478,8 +3488,8 @@ function Gi() {
|
|
|
3478
3488
|
break;
|
|
3479
3489
|
case "a":
|
|
3480
3490
|
t = JSON.parse(e.data.slice(1) || "[]");
|
|
3481
|
-
for (var
|
|
3482
|
-
this.onEvent(t[
|
|
3491
|
+
for (var o = 0; o < t.length; o++)
|
|
3492
|
+
this.onEvent(t[o]);
|
|
3483
3493
|
break;
|
|
3484
3494
|
case "m":
|
|
3485
3495
|
t = JSON.parse(e.data.slice(1) || "null"), this.onEvent(t);
|
|
@@ -3619,13 +3629,13 @@ function Gi() {
|
|
|
3619
3629
|
};
|
|
3620
3630
|
const nt = ri;
|
|
3621
3631
|
nt.createXDR = function(n, e) {
|
|
3622
|
-
return this.createRequest(
|
|
3632
|
+
return this.createRequest(Fn, n, e);
|
|
3623
3633
|
};
|
|
3624
3634
|
var si = {
|
|
3625
3635
|
nextAuthCallbackID: 1,
|
|
3626
3636
|
auth_callbacks: {},
|
|
3627
3637
|
ScriptReceivers: w,
|
|
3628
|
-
DependenciesReceivers:
|
|
3638
|
+
DependenciesReceivers: F,
|
|
3629
3639
|
getDefaultStrategy: zn,
|
|
3630
3640
|
Transports: mn,
|
|
3631
3641
|
transportConnectionInitializer: Hn,
|
|
@@ -3651,7 +3661,7 @@ function Gi() {
|
|
|
3651
3661
|
return this.getDocument().location.protocol;
|
|
3652
3662
|
},
|
|
3653
3663
|
getAuthorizers() {
|
|
3654
|
-
return { ajax:
|
|
3664
|
+
return { ajax: Pt, jsonp: Yt };
|
|
3655
3665
|
},
|
|
3656
3666
|
onDocumentBody(n) {
|
|
3657
3667
|
document.body ? n() : setTimeout(() => {
|
|
@@ -3751,8 +3761,8 @@ function Gi() {
|
|
|
3751
3761
|
features: this.options.features,
|
|
3752
3762
|
timeline: this.events
|
|
3753
3763
|
}, this.options.params);
|
|
3754
|
-
return this.events = [], e(r, (
|
|
3755
|
-
|
|
3764
|
+
return this.events = [], e(r, (o, c) => {
|
|
3765
|
+
o || this.sent++, t && t(o, c);
|
|
3756
3766
|
}), !0;
|
|
3757
3767
|
}
|
|
3758
3768
|
generateUniqueID() {
|
|
@@ -3760,8 +3770,8 @@ function Gi() {
|
|
|
3760
3770
|
}
|
|
3761
3771
|
}
|
|
3762
3772
|
class ai {
|
|
3763
|
-
constructor(e, t, r,
|
|
3764
|
-
this.name = e, this.priority = t, this.transport = r, this.options =
|
|
3773
|
+
constructor(e, t, r, o) {
|
|
3774
|
+
this.name = e, this.priority = t, this.transport = r, this.options = o || {};
|
|
3765
3775
|
}
|
|
3766
3776
|
isSupported() {
|
|
3767
3777
|
return this.transport.isSupported({
|
|
@@ -3773,27 +3783,27 @@ function Gi() {
|
|
|
3773
3783
|
if (this.priority < e)
|
|
3774
3784
|
return it(new q(), t);
|
|
3775
3785
|
} else return it(new D(), t);
|
|
3776
|
-
var r = !1,
|
|
3777
|
-
|
|
3786
|
+
var r = !1, o = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), c = null, l = function() {
|
|
3787
|
+
o.unbind("initialized", l), o.connect();
|
|
3778
3788
|
}, p = function() {
|
|
3779
|
-
c = X.createHandshake(
|
|
3789
|
+
c = X.createHandshake(o, function(I) {
|
|
3780
3790
|
r = !0, k(), t(null, I);
|
|
3781
3791
|
});
|
|
3782
|
-
},
|
|
3792
|
+
}, y = function(I) {
|
|
3783
3793
|
k(), t(I);
|
|
3784
3794
|
}, E = function() {
|
|
3785
3795
|
k();
|
|
3786
3796
|
var I;
|
|
3787
|
-
I = ae(
|
|
3797
|
+
I = ae(o), t(new j(I));
|
|
3788
3798
|
}, k = function() {
|
|
3789
|
-
|
|
3799
|
+
o.unbind("initialized", l), o.unbind("open", p), o.unbind("error", y), o.unbind("closed", E);
|
|
3790
3800
|
};
|
|
3791
|
-
return
|
|
3801
|
+
return o.bind("initialized", l), o.bind("open", p), o.bind("error", y), o.bind("closed", E), o.initialize(), {
|
|
3792
3802
|
abort: () => {
|
|
3793
|
-
r || (k(), c ? c.close() :
|
|
3803
|
+
r || (k(), c ? c.close() : o.close());
|
|
3794
3804
|
},
|
|
3795
3805
|
forceMinPriority: (I) => {
|
|
3796
|
-
r || this.priority < I && (c ? c.close() :
|
|
3806
|
+
r || this.priority < I && (c ? c.close() : o.close());
|
|
3797
3807
|
}
|
|
3798
3808
|
};
|
|
3799
3809
|
}
|
|
@@ -3809,12 +3819,12 @@ function Gi() {
|
|
|
3809
3819
|
};
|
|
3810
3820
|
}
|
|
3811
3821
|
const { Transports: ci } = C;
|
|
3812
|
-
var hi = function(n, e, t, r,
|
|
3822
|
+
var hi = function(n, e, t, r, o, c) {
|
|
3813
3823
|
var l = ci[t];
|
|
3814
3824
|
if (!l)
|
|
3815
3825
|
throw new J(t);
|
|
3816
|
-
var p = (!n.enabledTransports || He(n.enabledTransports, e) !== -1) && (!n.disabledTransports || He(n.disabledTransports, e) === -1),
|
|
3817
|
-
return p ? (
|
|
3826
|
+
var p = (!n.enabledTransports || He(n.enabledTransports, e) !== -1) && (!n.disabledTransports || He(n.disabledTransports, e) === -1), y;
|
|
3827
|
+
return p ? (o = Object.assign({ ignoreNullOrigin: n.ignoreNullOrigin }, o), y = new ai(e, r, c ? c.getAssistant(l) : l, o)) : y = li, y;
|
|
3818
3828
|
}, li = {
|
|
3819
3829
|
isSupported: function() {
|
|
3820
3830
|
return !1;
|
|
@@ -3837,16 +3847,16 @@ function Gi() {
|
|
|
3837
3847
|
throw "You must pass an options object";
|
|
3838
3848
|
if (n.cluster == null)
|
|
3839
3849
|
throw "Options object must provide a cluster";
|
|
3840
|
-
"disableStats" in n &&
|
|
3850
|
+
"disableStats" in n && L.warn("The disableStats option is deprecated in favor of enableStats");
|
|
3841
3851
|
}
|
|
3842
3852
|
const di = (n, e) => {
|
|
3843
3853
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
3844
3854
|
for (var r in e.params)
|
|
3845
3855
|
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(e.params[r]);
|
|
3846
3856
|
if (e.paramsProvider != null) {
|
|
3847
|
-
let
|
|
3848
|
-
for (var r in
|
|
3849
|
-
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(
|
|
3857
|
+
let o = e.paramsProvider();
|
|
3858
|
+
for (var r in o)
|
|
3859
|
+
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(o[r]);
|
|
3850
3860
|
}
|
|
3851
3861
|
return t;
|
|
3852
3862
|
}, fi = (n) => {
|
|
@@ -3862,9 +3872,9 @@ function Gi() {
|
|
|
3862
3872
|
for (var r in e.params)
|
|
3863
3873
|
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(e.params[r]);
|
|
3864
3874
|
if (e.paramsProvider != null) {
|
|
3865
|
-
let
|
|
3866
|
-
for (var r in
|
|
3867
|
-
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(
|
|
3875
|
+
let o = e.paramsProvider();
|
|
3876
|
+
for (var r in o)
|
|
3877
|
+
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(o[r]);
|
|
3868
3878
|
}
|
|
3869
3879
|
return t;
|
|
3870
3880
|
}, mi = (n) => {
|
|
@@ -3883,9 +3893,9 @@ function Gi() {
|
|
|
3883
3893
|
headers: e.headers
|
|
3884
3894
|
}
|
|
3885
3895
|
};
|
|
3886
|
-
return (
|
|
3887
|
-
const l = n.channel(
|
|
3888
|
-
t(l, r).authorize(
|
|
3896
|
+
return (o, c) => {
|
|
3897
|
+
const l = n.channel(o.channelName);
|
|
3898
|
+
t(l, r).authorize(o.socketId, c);
|
|
3889
3899
|
};
|
|
3890
3900
|
};
|
|
3891
3901
|
function rt(n, e) {
|
|
@@ -3904,19 +3914,19 @@ function Gi() {
|
|
|
3904
3914
|
enableStats: Ci(n),
|
|
3905
3915
|
httpHost: vi(n),
|
|
3906
3916
|
useTLS: wi(n),
|
|
3907
|
-
wsHost:
|
|
3917
|
+
wsHost: bi(n),
|
|
3908
3918
|
userAuthenticator: Si(n),
|
|
3909
|
-
channelAuthorizer:
|
|
3919
|
+
channelAuthorizer: xi(n, e)
|
|
3910
3920
|
};
|
|
3911
3921
|
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;
|
|
3912
3922
|
}
|
|
3913
3923
|
function vi(n) {
|
|
3914
3924
|
return n.httpHost ? n.httpHost : n.cluster ? `sockjs-${n.cluster}.pusher.com` : T.httpHost;
|
|
3915
3925
|
}
|
|
3916
|
-
function yi(n) {
|
|
3917
|
-
return n.wsHost ? n.wsHost : bi(n.cluster);
|
|
3918
|
-
}
|
|
3919
3926
|
function bi(n) {
|
|
3927
|
+
return n.wsHost ? n.wsHost : yi(n.cluster);
|
|
3928
|
+
}
|
|
3929
|
+
function yi(n) {
|
|
3920
3930
|
return `ws-${n}.pusher.com`;
|
|
3921
3931
|
}
|
|
3922
3932
|
function wi(n) {
|
|
@@ -3943,14 +3953,14 @@ function Gi() {
|
|
|
3943
3953
|
};
|
|
3944
3954
|
return t;
|
|
3945
3955
|
}
|
|
3946
|
-
function
|
|
3956
|
+
function xi(n, e) {
|
|
3947
3957
|
const t = Ti(n, e);
|
|
3948
3958
|
return st(t) ? t.customHandler : mi(t);
|
|
3949
3959
|
}
|
|
3950
|
-
class
|
|
3960
|
+
class _i extends $ {
|
|
3951
3961
|
constructor(e) {
|
|
3952
3962
|
super(function(t, r) {
|
|
3953
|
-
|
|
3963
|
+
L.debug(`No callbacks on watchlist events for ${t}`);
|
|
3954
3964
|
}), this.pusher = e, this.bindWatchlistInternalEvent();
|
|
3955
3965
|
}
|
|
3956
3966
|
handleEvent(e) {
|
|
@@ -3967,18 +3977,18 @@ function Gi() {
|
|
|
3967
3977
|
}
|
|
3968
3978
|
function Ei() {
|
|
3969
3979
|
let n, e;
|
|
3970
|
-
return { promise: new Promise((r,
|
|
3971
|
-
n = r, e =
|
|
3980
|
+
return { promise: new Promise((r, o) => {
|
|
3981
|
+
n = r, e = o;
|
|
3972
3982
|
}), resolve: n, reject: e };
|
|
3973
3983
|
}
|
|
3974
3984
|
const ki = Ei;
|
|
3975
3985
|
class Ai extends $ {
|
|
3976
3986
|
constructor(e) {
|
|
3977
3987
|
super(function(t, r) {
|
|
3978
|
-
|
|
3988
|
+
L.debug("No callbacks on user for " + t);
|
|
3979
3989
|
}), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (t, r) => {
|
|
3980
3990
|
if (t) {
|
|
3981
|
-
|
|
3991
|
+
L.warn(`Error during signin: ${t}`), this._cleanup();
|
|
3982
3992
|
return;
|
|
3983
3993
|
}
|
|
3984
3994
|
this.pusher.send_event("pusher:signin", {
|
|
@@ -3987,7 +3997,7 @@ function Gi() {
|
|
|
3987
3997
|
});
|
|
3988
3998
|
}, this.pusher = e, this.pusher.connection.bind("state_change", ({ previous: t, current: r }) => {
|
|
3989
3999
|
t !== "connected" && r === "connected" && this._signin(), t === "connected" && r !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
3990
|
-
}), this.watchlist = new
|
|
4000
|
+
}), this.watchlist = new _i(e), this.pusher.connection.bind("message", (t) => {
|
|
3991
4001
|
var r = t.event;
|
|
3992
4002
|
r === "pusher:signin_success" && this._onSigninSuccess(t.data), this.serverToUserChannel && this.serverToUserChannel.name === t.channel && this.serverToUserChannel.handleEvent(t);
|
|
3993
4003
|
});
|
|
@@ -4004,11 +4014,11 @@ function Gi() {
|
|
|
4004
4014
|
try {
|
|
4005
4015
|
this.user_data = JSON.parse(e.user_data);
|
|
4006
4016
|
} catch {
|
|
4007
|
-
|
|
4017
|
+
L.error(`Failed parsing user data after signin: ${e.user_data}`), this._cleanup();
|
|
4008
4018
|
return;
|
|
4009
4019
|
}
|
|
4010
4020
|
if (typeof this.user_data.id != "string" || this.user_data.id === "") {
|
|
4011
|
-
|
|
4021
|
+
L.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
|
|
4012
4022
|
return;
|
|
4013
4023
|
}
|
|
4014
4024
|
this._signinDoneResolve(), this._subscribeChannels();
|
|
@@ -4047,7 +4057,7 @@ function Gi() {
|
|
|
4047
4057
|
}));
|
|
4048
4058
|
}
|
|
4049
4059
|
constructor(e, t) {
|
|
4050
|
-
|
|
4060
|
+
Pi(e), ui(t), this.key = e, this.options = t, this.config = rt(this.options, this), this.channels = X.createChannels(), this.global_emitter = new $(), this.sessionID = C.randomInt(1e9), this.timeline = new oi(this.key, this.sessionID, {
|
|
4051
4061
|
cluster: this.config.cluster,
|
|
4052
4062
|
features: O.getClientFeatures(),
|
|
4053
4063
|
params: this.config.timelineParams || {},
|
|
@@ -4058,7 +4068,7 @@ function Gi() {
|
|
|
4058
4068
|
host: this.config.statsHost,
|
|
4059
4069
|
path: "/timeline/v2/" + C.TimelineTransport.name
|
|
4060
4070
|
}));
|
|
4061
|
-
var r = (
|
|
4071
|
+
var r = (o) => C.getDefaultStrategy(this.config, o, hi);
|
|
4062
4072
|
this.connection = X.createConnectionManager(this.key, {
|
|
4063
4073
|
getStrategy: r,
|
|
4064
4074
|
timeline: this.timeline,
|
|
@@ -4068,19 +4078,19 @@ function Gi() {
|
|
|
4068
4078
|
useTLS: !!this.config.useTLS
|
|
4069
4079
|
}), this.connection.bind("connected", () => {
|
|
4070
4080
|
this.subscribeAll(), this.timelineSender && this.timelineSender.send(this.connection.isUsingTLS());
|
|
4071
|
-
}), this.connection.bind("message", (
|
|
4072
|
-
var c =
|
|
4073
|
-
if (
|
|
4074
|
-
var p = this.channel(
|
|
4075
|
-
p && p.handleEvent(
|
|
4081
|
+
}), this.connection.bind("message", (o) => {
|
|
4082
|
+
var c = o.event, l = c.indexOf("pusher_internal:") === 0;
|
|
4083
|
+
if (o.channel) {
|
|
4084
|
+
var p = this.channel(o.channel);
|
|
4085
|
+
p && p.handleEvent(o);
|
|
4076
4086
|
}
|
|
4077
|
-
l || this.global_emitter.emit(
|
|
4087
|
+
l || this.global_emitter.emit(o.event, o.data);
|
|
4078
4088
|
}), this.connection.bind("connecting", () => {
|
|
4079
4089
|
this.channels.disconnect();
|
|
4080
4090
|
}), this.connection.bind("disconnected", () => {
|
|
4081
4091
|
this.channels.disconnect();
|
|
4082
|
-
}), this.connection.bind("error", (
|
|
4083
|
-
|
|
4092
|
+
}), this.connection.bind("error", (o) => {
|
|
4093
|
+
L.warn(o);
|
|
4084
4094
|
}), O.instances.push(this), this.timeline.info({ instances: O.instances.length }), this.user = new Ai(this), O.isReady && this.connect();
|
|
4085
4095
|
}
|
|
4086
4096
|
switchCluster(e) {
|
|
@@ -4144,7 +4154,7 @@ function Gi() {
|
|
|
4144
4154
|
}
|
|
4145
4155
|
O.instances = [], O.isReady = !1, O.logToConsole = !1, O.Runtime = C, O.ScriptReceivers = C.ScriptReceivers, O.DependenciesReceivers = C.DependenciesReceivers, O.auth_callbacks = C.auth_callbacks;
|
|
4146
4156
|
const ue = O;
|
|
4147
|
-
function
|
|
4157
|
+
function Pi(n) {
|
|
4148
4158
|
if (n == null)
|
|
4149
4159
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
4150
4160
|
}
|
|
@@ -4156,7 +4166,7 @@ function Gi() {
|
|
|
4156
4166
|
var g = a[m];
|
|
4157
4167
|
if (g !== void 0)
|
|
4158
4168
|
return g.exports;
|
|
4159
|
-
var
|
|
4169
|
+
var b = a[m] = {
|
|
4160
4170
|
/******/
|
|
4161
4171
|
// no module.id needed
|
|
4162
4172
|
/******/
|
|
@@ -4165,17 +4175,17 @@ function Gi() {
|
|
|
4165
4175
|
exports: {}
|
|
4166
4176
|
/******/
|
|
4167
4177
|
};
|
|
4168
|
-
return
|
|
4178
|
+
return s[m].call(b.exports, b, b.exports, h), b.exports;
|
|
4169
4179
|
}
|
|
4170
4180
|
h.d = (m, g) => {
|
|
4171
|
-
for (var
|
|
4172
|
-
h.o(g,
|
|
4181
|
+
for (var b in g)
|
|
4182
|
+
h.o(g, b) && !h.o(m, b) && Object.defineProperty(m, b, { enumerable: !0, get: g[b] });
|
|
4173
4183
|
}, h.o = (m, g) => Object.prototype.hasOwnProperty.call(m, g);
|
|
4174
4184
|
var u = h(721);
|
|
4175
4185
|
return u;
|
|
4176
4186
|
})()
|
|
4177
4187
|
));
|
|
4178
|
-
})(
|
|
4188
|
+
})(Le)), Le.exports;
|
|
4179
4189
|
}
|
|
4180
4190
|
var Yi = Gi();
|
|
4181
4191
|
const Ki = /* @__PURE__ */ Ji(Yi), Re = "/vendor/sendity-client/tailwind.css", Qi = {
|
|
@@ -4256,13 +4266,13 @@ function V(v) {
|
|
|
4256
4266
|
}
|
|
4257
4267
|
}
|
|
4258
4268
|
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>
|
|
4259
|
-
`,
|
|
4269
|
+
`, bt = '<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>', je = "sendityAuthRequest", nr = "https://sendity.io/api", ir = ["mailto:verify@sendity.io"], rr = 600 * 1e3, sr = 5e3, or = 15e3, Ie = 2e3, pe = 220, At = 0;
|
|
4260
4270
|
function Me(v, i) {
|
|
4261
4271
|
return `sendity:auth-request:${encodeURIComponent(v)}:${encodeURIComponent(i)}`;
|
|
4262
4272
|
}
|
|
4263
|
-
function
|
|
4273
|
+
function yt(v, i, s, a = Date.now()) {
|
|
4264
4274
|
v.removeItem(je);
|
|
4265
|
-
const h = Me(i,
|
|
4275
|
+
const h = Me(i, s), u = v.getItem(h);
|
|
4266
4276
|
if (!u) return null;
|
|
4267
4277
|
try {
|
|
4268
4278
|
const m = JSON.parse(u);
|
|
@@ -4273,37 +4283,37 @@ function bt(v, i, o, a = Date.now()) {
|
|
|
4273
4283
|
return v.removeItem(h), null;
|
|
4274
4284
|
}
|
|
4275
4285
|
}
|
|
4276
|
-
function ar(v, i,
|
|
4277
|
-
v.setItem(Me(i,
|
|
4286
|
+
function ar(v, i, s, a, h = Date.now()) {
|
|
4287
|
+
v.setItem(Me(i, s), JSON.stringify({ ...a, createdAt: h }));
|
|
4278
4288
|
}
|
|
4279
|
-
function wt(v, i,
|
|
4280
|
-
v.removeItem(Me(i,
|
|
4289
|
+
function wt(v, i, s) {
|
|
4290
|
+
v.removeItem(Me(i, s)), v.removeItem(je);
|
|
4281
4291
|
}
|
|
4282
4292
|
function me() {
|
|
4283
4293
|
return window.localStorage.removeItem(je), window.sessionStorage;
|
|
4284
4294
|
}
|
|
4285
4295
|
function cr(v, i = window.location.origin) {
|
|
4286
|
-
return v.filter((
|
|
4296
|
+
return v.filter((s) => hr(s, i));
|
|
4287
4297
|
}
|
|
4288
4298
|
function hr(v, i) {
|
|
4289
4299
|
try {
|
|
4290
|
-
const
|
|
4291
|
-
return ["http:", "https:", "mailto:", "whatsapp:"].includes(
|
|
4300
|
+
const s = new URL(v, i);
|
|
4301
|
+
return ["http:", "https:", "mailto:", "whatsapp:"].includes(s.protocol);
|
|
4292
4302
|
} catch {
|
|
4293
4303
|
return !1;
|
|
4294
4304
|
}
|
|
4295
4305
|
}
|
|
4296
|
-
function lr(v, i,
|
|
4297
|
-
return v === "push" ? { start: !1, delayMs: 0 } : v === "polling" || !i || !
|
|
4306
|
+
function lr(v, i, s) {
|
|
4307
|
+
return v === "push" ? { start: !1, delayMs: 0 } : v === "polling" || !i || !s ? { start: !0, delayMs: 0 } : { start: !0, delayMs: At };
|
|
4298
4308
|
}
|
|
4299
4309
|
const ve = class ve extends HTMLElement {
|
|
4300
4310
|
constructor() {
|
|
4301
|
-
super(), this.pollTimer = null, this.fallbackPollTimer = null, this.authenticatedEventTimer = 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.footerObserver = null, 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;
|
|
4311
|
+
super(), this.pollTimer = null, this.fallbackPollTimer = null, this.authenticatedEventTimer = 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.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;
|
|
4302
4312
|
const i = this.attachShadow({ mode: "open" });
|
|
4303
4313
|
this.injectTailwind(i);
|
|
4304
|
-
const
|
|
4305
|
-
|
|
4306
|
-
const a =
|
|
4314
|
+
const s = document.createElement("div");
|
|
4315
|
+
s.innerHTML = pt;
|
|
4316
|
+
const a = s.querySelector("template"), h = a ? a.content.cloneNode(!0) : document.createRange().createContextualFragment(pt), u = document.createElement("style");
|
|
4307
4317
|
u.textContent = zi, i.appendChild(u), i.appendChild(h);
|
|
4308
4318
|
}
|
|
4309
4319
|
static get observedAttributes() {
|
|
@@ -4320,7 +4330,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4320
4330
|
this.configureFooter(), this.dispatchPublicEvent("sendity:ready", {
|
|
4321
4331
|
transport: this.currentConfig.transport,
|
|
4322
4332
|
channel: this.primaryChannel(this.currentConfig.verifyUrls)
|
|
4323
|
-
}), this.
|
|
4333
|
+
}), this.showPlaceholderCode(), this.renderVerifiers(this.currentConfig.verifyUrls), this.startWhenVisible();
|
|
4324
4334
|
}
|
|
4325
4335
|
disconnectedCallback() {
|
|
4326
4336
|
this.stop(), this.destroyed = !0;
|
|
@@ -4328,30 +4338,41 @@ const ve = class ve extends HTMLElement {
|
|
|
4328
4338
|
attributeChangedCallback() {
|
|
4329
4339
|
this.isConnected && (this.currentConfig = this.resolveConfig(), this.configureFooter(), this.renderVerifiers(this.currentConfig.verifyUrls));
|
|
4330
4340
|
}
|
|
4341
|
+
startWhenVisible() {
|
|
4342
|
+
if (!(this.authFlowStarted || this.destroyed)) {
|
|
4343
|
+
if (!("IntersectionObserver" in window)) {
|
|
4344
|
+
this.start();
|
|
4345
|
+
return;
|
|
4346
|
+
}
|
|
4347
|
+
this.authStartObserver?.disconnect(), this.authStartObserver = new IntersectionObserver((i) => {
|
|
4348
|
+
i.some((a) => a.isIntersecting && a.intersectionRatio > 0) && (this.authStartObserver?.disconnect(), this.authStartObserver = null, this.start());
|
|
4349
|
+
}), this.authStartObserver.observe(this);
|
|
4350
|
+
}
|
|
4351
|
+
}
|
|
4331
4352
|
start() {
|
|
4332
|
-
this.step().then((i) => {
|
|
4353
|
+
this.authFlowStarted || (this.authFlowStarted = !0, this.step().then((i) => {
|
|
4333
4354
|
this.authenticated || this.destroyed || this.configureRealtime(i);
|
|
4334
4355
|
}).catch((i) => {
|
|
4335
4356
|
this.handleInitialError(i);
|
|
4336
|
-
});
|
|
4357
|
+
}));
|
|
4337
4358
|
}
|
|
4338
4359
|
stop() {
|
|
4339
|
-
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.echo && this.activeAuthRequestId && this.echo.leave(`sendity.auth-requests.${this.activeAuthRequestId}`), this.echo?.disconnect(), this.echo = null;
|
|
4360
|
+
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;
|
|
4340
4361
|
}
|
|
4341
4362
|
// Inject Tailwind CSS into the Shadow DOM so Tailwind utility classes
|
|
4342
4363
|
// used in sendity.html work within the component. We cache the processed
|
|
4343
4364
|
// CSS text across instances to avoid redundant network requests and ensure
|
|
4344
4365
|
// the Tailwind layer is inserted before component CSS.
|
|
4345
4366
|
injectTailwind(i) {
|
|
4346
|
-
const
|
|
4347
|
-
|
|
4367
|
+
const s = document.createElement("style");
|
|
4368
|
+
s.setAttribute("data-sendity-tw", ""), i.appendChild(s);
|
|
4348
4369
|
const a = this.constructor;
|
|
4349
4370
|
if (a.tailwindCssText !== null) {
|
|
4350
4371
|
if (a.tailwindCssText)
|
|
4351
|
-
|
|
4372
|
+
s.textContent = a.tailwindCssText;
|
|
4352
4373
|
else {
|
|
4353
4374
|
const h = document.createElement("link");
|
|
4354
|
-
h.rel = "stylesheet", h.href = Re, i.insertBefore(h,
|
|
4375
|
+
h.rel = "stylesheet", h.href = Re, i.insertBefore(h, s);
|
|
4355
4376
|
}
|
|
4356
4377
|
return;
|
|
4357
4378
|
}
|
|
@@ -4362,10 +4383,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4362
4383
|
})), a.tailwindLoading.then(() => {
|
|
4363
4384
|
if (!this.destroyed && i)
|
|
4364
4385
|
if (a.tailwindCssText)
|
|
4365
|
-
|
|
4386
|
+
s.textContent = a.tailwindCssText;
|
|
4366
4387
|
else {
|
|
4367
4388
|
const h = document.createElement("link");
|
|
4368
|
-
h.rel = "stylesheet", h.href = Re, i.insertBefore(h,
|
|
4389
|
+
h.rel = "stylesheet", h.href = Re, i.insertBefore(h, s);
|
|
4369
4390
|
}
|
|
4370
4391
|
});
|
|
4371
4392
|
}
|
|
@@ -4405,12 +4426,12 @@ const ve = class ve extends HTMLElement {
|
|
|
4405
4426
|
}
|
|
4406
4427
|
const i = () => {
|
|
4407
4428
|
if (!this.footerTimerEl || !this.activeAuthRequestExpiresAt) return;
|
|
4408
|
-
const
|
|
4409
|
-
if (Number.isNaN(
|
|
4429
|
+
const s = new Date(this.activeAuthRequestExpiresAt).getTime();
|
|
4430
|
+
if (Number.isNaN(s)) {
|
|
4410
4431
|
this.footerTimerEl.setAttribute("hidden", "");
|
|
4411
4432
|
return;
|
|
4412
4433
|
}
|
|
4413
|
-
const a = Math.max(0, Math.floor((
|
|
4434
|
+
const a = Math.max(0, Math.floor((s - Date.now()) / 1e3)), h = Math.floor(a / 60), u = String(a % 60).padStart(2, "0");
|
|
4414
4435
|
this.footerTimerEl.textContent = `${h}:${u}`, this.footerTimerEl.classList.toggle("low", a > 0 && a <= 60), this.footerTimerEl.removeAttribute("hidden"), a <= 0 && this.timerInterval !== null && (clearInterval(this.timerInterval), this.timerInterval = null, this.showExpiredState());
|
|
4415
4436
|
};
|
|
4416
4437
|
i(), this.timerInterval = window.setInterval(i, 1e3);
|
|
@@ -4420,7 +4441,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4420
4441
|
}
|
|
4421
4442
|
showExpiredState() {
|
|
4422
4443
|
if (!(this.authenticated || this.destroyed || !this.currentConfig)) {
|
|
4423
|
-
if (this.stopAuthTransports(), this.codeContainerEl?.classList.remove("code--active"), this.codeContainerEl?.classList.add("code--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.codeEl?.removeAttribute("hidden"), !this.isFooterHidden()) {
|
|
4444
|
+
if (this.stopAuthTransports(), this.codeContainerEl?.classList.remove("code--active", "code--placeholder"), this.codeContainerEl?.classList.add("code--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.codeEl?.removeAttribute("hidden"), !this.isFooterHidden()) {
|
|
4424
4445
|
const i = V(this.currentConfig.lang);
|
|
4425
4446
|
this.footerMessageEl && (this.footerMessageEl.textContent = i.ui.codeExpired), 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(() => {
|
|
4426
4447
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
@@ -4433,23 +4454,23 @@ const ve = class ve extends HTMLElement {
|
|
|
4433
4454
|
if (!this.verifiersEl || !this.currentConfig) return;
|
|
4434
4455
|
const i = V(this.currentConfig.lang);
|
|
4435
4456
|
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden");
|
|
4436
|
-
const
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
console.warn("[sendity-auth] failed to request a new code", u),
|
|
4457
|
+
const s = document.createElement("button");
|
|
4458
|
+
s.type = "button", s.className = "chan primary", s.addEventListener("click", () => {
|
|
4459
|
+
s.disabled = !0, this.requestNewAuthRequest().catch((u) => {
|
|
4460
|
+
console.warn("[sendity-auth] failed to request a new code", u), s.disabled = !1;
|
|
4440
4461
|
});
|
|
4441
4462
|
});
|
|
4442
4463
|
const a = document.createElement("span");
|
|
4443
|
-
a.className = "icon", a.setAttribute("aria-hidden", "true"), a.innerHTML = tr,
|
|
4464
|
+
a.className = "icon", a.setAttribute("aria-hidden", "true"), a.innerHTML = tr, s.appendChild(a);
|
|
4444
4465
|
const h = document.createElement("span");
|
|
4445
|
-
h.className = "label", h.textContent = i.ui.getNewCode,
|
|
4466
|
+
h.className = "label", h.textContent = i.ui.getNewCode, s.appendChild(h), this.verifiersEl.appendChild(s);
|
|
4446
4467
|
}
|
|
4447
4468
|
async requestNewAuthRequest() {
|
|
4448
4469
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4449
4470
|
const i = this.currentConfig;
|
|
4450
4471
|
this.stopAuthTransports(), this.stopCountdown(), this.codeContainerEl?.classList.remove("code--expired");
|
|
4451
|
-
const
|
|
4452
|
-
this.renderVerifiers(i.verifyUrls), this.showFooterWaitingState(), this.configureRealtime(
|
|
4472
|
+
const s = await this.createAuthRequest(i.serverUrl, i.publicKey, me());
|
|
4473
|
+
this.renderVerifiers(i.verifyUrls), this.showFooterWaitingState(), this.configureRealtime(s);
|
|
4453
4474
|
}
|
|
4454
4475
|
handleInitialError(i) {
|
|
4455
4476
|
console.error("[sendity-auth] Unable to initialize authentication", i), this.renderError("Unable to initialize authentication, see console for details"), this.dispatchEvent(
|
|
@@ -4464,11 +4485,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4464
4485
|
const i = {
|
|
4465
4486
|
lang: navigator.language?.startsWith("de") ? "de" : navigator.language?.startsWith("fr") ? "fr" : "en",
|
|
4466
4487
|
transport: "auto"
|
|
4467
|
-
},
|
|
4488
|
+
}, s = (R) => this.getAttribute(R) ?? void 0, a = s("server-url")?.trim() || nr, h = s("public-key")?.trim();
|
|
4468
4489
|
if (!h)
|
|
4469
4490
|
throw new Error("Missing required sendity-auth attribute: public-key");
|
|
4470
4491
|
let u = [...ir];
|
|
4471
|
-
const m =
|
|
4492
|
+
const m = s("verify-urls");
|
|
4472
4493
|
if (m)
|
|
4473
4494
|
try {
|
|
4474
4495
|
if (u = JSON.parse(m), !Array.isArray(u)) throw new Error("verify-urls not array");
|
|
@@ -4478,17 +4499,17 @@ const ve = class ve extends HTMLElement {
|
|
|
4478
4499
|
}
|
|
4479
4500
|
if (u = cr(u), u.length === 0)
|
|
4480
4501
|
throw new Error("Missing required sendity-auth attribute: verify-urls");
|
|
4481
|
-
let g =
|
|
4502
|
+
let g = s("lang") || i.lang;
|
|
4482
4503
|
g !== "en" && g !== "de" && g !== "fr" && (g = i.lang);
|
|
4483
|
-
const
|
|
4484
|
-
return { serverUrl: a, publicKey: h, verifyUrls: u, lang: g, transport:
|
|
4504
|
+
const b = s("transport"), _ = b === "push" || b === "polling" ? b : i.transport, w = this.parseAuthenticatedEventDelayMs(s("authenticated-event-delay-ms"));
|
|
4505
|
+
return { serverUrl: a, publicKey: h, verifyUrls: u, lang: g, transport: _, authenticatedEventDelayMs: w };
|
|
4485
4506
|
}
|
|
4486
4507
|
parseAuthenticatedEventDelayMs(i) {
|
|
4487
4508
|
if (i === void 0 || i.trim() === "") return Ie;
|
|
4488
|
-
const
|
|
4489
|
-
return !Number.isFinite(
|
|
4509
|
+
const s = Number(i);
|
|
4510
|
+
return !Number.isFinite(s) || s < 0 ? Ie : Math.round(s);
|
|
4490
4511
|
}
|
|
4491
|
-
async createAuthRequest(i,
|
|
4512
|
+
async createAuthRequest(i, s, a) {
|
|
4492
4513
|
const h = await fetch(this.joinUrl(i, "/auth-requests"), {
|
|
4493
4514
|
method: "POST",
|
|
4494
4515
|
mode: "cors",
|
|
@@ -4496,14 +4517,14 @@ const ve = class ve extends HTMLElement {
|
|
|
4496
4517
|
"Content-Type": "application/json",
|
|
4497
4518
|
Accept: "application/json"
|
|
4498
4519
|
},
|
|
4499
|
-
body: JSON.stringify({ public_key:
|
|
4520
|
+
body: JSON.stringify({ public_key: s })
|
|
4500
4521
|
});
|
|
4501
4522
|
if (!h.ok) throw new Error(`Auth request creation failed: ${h.status}`);
|
|
4502
4523
|
const u = await h.json();
|
|
4503
4524
|
if (!u.id) throw new Error("Missing id from server response");
|
|
4504
4525
|
const m = this.extractClientSecret(u);
|
|
4505
4526
|
if (!m) throw new Error("Missing client secret from server response");
|
|
4506
|
-
return ar(a, i,
|
|
4527
|
+
return ar(a, i, s, { id: String(u.id), clientSecret: m }), this.activeAuthRequestId = String(u.id), this.activeAuthRequestSecret = m, this.updateActiveAuthRequestExpiry(u), this.updateCode(u.formattedCode ?? u.code), this.dispatchPublicEvent("sendity:challenge-created", {
|
|
4507
4528
|
verificationId: String(u.id),
|
|
4508
4529
|
code: u.formattedCode ?? u.code ?? "",
|
|
4509
4530
|
channel: this.primaryChannel(this.currentConfig?.verifyUrls ?? [])
|
|
@@ -4511,38 +4532,38 @@ const ve = class ve extends HTMLElement {
|
|
|
4511
4532
|
}
|
|
4512
4533
|
async step() {
|
|
4513
4534
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4514
|
-
const { serverUrl: i, publicKey:
|
|
4535
|
+
const { serverUrl: i, publicKey: s } = this.currentConfig, a = me(), h = yt(a, i, s), u = h?.id;
|
|
4515
4536
|
if (!u)
|
|
4516
|
-
return await this.createAuthRequest(i,
|
|
4537
|
+
return await this.createAuthRequest(i, s, a);
|
|
4517
4538
|
this.activeAuthRequestId = u, this.activeAuthRequestSecret = h.clientSecret;
|
|
4518
4539
|
const m = await fetch(
|
|
4519
4540
|
this.authRequestStatusUrl(i, u),
|
|
4520
4541
|
this.authRequestStatusInit(h.clientSecret)
|
|
4521
4542
|
);
|
|
4522
4543
|
if (m.status !== 200)
|
|
4523
|
-
return wt(a, i,
|
|
4544
|
+
return wt(a, i, s), await this.step();
|
|
4524
4545
|
const g = await m.json();
|
|
4525
4546
|
if (g.status === "verified")
|
|
4526
4547
|
return this.handleAuthenticated(g), g;
|
|
4527
4548
|
if (g.status === "expired")
|
|
4528
4549
|
return this.updateActiveAuthRequestExpiry(g), this.updateCode(g.formattedCode ?? g.code), this.showExpiredState(), g;
|
|
4529
4550
|
g.id && (this.activeAuthRequestId = String(g.id));
|
|
4530
|
-
const
|
|
4531
|
-
return
|
|
4551
|
+
const b = this.extractClientSecret(g);
|
|
4552
|
+
return b && (this.activeAuthRequestSecret = b), this.updateActiveAuthRequestExpiry(g), this.updateCode(g.formattedCode ?? g.code), g;
|
|
4532
4553
|
}
|
|
4533
4554
|
configureRealtime(i) {
|
|
4534
4555
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4535
|
-
const { transport:
|
|
4556
|
+
const { transport: s } = this.currentConfig, a = i?.broadcasting, h = !!(a?.key && a.channel && a.authEndpoint);
|
|
4536
4557
|
let u = !1;
|
|
4537
|
-
|
|
4538
|
-
const m = lr(
|
|
4558
|
+
s !== "polling" && h && a ? u = this.subscribeToBroadcasting(a) : s === "push" && console.warn("[sendity-auth] Push transport requested, but server response does not contain broadcasting metadata");
|
|
4559
|
+
const m = lr(s, h, u);
|
|
4539
4560
|
m.start && this.startPolling(m.delayMs);
|
|
4540
4561
|
}
|
|
4541
4562
|
subscribeToBroadcasting(i) {
|
|
4542
4563
|
if (!this.currentConfig || !i.key || !i.channel || !i.authEndpoint) return !1;
|
|
4543
4564
|
try {
|
|
4544
4565
|
window.Pusher = Ki;
|
|
4545
|
-
const
|
|
4566
|
+
const s = (i.scheme ?? "https") === "https", a = i.port ?? (s ? 443 : 80);
|
|
4546
4567
|
return this.echo = new Vi({
|
|
4547
4568
|
broadcaster: "reverb",
|
|
4548
4569
|
key: i.key,
|
|
@@ -4550,8 +4571,8 @@ const ve = class ve extends HTMLElement {
|
|
|
4550
4571
|
wsPort: a,
|
|
4551
4572
|
wssPort: a,
|
|
4552
4573
|
wsPath: i.wsPath ?? "/ws",
|
|
4553
|
-
forceTLS:
|
|
4554
|
-
encrypted:
|
|
4574
|
+
forceTLS: s,
|
|
4575
|
+
encrypted: s,
|
|
4555
4576
|
enabledTransports: ["ws", "wss"],
|
|
4556
4577
|
authEndpoint: this.joinUrl(this.currentConfig.serverUrl, i.authEndpoint),
|
|
4557
4578
|
auth: {
|
|
@@ -4565,20 +4586,20 @@ const ve = class ve extends HTMLElement {
|
|
|
4565
4586
|
}), this.echo.private(i.channel).listen(i.event ?? ".authenticated", (h) => {
|
|
4566
4587
|
this.handleAuthenticated(h);
|
|
4567
4588
|
}), !0;
|
|
4568
|
-
} catch (
|
|
4569
|
-
return console.warn("[sendity-auth] realtime subscription failed, falling back to polling if enabled",
|
|
4589
|
+
} catch (s) {
|
|
4590
|
+
return console.warn("[sendity-auth] realtime subscription failed, falling back to polling if enabled", s), this.currentConfig.transport === "auto" && this.startPolling(At), !1;
|
|
4570
4591
|
}
|
|
4571
4592
|
}
|
|
4572
4593
|
startPolling(i) {
|
|
4573
4594
|
if (this.pollTimer !== null || this.authenticated) return;
|
|
4574
|
-
const
|
|
4595
|
+
const s = () => {
|
|
4575
4596
|
this.pollTimer !== null || this.authenticated || this.destroyed || (this.pollTimer = window.setInterval(() => {
|
|
4576
4597
|
this.step().catch((a) => console.warn("[sendity-auth] poll failed", a));
|
|
4577
4598
|
}, sr));
|
|
4578
4599
|
};
|
|
4579
4600
|
i > 0 ? this.fallbackPollTimer = window.setTimeout(() => {
|
|
4580
|
-
this.fallbackPollTimer = null,
|
|
4581
|
-
}, i) :
|
|
4601
|
+
this.fallbackPollTimer = null, s();
|
|
4602
|
+
}, i) : s();
|
|
4582
4603
|
}
|
|
4583
4604
|
handleAuthenticated(i) {
|
|
4584
4605
|
if (this.authenticated) return;
|
|
@@ -4589,34 +4610,34 @@ const ve = class ve extends HTMLElement {
|
|
|
4589
4610
|
return;
|
|
4590
4611
|
}
|
|
4591
4612
|
this.authenticated = !0, this.currentConfig && wt(me(), this.currentConfig.serverUrl, this.currentConfig.publicKey), this.stopAuthTransports(), this.showSuccess(i);
|
|
4592
|
-
const
|
|
4613
|
+
const s = this.toPublicAuthenticatedDetail(i), a = this.currentConfig?.authenticatedEventDelayMs ?? Ie;
|
|
4593
4614
|
this.authenticatedEventTimer = window.setTimeout(() => {
|
|
4594
|
-
this.authenticatedEventTimer = null, !this.destroyed && this.dispatchPublicEvent("sendity:authenticated",
|
|
4615
|
+
this.authenticatedEventTimer = null, !this.destroyed && this.dispatchPublicEvent("sendity:authenticated", s);
|
|
4595
4616
|
}, a);
|
|
4596
4617
|
}
|
|
4597
4618
|
stopAuthTransports() {
|
|
4598
4619
|
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null), this.fallbackPollTimer !== null && (clearTimeout(this.fallbackPollTimer), this.fallbackPollTimer = null), this.echo && this.activeAuthRequestId && this.echo.leave(`sendity.auth-requests.${this.activeAuthRequestId}`), this.echo?.disconnect(), this.echo = null;
|
|
4599
4620
|
}
|
|
4600
|
-
dispatchPublicEvent(i,
|
|
4601
|
-
this.dispatchEvent(new CustomEvent(i, { bubbles: !0, composed: !0, detail:
|
|
4621
|
+
dispatchPublicEvent(i, s) {
|
|
4622
|
+
this.dispatchEvent(new CustomEvent(i, { bubbles: !0, composed: !0, detail: s }));
|
|
4602
4623
|
}
|
|
4603
4624
|
toPublicAuthenticatedDetail(i) {
|
|
4604
|
-
const
|
|
4625
|
+
const s = String(i.auth_request_id ?? i.authRequestId ?? this.activeAuthRequestId ?? ""), a = i.channel ?? this.primaryChannel(this.currentConfig?.verifyUrls ?? []), h = i.expires_at ?? i.expiresAt;
|
|
4605
4626
|
return {
|
|
4606
|
-
sessionId:
|
|
4627
|
+
sessionId: s,
|
|
4607
4628
|
channel: a,
|
|
4608
4629
|
...i.identifier ? { address: i.identifier } : {},
|
|
4609
|
-
verificationId:
|
|
4630
|
+
verificationId: s,
|
|
4610
4631
|
signedResult: String(i.authorization ?? ""),
|
|
4611
4632
|
...h ? { expiresAt: String(h) } : {}
|
|
4612
4633
|
};
|
|
4613
4634
|
}
|
|
4614
4635
|
primaryChannel(i) {
|
|
4615
|
-
const
|
|
4616
|
-
return
|
|
4636
|
+
const s = i[0] ?? "";
|
|
4637
|
+
return s.startsWith("mailto:") ? "email" : s.startsWith("whatsapp:") || s.startsWith("whatsapp://") ? "whatsapp" : "unknown";
|
|
4617
4638
|
}
|
|
4618
|
-
authRequestStatusUrl(i,
|
|
4619
|
-
return new URL(this.joinUrl(i, `/auth-requests/${encodeURIComponent(
|
|
4639
|
+
authRequestStatusUrl(i, s) {
|
|
4640
|
+
return new URL(this.joinUrl(i, `/auth-requests/${encodeURIComponent(s)}`)).toString();
|
|
4620
4641
|
}
|
|
4621
4642
|
authRequestStatusInit(i) {
|
|
4622
4643
|
return {
|
|
@@ -4632,18 +4653,18 @@ const ve = class ve extends HTMLElement {
|
|
|
4632
4653
|
return String(i.client_secret ?? i.clientSecret ?? "");
|
|
4633
4654
|
}
|
|
4634
4655
|
updateActiveAuthRequestExpiry(i) {
|
|
4635
|
-
const
|
|
4636
|
-
|
|
4656
|
+
const s = i.expires_at ?? i.expiresAt;
|
|
4657
|
+
s && (this.activeAuthRequestExpiresAt = String(s));
|
|
4637
4658
|
}
|
|
4638
4659
|
waitingFooterMessage() {
|
|
4639
4660
|
if (!this.currentConfig) return "";
|
|
4640
|
-
const i = V(this.currentConfig.lang),
|
|
4641
|
-
return
|
|
4661
|
+
const i = V(this.currentConfig.lang), s = this.formatExpiryTime(this.activeAuthRequestExpiresAt, this.currentConfig.lang);
|
|
4662
|
+
return s ? i.ui.footerWaitingUntil.replace("(Time)", s) : i.ui.footerWaiting;
|
|
4642
4663
|
}
|
|
4643
|
-
formatExpiryTime(i,
|
|
4664
|
+
formatExpiryTime(i, s) {
|
|
4644
4665
|
if (!i) return null;
|
|
4645
4666
|
const a = new Date(i);
|
|
4646
|
-
return Number.isNaN(a.getTime()) ? null : new Intl.DateTimeFormat(this.localeForLang(
|
|
4667
|
+
return Number.isNaN(a.getTime()) ? null : new Intl.DateTimeFormat(this.localeForLang(s), { timeStyle: "short" }).format(a);
|
|
4647
4668
|
}
|
|
4648
4669
|
localeForLang(i) {
|
|
4649
4670
|
switch (i) {
|
|
@@ -4657,11 +4678,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4657
4678
|
}
|
|
4658
4679
|
async fetchAuthorizationAfterAuthenticatedSignal() {
|
|
4659
4680
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4660
|
-
const i =
|
|
4661
|
-
if (!
|
|
4681
|
+
const i = yt(me(), this.currentConfig.serverUrl, this.currentConfig.publicKey), s = this.activeAuthRequestId ?? i?.id, a = this.activeAuthRequestSecret ?? i?.clientSecret;
|
|
4682
|
+
if (!s || !a)
|
|
4662
4683
|
throw new Error("Cannot fetch authorization without an active auth request id and client secret");
|
|
4663
4684
|
const h = await fetch(
|
|
4664
|
-
this.authRequestStatusUrl(this.currentConfig.serverUrl,
|
|
4685
|
+
this.authRequestStatusUrl(this.currentConfig.serverUrl, s),
|
|
4665
4686
|
this.authRequestStatusInit(a)
|
|
4666
4687
|
);
|
|
4667
4688
|
if (!h.ok)
|
|
@@ -4677,33 +4698,37 @@ const ve = class ve extends HTMLElement {
|
|
|
4677
4698
|
if (!this.codeEl) return;
|
|
4678
4699
|
if (!!(i && String(i).trim().length > 0)) {
|
|
4679
4700
|
const a = String(i);
|
|
4680
|
-
this.lastCode = a, this.codeEl.textContent = a, this.codeContainerEl?.classList.remove("code--expired"), this.showCodeState();
|
|
4681
|
-
} else
|
|
4682
|
-
this.lastCode = void 0;
|
|
4683
|
-
const a = this.codeEl.getAttribute("data-placeholder") || "••••";
|
|
4684
|
-
this.codeEl.textContent = a, this.showLoading();
|
|
4685
|
-
}
|
|
4701
|
+
this.lastCode = a, this.codeEl.textContent = a, this.codeContainerEl?.classList.remove("code--expired", "code--placeholder"), this.showCodeState();
|
|
4702
|
+
} else
|
|
4703
|
+
this.lastCode = void 0, this.showPlaceholderCode();
|
|
4686
4704
|
this.currentConfig && this.renderVerifiers(this.currentConfig.verifyUrls);
|
|
4687
4705
|
}
|
|
4706
|
+
showPlaceholderCode() {
|
|
4707
|
+
this.codeEl && (this.lastCode = void 0, this.spinnerEl?.setAttribute("hidden", ""), this.codeEl.textContent = this.randomPlaceholderCode(), this.codeEl.removeAttribute("hidden"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired", "code--exiting", "code--collapsed"), this.codeContainerEl?.classList.add("code--placeholder"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", ""));
|
|
4708
|
+
}
|
|
4709
|
+
randomPlaceholderCode() {
|
|
4710
|
+
const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", s = () => i[Math.floor(Math.random() * i.length)], a = () => `${s()}${s()}${s()}`;
|
|
4711
|
+
return `SDY-${a()}-${a()}`;
|
|
4712
|
+
}
|
|
4688
4713
|
renderError(i) {
|
|
4689
4714
|
this.codeEl && (this.codeEl.textContent = i), this.verifiersEl && (this.verifiersEl.innerHTML = "");
|
|
4690
4715
|
}
|
|
4691
4716
|
showLoading() {
|
|
4692
|
-
this.spinnerEl?.removeAttribute("hidden"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired"), this.codeEl?.setAttribute("hidden", ""), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", "");
|
|
4717
|
+
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", "");
|
|
4693
4718
|
}
|
|
4694
4719
|
showCodeState() {
|
|
4695
|
-
if (this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--verified"), this.codeContainerEl?.classList.remove("code--exiting", "code--collapsed"), 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) {
|
|
4720
|
+
if (this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--verified", "code--placeholder"), this.codeContainerEl?.classList.remove("code--exiting", "code--collapsed"), 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) {
|
|
4696
4721
|
const i = V(this.currentConfig.lang);
|
|
4697
4722
|
this.promptEl.textContent = i.ui.sendCodePrompt, this.promptEl.classList.remove("prompt--exiting"), this.promptEl.removeAttribute("aria-hidden"), this.promptEl.removeAttribute("hidden");
|
|
4698
4723
|
}
|
|
4699
4724
|
this.successEl?.setAttribute("hidden", "");
|
|
4700
4725
|
}
|
|
4701
4726
|
showSuccess(i) {
|
|
4702
|
-
this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--active"), this.codeContainerEl?.classList.add("code--verified", "code--exiting"), this.promptEl?.classList.add("prompt--exiting"), this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.stopCountdown();
|
|
4703
|
-
const
|
|
4704
|
-
if (this.footerEl && (this.footerEl.hidden =
|
|
4727
|
+
this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--active", "code--placeholder"), this.codeContainerEl?.classList.add("code--verified", "code--exiting"), this.promptEl?.classList.add("prompt--exiting"), this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.stopCountdown();
|
|
4728
|
+
const s = this.isFooterHidden();
|
|
4729
|
+
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(() => {
|
|
4705
4730
|
this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl && (this.footerBrandEl.hidden = !0);
|
|
4706
|
-
}, pe))), this.footerStatusEl && (this.footerStatusEl.hidden =
|
|
4731
|
+
}, pe))), this.footerStatusEl && (this.footerStatusEl.hidden = s), this.footerMessageEl) {
|
|
4707
4732
|
const a = i.identifier && i.identifier.trim().length > 0 ? i.identifier.trim() : this.destinationAddressForChannel(i.channel ?? this.primaryChannel(this.currentConfig?.verifyUrls ?? []));
|
|
4708
4733
|
this.footerMessageEl.textContent = a ? `Verified ${a}` : "Verified";
|
|
4709
4734
|
}
|
|
@@ -4721,7 +4746,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4721
4746
|
}, pe);
|
|
4722
4747
|
}
|
|
4723
4748
|
destinationAddressForChannel(i) {
|
|
4724
|
-
const
|
|
4749
|
+
const s = this.currentConfig?.verifyUrls ?? [], a = s.find((h) => this.channelClass(h) === i) ?? s[0];
|
|
4725
4750
|
if (!a) return null;
|
|
4726
4751
|
try {
|
|
4727
4752
|
const h = new URL(a, window.location.origin);
|
|
@@ -4743,18 +4768,18 @@ const ve = class ve extends HTMLElement {
|
|
|
4743
4768
|
renderVerifiers(i) {
|
|
4744
4769
|
if (!this.verifiersEl) return;
|
|
4745
4770
|
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.toggle("is-two", i.length === 2);
|
|
4746
|
-
const
|
|
4771
|
+
const s = this.currentConfig;
|
|
4747
4772
|
i.forEach((a, h) => {
|
|
4748
4773
|
if (h > 0 && i.length === 2) {
|
|
4749
4774
|
const w = document.createElement("div");
|
|
4750
4775
|
w.className = "divider", w.setAttribute("aria-hidden", "true");
|
|
4751
4776
|
const R = document.createElement("span");
|
|
4752
|
-
R.textContent =
|
|
4777
|
+
R.textContent = s.lang === "de" ? "oder" : s.lang === "fr" ? "ou" : "or", w.appendChild(R), this.verifiersEl.appendChild(w);
|
|
4753
4778
|
}
|
|
4754
4779
|
const u = document.createElement("div");
|
|
4755
4780
|
u.className = "opt";
|
|
4756
4781
|
const m = document.createElement("a");
|
|
4757
|
-
m.className = "chan " + this.channelClass(a), m.href = this.buildLink(a,
|
|
4782
|
+
m.className = "chan " + this.channelClass(a), m.href = this.buildLink(a, s.lang), m.target = "_blank", m.rel = "noopener noreferrer", m.addEventListener("click", () => {
|
|
4758
4783
|
this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.showFooterWaitingState();
|
|
4759
4784
|
});
|
|
4760
4785
|
const g = this.iconForUrl(a);
|
|
@@ -4762,29 +4787,29 @@ const ve = class ve extends HTMLElement {
|
|
|
4762
4787
|
const w = document.createElement("span");
|
|
4763
4788
|
w.className = "icon", w.setAttribute("aria-hidden", "true"), w.innerHTML = g, m.appendChild(w);
|
|
4764
4789
|
}
|
|
4765
|
-
const
|
|
4766
|
-
|
|
4767
|
-
const
|
|
4768
|
-
if (
|
|
4790
|
+
const b = document.createElement("span");
|
|
4791
|
+
b.className = "label", b.textContent = this.channelLabel(a, s.lang), m.appendChild(b), u.appendChild(m);
|
|
4792
|
+
const _ = this.destinationText(a, s.lang);
|
|
4793
|
+
if (_) {
|
|
4769
4794
|
const w = document.createElement("a");
|
|
4770
|
-
w.className = "dest", w.href = m.href, w.target = "_blank", w.rel = "noopener noreferrer", w.textContent =
|
|
4795
|
+
w.className = "dest", w.href = m.href, w.target = "_blank", w.rel = "noopener noreferrer", w.textContent = _, u.appendChild(w);
|
|
4771
4796
|
}
|
|
4772
4797
|
this.verifiersEl.appendChild(u);
|
|
4773
4798
|
});
|
|
4774
4799
|
}
|
|
4775
4800
|
channelClass(i) {
|
|
4776
4801
|
try {
|
|
4777
|
-
const
|
|
4778
|
-
if (
|
|
4779
|
-
if (
|
|
4802
|
+
const s = new URL(i, window.location.origin);
|
|
4803
|
+
if (s.protocol === "mailto:") return "email";
|
|
4804
|
+
if (s.protocol === "whatsapp:" || s.protocol === "whatsapp://") return "whatsapp";
|
|
4780
4805
|
} catch {
|
|
4781
4806
|
if (i.startsWith("mailto:")) return "email";
|
|
4782
4807
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) return "whatsapp";
|
|
4783
4808
|
}
|
|
4784
4809
|
return "generic";
|
|
4785
4810
|
}
|
|
4786
|
-
channelLabel(i,
|
|
4787
|
-
const a = V(
|
|
4811
|
+
channelLabel(i, s) {
|
|
4812
|
+
const a = V(s), h = this.channelClass(i);
|
|
4788
4813
|
if (h === "email") return a.labels.email;
|
|
4789
4814
|
if (h === "whatsapp") return a.labels.whatsapp;
|
|
4790
4815
|
try {
|
|
@@ -4794,8 +4819,8 @@ const ve = class ve extends HTMLElement {
|
|
|
4794
4819
|
return i;
|
|
4795
4820
|
}
|
|
4796
4821
|
}
|
|
4797
|
-
destinationText(i,
|
|
4798
|
-
const h = V(
|
|
4822
|
+
destinationText(i, s) {
|
|
4823
|
+
const h = V(s).ui.toPrefix ?? "to";
|
|
4799
4824
|
try {
|
|
4800
4825
|
const u = new URL(i, window.location.origin);
|
|
4801
4826
|
if (u.protocol === "mailto:") {
|
|
@@ -4816,17 +4841,17 @@ const ve = class ve extends HTMLElement {
|
|
|
4816
4841
|
}
|
|
4817
4842
|
iconForUrl(i) {
|
|
4818
4843
|
try {
|
|
4819
|
-
const
|
|
4820
|
-
if (
|
|
4821
|
-
if (
|
|
4844
|
+
const s = new URL(i, window.location.origin);
|
|
4845
|
+
if (s.protocol === "mailto:") return vt;
|
|
4846
|
+
if (s.protocol === "whatsapp:" || s.protocol === "whatsapp://") return bt;
|
|
4822
4847
|
} catch {
|
|
4823
4848
|
if (i.startsWith("mailto:")) return vt;
|
|
4824
|
-
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) return
|
|
4849
|
+
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) return bt;
|
|
4825
4850
|
}
|
|
4826
4851
|
return null;
|
|
4827
4852
|
}
|
|
4828
|
-
labelForUrl(i,
|
|
4829
|
-
const a = V(
|
|
4853
|
+
labelForUrl(i, s) {
|
|
4854
|
+
const a = V(s);
|
|
4830
4855
|
try {
|
|
4831
4856
|
const h = new URL(i, window.location.origin);
|
|
4832
4857
|
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(":", "");
|
|
@@ -4834,38 +4859,38 @@ const ve = class ve extends HTMLElement {
|
|
|
4834
4859
|
return i.startsWith("mailto:") ? `${a.ui.by} ${a.labels.email}` : i.startsWith("whatsapp:") || i.startsWith("whatsapp://") ? `${a.ui.by} ${a.labels.whatsapp}` : i;
|
|
4835
4860
|
}
|
|
4836
4861
|
}
|
|
4837
|
-
buildLink(i,
|
|
4838
|
-
const a = this.lastCode, h = V(
|
|
4862
|
+
buildLink(i, s) {
|
|
4863
|
+
const a = this.lastCode, h = V(s), u = window.location.host;
|
|
4839
4864
|
if (!a) return i;
|
|
4840
4865
|
if (i.startsWith("mailto:")) {
|
|
4841
|
-
const [m, g = ""] = i.split("?"),
|
|
4842
|
-
|
|
4843
|
-
const R = this.toQuery(
|
|
4866
|
+
const [m, g = ""] = i.split("?"), b = new URLSearchParams(g), _ = this.applyTemplate(h.templates.emailSubject, u, a), w = this.applyTemplate(h.templates.emailBody, u, a);
|
|
4867
|
+
b.set("subject", _), b.set("body", w);
|
|
4868
|
+
const R = this.toQuery(b);
|
|
4844
4869
|
return `${m}?${R}`;
|
|
4845
4870
|
}
|
|
4846
4871
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) {
|
|
4847
|
-
const [m, g = ""] = i.split("?"),
|
|
4848
|
-
|
|
4849
|
-
const w = this.toQuery(
|
|
4872
|
+
const [m, g = ""] = i.split("?"), b = new URLSearchParams(g), _ = this.applyTemplate(h.templates.whatsappText, u, a);
|
|
4873
|
+
b.set("text", _);
|
|
4874
|
+
const w = this.toQuery(b);
|
|
4850
4875
|
return `${m}?${w}`;
|
|
4851
4876
|
}
|
|
4852
4877
|
return i;
|
|
4853
4878
|
}
|
|
4854
|
-
applyTemplate(i,
|
|
4855
|
-
return i.replaceAll("(Host)",
|
|
4879
|
+
applyTemplate(i, s, a) {
|
|
4880
|
+
return i.replaceAll("(Host)", s).replaceAll("(Code)", a);
|
|
4856
4881
|
}
|
|
4857
4882
|
// Build query string without using URLSearchParams.toString() because it encodes
|
|
4858
4883
|
// spaces as '+', which breaks expectations for many mail clients handling mailto:
|
|
4859
4884
|
// We use encodeURIComponent so spaces become '%20' and follow RFC 3986 style.
|
|
4860
4885
|
toQuery(i) {
|
|
4861
|
-
const
|
|
4886
|
+
const s = [];
|
|
4862
4887
|
return i.forEach((a, h) => {
|
|
4863
4888
|
const u = encodeURIComponent(h), m = encodeURIComponent(a);
|
|
4864
|
-
|
|
4865
|
-
}),
|
|
4889
|
+
s.push(`${u}=${m}`);
|
|
4890
|
+
}), s.join("&");
|
|
4866
4891
|
}
|
|
4867
|
-
joinUrl(i,
|
|
4868
|
-
return i.endsWith("/") &&
|
|
4892
|
+
joinUrl(i, s) {
|
|
4893
|
+
return i.endsWith("/") && s.startsWith("/") ? i + s.slice(1) : !i.endsWith("/") && !s.startsWith("/") ? i + "/" + s : i + s;
|
|
4869
4894
|
}
|
|
4870
4895
|
};
|
|
4871
4896
|
ve.tailwindCssText = null, ve.tailwindLoading = null;
|