rc-lib-ui 1.1.49 → 1.1.53
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.
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { UseRequestSocketOptions } from './useRequestSocketApi.types';
|
|
2
2
|
import { BasePayloadSocket } from '../../SocketApi.types';
|
|
3
3
|
export declare const useRequestSocketApi: <P extends BasePayloadSocket, Data extends BasePayloadSocket>(payload: P, options?: UseRequestSocketOptions<Data>) => {
|
|
4
|
+
refetch: () => Promise<void>;
|
|
5
|
+
abort: () => void;
|
|
4
6
|
data: Data | null;
|
|
5
|
-
error:
|
|
7
|
+
error: string;
|
|
6
8
|
isLoading: boolean;
|
|
7
9
|
isError: boolean;
|
|
8
10
|
isSuccess: boolean;
|
|
9
|
-
refetch: () => Promise<void>;
|
|
10
|
-
abort: () => void;
|
|
11
11
|
};
|
|
12
12
|
export declare const createRequestSocketApi: <P extends BasePayloadSocket, D extends BasePayloadSocket>(p: P, d?: UseRequestSocketOptions<D>) => {
|
|
13
|
+
refetch: () => Promise<void>;
|
|
14
|
+
abort: () => void;
|
|
13
15
|
data: D | null;
|
|
14
|
-
error:
|
|
16
|
+
error: string;
|
|
15
17
|
isLoading: boolean;
|
|
16
18
|
isError: boolean;
|
|
17
19
|
isSuccess: boolean;
|
|
18
|
-
refetch: () => Promise<void>;
|
|
19
|
-
abort: () => void;
|
|
20
20
|
};
|
package/dist/NetworkAndSocket/Socket/api/hooks/useRequestSocketApi/useRequestSocketApi.types.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ export interface UseRequestSocketOptions<Data = any> {
|
|
|
2
2
|
skip?: boolean;
|
|
3
3
|
timeout?: number;
|
|
4
4
|
onSuccess?: (data: Data) => void;
|
|
5
|
-
onError?: (error:
|
|
5
|
+
onError?: (error: string) => void;
|
|
6
6
|
}
|
|
7
7
|
export interface ResultUseRequestSocketApi<Data = any> {
|
|
8
8
|
data: Data | null;
|
|
9
|
-
error:
|
|
9
|
+
error: string;
|
|
10
10
|
isLoading: boolean;
|
|
11
11
|
isError: boolean;
|
|
12
12
|
isSuccess: boolean;
|
package/dist/socket.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import './socket.css';var
|
|
2
|
-
var
|
|
3
|
-
var r = (
|
|
4
|
-
import { jsx as
|
|
5
|
-
import k, { useState as
|
|
6
|
-
import { styled as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
1
|
+
import './socket.css';var j = Object.defineProperty;
|
|
2
|
+
var J = (n, t, e) => t in n ? j(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var r = (n, t, e) => J(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { jsx as D } from "react/jsx-runtime";
|
|
5
|
+
import k, { useState as z, useRef as x, useCallback as N, useEffect as O } from "react";
|
|
6
|
+
import { styled as M, Collapse as G } from "@mui/material";
|
|
7
|
+
import W from "classnames";
|
|
8
|
+
const B = (n) => {
|
|
9
9
|
let t;
|
|
10
|
-
const e = /* @__PURE__ */ new Set(),
|
|
10
|
+
const e = /* @__PURE__ */ new Set(), o = (u, h) => {
|
|
11
11
|
const f = typeof u == "function" ? u(t) : u;
|
|
12
12
|
if (!Object.is(f, t)) {
|
|
13
|
-
const
|
|
14
|
-
t = h ?? (typeof f != "object" || f === null) ? f : Object.assign({}, t, f), e.forEach((
|
|
13
|
+
const v = t;
|
|
14
|
+
t = h ?? (typeof f != "object" || f === null) ? f : Object.assign({}, t, f), e.forEach((b) => b(t, v));
|
|
15
15
|
}
|
|
16
|
-
}, i = () => t,
|
|
17
|
-
return
|
|
18
|
-
},
|
|
19
|
-
function
|
|
16
|
+
}, i = () => t, a = { setState: o, getState: i, getInitialState: () => S, subscribe: (u) => (e.add(u), () => e.delete(u)) }, S = t = n(o, i, a);
|
|
17
|
+
return a;
|
|
18
|
+
}, $ = (n) => n ? B(n) : B, V = (n) => n;
|
|
19
|
+
function K(n, t = V) {
|
|
20
20
|
const e = k.useSyncExternalStore(
|
|
21
|
-
|
|
22
|
-
k.useCallback(() => t(
|
|
23
|
-
k.useCallback(() => t(
|
|
21
|
+
n.subscribe,
|
|
22
|
+
k.useCallback(() => t(n.getState()), [n, t]),
|
|
23
|
+
k.useCallback(() => t(n.getInitialState()), [n, t])
|
|
24
24
|
);
|
|
25
25
|
return k.useDebugValue(e), e;
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
const t =
|
|
27
|
+
const T = (n) => {
|
|
28
|
+
const t = $(n), e = (o) => K(t, o);
|
|
29
29
|
return Object.assign(e, t), e;
|
|
30
|
-
},
|
|
30
|
+
}, Q = (n) => n ? T(n) : T, U = {
|
|
31
31
|
statusConnect: "disconnect",
|
|
32
32
|
isOfflineSocket: !1,
|
|
33
33
|
//Текущее состояние сокета. Зависит от события timeOffReConnect и если задаёться isDisableConnectSocket: true
|
|
@@ -39,31 +39,31 @@ const W = (o) => {
|
|
|
39
39
|
isSelectOffline: !1
|
|
40
40
|
//Для того что бы 2й раз окно не показывать
|
|
41
41
|
}
|
|
42
|
-
},
|
|
43
|
-
resetState: () => w.setState(
|
|
44
|
-
setStatusConnectSocket: ({ statusConnect:
|
|
45
|
-
setStatusIsReConnectSocket: ({ isReConnectSocket:
|
|
46
|
-
setStatusReady: ({ isReadySocket:
|
|
47
|
-
setIsOfflineSocket: ({ isOfflineSocket:
|
|
48
|
-
setInfoNoConnectServer: (
|
|
49
|
-
setIsDisableConnectSocket: ({ isDisableConnectSocket:
|
|
50
|
-
},
|
|
51
|
-
getStatusConnectSocket: (
|
|
52
|
-
getStatusIsReConnectSocket: (
|
|
53
|
-
getStatusReady: (
|
|
54
|
-
getIsOfflineSocket: (
|
|
55
|
-
getInfoNoConnectServer: (
|
|
56
|
-
getIsDisableConnectSocket: (
|
|
57
|
-
},
|
|
42
|
+
}, X = JSON.parse(JSON.stringify(U)), w = Q(() => U), p = {
|
|
43
|
+
resetState: () => w.setState(X),
|
|
44
|
+
setStatusConnectSocket: ({ statusConnect: n }) => w.setState({ statusConnect: n }),
|
|
45
|
+
setStatusIsReConnectSocket: ({ isReConnectSocket: n }) => w.setState({ isReConnectSocket: n }),
|
|
46
|
+
setStatusReady: ({ isReadySocket: n }) => w.setState({ isReadySocket: n }),
|
|
47
|
+
setIsOfflineSocket: ({ isOfflineSocket: n }) => w.setState({ isOfflineSocket: n }),
|
|
48
|
+
setInfoNoConnectServer: (n) => w.setState((t) => ({ infoNoConnectServer: { ...t.infoNoConnectServer, ...n } })),
|
|
49
|
+
setIsDisableConnectSocket: ({ isDisableConnectSocket: n }) => w.setState({ isDisableConnectSocket: n })
|
|
50
|
+
}, R = {
|
|
51
|
+
getStatusConnectSocket: (n) => n.statusConnect,
|
|
52
|
+
getStatusIsReConnectSocket: (n) => n.isReConnectSocket,
|
|
53
|
+
getStatusReady: (n) => n.isReadySocket,
|
|
54
|
+
getIsOfflineSocket: (n) => n.isOfflineSocket,
|
|
55
|
+
getInfoNoConnectServer: (n) => n.infoNoConnectServer,
|
|
56
|
+
getIsDisableConnectSocket: (n) => n.isDisableConnectSocket
|
|
57
|
+
}, m = (n) => w(n), Y = M("span")({
|
|
58
58
|
backgroundColor: "rgba(0,0,0,0.3)",
|
|
59
59
|
color: "#fff",
|
|
60
60
|
display: "flex",
|
|
61
61
|
alignItems: "center",
|
|
62
62
|
padding: "1px 10px",
|
|
63
63
|
borderRadius: "3px 3px 3px 3px"
|
|
64
|
-
}),
|
|
65
|
-
({ children:
|
|
66
|
-
)(({ theme:
|
|
64
|
+
}), P = M(
|
|
65
|
+
({ children: n, ...t }) => /* @__PURE__ */ D(G, { ...t, unmountOnExit: !0, children: /* @__PURE__ */ D(Y, { children: n }) })
|
|
66
|
+
)(({ theme: n }) => ({
|
|
67
67
|
fontSize: 10,
|
|
68
68
|
position: "absolute",
|
|
69
69
|
left: 0,
|
|
@@ -79,14 +79,14 @@ const W = (o) => {
|
|
|
79
79
|
color: "#151616",
|
|
80
80
|
letterSpacing: 1
|
|
81
81
|
}
|
|
82
|
-
})),
|
|
82
|
+
})), Z = "_connect-server-anim_1lp7f_1", _ = "_loading-stripes_1lp7f_1", tt = {
|
|
83
83
|
"connect-server-anim": "_connect-server-anim_1lp7f_1",
|
|
84
|
-
connectServerAnim:
|
|
84
|
+
connectServerAnim: Z,
|
|
85
85
|
"loading-stripes": "_loading-stripes_1lp7f_1",
|
|
86
|
-
loadingStripes:
|
|
87
|
-
},
|
|
88
|
-
shouldForwardProp: (
|
|
89
|
-
})(({ theme:
|
|
86
|
+
loadingStripes: _
|
|
87
|
+
}, et = M(P, {
|
|
88
|
+
shouldForwardProp: (n) => ![""].includes(n)
|
|
89
|
+
})(({ theme: n }) => ({
|
|
90
90
|
top: "100%",
|
|
91
91
|
"& .MuiCollapse-wrapper": {
|
|
92
92
|
height: 10
|
|
@@ -94,58 +94,58 @@ const W = (o) => {
|
|
|
94
94
|
"& span": {
|
|
95
95
|
height: "100%"
|
|
96
96
|
}
|
|
97
|
-
})),
|
|
98
|
-
const i =
|
|
99
|
-
return /* @__PURE__ */
|
|
100
|
-
|
|
97
|
+
})), st = ({ text: n = "Происходит подключение к серверу", className: t, ...e }) => {
|
|
98
|
+
const i = m(R.getStatusConnectSocket) === "pending";
|
|
99
|
+
return /* @__PURE__ */ D(
|
|
100
|
+
et,
|
|
101
101
|
{
|
|
102
102
|
in: i,
|
|
103
103
|
collapsedSize: "1px",
|
|
104
|
-
className:
|
|
104
|
+
className: W(tt["connect-server-anim"], t),
|
|
105
105
|
unmountOnExit: !0,
|
|
106
106
|
...e,
|
|
107
|
-
children:
|
|
107
|
+
children: n
|
|
108
108
|
}
|
|
109
109
|
);
|
|
110
|
-
},
|
|
111
|
-
function
|
|
112
|
-
return
|
|
110
|
+
}, nt = k.memo(st), ot = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
111
|
+
function it(n) {
|
|
112
|
+
return ot.test(n);
|
|
113
113
|
}
|
|
114
114
|
function L() {
|
|
115
|
-
var
|
|
116
|
-
return URL.revokeObjectURL(
|
|
115
|
+
var n = URL.createObjectURL(new Blob()), t = n.toString();
|
|
116
|
+
return URL.revokeObjectURL(n), t.split(/[:\/]/g).pop().toLowerCase();
|
|
117
117
|
}
|
|
118
|
-
L.valid =
|
|
119
|
-
class
|
|
118
|
+
L.valid = it;
|
|
119
|
+
class rt {
|
|
120
120
|
constructor() {
|
|
121
121
|
r(this, "defaultProps", {
|
|
122
122
|
interval: 5e3
|
|
123
123
|
});
|
|
124
124
|
r(this, "startActionEvery", (t, e = this.defaultProps) => {
|
|
125
|
-
const
|
|
125
|
+
const o = (f) => {
|
|
126
126
|
e != null && e.watchIdInterval && (e == null || e.watchIdInterval(f));
|
|
127
127
|
}, i = (f) => {
|
|
128
128
|
e != null && e.controlAction && (e == null || e.controlAction(f));
|
|
129
129
|
};
|
|
130
|
-
let c = !0,
|
|
130
|
+
let c = !0, l, a, S;
|
|
131
131
|
const u = (f = !0) => {
|
|
132
|
-
const
|
|
133
|
-
c = !1, clearInterval(
|
|
132
|
+
const v = "Ручное завершение startActionEvery";
|
|
133
|
+
c = !1, clearInterval(l), o(null), f ? a && a({ status: f, msg: v + ": (true)" }) : S && S({ status: f, msg: v + ": (false)" });
|
|
134
134
|
};
|
|
135
135
|
return {
|
|
136
|
-
promise: new Promise((f,
|
|
137
|
-
|
|
138
|
-
let
|
|
139
|
-
|
|
136
|
+
promise: new Promise((f, v) => {
|
|
137
|
+
a = f, S = v;
|
|
138
|
+
let b = 0, d = 0;
|
|
139
|
+
l = setInterval(
|
|
140
140
|
() => {
|
|
141
|
-
if (
|
|
142
|
-
c = !1, clearInterval(
|
|
141
|
+
if (b += e.interval, d += 1, e != null && e.cutoffTime && b > e.cutoffTime || e != null && e.countAction && (e == null ? void 0 : e.countAction) < d) {
|
|
142
|
+
c = !1, clearInterval(l), o(null), v({ status: !1, msg: Error("Время загрузки истекло") });
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
t() && (c = !1, clearInterval(
|
|
145
|
+
t() && (c = !1, clearInterval(l), o(null), f({ status: !0, msg: "cb вернул true" }));
|
|
146
146
|
},
|
|
147
147
|
e.interval < 200 ? 200 : e.interval
|
|
148
|
-
),
|
|
148
|
+
), o(l), i({
|
|
149
149
|
getIsActiveEvent: () => c,
|
|
150
150
|
stop: u
|
|
151
151
|
});
|
|
@@ -153,51 +153,51 @@ class at {
|
|
|
153
153
|
stop: u
|
|
154
154
|
};
|
|
155
155
|
});
|
|
156
|
-
r(this, "oneOf", (t, e, { second:
|
|
156
|
+
r(this, "oneOf", (t, e, { second: o }) => {
|
|
157
157
|
let i = 1;
|
|
158
158
|
t().then(() => {
|
|
159
159
|
i === 1 && (i = 0);
|
|
160
160
|
});
|
|
161
161
|
let c = setInterval(() => {
|
|
162
162
|
i === 1 && e(), clearInterval(c);
|
|
163
|
-
},
|
|
163
|
+
}, o * 1e3);
|
|
164
164
|
});
|
|
165
|
-
r(this, "oneOfPromise", (t, e, { second:
|
|
166
|
-
let
|
|
165
|
+
r(this, "oneOfPromise", (t, e, { second: o }) => new Promise((i, c) => {
|
|
166
|
+
let l = 1, a = { status: !1, msg: "" };
|
|
167
167
|
t().then((u) => {
|
|
168
|
-
|
|
168
|
+
l === 1 && (l = 0, i(u));
|
|
169
169
|
}).catch((u) => {
|
|
170
|
-
|
|
170
|
+
l === 1 && (l = 0, a.msg = u, c(u));
|
|
171
171
|
});
|
|
172
172
|
let S = setInterval(() => {
|
|
173
|
-
if (
|
|
174
|
-
if (
|
|
175
|
-
c({ status: !1, msg: "", ...e(
|
|
173
|
+
if (l === 1) {
|
|
174
|
+
if (l = 0, typeof e == "function") {
|
|
175
|
+
c({ status: !1, msg: "", ...e(a) });
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
178
|
c({ status: !1, msg: "oneOfPromise reject" });
|
|
179
179
|
}
|
|
180
180
|
clearInterval(S);
|
|
181
|
-
},
|
|
181
|
+
}, o * 1e3);
|
|
182
182
|
}));
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
class
|
|
185
|
+
class F {
|
|
186
186
|
constructor(t) {
|
|
187
187
|
r(this, "subscribersEvents", {});
|
|
188
188
|
r(this, "getListNameEvents", () => Object.keys(this.subscribersEvents));
|
|
189
189
|
r(this, "getSubscribers", () => this.subscribersEvents);
|
|
190
190
|
r(this, "subscribe", (t, e) => {
|
|
191
|
-
var
|
|
192
|
-
(
|
|
191
|
+
var o;
|
|
192
|
+
(o = this.subscribersEvents[t]) == null || o.push(e);
|
|
193
193
|
});
|
|
194
194
|
r(this, "unsubscribe", (t, e) => {
|
|
195
|
-
var
|
|
196
|
-
this.subscribersEvents[t] && (this.subscribersEvents[t] = (
|
|
195
|
+
var o;
|
|
196
|
+
this.subscribersEvents[t] && (this.subscribersEvents[t] = (o = this.subscribersEvents[t]) == null ? void 0 : o.filter((i) => i !== e));
|
|
197
197
|
});
|
|
198
198
|
r(this, "publish", (t, e) => {
|
|
199
|
-
var
|
|
200
|
-
this.subscribersEvents[t] && ((
|
|
199
|
+
var o;
|
|
200
|
+
this.subscribersEvents[t] && ((o = this.subscribersEvents[t]) == null || o.forEach((i) => {
|
|
201
201
|
i(e);
|
|
202
202
|
}));
|
|
203
203
|
});
|
|
@@ -211,7 +211,7 @@ class H {
|
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
class
|
|
214
|
+
class ct {
|
|
215
215
|
constructor(t) {
|
|
216
216
|
r(this, "networkInfo");
|
|
217
217
|
r(this, "listUrls", []);
|
|
@@ -221,7 +221,7 @@ class lt {
|
|
|
221
221
|
checkIntervalId: null
|
|
222
222
|
});
|
|
223
223
|
r(this, "getIsNetwork", (t) => !["unknown", "none"].includes(t));
|
|
224
|
-
r(this, "getTypeNetwork", (
|
|
224
|
+
r(this, "getTypeNetwork", (t, e) => e || e === null ? "4g" : "none");
|
|
225
225
|
/*-----------------------------------------------------------------------------*/
|
|
226
226
|
r(this, "controllersEvents", {
|
|
227
227
|
online: null,
|
|
@@ -246,26 +246,16 @@ class lt {
|
|
|
246
246
|
getState() {
|
|
247
247
|
return this.state;
|
|
248
248
|
}
|
|
249
|
-
// private getFetchOptions = (controller: AbortController) => ({
|
|
250
|
-
// method: 'HEAD',
|
|
251
|
-
// cache: 'no-store',
|
|
252
|
-
// signal: controller.signal,
|
|
253
|
-
// headers: {
|
|
254
|
-
// 'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
255
|
-
// 'Pragma': 'no-cache',
|
|
256
|
-
// 'Expires': '0'
|
|
257
|
-
// }
|
|
258
|
-
// } as const);
|
|
259
249
|
getConnection() {
|
|
260
250
|
var t;
|
|
261
251
|
return (t = window == null ? void 0 : window.navigator) == null ? void 0 : t.connection;
|
|
262
252
|
}
|
|
263
253
|
updateState(t, e) {
|
|
264
|
-
const
|
|
254
|
+
const o = {
|
|
265
255
|
isNetwork: t,
|
|
266
256
|
typeNetwork: this.getTypeNetwork(this.getConnection(), t)
|
|
267
257
|
};
|
|
268
|
-
this.networkInfo =
|
|
258
|
+
this.networkInfo = o, typeof e == "function" && e(o);
|
|
269
259
|
}
|
|
270
260
|
getControllersEvents() {
|
|
271
261
|
return this.controllersEvents;
|
|
@@ -274,45 +264,45 @@ class lt {
|
|
|
274
264
|
this.controllersEvents = { ...this.controllersEvents, ...t };
|
|
275
265
|
}
|
|
276
266
|
startEvents(t) {
|
|
277
|
-
var
|
|
267
|
+
var a, S, u, h;
|
|
278
268
|
const { isActiveEvents: e } = this.getState();
|
|
279
269
|
if (e)
|
|
280
270
|
return;
|
|
281
271
|
this.setState({ isActiveEvents: !0 });
|
|
282
|
-
const
|
|
272
|
+
const o = {
|
|
283
273
|
online: new AbortController(),
|
|
284
274
|
offline: new AbortController(),
|
|
285
275
|
change: new AbortController()
|
|
286
276
|
};
|
|
287
|
-
this.setControllersEvents(
|
|
288
|
-
const i = this.getConnection(), c = this.getTypeNetwork(i, window.navigator.onLine),
|
|
289
|
-
this.updateState(
|
|
277
|
+
this.setControllersEvents(o);
|
|
278
|
+
const i = this.getConnection(), c = this.getTypeNetwork(i, window.navigator.onLine), l = this.getIsNetwork(c);
|
|
279
|
+
this.updateState(l, t), window.addEventListener("online", () => {
|
|
290
280
|
this.updateState(!0, t);
|
|
291
|
-
}, { signal: (
|
|
281
|
+
}, { signal: (a = o.online) == null ? void 0 : a.signal }), window.addEventListener("offline", () => {
|
|
292
282
|
this.updateState(!1, t);
|
|
293
|
-
}, { signal: (S =
|
|
294
|
-
const f = this.getConnection(),
|
|
295
|
-
this.updateState(
|
|
296
|
-
}, { signal: (h =
|
|
283
|
+
}, { signal: (S = o.offline) == null ? void 0 : S.signal }), (u = this.getConnection()) != null && u.addEventListener && this.getConnection().addEventListener("change", () => {
|
|
284
|
+
const f = this.getConnection(), v = this.getTypeNetwork(f, null), b = this.getIsNetwork(v);
|
|
285
|
+
this.updateState(b, t);
|
|
286
|
+
}, { signal: (h = o.change) == null ? void 0 : h.signal });
|
|
297
287
|
}
|
|
298
288
|
stopEvents() {
|
|
299
289
|
const { isActiveEvents: t } = this.getState();
|
|
300
290
|
if (t) {
|
|
301
291
|
this.setState({ isActiveEvents: !1 });
|
|
302
292
|
const e = this.getControllersEvents();
|
|
303
|
-
for (const
|
|
304
|
-
|
|
293
|
+
for (const o of Object.values(e))
|
|
294
|
+
o == null || o.abort();
|
|
305
295
|
}
|
|
306
296
|
}
|
|
307
297
|
/*-----------------------------------------------------------------------------*/
|
|
308
298
|
async requestByUrls(t, e) {
|
|
309
|
-
const
|
|
310
|
-
this.updateState(
|
|
299
|
+
const o = await this.checkConnection(e);
|
|
300
|
+
this.updateState(o, t);
|
|
311
301
|
}
|
|
312
302
|
async checkConnection(t = {}) {
|
|
313
303
|
for (const e of this.listUrls)
|
|
314
304
|
try {
|
|
315
|
-
const
|
|
305
|
+
const o = new AbortController(), i = setTimeout(() => o.abort(), (t == null ? void 0 : t.timeout) || 5e3), c = await window.fetch(e);
|
|
316
306
|
if (clearTimeout(i), c.status >= 200 && c.status < 400)
|
|
317
307
|
return !0;
|
|
318
308
|
} catch {
|
|
@@ -327,8 +317,8 @@ class lt {
|
|
|
327
317
|
this.controllersFetching = { ...this.controllersFetching, ...t };
|
|
328
318
|
}
|
|
329
319
|
startFetching(t, { interval: e = 5e3 }) {
|
|
330
|
-
const { isMonitoring:
|
|
331
|
-
if (
|
|
320
|
+
const { isMonitoring: o } = this.getState();
|
|
321
|
+
if (o)
|
|
332
322
|
return;
|
|
333
323
|
this.setState({ isMonitoring: !0 });
|
|
334
324
|
const i = {
|
|
@@ -343,8 +333,8 @@ class lt {
|
|
|
343
333
|
stopFetching() {
|
|
344
334
|
const { isMonitoring: t, checkIntervalId: e } = this.getState();
|
|
345
335
|
if (!t) return;
|
|
346
|
-
const
|
|
347
|
-
for (const i of Object.values(
|
|
336
|
+
const o = this.getControllersMonitoring();
|
|
337
|
+
for (const i of Object.values(o))
|
|
348
338
|
i == null || i.abort();
|
|
349
339
|
e && clearInterval(e), this.setState({ isMonitoring: !1, checkIntervalId: null });
|
|
350
340
|
}
|
|
@@ -362,7 +352,7 @@ class lt {
|
|
|
362
352
|
return this.networkInfo;
|
|
363
353
|
}
|
|
364
354
|
}
|
|
365
|
-
class
|
|
355
|
+
class at {
|
|
366
356
|
constructor() {
|
|
367
357
|
r(this, "options", {
|
|
368
358
|
timeReConnect: 5e3,
|
|
@@ -375,10 +365,10 @@ class ut {
|
|
|
375
365
|
arrSaveReq: []
|
|
376
366
|
});
|
|
377
367
|
r(this, "initOptions", !1);
|
|
378
|
-
r(this, "events", new
|
|
368
|
+
r(this, "events", new F(["status", "msg", "error"]));
|
|
379
369
|
r(this, "stateDefault", this.copyState(this.state));
|
|
380
370
|
r(this, "eventListener", (t) => {
|
|
381
|
-
var
|
|
371
|
+
var o, i;
|
|
382
372
|
const e = [
|
|
383
373
|
["open", this.openHandler],
|
|
384
374
|
["close", this.closeHandler],
|
|
@@ -386,8 +376,8 @@ class ut {
|
|
|
386
376
|
["error", this.errHandler]
|
|
387
377
|
];
|
|
388
378
|
for (let c = 0; c < e.length; c++) {
|
|
389
|
-
const [
|
|
390
|
-
t === "add" ? (
|
|
379
|
+
const [l, a] = e[c];
|
|
380
|
+
t === "add" ? (o = this.state.ws) == null || o.addEventListener(l, a) : (i = this.state.ws) == null || i.removeEventListener(l, a);
|
|
391
381
|
}
|
|
392
382
|
});
|
|
393
383
|
r(this, "openHandler", () => {
|
|
@@ -399,13 +389,13 @@ class ut {
|
|
|
399
389
|
r(this, "msgHandler", (t) => {
|
|
400
390
|
const e = JSON.parse(t.data ? t.data : "{}");
|
|
401
391
|
try {
|
|
402
|
-
const { action:
|
|
392
|
+
const { action: o } = e, i = this.findDataRequestByAction(o);
|
|
403
393
|
if (i) {
|
|
404
|
-
const { cb: c, ...
|
|
405
|
-
this.events.publish("msg", { ...e, request: { ...S, ...
|
|
394
|
+
const { cb: c, ...l } = i, { payload: a, ...S } = l;
|
|
395
|
+
this.events.publish("msg", { ...e, request: { ...S, ...a } });
|
|
406
396
|
} else
|
|
407
397
|
this.events.publish("msg", e);
|
|
408
|
-
|
|
398
|
+
o && this.filterSaveItemsByResponse(e);
|
|
409
399
|
} catch {
|
|
410
400
|
this.events.publish("msg", {});
|
|
411
401
|
}
|
|
@@ -451,12 +441,12 @@ class ut {
|
|
|
451
441
|
return JSON.parse(JSON.stringify(t));
|
|
452
442
|
}
|
|
453
443
|
filterSaveItemsByResponse(t) {
|
|
454
|
-
const e = this.getRequestSave(),
|
|
444
|
+
const e = this.getRequestSave(), o = [];
|
|
455
445
|
for (let i = 0; i < e.length; i++) {
|
|
456
446
|
const c = e[i];
|
|
457
|
-
c.payload.action !== t.action ?
|
|
447
|
+
c.payload.action !== t.action ? o.push(c) : c.cb && c.cb(t);
|
|
458
448
|
}
|
|
459
|
-
this.state.arrSaveReq =
|
|
449
|
+
this.state.arrSaveReq = o;
|
|
460
450
|
}
|
|
461
451
|
connect() {
|
|
462
452
|
this.initOptions && (this.close(), this.setState({
|
|
@@ -471,21 +461,21 @@ class ut {
|
|
|
471
461
|
this.close(), this.setStatus("disconnect"), this.resetState(), this.events.resetSubscribers();
|
|
472
462
|
}
|
|
473
463
|
send(t) {
|
|
474
|
-
var
|
|
464
|
+
var o;
|
|
475
465
|
const e = JSON.stringify(t);
|
|
476
|
-
(
|
|
466
|
+
(o = this.state.ws) == null || o.send(e);
|
|
477
467
|
}
|
|
478
468
|
setRequestSave(t) {
|
|
479
469
|
if ("action" in t.payload) {
|
|
480
|
-
const e = this.state.arrSaveReq.findIndex((
|
|
470
|
+
const e = this.state.arrSaveReq.findIndex((o) => o.payload.action === t.payload.action);
|
|
481
471
|
~e ? this.state.arrSaveReq[e] = t : this.state.arrSaveReq.push(t);
|
|
482
472
|
}
|
|
483
473
|
}
|
|
484
474
|
//INFO: Запросов может быть несколько. И время запроса разное
|
|
485
475
|
getItemsRequestSaveByAction(t) {
|
|
486
476
|
return this.getRequestSave().filter((e) => {
|
|
487
|
-
var
|
|
488
|
-
return ((
|
|
477
|
+
var o;
|
|
478
|
+
return ((o = e == null ? void 0 : e.payload) == null ? void 0 : o.action) === t;
|
|
489
479
|
});
|
|
490
480
|
}
|
|
491
481
|
}
|
|
@@ -512,16 +502,16 @@ const s = class s {
|
|
|
512
502
|
s.state.isDisconnect || (s.setState({ isDisconnect: !0 }), console.log("DISCONNECT WS"), s.wsApi.disconnect(), s.resetState(), s.events.resetSubscribers());
|
|
513
503
|
}
|
|
514
504
|
static send(t, e) {
|
|
515
|
-
const { action:
|
|
505
|
+
const { action: o, ...i } = t, c = i != null && i.request_id ? i.request_id : L(), l = Date.now();
|
|
516
506
|
s.wsApi.setRequestSave({
|
|
517
|
-
requestAction:
|
|
507
|
+
requestAction: o,
|
|
518
508
|
request_id: c,
|
|
519
|
-
requestTime:
|
|
520
|
-
payload: { action:
|
|
509
|
+
requestTime: l,
|
|
510
|
+
payload: { action: o, ...i },
|
|
521
511
|
cb: e
|
|
522
512
|
});
|
|
523
|
-
const
|
|
524
|
-
if (!
|
|
513
|
+
const a = s.wsApi.getSocket();
|
|
514
|
+
if (!a || a.readyState !== 1) {
|
|
525
515
|
console.log("Нет подключения к сокету. Запрос сохранён в setRequestSave");
|
|
526
516
|
return;
|
|
527
517
|
}
|
|
@@ -531,41 +521,41 @@ const s = class s {
|
|
|
531
521
|
console.dir("функция stop не присвоена к stopReConnect");
|
|
532
522
|
}
|
|
533
523
|
static async request(t, e = {}) {
|
|
534
|
-
return new Promise((
|
|
535
|
-
var
|
|
536
|
-
if ((
|
|
524
|
+
return new Promise((o, i) => {
|
|
525
|
+
var d, y;
|
|
526
|
+
if ((d = e == null ? void 0 : e.signal) != null && d.aborted) {
|
|
537
527
|
i(new DOMException("Aborted", "AbortError"));
|
|
538
528
|
return;
|
|
539
529
|
}
|
|
540
|
-
const c = t.action,
|
|
530
|
+
const c = t.action, l = t.request_id ? t.request_id : L(), a = Date.now();
|
|
541
531
|
s.wsApi.setRequestSave({
|
|
542
532
|
requestAction: c,
|
|
543
|
-
request_id:
|
|
544
|
-
requestTime:
|
|
533
|
+
request_id: l,
|
|
534
|
+
requestTime: a,
|
|
545
535
|
payload: t,
|
|
546
536
|
cb: void 0
|
|
547
537
|
});
|
|
548
538
|
let S;
|
|
549
539
|
e != null && e.timeout && (S = setTimeout(() => {
|
|
550
|
-
|
|
540
|
+
v(), i(new Error("Request timeout"));
|
|
551
541
|
}, e.timeout));
|
|
552
|
-
const u = (
|
|
553
|
-
|
|
554
|
-
}, h = (
|
|
555
|
-
var
|
|
556
|
-
const
|
|
557
|
-
!
|
|
542
|
+
const u = (g) => {
|
|
543
|
+
v(), i(g);
|
|
544
|
+
}, h = (g) => {
|
|
545
|
+
var A;
|
|
546
|
+
const E = this.wsApi.findDataRequestByAction(c);
|
|
547
|
+
!E || ((A = g == null ? void 0 : g.request) == null ? void 0 : A.requestAction) !== E.requestAction || (v(), o({ ...g }));
|
|
558
548
|
}, f = () => {
|
|
559
|
-
|
|
560
|
-
},
|
|
561
|
-
var
|
|
562
|
-
s.off("msg", h), s.off("error", u), S && clearTimeout(S), (
|
|
549
|
+
v(), i(new DOMException("Aborted", "AbortError"));
|
|
550
|
+
}, v = () => {
|
|
551
|
+
var g;
|
|
552
|
+
s.off("msg", h), s.off("error", u), S && clearTimeout(S), (g = e == null ? void 0 : e.signal) == null || g.removeEventListener("abort", f);
|
|
563
553
|
};
|
|
564
|
-
s.on("msg", h), s.on("error", u), (
|
|
565
|
-
const
|
|
566
|
-
if (!
|
|
567
|
-
const
|
|
568
|
-
console.error(
|
|
554
|
+
s.on("msg", h), s.on("error", u), (y = e == null ? void 0 : e.signal) == null || y.addEventListener("abort", f);
|
|
555
|
+
const b = s.wsApi.getSocket();
|
|
556
|
+
if (!b || b.readyState !== 1) {
|
|
557
|
+
const g = "Нет подключения к сокету";
|
|
558
|
+
console.error(g), v(), i(new Error(g));
|
|
569
559
|
return;
|
|
570
560
|
}
|
|
571
561
|
s.wsApi.send(t);
|
|
@@ -582,8 +572,8 @@ r(s, "state", {
|
|
|
582
572
|
}), r(s, "options", {
|
|
583
573
|
isReConnectNetworkOnline: !1,
|
|
584
574
|
listUrlsCheckConnectNetwork: ["https://jsonplaceholder.typicode.com/posts/1"]
|
|
585
|
-
}), r(s, "wsApi", new
|
|
586
|
-
r(s, "networkTicker", null), r(s, "events", new
|
|
575
|
+
}), r(s, "wsApi", new at()), r(s, "delay", new rt()), // private static internetControl:NetworkControls | null = null
|
|
576
|
+
r(s, "networkTicker", null), r(s, "events", new F(["timeOffReConnect", "reConnect", "network"])), r(s, "saveID", {
|
|
587
577
|
idReConnect: null,
|
|
588
578
|
checkConnect: null
|
|
589
579
|
}), r(s, "stateDefault", s.copyState(s.state)), r(s, "setInfoConnect", (t) => {
|
|
@@ -594,9 +584,9 @@ r(s, "networkTicker", null), r(s, "events", new H(["timeOffReConnect", "reConnec
|
|
|
594
584
|
}), r(s, "offline", () => {
|
|
595
585
|
s.state.isActiveReConnect && s.stopReConnect(!1);
|
|
596
586
|
}), r(s, "splitOptions", (t) => Object.entries(t).reduce(
|
|
597
|
-
(e, [
|
|
587
|
+
(e, [o, i]) => {
|
|
598
588
|
const c = s.wsApi.getOptions();
|
|
599
|
-
return
|
|
589
|
+
return o in c ? { ...e, WsOptions: { ...e.WsOptions, [o]: i } } : { ...e, SocketApiOptions: { ...e.SocketApiOptions, [o]: i } };
|
|
600
590
|
},
|
|
601
591
|
{ WsOptions: {}, SocketApiOptions: {} }
|
|
602
592
|
)), /*---------------------------------------------------------------------------------------------------------------------------*/
|
|
@@ -610,10 +600,10 @@ r(s, "getState", () => s.state), r(s, "getOptions", () => ({ ...s.options, ...s.
|
|
|
610
600
|
r(s, "setNetworkStatus", (t) => {
|
|
611
601
|
s.events.publish("network", t), t.isNetwork ? s.online() : s.offline();
|
|
612
602
|
}), r(s, "init", (t) => {
|
|
613
|
-
const { WsOptions: e, SocketApiOptions:
|
|
614
|
-
s.networkTicker = new
|
|
603
|
+
const { WsOptions: e, SocketApiOptions: o } = s.splitOptions(t);
|
|
604
|
+
s.networkTicker = new ct(o.listUrlsCheckConnectNetwork ?? []), s.networkTicker.startEvents((i) => {
|
|
615
605
|
s.setNetworkStatus(i);
|
|
616
|
-
}), s.setOptions(
|
|
606
|
+
}), s.setOptions(o), s.wsApi.init(e), s.wsApi.events.subscribe("status", (i) => {
|
|
617
607
|
s.setState({ isOfflineSocket: i !== "ready" });
|
|
618
608
|
});
|
|
619
609
|
}), /*------------------------------------------------------------------------------------------------------*/
|
|
@@ -629,125 +619,162 @@ r(s, "socketReConnect", () => {
|
|
|
629
619
|
{
|
|
630
620
|
interval: t,
|
|
631
621
|
countAction: i,
|
|
632
|
-
watchIdInterval: (
|
|
633
|
-
s.saveID.idReConnect =
|
|
622
|
+
watchIdInterval: (l) => {
|
|
623
|
+
s.saveID.idReConnect = l;
|
|
634
624
|
},
|
|
635
|
-
controlAction: ({ stop:
|
|
636
|
-
s.stopReConnect =
|
|
625
|
+
controlAction: ({ stop: l, getIsActiveEvent: a }) => {
|
|
626
|
+
s.stopReConnect = l;
|
|
637
627
|
}
|
|
638
628
|
}
|
|
639
|
-
).promise.then((
|
|
640
|
-
s.setInfoConnect(
|
|
641
|
-
}).catch((
|
|
629
|
+
).promise.then((l) => {
|
|
630
|
+
s.setInfoConnect(l);
|
|
631
|
+
}).catch((l) => {
|
|
642
632
|
if (s.wsApi.getStatusSocket() === "ready") {
|
|
643
633
|
console.log("Сокет успел подключиться, игнорируем ошибку таймаута"), s.setInfoConnect({ status: !0, msg: "Подключено (восстановлено)" });
|
|
644
634
|
return;
|
|
645
635
|
}
|
|
646
|
-
s.setInfoConnect(
|
|
636
|
+
s.setInfoConnect(l);
|
|
647
637
|
});
|
|
648
638
|
}
|
|
649
639
|
});
|
|
650
|
-
let
|
|
651
|
-
const
|
|
652
|
-
const e =
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
640
|
+
let C = s;
|
|
641
|
+
const lt = (n, t = {}) => {
|
|
642
|
+
const e = n.action, { skip: o = !1, timeout: i = 5e3 } = t, [c, l] = z({
|
|
643
|
+
data: null,
|
|
644
|
+
error: "",
|
|
645
|
+
isLoading: !1,
|
|
646
|
+
isError: !1,
|
|
647
|
+
isSuccess: !1
|
|
648
|
+
}), a = m(R.getStatusReady), S = m(R.getStatusConnectSocket), u = x(null), h = x(t);
|
|
649
|
+
h.current = t;
|
|
650
|
+
const f = N(async () => {
|
|
651
|
+
var y, g, E, A;
|
|
652
|
+
if (o) return;
|
|
653
|
+
l((I) => ({
|
|
654
|
+
...I,
|
|
655
|
+
isLoading: !0,
|
|
656
|
+
isError: !1,
|
|
657
|
+
isSuccess: !1,
|
|
658
|
+
error: "",
|
|
659
|
+
data: null
|
|
660
|
+
})), u.current = new AbortController();
|
|
661
|
+
const d = u.current.signal;
|
|
656
662
|
try {
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
663
|
+
const I = await C.request(n, { timeout: i, signal: d });
|
|
664
|
+
if (d.aborted) return;
|
|
665
|
+
l((q) => ({
|
|
666
|
+
...q,
|
|
667
|
+
data: I,
|
|
668
|
+
isSuccess: !0,
|
|
669
|
+
isLoading: !1
|
|
670
|
+
})), (g = (y = h.current).onSuccess) == null || g.call(y, I);
|
|
671
|
+
} catch (I) {
|
|
672
|
+
if (d.aborted) return;
|
|
673
|
+
const q = I instanceof Error ? I.message : String(I);
|
|
674
|
+
l((H) => ({
|
|
675
|
+
...H,
|
|
676
|
+
error: q,
|
|
677
|
+
isError: !0,
|
|
678
|
+
isLoading: !1
|
|
679
|
+
})), (A = (E = h.current).onError) == null || A.call(E, q);
|
|
669
680
|
}
|
|
670
|
-
}, [
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
681
|
+
}, [o, e, n, i]);
|
|
682
|
+
O(() => (!o && a && f(), () => {
|
|
683
|
+
var d;
|
|
684
|
+
(d = u.current) == null || d.abort();
|
|
685
|
+
}), [f, o, a]), O(() => {
|
|
686
|
+
!a && S === "pending" && l((d) => ({
|
|
687
|
+
...d,
|
|
688
|
+
isError: !1,
|
|
689
|
+
isSuccess: !1,
|
|
690
|
+
error: "Потеряно соединение с сервером"
|
|
691
|
+
}));
|
|
692
|
+
}, [a, S]);
|
|
693
|
+
const v = N(() => {
|
|
694
|
+
var d;
|
|
695
|
+
return (d = u.current) == null || d.abort(), f();
|
|
696
|
+
}, [f]), b = N(() => {
|
|
697
|
+
var d;
|
|
698
|
+
(d = u.current) == null || d.abort(), l((y) => ({ ...y, isLoading: !1 }));
|
|
676
699
|
}, []);
|
|
677
|
-
return {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
700
|
+
return {
|
|
701
|
+
...c,
|
|
702
|
+
refetch: v,
|
|
703
|
+
abort: b
|
|
704
|
+
};
|
|
705
|
+
}, yt = (n, t) => lt(n, t), ut = (n) => {
|
|
706
|
+
const { isNetwork: t, typeNetwork: e } = n, { isModal: o } = m(R.getInfoNoConnectServer), i = m(R.getStatusIsReConnectSocket), c = m(R.getIsDisableConnectSocket), l = m(R.getStatusConnectSocket);
|
|
707
|
+
return O(() => (C.init(n.init), typeof n.onMount == "function" && n.onMount(), C.on("status", (a) => {
|
|
681
708
|
const S = w.getState(), { isReadySocket: u, infoNoConnectServer: { isModal: h }, isOfflineSocket: f } = S;
|
|
682
|
-
|
|
683
|
-
}),
|
|
684
|
-
console.log("error: ",
|
|
685
|
-
}),
|
|
686
|
-
console.log('on"reConnect" (status): ',
|
|
709
|
+
a !== "ready" && u && p.setStatusReady({ isReadySocket: !1 }), !u && a === "ready" && (p.setStatusReady({ isReadySocket: !0 }), h && f && (console.log("Вырубаем модалку т.к. сокет законектился после окончания timeOffReConnect"), p.setInfoNoConnectServer({ isModal: !1 }), p.setIsOfflineSocket({ isOfflineSocket: !1 }))), p.setStatusConnectSocket({ statusConnect: a });
|
|
710
|
+
}), C.on("error", (a) => {
|
|
711
|
+
console.log("error: ", a);
|
|
712
|
+
}), C.on("reConnect", (a) => {
|
|
713
|
+
console.log('on"reConnect" (status): ', a);
|
|
687
714
|
const S = w.getState(), { isReConnectSocket: u, infoNoConnectServer: { isModal: h } } = S;
|
|
688
|
-
u !==
|
|
689
|
-
}),
|
|
690
|
-
if (console.log("timeOffReConnect: ",
|
|
715
|
+
u !== a && p.setStatusIsReConnectSocket({ isReConnectSocket: a }), h && a && p.setInfoNoConnectServer({ isModal: !1 });
|
|
716
|
+
}), C.on("timeOffReConnect", (a) => {
|
|
717
|
+
if (console.log("timeOffReConnect: ", a), p.setIsOfflineSocket({ isOfflineSocket: !a.status }), !a.status) {
|
|
691
718
|
const S = w.getState(), { infoNoConnectServer: { isModal: u, isSelectOffline: h } } = S;
|
|
692
719
|
let f = !1;
|
|
693
720
|
!u && !h && (f = !0), f && p.setInfoNoConnectServer({ isModal: f });
|
|
694
721
|
}
|
|
695
|
-
}),
|
|
696
|
-
typeof
|
|
697
|
-
}), []),
|
|
698
|
-
t && !c && !
|
|
699
|
-
}, [c,
|
|
700
|
-
i && (!t ||
|
|
701
|
-
}, [i, t,
|
|
702
|
-
c && (console.log("isDisableConnectSocket: ", c), p.setIsOfflineSocket({ isOfflineSocket: !0 }),
|
|
722
|
+
}), C.connect(), () => {
|
|
723
|
+
typeof n.onUnmount == "function" && n.onUnmount(), console.dir("disconnect"), C.disconnect();
|
|
724
|
+
}), []), O(() => {
|
|
725
|
+
t && !c && !o && !i && ["close"].includes(l) && e !== "none" && (console.log("Запущен socketReConnect"), C.socketReConnect());
|
|
726
|
+
}, [c, o, i, l, e, t]), O(() => {
|
|
727
|
+
i && (!t || l === "ready") && (console.log("Запущен stopReConnect"), C.stopReConnect());
|
|
728
|
+
}, [i, t, l]), O(() => {
|
|
729
|
+
c && (console.log("isDisableConnectSocket: ", c), p.setIsOfflineSocket({ isOfflineSocket: !0 }), C.close());
|
|
703
730
|
}, [c]), null;
|
|
704
|
-
},
|
|
705
|
-
shouldForwardProp: (
|
|
706
|
-
})(({ theme:
|
|
731
|
+
}, ft = k.memo(ut), St = M(P, {
|
|
732
|
+
shouldForwardProp: (n) => ![""].includes(n)
|
|
733
|
+
})(({ theme: n }) => ({
|
|
707
734
|
bottom: "100%",
|
|
708
|
-
backgroundColor:
|
|
735
|
+
backgroundColor: n.palette.error.light,
|
|
709
736
|
backgroundImage: "linear-gradient(180deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, 0))",
|
|
710
737
|
"& .MuiCollapse-wrapper": {},
|
|
711
738
|
"& span": {
|
|
712
739
|
padding: "1px 10px"
|
|
713
740
|
}
|
|
714
|
-
})),
|
|
715
|
-
const i =
|
|
716
|
-
return /* @__PURE__ */
|
|
717
|
-
|
|
741
|
+
})), dt = ({ children: n, className: t, isNetwork: e, ...o }) => {
|
|
742
|
+
const i = m(R.getIsOfflineSocket), c = m(R.getIsDisableConnectSocket), l = i || !e, a = "Оффлайн";
|
|
743
|
+
return /* @__PURE__ */ D(
|
|
744
|
+
St,
|
|
718
745
|
{
|
|
719
|
-
in:
|
|
720
|
-
className:
|
|
721
|
-
...
|
|
722
|
-
children: typeof
|
|
746
|
+
in: l,
|
|
747
|
+
className: W("socket-offline", t),
|
|
748
|
+
...o,
|
|
749
|
+
children: typeof n == "function" ? n({ isDisableConnectSocket: c }) : c ? `Режим ${a}` : a
|
|
723
750
|
}
|
|
724
751
|
);
|
|
725
|
-
},
|
|
726
|
-
const t =
|
|
752
|
+
}, ht = k.memo(dt), vt = ({ children: n }) => {
|
|
753
|
+
const t = N(() => {
|
|
727
754
|
p.setInfoNoConnectServer({ isModal: !1, isSelectOffline: !1 });
|
|
728
755
|
}, []);
|
|
729
|
-
return
|
|
730
|
-
},
|
|
731
|
-
const t =
|
|
756
|
+
return n({ reConnect: t });
|
|
757
|
+
}, gt = k.memo(vt), pt = ({ children: n }) => {
|
|
758
|
+
const t = N(() => {
|
|
732
759
|
p.setInfoNoConnectServer({ isModal: !1, isSelectOffline: !0 }), p.setIsDisableConnectSocket({ isDisableConnectSocket: !0 });
|
|
733
760
|
}, []);
|
|
734
|
-
return
|
|
735
|
-
},
|
|
736
|
-
ConnectDetection:
|
|
737
|
-
OfflineDetection:
|
|
761
|
+
return n({ offlineActive: t });
|
|
762
|
+
}, Ct = k.memo(pt), It = {
|
|
763
|
+
ConnectDetection: nt,
|
|
764
|
+
OfflineDetection: ht,
|
|
738
765
|
Buttons: {
|
|
739
|
-
OfflineActive:
|
|
740
|
-
ReConnect:
|
|
766
|
+
OfflineActive: Ct,
|
|
767
|
+
ReConnect: gt
|
|
741
768
|
},
|
|
742
|
-
Initialization:
|
|
769
|
+
Initialization: ft
|
|
743
770
|
};
|
|
744
771
|
export {
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
772
|
+
It as Socket,
|
|
773
|
+
C as SocketApi,
|
|
774
|
+
yt as createRequestSocketApi,
|
|
748
775
|
p as socketActions,
|
|
749
|
-
|
|
776
|
+
R as socketSelectors,
|
|
750
777
|
w as socketStore,
|
|
751
|
-
|
|
752
|
-
|
|
778
|
+
lt as useRequestSocketApi,
|
|
779
|
+
m as useSocketSelector
|
|
753
780
|
};
|