react-luminus-components 2.1.8 → 2.1.9
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/.vite/manifest.json +191 -50
- package/dist/Alert-BApdinGX.cjs +1 -0
- package/dist/Alert-D2Bw906t.js +495 -0
- package/dist/DelegationContext-B1WXROG2.cjs +201 -0
- package/dist/DelegationContext-CCnk58PI.js +3156 -0
- package/dist/HelmetContext-ChKPef74.js +49 -0
- package/dist/HelmetContext-DDQ-Phg7.cjs +1 -0
- package/dist/PrimaryButton-D7r0m8xi.js +742 -0
- package/dist/PrimaryButton-D91b3Dmv.cjs +1 -0
- package/dist/SimpleTooltip-B00uLuVM.cjs +1 -0
- package/dist/SimpleTooltip-dwOOgecT.js +1642 -0
- package/dist/Typography-C5KJzU5O.js +1627 -0
- package/dist/Typography-Fo21SeyJ.cjs +20 -0
- package/dist/UserContext-45ZxeQHB.cjs +1 -0
- package/dist/UserContext-ZsTsf5Xe.js +270 -0
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +1773 -852
- package/dist/dateUtils-CXm9PEh6.cjs +1 -0
- package/dist/dateUtils-ayErBYbI.js +1488 -0
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +118 -123
- package/dist/index-4IYT9u10.js +95 -0
- package/dist/index-jmbq5h95.cjs +25 -0
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +97 -98
- package/dist/localStorageUtils-BSATUi5m.cjs +1 -0
- package/dist/localStorageUtils-DNgjNynk.js +1070 -0
- package/dist/main.cjs.js +56 -7
- package/dist/main.es.js +36660 -11628
- package/dist/models/texts/ApprovalTexts.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/useIsFormDirty-76y8Dca-.cjs +1 -0
- package/dist/useIsFormDirty-Ba5uhPH7.js +3257 -0
- package/dist/useWindowSize-7W91GsJQ.js +56 -0
- package/dist/useWindowSize-CLoDaEYh.cjs +1 -0
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +79 -85
- package/package.json +10 -1
- package/dist/FormDisabledProvider-D-DRODSt.js +0 -51
- package/dist/FormDisabledProvider-Dt39yr7W.cjs +0 -1
- package/dist/localStorageUtils-CVwJ9FKd.cjs +0 -1
- package/dist/localStorageUtils-TeLq8MHE.js +0 -59
- package/dist/nivo-bar-D6NJLYWS.js +0 -39616
- package/dist/nivo-bar-SBWBmyeI.cjs +0 -293
- package/dist/useIsFormDirty-CZ4jNRFn.js +0 -117
- package/dist/useIsFormDirty-Crsu8mjo.cjs +0 -1
- package/dist/useLocalStorageState-Ca7olZgH.cjs +0 -1
- package/dist/useLocalStorageState-DtBc-C2W.js +0 -25
package/dist/contexts.es.js
CHANGED
|
@@ -1,537 +1,536 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useState as
|
|
5
|
-
import "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import "
|
|
9
|
-
import "
|
|
10
|
-
import "react
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { u as
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const e = re(t);
|
|
1
|
+
import { L as fe, u as Z, U as We } from "./UserContext-ZsTsf5Xe.js";
|
|
2
|
+
import { jsxs as A, jsx as v } from "react/jsx-runtime";
|
|
3
|
+
import { c as j } from "./index-4IYT9u10.js";
|
|
4
|
+
import { useState as M, useContext as G, useEffect as K, useRef as ee, useMemo as V, useCallback as ne, useSyncExternalStore as Ue, createContext as Be } from "react";
|
|
5
|
+
import { C as je, c as Fe, P as Ae, F as qe, L as ze, u as Ke, A as be, D as Me, k as Ge, g as Ve, b as Xe, d as Je, h as Ye } from "./DelegationContext-CCnk58PI.js";
|
|
6
|
+
import { o as Le } from "./Typography-C5KJzU5O.js";
|
|
7
|
+
import { h as q, b as Qe, P as ue, L as Ze, k as et } from "./PrimaryButton-D7r0m8xi.js";
|
|
8
|
+
import { m as Rn, l as $n, i as An } from "./PrimaryButton-D7r0m8xi.js";
|
|
9
|
+
import { EventType as Se, InteractionStatus as tt, InteractionRequiredAuthError as nt } from "@azure/msal-browser";
|
|
10
|
+
import { MsalProvider as ot, useMsal as st } from "@azure/msal-react";
|
|
11
|
+
import { t as he, D as rt, v as ke, E as it } from "./dateUtils-ayErBYbI.js";
|
|
12
|
+
import { H as ct } from "./HelmetContext-ChKPef74.js";
|
|
13
|
+
import { u as at } from "./useIsBrowserOnline-RAirIO4c.js";
|
|
14
|
+
function lt(n) {
|
|
15
|
+
const e = he(n);
|
|
17
16
|
return e.setHours(23, 59, 59, 999), e;
|
|
18
17
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
18
|
+
function ht() {
|
|
19
|
+
return lt(Date.now());
|
|
21
20
|
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
+
|
|
25
|
-
+
|
|
26
|
-
].sort((
|
|
27
|
-
return
|
|
21
|
+
function ut(n, e) {
|
|
22
|
+
const t = +he(n), [o, s] = [
|
|
23
|
+
+he(e.start),
|
|
24
|
+
+he(e.end)
|
|
25
|
+
].sort((r, i) => r - i);
|
|
26
|
+
return t >= o && t <= s;
|
|
28
27
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
28
|
+
function dt() {
|
|
29
|
+
return rt(Date.now());
|
|
31
30
|
}
|
|
32
|
-
const
|
|
33
|
-
const e =
|
|
34
|
-
children:
|
|
35
|
-
} =
|
|
31
|
+
const ft = (n) => {
|
|
32
|
+
const e = j.c(10), {
|
|
33
|
+
children: t
|
|
34
|
+
} = n, [o, s] = M(!1), [r, i] = M(""), [c, l] = M(void 0);
|
|
36
35
|
let h;
|
|
37
|
-
e[0] === Symbol.for("react.memo_cache_sentinel") ? (h = (S,
|
|
38
|
-
|
|
36
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (h = (S, _) => {
|
|
37
|
+
s(!0), i(S), l(_);
|
|
39
38
|
}, e[0] = h) : h = e[0];
|
|
40
39
|
const u = h;
|
|
41
|
-
let
|
|
42
|
-
e[1] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
43
|
-
|
|
44
|
-
}, e[1] =
|
|
45
|
-
const f =
|
|
40
|
+
let p;
|
|
41
|
+
e[1] === Symbol.for("react.memo_cache_sentinel") ? (p = () => {
|
|
42
|
+
s(!1);
|
|
43
|
+
}, e[1] = p) : p = e[1];
|
|
44
|
+
const f = p;
|
|
46
45
|
let g;
|
|
47
|
-
e[2] !==
|
|
48
|
-
show:
|
|
49
|
-
text:
|
|
46
|
+
e[2] !== o || e[3] !== r || e[4] !== c ? (g = {
|
|
47
|
+
show: o,
|
|
48
|
+
text: r,
|
|
50
49
|
showConfirm: u,
|
|
51
50
|
hideConfirm: f,
|
|
52
51
|
textSm: c
|
|
53
|
-
}, e[2] =
|
|
52
|
+
}, e[2] = o, e[3] = r, e[4] = c, e[5] = g) : g = e[5];
|
|
54
53
|
const w = g;
|
|
55
54
|
let b;
|
|
56
|
-
e[6] === Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */
|
|
55
|
+
e[6] === Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ v(cn, {}), e[6] = b) : b = e[6];
|
|
57
56
|
let d;
|
|
58
|
-
return e[7] !==
|
|
57
|
+
return e[7] !== t || e[8] !== w ? (d = /* @__PURE__ */ A(je.Provider, { value: w, children: [
|
|
59
58
|
b,
|
|
60
|
-
|
|
61
|
-
] }), e[7] =
|
|
62
|
-
},
|
|
63
|
-
const
|
|
59
|
+
t
|
|
60
|
+
] }), e[7] = t, e[8] = w, e[9] = d) : d = e[9], d;
|
|
61
|
+
}, gt = () => {
|
|
62
|
+
const n = j.c(49), {
|
|
64
63
|
texts: e
|
|
65
|
-
} =
|
|
66
|
-
confirm:
|
|
64
|
+
} = G(fe), {
|
|
65
|
+
confirm: t
|
|
67
66
|
} = e, {
|
|
68
|
-
isShown:
|
|
69
|
-
text:
|
|
70
|
-
onFinish:
|
|
71
|
-
} =
|
|
72
|
-
options:
|
|
73
|
-
} =
|
|
67
|
+
isShown: o,
|
|
68
|
+
text: s,
|
|
69
|
+
onFinish: r
|
|
70
|
+
} = Fe(), {
|
|
71
|
+
options: i
|
|
72
|
+
} = G(Ae), [c, l] = M(i.defaultValue ?? "");
|
|
74
73
|
let h;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
74
|
+
n[0] !== r ? (h = () => {
|
|
75
|
+
r(null);
|
|
76
|
+
}, n[0] = r, n[1] = h) : h = n[1];
|
|
78
77
|
const u = h;
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
const f =
|
|
78
|
+
let p;
|
|
79
|
+
n[2] !== r || n[3] !== i.required || n[4] !== c ? (p = (z) => {
|
|
80
|
+
z.preventDefault(), !(i.required && !c) && (r(c), l(""));
|
|
81
|
+
}, n[2] = r, n[3] = i.required, n[4] = c, n[5] = p) : p = n[5];
|
|
82
|
+
const f = p;
|
|
84
83
|
let g;
|
|
85
|
-
|
|
84
|
+
n[6] === Symbol.for("react.memo_cache_sentinel") ? (g = (z) => l(z.currentTarget.value), n[6] = g) : g = n[6];
|
|
86
85
|
let w;
|
|
87
|
-
|
|
86
|
+
n[7] !== c ? (w = {
|
|
88
87
|
value: c,
|
|
89
88
|
onChange: g,
|
|
90
89
|
className: "w-100",
|
|
91
90
|
autoFocus: !0,
|
|
92
91
|
tabIndex: 0
|
|
93
|
-
},
|
|
92
|
+
}, n[7] = c, n[8] = w) : w = n[8];
|
|
94
93
|
const b = w;
|
|
95
94
|
let d, S;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}, S = [
|
|
99
|
-
let p;
|
|
100
|
-
t[13] !== o ? (p = /* @__PURE__ */ y(U.Header, { className: "justify-content-center", children: /* @__PURE__ */ y(U.Title, { children: o }) }), t[13] = o, t[14] = p) : p = t[14];
|
|
101
|
-
let C;
|
|
102
|
-
t[15] !== b || t[16] !== r.input || t[17] !== r.maxLength ? (C = r.input === "textarea" ? /* @__PURE__ */ y("textarea", { ...b, rows: 5, maxLength: r.maxLength }) : void 0, t[15] = b, t[16] = r.input, t[17] = r.maxLength, t[18] = C) : C = t[18];
|
|
95
|
+
n[9] !== o || n[10] !== i.defaultValue ? (d = () => {
|
|
96
|
+
o === !0 && l(i.defaultValue ?? "");
|
|
97
|
+
}, S = [o, i.defaultValue], n[9] = o, n[10] = i.defaultValue, n[11] = d, n[12] = S) : (d = n[11], S = n[12]), K(d, S);
|
|
103
98
|
let _;
|
|
104
|
-
|
|
105
|
-
let
|
|
106
|
-
|
|
99
|
+
n[13] !== s ? (_ = /* @__PURE__ */ v(q.Header, { className: "justify-content-center", children: /* @__PURE__ */ v(q.Title, { children: s }) }), n[13] = s, n[14] = _) : _ = n[14];
|
|
100
|
+
let C;
|
|
101
|
+
n[15] !== b || n[16] !== i.input || n[17] !== i.maxLength ? (C = i.input === "textarea" ? /* @__PURE__ */ v("textarea", { ...b, rows: 5, maxLength: i.maxLength }) : void 0, n[15] = b, n[16] = i.input, n[17] = i.maxLength, n[18] = C) : C = n[18];
|
|
102
|
+
let m;
|
|
103
|
+
n[19] !== b || n[20] !== i.input || n[21] !== i.maxLength || n[22] !== i.type ? (m = i.input === "input" ? /* @__PURE__ */ v(Qe, { ...b, type: i.type, maxLength: i.maxLength }) : void 0, n[19] = b, n[20] = i.input, n[21] = i.maxLength, n[22] = i.type, n[23] = m) : m = n[23];
|
|
104
|
+
let E;
|
|
105
|
+
n[24] !== i.maxLength || n[25] !== c ? (E = i.maxLength != null && /* @__PURE__ */ v("div", { className: "d-flex justify-content-end", children: /* @__PURE__ */ A(Le, { variant: "caption", children: [
|
|
107
106
|
c.length,
|
|
108
107
|
"/",
|
|
109
|
-
|
|
110
|
-
] }) }),
|
|
111
|
-
let k;
|
|
112
|
-
t[27] !== v || t[28] !== C || t[29] !== _ ? (k = /* @__PURE__ */ A(U.Body, { children: [
|
|
113
|
-
C,
|
|
114
|
-
_,
|
|
115
|
-
v
|
|
116
|
-
] }), t[27] = v, t[28] = C, t[29] = _, t[30] = k) : k = t[30];
|
|
117
|
-
let M;
|
|
118
|
-
t[31] !== n.cancel || t[32] !== u ? (M = /* @__PURE__ */ y(ie, { variant: "outlined", color: "secondary", onClick: u, className: "flex-grow-1", children: n.cancel }), t[31] = n.cancel, t[32] = u, t[33] = M) : M = t[33];
|
|
119
|
-
const I = r.required && !c;
|
|
120
|
-
let $;
|
|
121
|
-
t[34] !== n.confirm || t[35] !== I ? ($ = /* @__PURE__ */ y(ie, { color: "primary", disabled: I, type: "submit", className: "flex-grow-1", children: n.confirm }), t[34] = n.confirm, t[35] = I, t[36] = $) : $ = t[36];
|
|
108
|
+
i.maxLength
|
|
109
|
+
] }) }), n[24] = i.maxLength, n[25] = c, n[26] = E) : E = n[26];
|
|
122
110
|
let P;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
111
|
+
n[27] !== E || n[28] !== C || n[29] !== m ? (P = /* @__PURE__ */ A(q.Body, { children: [
|
|
112
|
+
C,
|
|
113
|
+
m,
|
|
114
|
+
E
|
|
115
|
+
] }), n[27] = E, n[28] = C, n[29] = m, n[30] = P) : P = n[30];
|
|
127
116
|
let N;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
]
|
|
117
|
+
n[31] !== t.cancel || n[32] !== u ? (N = /* @__PURE__ */ v(ue, { variant: "outlined", color: "secondary", onClick: u, className: "flex-grow-1", children: t.cancel }), n[31] = t.cancel, n[32] = u, n[33] = N) : N = n[33];
|
|
118
|
+
const L = i.required && !c;
|
|
119
|
+
let O;
|
|
120
|
+
n[34] !== t.confirm || n[35] !== L ? (O = /* @__PURE__ */ v(ue, { color: "primary", disabled: L, type: "submit", className: "flex-grow-1", children: t.confirm }), n[34] = t.confirm, n[35] = L, n[36] = O) : O = n[36];
|
|
121
|
+
let D;
|
|
122
|
+
n[37] !== N || n[38] !== O ? (D = /* @__PURE__ */ A(q.Footer, { className: "w-100 d-flex gap-5", children: [
|
|
123
|
+
N,
|
|
124
|
+
O
|
|
125
|
+
] }), n[37] = N, n[38] = O, n[39] = D) : D = n[39];
|
|
132
126
|
let W;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
] }),
|
|
127
|
+
n[40] !== f || n[41] !== P || n[42] !== D ? (W = /* @__PURE__ */ A("form", { onSubmit: f, onKeyDown: _t, children: [
|
|
128
|
+
P,
|
|
129
|
+
D
|
|
130
|
+
] }), n[40] = f, n[41] = P, n[42] = D, n[43] = W) : W = n[43];
|
|
131
|
+
let F;
|
|
132
|
+
return n[44] !== o || n[45] !== u || n[46] !== W || n[47] !== _ ? (F = /* @__PURE__ */ A(q, { show: o, size: "sm", centered: !0, onHide: u, children: [
|
|
133
|
+
_,
|
|
134
|
+
W
|
|
135
|
+
] }), n[44] = o, n[45] = u, n[46] = W, n[47] = _, n[48] = F) : F = n[48], F;
|
|
137
136
|
};
|
|
138
|
-
function
|
|
139
|
-
return
|
|
137
|
+
function _t(n) {
|
|
138
|
+
return n.stopPropagation();
|
|
140
139
|
}
|
|
141
|
-
const
|
|
142
|
-
const e =
|
|
143
|
-
children:
|
|
144
|
-
} =
|
|
140
|
+
const pt = (n) => {
|
|
141
|
+
const e = j.c(11), {
|
|
142
|
+
children: t
|
|
143
|
+
} = n, [o, s] = M(!1), [r, i] = M("");
|
|
145
144
|
let c;
|
|
146
145
|
e[0] === Symbol.for("react.memo_cache_sentinel") ? (c = {
|
|
147
146
|
input: "textarea",
|
|
148
147
|
type: "text"
|
|
149
148
|
}, e[0] = c) : c = e[0];
|
|
150
|
-
const [
|
|
151
|
-
let
|
|
152
|
-
e[1] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
153
|
-
|
|
154
|
-
}, e[1] =
|
|
155
|
-
const f =
|
|
149
|
+
const [l, h] = M(c), u = ee(mt);
|
|
150
|
+
let p;
|
|
151
|
+
e[1] === Symbol.for("react.memo_cache_sentinel") ? (p = (C) => {
|
|
152
|
+
i(C), s(!0);
|
|
153
|
+
}, e[1] = p) : p = e[1];
|
|
154
|
+
const f = p;
|
|
156
155
|
let g;
|
|
157
156
|
e[2] === Symbol.for("react.memo_cache_sentinel") ? (g = () => {
|
|
158
|
-
|
|
157
|
+
s(!1);
|
|
159
158
|
}, e[2] = g) : g = e[2];
|
|
160
159
|
const w = g;
|
|
161
160
|
let b;
|
|
162
|
-
e[3] !==
|
|
163
|
-
isShown:
|
|
164
|
-
text:
|
|
161
|
+
e[3] !== o || e[4] !== l || e[5] !== r ? (b = {
|
|
162
|
+
isShown: o,
|
|
163
|
+
text: r,
|
|
165
164
|
showPrompt: f,
|
|
166
165
|
hidePrompt: w,
|
|
167
166
|
resolveRef: u,
|
|
168
|
-
options:
|
|
167
|
+
options: l,
|
|
169
168
|
setOptions: h
|
|
170
|
-
}, e[3] =
|
|
169
|
+
}, e[3] = o, e[4] = l, e[5] = r, e[6] = b) : b = e[6];
|
|
171
170
|
const d = b;
|
|
172
171
|
let S;
|
|
173
|
-
e[7] === Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */
|
|
174
|
-
let
|
|
175
|
-
return e[8] !==
|
|
176
|
-
|
|
172
|
+
e[7] === Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ v(gt, {}), e[7] = S) : S = e[7];
|
|
173
|
+
let _;
|
|
174
|
+
return e[8] !== t || e[9] !== d ? (_ = /* @__PURE__ */ A(Ae.Provider, { value: d, children: [
|
|
175
|
+
t,
|
|
177
176
|
S
|
|
178
|
-
] }), e[8] =
|
|
177
|
+
] }), e[8] = t, e[9] = d, e[10] = _) : _ = e[10], _;
|
|
179
178
|
};
|
|
180
|
-
function
|
|
179
|
+
function mt() {
|
|
181
180
|
}
|
|
182
|
-
const
|
|
183
|
-
const e =
|
|
184
|
-
cookieDomain:
|
|
185
|
-
axiosOptions:
|
|
186
|
-
language:
|
|
187
|
-
texts:
|
|
188
|
-
ProjectIconComponent:
|
|
181
|
+
const bn = (n) => {
|
|
182
|
+
const e = j.c(14), {
|
|
183
|
+
cookieDomain: t,
|
|
184
|
+
axiosOptions: o,
|
|
185
|
+
language: s,
|
|
186
|
+
texts: r,
|
|
187
|
+
ProjectIconComponent: i,
|
|
189
188
|
localizationContext: c,
|
|
190
|
-
chartColorPalette:
|
|
189
|
+
chartColorPalette: l,
|
|
191
190
|
children: h
|
|
192
|
-
} =
|
|
191
|
+
} = n;
|
|
193
192
|
let u;
|
|
194
|
-
e[0] !==
|
|
195
|
-
axiosOptions:
|
|
196
|
-
cookieDomain:
|
|
197
|
-
language:
|
|
198
|
-
texts:
|
|
199
|
-
ProjectIconComponent:
|
|
193
|
+
e[0] !== i || e[1] !== o || e[2] !== l || e[3] !== t || e[4] !== s || e[5] !== c || e[6] !== r ? (u = {
|
|
194
|
+
axiosOptions: o,
|
|
195
|
+
cookieDomain: t,
|
|
196
|
+
language: s,
|
|
197
|
+
texts: r,
|
|
198
|
+
ProjectIconComponent: i,
|
|
200
199
|
localizationContext: c,
|
|
201
|
-
chartColorPalette:
|
|
202
|
-
}, e[0] =
|
|
203
|
-
const
|
|
200
|
+
chartColorPalette: l
|
|
201
|
+
}, e[0] = i, e[1] = o, e[2] = l, e[3] = t, e[4] = s, e[5] = c, e[6] = r, e[7] = u) : u = e[7];
|
|
202
|
+
const p = u;
|
|
204
203
|
let f;
|
|
205
|
-
e[8] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */
|
|
204
|
+
e[8] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ v(qe, {}), e[8] = f) : f = e[8];
|
|
206
205
|
let g;
|
|
207
|
-
e[9] !== h ? (g = /* @__PURE__ */
|
|
206
|
+
e[9] !== h ? (g = /* @__PURE__ */ v(ft, { children: /* @__PURE__ */ A(pt, { children: [
|
|
208
207
|
f,
|
|
209
208
|
h
|
|
210
209
|
] }) }), e[9] = h, e[10] = g) : g = e[10];
|
|
211
210
|
let w;
|
|
212
|
-
return e[11] !==
|
|
213
|
-
},
|
|
214
|
-
const e =
|
|
215
|
-
children:
|
|
216
|
-
} =
|
|
217
|
-
let
|
|
218
|
-
e[0] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
219
|
-
const [
|
|
211
|
+
return e[11] !== p || e[12] !== g ? (w = /* @__PURE__ */ v(fe.Provider, { value: p, children: g }), e[11] = p, e[12] = g, e[13] = w) : w = e[13], w;
|
|
212
|
+
}, yn = (n) => {
|
|
213
|
+
const e = j.c(15), {
|
|
214
|
+
children: t
|
|
215
|
+
} = n, [o, s] = M(!1);
|
|
216
|
+
let r;
|
|
217
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ new Set(), e[0] = r) : r = e[0];
|
|
218
|
+
const [i] = M(r);
|
|
220
219
|
let c;
|
|
221
|
-
e[1] !==
|
|
222
|
-
|
|
223
|
-
}, e[1] =
|
|
224
|
-
const
|
|
220
|
+
e[1] !== i ? (c = (b) => {
|
|
221
|
+
i.add(b), s(!0);
|
|
222
|
+
}, e[1] = i, e[2] = c) : c = e[2];
|
|
223
|
+
const l = c;
|
|
225
224
|
let h;
|
|
226
|
-
e[3] !==
|
|
227
|
-
|
|
228
|
-
}, e[3] =
|
|
225
|
+
e[3] !== i ? (h = (b) => {
|
|
226
|
+
i.delete(b), i.size === 0 && s(!1);
|
|
227
|
+
}, e[3] = i, e[4] = h) : h = e[4];
|
|
229
228
|
const u = h;
|
|
230
|
-
let
|
|
231
|
-
e[5] !==
|
|
232
|
-
isLoading:
|
|
233
|
-
startLoading:
|
|
229
|
+
let p;
|
|
230
|
+
e[5] !== o || e[6] !== l || e[7] !== u ? (p = {
|
|
231
|
+
isLoading: o,
|
|
232
|
+
startLoading: l,
|
|
234
233
|
stopLoading: u
|
|
235
|
-
}, e[5] =
|
|
236
|
-
const f =
|
|
234
|
+
}, e[5] = o, e[6] = l, e[7] = u, e[8] = p) : p = e[8];
|
|
235
|
+
const f = p;
|
|
237
236
|
let g;
|
|
238
|
-
e[9] !==
|
|
237
|
+
e[9] !== o ? (g = o && /* @__PURE__ */ v(Ze, {}), e[9] = o, e[10] = g) : g = e[10];
|
|
239
238
|
let w;
|
|
240
|
-
return e[11] !==
|
|
239
|
+
return e[11] !== t || e[12] !== f || e[13] !== g ? (w = /* @__PURE__ */ A(ze.Provider, { value: f, children: [
|
|
241
240
|
g,
|
|
242
|
-
|
|
243
|
-
] }), e[11] =
|
|
244
|
-
},
|
|
245
|
-
const e =
|
|
246
|
-
children:
|
|
247
|
-
} =
|
|
248
|
-
msalInstance:
|
|
249
|
-
getToken:
|
|
250
|
-
} =
|
|
251
|
-
delegation:
|
|
241
|
+
t
|
|
242
|
+
] }), e[11] = t, e[12] = f, e[13] = g, e[14] = w) : w = e[14], w;
|
|
243
|
+
}, Cn = (n) => {
|
|
244
|
+
const e = j.c(39), {
|
|
245
|
+
children: t
|
|
246
|
+
} = n, o = Ke(), {
|
|
247
|
+
msalInstance: s,
|
|
248
|
+
getToken: r
|
|
249
|
+
} = G(be), {
|
|
250
|
+
delegation: i,
|
|
252
251
|
setDelegation: c,
|
|
253
|
-
setAvailableDelegations:
|
|
252
|
+
setAvailableDelegations: l,
|
|
254
253
|
refreshAvailableDelegations: h
|
|
255
|
-
} =
|
|
254
|
+
} = G(Me), [u, p] = M(null);
|
|
256
255
|
let f;
|
|
257
|
-
e[0] !==
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
}, e[0] =
|
|
256
|
+
e[0] !== r ? (f = async () => {
|
|
257
|
+
const R = await r();
|
|
258
|
+
R && p(R.token);
|
|
259
|
+
}, e[0] = r, e[1] = f) : f = e[1];
|
|
261
260
|
const g = f;
|
|
262
261
|
let w, b;
|
|
263
262
|
e[2] !== g ? (w = () => {
|
|
264
263
|
g();
|
|
265
|
-
}, b = [g], e[2] = g, e[3] = w, e[4] = b) : (w = e[3], b = e[4]),
|
|
264
|
+
}, b = [g], e[2] = g, e[3] = w, e[4] = b) : (w = e[3], b = e[4]), K(w, b);
|
|
266
265
|
let d;
|
|
267
266
|
if (e[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
268
267
|
e: {
|
|
269
|
-
const
|
|
270
|
-
if (!
|
|
268
|
+
const R = localStorage.getItem("user") ?? null;
|
|
269
|
+
if (!R) {
|
|
271
270
|
d = null;
|
|
272
271
|
break e;
|
|
273
272
|
}
|
|
274
|
-
d = JSON.parse(
|
|
273
|
+
d = JSON.parse(R ?? "");
|
|
275
274
|
}
|
|
276
275
|
e[5] = d;
|
|
277
276
|
} else
|
|
278
277
|
d = e[5];
|
|
279
278
|
const S = d;
|
|
280
|
-
let
|
|
281
|
-
e[6] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
282
|
-
state: S ?
|
|
279
|
+
let _;
|
|
280
|
+
e[6] === Symbol.for("react.memo_cache_sentinel") ? (_ = {
|
|
281
|
+
state: S ? Z.LOGGED_IN : Z.LOGGED_OUT,
|
|
283
282
|
user: S
|
|
284
|
-
}, e[6] =
|
|
285
|
-
const [C,
|
|
286
|
-
let
|
|
287
|
-
e[7] !==
|
|
288
|
-
let
|
|
289
|
-
return await
|
|
283
|
+
}, e[6] = _) : _ = e[6];
|
|
284
|
+
const [C, m] = M(_);
|
|
285
|
+
let E;
|
|
286
|
+
e[7] !== o ? (E = async (R) => {
|
|
287
|
+
let U = null;
|
|
288
|
+
return await o.get("/user/detail", R ? {
|
|
290
289
|
headers: {
|
|
291
|
-
Authorization: `Bearer ${
|
|
290
|
+
Authorization: `Bearer ${R}`
|
|
292
291
|
}
|
|
293
|
-
} : void 0).then((
|
|
294
|
-
|
|
292
|
+
} : void 0).then((me) => {
|
|
293
|
+
U = me.data;
|
|
295
294
|
}).catch(() => {
|
|
296
|
-
|
|
297
|
-
}),
|
|
298
|
-
}, e[7] =
|
|
299
|
-
const
|
|
300
|
-
let
|
|
301
|
-
e[9] !==
|
|
302
|
-
localStorage.removeItem("user"),
|
|
303
|
-
state:
|
|
295
|
+
U = null;
|
|
296
|
+
}), U;
|
|
297
|
+
}, e[7] = o, e[8] = E) : E = e[8];
|
|
298
|
+
const P = E;
|
|
299
|
+
let N;
|
|
300
|
+
e[9] !== l || e[10] !== c ? (N = () => {
|
|
301
|
+
c(null), localStorage.removeItem("user-delegation"), l(null), localStorage.removeItem("user"), m({
|
|
302
|
+
state: Z.LOGGED_OUT,
|
|
304
303
|
user: null
|
|
305
|
-
})
|
|
306
|
-
}, e[9] =
|
|
307
|
-
const
|
|
308
|
-
let
|
|
309
|
-
e[12] !==
|
|
310
|
-
|
|
311
|
-
state:
|
|
304
|
+
});
|
|
305
|
+
}, e[9] = l, e[10] = c, e[11] = N) : N = e[11];
|
|
306
|
+
const L = N;
|
|
307
|
+
let O;
|
|
308
|
+
e[12] !== P || e[13] !== h ? (O = async (R) => {
|
|
309
|
+
m({
|
|
310
|
+
state: Z.LOGGING_IN,
|
|
312
311
|
user: null
|
|
313
312
|
});
|
|
314
|
-
const
|
|
315
|
-
return
|
|
316
|
-
state:
|
|
317
|
-
user:
|
|
318
|
-
}), localStorage.setItem("user", JSON.stringify(
|
|
319
|
-
state:
|
|
313
|
+
const U = await P(R);
|
|
314
|
+
return U ? (m({
|
|
315
|
+
state: Z.LOGGED_IN,
|
|
316
|
+
user: U
|
|
317
|
+
}), localStorage.setItem("user", JSON.stringify(U)), await h(), !0) : (m({
|
|
318
|
+
state: Z.LOGIN_FAILED,
|
|
320
319
|
user: null
|
|
321
320
|
}), !1);
|
|
322
|
-
}, e[12] =
|
|
323
|
-
const
|
|
324
|
-
let
|
|
325
|
-
e[15] !==
|
|
326
|
-
if (
|
|
327
|
-
const
|
|
328
|
-
if (
|
|
329
|
-
const
|
|
330
|
-
|
|
321
|
+
}, e[12] = P, e[13] = h, e[14] = O) : O = e[14];
|
|
322
|
+
const D = O;
|
|
323
|
+
let W;
|
|
324
|
+
e[15] !== s ? (W = () => {
|
|
325
|
+
if (s) {
|
|
326
|
+
const R = s.addEventCallback((U) => {
|
|
327
|
+
if (U.eventType === Se.LOGIN_SUCCESS && U.payload) {
|
|
328
|
+
const me = U.payload;
|
|
329
|
+
p(me.accessToken);
|
|
331
330
|
}
|
|
332
331
|
});
|
|
333
332
|
return () => {
|
|
334
|
-
|
|
333
|
+
R && s.removeEventCallback(R);
|
|
335
334
|
};
|
|
336
335
|
}
|
|
337
|
-
return
|
|
338
|
-
}, e[15] =
|
|
339
|
-
let W;
|
|
340
|
-
e[17] !== P || e[18] !== I || e[19] !== o ? (W = [o, P, I], e[17] = P, e[18] = I, e[19] = o, e[20] = W) : W = e[20], B(N, W);
|
|
336
|
+
return wt;
|
|
337
|
+
}, e[15] = s, e[16] = W) : W = e[16];
|
|
341
338
|
let F;
|
|
342
|
-
e[
|
|
343
|
-
|
|
344
|
-
|
|
339
|
+
e[17] !== D || e[18] !== L || e[19] !== s ? (F = [s, D, L], e[17] = D, e[18] = L, e[19] = s, e[20] = F) : F = e[20], K(W, F);
|
|
340
|
+
let z;
|
|
341
|
+
e[21] !== D || e[22] !== L || e[23] !== c ? (z = async (R) => {
|
|
342
|
+
R && await D(R).catch(() => {
|
|
343
|
+
L(), c(null);
|
|
345
344
|
});
|
|
346
|
-
}, e[21] =
|
|
347
|
-
const
|
|
348
|
-
let
|
|
349
|
-
e[25] !== u || e[26] !==
|
|
350
|
-
|
|
351
|
-
}, e[25] = u, e[26] =
|
|
352
|
-
const
|
|
353
|
-
let
|
|
354
|
-
e[28] !== u || e[29] !==
|
|
355
|
-
let
|
|
356
|
-
e[32] !==
|
|
345
|
+
}, e[21] = D, e[22] = L, e[23] = c, e[24] = z) : z = e[24];
|
|
346
|
+
const Q = z;
|
|
347
|
+
let re;
|
|
348
|
+
e[25] !== u || e[26] !== Q ? (re = () => {
|
|
349
|
+
Q(u);
|
|
350
|
+
}, e[25] = u, e[26] = Q, e[27] = re) : re = e[27];
|
|
351
|
+
const _e = i == null ? void 0 : i.id;
|
|
352
|
+
let ie;
|
|
353
|
+
e[28] !== u || e[29] !== Q || e[30] !== _e ? (ie = [u, _e, Q], e[28] = u, e[29] = Q, e[30] = _e, e[31] = ie) : ie = e[31], K(re, ie);
|
|
354
|
+
let ce;
|
|
355
|
+
e[32] !== D || e[33] !== L || e[34] !== C ? (ce = {
|
|
357
356
|
user: C.user,
|
|
358
357
|
userLoginState: C,
|
|
359
|
-
loginUser:
|
|
360
|
-
logoutUser:
|
|
361
|
-
}, e[32] =
|
|
362
|
-
const
|
|
363
|
-
let
|
|
364
|
-
return e[36] !==
|
|
358
|
+
loginUser: D,
|
|
359
|
+
logoutUser: L
|
|
360
|
+
}, e[32] = D, e[33] = L, e[34] = C, e[35] = ce) : ce = e[35];
|
|
361
|
+
const pe = ce;
|
|
362
|
+
let ae;
|
|
363
|
+
return e[36] !== t || e[37] !== pe ? (ae = /* @__PURE__ */ v(We.Provider, { value: pe, children: t }), e[36] = t, e[37] = pe, e[38] = ae) : ae = e[38], ae;
|
|
365
364
|
};
|
|
366
|
-
function
|
|
365
|
+
function wt() {
|
|
367
366
|
}
|
|
368
|
-
const
|
|
369
|
-
const
|
|
367
|
+
const St = () => {
|
|
368
|
+
const n = j.c(2);
|
|
370
369
|
let e;
|
|
371
|
-
|
|
372
|
-
let
|
|
373
|
-
return
|
|
370
|
+
n[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ v("p", { children: "Redirecting..." }), n[0] = e) : e = n[0];
|
|
371
|
+
let t;
|
|
372
|
+
return n[1] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ A("div", { children: [
|
|
374
373
|
e,
|
|
375
374
|
/* @__PURE__ */ A("p", { children: [
|
|
376
375
|
"If you are not redirected within 10 seconds, please click",
|
|
377
376
|
" ",
|
|
378
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ v("a", { href: window.location.href.replace("/blank", "/"), children: "here" })
|
|
379
378
|
] })
|
|
380
|
-
] }),
|
|
381
|
-
},
|
|
382
|
-
const e =
|
|
379
|
+
] }), n[1] = t) : t = n[1], t;
|
|
380
|
+
}, bt = (n) => {
|
|
381
|
+
const e = n == null ? void 0 : n.getActiveAccount();
|
|
383
382
|
console.log("getTokenMsal activeAccount", e);
|
|
384
|
-
const
|
|
385
|
-
console.log("getTokenMsal allAccounts",
|
|
386
|
-
const
|
|
387
|
-
return console.log("getTokenMsal account",
|
|
388
|
-
},
|
|
389
|
-
...
|
|
383
|
+
const t = n == null ? void 0 : n.getAllAccounts();
|
|
384
|
+
console.log("getTokenMsal allAccounts", t);
|
|
385
|
+
const o = (t == null ? void 0 : t.at(0)) ?? void 0;
|
|
386
|
+
return console.log("getTokenMsal account", o), o ? (e || n == null || n.setActiveAccount(o), o) : null;
|
|
387
|
+
}, Ee = ({
|
|
388
|
+
...n
|
|
390
389
|
}) => {
|
|
391
390
|
const {
|
|
392
391
|
inProgress: e
|
|
393
|
-
} =
|
|
394
|
-
cookieDomain:
|
|
395
|
-
} =
|
|
396
|
-
() =>
|
|
392
|
+
} = st(), {
|
|
393
|
+
cookieDomain: t
|
|
394
|
+
} = G(fe), [, o] = Ge(["Authorization"]), s = V(
|
|
395
|
+
() => n.useMsal ? n.msalInstance : null,
|
|
397
396
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
398
|
-
[
|
|
399
|
-
),
|
|
400
|
-
() =>
|
|
397
|
+
[n.useMsal, n.useMsal ? n.msalInstance : null]
|
|
398
|
+
), r = V(
|
|
399
|
+
() => n.useMsal ? n.msalScopes : [],
|
|
401
400
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
402
|
-
[
|
|
403
|
-
),
|
|
404
|
-
() =>
|
|
401
|
+
[n.useMsal, n.useMsal ? n.msalScopes : null]
|
|
402
|
+
), i = V(
|
|
403
|
+
() => n.useMsal ? n.msalExtraScopes : [],
|
|
405
404
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
406
|
-
[
|
|
407
|
-
), c =
|
|
405
|
+
[n.useMsal, n.useMsal ? n.msalExtraScopes : null]
|
|
406
|
+
), c = ee(null), l = ee(!1), h = ne(() => {
|
|
408
407
|
const d = localStorage.getItem("token");
|
|
409
408
|
return d ? {
|
|
410
409
|
token: d,
|
|
411
|
-
expiresOn:
|
|
410
|
+
expiresOn: et(new Date(Date.now()), 1)
|
|
412
411
|
} : null;
|
|
413
|
-
}, []), u =
|
|
414
|
-
if (console.log("getTokenMsal"),
|
|
412
|
+
}, []), u = ne(async () => {
|
|
413
|
+
if (console.log("getTokenMsal"), s == null)
|
|
415
414
|
throw console.log("getTokenMsal throwing error because msalInstance is null"), new Error("getTokenMsal: msalInstance is null");
|
|
416
415
|
if (c.current)
|
|
417
416
|
return console.log("getTokenMsal returning tokenRequestPromise.current", c.current), c.current;
|
|
418
|
-
const d = new Promise((S,
|
|
419
|
-
const C = (
|
|
420
|
-
const
|
|
421
|
-
if (!
|
|
422
|
-
console.log("getTokenMsal no account found. Redirecting to login"),
|
|
423
|
-
scopes:
|
|
424
|
-
extraScopesToConsent:
|
|
417
|
+
const d = new Promise((S, _) => {
|
|
418
|
+
const C = (m) => {
|
|
419
|
+
const E = bt(s);
|
|
420
|
+
if (!E) {
|
|
421
|
+
console.log("getTokenMsal no account found. Redirecting to login"), s == null || s.loginRedirect({
|
|
422
|
+
scopes: r,
|
|
423
|
+
extraScopesToConsent: i
|
|
425
424
|
});
|
|
426
425
|
return;
|
|
427
426
|
}
|
|
428
|
-
|
|
429
|
-
scopes:
|
|
430
|
-
account:
|
|
431
|
-
redirectUri:
|
|
432
|
-
}).then((
|
|
433
|
-
|
|
434
|
-
token:
|
|
435
|
-
expiresOn:
|
|
427
|
+
s == null || s.acquireTokenSilent({
|
|
428
|
+
scopes: r,
|
|
429
|
+
account: E,
|
|
430
|
+
redirectUri: n.useMsal ? n.msalSilentRedirectUri : void 0
|
|
431
|
+
}).then((P) => {
|
|
432
|
+
m(), S({
|
|
433
|
+
token: P.accessToken,
|
|
434
|
+
expiresOn: P.expiresOn ?? new Date(Date.now())
|
|
436
435
|
});
|
|
437
|
-
}).catch((
|
|
438
|
-
console.error("Error acquiring token",
|
|
439
|
-
scopes:
|
|
440
|
-
extraScopesToConsent:
|
|
441
|
-
}),
|
|
436
|
+
}).catch((P) => {
|
|
437
|
+
console.error("Error acquiring token", P), P instanceof nt && (console.log("Silent token acquisition failed. Acquiring token using redirect"), s == null || s.acquireTokenRedirect({
|
|
438
|
+
scopes: r,
|
|
439
|
+
extraScopesToConsent: i
|
|
440
|
+
}), m(), S(null)), m(), _(P);
|
|
442
441
|
}).finally(() => {
|
|
443
|
-
|
|
442
|
+
m(), _(new Error("No access token returned from handleRedirectPromise"));
|
|
444
443
|
});
|
|
445
444
|
};
|
|
446
|
-
|
|
445
|
+
l.current ? C(() => {
|
|
447
446
|
c.current = null;
|
|
448
|
-
}) :
|
|
449
|
-
if (console.log("getTokenMsal tokenResponse",
|
|
447
|
+
}) : s.handleRedirectPromise().then((m) => {
|
|
448
|
+
if (console.log("getTokenMsal tokenResponse", m), !(m != null && m.accessToken)) {
|
|
450
449
|
C(() => {
|
|
451
|
-
c.current = null,
|
|
450
|
+
c.current = null, l.current = !0;
|
|
452
451
|
});
|
|
453
452
|
return;
|
|
454
453
|
}
|
|
455
|
-
c.current = null,
|
|
456
|
-
token:
|
|
457
|
-
expiresOn:
|
|
454
|
+
c.current = null, l.current = !0, S({
|
|
455
|
+
token: m.accessToken,
|
|
456
|
+
expiresOn: m.expiresOn ?? new Date(Date.now())
|
|
458
457
|
});
|
|
459
458
|
});
|
|
460
459
|
});
|
|
461
460
|
return c.current = d, d;
|
|
462
|
-
}, [
|
|
461
|
+
}, [i, s, r, n.msalSilentRedirectUri, n.useMsal]), p = ne(async () => n.useMsal ? u() : h(), [h, u, n.useMsal]), f = ne((d) => n.useMsal ? () => {
|
|
463
462
|
} : (window.addEventListener("storage", d), window.addEventListener("dev-auth-change", d), () => {
|
|
464
463
|
window.removeEventListener("storage", d), window.removeEventListener("dev-auth-change", d);
|
|
465
|
-
}), [
|
|
464
|
+
}), [n.useMsal]), g = Ue(f, () => localStorage.getItem("token") !== null ? "AUTH_OK" : "NO_AUTH"), w = V(() => {
|
|
466
465
|
var d;
|
|
467
|
-
return
|
|
468
|
-
}, [g, e,
|
|
469
|
-
useMsal:
|
|
470
|
-
msalInstance:
|
|
471
|
-
msalScopes:
|
|
472
|
-
msalExtraScopes:
|
|
473
|
-
getToken:
|
|
466
|
+
return n.useMsal ? e !== tt.None ? "AUTH_IN_PROGRESS" : (s == null ? void 0 : s.getActiveAccount()) ?? ((d = s == null ? void 0 : s.getAllAccounts()) == null ? void 0 : d[0]) ?? null ? "AUTH_OK" : "NO_AUTH" : g;
|
|
467
|
+
}, [g, e, s, n.useMsal]), b = V(() => ({
|
|
468
|
+
useMsal: n.useMsal ?? !1,
|
|
469
|
+
msalInstance: s,
|
|
470
|
+
msalScopes: r,
|
|
471
|
+
msalExtraScopes: i,
|
|
472
|
+
getToken: p,
|
|
474
473
|
authState: w
|
|
475
|
-
}), [
|
|
476
|
-
return
|
|
477
|
-
if (
|
|
478
|
-
const d =
|
|
479
|
-
if (S.eventType ===
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
const
|
|
483
|
-
|
|
474
|
+
}), [n.useMsal, s, r, i, p, w]);
|
|
475
|
+
return K(() => {
|
|
476
|
+
if (n.useMsal && s) {
|
|
477
|
+
const d = s.addEventCallback((S) => {
|
|
478
|
+
if (S.eventType === Se.LOGIN_SUCCESS || S.eventType === Se.ACQUIRE_TOKEN_SUCCESS && S.payload) {
|
|
479
|
+
const _ = S.payload, C = _.account;
|
|
480
|
+
s.setActiveAccount(C);
|
|
481
|
+
const m = _.accessToken, E = _.expiresOn;
|
|
482
|
+
o("Authorization", m, {
|
|
484
483
|
path: "/",
|
|
485
484
|
secure: !0,
|
|
486
485
|
sameSite: "none",
|
|
487
|
-
domain:
|
|
488
|
-
expires:
|
|
486
|
+
domain: t,
|
|
487
|
+
expires: E ?? void 0
|
|
489
488
|
});
|
|
490
489
|
}
|
|
491
490
|
S.error && console.error("AuthProvider MSAL Error", S);
|
|
492
491
|
});
|
|
493
492
|
return () => {
|
|
494
|
-
d &&
|
|
493
|
+
d && s.removeEventCallback(d);
|
|
495
494
|
};
|
|
496
495
|
}
|
|
497
496
|
return () => {
|
|
498
497
|
};
|
|
499
|
-
}, [
|
|
500
|
-
},
|
|
501
|
-
const e =
|
|
502
|
-
let
|
|
503
|
-
if (e[0] !==
|
|
504
|
-
...
|
|
505
|
-
} =
|
|
506
|
-
let
|
|
507
|
-
e[2] !==
|
|
508
|
-
let
|
|
509
|
-
return e[4] !==
|
|
510
|
-
}
|
|
511
|
-
let
|
|
512
|
-
return e[7] !==
|
|
513
|
-
},
|
|
514
|
-
const e =
|
|
515
|
-
children:
|
|
516
|
-
relativeEndpoint:
|
|
517
|
-
} =
|
|
498
|
+
}, [n.useMsal, s, o, t]), /* @__PURE__ */ v(be.Provider, { value: b, children: window.location.pathname === "/blank" ? /* @__PURE__ */ v(St, {}) : n.children });
|
|
499
|
+
}, vn = (n) => {
|
|
500
|
+
const e = j.c(9);
|
|
501
|
+
let t;
|
|
502
|
+
if (e[0] !== n ? ({
|
|
503
|
+
...t
|
|
504
|
+
} = n, e[0] = n, e[1] = t) : t = e[1], t.useMsal) {
|
|
505
|
+
let s;
|
|
506
|
+
e[2] !== t ? (s = /* @__PURE__ */ v(Ee, { ...t }), e[2] = t, e[3] = s) : s = e[3];
|
|
507
|
+
let r;
|
|
508
|
+
return e[4] !== t.msalInstance || e[5] !== s ? (r = /* @__PURE__ */ v(ot, { instance: t.msalInstance, children: s }), e[4] = t.msalInstance, e[5] = s, e[6] = r) : r = e[6], r;
|
|
509
|
+
}
|
|
510
|
+
let o;
|
|
511
|
+
return e[7] !== t ? (o = /* @__PURE__ */ v(Ee, { ...t }), e[7] = t, e[8] = o) : o = e[8], o;
|
|
512
|
+
}, kn = (n) => {
|
|
513
|
+
const e = j.c(18), {
|
|
514
|
+
children: t,
|
|
515
|
+
relativeEndpoint: o
|
|
516
|
+
} = n, [s, r, i] = Ve("user-delegation", null);
|
|
518
517
|
let c;
|
|
519
518
|
e: {
|
|
520
|
-
if (!
|
|
519
|
+
if (!s) {
|
|
521
520
|
c = null;
|
|
522
521
|
break e;
|
|
523
522
|
}
|
|
524
|
-
const
|
|
525
|
-
if (!
|
|
526
|
-
start:
|
|
527
|
-
end:
|
|
523
|
+
const E = s.from ? ke(s.from) : dt(), P = s.to ? ke(s.to) : ht();
|
|
524
|
+
if (!ut(new Date(Date.now()), {
|
|
525
|
+
start: E,
|
|
526
|
+
end: P
|
|
528
527
|
})) {
|
|
529
|
-
|
|
528
|
+
r(null), c = null;
|
|
530
529
|
break e;
|
|
531
530
|
}
|
|
532
|
-
c =
|
|
531
|
+
c = s;
|
|
533
532
|
}
|
|
534
|
-
const
|
|
533
|
+
const l = c;
|
|
535
534
|
let h;
|
|
536
535
|
e[0] === Symbol.for("react.memo_cache_sentinel") ? (h = {
|
|
537
536
|
nullStateBeforeLoad: !1,
|
|
@@ -539,104 +538,189 @@ const vt = () => {
|
|
|
539
538
|
}, e[0] = h) : h = e[0];
|
|
540
539
|
const {
|
|
541
540
|
data: u,
|
|
542
|
-
setData:
|
|
541
|
+
setData: p,
|
|
543
542
|
reloadData: f
|
|
544
|
-
} = Xe(
|
|
543
|
+
} = Xe(o, h), g = ee(null);
|
|
545
544
|
let w, b;
|
|
546
545
|
e[1] !== f ? (w = () => {
|
|
547
|
-
const
|
|
548
|
-
f(), g.current = window.setTimeout(
|
|
546
|
+
const E = () => {
|
|
547
|
+
f(), g.current = window.setTimeout(E, it() + 5e3);
|
|
549
548
|
};
|
|
550
|
-
return
|
|
549
|
+
return E(), () => {
|
|
551
550
|
g.current !== null && window.clearTimeout(g.current);
|
|
552
551
|
};
|
|
553
|
-
}, b = [f], e[1] = f, e[2] = w, e[3] = b) : (w = e[2], b = e[3]),
|
|
552
|
+
}, b = [f], e[1] = f, e[2] = w, e[3] = b) : (w = e[2], b = e[3]), K(w, b);
|
|
554
553
|
let d;
|
|
555
|
-
e[4] !==
|
|
556
|
-
const
|
|
557
|
-
|
|
554
|
+
e[4] !== i ? (d = () => {
|
|
555
|
+
const E = () => {
|
|
556
|
+
i();
|
|
558
557
|
};
|
|
559
|
-
return window.addEventListener("focus",
|
|
560
|
-
window.removeEventListener("focus",
|
|
558
|
+
return window.addEventListener("focus", E), () => {
|
|
559
|
+
window.removeEventListener("focus", E);
|
|
561
560
|
};
|
|
562
|
-
}, e[4] =
|
|
561
|
+
}, e[4] = i, e[5] = d) : d = e[5];
|
|
563
562
|
let S;
|
|
564
|
-
e[6] !==
|
|
565
|
-
let
|
|
566
|
-
e[9] !== u || e[10] !== f || e[11] !==
|
|
567
|
-
delegation:
|
|
568
|
-
setDelegation:
|
|
563
|
+
e[6] !== i || e[7] !== f ? (S = [i, f], e[6] = i, e[7] = f, e[8] = S) : S = e[8], K(d, S);
|
|
564
|
+
let _;
|
|
565
|
+
e[9] !== u || e[10] !== f || e[11] !== p || e[12] !== r || e[13] !== l ? (_ = {
|
|
566
|
+
delegation: l,
|
|
567
|
+
setDelegation: r,
|
|
569
568
|
availableDelegations: u,
|
|
570
|
-
setAvailableDelegations:
|
|
569
|
+
setAvailableDelegations: p,
|
|
571
570
|
refreshAvailableDelegations: f
|
|
572
|
-
}, e[9] = u, e[10] = f, e[11] =
|
|
573
|
-
const C =
|
|
574
|
-
let
|
|
575
|
-
return e[15] !==
|
|
576
|
-
},
|
|
577
|
-
const e =
|
|
578
|
-
defaultHelmet:
|
|
579
|
-
children:
|
|
580
|
-
helmetPrefix:
|
|
581
|
-
} =
|
|
582
|
-
let
|
|
583
|
-
e[0] !==
|
|
571
|
+
}, e[9] = u, e[10] = f, e[11] = p, e[12] = r, e[13] = l, e[14] = _) : _ = e[14];
|
|
572
|
+
const C = _;
|
|
573
|
+
let m;
|
|
574
|
+
return e[15] !== t || e[16] !== C ? (m = /* @__PURE__ */ v(Me.Provider, { value: C, children: t }), e[15] = t, e[16] = C, e[17] = m) : m = e[17], m;
|
|
575
|
+
}, Te = (n, e) => n ? `${n} | ${e}` : e, En = (n) => {
|
|
576
|
+
const e = j.c(18), {
|
|
577
|
+
defaultHelmet: t,
|
|
578
|
+
children: o,
|
|
579
|
+
helmetPrefix: s
|
|
580
|
+
} = n, r = s ?? "";
|
|
581
|
+
let i;
|
|
582
|
+
e[0] !== t || e[1] !== r ? (i = Te(r, t), e[0] = t, e[1] = r, e[2] = i) : i = e[2];
|
|
584
583
|
let c;
|
|
585
|
-
e[3] !==
|
|
586
|
-
const [
|
|
584
|
+
e[3] !== i ? (c = [i], e[3] = i, e[4] = c) : c = e[4];
|
|
585
|
+
const [l, h] = M(c);
|
|
587
586
|
let u;
|
|
588
|
-
e[5] !==
|
|
589
|
-
h((
|
|
590
|
-
}, e[5] =
|
|
591
|
-
const
|
|
587
|
+
e[5] !== s ? (u = (m) => {
|
|
588
|
+
h((E) => [...E, Te(s ?? "", m)]);
|
|
589
|
+
}, e[5] = s, e[6] = u) : u = e[6];
|
|
590
|
+
const p = u;
|
|
592
591
|
let f;
|
|
593
592
|
e[7] === Symbol.for("react.memo_cache_sentinel") ? (f = () => {
|
|
594
|
-
h(
|
|
593
|
+
h(yt);
|
|
595
594
|
}, e[7] = f) : f = e[7];
|
|
596
595
|
const g = f;
|
|
597
596
|
let w;
|
|
598
|
-
e[8] !==
|
|
597
|
+
e[8] !== l ? (w = l.at(-1) ?? "", e[8] = l, e[9] = w) : w = e[9];
|
|
599
598
|
const b = w;
|
|
600
599
|
let d;
|
|
601
|
-
e[10] !==
|
|
602
|
-
addHelmet:
|
|
600
|
+
e[10] !== p ? (d = {
|
|
601
|
+
addHelmet: p,
|
|
603
602
|
removeHelmet: g
|
|
604
|
-
}, e[10] =
|
|
603
|
+
}, e[10] = p, e[11] = d) : d = e[11];
|
|
605
604
|
const S = d;
|
|
606
|
-
let
|
|
607
|
-
e[12] !== b ? (
|
|
605
|
+
let _;
|
|
606
|
+
e[12] !== b ? (_ = /* @__PURE__ */ v("title", { children: b }), e[12] = b, e[13] = _) : _ = e[13];
|
|
608
607
|
let C;
|
|
609
|
-
return e[14] !==
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
] }), e[14] =
|
|
608
|
+
return e[14] !== o || e[15] !== S || e[16] !== _ ? (C = /* @__PURE__ */ A(ct.Provider, { value: S, children: [
|
|
609
|
+
_,
|
|
610
|
+
o
|
|
611
|
+
] }), e[14] = o, e[15] = S, e[16] = _, e[17] = C) : C = e[17], C;
|
|
613
612
|
};
|
|
614
|
-
function
|
|
615
|
-
return
|
|
613
|
+
function yt(n) {
|
|
614
|
+
return n.length > 1 ? n.slice(0, -1) : n;
|
|
616
615
|
}
|
|
617
|
-
class
|
|
618
|
-
|
|
619
|
-
|
|
616
|
+
class X extends Error {
|
|
617
|
+
/** Constructs a new instance of {@link @microsoft/signalr.HttpError}.
|
|
618
|
+
*
|
|
619
|
+
* @param {string} errorMessage A descriptive error message.
|
|
620
|
+
* @param {number} statusCode The HTTP status code represented by this error.
|
|
621
|
+
*/
|
|
622
|
+
constructor(e, t) {
|
|
623
|
+
const o = new.target.prototype;
|
|
624
|
+
super(`${e}: Status code '${t}'`), this.statusCode = t, this.__proto__ = o;
|
|
620
625
|
}
|
|
621
626
|
}
|
|
622
|
-
class
|
|
623
|
-
|
|
627
|
+
class ye extends Error {
|
|
628
|
+
/** Constructs a new instance of {@link @microsoft/signalr.TimeoutError}.
|
|
629
|
+
*
|
|
630
|
+
* @param {string} errorMessage A descriptive error message.
|
|
631
|
+
*/
|
|
632
|
+
constructor(e = "A timeout occurred.") {
|
|
633
|
+
const t = new.target.prototype;
|
|
634
|
+
super(e), this.__proto__ = t;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
class B extends Error {
|
|
638
|
+
/** Constructs a new instance of {@link AbortError}.
|
|
639
|
+
*
|
|
640
|
+
* @param {string} errorMessage A descriptive error message.
|
|
641
|
+
*/
|
|
642
|
+
constructor(e = "An abort occurred.") {
|
|
643
|
+
const t = new.target.prototype;
|
|
644
|
+
super(e), this.__proto__ = t;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
class Ct extends Error {
|
|
648
|
+
/** Constructs a new instance of {@link @microsoft/signalr.UnsupportedTransportError}.
|
|
649
|
+
*
|
|
650
|
+
* @param {string} message A descriptive error message.
|
|
651
|
+
* @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
|
|
652
|
+
*/
|
|
653
|
+
constructor(e, t) {
|
|
654
|
+
const o = new.target.prototype;
|
|
655
|
+
super(e), this.transport = t, this.errorType = "UnsupportedTransportError", this.__proto__ = o;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
class vt extends Error {
|
|
659
|
+
/** Constructs a new instance of {@link @microsoft/signalr.DisabledTransportError}.
|
|
660
|
+
*
|
|
661
|
+
* @param {string} message A descriptive error message.
|
|
662
|
+
* @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
|
|
663
|
+
*/
|
|
664
|
+
constructor(e, t) {
|
|
665
|
+
const o = new.target.prototype;
|
|
666
|
+
super(e), this.transport = t, this.errorType = "DisabledTransportError", this.__proto__ = o;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
class kt extends Error {
|
|
670
|
+
/** Constructs a new instance of {@link @microsoft/signalr.FailedToStartTransportError}.
|
|
671
|
+
*
|
|
672
|
+
* @param {string} message A descriptive error message.
|
|
673
|
+
* @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
|
|
674
|
+
*/
|
|
675
|
+
constructor(e, t) {
|
|
676
|
+
const o = new.target.prototype;
|
|
677
|
+
super(e), this.transport = t, this.errorType = "FailedToStartTransportError", this.__proto__ = o;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
class Ie extends Error {
|
|
681
|
+
/** Constructs a new instance of {@link @microsoft/signalr.FailedToNegotiateWithServerError}.
|
|
682
|
+
*
|
|
683
|
+
* @param {string} message A descriptive error message.
|
|
684
|
+
*/
|
|
685
|
+
constructor(e) {
|
|
686
|
+
const t = new.target.prototype;
|
|
687
|
+
super(e), this.errorType = "FailedToNegotiateWithServerError", this.__proto__ = t;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
class Et extends Error {
|
|
691
|
+
/** Constructs a new instance of {@link @microsoft/signalr.AggregateErrors}.
|
|
692
|
+
*
|
|
693
|
+
* @param {string} message A descriptive error message.
|
|
694
|
+
* @param {Error[]} innerErrors The collection of errors this error is aggregating.
|
|
695
|
+
*/
|
|
696
|
+
constructor(e, t) {
|
|
697
|
+
const o = new.target.prototype;
|
|
698
|
+
super(e), this.innerErrors = t, this.__proto__ = o;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
class He {
|
|
702
|
+
constructor(e, t, o) {
|
|
703
|
+
this.statusCode = e, this.statusText = t, this.content = o;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
class ge {
|
|
707
|
+
get(e, t) {
|
|
624
708
|
return this.send({
|
|
625
|
-
...
|
|
709
|
+
...t,
|
|
626
710
|
method: "GET",
|
|
627
711
|
url: e
|
|
628
712
|
});
|
|
629
713
|
}
|
|
630
|
-
post(e,
|
|
714
|
+
post(e, t) {
|
|
631
715
|
return this.send({
|
|
632
|
-
...
|
|
716
|
+
...t,
|
|
633
717
|
method: "POST",
|
|
634
718
|
url: e
|
|
635
719
|
});
|
|
636
720
|
}
|
|
637
|
-
delete(e,
|
|
721
|
+
delete(e, t) {
|
|
638
722
|
return this.send({
|
|
639
|
-
...
|
|
723
|
+
...t,
|
|
640
724
|
method: "DELETE",
|
|
641
725
|
url: e
|
|
642
726
|
});
|
|
@@ -651,43 +735,201 @@ class le {
|
|
|
651
735
|
return "";
|
|
652
736
|
}
|
|
653
737
|
}
|
|
654
|
-
|
|
738
|
+
var a;
|
|
739
|
+
(function(n) {
|
|
740
|
+
n[n.Trace = 0] = "Trace", n[n.Debug = 1] = "Debug", n[n.Information = 2] = "Information", n[n.Warning = 3] = "Warning", n[n.Error = 4] = "Error", n[n.Critical = 5] = "Critical", n[n.None = 6] = "None";
|
|
741
|
+
})(a || (a = {}));
|
|
742
|
+
class oe {
|
|
743
|
+
constructor() {
|
|
744
|
+
}
|
|
745
|
+
/** @inheritDoc */
|
|
746
|
+
// eslint-disable-next-line
|
|
747
|
+
log(e, t) {
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
oe.instance = new oe();
|
|
751
|
+
const Tt = "10.0.0";
|
|
752
|
+
class I {
|
|
753
|
+
static isRequired(e, t) {
|
|
754
|
+
if (e == null)
|
|
755
|
+
throw new Error(`The '${t}' argument is required.`);
|
|
756
|
+
}
|
|
757
|
+
static isNotEmpty(e, t) {
|
|
758
|
+
if (!e || e.match(/^\s*$/))
|
|
759
|
+
throw new Error(`The '${t}' argument should not be empty.`);
|
|
760
|
+
}
|
|
761
|
+
static isIn(e, t, o) {
|
|
762
|
+
if (!(e in t))
|
|
763
|
+
throw new Error(`Unknown ${o} value: ${e}.`);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
class T {
|
|
767
|
+
// react-native has a window but no document so we should check both
|
|
768
|
+
static get isBrowser() {
|
|
769
|
+
return !T.isNode && typeof window == "object" && typeof window.document == "object";
|
|
770
|
+
}
|
|
771
|
+
// WebWorkers don't have a window object so the isBrowser check would fail
|
|
772
|
+
static get isWebWorker() {
|
|
773
|
+
return !T.isNode && typeof self == "object" && "importScripts" in self;
|
|
774
|
+
}
|
|
775
|
+
// react-native has a window but no document
|
|
776
|
+
static get isReactNative() {
|
|
777
|
+
return !T.isNode && typeof window == "object" && typeof window.document > "u";
|
|
778
|
+
}
|
|
779
|
+
// Node apps shouldn't have a window object, but WebWorkers don't either
|
|
780
|
+
// so we need to check for both WebWorker and window
|
|
781
|
+
static get isNode() {
|
|
782
|
+
return typeof process < "u" && process.release && process.release.name === "node";
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
function se(n, e) {
|
|
786
|
+
let t = "";
|
|
787
|
+
return Y(n) ? (t = `Binary data of length ${n.byteLength}`, e && (t += `. Content: '${It(n)}'`)) : typeof n == "string" && (t = `String data of length ${n.length}`, e && (t += `. Content: '${n}'`)), t;
|
|
788
|
+
}
|
|
789
|
+
function It(n) {
|
|
790
|
+
const e = new Uint8Array(n);
|
|
791
|
+
let t = "";
|
|
792
|
+
return e.forEach((o) => {
|
|
793
|
+
const s = o < 16 ? "0" : "";
|
|
794
|
+
t += `0x${s}${o.toString(16)} `;
|
|
795
|
+
}), t.substring(0, t.length - 1);
|
|
796
|
+
}
|
|
797
|
+
function Y(n) {
|
|
798
|
+
return n && typeof ArrayBuffer < "u" && (n instanceof ArrayBuffer || // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof
|
|
799
|
+
n.constructor && n.constructor.name === "ArrayBuffer");
|
|
800
|
+
}
|
|
801
|
+
async function Ne(n, e, t, o, s, r) {
|
|
802
|
+
const i = {}, [c, l] = te();
|
|
803
|
+
i[c] = l, n.log(a.Trace, `(${e} transport) sending data. ${se(s, r.logMessageContent)}.`);
|
|
804
|
+
const h = Y(s) ? "arraybuffer" : "text", u = await t.post(o, {
|
|
805
|
+
content: s,
|
|
806
|
+
headers: { ...i, ...r.headers },
|
|
807
|
+
responseType: h,
|
|
808
|
+
timeout: r.timeout,
|
|
809
|
+
withCredentials: r.withCredentials
|
|
810
|
+
});
|
|
811
|
+
n.log(a.Trace, `(${e} transport) request complete. Response status: ${u.statusCode}.`);
|
|
812
|
+
}
|
|
813
|
+
function Pt(n) {
|
|
814
|
+
return n === void 0 ? new de(a.Information) : n === null ? oe.instance : n.log !== void 0 ? n : new de(n);
|
|
815
|
+
}
|
|
816
|
+
class xt {
|
|
817
|
+
constructor(e, t) {
|
|
818
|
+
this._subject = e, this._observer = t;
|
|
819
|
+
}
|
|
820
|
+
dispose() {
|
|
821
|
+
const e = this._subject.observers.indexOf(this._observer);
|
|
822
|
+
e > -1 && this._subject.observers.splice(e, 1), this._subject.observers.length === 0 && this._subject.cancelCallback && this._subject.cancelCallback().catch((t) => {
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
class de {
|
|
827
|
+
constructor(e) {
|
|
828
|
+
this._minLevel = e, this.out = console;
|
|
829
|
+
}
|
|
830
|
+
log(e, t) {
|
|
831
|
+
if (e >= this._minLevel) {
|
|
832
|
+
const o = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${a[e]}: ${t}`;
|
|
833
|
+
switch (e) {
|
|
834
|
+
case a.Critical:
|
|
835
|
+
case a.Error:
|
|
836
|
+
this.out.error(o);
|
|
837
|
+
break;
|
|
838
|
+
case a.Warning:
|
|
839
|
+
this.out.warn(o);
|
|
840
|
+
break;
|
|
841
|
+
case a.Information:
|
|
842
|
+
this.out.info(o);
|
|
843
|
+
break;
|
|
844
|
+
default:
|
|
845
|
+
this.out.log(o);
|
|
846
|
+
break;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
function te() {
|
|
852
|
+
let n = "X-SignalR-User-Agent";
|
|
853
|
+
return T.isNode && (n = "User-Agent"), [n, Dt(Tt, Rt(), At(), $t())];
|
|
854
|
+
}
|
|
855
|
+
function Dt(n, e, t, o) {
|
|
856
|
+
let s = "Microsoft SignalR/";
|
|
857
|
+
const r = n.split(".");
|
|
858
|
+
return s += `${r[0]}.${r[1]}`, s += ` (${n}; `, e && e !== "" ? s += `${e}; ` : s += "Unknown OS; ", s += `${t}`, o ? s += `; ${o}` : s += "; Unknown Runtime Version", s += ")", s;
|
|
859
|
+
}
|
|
860
|
+
function Rt() {
|
|
861
|
+
if (T.isNode)
|
|
862
|
+
switch (process.platform) {
|
|
863
|
+
case "win32":
|
|
864
|
+
return "Windows NT";
|
|
865
|
+
case "darwin":
|
|
866
|
+
return "macOS";
|
|
867
|
+
case "linux":
|
|
868
|
+
return "Linux";
|
|
869
|
+
default:
|
|
870
|
+
return process.platform;
|
|
871
|
+
}
|
|
872
|
+
else
|
|
873
|
+
return "";
|
|
874
|
+
}
|
|
875
|
+
function $t() {
|
|
876
|
+
if (T.isNode)
|
|
877
|
+
return process.versions.node;
|
|
878
|
+
}
|
|
879
|
+
function At() {
|
|
880
|
+
return T.isNode ? "NodeJS" : "Browser";
|
|
881
|
+
}
|
|
882
|
+
function we(n) {
|
|
883
|
+
return n.stack ? n.stack : n.message ? n.message : `${n}`;
|
|
884
|
+
}
|
|
885
|
+
function Mt() {
|
|
886
|
+
if (typeof globalThis < "u")
|
|
887
|
+
return globalThis;
|
|
888
|
+
if (typeof self < "u")
|
|
889
|
+
return self;
|
|
890
|
+
if (typeof window < "u")
|
|
891
|
+
return window;
|
|
892
|
+
if (typeof global < "u")
|
|
893
|
+
return global;
|
|
894
|
+
throw new Error("could not find global");
|
|
895
|
+
}
|
|
896
|
+
class Lt extends ge {
|
|
655
897
|
constructor(e) {
|
|
656
|
-
if (super(), this._logger = e, typeof fetch > "u" ||
|
|
657
|
-
const
|
|
658
|
-
this._jar = new (
|
|
898
|
+
if (super(), this._logger = e, typeof fetch > "u" || T.isNode) {
|
|
899
|
+
const t = typeof __webpack_require__ == "function" ? __non_webpack_require__ : require;
|
|
900
|
+
this._jar = new (t("tough-cookie")).CookieJar(), typeof fetch > "u" ? this._fetchType = t("node-fetch") : this._fetchType = fetch, this._fetchType = t("fetch-cookie")(this._fetchType, this._jar);
|
|
659
901
|
} else
|
|
660
|
-
this._fetchType = fetch.bind(
|
|
902
|
+
this._fetchType = fetch.bind(Mt());
|
|
661
903
|
if (typeof AbortController > "u") {
|
|
662
|
-
const
|
|
663
|
-
this._abortControllerType =
|
|
904
|
+
const t = typeof __webpack_require__ == "function" ? __non_webpack_require__ : require;
|
|
905
|
+
this._abortControllerType = t("abort-controller");
|
|
664
906
|
} else
|
|
665
907
|
this._abortControllerType = AbortController;
|
|
666
908
|
}
|
|
667
909
|
/** @inheritDoc */
|
|
668
910
|
async send(e) {
|
|
669
911
|
if (e.abortSignal && e.abortSignal.aborted)
|
|
670
|
-
throw new
|
|
912
|
+
throw new B();
|
|
671
913
|
if (!e.method)
|
|
672
914
|
throw new Error("No method defined.");
|
|
673
915
|
if (!e.url)
|
|
674
916
|
throw new Error("No url defined.");
|
|
675
|
-
const
|
|
676
|
-
let
|
|
917
|
+
const t = new this._abortControllerType();
|
|
918
|
+
let o;
|
|
677
919
|
e.abortSignal && (e.abortSignal.onabort = () => {
|
|
678
|
-
|
|
920
|
+
t.abort(), o = new B();
|
|
679
921
|
});
|
|
680
|
-
let
|
|
922
|
+
let s = null;
|
|
681
923
|
if (e.timeout) {
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
},
|
|
924
|
+
const l = e.timeout;
|
|
925
|
+
s = setTimeout(() => {
|
|
926
|
+
t.abort(), this._logger.log(a.Warning, "Timeout from HTTP request."), o = new ye();
|
|
927
|
+
}, l);
|
|
686
928
|
}
|
|
687
|
-
e.content === "" && (e.content = void 0), e.content && (e.headers = e.headers || {},
|
|
688
|
-
let
|
|
929
|
+
e.content === "" && (e.content = void 0), e.content && (e.headers = e.headers || {}, Y(e.content) ? e.headers["Content-Type"] = "application/octet-stream" : e.headers["Content-Type"] = "text/plain;charset=UTF-8");
|
|
930
|
+
let r;
|
|
689
931
|
try {
|
|
690
|
-
|
|
932
|
+
r = await this._fetchType(e.url, {
|
|
691
933
|
body: e.content,
|
|
692
934
|
cache: "no-cache",
|
|
693
935
|
credentials: e.withCredentials === !0 ? "include" : "same-origin",
|
|
@@ -698,125 +940,799 @@ class Et extends le {
|
|
|
698
940
|
method: e.method,
|
|
699
941
|
mode: "cors",
|
|
700
942
|
redirect: "follow",
|
|
701
|
-
signal:
|
|
943
|
+
signal: t.signal
|
|
702
944
|
});
|
|
703
|
-
} catch (
|
|
704
|
-
throw
|
|
945
|
+
} catch (l) {
|
|
946
|
+
throw o || (this._logger.log(a.Warning, `Error from HTTP request. ${l}.`), l);
|
|
705
947
|
} finally {
|
|
706
|
-
|
|
948
|
+
s && clearTimeout(s), e.abortSignal && (e.abortSignal.onabort = null);
|
|
707
949
|
}
|
|
708
|
-
if (!
|
|
709
|
-
const
|
|
710
|
-
throw new
|
|
950
|
+
if (!r.ok) {
|
|
951
|
+
const l = await Pe(r, "text");
|
|
952
|
+
throw new X(l || r.statusText, r.status);
|
|
711
953
|
}
|
|
712
|
-
const c = await
|
|
713
|
-
return new
|
|
954
|
+
const c = await Pe(r, e.responseType);
|
|
955
|
+
return new He(r.status, r.statusText, c);
|
|
714
956
|
}
|
|
715
957
|
getCookieString(e) {
|
|
716
|
-
let
|
|
717
|
-
return
|
|
958
|
+
let t = "";
|
|
959
|
+
return T.isNode && this._jar && this._jar.getCookies(e, (o, s) => t = s.join("; ")), t;
|
|
718
960
|
}
|
|
719
961
|
}
|
|
720
|
-
function
|
|
721
|
-
let
|
|
962
|
+
function Pe(n, e) {
|
|
963
|
+
let t;
|
|
722
964
|
switch (e) {
|
|
723
965
|
case "arraybuffer":
|
|
724
|
-
|
|
966
|
+
t = n.arrayBuffer();
|
|
725
967
|
break;
|
|
726
968
|
case "text":
|
|
727
|
-
|
|
969
|
+
t = n.text();
|
|
728
970
|
break;
|
|
729
971
|
case "blob":
|
|
730
972
|
case "document":
|
|
731
973
|
case "json":
|
|
732
974
|
throw new Error(`${e} is not supported.`);
|
|
733
975
|
default:
|
|
734
|
-
|
|
976
|
+
t = n.text();
|
|
735
977
|
break;
|
|
736
978
|
}
|
|
737
|
-
return
|
|
979
|
+
return t;
|
|
738
980
|
}
|
|
739
|
-
class
|
|
981
|
+
class Ht extends ge {
|
|
740
982
|
constructor(e) {
|
|
741
983
|
super(), this._logger = e;
|
|
742
984
|
}
|
|
743
985
|
/** @inheritDoc */
|
|
744
986
|
send(e) {
|
|
745
|
-
return e.abortSignal && e.abortSignal.aborted ? Promise.reject(new
|
|
746
|
-
const
|
|
747
|
-
|
|
748
|
-
const
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
}), e.responseType && (
|
|
752
|
-
|
|
753
|
-
}), e.timeout && (
|
|
754
|
-
e.abortSignal && (e.abortSignal.onabort = null),
|
|
755
|
-
},
|
|
756
|
-
this._logger.log(
|
|
757
|
-
},
|
|
758
|
-
this._logger.log(
|
|
759
|
-
},
|
|
987
|
+
return e.abortSignal && e.abortSignal.aborted ? Promise.reject(new B()) : e.method ? e.url ? new Promise((t, o) => {
|
|
988
|
+
const s = new XMLHttpRequest();
|
|
989
|
+
s.open(e.method, e.url, !0), s.withCredentials = e.withCredentials === void 0 ? !0 : e.withCredentials, s.setRequestHeader("X-Requested-With", "XMLHttpRequest"), e.content === "" && (e.content = void 0), e.content && (Y(e.content) ? s.setRequestHeader("Content-Type", "application/octet-stream") : s.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"));
|
|
990
|
+
const r = e.headers;
|
|
991
|
+
r && Object.keys(r).forEach((i) => {
|
|
992
|
+
s.setRequestHeader(i, r[i]);
|
|
993
|
+
}), e.responseType && (s.responseType = e.responseType), e.abortSignal && (e.abortSignal.onabort = () => {
|
|
994
|
+
s.abort(), o(new B());
|
|
995
|
+
}), e.timeout && (s.timeout = e.timeout), s.onload = () => {
|
|
996
|
+
e.abortSignal && (e.abortSignal.onabort = null), s.status >= 200 && s.status < 300 ? t(new He(s.status, s.statusText, s.response || s.responseText)) : o(new X(s.response || s.responseText || s.statusText, s.status));
|
|
997
|
+
}, s.onerror = () => {
|
|
998
|
+
this._logger.log(a.Warning, `Error from HTTP request. ${s.status}: ${s.statusText}.`), o(new X(s.statusText, s.status));
|
|
999
|
+
}, s.ontimeout = () => {
|
|
1000
|
+
this._logger.log(a.Warning, "Timeout from HTTP request."), o(new ye());
|
|
1001
|
+
}, s.send(e.content);
|
|
760
1002
|
}) : Promise.reject(new Error("No url defined.")) : Promise.reject(new Error("No method defined."));
|
|
761
1003
|
}
|
|
762
1004
|
}
|
|
763
|
-
class
|
|
1005
|
+
class Nt extends ge {
|
|
764
1006
|
/** Creates a new instance of the {@link @microsoft/signalr.DefaultHttpClient}, using the provided {@link @microsoft/signalr.ILogger} to log messages. */
|
|
765
1007
|
constructor(e) {
|
|
766
|
-
if (super(), typeof fetch < "u" ||
|
|
767
|
-
this._httpClient = new
|
|
1008
|
+
if (super(), typeof fetch < "u" || T.isNode)
|
|
1009
|
+
this._httpClient = new Lt(e);
|
|
768
1010
|
else if (typeof XMLHttpRequest < "u")
|
|
769
|
-
this._httpClient = new
|
|
1011
|
+
this._httpClient = new Ht(e);
|
|
770
1012
|
else
|
|
771
1013
|
throw new Error("No usable HttpClient found.");
|
|
772
1014
|
}
|
|
773
1015
|
/** @inheritDoc */
|
|
774
1016
|
send(e) {
|
|
775
|
-
return e.abortSignal && e.abortSignal.aborted ? Promise.reject(new
|
|
1017
|
+
return e.abortSignal && e.abortSignal.aborted ? Promise.reject(new B()) : e.method ? e.url ? this._httpClient.send(e) : Promise.reject(new Error("No url defined.")) : Promise.reject(new Error("No method defined."));
|
|
776
1018
|
}
|
|
777
1019
|
getCookieString(e) {
|
|
778
1020
|
return this._httpClient.getCookieString(e);
|
|
779
1021
|
}
|
|
780
1022
|
}
|
|
781
|
-
|
|
782
|
-
|
|
1023
|
+
class H {
|
|
1024
|
+
static write(e) {
|
|
1025
|
+
return `${e}${H.RecordSeparator}`;
|
|
1026
|
+
}
|
|
1027
|
+
static parse(e) {
|
|
1028
|
+
if (e[e.length - 1] !== H.RecordSeparator)
|
|
1029
|
+
throw new Error("Message is incomplete.");
|
|
1030
|
+
const t = e.split(H.RecordSeparator);
|
|
1031
|
+
return t.pop(), t;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
H.RecordSeparatorCode = 30;
|
|
1035
|
+
H.RecordSeparator = String.fromCharCode(H.RecordSeparatorCode);
|
|
1036
|
+
class Ot {
|
|
1037
|
+
// Handshake request is always JSON
|
|
1038
|
+
writeHandshakeRequest(e) {
|
|
1039
|
+
return H.write(JSON.stringify(e));
|
|
1040
|
+
}
|
|
1041
|
+
parseHandshakeResponse(e) {
|
|
1042
|
+
let t, o;
|
|
1043
|
+
if (Y(e)) {
|
|
1044
|
+
const c = new Uint8Array(e), l = c.indexOf(H.RecordSeparatorCode);
|
|
1045
|
+
if (l === -1)
|
|
1046
|
+
throw new Error("Message is incomplete.");
|
|
1047
|
+
const h = l + 1;
|
|
1048
|
+
t = String.fromCharCode.apply(null, Array.prototype.slice.call(c.slice(0, h))), o = c.byteLength > h ? c.slice(h).buffer : null;
|
|
1049
|
+
} else {
|
|
1050
|
+
const c = e, l = c.indexOf(H.RecordSeparator);
|
|
1051
|
+
if (l === -1)
|
|
1052
|
+
throw new Error("Message is incomplete.");
|
|
1053
|
+
const h = l + 1;
|
|
1054
|
+
t = c.substring(0, h), o = c.length > h ? c.substring(h) : null;
|
|
1055
|
+
}
|
|
1056
|
+
const s = H.parse(t), r = JSON.parse(s[0]);
|
|
1057
|
+
if (r.type)
|
|
1058
|
+
throw new Error("Expected a handshake response from the server.");
|
|
1059
|
+
return [o, r];
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
var y;
|
|
1063
|
+
(function(n) {
|
|
1064
|
+
n[n.Invocation = 1] = "Invocation", n[n.StreamItem = 2] = "StreamItem", n[n.Completion = 3] = "Completion", n[n.StreamInvocation = 4] = "StreamInvocation", n[n.CancelInvocation = 5] = "CancelInvocation", n[n.Ping = 6] = "Ping", n[n.Close = 7] = "Close", n[n.Ack = 8] = "Ack", n[n.Sequence = 9] = "Sequence";
|
|
1065
|
+
})(y || (y = {}));
|
|
1066
|
+
class Wt {
|
|
1067
|
+
constructor() {
|
|
1068
|
+
this.observers = [];
|
|
1069
|
+
}
|
|
1070
|
+
next(e) {
|
|
1071
|
+
for (const t of this.observers)
|
|
1072
|
+
t.next(e);
|
|
1073
|
+
}
|
|
1074
|
+
error(e) {
|
|
1075
|
+
for (const t of this.observers)
|
|
1076
|
+
t.error && t.error(e);
|
|
1077
|
+
}
|
|
1078
|
+
complete() {
|
|
1079
|
+
for (const e of this.observers)
|
|
1080
|
+
e.complete && e.complete();
|
|
1081
|
+
}
|
|
1082
|
+
subscribe(e) {
|
|
1083
|
+
return this.observers.push(e), new xt(this, e);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
class Ut {
|
|
1087
|
+
constructor(e, t, o) {
|
|
1088
|
+
this._bufferSize = 1e5, this._messages = [], this._totalMessageCount = 0, this._waitForSequenceMessage = !1, this._nextReceivingSequenceId = 1, this._latestReceivedSequenceId = 0, this._bufferedByteCount = 0, this._reconnectInProgress = !1, this._protocol = e, this._connection = t, this._bufferSize = o;
|
|
1089
|
+
}
|
|
1090
|
+
async _send(e) {
|
|
1091
|
+
const t = this._protocol.writeMessage(e);
|
|
1092
|
+
let o = Promise.resolve();
|
|
1093
|
+
if (this._isInvocationMessage(e)) {
|
|
1094
|
+
this._totalMessageCount++;
|
|
1095
|
+
let s = () => {
|
|
1096
|
+
}, r = () => {
|
|
1097
|
+
};
|
|
1098
|
+
Y(t) ? this._bufferedByteCount += t.byteLength : this._bufferedByteCount += t.length, this._bufferedByteCount >= this._bufferSize && (o = new Promise((i, c) => {
|
|
1099
|
+
s = i, r = c;
|
|
1100
|
+
})), this._messages.push(new Bt(t, this._totalMessageCount, s, r));
|
|
1101
|
+
}
|
|
1102
|
+
try {
|
|
1103
|
+
this._reconnectInProgress || await this._connection.send(t);
|
|
1104
|
+
} catch {
|
|
1105
|
+
this._disconnected();
|
|
1106
|
+
}
|
|
1107
|
+
await o;
|
|
1108
|
+
}
|
|
1109
|
+
_ack(e) {
|
|
1110
|
+
let t = -1;
|
|
1111
|
+
for (let o = 0; o < this._messages.length; o++) {
|
|
1112
|
+
const s = this._messages[o];
|
|
1113
|
+
if (s._id <= e.sequenceId)
|
|
1114
|
+
t = o, Y(s._message) ? this._bufferedByteCount -= s._message.byteLength : this._bufferedByteCount -= s._message.length, s._resolver();
|
|
1115
|
+
else if (this._bufferedByteCount < this._bufferSize)
|
|
1116
|
+
s._resolver();
|
|
1117
|
+
else
|
|
1118
|
+
break;
|
|
1119
|
+
}
|
|
1120
|
+
t !== -1 && (this._messages = this._messages.slice(t + 1));
|
|
1121
|
+
}
|
|
1122
|
+
_shouldProcessMessage(e) {
|
|
1123
|
+
if (this._waitForSequenceMessage)
|
|
1124
|
+
return e.type !== y.Sequence ? !1 : (this._waitForSequenceMessage = !1, !0);
|
|
1125
|
+
if (!this._isInvocationMessage(e))
|
|
1126
|
+
return !0;
|
|
1127
|
+
const t = this._nextReceivingSequenceId;
|
|
1128
|
+
return this._nextReceivingSequenceId++, t <= this._latestReceivedSequenceId ? (t === this._latestReceivedSequenceId && this._ackTimer(), !1) : (this._latestReceivedSequenceId = t, this._ackTimer(), !0);
|
|
1129
|
+
}
|
|
1130
|
+
_resetSequence(e) {
|
|
1131
|
+
if (e.sequenceId > this._nextReceivingSequenceId) {
|
|
1132
|
+
this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
this._nextReceivingSequenceId = e.sequenceId;
|
|
1136
|
+
}
|
|
1137
|
+
_disconnected() {
|
|
1138
|
+
this._reconnectInProgress = !0, this._waitForSequenceMessage = !0;
|
|
1139
|
+
}
|
|
1140
|
+
async _resend() {
|
|
1141
|
+
const e = this._messages.length !== 0 ? this._messages[0]._id : this._totalMessageCount + 1;
|
|
1142
|
+
await this._connection.send(this._protocol.writeMessage({ type: y.Sequence, sequenceId: e }));
|
|
1143
|
+
const t = this._messages;
|
|
1144
|
+
for (const o of t)
|
|
1145
|
+
await this._connection.send(o._message);
|
|
1146
|
+
this._reconnectInProgress = !1;
|
|
1147
|
+
}
|
|
1148
|
+
_dispose(e) {
|
|
1149
|
+
e ?? (e = new Error("Unable to reconnect to server."));
|
|
1150
|
+
for (const t of this._messages)
|
|
1151
|
+
t._rejector(e);
|
|
1152
|
+
}
|
|
1153
|
+
_isInvocationMessage(e) {
|
|
1154
|
+
switch (e.type) {
|
|
1155
|
+
case y.Invocation:
|
|
1156
|
+
case y.StreamItem:
|
|
1157
|
+
case y.Completion:
|
|
1158
|
+
case y.StreamInvocation:
|
|
1159
|
+
case y.CancelInvocation:
|
|
1160
|
+
return !0;
|
|
1161
|
+
case y.Close:
|
|
1162
|
+
case y.Sequence:
|
|
1163
|
+
case y.Ping:
|
|
1164
|
+
case y.Ack:
|
|
1165
|
+
return !1;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
_ackTimer() {
|
|
1169
|
+
this._ackTimerHandle === void 0 && (this._ackTimerHandle = setTimeout(async () => {
|
|
1170
|
+
try {
|
|
1171
|
+
this._reconnectInProgress || await this._connection.send(this._protocol.writeMessage({ type: y.Ack, sequenceId: this._latestReceivedSequenceId }));
|
|
1172
|
+
} catch {
|
|
1173
|
+
}
|
|
1174
|
+
clearTimeout(this._ackTimerHandle), this._ackTimerHandle = void 0;
|
|
1175
|
+
}, 1e3));
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
class Bt {
|
|
1179
|
+
constructor(e, t, o, s) {
|
|
1180
|
+
this._message = e, this._id = t, this._resolver = o, this._rejector = s;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
const jt = 30 * 1e3, Ft = 15 * 1e3, qt = 1e5;
|
|
1184
|
+
var k;
|
|
1185
|
+
(function(n) {
|
|
1186
|
+
n.Disconnected = "Disconnected", n.Connecting = "Connecting", n.Connected = "Connected", n.Disconnecting = "Disconnecting", n.Reconnecting = "Reconnecting";
|
|
1187
|
+
})(k || (k = {}));
|
|
1188
|
+
class Ce {
|
|
1189
|
+
/** @internal */
|
|
1190
|
+
// Using a public static factory method means we can have a private constructor and an _internal_
|
|
1191
|
+
// create method that can be used by HubConnectionBuilder. An "internal" constructor would just
|
|
1192
|
+
// be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a
|
|
1193
|
+
// public parameter-less constructor.
|
|
1194
|
+
static create(e, t, o, s, r, i, c) {
|
|
1195
|
+
return new Ce(e, t, o, s, r, i, c);
|
|
1196
|
+
}
|
|
1197
|
+
constructor(e, t, o, s, r, i, c) {
|
|
1198
|
+
this._nextKeepAlive = 0, this._freezeEventListener = () => {
|
|
1199
|
+
this._logger.log(a.Warning, "The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep");
|
|
1200
|
+
}, I.isRequired(e, "connection"), I.isRequired(t, "logger"), I.isRequired(o, "protocol"), this.serverTimeoutInMilliseconds = r ?? jt, this.keepAliveIntervalInMilliseconds = i ?? Ft, this._statefulReconnectBufferSize = c ?? qt, this._logger = t, this._protocol = o, this.connection = e, this._reconnectPolicy = s, this._handshakeProtocol = new Ot(), this.connection.onreceive = (l) => this._processIncomingData(l), this.connection.onclose = (l) => this._connectionClosed(l), this._callbacks = {}, this._methods = {}, this._closedCallbacks = [], this._reconnectingCallbacks = [], this._reconnectedCallbacks = [], this._invocationId = 0, this._receivedHandshakeResponse = !1, this._connectionState = k.Disconnected, this._connectionStarted = !1, this._cachedPingMessage = this._protocol.writeMessage({ type: y.Ping });
|
|
1201
|
+
}
|
|
1202
|
+
/** Indicates the state of the {@link HubConnection} to the server. */
|
|
1203
|
+
get state() {
|
|
1204
|
+
return this._connectionState;
|
|
1205
|
+
}
|
|
1206
|
+
/** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either
|
|
1207
|
+
* in the disconnected state or if the negotiation step was skipped.
|
|
1208
|
+
*/
|
|
1209
|
+
get connectionId() {
|
|
1210
|
+
return this.connection && this.connection.connectionId || null;
|
|
1211
|
+
}
|
|
1212
|
+
/** Indicates the url of the {@link HubConnection} to the server. */
|
|
1213
|
+
get baseUrl() {
|
|
1214
|
+
return this.connection.baseUrl || "";
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Sets a new url for the HubConnection. Note that the url can only be changed when the connection is in either the Disconnected or
|
|
1218
|
+
* Reconnecting states.
|
|
1219
|
+
* @param {string} url The url to connect to.
|
|
1220
|
+
*/
|
|
1221
|
+
set baseUrl(e) {
|
|
1222
|
+
if (this._connectionState !== k.Disconnected && this._connectionState !== k.Reconnecting)
|
|
1223
|
+
throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");
|
|
1224
|
+
if (!e)
|
|
1225
|
+
throw new Error("The HubConnection url must be a valid url.");
|
|
1226
|
+
this.connection.baseUrl = e;
|
|
1227
|
+
}
|
|
1228
|
+
/** Starts the connection.
|
|
1229
|
+
*
|
|
1230
|
+
* @returns {Promise<void>} A Promise that resolves when the connection has been successfully established, or rejects with an error.
|
|
1231
|
+
*/
|
|
1232
|
+
start() {
|
|
1233
|
+
return this._startPromise = this._startWithStateTransitions(), this._startPromise;
|
|
1234
|
+
}
|
|
1235
|
+
async _startWithStateTransitions() {
|
|
1236
|
+
if (this._connectionState !== k.Disconnected)
|
|
1237
|
+
return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));
|
|
1238
|
+
this._connectionState = k.Connecting, this._logger.log(a.Debug, "Starting HubConnection.");
|
|
1239
|
+
try {
|
|
1240
|
+
await this._startInternal(), T.isBrowser && window.document.addEventListener("freeze", this._freezeEventListener), this._connectionState = k.Connected, this._connectionStarted = !0, this._logger.log(a.Debug, "HubConnection connected successfully.");
|
|
1241
|
+
} catch (e) {
|
|
1242
|
+
return this._connectionState = k.Disconnected, this._logger.log(a.Debug, `HubConnection failed to start successfully because of error '${e}'.`), Promise.reject(e);
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
async _startInternal() {
|
|
1246
|
+
this._stopDuringStartError = void 0, this._receivedHandshakeResponse = !1;
|
|
1247
|
+
const e = new Promise((t, o) => {
|
|
1248
|
+
this._handshakeResolver = t, this._handshakeRejecter = o;
|
|
1249
|
+
});
|
|
1250
|
+
await this.connection.start(this._protocol.transferFormat);
|
|
1251
|
+
try {
|
|
1252
|
+
let t = this._protocol.version;
|
|
1253
|
+
this.connection.features.reconnect || (t = 1);
|
|
1254
|
+
const o = {
|
|
1255
|
+
protocol: this._protocol.name,
|
|
1256
|
+
version: t
|
|
1257
|
+
};
|
|
1258
|
+
if (this._logger.log(a.Debug, "Sending handshake request."), await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(o)), this._logger.log(a.Information, `Using HubProtocol '${this._protocol.name}'.`), this._cleanupTimeout(), this._resetTimeoutPeriod(), this._resetKeepAliveInterval(), await e, this._stopDuringStartError)
|
|
1259
|
+
throw this._stopDuringStartError;
|
|
1260
|
+
(this.connection.features.reconnect || !1) && (this._messageBuffer = new Ut(this._protocol, this.connection, this._statefulReconnectBufferSize), this.connection.features.disconnected = this._messageBuffer._disconnected.bind(this._messageBuffer), this.connection.features.resend = () => {
|
|
1261
|
+
if (this._messageBuffer)
|
|
1262
|
+
return this._messageBuffer._resend();
|
|
1263
|
+
}), this.connection.features.inherentKeepAlive || await this._sendMessage(this._cachedPingMessage);
|
|
1264
|
+
} catch (t) {
|
|
1265
|
+
throw this._logger.log(a.Debug, `Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`), this._cleanupTimeout(), this._cleanupPingTimer(), await this.connection.stop(t), t;
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
/** Stops the connection.
|
|
1269
|
+
*
|
|
1270
|
+
* @returns {Promise<void>} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.
|
|
1271
|
+
*/
|
|
1272
|
+
async stop() {
|
|
1273
|
+
const e = this._startPromise;
|
|
1274
|
+
this.connection.features.reconnect = !1, this._stopPromise = this._stopInternal(), await this._stopPromise;
|
|
1275
|
+
try {
|
|
1276
|
+
await e;
|
|
1277
|
+
} catch {
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
_stopInternal(e) {
|
|
1281
|
+
if (this._connectionState === k.Disconnected)
|
|
1282
|
+
return this._logger.log(a.Debug, `Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`), Promise.resolve();
|
|
1283
|
+
if (this._connectionState === k.Disconnecting)
|
|
1284
|
+
return this._logger.log(a.Debug, `Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`), this._stopPromise;
|
|
1285
|
+
const t = this._connectionState;
|
|
1286
|
+
return this._connectionState = k.Disconnecting, this._logger.log(a.Debug, "Stopping HubConnection."), this._reconnectDelayHandle ? (this._logger.log(a.Debug, "Connection stopped during reconnect delay. Done reconnecting."), clearTimeout(this._reconnectDelayHandle), this._reconnectDelayHandle = void 0, this._completeClose(), Promise.resolve()) : (t === k.Connected && this._sendCloseMessage(), this._cleanupTimeout(), this._cleanupPingTimer(), this._stopDuringStartError = e || new B("The connection was stopped before the hub handshake could complete."), this.connection.stop(e));
|
|
1287
|
+
}
|
|
1288
|
+
async _sendCloseMessage() {
|
|
1289
|
+
try {
|
|
1290
|
+
await this._sendWithProtocol(this._createCloseMessage());
|
|
1291
|
+
} catch {
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
/** Invokes a streaming hub method on the server using the specified name and arguments.
|
|
1295
|
+
*
|
|
1296
|
+
* @typeparam T The type of the items returned by the server.
|
|
1297
|
+
* @param {string} methodName The name of the server method to invoke.
|
|
1298
|
+
* @param {any[]} args The arguments used to invoke the server method.
|
|
1299
|
+
* @returns {IStreamResult<T>} An object that yields results from the server as they are received.
|
|
1300
|
+
*/
|
|
1301
|
+
stream(e, ...t) {
|
|
1302
|
+
const [o, s] = this._replaceStreamingParams(t), r = this._createStreamInvocation(e, t, s);
|
|
1303
|
+
let i;
|
|
1304
|
+
const c = new Wt();
|
|
1305
|
+
return c.cancelCallback = () => {
|
|
1306
|
+
const l = this._createCancelInvocation(r.invocationId);
|
|
1307
|
+
return delete this._callbacks[r.invocationId], i.then(() => this._sendWithProtocol(l));
|
|
1308
|
+
}, this._callbacks[r.invocationId] = (l, h) => {
|
|
1309
|
+
if (h) {
|
|
1310
|
+
c.error(h);
|
|
1311
|
+
return;
|
|
1312
|
+
} else l && (l.type === y.Completion ? l.error ? c.error(new Error(l.error)) : c.complete() : c.next(l.item));
|
|
1313
|
+
}, i = this._sendWithProtocol(r).catch((l) => {
|
|
1314
|
+
c.error(l), delete this._callbacks[r.invocationId];
|
|
1315
|
+
}), this._launchStreams(o, i), c;
|
|
1316
|
+
}
|
|
1317
|
+
_sendMessage(e) {
|
|
1318
|
+
return this._resetKeepAliveInterval(), this.connection.send(e);
|
|
1319
|
+
}
|
|
1320
|
+
/**
|
|
1321
|
+
* Sends a js object to the server.
|
|
1322
|
+
* @param message The js object to serialize and send.
|
|
1323
|
+
*/
|
|
1324
|
+
_sendWithProtocol(e) {
|
|
1325
|
+
return this._messageBuffer ? this._messageBuffer._send(e) : this._sendMessage(this._protocol.writeMessage(e));
|
|
1326
|
+
}
|
|
1327
|
+
/** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.
|
|
1328
|
+
*
|
|
1329
|
+
* The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still
|
|
1330
|
+
* be processing the invocation.
|
|
1331
|
+
*
|
|
1332
|
+
* @param {string} methodName The name of the server method to invoke.
|
|
1333
|
+
* @param {any[]} args The arguments used to invoke the server method.
|
|
1334
|
+
* @returns {Promise<void>} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.
|
|
1335
|
+
*/
|
|
1336
|
+
send(e, ...t) {
|
|
1337
|
+
const [o, s] = this._replaceStreamingParams(t), r = this._sendWithProtocol(this._createInvocation(e, t, !0, s));
|
|
1338
|
+
return this._launchStreams(o, r), r;
|
|
1339
|
+
}
|
|
1340
|
+
/** Invokes a hub method on the server using the specified name and arguments.
|
|
1341
|
+
*
|
|
1342
|
+
* The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise
|
|
1343
|
+
* resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of
|
|
1344
|
+
* resolving the Promise.
|
|
1345
|
+
*
|
|
1346
|
+
* @typeparam T The expected return type.
|
|
1347
|
+
* @param {string} methodName The name of the server method to invoke.
|
|
1348
|
+
* @param {any[]} args The arguments used to invoke the server method.
|
|
1349
|
+
* @returns {Promise<T>} A Promise that resolves with the result of the server method (if any), or rejects with an error.
|
|
1350
|
+
*/
|
|
1351
|
+
invoke(e, ...t) {
|
|
1352
|
+
const [o, s] = this._replaceStreamingParams(t), r = this._createInvocation(e, t, !1, s);
|
|
1353
|
+
return new Promise((c, l) => {
|
|
1354
|
+
this._callbacks[r.invocationId] = (u, p) => {
|
|
1355
|
+
if (p) {
|
|
1356
|
+
l(p);
|
|
1357
|
+
return;
|
|
1358
|
+
} else u && (u.type === y.Completion ? u.error ? l(new Error(u.error)) : c(u.result) : l(new Error(`Unexpected message type: ${u.type}`)));
|
|
1359
|
+
};
|
|
1360
|
+
const h = this._sendWithProtocol(r).catch((u) => {
|
|
1361
|
+
l(u), delete this._callbacks[r.invocationId];
|
|
1362
|
+
});
|
|
1363
|
+
this._launchStreams(o, h);
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
on(e, t) {
|
|
1367
|
+
!e || !t || (e = e.toLowerCase(), this._methods[e] || (this._methods[e] = []), this._methods[e].indexOf(t) === -1 && this._methods[e].push(t));
|
|
1368
|
+
}
|
|
1369
|
+
off(e, t) {
|
|
1370
|
+
if (!e)
|
|
1371
|
+
return;
|
|
1372
|
+
e = e.toLowerCase();
|
|
1373
|
+
const o = this._methods[e];
|
|
1374
|
+
if (o)
|
|
1375
|
+
if (t) {
|
|
1376
|
+
const s = o.indexOf(t);
|
|
1377
|
+
s !== -1 && (o.splice(s, 1), o.length === 0 && delete this._methods[e]);
|
|
1378
|
+
} else
|
|
1379
|
+
delete this._methods[e];
|
|
1380
|
+
}
|
|
1381
|
+
/** Registers a handler that will be invoked when the connection is closed.
|
|
1382
|
+
*
|
|
1383
|
+
* @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).
|
|
1384
|
+
*/
|
|
1385
|
+
onclose(e) {
|
|
1386
|
+
e && this._closedCallbacks.push(e);
|
|
1387
|
+
}
|
|
1388
|
+
/** Registers a handler that will be invoked when the connection starts reconnecting.
|
|
1389
|
+
*
|
|
1390
|
+
* @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any).
|
|
1391
|
+
*/
|
|
1392
|
+
onreconnecting(e) {
|
|
1393
|
+
e && this._reconnectingCallbacks.push(e);
|
|
1394
|
+
}
|
|
1395
|
+
/** Registers a handler that will be invoked when the connection successfully reconnects.
|
|
1396
|
+
*
|
|
1397
|
+
* @param {Function} callback The handler that will be invoked when the connection successfully reconnects.
|
|
1398
|
+
*/
|
|
1399
|
+
onreconnected(e) {
|
|
1400
|
+
e && this._reconnectedCallbacks.push(e);
|
|
1401
|
+
}
|
|
1402
|
+
_processIncomingData(e) {
|
|
1403
|
+
if (this._cleanupTimeout(), this._receivedHandshakeResponse || (e = this._processHandshakeResponse(e), this._receivedHandshakeResponse = !0), e) {
|
|
1404
|
+
const t = this._protocol.parseMessages(e, this._logger);
|
|
1405
|
+
for (const o of t)
|
|
1406
|
+
if (!(this._messageBuffer && !this._messageBuffer._shouldProcessMessage(o)))
|
|
1407
|
+
switch (o.type) {
|
|
1408
|
+
case y.Invocation:
|
|
1409
|
+
this._invokeClientMethod(o).catch((s) => {
|
|
1410
|
+
this._logger.log(a.Error, `Invoke client method threw error: ${we(s)}`);
|
|
1411
|
+
});
|
|
1412
|
+
break;
|
|
1413
|
+
case y.StreamItem:
|
|
1414
|
+
case y.Completion: {
|
|
1415
|
+
const s = this._callbacks[o.invocationId];
|
|
1416
|
+
if (s) {
|
|
1417
|
+
o.type === y.Completion && delete this._callbacks[o.invocationId];
|
|
1418
|
+
try {
|
|
1419
|
+
s(o);
|
|
1420
|
+
} catch (r) {
|
|
1421
|
+
this._logger.log(a.Error, `Stream callback threw error: ${we(r)}`);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
break;
|
|
1425
|
+
}
|
|
1426
|
+
case y.Ping:
|
|
1427
|
+
break;
|
|
1428
|
+
case y.Close: {
|
|
1429
|
+
this._logger.log(a.Information, "Close message received from server.");
|
|
1430
|
+
const s = o.error ? new Error("Server returned an error on close: " + o.error) : void 0;
|
|
1431
|
+
o.allowReconnect === !0 ? this.connection.stop(s) : this._stopPromise = this._stopInternal(s);
|
|
1432
|
+
break;
|
|
1433
|
+
}
|
|
1434
|
+
case y.Ack:
|
|
1435
|
+
this._messageBuffer && this._messageBuffer._ack(o);
|
|
1436
|
+
break;
|
|
1437
|
+
case y.Sequence:
|
|
1438
|
+
this._messageBuffer && this._messageBuffer._resetSequence(o);
|
|
1439
|
+
break;
|
|
1440
|
+
default:
|
|
1441
|
+
this._logger.log(a.Warning, `Invalid message type: ${o.type}.`);
|
|
1442
|
+
break;
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
this._resetTimeoutPeriod();
|
|
1446
|
+
}
|
|
1447
|
+
_processHandshakeResponse(e) {
|
|
1448
|
+
let t, o;
|
|
1449
|
+
try {
|
|
1450
|
+
[o, t] = this._handshakeProtocol.parseHandshakeResponse(e);
|
|
1451
|
+
} catch (s) {
|
|
1452
|
+
const r = "Error parsing handshake response: " + s;
|
|
1453
|
+
this._logger.log(a.Error, r);
|
|
1454
|
+
const i = new Error(r);
|
|
1455
|
+
throw this._handshakeRejecter(i), i;
|
|
1456
|
+
}
|
|
1457
|
+
if (t.error) {
|
|
1458
|
+
const s = "Server returned handshake error: " + t.error;
|
|
1459
|
+
this._logger.log(a.Error, s);
|
|
1460
|
+
const r = new Error(s);
|
|
1461
|
+
throw this._handshakeRejecter(r), r;
|
|
1462
|
+
} else
|
|
1463
|
+
this._logger.log(a.Debug, "Server handshake complete.");
|
|
1464
|
+
return this._handshakeResolver(), o;
|
|
1465
|
+
}
|
|
1466
|
+
_resetKeepAliveInterval() {
|
|
1467
|
+
this.connection.features.inherentKeepAlive || (this._nextKeepAlive = (/* @__PURE__ */ new Date()).getTime() + this.keepAliveIntervalInMilliseconds, this._cleanupPingTimer());
|
|
1468
|
+
}
|
|
1469
|
+
_resetTimeoutPeriod() {
|
|
1470
|
+
if (!this.connection.features || !this.connection.features.inherentKeepAlive) {
|
|
1471
|
+
this._timeoutHandle = setTimeout(() => this.serverTimeout(), this.serverTimeoutInMilliseconds);
|
|
1472
|
+
let e = this._nextKeepAlive - (/* @__PURE__ */ new Date()).getTime();
|
|
1473
|
+
if (e < 0) {
|
|
1474
|
+
this._connectionState === k.Connected && this._trySendPingMessage();
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
this._pingServerHandle === void 0 && (e < 0 && (e = 0), this._pingServerHandle = setTimeout(async () => {
|
|
1478
|
+
this._connectionState === k.Connected && await this._trySendPingMessage();
|
|
1479
|
+
}, e));
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1483
|
+
serverTimeout() {
|
|
1484
|
+
this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."));
|
|
1485
|
+
}
|
|
1486
|
+
async _invokeClientMethod(e) {
|
|
1487
|
+
const t = e.target.toLowerCase(), o = this._methods[t];
|
|
1488
|
+
if (!o) {
|
|
1489
|
+
this._logger.log(a.Warning, `No client method with the name '${t}' found.`), e.invocationId && (this._logger.log(a.Warning, `No result given for '${t}' method and invocation ID '${e.invocationId}'.`), await this._sendWithProtocol(this._createCompletionMessage(e.invocationId, "Client didn't provide a result.", null)));
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1492
|
+
const s = o.slice(), r = !!e.invocationId;
|
|
1493
|
+
let i, c, l;
|
|
1494
|
+
for (const h of s)
|
|
1495
|
+
try {
|
|
1496
|
+
const u = i;
|
|
1497
|
+
i = await h.apply(this, e.arguments), r && i && u && (this._logger.log(a.Error, `Multiple results provided for '${t}'. Sending error to server.`), l = this._createCompletionMessage(e.invocationId, "Client provided multiple results.", null)), c = void 0;
|
|
1498
|
+
} catch (u) {
|
|
1499
|
+
c = u, this._logger.log(a.Error, `A callback for the method '${t}' threw error '${u}'.`);
|
|
1500
|
+
}
|
|
1501
|
+
l ? await this._sendWithProtocol(l) : r ? (c ? l = this._createCompletionMessage(e.invocationId, `${c}`, null) : i !== void 0 ? l = this._createCompletionMessage(e.invocationId, null, i) : (this._logger.log(a.Warning, `No result given for '${t}' method and invocation ID '${e.invocationId}'.`), l = this._createCompletionMessage(e.invocationId, "Client didn't provide a result.", null)), await this._sendWithProtocol(l)) : i && this._logger.log(a.Error, `Result given for '${t}' method but server is not expecting a result.`);
|
|
1502
|
+
}
|
|
1503
|
+
_connectionClosed(e) {
|
|
1504
|
+
this._logger.log(a.Debug, `HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`), this._stopDuringStartError = this._stopDuringStartError || e || new B("The underlying connection was closed before the hub handshake could complete."), this._handshakeResolver && this._handshakeResolver(), this._cancelCallbacksWithError(e || new Error("Invocation canceled due to the underlying connection being closed.")), this._cleanupTimeout(), this._cleanupPingTimer(), this._connectionState === k.Disconnecting ? this._completeClose(e) : this._connectionState === k.Connected && this._reconnectPolicy ? this._reconnect(e) : this._connectionState === k.Connected && this._completeClose(e);
|
|
1505
|
+
}
|
|
1506
|
+
_completeClose(e) {
|
|
1507
|
+
if (this._connectionStarted) {
|
|
1508
|
+
this._connectionState = k.Disconnected, this._connectionStarted = !1, this._messageBuffer && (this._messageBuffer._dispose(e ?? new Error("Connection closed.")), this._messageBuffer = void 0), T.isBrowser && window.document.removeEventListener("freeze", this._freezeEventListener);
|
|
1509
|
+
try {
|
|
1510
|
+
this._closedCallbacks.forEach((t) => t.apply(this, [e]));
|
|
1511
|
+
} catch (t) {
|
|
1512
|
+
this._logger.log(a.Error, `An onclose callback called with error '${e}' threw error '${t}'.`);
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
async _reconnect(e) {
|
|
1517
|
+
const t = Date.now();
|
|
1518
|
+
let o = 0, s = e !== void 0 ? e : new Error("Attempting to reconnect due to a unknown error."), r = this._getNextRetryDelay(o, 0, s);
|
|
1519
|
+
if (r === null) {
|
|
1520
|
+
this._logger.log(a.Debug, "Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."), this._completeClose(e);
|
|
1521
|
+
return;
|
|
1522
|
+
}
|
|
1523
|
+
if (this._connectionState = k.Reconnecting, e ? this._logger.log(a.Information, `Connection reconnecting because of error '${e}'.`) : this._logger.log(a.Information, "Connection reconnecting."), this._reconnectingCallbacks.length !== 0) {
|
|
1524
|
+
try {
|
|
1525
|
+
this._reconnectingCallbacks.forEach((i) => i.apply(this, [e]));
|
|
1526
|
+
} catch (i) {
|
|
1527
|
+
this._logger.log(a.Error, `An onreconnecting callback called with error '${e}' threw error '${i}'.`);
|
|
1528
|
+
}
|
|
1529
|
+
if (this._connectionState !== k.Reconnecting) {
|
|
1530
|
+
this._logger.log(a.Debug, "Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");
|
|
1531
|
+
return;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
for (; r !== null; ) {
|
|
1535
|
+
if (this._logger.log(a.Information, `Reconnect attempt number ${o + 1} will start in ${r} ms.`), await new Promise((i) => {
|
|
1536
|
+
this._reconnectDelayHandle = setTimeout(i, r);
|
|
1537
|
+
}), this._reconnectDelayHandle = void 0, this._connectionState !== k.Reconnecting) {
|
|
1538
|
+
this._logger.log(a.Debug, "Connection left the reconnecting state during reconnect delay. Done reconnecting.");
|
|
1539
|
+
return;
|
|
1540
|
+
}
|
|
1541
|
+
try {
|
|
1542
|
+
if (await this._startInternal(), this._connectionState = k.Connected, this._logger.log(a.Information, "HubConnection reconnected successfully."), this._reconnectedCallbacks.length !== 0)
|
|
1543
|
+
try {
|
|
1544
|
+
this._reconnectedCallbacks.forEach((i) => i.apply(this, [this.connection.connectionId]));
|
|
1545
|
+
} catch (i) {
|
|
1546
|
+
this._logger.log(a.Error, `An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${i}'.`);
|
|
1547
|
+
}
|
|
1548
|
+
return;
|
|
1549
|
+
} catch (i) {
|
|
1550
|
+
if (this._logger.log(a.Information, `Reconnect attempt failed because of error '${i}'.`), this._connectionState !== k.Reconnecting) {
|
|
1551
|
+
this._logger.log(a.Debug, `Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`), this._connectionState === k.Disconnecting && this._completeClose();
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
o++, s = i instanceof Error ? i : new Error(i.toString()), r = this._getNextRetryDelay(o, Date.now() - t, s);
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
this._logger.log(a.Information, `Reconnect retries have been exhausted after ${Date.now() - t} ms and ${o} failed attempts. Connection disconnecting.`), this._completeClose();
|
|
1558
|
+
}
|
|
1559
|
+
_getNextRetryDelay(e, t, o) {
|
|
1560
|
+
try {
|
|
1561
|
+
return this._reconnectPolicy.nextRetryDelayInMilliseconds({
|
|
1562
|
+
elapsedMilliseconds: t,
|
|
1563
|
+
previousRetryCount: e,
|
|
1564
|
+
retryReason: o
|
|
1565
|
+
});
|
|
1566
|
+
} catch (s) {
|
|
1567
|
+
return this._logger.log(a.Error, `IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${s}'.`), null;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
_cancelCallbacksWithError(e) {
|
|
1571
|
+
const t = this._callbacks;
|
|
1572
|
+
this._callbacks = {}, Object.keys(t).forEach((o) => {
|
|
1573
|
+
const s = t[o];
|
|
1574
|
+
try {
|
|
1575
|
+
s(null, e);
|
|
1576
|
+
} catch (r) {
|
|
1577
|
+
this._logger.log(a.Error, `Stream 'error' callback called with '${e}' threw error: ${we(r)}`);
|
|
1578
|
+
}
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
_cleanupPingTimer() {
|
|
1582
|
+
this._pingServerHandle && (clearTimeout(this._pingServerHandle), this._pingServerHandle = void 0);
|
|
1583
|
+
}
|
|
1584
|
+
_cleanupTimeout() {
|
|
1585
|
+
this._timeoutHandle && clearTimeout(this._timeoutHandle);
|
|
1586
|
+
}
|
|
1587
|
+
_createInvocation(e, t, o, s) {
|
|
1588
|
+
if (o)
|
|
1589
|
+
return s.length !== 0 ? {
|
|
1590
|
+
target: e,
|
|
1591
|
+
arguments: t,
|
|
1592
|
+
streamIds: s,
|
|
1593
|
+
type: y.Invocation
|
|
1594
|
+
} : {
|
|
1595
|
+
target: e,
|
|
1596
|
+
arguments: t,
|
|
1597
|
+
type: y.Invocation
|
|
1598
|
+
};
|
|
1599
|
+
{
|
|
1600
|
+
const r = this._invocationId;
|
|
1601
|
+
return this._invocationId++, s.length !== 0 ? {
|
|
1602
|
+
target: e,
|
|
1603
|
+
arguments: t,
|
|
1604
|
+
invocationId: r.toString(),
|
|
1605
|
+
streamIds: s,
|
|
1606
|
+
type: y.Invocation
|
|
1607
|
+
} : {
|
|
1608
|
+
target: e,
|
|
1609
|
+
arguments: t,
|
|
1610
|
+
invocationId: r.toString(),
|
|
1611
|
+
type: y.Invocation
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
_launchStreams(e, t) {
|
|
1616
|
+
if (e.length !== 0) {
|
|
1617
|
+
t || (t = Promise.resolve());
|
|
1618
|
+
for (const o in e)
|
|
1619
|
+
e[o].subscribe({
|
|
1620
|
+
complete: () => {
|
|
1621
|
+
t = t.then(() => this._sendWithProtocol(this._createCompletionMessage(o)));
|
|
1622
|
+
},
|
|
1623
|
+
error: (s) => {
|
|
1624
|
+
let r;
|
|
1625
|
+
s instanceof Error ? r = s.message : s && s.toString ? r = s.toString() : r = "Unknown error", t = t.then(() => this._sendWithProtocol(this._createCompletionMessage(o, r)));
|
|
1626
|
+
},
|
|
1627
|
+
next: (s) => {
|
|
1628
|
+
t = t.then(() => this._sendWithProtocol(this._createStreamItemMessage(o, s)));
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
_replaceStreamingParams(e) {
|
|
1634
|
+
const t = [], o = [];
|
|
1635
|
+
for (let s = 0; s < e.length; s++) {
|
|
1636
|
+
const r = e[s];
|
|
1637
|
+
if (this._isObservable(r)) {
|
|
1638
|
+
const i = this._invocationId;
|
|
1639
|
+
this._invocationId++, t[i] = r, o.push(i.toString()), e.splice(s, 1);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
return [t, o];
|
|
1643
|
+
}
|
|
1644
|
+
_isObservable(e) {
|
|
1645
|
+
return e && e.subscribe && typeof e.subscribe == "function";
|
|
1646
|
+
}
|
|
1647
|
+
_createStreamInvocation(e, t, o) {
|
|
1648
|
+
const s = this._invocationId;
|
|
1649
|
+
return this._invocationId++, o.length !== 0 ? {
|
|
1650
|
+
target: e,
|
|
1651
|
+
arguments: t,
|
|
1652
|
+
invocationId: s.toString(),
|
|
1653
|
+
streamIds: o,
|
|
1654
|
+
type: y.StreamInvocation
|
|
1655
|
+
} : {
|
|
1656
|
+
target: e,
|
|
1657
|
+
arguments: t,
|
|
1658
|
+
invocationId: s.toString(),
|
|
1659
|
+
type: y.StreamInvocation
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
_createCancelInvocation(e) {
|
|
1663
|
+
return {
|
|
1664
|
+
invocationId: e,
|
|
1665
|
+
type: y.CancelInvocation
|
|
1666
|
+
};
|
|
1667
|
+
}
|
|
1668
|
+
_createStreamItemMessage(e, t) {
|
|
1669
|
+
return {
|
|
1670
|
+
invocationId: e,
|
|
1671
|
+
item: t,
|
|
1672
|
+
type: y.StreamItem
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
_createCompletionMessage(e, t, o) {
|
|
1676
|
+
return t ? {
|
|
1677
|
+
error: t,
|
|
1678
|
+
invocationId: e,
|
|
1679
|
+
type: y.Completion
|
|
1680
|
+
} : {
|
|
1681
|
+
invocationId: e,
|
|
1682
|
+
result: o,
|
|
1683
|
+
type: y.Completion
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
_createCloseMessage() {
|
|
1687
|
+
return { type: y.Close };
|
|
1688
|
+
}
|
|
1689
|
+
async _trySendPingMessage() {
|
|
1690
|
+
try {
|
|
1691
|
+
await this._sendMessage(this._cachedPingMessage);
|
|
1692
|
+
} catch {
|
|
1693
|
+
this._cleanupPingTimer();
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
const zt = [0, 2e3, 1e4, 3e4, null];
|
|
1698
|
+
class xe {
|
|
783
1699
|
constructor(e) {
|
|
784
|
-
this._retryDelays = e !== void 0 ? [...e, null] :
|
|
1700
|
+
this._retryDelays = e !== void 0 ? [...e, null] : zt;
|
|
785
1701
|
}
|
|
786
1702
|
nextRetryDelayInMilliseconds(e) {
|
|
787
1703
|
return this._retryDelays[e.previousRetryCount];
|
|
788
1704
|
}
|
|
789
1705
|
}
|
|
790
|
-
class
|
|
1706
|
+
class J {
|
|
791
1707
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
class
|
|
795
|
-
constructor(e,
|
|
796
|
-
super(), this._innerClient = e, this._accessTokenFactory =
|
|
1708
|
+
J.Authorization = "Authorization";
|
|
1709
|
+
J.Cookie = "Cookie";
|
|
1710
|
+
class Kt extends ge {
|
|
1711
|
+
constructor(e, t) {
|
|
1712
|
+
super(), this._innerClient = e, this._accessTokenFactory = t;
|
|
797
1713
|
}
|
|
798
1714
|
async send(e) {
|
|
799
|
-
let
|
|
800
|
-
this._accessTokenFactory && (!this._accessToken || e.url && e.url.indexOf("/negotiate?") > 0) && (
|
|
801
|
-
const
|
|
802
|
-
return
|
|
1715
|
+
let t = !0;
|
|
1716
|
+
this._accessTokenFactory && (!this._accessToken || e.url && e.url.indexOf("/negotiate?") > 0) && (t = !1, this._accessToken = await this._accessTokenFactory()), this._setAuthorizationHeader(e);
|
|
1717
|
+
const o = await this._innerClient.send(e);
|
|
1718
|
+
return t && o.statusCode === 401 && this._accessTokenFactory ? (this._accessToken = await this._accessTokenFactory(), this._setAuthorizationHeader(e), await this._innerClient.send(e)) : o;
|
|
803
1719
|
}
|
|
804
1720
|
_setAuthorizationHeader(e) {
|
|
805
|
-
e.headers || (e.headers = {}), this._accessToken ? e.headers[
|
|
1721
|
+
e.headers || (e.headers = {}), this._accessToken ? e.headers[J.Authorization] = `Bearer ${this._accessToken}` : this._accessTokenFactory && e.headers[J.Authorization] && delete e.headers[J.Authorization];
|
|
806
1722
|
}
|
|
807
1723
|
getCookieString(e) {
|
|
808
1724
|
return this._innerClient.getCookieString(e);
|
|
809
1725
|
}
|
|
810
1726
|
}
|
|
811
|
-
var
|
|
812
|
-
(function(
|
|
813
|
-
|
|
814
|
-
})(
|
|
815
|
-
var
|
|
816
|
-
(function(
|
|
817
|
-
|
|
818
|
-
})(
|
|
819
|
-
let
|
|
1727
|
+
var x;
|
|
1728
|
+
(function(n) {
|
|
1729
|
+
n[n.None = 0] = "None", n[n.WebSockets = 1] = "WebSockets", n[n.ServerSentEvents = 2] = "ServerSentEvents", n[n.LongPolling = 4] = "LongPolling";
|
|
1730
|
+
})(x || (x = {}));
|
|
1731
|
+
var $;
|
|
1732
|
+
(function(n) {
|
|
1733
|
+
n[n.Text = 1] = "Text", n[n.Binary = 2] = "Binary";
|
|
1734
|
+
})($ || ($ = {}));
|
|
1735
|
+
let Gt = class {
|
|
820
1736
|
constructor() {
|
|
821
1737
|
this._isAborted = !1, this.onabort = null;
|
|
822
1738
|
}
|
|
@@ -830,118 +1746,118 @@ let Dt = class {
|
|
|
830
1746
|
return this._isAborted;
|
|
831
1747
|
}
|
|
832
1748
|
};
|
|
833
|
-
class
|
|
1749
|
+
class De {
|
|
834
1750
|
// This is an internal type, not exported from 'index' so this is really just internal.
|
|
835
1751
|
get pollAborted() {
|
|
836
1752
|
return this._pollAbort.aborted;
|
|
837
1753
|
}
|
|
838
|
-
constructor(e,
|
|
839
|
-
this._httpClient = e, this._logger =
|
|
1754
|
+
constructor(e, t, o) {
|
|
1755
|
+
this._httpClient = e, this._logger = t, this._pollAbort = new Gt(), this._options = o, this._running = !1, this.onreceive = null, this.onclose = null;
|
|
840
1756
|
}
|
|
841
|
-
async connect(e,
|
|
842
|
-
if (
|
|
1757
|
+
async connect(e, t) {
|
|
1758
|
+
if (I.isRequired(e, "url"), I.isRequired(t, "transferFormat"), I.isIn(t, $, "transferFormat"), this._url = e, this._logger.log(a.Trace, "(LongPolling transport) Connecting."), t === $.Binary && typeof XMLHttpRequest < "u" && typeof new XMLHttpRequest().responseType != "string")
|
|
843
1759
|
throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");
|
|
844
|
-
const [
|
|
1760
|
+
const [o, s] = te(), r = { [o]: s, ...this._options.headers }, i = {
|
|
845
1761
|
abortSignal: this._pollAbort.signal,
|
|
846
|
-
headers:
|
|
1762
|
+
headers: r,
|
|
847
1763
|
timeout: 1e5,
|
|
848
1764
|
withCredentials: this._options.withCredentials
|
|
849
1765
|
};
|
|
850
|
-
|
|
1766
|
+
t === $.Binary && (i.responseType = "arraybuffer");
|
|
851
1767
|
const c = `${e}&_=${Date.now()}`;
|
|
852
|
-
this._logger.log(
|
|
853
|
-
const
|
|
854
|
-
|
|
1768
|
+
this._logger.log(a.Trace, `(LongPolling transport) polling: ${c}.`);
|
|
1769
|
+
const l = await this._httpClient.get(c, i);
|
|
1770
|
+
l.statusCode !== 200 ? (this._logger.log(a.Error, `(LongPolling transport) Unexpected response code: ${l.statusCode}.`), this._closeError = new X(l.statusText || "", l.statusCode), this._running = !1) : this._running = !0, this._receiving = this._poll(this._url, i);
|
|
855
1771
|
}
|
|
856
|
-
async _poll(e,
|
|
1772
|
+
async _poll(e, t) {
|
|
857
1773
|
try {
|
|
858
1774
|
for (; this._running; )
|
|
859
1775
|
try {
|
|
860
|
-
const
|
|
861
|
-
this._logger.log(
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
} catch (
|
|
865
|
-
this._running ?
|
|
1776
|
+
const o = `${e}&_=${Date.now()}`;
|
|
1777
|
+
this._logger.log(a.Trace, `(LongPolling transport) polling: ${o}.`);
|
|
1778
|
+
const s = await this._httpClient.get(o, t);
|
|
1779
|
+
s.statusCode === 204 ? (this._logger.log(a.Information, "(LongPolling transport) Poll terminated by server."), this._running = !1) : s.statusCode !== 200 ? (this._logger.log(a.Error, `(LongPolling transport) Unexpected response code: ${s.statusCode}.`), this._closeError = new X(s.statusText || "", s.statusCode), this._running = !1) : s.content ? (this._logger.log(a.Trace, `(LongPolling transport) data received. ${se(s.content, this._options.logMessageContent)}.`), this.onreceive && this.onreceive(s.content)) : this._logger.log(a.Trace, "(LongPolling transport) Poll timed out, reissuing.");
|
|
1780
|
+
} catch (o) {
|
|
1781
|
+
this._running ? o instanceof ye ? this._logger.log(a.Trace, "(LongPolling transport) Poll timed out, reissuing.") : (this._closeError = o, this._running = !1) : this._logger.log(a.Trace, `(LongPolling transport) Poll errored after shutdown: ${o.message}`);
|
|
866
1782
|
}
|
|
867
1783
|
} finally {
|
|
868
|
-
this._logger.log(
|
|
1784
|
+
this._logger.log(a.Trace, "(LongPolling transport) Polling complete."), this.pollAborted || this._raiseOnClose();
|
|
869
1785
|
}
|
|
870
1786
|
}
|
|
871
1787
|
async send(e) {
|
|
872
|
-
return this._running ?
|
|
1788
|
+
return this._running ? Ne(this._logger, "LongPolling", this._httpClient, this._url, e, this._options) : Promise.reject(new Error("Cannot send until the transport is connected"));
|
|
873
1789
|
}
|
|
874
1790
|
async stop() {
|
|
875
|
-
this._logger.log(
|
|
1791
|
+
this._logger.log(a.Trace, "(LongPolling transport) Stopping polling."), this._running = !1, this._pollAbort.abort();
|
|
876
1792
|
try {
|
|
877
|
-
await this._receiving, this._logger.log(
|
|
878
|
-
const e = {}, [
|
|
879
|
-
e[
|
|
880
|
-
const
|
|
1793
|
+
await this._receiving, this._logger.log(a.Trace, `(LongPolling transport) sending DELETE request to ${this._url}.`);
|
|
1794
|
+
const e = {}, [t, o] = te();
|
|
1795
|
+
e[t] = o;
|
|
1796
|
+
const s = {
|
|
881
1797
|
headers: { ...e, ...this._options.headers },
|
|
882
1798
|
timeout: this._options.timeout,
|
|
883
1799
|
withCredentials: this._options.withCredentials
|
|
884
1800
|
};
|
|
885
|
-
let
|
|
1801
|
+
let r;
|
|
886
1802
|
try {
|
|
887
|
-
await this._httpClient.delete(this._url,
|
|
888
|
-
} catch (
|
|
889
|
-
|
|
1803
|
+
await this._httpClient.delete(this._url, s);
|
|
1804
|
+
} catch (i) {
|
|
1805
|
+
r = i;
|
|
890
1806
|
}
|
|
891
|
-
|
|
1807
|
+
r ? r instanceof X && (r.statusCode === 404 ? this._logger.log(a.Trace, "(LongPolling transport) A 404 response was returned from sending a DELETE request.") : this._logger.log(a.Trace, `(LongPolling transport) Error sending a DELETE request: ${r}`)) : this._logger.log(a.Trace, "(LongPolling transport) DELETE request accepted.");
|
|
892
1808
|
} finally {
|
|
893
|
-
this._logger.log(
|
|
1809
|
+
this._logger.log(a.Trace, "(LongPolling transport) Stop finished."), this._raiseOnClose();
|
|
894
1810
|
}
|
|
895
1811
|
}
|
|
896
1812
|
_raiseOnClose() {
|
|
897
1813
|
if (this.onclose) {
|
|
898
1814
|
let e = "(LongPolling transport) Firing onclose event.";
|
|
899
|
-
this._closeError && (e += " Error: " + this._closeError), this._logger.log(
|
|
1815
|
+
this._closeError && (e += " Error: " + this._closeError), this._logger.log(a.Trace, e), this.onclose(this._closeError);
|
|
900
1816
|
}
|
|
901
1817
|
}
|
|
902
1818
|
}
|
|
903
|
-
class
|
|
904
|
-
constructor(e,
|
|
905
|
-
this._httpClient = e, this._accessToken =
|
|
906
|
-
}
|
|
907
|
-
async connect(e,
|
|
908
|
-
return
|
|
909
|
-
let
|
|
910
|
-
if (
|
|
911
|
-
|
|
1819
|
+
class Vt {
|
|
1820
|
+
constructor(e, t, o, s) {
|
|
1821
|
+
this._httpClient = e, this._accessToken = t, this._logger = o, this._options = s, this.onreceive = null, this.onclose = null;
|
|
1822
|
+
}
|
|
1823
|
+
async connect(e, t) {
|
|
1824
|
+
return I.isRequired(e, "url"), I.isRequired(t, "transferFormat"), I.isIn(t, $, "transferFormat"), this._logger.log(a.Trace, "(SSE transport) Connecting."), this._url = e, this._accessToken && (e += (e.indexOf("?") < 0 ? "?" : "&") + `access_token=${encodeURIComponent(this._accessToken)}`), new Promise((o, s) => {
|
|
1825
|
+
let r = !1;
|
|
1826
|
+
if (t !== $.Text) {
|
|
1827
|
+
s(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));
|
|
912
1828
|
return;
|
|
913
1829
|
}
|
|
914
|
-
let
|
|
915
|
-
if (
|
|
916
|
-
|
|
1830
|
+
let i;
|
|
1831
|
+
if (T.isBrowser || T.isWebWorker)
|
|
1832
|
+
i = new this._options.EventSource(e, { withCredentials: this._options.withCredentials });
|
|
917
1833
|
else {
|
|
918
|
-
const c = this._httpClient.getCookieString(e),
|
|
919
|
-
|
|
920
|
-
const [h, u] =
|
|
921
|
-
|
|
1834
|
+
const c = this._httpClient.getCookieString(e), l = {};
|
|
1835
|
+
l.Cookie = c;
|
|
1836
|
+
const [h, u] = te();
|
|
1837
|
+
l[h] = u, i = new this._options.EventSource(e, { withCredentials: this._options.withCredentials, headers: { ...l, ...this._options.headers } });
|
|
922
1838
|
}
|
|
923
1839
|
try {
|
|
924
|
-
|
|
1840
|
+
i.onmessage = (c) => {
|
|
925
1841
|
if (this.onreceive)
|
|
926
1842
|
try {
|
|
927
|
-
this._logger.log(
|
|
928
|
-
} catch (
|
|
929
|
-
this._close(
|
|
1843
|
+
this._logger.log(a.Trace, `(SSE transport) data received. ${se(c.data, this._options.logMessageContent)}.`), this.onreceive(c.data);
|
|
1844
|
+
} catch (l) {
|
|
1845
|
+
this._close(l);
|
|
930
1846
|
return;
|
|
931
1847
|
}
|
|
932
|
-
},
|
|
933
|
-
|
|
934
|
-
},
|
|
935
|
-
this._logger.log(
|
|
1848
|
+
}, i.onerror = (c) => {
|
|
1849
|
+
r ? this._close() : s(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."));
|
|
1850
|
+
}, i.onopen = () => {
|
|
1851
|
+
this._logger.log(a.Information, `SSE connected to ${this._url}`), this._eventSource = i, r = !0, o();
|
|
936
1852
|
};
|
|
937
1853
|
} catch (c) {
|
|
938
|
-
|
|
1854
|
+
s(c);
|
|
939
1855
|
return;
|
|
940
1856
|
}
|
|
941
1857
|
});
|
|
942
1858
|
}
|
|
943
1859
|
async send(e) {
|
|
944
|
-
return this._eventSource ?
|
|
1860
|
+
return this._eventSource ? Ne(this._logger, "SSE", this._httpClient, this._url, e, this._options) : Promise.reject(new Error("Cannot send until the transport is connected"));
|
|
945
1861
|
}
|
|
946
1862
|
stop() {
|
|
947
1863
|
return this._close(), Promise.resolve();
|
|
@@ -950,50 +1866,50 @@ class It {
|
|
|
950
1866
|
this._eventSource && (this._eventSource.close(), this._eventSource = void 0, this.onclose && this.onclose(e));
|
|
951
1867
|
}
|
|
952
1868
|
}
|
|
953
|
-
class
|
|
954
|
-
constructor(e,
|
|
955
|
-
this._logger =
|
|
1869
|
+
class Xt {
|
|
1870
|
+
constructor(e, t, o, s, r, i) {
|
|
1871
|
+
this._logger = o, this._accessTokenFactory = t, this._logMessageContent = s, this._webSocketConstructor = r, this._httpClient = e, this.onreceive = null, this.onclose = null, this._headers = i;
|
|
956
1872
|
}
|
|
957
|
-
async connect(e,
|
|
958
|
-
|
|
959
|
-
let
|
|
960
|
-
return this._accessTokenFactory && (
|
|
1873
|
+
async connect(e, t) {
|
|
1874
|
+
I.isRequired(e, "url"), I.isRequired(t, "transferFormat"), I.isIn(t, $, "transferFormat"), this._logger.log(a.Trace, "(WebSockets transport) Connecting.");
|
|
1875
|
+
let o;
|
|
1876
|
+
return this._accessTokenFactory && (o = await this._accessTokenFactory()), new Promise((s, r) => {
|
|
961
1877
|
e = e.replace(/^http/, "ws");
|
|
962
|
-
let
|
|
1878
|
+
let i;
|
|
963
1879
|
const c = this._httpClient.getCookieString(e);
|
|
964
|
-
let
|
|
965
|
-
if (
|
|
966
|
-
const h = {}, [u,
|
|
967
|
-
h[u] =
|
|
1880
|
+
let l = !1;
|
|
1881
|
+
if (T.isNode || T.isReactNative) {
|
|
1882
|
+
const h = {}, [u, p] = te();
|
|
1883
|
+
h[u] = p, o && (h[J.Authorization] = `Bearer ${o}`), c && (h[J.Cookie] = c), i = new this._webSocketConstructor(e, void 0, {
|
|
968
1884
|
headers: { ...h, ...this._headers }
|
|
969
1885
|
});
|
|
970
1886
|
} else
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
this._logger.log(
|
|
974
|
-
},
|
|
1887
|
+
o && (e += (e.indexOf("?") < 0 ? "?" : "&") + `access_token=${encodeURIComponent(o)}`);
|
|
1888
|
+
i || (i = new this._webSocketConstructor(e)), t === $.Binary && (i.binaryType = "arraybuffer"), i.onopen = (h) => {
|
|
1889
|
+
this._logger.log(a.Information, `WebSocket connected to ${e}.`), this._webSocket = i, l = !0, s();
|
|
1890
|
+
}, i.onerror = (h) => {
|
|
975
1891
|
let u = null;
|
|
976
|
-
typeof ErrorEvent < "u" && h instanceof ErrorEvent ? u = h.error : u = "There was an error with the transport", this._logger.log(
|
|
977
|
-
},
|
|
978
|
-
if (this._logger.log(
|
|
1892
|
+
typeof ErrorEvent < "u" && h instanceof ErrorEvent ? u = h.error : u = "There was an error with the transport", this._logger.log(a.Information, `(WebSockets transport) ${u}.`);
|
|
1893
|
+
}, i.onmessage = (h) => {
|
|
1894
|
+
if (this._logger.log(a.Trace, `(WebSockets transport) data received. ${se(h.data, this._logMessageContent)}.`), this.onreceive)
|
|
979
1895
|
try {
|
|
980
1896
|
this.onreceive(h.data);
|
|
981
1897
|
} catch (u) {
|
|
982
1898
|
this._close(u);
|
|
983
1899
|
return;
|
|
984
1900
|
}
|
|
985
|
-
},
|
|
986
|
-
if (
|
|
1901
|
+
}, i.onclose = (h) => {
|
|
1902
|
+
if (l)
|
|
987
1903
|
this._close(h);
|
|
988
1904
|
else {
|
|
989
1905
|
let u = null;
|
|
990
|
-
typeof ErrorEvent < "u" && h instanceof ErrorEvent ? u = h.error : u = "WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",
|
|
1906
|
+
typeof ErrorEvent < "u" && h instanceof ErrorEvent ? u = h.error : u = "WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.", r(new Error(u));
|
|
991
1907
|
}
|
|
992
1908
|
};
|
|
993
1909
|
});
|
|
994
1910
|
}
|
|
995
1911
|
send(e) {
|
|
996
|
-
return this._webSocket && this._webSocket.readyState === this._webSocketConstructor.OPEN ? (this._logger.log(
|
|
1912
|
+
return this._webSocket && this._webSocket.readyState === this._webSocketConstructor.OPEN ? (this._logger.log(a.Trace, `(WebSockets transport) sending data. ${se(e, this._logMessageContent)}.`), this._webSocket.send(e), Promise.resolve()) : Promise.reject("WebSocket is not in the OPEN state");
|
|
997
1913
|
}
|
|
998
1914
|
stop() {
|
|
999
1915
|
return this._webSocket && this._close(void 0), Promise.resolve();
|
|
@@ -1002,50 +1918,50 @@ class Rt {
|
|
|
1002
1918
|
this._webSocket && (this._webSocket.onclose = () => {
|
|
1003
1919
|
}, this._webSocket.onmessage = () => {
|
|
1004
1920
|
}, this._webSocket.onerror = () => {
|
|
1005
|
-
}, this._webSocket.close(), this._webSocket = void 0), this._logger.log(
|
|
1921
|
+
}, this._webSocket.close(), this._webSocket = void 0), this._logger.log(a.Trace, "(WebSockets transport) socket closed."), this.onclose && (this._isCloseEvent(e) && (e.wasClean === !1 || e.code !== 1e3) ? this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason || "no reason given"}).`)) : e instanceof Error ? this.onclose(e) : this.onclose());
|
|
1006
1922
|
}
|
|
1007
1923
|
_isCloseEvent(e) {
|
|
1008
1924
|
return e && typeof e.wasClean == "boolean" && typeof e.code == "number";
|
|
1009
1925
|
}
|
|
1010
1926
|
}
|
|
1011
|
-
const
|
|
1012
|
-
class
|
|
1013
|
-
constructor(e,
|
|
1927
|
+
const Re = 100;
|
|
1928
|
+
class Jt {
|
|
1929
|
+
constructor(e, t = {}) {
|
|
1014
1930
|
if (this._stopPromiseResolver = () => {
|
|
1015
|
-
}, this.features = {}, this._negotiateVersion = 1,
|
|
1016
|
-
|
|
1931
|
+
}, this.features = {}, this._negotiateVersion = 1, I.isRequired(e, "url"), this._logger = Pt(t.logger), this.baseUrl = this._resolveUrl(e), t = t || {}, t.logMessageContent = t.logMessageContent === void 0 ? !1 : t.logMessageContent, typeof t.withCredentials == "boolean" || t.withCredentials === void 0)
|
|
1932
|
+
t.withCredentials = t.withCredentials === void 0 ? !0 : t.withCredentials;
|
|
1017
1933
|
else
|
|
1018
1934
|
throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");
|
|
1019
|
-
|
|
1020
|
-
let
|
|
1021
|
-
if (
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1935
|
+
t.timeout = t.timeout === void 0 ? 100 * 1e3 : t.timeout;
|
|
1936
|
+
let o = null, s = null;
|
|
1937
|
+
if (T.isNode && typeof require < "u") {
|
|
1938
|
+
const r = typeof __webpack_require__ == "function" ? __non_webpack_require__ : require;
|
|
1939
|
+
o = r("ws"), s = r("eventsource");
|
|
1024
1940
|
}
|
|
1025
|
-
!
|
|
1941
|
+
!T.isNode && typeof WebSocket < "u" && !t.WebSocket ? t.WebSocket = WebSocket : T.isNode && !t.WebSocket && o && (t.WebSocket = o), !T.isNode && typeof EventSource < "u" && !t.EventSource ? t.EventSource = EventSource : T.isNode && !t.EventSource && typeof s < "u" && (t.EventSource = s), this._httpClient = new Kt(t.httpClient || new Nt(this._logger), t.accessTokenFactory), this._connectionState = "Disconnected", this._connectionStarted = !1, this._options = t, this.onreceive = null, this.onclose = null;
|
|
1026
1942
|
}
|
|
1027
1943
|
async start(e) {
|
|
1028
|
-
if (e = e ||
|
|
1944
|
+
if (e = e || $.Binary, I.isIn(e, $, "transferFormat"), this._logger.log(a.Debug, `Starting connection with transfer format '${$[e]}'.`), this._connectionState !== "Disconnected")
|
|
1029
1945
|
return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));
|
|
1030
1946
|
if (this._connectionState = "Connecting", this._startInternalPromise = this._startInternal(e), await this._startInternalPromise, this._connectionState === "Disconnecting") {
|
|
1031
|
-
const
|
|
1032
|
-
return this._logger.log(
|
|
1947
|
+
const t = "Failed to start the HttpConnection before stop() was called.";
|
|
1948
|
+
return this._logger.log(a.Error, t), await this._stopPromise, Promise.reject(new B(t));
|
|
1033
1949
|
} else if (this._connectionState !== "Connected") {
|
|
1034
|
-
const
|
|
1035
|
-
return this._logger.log(
|
|
1950
|
+
const t = "HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";
|
|
1951
|
+
return this._logger.log(a.Error, t), Promise.reject(new B(t));
|
|
1036
1952
|
}
|
|
1037
1953
|
this._connectionStarted = !0;
|
|
1038
1954
|
}
|
|
1039
1955
|
send(e) {
|
|
1040
|
-
return this._connectionState !== "Connected" ? Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")) : (this._sendQueue || (this._sendQueue = new
|
|
1956
|
+
return this._connectionState !== "Connected" ? Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")) : (this._sendQueue || (this._sendQueue = new ve(this.transport)), this._sendQueue.send(e));
|
|
1041
1957
|
}
|
|
1042
1958
|
async stop(e) {
|
|
1043
1959
|
if (this._connectionState === "Disconnected")
|
|
1044
|
-
return this._logger.log(
|
|
1960
|
+
return this._logger.log(a.Debug, `Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`), Promise.resolve();
|
|
1045
1961
|
if (this._connectionState === "Disconnecting")
|
|
1046
|
-
return this._logger.log(
|
|
1047
|
-
this._connectionState = "Disconnecting", this._stopPromise = new Promise((
|
|
1048
|
-
this._stopPromiseResolver =
|
|
1962
|
+
return this._logger.log(a.Debug, `Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`), this._stopPromise;
|
|
1963
|
+
this._connectionState = "Disconnecting", this._stopPromise = new Promise((t) => {
|
|
1964
|
+
this._stopPromiseResolver = t;
|
|
1049
1965
|
}), await this._stopInternal(e), await this._stopPromise;
|
|
1050
1966
|
}
|
|
1051
1967
|
async _stopInternal(e) {
|
|
@@ -1057,200 +1973,200 @@ class Mt {
|
|
|
1057
1973
|
if (this.transport) {
|
|
1058
1974
|
try {
|
|
1059
1975
|
await this.transport.stop();
|
|
1060
|
-
} catch (
|
|
1061
|
-
this._logger.log(
|
|
1976
|
+
} catch (t) {
|
|
1977
|
+
this._logger.log(a.Error, `HttpConnection.transport.stop() threw error '${t}'.`), this._stopConnection();
|
|
1062
1978
|
}
|
|
1063
1979
|
this.transport = void 0;
|
|
1064
1980
|
} else
|
|
1065
|
-
this._logger.log(
|
|
1981
|
+
this._logger.log(a.Debug, "HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.");
|
|
1066
1982
|
}
|
|
1067
1983
|
async _startInternal(e) {
|
|
1068
|
-
let
|
|
1984
|
+
let t = this.baseUrl;
|
|
1069
1985
|
this._accessTokenFactory = this._options.accessTokenFactory, this._httpClient._accessTokenFactory = this._accessTokenFactory;
|
|
1070
1986
|
try {
|
|
1071
1987
|
if (this._options.skipNegotiation)
|
|
1072
|
-
if (this._options.transport ===
|
|
1073
|
-
this.transport = this._constructTransport(
|
|
1988
|
+
if (this._options.transport === x.WebSockets)
|
|
1989
|
+
this.transport = this._constructTransport(x.WebSockets), await this._startTransport(t, e);
|
|
1074
1990
|
else
|
|
1075
1991
|
throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");
|
|
1076
1992
|
else {
|
|
1077
|
-
let
|
|
1993
|
+
let o = null, s = 0;
|
|
1078
1994
|
do {
|
|
1079
|
-
if (
|
|
1080
|
-
throw new
|
|
1081
|
-
if (
|
|
1082
|
-
throw new Error(
|
|
1083
|
-
if (
|
|
1995
|
+
if (o = await this._getNegotiationResponse(t), this._connectionState === "Disconnecting" || this._connectionState === "Disconnected")
|
|
1996
|
+
throw new B("The connection was stopped during negotiation.");
|
|
1997
|
+
if (o.error)
|
|
1998
|
+
throw new Error(o.error);
|
|
1999
|
+
if (o.ProtocolVersion)
|
|
1084
2000
|
throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");
|
|
1085
|
-
if (
|
|
1086
|
-
const
|
|
1087
|
-
this._accessTokenFactory = () =>
|
|
2001
|
+
if (o.url && (t = o.url), o.accessToken) {
|
|
2002
|
+
const r = o.accessToken;
|
|
2003
|
+
this._accessTokenFactory = () => r, this._httpClient._accessToken = r, this._httpClient._accessTokenFactory = void 0;
|
|
1088
2004
|
}
|
|
1089
|
-
|
|
1090
|
-
} while (
|
|
1091
|
-
if (
|
|
2005
|
+
s++;
|
|
2006
|
+
} while (o.url && s < Re);
|
|
2007
|
+
if (s === Re && o.url)
|
|
1092
2008
|
throw new Error("Negotiate redirection limit exceeded.");
|
|
1093
|
-
await this._createTransport(
|
|
2009
|
+
await this._createTransport(t, this._options.transport, o, e);
|
|
1094
2010
|
}
|
|
1095
|
-
this.transport instanceof
|
|
1096
|
-
} catch (
|
|
1097
|
-
return this._logger.log(
|
|
2011
|
+
this.transport instanceof De && (this.features.inherentKeepAlive = !0), this._connectionState === "Connecting" && (this._logger.log(a.Debug, "The HttpConnection connected successfully."), this._connectionState = "Connected");
|
|
2012
|
+
} catch (o) {
|
|
2013
|
+
return this._logger.log(a.Error, "Failed to start the connection: " + o), this._connectionState = "Disconnected", this.transport = void 0, this._stopPromiseResolver(), Promise.reject(o);
|
|
1098
2014
|
}
|
|
1099
2015
|
}
|
|
1100
2016
|
async _getNegotiationResponse(e) {
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1103
|
-
const
|
|
1104
|
-
this._logger.log(
|
|
2017
|
+
const t = {}, [o, s] = te();
|
|
2018
|
+
t[o] = s;
|
|
2019
|
+
const r = this._resolveNegotiateUrl(e);
|
|
2020
|
+
this._logger.log(a.Debug, `Sending negotiation request: ${r}.`);
|
|
1105
2021
|
try {
|
|
1106
|
-
const
|
|
2022
|
+
const i = await this._httpClient.post(r, {
|
|
1107
2023
|
content: "",
|
|
1108
|
-
headers: { ...
|
|
2024
|
+
headers: { ...t, ...this._options.headers },
|
|
1109
2025
|
timeout: this._options.timeout,
|
|
1110
2026
|
withCredentials: this._options.withCredentials
|
|
1111
2027
|
});
|
|
1112
|
-
if (
|
|
1113
|
-
return Promise.reject(new Error(`Unexpected status code returned from negotiate '${
|
|
1114
|
-
const c = JSON.parse(
|
|
1115
|
-
return (!c.negotiateVersion || c.negotiateVersion < 1) && (c.connectionToken = c.connectionId), c.useStatefulReconnect && this._options._useStatefulReconnect !== !0 ? Promise.reject(new
|
|
1116
|
-
} catch (
|
|
1117
|
-
let c = "Failed to complete negotiation with the server: " +
|
|
1118
|
-
return
|
|
2028
|
+
if (i.statusCode !== 200)
|
|
2029
|
+
return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));
|
|
2030
|
+
const c = JSON.parse(i.content);
|
|
2031
|
+
return (!c.negotiateVersion || c.negotiateVersion < 1) && (c.connectionToken = c.connectionId), c.useStatefulReconnect && this._options._useStatefulReconnect !== !0 ? Promise.reject(new Ie("Client didn't negotiate Stateful Reconnect but the server did.")) : c;
|
|
2032
|
+
} catch (i) {
|
|
2033
|
+
let c = "Failed to complete negotiation with the server: " + i;
|
|
2034
|
+
return i instanceof X && i.statusCode === 404 && (c = c + " Either this is not a SignalR endpoint or there is a proxy blocking the connection."), this._logger.log(a.Error, c), Promise.reject(new Ie(c));
|
|
1119
2035
|
}
|
|
1120
2036
|
}
|
|
1121
|
-
_createConnectUrl(e,
|
|
1122
|
-
return
|
|
2037
|
+
_createConnectUrl(e, t) {
|
|
2038
|
+
return t ? e + (e.indexOf("?") === -1 ? "?" : "&") + `id=${t}` : e;
|
|
1123
2039
|
}
|
|
1124
|
-
async _createTransport(e,
|
|
1125
|
-
let
|
|
1126
|
-
if (this._isITransport(
|
|
1127
|
-
this._logger.log(
|
|
2040
|
+
async _createTransport(e, t, o, s) {
|
|
2041
|
+
let r = this._createConnectUrl(e, o.connectionToken);
|
|
2042
|
+
if (this._isITransport(t)) {
|
|
2043
|
+
this._logger.log(a.Debug, "Connection was provided an instance of ITransport, using that directly."), this.transport = t, await this._startTransport(r, s), this.connectionId = o.connectionId;
|
|
1128
2044
|
return;
|
|
1129
2045
|
}
|
|
1130
|
-
const
|
|
1131
|
-
let
|
|
2046
|
+
const i = [], c = o.availableTransports || [];
|
|
2047
|
+
let l = o;
|
|
1132
2048
|
for (const h of c) {
|
|
1133
|
-
const u = this._resolveTransportOrError(h,
|
|
2049
|
+
const u = this._resolveTransportOrError(h, t, s, (l == null ? void 0 : l.useStatefulReconnect) === !0);
|
|
1134
2050
|
if (u instanceof Error)
|
|
1135
|
-
|
|
2051
|
+
i.push(`${h.transport} failed:`), i.push(u);
|
|
1136
2052
|
else if (this._isITransport(u)) {
|
|
1137
|
-
if (this.transport = u, !
|
|
2053
|
+
if (this.transport = u, !l) {
|
|
1138
2054
|
try {
|
|
1139
|
-
|
|
1140
|
-
} catch (
|
|
1141
|
-
return Promise.reject(
|
|
2055
|
+
l = await this._getNegotiationResponse(e);
|
|
2056
|
+
} catch (p) {
|
|
2057
|
+
return Promise.reject(p);
|
|
1142
2058
|
}
|
|
1143
|
-
|
|
2059
|
+
r = this._createConnectUrl(e, l.connectionToken);
|
|
1144
2060
|
}
|
|
1145
2061
|
try {
|
|
1146
|
-
await this._startTransport(
|
|
2062
|
+
await this._startTransport(r, s), this.connectionId = l.connectionId;
|
|
1147
2063
|
return;
|
|
1148
|
-
} catch (
|
|
1149
|
-
if (this._logger.log(
|
|
2064
|
+
} catch (p) {
|
|
2065
|
+
if (this._logger.log(a.Error, `Failed to start the transport '${h.transport}': ${p}`), l = void 0, i.push(new kt(`${h.transport} failed: ${p}`, x[h.transport])), this._connectionState !== "Connecting") {
|
|
1150
2066
|
const f = "Failed to select transport before stop() was called.";
|
|
1151
|
-
return this._logger.log(
|
|
2067
|
+
return this._logger.log(a.Debug, f), Promise.reject(new B(f));
|
|
1152
2068
|
}
|
|
1153
2069
|
}
|
|
1154
2070
|
}
|
|
1155
2071
|
}
|
|
1156
|
-
return
|
|
2072
|
+
return i.length > 0 ? Promise.reject(new Et(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`, i)) : Promise.reject(new Error("None of the transports supported by the client are supported by the server."));
|
|
1157
2073
|
}
|
|
1158
2074
|
_constructTransport(e) {
|
|
1159
2075
|
switch (e) {
|
|
1160
|
-
case
|
|
2076
|
+
case x.WebSockets:
|
|
1161
2077
|
if (!this._options.WebSocket)
|
|
1162
2078
|
throw new Error("'WebSocket' is not supported in your environment.");
|
|
1163
|
-
return new
|
|
1164
|
-
case
|
|
2079
|
+
return new Xt(this._httpClient, this._accessTokenFactory, this._logger, this._options.logMessageContent, this._options.WebSocket, this._options.headers || {});
|
|
2080
|
+
case x.ServerSentEvents:
|
|
1165
2081
|
if (!this._options.EventSource)
|
|
1166
2082
|
throw new Error("'EventSource' is not supported in your environment.");
|
|
1167
|
-
return new
|
|
1168
|
-
case
|
|
1169
|
-
return new
|
|
2083
|
+
return new Vt(this._httpClient, this._httpClient._accessToken, this._logger, this._options);
|
|
2084
|
+
case x.LongPolling:
|
|
2085
|
+
return new De(this._httpClient, this._logger, this._options);
|
|
1170
2086
|
default:
|
|
1171
2087
|
throw new Error(`Unknown transport: ${e}.`);
|
|
1172
2088
|
}
|
|
1173
2089
|
}
|
|
1174
|
-
_startTransport(e,
|
|
1175
|
-
return this.transport.onreceive = this.onreceive, this.features.reconnect ? this.transport.onclose = async (
|
|
1176
|
-
let
|
|
2090
|
+
_startTransport(e, t) {
|
|
2091
|
+
return this.transport.onreceive = this.onreceive, this.features.reconnect ? this.transport.onclose = async (o) => {
|
|
2092
|
+
let s = !1;
|
|
1177
2093
|
if (this.features.reconnect)
|
|
1178
2094
|
try {
|
|
1179
|
-
this.features.disconnected(), await this.transport.connect(e,
|
|
2095
|
+
this.features.disconnected(), await this.transport.connect(e, t), await this.features.resend();
|
|
1180
2096
|
} catch {
|
|
1181
|
-
|
|
2097
|
+
s = !0;
|
|
1182
2098
|
}
|
|
1183
2099
|
else {
|
|
1184
|
-
this._stopConnection(
|
|
2100
|
+
this._stopConnection(o);
|
|
1185
2101
|
return;
|
|
1186
2102
|
}
|
|
1187
|
-
|
|
1188
|
-
} : this.transport.onclose = (
|
|
1189
|
-
}
|
|
1190
|
-
_resolveTransportOrError(e,
|
|
1191
|
-
const
|
|
1192
|
-
if (
|
|
1193
|
-
return this._logger.log(
|
|
1194
|
-
if (
|
|
1195
|
-
if (e.transferFormats.map((c) =>
|
|
1196
|
-
if (
|
|
1197
|
-
return this._logger.log(
|
|
1198
|
-
this._logger.log(
|
|
2103
|
+
s && this._stopConnection(o);
|
|
2104
|
+
} : this.transport.onclose = (o) => this._stopConnection(o), this.transport.connect(e, t);
|
|
2105
|
+
}
|
|
2106
|
+
_resolveTransportOrError(e, t, o, s) {
|
|
2107
|
+
const r = x[e.transport];
|
|
2108
|
+
if (r == null)
|
|
2109
|
+
return this._logger.log(a.Debug, `Skipping transport '${e.transport}' because it is not supported by this client.`), new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);
|
|
2110
|
+
if (Yt(t, r))
|
|
2111
|
+
if (e.transferFormats.map((c) => $[c]).indexOf(o) >= 0) {
|
|
2112
|
+
if (r === x.WebSockets && !this._options.WebSocket || r === x.ServerSentEvents && !this._options.EventSource)
|
|
2113
|
+
return this._logger.log(a.Debug, `Skipping transport '${x[r]}' because it is not supported in your environment.'`), new Ct(`'${x[r]}' is not supported in your environment.`, r);
|
|
2114
|
+
this._logger.log(a.Debug, `Selecting transport '${x[r]}'.`);
|
|
1199
2115
|
try {
|
|
1200
|
-
return this.features.reconnect =
|
|
2116
|
+
return this.features.reconnect = r === x.WebSockets ? s : void 0, this._constructTransport(r);
|
|
1201
2117
|
} catch (c) {
|
|
1202
2118
|
return c;
|
|
1203
2119
|
}
|
|
1204
2120
|
} else
|
|
1205
|
-
return this._logger.log(
|
|
2121
|
+
return this._logger.log(a.Debug, `Skipping transport '${x[r]}' because it does not support the requested transfer format '${$[o]}'.`), new Error(`'${x[r]}' does not support ${$[o]}.`);
|
|
1206
2122
|
else
|
|
1207
|
-
return this._logger.log(
|
|
2123
|
+
return this._logger.log(a.Debug, `Skipping transport '${x[r]}' because it was disabled by the client.`), new vt(`'${x[r]}' is disabled by the client.`, r);
|
|
1208
2124
|
}
|
|
1209
2125
|
_isITransport(e) {
|
|
1210
2126
|
return e && typeof e == "object" && "connect" in e;
|
|
1211
2127
|
}
|
|
1212
2128
|
_stopConnection(e) {
|
|
1213
|
-
if (this._logger.log(
|
|
1214
|
-
this._logger.log(
|
|
2129
|
+
if (this._logger.log(a.Debug, `HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`), this.transport = void 0, e = this._stopError || e, this._stopError = void 0, this._connectionState === "Disconnected") {
|
|
2130
|
+
this._logger.log(a.Debug, `Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);
|
|
1215
2131
|
return;
|
|
1216
2132
|
}
|
|
1217
2133
|
if (this._connectionState === "Connecting")
|
|
1218
|
-
throw this._logger.log(
|
|
1219
|
-
if (this._connectionState === "Disconnecting" && this._stopPromiseResolver(), e ? this._logger.log(
|
|
1220
|
-
this._logger.log(
|
|
2134
|
+
throw this._logger.log(a.Warning, `Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`), new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);
|
|
2135
|
+
if (this._connectionState === "Disconnecting" && this._stopPromiseResolver(), e ? this._logger.log(a.Error, `Connection disconnected with error '${e}'.`) : this._logger.log(a.Information, "Connection disconnected."), this._sendQueue && (this._sendQueue.stop().catch((t) => {
|
|
2136
|
+
this._logger.log(a.Error, `TransportSendQueue.stop() threw error '${t}'.`);
|
|
1221
2137
|
}), this._sendQueue = void 0), this.connectionId = void 0, this._connectionState = "Disconnected", this._connectionStarted) {
|
|
1222
2138
|
this._connectionStarted = !1;
|
|
1223
2139
|
try {
|
|
1224
2140
|
this.onclose && this.onclose(e);
|
|
1225
|
-
} catch (
|
|
1226
|
-
this._logger.log(
|
|
2141
|
+
} catch (t) {
|
|
2142
|
+
this._logger.log(a.Error, `HttpConnection.onclose(${e}) threw error '${t}'.`);
|
|
1227
2143
|
}
|
|
1228
2144
|
}
|
|
1229
2145
|
}
|
|
1230
2146
|
_resolveUrl(e) {
|
|
1231
2147
|
if (e.lastIndexOf("https://", 0) === 0 || e.lastIndexOf("http://", 0) === 0)
|
|
1232
2148
|
return e;
|
|
1233
|
-
if (!
|
|
2149
|
+
if (!T.isBrowser)
|
|
1234
2150
|
throw new Error(`Cannot resolve '${e}'.`);
|
|
1235
|
-
const
|
|
1236
|
-
return
|
|
2151
|
+
const t = window.document.createElement("a");
|
|
2152
|
+
return t.href = e, this._logger.log(a.Information, `Normalizing '${e}' to '${t.href}'.`), t.href;
|
|
1237
2153
|
}
|
|
1238
2154
|
_resolveNegotiateUrl(e) {
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1241
|
-
const
|
|
1242
|
-
return
|
|
2155
|
+
const t = new URL(e);
|
|
2156
|
+
t.pathname.endsWith("/") ? t.pathname += "negotiate" : t.pathname += "/negotiate";
|
|
2157
|
+
const o = new URLSearchParams(t.searchParams);
|
|
2158
|
+
return o.has("negotiateVersion") || o.append("negotiateVersion", this._negotiateVersion.toString()), o.has("useStatefulReconnect") ? o.get("useStatefulReconnect") === "true" && (this._options._useStatefulReconnect = !0) : this._options._useStatefulReconnect === !0 && o.append("useStatefulReconnect", "true"), t.search = o.toString(), t.toString();
|
|
1243
2159
|
}
|
|
1244
2160
|
}
|
|
1245
|
-
function
|
|
1246
|
-
return !
|
|
2161
|
+
function Yt(n, e) {
|
|
2162
|
+
return !n || (e & n) !== 0;
|
|
1247
2163
|
}
|
|
1248
|
-
class
|
|
2164
|
+
class ve {
|
|
1249
2165
|
constructor(e) {
|
|
1250
|
-
this._transport = e, this._buffer = [], this._executing = !0, this._sendBufferedData = new
|
|
2166
|
+
this._transport = e, this._buffer = [], this._executing = !0, this._sendBufferedData = new le(), this._transportResult = new le(), this._sendLoopPromise = this._sendLoop();
|
|
1251
2167
|
}
|
|
1252
2168
|
send(e) {
|
|
1253
|
-
return this._bufferData(e), this._transportResult || (this._transportResult = new
|
|
2169
|
+
return this._bufferData(e), this._transportResult || (this._transportResult = new le()), this._transportResult.promise;
|
|
1254
2170
|
}
|
|
1255
2171
|
stop() {
|
|
1256
2172
|
return this._executing = !1, this._sendBufferedData.resolve(), this._sendLoopPromise;
|
|
@@ -1266,29 +2182,29 @@ class me {
|
|
|
1266
2182
|
this._transportResult && this._transportResult.reject("Connection stopped.");
|
|
1267
2183
|
break;
|
|
1268
2184
|
}
|
|
1269
|
-
this._sendBufferedData = new
|
|
2185
|
+
this._sendBufferedData = new le();
|
|
1270
2186
|
const e = this._transportResult;
|
|
1271
2187
|
this._transportResult = void 0;
|
|
1272
|
-
const
|
|
2188
|
+
const t = typeof this._buffer[0] == "string" ? this._buffer.join("") : ve._concatBuffers(this._buffer);
|
|
1273
2189
|
this._buffer.length = 0;
|
|
1274
2190
|
try {
|
|
1275
|
-
await this._transport.send(
|
|
1276
|
-
} catch (
|
|
1277
|
-
e.reject(
|
|
2191
|
+
await this._transport.send(t), e.resolve();
|
|
2192
|
+
} catch (o) {
|
|
2193
|
+
e.reject(o);
|
|
1278
2194
|
}
|
|
1279
2195
|
}
|
|
1280
2196
|
}
|
|
1281
2197
|
static _concatBuffers(e) {
|
|
1282
|
-
const
|
|
1283
|
-
let
|
|
1284
|
-
for (const
|
|
1285
|
-
|
|
1286
|
-
return
|
|
2198
|
+
const t = e.map((r) => r.byteLength).reduce((r, i) => r + i), o = new Uint8Array(t);
|
|
2199
|
+
let s = 0;
|
|
2200
|
+
for (const r of e)
|
|
2201
|
+
o.set(new Uint8Array(r), s), s += r.byteLength;
|
|
2202
|
+
return o.buffer;
|
|
1287
2203
|
}
|
|
1288
2204
|
}
|
|
1289
|
-
class
|
|
2205
|
+
class le {
|
|
1290
2206
|
constructor() {
|
|
1291
|
-
this.promise = new Promise((e,
|
|
2207
|
+
this.promise = new Promise((e, t) => [this._resolver, this._rejecter] = [e, t]);
|
|
1292
2208
|
}
|
|
1293
2209
|
resolve() {
|
|
1294
2210
|
this._resolver();
|
|
@@ -1297,54 +2213,54 @@ class se {
|
|
|
1297
2213
|
this._rejecter(e);
|
|
1298
2214
|
}
|
|
1299
2215
|
}
|
|
1300
|
-
const
|
|
1301
|
-
class
|
|
2216
|
+
const Qt = "json";
|
|
2217
|
+
class Zt {
|
|
1302
2218
|
constructor() {
|
|
1303
|
-
this.name =
|
|
2219
|
+
this.name = Qt, this.version = 2, this.transferFormat = $.Text;
|
|
1304
2220
|
}
|
|
1305
2221
|
/** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.
|
|
1306
2222
|
*
|
|
1307
2223
|
* @param {string} input A string containing the serialized representation.
|
|
1308
2224
|
* @param {ILogger} logger A logger that will be used to log messages that occur during parsing.
|
|
1309
2225
|
*/
|
|
1310
|
-
parseMessages(e,
|
|
2226
|
+
parseMessages(e, t) {
|
|
1311
2227
|
if (typeof e != "string")
|
|
1312
2228
|
throw new Error("Invalid input for JSON hub protocol. Expected a string.");
|
|
1313
2229
|
if (!e)
|
|
1314
2230
|
return [];
|
|
1315
|
-
|
|
1316
|
-
const
|
|
1317
|
-
for (const
|
|
1318
|
-
const
|
|
1319
|
-
if (typeof
|
|
2231
|
+
t === null && (t = oe.instance);
|
|
2232
|
+
const o = H.parse(e), s = [];
|
|
2233
|
+
for (const r of o) {
|
|
2234
|
+
const i = JSON.parse(r);
|
|
2235
|
+
if (typeof i.type != "number")
|
|
1320
2236
|
throw new Error("Invalid payload.");
|
|
1321
|
-
switch (
|
|
1322
|
-
case
|
|
1323
|
-
this._isInvocationMessage(
|
|
2237
|
+
switch (i.type) {
|
|
2238
|
+
case y.Invocation:
|
|
2239
|
+
this._isInvocationMessage(i);
|
|
1324
2240
|
break;
|
|
1325
|
-
case
|
|
1326
|
-
this._isStreamItemMessage(
|
|
2241
|
+
case y.StreamItem:
|
|
2242
|
+
this._isStreamItemMessage(i);
|
|
1327
2243
|
break;
|
|
1328
|
-
case
|
|
1329
|
-
this._isCompletionMessage(
|
|
2244
|
+
case y.Completion:
|
|
2245
|
+
this._isCompletionMessage(i);
|
|
1330
2246
|
break;
|
|
1331
|
-
case
|
|
2247
|
+
case y.Ping:
|
|
1332
2248
|
break;
|
|
1333
|
-
case
|
|
2249
|
+
case y.Close:
|
|
1334
2250
|
break;
|
|
1335
|
-
case
|
|
1336
|
-
this._isAckMessage(
|
|
2251
|
+
case y.Ack:
|
|
2252
|
+
this._isAckMessage(i);
|
|
1337
2253
|
break;
|
|
1338
|
-
case
|
|
1339
|
-
this._isSequenceMessage(
|
|
2254
|
+
case y.Sequence:
|
|
2255
|
+
this._isSequenceMessage(i);
|
|
1340
2256
|
break;
|
|
1341
2257
|
default:
|
|
1342
|
-
|
|
2258
|
+
t.log(a.Information, "Unknown message type '" + i.type + "' ignored.");
|
|
1343
2259
|
continue;
|
|
1344
2260
|
}
|
|
1345
|
-
|
|
2261
|
+
s.push(i);
|
|
1346
2262
|
}
|
|
1347
|
-
return
|
|
2263
|
+
return s;
|
|
1348
2264
|
}
|
|
1349
2265
|
/** Writes the specified {@link @microsoft/signalr.HubMessage} to a string and returns it.
|
|
1350
2266
|
*
|
|
@@ -1352,7 +2268,7 @@ class Ot {
|
|
|
1352
2268
|
* @returns {string} A string containing the serialized representation of the message.
|
|
1353
2269
|
*/
|
|
1354
2270
|
writeMessage(e) {
|
|
1355
|
-
return
|
|
2271
|
+
return H.write(JSON.stringify(e));
|
|
1356
2272
|
}
|
|
1357
2273
|
_isInvocationMessage(e) {
|
|
1358
2274
|
this._assertNotEmptyString(e.target, "Invalid payload for Invocation message."), e.invocationId !== void 0 && this._assertNotEmptyString(e.invocationId, "Invalid payload for Invocation message.");
|
|
@@ -1374,43 +2290,43 @@ class Ot {
|
|
|
1374
2290
|
if (typeof e.sequenceId != "number")
|
|
1375
2291
|
throw new Error("Invalid SequenceId for Sequence message.");
|
|
1376
2292
|
}
|
|
1377
|
-
_assertNotEmptyString(e,
|
|
2293
|
+
_assertNotEmptyString(e, t) {
|
|
1378
2294
|
if (typeof e != "string" || e === "")
|
|
1379
|
-
throw new Error(
|
|
2295
|
+
throw new Error(t);
|
|
1380
2296
|
}
|
|
1381
2297
|
}
|
|
1382
|
-
const
|
|
1383
|
-
trace:
|
|
1384
|
-
debug:
|
|
1385
|
-
info:
|
|
1386
|
-
information:
|
|
1387
|
-
warn:
|
|
1388
|
-
warning:
|
|
1389
|
-
error:
|
|
1390
|
-
critical:
|
|
1391
|
-
none:
|
|
2298
|
+
const en = {
|
|
2299
|
+
trace: a.Trace,
|
|
2300
|
+
debug: a.Debug,
|
|
2301
|
+
info: a.Information,
|
|
2302
|
+
information: a.Information,
|
|
2303
|
+
warn: a.Warning,
|
|
2304
|
+
warning: a.Warning,
|
|
2305
|
+
error: a.Error,
|
|
2306
|
+
critical: a.Critical,
|
|
2307
|
+
none: a.None
|
|
1392
2308
|
};
|
|
1393
|
-
function
|
|
1394
|
-
const e =
|
|
2309
|
+
function tn(n) {
|
|
2310
|
+
const e = en[n.toLowerCase()];
|
|
1395
2311
|
if (typeof e < "u")
|
|
1396
2312
|
return e;
|
|
1397
|
-
throw new Error(`Unknown log level: ${
|
|
2313
|
+
throw new Error(`Unknown log level: ${n}`);
|
|
1398
2314
|
}
|
|
1399
|
-
class
|
|
2315
|
+
class nn {
|
|
1400
2316
|
configureLogging(e) {
|
|
1401
|
-
if (
|
|
2317
|
+
if (I.isRequired(e, "logging"), on(e))
|
|
1402
2318
|
this.logger = e;
|
|
1403
2319
|
else if (typeof e == "string") {
|
|
1404
|
-
const
|
|
1405
|
-
this.logger = new
|
|
2320
|
+
const t = tn(e);
|
|
2321
|
+
this.logger = new de(t);
|
|
1406
2322
|
} else
|
|
1407
|
-
this.logger = new
|
|
2323
|
+
this.logger = new de(e);
|
|
1408
2324
|
return this;
|
|
1409
2325
|
}
|
|
1410
|
-
withUrl(e,
|
|
1411
|
-
return
|
|
2326
|
+
withUrl(e, t) {
|
|
2327
|
+
return I.isRequired(e, "url"), I.isNotEmpty(e, "url"), this.url = e, typeof t == "object" ? this.httpConnectionOptions = { ...this.httpConnectionOptions, ...t } : this.httpConnectionOptions = {
|
|
1412
2328
|
...this.httpConnectionOptions,
|
|
1413
|
-
transport:
|
|
2329
|
+
transport: t
|
|
1414
2330
|
}, this;
|
|
1415
2331
|
}
|
|
1416
2332
|
/** Configures the {@link @microsoft/signalr.HubConnection} to use the specified Hub Protocol.
|
|
@@ -1418,26 +2334,26 @@ class Ut {
|
|
|
1418
2334
|
* @param {IHubProtocol} protocol The {@link @microsoft/signalr.IHubProtocol} implementation to use.
|
|
1419
2335
|
*/
|
|
1420
2336
|
withHubProtocol(e) {
|
|
1421
|
-
return
|
|
2337
|
+
return I.isRequired(e, "protocol"), this.protocol = e, this;
|
|
1422
2338
|
}
|
|
1423
2339
|
withAutomaticReconnect(e) {
|
|
1424
2340
|
if (this.reconnectPolicy)
|
|
1425
2341
|
throw new Error("A reconnectPolicy has already been set.");
|
|
1426
|
-
return e ? Array.isArray(e) ? this.reconnectPolicy = new
|
|
2342
|
+
return e ? Array.isArray(e) ? this.reconnectPolicy = new xe(e) : this.reconnectPolicy = e : this.reconnectPolicy = new xe(), this;
|
|
1427
2343
|
}
|
|
1428
2344
|
/** Configures {@link @microsoft/signalr.HubConnection.serverTimeoutInMilliseconds} for the {@link @microsoft/signalr.HubConnection}.
|
|
1429
2345
|
*
|
|
1430
2346
|
* @returns The {@link @microsoft/signalr.HubConnectionBuilder} instance, for chaining.
|
|
1431
2347
|
*/
|
|
1432
2348
|
withServerTimeout(e) {
|
|
1433
|
-
return
|
|
2349
|
+
return I.isRequired(e, "milliseconds"), this._serverTimeoutInMilliseconds = e, this;
|
|
1434
2350
|
}
|
|
1435
2351
|
/** Configures {@link @microsoft/signalr.HubConnection.keepAliveIntervalInMilliseconds} for the {@link @microsoft/signalr.HubConnection}.
|
|
1436
2352
|
*
|
|
1437
2353
|
* @returns The {@link @microsoft/signalr.HubConnectionBuilder} instance, for chaining.
|
|
1438
2354
|
*/
|
|
1439
2355
|
withKeepAliveInterval(e) {
|
|
1440
|
-
return
|
|
2356
|
+
return I.isRequired(e, "milliseconds"), this._keepAliveIntervalInMilliseconds = e, this;
|
|
1441
2357
|
}
|
|
1442
2358
|
/** Enables and configures options for the Stateful Reconnect feature.
|
|
1443
2359
|
*
|
|
@@ -1454,137 +2370,142 @@ class Ut {
|
|
|
1454
2370
|
const e = this.httpConnectionOptions || {};
|
|
1455
2371
|
if (e.logger === void 0 && (e.logger = this.logger), !this.url)
|
|
1456
2372
|
throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");
|
|
1457
|
-
const
|
|
1458
|
-
return
|
|
2373
|
+
const t = new Jt(this.url, e);
|
|
2374
|
+
return Ce.create(t, this.logger || oe.instance, this.protocol || new Zt(), this.reconnectPolicy, this._serverTimeoutInMilliseconds, this._keepAliveIntervalInMilliseconds, this._statefulReconnectBufferSize);
|
|
1459
2375
|
}
|
|
1460
2376
|
}
|
|
1461
|
-
function
|
|
1462
|
-
return
|
|
2377
|
+
function on(n) {
|
|
2378
|
+
return n.log !== void 0;
|
|
1463
2379
|
}
|
|
1464
|
-
const
|
|
1465
|
-
|
|
2380
|
+
const Oe = Be({
|
|
2381
|
+
isAlive: !1,
|
|
2382
|
+
shouldBeAlive: !1,
|
|
2383
|
+
connectionState: k.Disconnected,
|
|
2384
|
+
hasLastConnectionEnded: !1
|
|
2385
|
+
}), sn = 10 * 1e3, rn = 15 * 1e3, In = ({
|
|
2386
|
+
children: n,
|
|
1466
2387
|
apiUrl: e,
|
|
1467
|
-
endpoint:
|
|
2388
|
+
endpoint: t
|
|
1468
2389
|
}) => {
|
|
1469
2390
|
const {
|
|
1470
|
-
authState:
|
|
1471
|
-
getToken:
|
|
1472
|
-
} =
|
|
1473
|
-
|
|
1474
|
-
const f =
|
|
2391
|
+
authState: o,
|
|
2392
|
+
getToken: s
|
|
2393
|
+
} = G(be), r = at(), [i, c] = M(k.Disconnected), [l, h] = M(!1), u = ee(null), p = ee(s);
|
|
2394
|
+
p.current = s;
|
|
2395
|
+
const f = ne(() => {
|
|
1475
2396
|
var d;
|
|
1476
|
-
return c(((d = u.current) == null ? void 0 : d.state) ??
|
|
2397
|
+
return c(((d = u.current) == null ? void 0 : d.state) ?? k.Disconnected);
|
|
1477
2398
|
}, []);
|
|
1478
|
-
|
|
1479
|
-
if (
|
|
2399
|
+
K(() => {
|
|
2400
|
+
if (o !== "AUTH_OK" || !r)
|
|
1480
2401
|
return;
|
|
1481
2402
|
let d = !1, S = null;
|
|
1482
|
-
const
|
|
1483
|
-
accessTokenFactory: () =>
|
|
2403
|
+
const _ = new nn().withUrl(`${e}/${t}`, {
|
|
2404
|
+
accessTokenFactory: () => p.current().then((m) => (m == null ? void 0 : m.token) ?? "")
|
|
1484
2405
|
}).withAutomaticReconnect({
|
|
1485
|
-
nextRetryDelayInMilliseconds: (
|
|
2406
|
+
nextRetryDelayInMilliseconds: (m) => Math.min(1e3 * 2 ** m.previousRetryCount, rn)
|
|
1486
2407
|
}).build();
|
|
1487
|
-
u.current =
|
|
1488
|
-
console.log("WS: Server says:",
|
|
1489
|
-
}),
|
|
1490
|
-
d || (console.log("WS: Reconnecting...",
|
|
1491
|
-
}),
|
|
2408
|
+
u.current = _, _.on("Connected", (m) => {
|
|
2409
|
+
console.log("WS: Server says:", m);
|
|
2410
|
+
}), _.onreconnecting((m) => {
|
|
2411
|
+
d || (console.log("WS: Reconnecting...", m), f());
|
|
2412
|
+
}), _.onreconnected(() => {
|
|
1492
2413
|
d || (console.log("WS: Reconnected"), f(), h(!1));
|
|
1493
|
-
}),
|
|
1494
|
-
d || (console.log("WS: Connection closed",
|
|
2414
|
+
}), _.onclose((m) => {
|
|
2415
|
+
d || (console.log("WS: Connection closed", m), f(), h(!0));
|
|
1495
2416
|
});
|
|
1496
2417
|
const C = () => {
|
|
1497
|
-
S !== null && window.clearTimeout(S),
|
|
2418
|
+
S !== null && window.clearTimeout(S), _.start().then(() => {
|
|
1498
2419
|
if (d) {
|
|
1499
|
-
|
|
1500
|
-
console.log("WS: Error stopping connection:",
|
|
2420
|
+
_.stop().catch((m) => {
|
|
2421
|
+
console.log("WS: Error stopping connection:", m);
|
|
1501
2422
|
});
|
|
1502
2423
|
return;
|
|
1503
2424
|
}
|
|
1504
2425
|
console.log("WS: Connection started"), f(), h(!1);
|
|
1505
|
-
}).catch((
|
|
1506
|
-
d || (console.log("WS: Error starting connection:",
|
|
2426
|
+
}).catch((m) => {
|
|
2427
|
+
d || (console.log("WS: Error starting connection:", m), f(), h(!0), S = window.setTimeout(C, sn));
|
|
1507
2428
|
});
|
|
1508
2429
|
};
|
|
1509
2430
|
return C(), () => {
|
|
1510
|
-
d = !0, S !== null && window.clearTimeout(S), u.current = null, f(), h(!1),
|
|
1511
|
-
console.log("WS: Error stopping connection:",
|
|
2431
|
+
d = !0, S !== null && window.clearTimeout(S), u.current = null, f(), h(!1), _.stop().catch((m) => {
|
|
2432
|
+
console.log("WS: Error stopping connection:", m);
|
|
1512
2433
|
});
|
|
1513
2434
|
};
|
|
1514
|
-
}, [e,
|
|
1515
|
-
const g =
|
|
2435
|
+
}, [e, o, t, f, r]);
|
|
2436
|
+
const g = V(() => i === k.Connected, [i]), w = o === "AUTH_OK" && r, b = V(() => ({
|
|
1516
2437
|
isAlive: g,
|
|
1517
2438
|
shouldBeAlive: w,
|
|
1518
|
-
connectionState:
|
|
1519
|
-
hasLastConnectionEnded:
|
|
1520
|
-
}), [g, w,
|
|
1521
|
-
return /* @__PURE__ */
|
|
1522
|
-
},
|
|
1523
|
-
const
|
|
1524
|
-
if (!
|
|
2439
|
+
connectionState: i,
|
|
2440
|
+
hasLastConnectionEnded: l
|
|
2441
|
+
}), [g, w, i, l]);
|
|
2442
|
+
return /* @__PURE__ */ v(Oe.Provider, { value: b, children: n });
|
|
2443
|
+
}, Pn = () => {
|
|
2444
|
+
const n = G(Oe);
|
|
2445
|
+
if (!n)
|
|
1525
2446
|
throw new Error("useApiWebSocket must be used within a ApiWebSocketProvider");
|
|
1526
|
-
return
|
|
1527
|
-
},
|
|
1528
|
-
const
|
|
2447
|
+
return n;
|
|
2448
|
+
}, $e = 50, cn = () => {
|
|
2449
|
+
const n = j.c(22), {
|
|
1529
2450
|
texts: e
|
|
1530
|
-
} =
|
|
1531
|
-
confirm:
|
|
2451
|
+
} = G(fe), {
|
|
2452
|
+
confirm: t
|
|
1532
2453
|
} = e, {
|
|
1533
|
-
onConfirm:
|
|
1534
|
-
onCancel:
|
|
1535
|
-
text:
|
|
1536
|
-
show:
|
|
2454
|
+
onConfirm: o,
|
|
2455
|
+
onCancel: s,
|
|
2456
|
+
text: r,
|
|
2457
|
+
show: i,
|
|
1537
2458
|
textSm: c
|
|
1538
|
-
} =
|
|
2459
|
+
} = Je(), l = c === void 0 ? r.length > $e : c, h = r.length > $e;
|
|
1539
2460
|
let u;
|
|
1540
|
-
|
|
1541
|
-
if (
|
|
1542
|
-
e: switch (
|
|
2461
|
+
n[0] !== s || n[1] !== o || n[2] !== i ? (u = (_) => {
|
|
2462
|
+
if (i)
|
|
2463
|
+
e: switch (_.key) {
|
|
1543
2464
|
case "Enter": {
|
|
1544
|
-
|
|
2465
|
+
_.preventDefault(), _.stopPropagation(), o();
|
|
1545
2466
|
break e;
|
|
1546
2467
|
}
|
|
1547
2468
|
case "Escape": {
|
|
1548
|
-
|
|
2469
|
+
_.preventDefault(), _.stopPropagation(), s();
|
|
1549
2470
|
break e;
|
|
1550
2471
|
}
|
|
1551
2472
|
}
|
|
1552
|
-
},
|
|
2473
|
+
}, n[0] = s, n[1] = o, n[2] = i, n[3] = u) : u = n[3], Ye(u);
|
|
1553
2474
|
const f = h ? void 0 : "sm";
|
|
1554
2475
|
let g;
|
|
1555
|
-
|
|
2476
|
+
n[4] !== l || n[5] !== r ? (g = /* @__PURE__ */ v(q.Header, { className: "justify-content-center", children: l ? /* @__PURE__ */ v(Le, { variant: "body", children: r }) : /* @__PURE__ */ v(q.Title, { children: r }) }), n[4] = l, n[5] = r, n[6] = g) : g = n[6];
|
|
1556
2477
|
let w;
|
|
1557
|
-
|
|
2478
|
+
n[7] !== t.no || n[8] !== s ? (w = /* @__PURE__ */ v(ue, { type: "button", variant: "outlined", color: "secondary", className: "w-100", onClick: s, children: t.no }), n[7] = t.no, n[8] = s, n[9] = w) : w = n[9];
|
|
1558
2479
|
let b;
|
|
1559
|
-
|
|
2480
|
+
n[10] !== t.yes || n[11] !== o ? (b = /* @__PURE__ */ v(ue, { type: "button", color: "primary", onClick: o, className: "w-100 ml", children: t.yes }), n[10] = t.yes, n[11] = o, n[12] = b) : b = n[12];
|
|
1560
2481
|
let d;
|
|
1561
|
-
|
|
2482
|
+
n[13] !== w || n[14] !== b ? (d = /* @__PURE__ */ v(q.Body, { children: /* @__PURE__ */ A("div", { className: "w-100 d-flex gap-5", children: [
|
|
1562
2483
|
w,
|
|
1563
2484
|
b
|
|
1564
|
-
] }) }),
|
|
2485
|
+
] }) }), n[13] = w, n[14] = b, n[15] = d) : d = n[15];
|
|
1565
2486
|
let S;
|
|
1566
|
-
return
|
|
2487
|
+
return n[16] !== s || n[17] !== i || n[18] !== f || n[19] !== g || n[20] !== d ? (S = /* @__PURE__ */ A(q, { show: i, size: f, centered: !0, onHide: s, children: [
|
|
1567
2488
|
g,
|
|
1568
2489
|
d
|
|
1569
|
-
] }),
|
|
2490
|
+
] }), n[16] = s, n[17] = i, n[18] = f, n[19] = g, n[20] = d, n[21] = S) : S = n[21], S;
|
|
1570
2491
|
};
|
|
1571
2492
|
export {
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
2493
|
+
Oe as ApiWebSocketContext,
|
|
2494
|
+
In as ApiWebSocketProvider,
|
|
2495
|
+
be as AuthContext,
|
|
2496
|
+
vn as AuthProvider,
|
|
2497
|
+
Me as DelegationContext,
|
|
2498
|
+
kn as DelegationProvider,
|
|
2499
|
+
Rn as FormDisabledContext,
|
|
2500
|
+
$n as FormDisabledProvider,
|
|
2501
|
+
ct as HelmetContext,
|
|
2502
|
+
En as HelmetProvider,
|
|
2503
|
+
ze as LoadingContext,
|
|
2504
|
+
yn as LoadingProvider,
|
|
2505
|
+
fe as LuminusComponentsContext,
|
|
2506
|
+
bn as LuminusComponentsProvider,
|
|
2507
|
+
We as UserContext,
|
|
2508
|
+
Cn as UserProvider,
|
|
2509
|
+
Pn as useApiWebSocketContext,
|
|
2510
|
+
An as useFormDisabledContext
|
|
1590
2511
|
};
|