@obb871001/api-integration-sdk 1.0.37 → 1.0.39

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.
Files changed (3) hide show
  1. package/dist/index.cjs +6 -22
  2. package/dist/index.js +1516 -1514
  3. package/package.json +17 -7
package/dist/index.js CHANGED
@@ -1,1616 +1,1618 @@
1
- import { useQueries as tt, QueryClient as nt, QueryClientProvider as at } from "@tanstack/react-query";
2
- import ye, { createContext as ut, useContext as ot, useCallback as de, useRef as ir, useMemo as Ge, useEffect as Ce } from "react";
1
+ import ye, { createContext as tt, useContext as nt, useMemo as Ge, useRef as ir, useEffect as Ce, useCallback as de } from "react";
2
+ import { QueryClient as at, QueryClientProvider as ot, useQueries as ut } from "@tanstack/react-query";
3
3
  import ct from "axios";
4
4
  import { get as we } from "lodash";
5
5
  import it from "react-dom";
6
- const Ar = ut(null), Pr = () => {
7
- const r = ot(Ar);
8
- if (!r)
9
- throw new Error("useApiContext must be used within ApiProvider");
10
- return r;
11
- };
12
- function st({
13
- baseURL: r,
14
- getToken: g,
15
- timeoutMs: O = 15e3,
16
- currency: h = "TWD",
17
- lng: v = "tw",
18
- onError: _
19
- } = {}) {
20
- const S = ct.create({
21
- baseURL: r,
22
- timeout: O,
23
- headers: { "Content-Type": "application/json" }
24
- });
25
- return S.interceptors.request.use(async (d) => {
26
- if (d.headers = d.headers || {}, g) {
27
- const c = await g();
28
- c && (d.headers.Authorization = `Bearer ${c}`);
29
- }
30
- return d.headers.Currency = h, d.headers["currency-code"] = h, d.headers.lang = v, d;
31
- }), S.interceptors.response.use(
32
- (d) => d.data,
33
- (d) => _ ? _(d, { instance: S }) : Promise.reject(d)
34
- ), S;
35
- }
36
- const lt = () => {
37
- const { client: r } = Pr(), g = de(
38
- async (S) => {
39
- const { mac_address: d = "", app_version: c = "", anydesk_id: l = "" } = S, { data: u } = await r.post("/cash-register/login", {
40
- mac_address: d,
41
- app_version: c,
42
- anydesk_id: l
43
- });
44
- return u;
45
- },
46
- [r]
47
- ), O = de(async () => r.get("/member/getMemberInfo"), [r]), h = de(async () => {
48
- const { data: S } = await r.get("/getGameList");
49
- return S;
50
- }, [r]), v = de(async () => {
51
- const { data: S } = await r.get("/getNowCurrencyExchange");
52
- return S;
53
- }, [r]), _ = de(async () => {
54
- const { data: S } = await r.get("/getFavoriteGame");
55
- return S;
56
- }, [r]);
57
- return {
58
- machineLoginApi: g,
59
- userInfoApi: O,
60
- userGameListApi: h,
61
- userFavoriteGameApi: _,
62
- userCurrencyExchangeApi: v
63
- };
64
- }, kt = () => {
65
- const { getToken: r } = Pr(), { userInfoApi: g } = lt(), O = tt({
66
- queries: [
67
- {
68
- queryKey: ["getMemberInfo"],
69
- queryFn: async () => await g(),
70
- refetchInterval: 5e4
71
- }
72
- ],
73
- enabled: !!r
74
- }), { data: h, isFetching: v, error: _ } = O[0] || {};
75
- return { data: h, isFetching: v, error: _ };
76
- };
77
- function ft(r) {
6
+ function st(r) {
78
7
  return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
79
8
  }
80
- var je = {}, F = {}, Ue = {}, sr;
81
- function H() {
82
- return sr || (sr = 1, (function(r) {
83
- Object.defineProperty(r, "__esModule", { value: !0 }), r.isEventSourceSupported = r.isReactNative = r.ReadyState = r.DEFAULT_HEARTBEAT = r.UNPARSABLE_JSON_OBJECT = r.DEFAULT_RECONNECT_INTERVAL_MS = r.DEFAULT_RECONNECT_LIMIT = r.SOCKET_IO_PING_CODE = r.SOCKET_IO_PATH = r.SOCKET_IO_PING_INTERVAL = r.DEFAULT_EVENT_SOURCE_OPTIONS = r.EMPTY_EVENT_HANDLERS = r.DEFAULT_OPTIONS = void 0;
84
- var g = 1, O = 1e3 * g;
85
- r.DEFAULT_OPTIONS = {}, r.EMPTY_EVENT_HANDLERS = {}, r.DEFAULT_EVENT_SOURCE_OPTIONS = {
86
- withCredentials: !1,
87
- events: r.EMPTY_EVENT_HANDLERS
88
- }, r.SOCKET_IO_PING_INTERVAL = 25 * O, r.SOCKET_IO_PATH = "/socket.io/?EIO=3&transport=websocket", r.SOCKET_IO_PING_CODE = "2", r.DEFAULT_RECONNECT_LIMIT = 20, r.DEFAULT_RECONNECT_INTERVAL_MS = 5e3, r.UNPARSABLE_JSON_OBJECT = {}, r.DEFAULT_HEARTBEAT = {
89
- message: "ping",
90
- timeout: 6e4,
91
- interval: 25e3
92
- };
93
- var h;
94
- (function(_) {
95
- _[_.UNINSTANTIATED = -1] = "UNINSTANTIATED", _[_.CONNECTING = 0] = "CONNECTING", _[_.OPEN = 1] = "OPEN", _[_.CLOSING = 2] = "CLOSING", _[_.CLOSED = 3] = "CLOSED";
96
- })(h || (r.ReadyState = h = {}));
97
- var v = function() {
98
- try {
99
- return "EventSource" in globalThis;
100
- } catch {
101
- return !1;
102
- }
103
- };
104
- r.isReactNative = typeof navigator < "u" && navigator.product === "ReactNative", r.isEventSourceSupported = !r.isReactNative && v();
105
- })(Ue)), Ue;
106
- }
107
- var _e = {}, We = {}, lr;
108
- function Je() {
109
- return lr || (lr = 1, (function(r) {
110
- Object.defineProperty(r, "__esModule", { value: !0 }), r.resetWebSockets = r.sharedWebSockets = void 0, r.sharedWebSockets = {};
111
- var g = function(O) {
112
- if (O && r.sharedWebSockets.hasOwnProperty(O))
113
- delete r.sharedWebSockets[O];
114
- else
115
- for (var h in r.sharedWebSockets)
116
- r.sharedWebSockets.hasOwnProperty(h) && delete r.sharedWebSockets[h];
117
- };
118
- r.resetWebSockets = g;
119
- })(We)), We;
120
- }
121
- var te = {}, K = {}, fr;
122
- function Ve() {
123
- if (fr) return K;
124
- fr = 1, Object.defineProperty(K, "__esModule", { value: !0 }), K.setUpSocketIOPing = K.appendQueryParams = K.parseSocketIOUrl = void 0;
125
- var r = H(), g = function(v) {
126
- if (v) {
127
- var _ = /^https|wss/.test(v), S = v.replace(/^(https?|wss?)(:\/\/)?/, ""), d = S.replace(/\/$/, ""), c = _ ? "wss" : "ws";
128
- return "".concat(c, "://").concat(d).concat(r.SOCKET_IO_PATH);
129
- } else if (v === "") {
130
- var _ = /^https/.test(window.location.protocol), c = _ ? "wss" : "ws", l = window.location.port ? ":".concat(window.location.port) : "";
131
- return "".concat(c, "://").concat(window.location.hostname).concat(l).concat(r.SOCKET_IO_PATH);
132
- }
133
- return v;
134
- };
135
- K.parseSocketIOUrl = g;
136
- var O = function(v, _) {
137
- _ === void 0 && (_ = {});
138
- var S = /\?([\w]+=[\w]+)/, d = S.test(v), c = "".concat(Object.entries(_).reduce(function(l, u) {
139
- var a = u[0], i = u[1];
140
- return l + "".concat(a, "=").concat(i, "&");
141
- }, "").slice(0, -1));
142
- return "".concat(v).concat(d ? "&" : "?").concat(c);
143
- };
144
- K.appendQueryParams = O;
145
- var h = function(v, _) {
146
- _ === void 0 && (_ = r.SOCKET_IO_PING_INTERVAL);
147
- var S = function() {
148
- return v(r.SOCKET_IO_PING_CODE);
149
- };
150
- return window.setInterval(S, _);
151
- };
152
- return K.setUpSocketIOPing = h, K;
153
- }
154
- var Ae = {}, vr;
155
- function Ir() {
156
- if (vr) return Ae;
157
- vr = 1, Object.defineProperty(Ae, "__esModule", { value: !0 }), Ae.heartbeat = O;
158
- var r = H();
159
- function g(h) {
160
- return Array.isArray(h) ? h.reduce(function(v, _) {
161
- return v.current > _.current ? v : _;
162
- }).current : h.current;
163
- }
164
- function O(h, v, _) {
165
- var S = _ || {}, d = S.interval, c = d === void 0 ? r.DEFAULT_HEARTBEAT.interval : d, l = S.timeout, u = l === void 0 ? r.DEFAULT_HEARTBEAT.timeout : l, a = S.message, i = a === void 0 ? r.DEFAULT_HEARTBEAT.message : a, t = Math.max(100, c / 10), n = Date.now(), f = setInterval(function() {
166
- var E = Date.now(), o = g(v);
167
- if (o + u <= E)
168
- console.warn("Heartbeat timed out, closing connection, last message received ".concat(E - o, "ms ago, last ping sent ").concat(E - n, "ms ago")), h.close();
169
- else if (o + c <= E && n + c <= E)
170
- try {
171
- typeof i == "function" ? h.send(i()) : h.send(i), n = E;
172
- } catch (y) {
173
- console.error("Heartbeat failed, closing connection", y instanceof Error ? y.message : y), h.close();
174
- }
175
- }, t);
176
- return h.addEventListener("close", function() {
177
- clearInterval(f);
178
- }), function() {
179
- };
180
- }
181
- return Ae;
182
- }
183
- var Ee = {}, Fe = {}, dr;
184
- function He() {
185
- return dr || (dr = 1, (function(r) {
186
- Object.defineProperty(r, "__esModule", { value: !0 }), r.resetSubscribers = r.removeSubscriber = r.addSubscriber = r.hasSubscribers = r.getSubscribers = void 0;
187
- var g = {}, O = [], h = function(c) {
188
- return (0, r.hasSubscribers)(c) ? Array.from(g[c]) : O;
189
- };
190
- r.getSubscribers = h;
191
- var v = function(c) {
192
- var l;
193
- return ((l = g[c]) === null || l === void 0 ? void 0 : l.size) > 0;
194
- };
195
- r.hasSubscribers = v;
196
- var _ = function(c, l) {
197
- g[c] = g[c] || /* @__PURE__ */ new Set(), g[c].add(l);
198
- };
199
- r.addSubscriber = _;
200
- var S = function(c, l) {
201
- g[c].delete(l);
202
- };
203
- r.removeSubscriber = S;
204
- var d = function(c) {
205
- if (c && g.hasOwnProperty(c))
206
- delete g[c];
207
- else
208
- for (var l in g)
209
- g.hasOwnProperty(l) && delete g[l];
210
- };
211
- r.resetSubscribers = d;
212
- })(Fe)), Fe;
213
- }
214
- var _r;
215
- function $e() {
216
- if (_r) return Ee;
217
- _r = 1, Object.defineProperty(Ee, "__esModule", { value: !0 }), Ee.assertIsWebSocket = O, Ee.resetGlobalState = h;
218
- var r = Je(), g = He();
219
- function O(v, _) {
220
- if (!_ && !(v instanceof WebSocket))
221
- throw new Error("");
222
- }
223
- function h(v) {
224
- (0, g.resetSubscribers)(v), (0, r.resetWebSockets)(v);
9
+ var Ae = { exports: {} }, _e = {};
10
+ var sr;
11
+ function lt() {
12
+ if (sr) return _e;
13
+ sr = 1;
14
+ var r = ye, b = Symbol.for("react.element"), O = Symbol.for("react.fragment"), _ = Object.prototype.hasOwnProperty, f = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, E = { key: !0, ref: !0, __self: !0, __source: !0 };
15
+ function S(d, c, l) {
16
+ var o, a = {}, i = null, t = null;
17
+ l !== void 0 && (i = "" + l), c.key !== void 0 && (i = "" + c.key), c.ref !== void 0 && (t = c.ref);
18
+ for (o in c) _.call(c, o) && !E.hasOwnProperty(o) && (a[o] = c[o]);
19
+ if (d && d.defaultProps) for (o in c = d.defaultProps, c) a[o] === void 0 && (a[o] = c[o]);
20
+ return { $$typeof: b, type: d, key: i, ref: t, props: a, _owner: f.current };
225
21
  }
226
- return Ee;
227
- }
228
- var Er;
229
- function vt() {
230
- if (Er) return te;
231
- Er = 1;
232
- var r = te && te.__assign || function() {
233
- return r = Object.assign || function(u) {
234
- for (var a, i = 1, t = arguments.length; i < t; i++) {
235
- a = arguments[i];
236
- for (var n in a) Object.prototype.hasOwnProperty.call(a, n) && (u[n] = a[n]);
237
- }
238
- return u;
239
- }, r.apply(this, arguments);
240
- };
241
- Object.defineProperty(te, "__esModule", { value: !0 }), te.attachListeners = void 0;
242
- var g = Ve(), O = Ir(), h = H(), v = $e(), _ = function(u, a, i, t) {
243
- u.onmessage = function(n) {
244
- var f;
245
- a.current.onMessage && a.current.onMessage(n), typeof t?.current == "number" && (t.current = Date.now()), !(typeof a.current.filter == "function" && a.current.filter(n) !== !0) && (a.current.heartbeat && typeof a.current.heartbeat != "boolean" && ((f = a.current.heartbeat) === null || f === void 0 ? void 0 : f.returnMessage) === n.data || i(n));
246
- };
247
- }, S = function(u, a, i, t, n) {
248
- u.onopen = function(f) {
249
- if (a.current.onOpen && a.current.onOpen(f), t.current = 0, i(h.ReadyState.OPEN), a.current.heartbeat && u instanceof WebSocket) {
250
- var E = typeof a.current.heartbeat == "boolean" ? void 0 : a.current.heartbeat;
251
- n.current = Date.now(), (0, O.heartbeat)(u, n, E);
252
- }
253
- };
254
- }, d = function(u, a, i, t, n) {
255
- if (h.isEventSourceSupported && u instanceof EventSource)
256
- return function() {
257
- };
258
- (0, v.assertIsWebSocket)(u, a.current.skipAssert);
259
- var f;
260
- return u.onclose = function(E) {
261
- var o;
262
- if (a.current.onClose && a.current.onClose(E), i(h.ReadyState.CLOSED), a.current.shouldReconnect && a.current.shouldReconnect(E)) {
263
- var y = (o = a.current.reconnectAttempts) !== null && o !== void 0 ? o : h.DEFAULT_RECONNECT_LIMIT;
264
- if (n.current < y) {
265
- var C = typeof a.current.reconnectInterval == "function" ? a.current.reconnectInterval(n.current) : a.current.reconnectInterval;
266
- f = window.setTimeout(function() {
267
- n.current++, t();
268
- }, C ?? h.DEFAULT_RECONNECT_INTERVAL_MS);
269
- } else
270
- a.current.onReconnectStop && a.current.onReconnectStop(y), console.warn("Max reconnect attempts of ".concat(y, " exceeded"));
271
- }
272
- }, function() {
273
- return f && window.clearTimeout(f);
274
- };
275
- }, c = function(u, a, i, t, n) {
276
- var f;
277
- return u.onerror = function(E) {
278
- var o;
279
- if (a.current.onError && a.current.onError(E), h.isEventSourceSupported && u instanceof EventSource && (a.current.onClose && a.current.onClose(r(r({}, E), { code: 1006, reason: "An error occurred with the EventSource: ".concat(E), wasClean: !1 })), i(h.ReadyState.CLOSED), u.close()), a.current.retryOnError)
280
- if (n.current < ((o = a.current.reconnectAttempts) !== null && o !== void 0 ? o : h.DEFAULT_RECONNECT_LIMIT)) {
281
- var y = typeof a.current.reconnectInterval == "function" ? a.current.reconnectInterval(n.current) : a.current.reconnectInterval;
282
- f = window.setTimeout(function() {
283
- n.current++, t();
284
- }, y ?? h.DEFAULT_RECONNECT_INTERVAL_MS);
285
- } else
286
- a.current.onReconnectStop && a.current.onReconnectStop(a.current.reconnectAttempts), console.warn("Max reconnect attempts of ".concat(a.current.reconnectAttempts, " exceeded"));
287
- }, function() {
288
- return f && window.clearTimeout(f);
289
- };
290
- }, l = function(u, a, i, t, n, f, E) {
291
- var o = a.setLastMessage, y = a.setReadyState, C, P, T;
292
- return i.current.fromSocketIO && (C = (0, g.setUpSocketIOPing)(E)), _(u, i, o, f), S(u, i, y, n, f), P = d(u, i, y, t, n), T = c(u, i, y, t, n), function() {
293
- y(h.ReadyState.CLOSING), P(), T(), u.close(), C && clearInterval(C);
294
- };
295
- };
296
- return te.attachListeners = l, te;
297
- }
298
- var ne = {}, Sr;
299
- function dt() {
300
- if (Sr) return ne;
301
- Sr = 1;
302
- var r = ne && ne.__assign || function() {
303
- return r = Object.assign || function(a) {
304
- for (var i, t = 1, n = arguments.length; t < n; t++) {
305
- i = arguments[t];
306
- for (var f in i) Object.prototype.hasOwnProperty.call(i, f) && (a[f] = i[f]);
307
- }
308
- return a;
309
- }, r.apply(this, arguments);
310
- };
311
- Object.defineProperty(ne, "__esModule", { value: !0 }), ne.attachSharedListeners = void 0;
312
- var g = Je(), O = H(), h = He(), v = Ve(), _ = Ir(), S = function(a, i, t) {
313
- a.onmessage = function(n) {
314
- (0, h.getSubscribers)(i).forEach(function(f) {
315
- var E;
316
- f.optionsRef.current.onMessage && f.optionsRef.current.onMessage(n), typeof ((E = f?.lastMessageTime) === null || E === void 0 ? void 0 : E.current) == "number" && (f.lastMessageTime.current = Date.now()), !(typeof f.optionsRef.current.filter == "function" && f.optionsRef.current.filter(n) !== !0) && (t && typeof t != "boolean" && t?.returnMessage === n.data || f.setLastMessage(n));
317
- });
318
- };
319
- }, d = function(a, i, t) {
320
- a.onopen = function(n) {
321
- var f = (0, h.getSubscribers)(i);
322
- f.forEach(function(E) {
323
- E.reconnectCount.current = 0, E.optionsRef.current.onOpen && E.optionsRef.current.onOpen(n), E.setReadyState(O.ReadyState.OPEN), t && a instanceof WebSocket && (E.lastMessageTime.current = Date.now());
324
- }), t && a instanceof WebSocket && (0, _.heartbeat)(a, f.map(function(E) {
325
- return E.lastMessageTime;
326
- }), typeof t == "boolean" ? void 0 : t);
327
- };
328
- }, c = function(a, i) {
329
- a instanceof WebSocket && (a.onclose = function(t) {
330
- (0, h.getSubscribers)(i).forEach(function(n) {
331
- n.optionsRef.current.onClose && n.optionsRef.current.onClose(t), n.setReadyState(O.ReadyState.CLOSED);
332
- }), delete g.sharedWebSockets[i], (0, h.getSubscribers)(i).forEach(function(n) {
333
- var f;
334
- if (n.optionsRef.current.shouldReconnect && n.optionsRef.current.shouldReconnect(t)) {
335
- var E = (f = n.optionsRef.current.reconnectAttempts) !== null && f !== void 0 ? f : O.DEFAULT_RECONNECT_LIMIT;
336
- if (n.reconnectCount.current < E) {
337
- var o = typeof n.optionsRef.current.reconnectInterval == "function" ? n.optionsRef.current.reconnectInterval(n.reconnectCount.current) : n.optionsRef.current.reconnectInterval;
338
- setTimeout(function() {
339
- n.reconnectCount.current++, n.reconnect.current();
340
- }, o ?? O.DEFAULT_RECONNECT_INTERVAL_MS);
341
- } else
342
- n.optionsRef.current.onReconnectStop && n.optionsRef.current.onReconnectStop(n.optionsRef.current.reconnectAttempts), console.warn("Max reconnect attempts of ".concat(E, " exceeded"));
343
- }
344
- });
345
- });
346
- }, l = function(a, i) {
347
- a.onerror = function(t) {
348
- (0, h.getSubscribers)(i).forEach(function(n) {
349
- n.optionsRef.current.onError && n.optionsRef.current.onError(t), O.isEventSourceSupported && a instanceof EventSource && (n.optionsRef.current.onClose && n.optionsRef.current.onClose(r(r({}, t), { code: 1006, reason: "An error occurred with the EventSource: ".concat(t), wasClean: !1 })), n.setReadyState(O.ReadyState.CLOSED));
350
- }), O.isEventSourceSupported && a instanceof EventSource && a.close();
351
- };
352
- }, u = function(a, i, t, n) {
353
- var f;
354
- return t.current.fromSocketIO && (f = (0, v.setUpSocketIOPing)(n)), S(a, i, t.current.heartbeat), c(a, i), d(a, i, t.current.heartbeat), l(a, i), function() {
355
- f && clearInterval(f);
356
- };
357
- };
358
- return ne.attachSharedListeners = u, ne;
22
+ return _e.Fragment = O, _e.jsx = S, _e.jsxs = S, _e;
359
23
  }
360
- var hr;
361
- function _t() {
362
- if (hr) return _e;
363
- hr = 1, Object.defineProperty(_e, "__esModule", { value: !0 }), _e.createOrJoinSocket = void 0;
364
- var r = Je(), g = H(), O = vt(), h = dt(), v = He(), _ = function(d, c, l, u, a) {
365
- return function() {
366
- if ((0, v.removeSubscriber)(d, c), !(0, v.hasSubscribers)(d)) {
367
- try {
368
- var i = r.sharedWebSockets[d];
369
- i instanceof WebSocket && (i.onclose = function(t) {
370
- l.current.onClose && l.current.onClose(t), u(g.ReadyState.CLOSED);
371
- }), i.close();
372
- } catch {
373
- }
374
- a && a(), delete r.sharedWebSockets[d];
24
+ var Ee = {};
25
+ var lr;
26
+ function ft() {
27
+ return lr || (lr = 1, process.env.NODE_ENV !== "production" && (function() {
28
+ var r = ye, b = Symbol.for("react.element"), O = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), S = Symbol.for("react.provider"), d = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), o = Symbol.for("react.suspense_list"), a = Symbol.for("react.memo"), i = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), n = Symbol.iterator, v = "@@iterator";
29
+ function h(e) {
30
+ if (e === null || typeof e != "object")
31
+ return null;
32
+ var s = n && e[n] || e[v];
33
+ return typeof s == "function" ? s : null;
34
+ }
35
+ var u = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
36
+ function y(e) {
37
+ {
38
+ for (var s = arguments.length, g = new Array(s > 1 ? s - 1 : 0), p = 1; p < s; p++)
39
+ g[p - 1] = arguments[p];
40
+ C("error", e, g);
375
41
  }
376
- };
377
- }, S = function(d, c, l, u, a, i, t, n, f) {
378
- if (!g.isEventSourceSupported && u.current.eventSourceOptions)
379
- throw g.isReactNative ? new Error("EventSource is not supported in ReactNative") : new Error("EventSource is not supported");
380
- if (u.current.share) {
381
- var E = null;
382
- r.sharedWebSockets[c] === void 0 ? (r.sharedWebSockets[c] = u.current.eventSourceOptions ? new EventSource(c, u.current.eventSourceOptions) : new WebSocket(c, u.current.protocols), d.current = r.sharedWebSockets[c], l(g.ReadyState.CONNECTING), E = (0, h.attachSharedListeners)(r.sharedWebSockets[c], c, u, f)) : (d.current = r.sharedWebSockets[c], l(r.sharedWebSockets[c].readyState));
383
- var o = {
384
- setLastMessage: a,
385
- setReadyState: l,
386
- optionsRef: u,
387
- reconnectCount: t,
388
- lastMessageTime: n,
389
- reconnect: i
390
- };
391
- return (0, v.addSubscriber)(c, o), _(c, o, u, l, E);
392
- } else {
393
- if (d.current = u.current.eventSourceOptions ? new EventSource(c, u.current.eventSourceOptions) : new WebSocket(c, u.current.protocols), l(g.ReadyState.CONNECTING), !d.current)
394
- throw new Error("WebSocket failed to be created");
395
- return (0, O.attachListeners)(d.current, {
396
- setLastMessage: a,
397
- setReadyState: l
398
- }, u, i.current, t, n, f);
399
42
  }
400
- };
401
- return _e.createOrJoinSocket = S, _e;
402
- }
403
- var x = {}, yr;
404
- function Et() {
405
- return yr || (yr = 1, (function(r) {
406
- var g = x && x.__awaiter || function(c, l, u, a) {
407
- function i(t) {
408
- return t instanceof u ? t : new u(function(n) {
409
- n(t);
43
+ function C(e, s, g) {
44
+ {
45
+ var p = u.ReactDebugCurrentFrame, w = p.getStackAddendum();
46
+ w !== "" && (s += "%s", g = g.concat([w]));
47
+ var I = g.map(function(R) {
48
+ return String(R);
410
49
  });
50
+ I.unshift("Warning: " + s), Function.prototype.apply.call(console[e], console, I);
411
51
  }
412
- return new (u || (u = Promise))(function(t, n) {
413
- function f(y) {
414
- try {
415
- o(a.next(y));
416
- } catch (C) {
417
- n(C);
418
- }
419
- }
420
- function E(y) {
421
- try {
422
- o(a.throw(y));
423
- } catch (C) {
424
- n(C);
425
- }
426
- }
427
- function o(y) {
428
- y.done ? t(y.value) : i(y.value).then(f, E);
429
- }
430
- o((a = a.apply(c, l || [])).next());
431
- });
432
- }, O = x && x.__generator || function(c, l) {
433
- var u = { label: 0, sent: function() {
434
- if (t[0] & 1) throw t[1];
435
- return t[1];
436
- }, trys: [], ops: [] }, a, i, t, n = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
437
- return n.next = f(0), n.throw = f(1), n.return = f(2), typeof Symbol == "function" && (n[Symbol.iterator] = function() {
438
- return this;
439
- }), n;
440
- function f(o) {
441
- return function(y) {
442
- return E([o, y]);
443
- };
444
- }
445
- function E(o) {
446
- if (a) throw new TypeError("Generator is already executing.");
447
- for (; n && (n = 0, o[0] && (u = 0)), u; ) try {
448
- if (a = 1, i && (t = o[0] & 2 ? i.return : o[0] ? i.throw || ((t = i.return) && t.call(i), 0) : i.next) && !(t = t.call(i, o[1])).done) return t;
449
- switch (i = 0, t && (o = [o[0] & 2, t.value]), o[0]) {
450
- case 0:
451
- case 1:
452
- t = o;
453
- break;
454
- case 4:
455
- return u.label++, { value: o[1], done: !1 };
456
- case 5:
457
- u.label++, i = o[1], o = [0];
458
- continue;
459
- case 7:
460
- o = u.ops.pop(), u.trys.pop();
461
- continue;
462
- default:
463
- if (t = u.trys, !(t = t.length > 0 && t[t.length - 1]) && (o[0] === 6 || o[0] === 2)) {
464
- u = 0;
465
- continue;
466
- }
467
- if (o[0] === 3 && (!t || o[1] > t[0] && o[1] < t[3])) {
468
- u.label = o[1];
469
- break;
470
- }
471
- if (o[0] === 6 && u.label < t[1]) {
472
- u.label = t[1], t = o;
473
- break;
474
- }
475
- if (t && u.label < t[2]) {
476
- u.label = t[2], u.ops.push(o);
477
- break;
478
- }
479
- t[2] && u.ops.pop(), u.trys.pop();
480
- continue;
481
- }
482
- o = l.call(c, u);
483
- } catch (y) {
484
- o = [6, y], i = 0;
485
- } finally {
486
- a = t = 0;
487
- }
488
- if (o[0] & 5) throw o[1];
489
- return { value: o[0] ? o[1] : void 0, done: !0 };
52
+ }
53
+ var P = !1, T = !1, A = !1, k = !1, se = !1, le;
54
+ le = Symbol.for("react.module.reference");
55
+ function Ie(e) {
56
+ return !!(typeof e == "string" || typeof e == "function" || e === _ || e === E || se || e === f || e === l || e === o || k || e === t || P || T || A || typeof e == "object" && e !== null && (e.$$typeof === i || e.$$typeof === a || e.$$typeof === S || e.$$typeof === d || e.$$typeof === c || // This needs to include all possible module reference object
57
+ // types supported by any Flight configuration anywhere since
58
+ // we don't know which Flight build this will end up being used
59
+ // with.
60
+ e.$$typeof === le || e.getModuleId !== void 0));
61
+ }
62
+ function be(e, s, g) {
63
+ var p = e.displayName;
64
+ if (p)
65
+ return p;
66
+ var w = s.displayName || s.name || "";
67
+ return w !== "" ? g + "(" + w + ")" : g;
68
+ }
69
+ function J(e) {
70
+ return e.displayName || "Context";
71
+ }
72
+ function L(e) {
73
+ if (e == null)
74
+ return null;
75
+ if (typeof e.tag == "number" && y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
76
+ return e.displayName || e.name || null;
77
+ if (typeof e == "string")
78
+ return e;
79
+ switch (e) {
80
+ case _:
81
+ return "Fragment";
82
+ case O:
83
+ return "Portal";
84
+ case E:
85
+ return "Profiler";
86
+ case f:
87
+ return "StrictMode";
88
+ case l:
89
+ return "Suspense";
90
+ case o:
91
+ return "SuspenseList";
490
92
  }
491
- }, h = x && x.__spreadArray || function(c, l, u) {
492
- if (u || arguments.length === 2) for (var a = 0, i = l.length, t; a < i; a++)
493
- (t || !(a in l)) && (t || (t = Array.prototype.slice.call(l, 0, a)), t[a] = l[a]);
494
- return c.concat(t || Array.prototype.slice.call(l));
495
- };
496
- Object.defineProperty(r, "__esModule", { value: !0 }), r.getUrl = void 0;
497
- var v = Ve(), _ = H(), S = function(c) {
498
- return new Promise(function(l) {
499
- return window.setTimeout(l, c);
500
- });
501
- }, d = function(c, l) {
502
- for (var u = [], a = 2; a < arguments.length; a++)
503
- u[a - 2] = arguments[a];
504
- return g(void 0, h([c, l], u, !0), void 0, function(i, t, n) {
505
- var f, E, o, y, C, P, T, A;
506
- return n === void 0 && (n = 0), O(this, function(k) {
507
- switch (k.label) {
508
- case 0:
509
- if (typeof i != "function") return [3, 10];
510
- k.label = 1;
511
- case 1:
512
- return k.trys.push([1, 3, , 9]), [4, i()];
513
- case 2:
514
- return f = k.sent(), [3, 9];
515
- case 3:
516
- return k.sent(), t.current.retryOnError ? (E = (P = t.current.reconnectAttempts) !== null && P !== void 0 ? P : _.DEFAULT_RECONNECT_LIMIT, n < E ? (o = typeof t.current.reconnectInterval == "function" ? t.current.reconnectInterval(n) : t.current.reconnectInterval, [4, S(o ?? _.DEFAULT_RECONNECT_INTERVAL_MS)]) : [3, 5]) : [3, 7];
517
- case 4:
518
- return k.sent(), [2, (0, r.getUrl)(i, t, n + 1)];
519
- case 5:
520
- return (A = (T = t.current).onReconnectStop) === null || A === void 0 || A.call(T, n), [2, null];
521
- case 6:
522
- return [3, 8];
523
- case 7:
524
- return [2, null];
525
- case 8:
526
- return [3, 9];
527
- case 9:
528
- return [3, 11];
529
- case 10:
530
- f = i, k.label = 11;
531
- case 11:
532
- return y = t.current.fromSocketIO ? (0, v.parseSocketIOUrl)(f) : f, C = t.current.queryParams ? (0, v.appendQueryParams)(y, t.current.queryParams) : y, [2, C];
93
+ if (typeof e == "object")
94
+ switch (e.$$typeof) {
95
+ case d:
96
+ var s = e;
97
+ return J(s) + ".Consumer";
98
+ case S:
99
+ var g = e;
100
+ return J(g._context) + ".Provider";
101
+ case c:
102
+ return be(e, e.render, "ForwardRef");
103
+ case a:
104
+ var p = e.displayName || null;
105
+ return p !== null ? p : L(e.type) || "Memo";
106
+ case i: {
107
+ var w = e, I = w._payload, R = w._init;
108
+ try {
109
+ return L(R(I));
110
+ } catch {
111
+ return null;
112
+ }
533
113
  }
534
- });
535
- });
536
- };
537
- r.getUrl = d;
538
- })(x)), x;
539
- }
540
- var qe = {}, br;
541
- function St() {
542
- return br || (br = 1, (function(r) {
543
- Object.defineProperty(r, "__esModule", { value: !0 }), r.websocketWrapper = void 0;
544
- var g = function(O, h) {
545
- return new Proxy(O, {
546
- get: function(v, _) {
547
- var S = v[_];
548
- return _ === "reconnect" ? h : typeof S == "function" ? (console.error("Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket."), function() {
549
- }) : S;
550
- },
551
- set: function(v, _, S) {
552
- return /^on/.test(_) ? (console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."), !1) : (v[_] = S, !0);
553
114
  }
554
- });
555
- };
556
- r.websocketWrapper = g, r.default = r.websocketWrapper;
557
- })(qe)), qe;
558
- }
559
- var gr;
560
- function Ye() {
561
- if (gr) return F;
562
- gr = 1;
563
- var r = F && F.__assign || function() {
564
- return r = Object.assign || function(i) {
565
- for (var t, n = 1, f = arguments.length; n < f; n++) {
566
- t = arguments[n];
567
- for (var E in t) Object.prototype.hasOwnProperty.call(t, E) && (i[E] = t[E]);
568
- }
569
- return i;
570
- }, r.apply(this, arguments);
571
- }, g = F && F.__awaiter || function(i, t, n, f) {
572
- function E(o) {
573
- return o instanceof n ? o : new n(function(y) {
574
- y(o);
575
- });
115
+ return null;
576
116
  }
577
- return new (n || (n = Promise))(function(o, y) {
578
- function C(A) {
579
- try {
580
- T(f.next(A));
581
- } catch (k) {
582
- y(k);
117
+ var G = Object.assign, X = 0, $, ge, Oe, D, j, Y, fe;
118
+ function Z() {
119
+ }
120
+ Z.__reactDisabledLog = !0;
121
+ function z() {
122
+ {
123
+ if (X === 0) {
124
+ $ = console.log, ge = console.info, Oe = console.warn, D = console.error, j = console.group, Y = console.groupCollapsed, fe = console.groupEnd;
125
+ var e = {
126
+ configurable: !0,
127
+ enumerable: !0,
128
+ value: Z,
129
+ writable: !0
130
+ };
131
+ Object.defineProperties(console, {
132
+ info: e,
133
+ log: e,
134
+ warn: e,
135
+ error: e,
136
+ group: e,
137
+ groupCollapsed: e,
138
+ groupEnd: e
139
+ });
583
140
  }
141
+ X++;
584
142
  }
585
- function P(A) {
586
- try {
587
- T(f.throw(A));
588
- } catch (k) {
589
- y(k);
143
+ }
144
+ function pe() {
145
+ {
146
+ if (X--, X === 0) {
147
+ var e = {
148
+ configurable: !0,
149
+ enumerable: !0,
150
+ writable: !0
151
+ };
152
+ Object.defineProperties(console, {
153
+ log: G({}, e, {
154
+ value: $
155
+ }),
156
+ info: G({}, e, {
157
+ value: ge
158
+ }),
159
+ warn: G({}, e, {
160
+ value: Oe
161
+ }),
162
+ error: G({}, e, {
163
+ value: D
164
+ }),
165
+ group: G({}, e, {
166
+ value: j
167
+ }),
168
+ groupCollapsed: G({}, e, {
169
+ value: Y
170
+ }),
171
+ groupEnd: G({}, e, {
172
+ value: fe
173
+ })
174
+ });
590
175
  }
176
+ X < 0 && y("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
591
177
  }
592
- function T(A) {
593
- A.done ? o(A.value) : E(A.value).then(C, P);
178
+ }
179
+ var oe = u.ReactCurrentDispatcher, B;
180
+ function ue(e, s, g) {
181
+ {
182
+ if (B === void 0)
183
+ try {
184
+ throw Error();
185
+ } catch (w) {
186
+ var p = w.stack.trim().match(/\n( *(at )?)/);
187
+ B = p && p[1] || "";
188
+ }
189
+ return `
190
+ ` + B + e;
594
191
  }
595
- T((f = f.apply(i, t || [])).next());
596
- });
597
- }, O = F && F.__generator || function(i, t) {
598
- var n = { label: 0, sent: function() {
599
- if (o[0] & 1) throw o[1];
600
- return o[1];
601
- }, trys: [], ops: [] }, f, E, o, y = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
602
- return y.next = C(0), y.throw = C(1), y.return = C(2), typeof Symbol == "function" && (y[Symbol.iterator] = function() {
603
- return this;
604
- }), y;
605
- function C(T) {
606
- return function(A) {
607
- return P([T, A]);
608
- };
609
192
  }
610
- function P(T) {
611
- if (f) throw new TypeError("Generator is already executing.");
612
- for (; y && (y = 0, T[0] && (n = 0)), n; ) try {
613
- if (f = 1, E && (o = T[0] & 2 ? E.return : T[0] ? E.throw || ((o = E.return) && o.call(E), 0) : E.next) && !(o = o.call(E, T[1])).done) return o;
614
- switch (E = 0, o && (T = [T[0] & 2, o.value]), T[0]) {
615
- case 0:
616
- case 1:
617
- o = T;
618
- break;
619
- case 4:
620
- return n.label++, { value: T[1], done: !1 };
621
- case 5:
622
- n.label++, E = T[1], T = [0];
623
- continue;
624
- case 7:
625
- T = n.ops.pop(), n.trys.pop();
626
- continue;
627
- default:
628
- if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (T[0] === 6 || T[0] === 2)) {
629
- n = 0;
630
- continue;
631
- }
632
- if (T[0] === 3 && (!o || T[1] > o[0] && T[1] < o[3])) {
633
- n.label = T[1];
634
- break;
193
+ var ee = !1, Te;
194
+ {
195
+ var kr = typeof WeakMap == "function" ? WeakMap : Map;
196
+ Te = new kr();
197
+ }
198
+ function Be(e, s) {
199
+ if (!e || ee)
200
+ return "";
201
+ {
202
+ var g = Te.get(e);
203
+ if (g !== void 0)
204
+ return g;
205
+ }
206
+ var p;
207
+ ee = !0;
208
+ var w = Error.prepareStackTrace;
209
+ Error.prepareStackTrace = void 0;
210
+ var I;
211
+ I = oe.current, oe.current = null, z();
212
+ try {
213
+ if (s) {
214
+ var R = function() {
215
+ throw Error();
216
+ };
217
+ if (Object.defineProperty(R.prototype, "props", {
218
+ set: function() {
219
+ throw Error();
635
220
  }
636
- if (T[0] === 6 && n.label < o[1]) {
637
- n.label = o[1], o = T;
638
- break;
221
+ }), typeof Reflect == "object" && Reflect.construct) {
222
+ try {
223
+ Reflect.construct(R, []);
224
+ } catch (W) {
225
+ p = W;
639
226
  }
640
- if (o && n.label < o[2]) {
641
- n.label = o[2], n.ops.push(T);
642
- break;
227
+ Reflect.construct(e, [], R);
228
+ } else {
229
+ try {
230
+ R.call();
231
+ } catch (W) {
232
+ p = W;
643
233
  }
644
- o[2] && n.ops.pop(), n.trys.pop();
645
- continue;
646
- }
647
- T = t.call(i, n);
648
- } catch (A) {
649
- T = [6, A], E = 0;
650
- } finally {
651
- f = o = 0;
234
+ e.call(R.prototype);
235
+ }
236
+ } else {
237
+ try {
238
+ throw Error();
239
+ } catch (W) {
240
+ p = W;
241
+ }
242
+ e();
243
+ }
244
+ } catch (W) {
245
+ if (W && p && typeof W.stack == "string") {
246
+ for (var m = W.stack.split(`
247
+ `), U = p.stack.split(`
248
+ `), N = m.length - 1, M = U.length - 1; N >= 1 && M >= 0 && m[N] !== U[M]; )
249
+ M--;
250
+ for (; N >= 1 && M >= 0; N--, M--)
251
+ if (m[N] !== U[M]) {
252
+ if (N !== 1 || M !== 1)
253
+ do
254
+ if (N--, M--, M < 0 || m[N] !== U[M]) {
255
+ var q = `
256
+ ` + m[N].replace(" at new ", " at ");
257
+ return e.displayName && q.includes("<anonymous>") && (q = q.replace("<anonymous>", e.displayName)), typeof e == "function" && Te.set(e, q), q;
258
+ }
259
+ while (N >= 1 && M >= 0);
260
+ break;
261
+ }
262
+ }
263
+ } finally {
264
+ ee = !1, oe.current = I, pe(), Error.prepareStackTrace = w;
652
265
  }
653
- if (T[0] & 5) throw T[1];
654
- return { value: T[0] ? T[1] : void 0, done: !0 };
266
+ var ie = e ? e.displayName || e.name : "", re = ie ? ue(ie) : "";
267
+ return typeof e == "function" && Te.set(e, re), re;
655
268
  }
656
- }, h = F && F.__importDefault || function(i) {
657
- return i && i.__esModule ? i : { default: i };
658
- };
659
- Object.defineProperty(F, "__esModule", { value: !0 }), F.useWebSocket = void 0;
660
- var v = ye, _ = it, S = H(), d = _t(), c = Et(), l = h(St()), u = $e(), a = function(i, t, n) {
661
- t === void 0 && (t = S.DEFAULT_OPTIONS), n === void 0 && (n = !0);
662
- var f = (0, v.useState)(null), E = f[0], o = f[1], y = (0, v.useState)({}), C = y[0], P = y[1], T = (0, v.useMemo)(function() {
663
- if (!t.disableJson && E)
664
- try {
665
- return JSON.parse(E.data);
666
- } catch {
667
- return S.UNPARSABLE_JSON_OBJECT;
668
- }
669
- return null;
670
- }, [E, t.disableJson]), A = (0, v.useRef)(null), k = (0, v.useRef)(null), se = (0, v.useRef)(function() {
671
- }), le = (0, v.useRef)(0), Ie = (0, v.useRef)(Date.now()), be = (0, v.useRef)([]), J = (0, v.useRef)(null), L = (0, v.useRef)(t);
672
- L.current = t;
673
- var G = A.current && C[A.current] !== void 0 ? C[A.current] : i !== null && n === !0 ? S.ReadyState.CONNECTING : S.ReadyState.UNINSTANTIATED, X = t.queryParams ? JSON.stringify(t.queryParams) : null, $ = (0, v.useCallback)(function(D, j) {
674
- var Y;
675
- if (j === void 0 && (j = !0), S.isEventSourceSupported && k.current instanceof EventSource) {
676
- console.warn("Unable to send a message from an eventSource");
677
- return;
269
+ function Nr(e, s, g) {
270
+ return Be(e, !1);
271
+ }
272
+ function Mr(e) {
273
+ var s = e.prototype;
274
+ return !!(s && s.isReactComponent);
275
+ }
276
+ function me(e, s, g) {
277
+ if (e == null)
278
+ return "";
279
+ if (typeof e == "function")
280
+ return Be(e, Mr(e));
281
+ if (typeof e == "string")
282
+ return ue(e);
283
+ switch (e) {
284
+ case l:
285
+ return ue("Suspense");
286
+ case o:
287
+ return ue("SuspenseList");
678
288
  }
679
- ((Y = k.current) === null || Y === void 0 ? void 0 : Y.readyState) === S.ReadyState.OPEN ? ((0, u.assertIsWebSocket)(k.current, L.current.skipAssert), k.current.send(D)) : j && be.current.push(D);
680
- }, []), ge = (0, v.useCallback)(function(D, j) {
681
- j === void 0 && (j = !0), $(JSON.stringify(D), j);
682
- }, [$]), Oe = (0, v.useCallback)(function() {
683
- return L.current.share !== !0 || S.isEventSourceSupported && k.current instanceof EventSource ? k.current : (J.current === null && k.current && ((0, u.assertIsWebSocket)(k.current, L.current.skipAssert), J.current = (0, l.default)(k.current, se)), J.current);
684
- }, []);
685
- return (0, v.useEffect)(function() {
686
- if (i !== null && n === !0) {
687
- var D, j = !1, Y = !0, fe = function() {
688
- return g(void 0, void 0, void 0, function() {
689
- var Z, z, pe;
690
- return O(this, function(ue) {
691
- switch (ue.label) {
692
- case 0:
693
- return Z = A, [4, (0, c.getUrl)(i, L)];
694
- case 1:
695
- return Z.current = ue.sent(), A.current === null ? (console.error("Failed to get a valid URL. WebSocket connection aborted."), A.current = "ABORTED", (0, _.flushSync)(function() {
696
- return P(function(B) {
697
- return r(r({}, B), { ABORTED: S.ReadyState.CLOSED });
698
- });
699
- }), [
700
- 2
701
- /*return*/
702
- ]) : (z = function(B) {
703
- j || (0, _.flushSync)(function() {
704
- return o(B);
705
- });
706
- }, pe = function(B) {
707
- j || (0, _.flushSync)(function() {
708
- return P(function(oe) {
709
- var ee;
710
- return r(r({}, oe), A.current && (ee = {}, ee[A.current] = B, ee));
711
- });
712
- });
713
- }, Y && (D = (0, d.createOrJoinSocket)(k, A.current, pe, L, z, se, le, Ie, $)), [
714
- 2
715
- /*return*/
716
- ]);
289
+ if (typeof e == "object")
290
+ switch (e.$$typeof) {
291
+ case c:
292
+ return Nr(e.render);
293
+ case a:
294
+ return me(e.type, s, g);
295
+ case i: {
296
+ var p = e, w = p._payload, I = p._init;
297
+ try {
298
+ return me(I(w), s, g);
299
+ } catch {
300
+ }
301
+ }
302
+ }
303
+ return "";
304
+ }
305
+ var ve = Object.prototype.hasOwnProperty, Ke = {}, xe = u.ReactDebugCurrentFrame;
306
+ function Re(e) {
307
+ if (e) {
308
+ var s = e._owner, g = me(e.type, e._source, s ? s.type : null);
309
+ xe.setExtraStackFrame(g);
310
+ } else
311
+ xe.setExtraStackFrame(null);
312
+ }
313
+ function Dr(e, s, g, p, w) {
314
+ {
315
+ var I = Function.call.bind(ve);
316
+ for (var R in e)
317
+ if (I(e, R)) {
318
+ var m = void 0;
319
+ try {
320
+ if (typeof e[R] != "function") {
321
+ var U = Error((p || "React class") + ": " + g + " type `" + R + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[R] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
322
+ throw U.name = "Invariant Violation", U;
717
323
  }
718
- });
719
- });
324
+ m = e[R](s, R, p, g, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
325
+ } catch (N) {
326
+ m = N;
327
+ }
328
+ m && !(m instanceof Error) && (Re(w), y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", p || "React class", g, R, typeof m), Re(null)), m instanceof Error && !(m.message in Ke) && (Ke[m.message] = !0, Re(w), y("Failed %s type: %s", g, m.message), Re(null));
329
+ }
330
+ }
331
+ }
332
+ var Lr = Array.isArray;
333
+ function ke(e) {
334
+ return Lr(e);
335
+ }
336
+ function jr(e) {
337
+ {
338
+ var s = typeof Symbol == "function" && Symbol.toStringTag, g = s && e[Symbol.toStringTag] || e.constructor.name || "Object";
339
+ return g;
340
+ }
341
+ }
342
+ function Ur(e) {
343
+ try {
344
+ return Qe(e), !1;
345
+ } catch {
346
+ return !0;
347
+ }
348
+ }
349
+ function Qe(e) {
350
+ return "" + e;
351
+ }
352
+ function ze(e) {
353
+ if (Ur(e))
354
+ return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", jr(e)), Qe(e);
355
+ }
356
+ var Xe = u.ReactCurrentOwner, Wr = {
357
+ key: !0,
358
+ ref: !0,
359
+ __self: !0,
360
+ __source: !0
361
+ }, Ze, er;
362
+ function Fr(e) {
363
+ if (ve.call(e, "ref")) {
364
+ var s = Object.getOwnPropertyDescriptor(e, "ref").get;
365
+ if (s && s.isReactWarning)
366
+ return !1;
367
+ }
368
+ return e.ref !== void 0;
369
+ }
370
+ function qr(e) {
371
+ if (ve.call(e, "key")) {
372
+ var s = Object.getOwnPropertyDescriptor(e, "key").get;
373
+ if (s && s.isReactWarning)
374
+ return !1;
375
+ }
376
+ return e.key !== void 0;
377
+ }
378
+ function Gr(e, s) {
379
+ typeof e.ref == "string" && Xe.current;
380
+ }
381
+ function Jr(e, s) {
382
+ {
383
+ var g = function() {
384
+ Ze || (Ze = !0, y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
720
385
  };
721
- return se.current = function() {
722
- j || (J.current && (J.current = null), D?.(), fe());
723
- }, fe(), function() {
724
- j = !0, Y = !1, J.current && (J.current = null), D?.(), o(null);
386
+ g.isReactWarning = !0, Object.defineProperty(e, "key", {
387
+ get: g,
388
+ configurable: !0
389
+ });
390
+ }
391
+ }
392
+ function Hr(e, s) {
393
+ {
394
+ var g = function() {
395
+ er || (er = !0, y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
725
396
  };
726
- } else (i === null || n === !1) && (le.current = 0, P(function(Z) {
727
- var z;
728
- return r(r({}, Z), A.current && (z = {}, z[A.current] = S.ReadyState.CLOSED, z));
729
- }));
730
- }, [i, n, X, $]), (0, v.useEffect)(function() {
731
- G === S.ReadyState.OPEN && be.current.splice(0).forEach(function(D) {
732
- $(D);
733
- });
734
- }, [G]), {
735
- sendMessage: $,
736
- sendJsonMessage: ge,
737
- lastMessage: E,
738
- lastJsonMessage: T,
739
- readyState: G,
740
- getWebSocket: Oe
741
- };
742
- };
743
- return F.useWebSocket = a, F;
744
- }
745
- var ae = {}, Or;
746
- function ht() {
747
- if (Or) return ae;
748
- Or = 1;
749
- var r = ae && ae.__assign || function() {
750
- return r = Object.assign || function(d) {
751
- for (var c, l = 1, u = arguments.length; l < u; l++) {
752
- c = arguments[l];
753
- for (var a in c) Object.prototype.hasOwnProperty.call(c, a) && (d[a] = c[a]);
397
+ g.isReactWarning = !0, Object.defineProperty(e, "ref", {
398
+ get: g,
399
+ configurable: !0
400
+ });
754
401
  }
755
- return d;
756
- }, r.apply(this, arguments);
757
- };
758
- Object.defineProperty(ae, "__esModule", { value: !0 }), ae.useSocketIO = void 0;
759
- var g = ye, O = Ye(), h = H(), v = {
760
- type: "empty",
761
- payload: null
762
- }, _ = function(d) {
763
- if (!d || !d.data)
764
- return v;
765
- var c = d.data.match(/\[.*]/);
766
- if (!c)
767
- return v;
768
- var l = JSON.parse(c);
769
- return !Array.isArray(l) || !l[1] ? v : {
770
- type: l[0],
771
- payload: l[1]
772
- };
773
- }, S = function(d, c, l) {
774
- c === void 0 && (c = h.DEFAULT_OPTIONS), l === void 0 && (l = !0);
775
- var u = (0, g.useMemo)(function() {
776
- return r(r({}, c), { fromSocketIO: !0 });
777
- }, []), a = (0, O.useWebSocket)(d, u, l), i = a.sendMessage, t = a.sendJsonMessage, n = a.lastMessage, f = a.readyState, E = a.getWebSocket, o = (0, g.useMemo)(function() {
778
- return _(n);
779
- }, [n]);
780
- return {
781
- sendMessage: i,
782
- sendJsonMessage: t,
783
- lastMessage: o,
784
- lastJsonMessage: o,
785
- readyState: f,
786
- getWebSocket: E
402
+ }
403
+ var Vr = function(e, s, g, p, w, I, R) {
404
+ var m = {
405
+ // This tag allows us to uniquely identify this as a React Element
406
+ $$typeof: b,
407
+ // Built-in properties that belong on the element
408
+ type: e,
409
+ key: s,
410
+ ref: g,
411
+ props: R,
412
+ // Record the component responsible for creating this element.
413
+ _owner: I
414
+ };
415
+ return m._store = {}, Object.defineProperty(m._store, "validated", {
416
+ configurable: !1,
417
+ enumerable: !1,
418
+ writable: !0,
419
+ value: !1
420
+ }), Object.defineProperty(m, "_self", {
421
+ configurable: !1,
422
+ enumerable: !1,
423
+ writable: !1,
424
+ value: p
425
+ }), Object.defineProperty(m, "_source", {
426
+ configurable: !1,
427
+ enumerable: !1,
428
+ writable: !1,
429
+ value: w
430
+ }), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
787
431
  };
788
- };
789
- return ae.useSocketIO = S, ae;
790
- }
791
- var Q = {}, pr;
792
- function yt() {
793
- if (pr) return Q;
794
- pr = 1;
795
- var r = Q && Q.__assign || function() {
796
- return r = Object.assign || function(S) {
797
- for (var d, c = 1, l = arguments.length; c < l; c++) {
798
- d = arguments[c];
799
- for (var u in d) Object.prototype.hasOwnProperty.call(d, u) && (S[u] = d[u]);
800
- }
801
- return S;
802
- }, r.apply(this, arguments);
803
- }, g = Q && Q.__rest || function(S, d) {
804
- var c = {};
805
- for (var l in S) Object.prototype.hasOwnProperty.call(S, l) && d.indexOf(l) < 0 && (c[l] = S[l]);
806
- if (S != null && typeof Object.getOwnPropertySymbols == "function")
807
- for (var u = 0, l = Object.getOwnPropertySymbols(S); u < l.length; u++)
808
- d.indexOf(l[u]) < 0 && Object.prototype.propertyIsEnumerable.call(S, l[u]) && (c[l[u]] = S[l[u]]);
809
- return c;
810
- };
811
- Object.defineProperty(Q, "__esModule", { value: !0 }), Q.useEventSource = void 0;
812
- var O = ye, h = Ye(), v = H(), _ = function(S, d, c) {
813
- d === void 0 && (d = v.DEFAULT_EVENT_SOURCE_OPTIONS);
814
- var l = d.withCredentials, u = d.events, a = g(d, ["withCredentials", "events"]);
815
- c === void 0 && (c = !0);
816
- var i = r(r({}, a), { eventSourceOptions: {
817
- withCredentials: l
818
- } }), t = (0, O.useRef)(v.EMPTY_EVENT_HANDLERS);
819
- u && (t.current = u);
820
- var n = (0, h.useWebSocket)(S, i, c), f = n.lastMessage, E = n.readyState, o = n.getWebSocket;
821
- return (0, O.useEffect)(function() {
822
- f?.type && Object.entries(t.current).forEach(function(y) {
823
- var C = y[0], P = y[1];
824
- C === f.type && P(f);
825
- });
826
- }, [f]), {
827
- lastEvent: f,
828
- readyState: E,
829
- getEventSource: o
830
- };
831
- };
832
- return Q.useEventSource = _, Q;
833
- }
834
- var Tr;
835
- function bt() {
836
- return Tr || (Tr = 1, (function(r) {
837
- Object.defineProperty(r, "__esModule", { value: !0 }), r.resetGlobalState = r.useEventSource = r.ReadyState = r.useSocketIO = r.default = void 0;
838
- var g = Ye();
839
- Object.defineProperty(r, "default", { enumerable: !0, get: function() {
840
- return g.useWebSocket;
841
- } });
842
- var O = ht();
843
- Object.defineProperty(r, "useSocketIO", { enumerable: !0, get: function() {
844
- return O.useSocketIO;
845
- } });
846
- var h = H();
847
- Object.defineProperty(r, "ReadyState", { enumerable: !0, get: function() {
848
- return h.ReadyState;
849
- } });
850
- var v = yt();
851
- Object.defineProperty(r, "useEventSource", { enumerable: !0, get: function() {
852
- return v.useEventSource;
853
- } });
854
- var _ = $e();
855
- Object.defineProperty(r, "resetGlobalState", { enumerable: !0, get: function() {
856
- return _.resetGlobalState;
857
- } });
858
- })(je)), je;
859
- }
860
- var gt = bt();
861
- const Ot = /* @__PURE__ */ ft(gt), V = {
862
- DEPOSIT: "deposit",
863
- TRANS_CODE: "transCode",
864
- ERROR: "error",
865
- UPDATE_MEMBER: "update_member",
866
- MAINTAIN_NOTICE: "maintain_notice",
867
- MAINTAIN_NOTICE_MEMBER: "maintain_notice_member",
868
- RELOAD: "reload",
869
- TRANSFER_IN_GAME: "transfer_in_game",
870
- CHECK_REQUEST: "CHECK_RREQUEST",
871
- CASH_REGISTER_LIMIT: "cash_register_limit"
872
- }, pt = 3e4, Nt = ({
873
- socketUrl: r,
874
- socketHandlers: g = {},
875
- options: O = {}
876
- }) => {
877
- const h = ir(!1), v = ir(g), {
878
- sendMessage: _,
879
- // 發送普通訊息
880
- sendJsonMessage: S,
881
- // 發送 JSON 訊息
882
- lastMessage: d,
883
- // 最後接收到的訊息
884
- // lastJsonMessage, // 最後接收到的 JSON 訊息
885
- readyState: c
886
- // WebSocket 連線狀態
887
- // getWebSocket, // 獲取 WebSocket 實例
888
- } = Ot(r, {
889
- queryParams: { key: "wsky" },
890
- onOpen: () => console.log("連線成功"),
891
- shouldReconnect: () => h.current === !1,
892
- reconnectAttempts: 9999,
893
- reconnectInterval: 1e3,
894
- ...O
895
- }), l = Ge(() => {
896
- try {
897
- return JSON.parse(d?.data);
898
- } catch {
899
- return null;
432
+ function $r(e, s, g, p, w) {
433
+ {
434
+ var I, R = {}, m = null, U = null;
435
+ g !== void 0 && (ze(g), m = "" + g), qr(s) && (ze(s.key), m = "" + s.key), Fr(s) && (U = s.ref, Gr(s, w));
436
+ for (I in s)
437
+ ve.call(s, I) && !Wr.hasOwnProperty(I) && (R[I] = s[I]);
438
+ if (e && e.defaultProps) {
439
+ var N = e.defaultProps;
440
+ for (I in N)
441
+ R[I] === void 0 && (R[I] = N[I]);
442
+ }
443
+ if (m || U) {
444
+ var M = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
445
+ m && Jr(R, M), U && Hr(R, M);
446
+ }
447
+ return Vr(e, m, U, w, p, Xe.current, R);
448
+ }
900
449
  }
901
- }, [d?.data]);
902
- return Ce(() => {
903
- const u = setInterval(
904
- () => _("ping"),
905
- pt
906
- );
907
- return () => clearInterval(u);
908
- }, [_]), Ce(() => {
909
- v.current = g;
910
- }, [g]), Ce(() => {
911
- if (!l) return;
912
- const {
913
- onDeposit: u,
914
- onTransCode: a,
915
- onError: i,
916
- onUpdateMember: t,
917
- onMaintainNotice: n,
918
- onMaintainNoticeMember: f,
919
- onReload: E,
920
- onTransferInGame: o,
921
- onCashRegisterLimit: y
922
- } = v.current, C = we(l, "type", ""), P = {
923
- memberInfoUid: we(l, "member_info_uid", null),
924
- data: we(l, "data", null),
925
- memo: we(l, "memo", null)
926
- };
927
- switch (C) {
928
- case V.DEPOSIT:
929
- u?.(P);
930
- break;
931
- case V.TRANS_CODE:
932
- a?.(P);
933
- break;
934
- case V.ERROR:
935
- i?.(P);
936
- break;
937
- case V.UPDATE_MEMBER:
938
- t?.(P);
939
- break;
940
- case V.MAINTAIN_NOTICE:
941
- n?.(P);
942
- break;
943
- case V.MAINTAIN_NOTICE_MEMBER:
944
- f?.(P);
945
- break;
946
- case V.RELOAD:
947
- E?.(P);
948
- break;
949
- case V.TRANSFER_IN_GAME:
950
- case V.CHECK_REQUEST:
951
- o?.(P);
952
- break;
953
- case V.CASH_REGISTER_LIMIT:
954
- y?.(P);
955
- break;
956
- default:
957
- console.warn("Unknown socket type:", C);
958
- break;
450
+ var Ne = u.ReactCurrentOwner, rr = u.ReactDebugCurrentFrame;
451
+ function ce(e) {
452
+ if (e) {
453
+ var s = e._owner, g = me(e.type, e._source, s ? s.type : null);
454
+ rr.setExtraStackFrame(g);
455
+ } else
456
+ rr.setExtraStackFrame(null);
959
457
  }
960
- }, [l]), Ce(() => () => h.current = !0, []), {
961
- sendMessage: _,
962
- sendJsonMessage: S,
963
- readyState: c
964
- // WebSocket 連線狀態
965
- };
966
- };
967
- var Pe = { exports: {} }, Se = {};
968
- /**
969
- * @license React
970
- * react-jsx-runtime.production.min.js
971
- *
972
- * Copyright (c) Facebook, Inc. and its affiliates.
973
- *
974
- * This source code is licensed under the MIT license found in the
975
- * LICENSE file in the root directory of this source tree.
976
- */
977
- var mr;
978
- function Tt() {
979
- if (mr) return Se;
980
- mr = 1;
981
- var r = ye, g = Symbol.for("react.element"), O = Symbol.for("react.fragment"), h = Object.prototype.hasOwnProperty, v = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, _ = { key: !0, ref: !0, __self: !0, __source: !0 };
982
- function S(d, c, l) {
983
- var u, a = {}, i = null, t = null;
984
- l !== void 0 && (i = "" + l), c.key !== void 0 && (i = "" + c.key), c.ref !== void 0 && (t = c.ref);
985
- for (u in c) h.call(c, u) && !_.hasOwnProperty(u) && (a[u] = c[u]);
986
- if (d && d.defaultProps) for (u in c = d.defaultProps, c) a[u] === void 0 && (a[u] = c[u]);
987
- return { $$typeof: g, type: d, key: i, ref: t, props: a, _owner: v.current };
988
- }
989
- return Se.Fragment = O, Se.jsx = S, Se.jsxs = S, Se;
990
- }
991
- var he = {};
992
- /**
993
- * @license React
994
- * react-jsx-runtime.development.js
995
- *
996
- * Copyright (c) Facebook, Inc. and its affiliates.
997
- *
998
- * This source code is licensed under the MIT license found in the
999
- * LICENSE file in the root directory of this source tree.
1000
- */
1001
- var Rr;
1002
- function mt() {
1003
- return Rr || (Rr = 1, process.env.NODE_ENV !== "production" && (function() {
1004
- var r = ye, g = Symbol.for("react.element"), O = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), S = Symbol.for("react.provider"), d = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), a = Symbol.for("react.memo"), i = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), n = Symbol.iterator, f = "@@iterator";
1005
- function E(e) {
1006
- if (e === null || typeof e != "object")
1007
- return null;
1008
- var s = n && e[n] || e[f];
1009
- return typeof s == "function" ? s : null;
458
+ var Me;
459
+ Me = !1;
460
+ function De(e) {
461
+ return typeof e == "object" && e !== null && e.$$typeof === b;
1010
462
  }
1011
- var o = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
1012
- function y(e) {
463
+ function tr() {
1013
464
  {
1014
- for (var s = arguments.length, b = new Array(s > 1 ? s - 1 : 0), p = 1; p < s; p++)
1015
- b[p - 1] = arguments[p];
1016
- C("error", e, b);
465
+ if (Ne.current) {
466
+ var e = L(Ne.current.type);
467
+ if (e)
468
+ return `
469
+
470
+ Check the render method of \`` + e + "`.";
471
+ }
472
+ return "";
1017
473
  }
1018
474
  }
1019
- function C(e, s, b) {
475
+ function Yr(e) {
476
+ return "";
477
+ }
478
+ var nr = {};
479
+ function Br(e) {
1020
480
  {
1021
- var p = o.ReactDebugCurrentFrame, w = p.getStackAddendum();
1022
- w !== "" && (s += "%s", b = b.concat([w]));
1023
- var I = b.map(function(R) {
1024
- return String(R);
1025
- });
1026
- I.unshift("Warning: " + s), Function.prototype.apply.call(console[e], console, I);
481
+ var s = tr();
482
+ if (!s) {
483
+ var g = typeof e == "string" ? e : e.displayName || e.name;
484
+ g && (s = `
485
+
486
+ Check the top-level render call using <` + g + ">.");
487
+ }
488
+ return s;
1027
489
  }
1028
490
  }
1029
- var P = !1, T = !1, A = !1, k = !1, se = !1, le;
1030
- le = Symbol.for("react.module.reference");
1031
- function Ie(e) {
1032
- return !!(typeof e == "string" || typeof e == "function" || e === h || e === _ || se || e === v || e === l || e === u || k || e === t || P || T || A || typeof e == "object" && e !== null && (e.$$typeof === i || e.$$typeof === a || e.$$typeof === S || e.$$typeof === d || e.$$typeof === c || // This needs to include all possible module reference object
1033
- // types supported by any Flight configuration anywhere since
1034
- // we don't know which Flight build this will end up being used
1035
- // with.
1036
- e.$$typeof === le || e.getModuleId !== void 0));
1037
- }
1038
- function be(e, s, b) {
1039
- var p = e.displayName;
1040
- if (p)
1041
- return p;
1042
- var w = s.displayName || s.name || "";
1043
- return w !== "" ? b + "(" + w + ")" : b;
1044
- }
1045
- function J(e) {
1046
- return e.displayName || "Context";
1047
- }
1048
- function L(e) {
1049
- if (e == null)
1050
- return null;
1051
- if (typeof e.tag == "number" && y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
1052
- return e.displayName || e.name || null;
1053
- if (typeof e == "string")
1054
- return e;
1055
- switch (e) {
1056
- case h:
1057
- return "Fragment";
1058
- case O:
1059
- return "Portal";
1060
- case _:
1061
- return "Profiler";
1062
- case v:
1063
- return "StrictMode";
1064
- case l:
1065
- return "Suspense";
1066
- case u:
1067
- return "SuspenseList";
491
+ function ar(e, s) {
492
+ {
493
+ if (!e._store || e._store.validated || e.key != null)
494
+ return;
495
+ e._store.validated = !0;
496
+ var g = Br(s);
497
+ if (nr[g])
498
+ return;
499
+ nr[g] = !0;
500
+ var p = "";
501
+ e && e._owner && e._owner !== Ne.current && (p = " It was passed a child from " + L(e._owner.type) + "."), ce(e), y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', g, p), ce(null);
1068
502
  }
1069
- if (typeof e == "object")
1070
- switch (e.$$typeof) {
1071
- case d:
1072
- var s = e;
1073
- return J(s) + ".Consumer";
1074
- case S:
1075
- var b = e;
1076
- return J(b._context) + ".Provider";
1077
- case c:
1078
- return be(e, e.render, "ForwardRef");
1079
- case a:
1080
- var p = e.displayName || null;
1081
- return p !== null ? p : L(e.type) || "Memo";
1082
- case i: {
1083
- var w = e, I = w._payload, R = w._init;
1084
- try {
1085
- return L(R(I));
1086
- } catch {
1087
- return null;
1088
- }
1089
- }
1090
- }
1091
- return null;
1092
503
  }
1093
- var G = Object.assign, X = 0, $, ge, Oe, D, j, Y, fe;
1094
- function Z() {
1095
- }
1096
- Z.__reactDisabledLog = !0;
1097
- function z() {
504
+ function or(e, s) {
1098
505
  {
1099
- if (X === 0) {
1100
- $ = console.log, ge = console.info, Oe = console.warn, D = console.error, j = console.group, Y = console.groupCollapsed, fe = console.groupEnd;
1101
- var e = {
1102
- configurable: !0,
1103
- enumerable: !0,
1104
- value: Z,
1105
- writable: !0
1106
- };
1107
- Object.defineProperties(console, {
1108
- info: e,
1109
- log: e,
1110
- warn: e,
1111
- error: e,
1112
- group: e,
1113
- groupCollapsed: e,
1114
- groupEnd: e
1115
- });
506
+ if (typeof e != "object")
507
+ return;
508
+ if (ke(e))
509
+ for (var g = 0; g < e.length; g++) {
510
+ var p = e[g];
511
+ De(p) && ar(p, s);
512
+ }
513
+ else if (De(e))
514
+ e._store && (e._store.validated = !0);
515
+ else if (e) {
516
+ var w = h(e);
517
+ if (typeof w == "function" && w !== e.entries)
518
+ for (var I = w.call(e), R; !(R = I.next()).done; )
519
+ De(R.value) && ar(R.value, s);
1116
520
  }
1117
- X++;
1118
521
  }
1119
522
  }
1120
- function pe() {
523
+ function Kr(e) {
1121
524
  {
1122
- if (X--, X === 0) {
1123
- var e = {
1124
- configurable: !0,
1125
- enumerable: !0,
1126
- writable: !0
1127
- };
1128
- Object.defineProperties(console, {
1129
- log: G({}, e, {
1130
- value: $
1131
- }),
1132
- info: G({}, e, {
1133
- value: ge
1134
- }),
1135
- warn: G({}, e, {
1136
- value: Oe
1137
- }),
1138
- error: G({}, e, {
1139
- value: D
1140
- }),
1141
- group: G({}, e, {
1142
- value: j
1143
- }),
1144
- groupCollapsed: G({}, e, {
1145
- value: Y
1146
- }),
1147
- groupEnd: G({}, e, {
1148
- value: fe
1149
- })
1150
- });
525
+ var s = e.type;
526
+ if (s == null || typeof s == "string")
527
+ return;
528
+ var g;
529
+ if (typeof s == "function")
530
+ g = s.propTypes;
531
+ else if (typeof s == "object" && (s.$$typeof === c || // Note: Memo only checks outer props here.
532
+ // Inner props are checked in the reconciler.
533
+ s.$$typeof === a))
534
+ g = s.propTypes;
535
+ else
536
+ return;
537
+ if (g) {
538
+ var p = L(s);
539
+ Dr(g, e.props, "prop", p, e);
540
+ } else if (s.PropTypes !== void 0 && !Me) {
541
+ Me = !0;
542
+ var w = L(s);
543
+ y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", w || "Unknown");
1151
544
  }
1152
- X < 0 && y("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
545
+ typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
1153
546
  }
1154
547
  }
1155
- var ue = o.ReactCurrentDispatcher, B;
1156
- function oe(e, s, b) {
548
+ function xr(e) {
1157
549
  {
1158
- if (B === void 0)
1159
- try {
1160
- throw Error();
1161
- } catch (w) {
1162
- var p = w.stack.trim().match(/\n( *(at )?)/);
1163
- B = p && p[1] || "";
550
+ for (var s = Object.keys(e.props), g = 0; g < s.length; g++) {
551
+ var p = s[g];
552
+ if (p !== "children" && p !== "key") {
553
+ ce(e), y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", p), ce(null);
554
+ break;
1164
555
  }
1165
- return `
1166
- ` + B + e;
556
+ }
557
+ e.ref !== null && (ce(e), y("Invalid attribute `ref` supplied to `React.Fragment`."), ce(null));
1167
558
  }
1168
559
  }
1169
- var ee = !1, Te;
1170
- {
1171
- var kr = typeof WeakMap == "function" ? WeakMap : Map;
1172
- Te = new kr();
1173
- }
1174
- function Be(e, s) {
1175
- if (!e || ee)
1176
- return "";
560
+ var ur = {};
561
+ function cr(e, s, g, p, w, I) {
1177
562
  {
1178
- var b = Te.get(e);
1179
- if (b !== void 0)
1180
- return b;
1181
- }
1182
- var p;
1183
- ee = !0;
1184
- var w = Error.prepareStackTrace;
1185
- Error.prepareStackTrace = void 0;
1186
- var I;
1187
- I = ue.current, ue.current = null, z();
1188
- try {
1189
- if (s) {
1190
- var R = function() {
1191
- throw Error();
1192
- };
1193
- if (Object.defineProperty(R.prototype, "props", {
1194
- set: function() {
1195
- throw Error();
1196
- }
1197
- }), typeof Reflect == "object" && Reflect.construct) {
1198
- try {
1199
- Reflect.construct(R, []);
1200
- } catch (W) {
1201
- p = W;
1202
- }
1203
- Reflect.construct(e, [], R);
1204
- } else {
1205
- try {
1206
- R.call();
1207
- } catch (W) {
1208
- p = W;
1209
- }
1210
- e.call(R.prototype);
1211
- }
1212
- } else {
1213
- try {
1214
- throw Error();
1215
- } catch (W) {
1216
- p = W;
1217
- }
1218
- e();
563
+ var R = Ie(e);
564
+ if (!R) {
565
+ var m = "";
566
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (m += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
567
+ var U = Yr();
568
+ U ? m += U : m += tr();
569
+ var N;
570
+ e === null ? N = "null" : ke(e) ? N = "array" : e !== void 0 && e.$$typeof === b ? (N = "<" + (L(e.type) || "Unknown") + " />", m = " Did you accidentally export a JSX literal instead of a component?") : N = typeof e, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", N, m);
1219
571
  }
1220
- } catch (W) {
1221
- if (W && p && typeof W.stack == "string") {
1222
- for (var m = W.stack.split(`
1223
- `), U = p.stack.split(`
1224
- `), N = m.length - 1, M = U.length - 1; N >= 1 && M >= 0 && m[N] !== U[M]; )
1225
- M--;
1226
- for (; N >= 1 && M >= 0; N--, M--)
1227
- if (m[N] !== U[M]) {
1228
- if (N !== 1 || M !== 1)
1229
- do
1230
- if (N--, M--, M < 0 || m[N] !== U[M]) {
1231
- var q = `
1232
- ` + m[N].replace(" at new ", " at ");
1233
- return e.displayName && q.includes("<anonymous>") && (q = q.replace("<anonymous>", e.displayName)), typeof e == "function" && Te.set(e, q), q;
1234
- }
1235
- while (N >= 1 && M >= 0);
1236
- break;
1237
- }
572
+ var M = $r(e, s, g, w, I);
573
+ if (M == null)
574
+ return M;
575
+ if (R) {
576
+ var q = s.children;
577
+ if (q !== void 0)
578
+ if (p)
579
+ if (ke(q)) {
580
+ for (var ie = 0; ie < q.length; ie++)
581
+ or(q[ie], e);
582
+ Object.freeze && Object.freeze(q);
583
+ } else
584
+ y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
585
+ else
586
+ or(q, e);
1238
587
  }
1239
- } finally {
1240
- ee = !1, ue.current = I, pe(), Error.prepareStackTrace = w;
1241
- }
1242
- var ie = e ? e.displayName || e.name : "", re = ie ? oe(ie) : "";
1243
- return typeof e == "function" && Te.set(e, re), re;
1244
- }
1245
- function Nr(e, s, b) {
1246
- return Be(e, !1);
1247
- }
1248
- function Mr(e) {
1249
- var s = e.prototype;
1250
- return !!(s && s.isReactComponent);
1251
- }
1252
- function me(e, s, b) {
1253
- if (e == null)
1254
- return "";
1255
- if (typeof e == "function")
1256
- return Be(e, Mr(e));
1257
- if (typeof e == "string")
1258
- return oe(e);
1259
- switch (e) {
1260
- case l:
1261
- return oe("Suspense");
1262
- case u:
1263
- return oe("SuspenseList");
1264
- }
1265
- if (typeof e == "object")
1266
- switch (e.$$typeof) {
1267
- case c:
1268
- return Nr(e.render);
1269
- case a:
1270
- return me(e.type, s, b);
1271
- case i: {
1272
- var p = e, w = p._payload, I = p._init;
1273
- try {
1274
- return me(I(w), s, b);
1275
- } catch {
1276
- }
588
+ if (ve.call(s, "key")) {
589
+ var re = L(e), W = Object.keys(s).filter(function(rt) {
590
+ return rt !== "key";
591
+ }), Le = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
592
+ if (!ur[re + Le]) {
593
+ var et = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
594
+ y(`A props object containing a "key" prop is being spread into JSX:
595
+ let props = %s;
596
+ <%s {...props} />
597
+ React keys must be passed directly to JSX without using spread:
598
+ let props = %s;
599
+ <%s key={someKey} {...props} />`, Le, re, et, re), ur[re + Le] = !0;
1277
600
  }
1278
601
  }
1279
- return "";
602
+ return e === _ ? xr(M) : Kr(M), M;
603
+ }
1280
604
  }
1281
- var ve = Object.prototype.hasOwnProperty, Ke = {}, xe = o.ReactDebugCurrentFrame;
1282
- function Re(e) {
1283
- if (e) {
1284
- var s = e._owner, b = me(e.type, e._source, s ? s.type : null);
1285
- xe.setExtraStackFrame(b);
1286
- } else
1287
- xe.setExtraStackFrame(null);
605
+ function Qr(e, s, g) {
606
+ return cr(e, s, g, !0);
1288
607
  }
1289
- function Dr(e, s, b, p, w) {
1290
- {
1291
- var I = Function.call.bind(ve);
1292
- for (var R in e)
1293
- if (I(e, R)) {
1294
- var m = void 0;
1295
- try {
1296
- if (typeof e[R] != "function") {
1297
- var U = Error((p || "React class") + ": " + b + " type `" + R + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[R] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
1298
- throw U.name = "Invariant Violation", U;
1299
- }
1300
- m = e[R](s, R, p, b, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
1301
- } catch (N) {
1302
- m = N;
1303
- }
1304
- m && !(m instanceof Error) && (Re(w), y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", p || "React class", b, R, typeof m), Re(null)), m instanceof Error && !(m.message in Ke) && (Ke[m.message] = !0, Re(w), y("Failed %s type: %s", b, m.message), Re(null));
1305
- }
1306
- }
608
+ function zr(e, s, g) {
609
+ return cr(e, s, g, !1);
1307
610
  }
1308
- var Lr = Array.isArray;
1309
- function ke(e) {
1310
- return Lr(e);
611
+ var Xr = zr, Zr = Qr;
612
+ Ee.Fragment = _, Ee.jsx = Xr, Ee.jsxs = Zr;
613
+ })()), Ee;
614
+ }
615
+ var fr;
616
+ function vt() {
617
+ return fr || (fr = 1, process.env.NODE_ENV === "production" ? Ae.exports = lt() : Ae.exports = ft()), Ae.exports;
618
+ }
619
+ var vr = vt();
620
+ const Ar = tt(null), Pr = () => {
621
+ const r = nt(Ar);
622
+ if (!r)
623
+ throw new Error("useApiContext must be used within ApiProvider");
624
+ return r;
625
+ };
626
+ function dt({
627
+ baseURL: r,
628
+ getToken: b,
629
+ timeoutMs: O = 15e3,
630
+ currency: _ = "TWD",
631
+ lng: f = "tw",
632
+ onError: E
633
+ } = {}) {
634
+ const S = ct.create({
635
+ baseURL: r,
636
+ timeout: O,
637
+ headers: { "Content-Type": "application/json" }
638
+ });
639
+ return S.interceptors.request.use(async (d) => {
640
+ if (d.headers = d.headers || {}, b) {
641
+ const c = await b();
642
+ c && (d.headers.Authorization = `Bearer ${c}`);
1311
643
  }
1312
- function jr(e) {
1313
- {
1314
- var s = typeof Symbol == "function" && Symbol.toStringTag, b = s && e[Symbol.toStringTag] || e.constructor.name || "Object";
1315
- return b;
644
+ return d.headers.Currency = _, d.headers["currency-code"] = _, d.headers.lang = f, d;
645
+ }), S.interceptors.response.use(
646
+ (d) => d.data,
647
+ (d) => E ? E(d, { instance: S }) : Promise.reject(d)
648
+ ), S;
649
+ }
650
+ function kt({ children: r, ...b }) {
651
+ const O = Ge(() => dt(b), [b]), f = Ge(
652
+ () => new at({
653
+ defaultOptions: {
654
+ queries: {
655
+ refetchOnWindowFocus: !1,
656
+ retry: 1
657
+ }
1316
658
  }
1317
- }
1318
- function Ur(e) {
659
+ }),
660
+ []
661
+ );
662
+ return /* @__PURE__ */ vr.jsx(ot, { client: f, children: /* @__PURE__ */ vr.jsx(Ar.Provider, { value: { client: O, ...b }, children: r }) });
663
+ }
664
+ const Nt = () => {
665
+ const r = (_, f) => !_ && !f, b = (_) => _.startsWith("pc.");
666
+ return {
667
+ executeLogout: ({
668
+ isCallBackInvalid: _ = !1,
669
+ hostname: f = "",
670
+ shouldRedirect: E,
671
+ onShowError: S,
672
+ onCleanup: d,
673
+ onRemoveToken: c,
674
+ onRedirect: l,
675
+ onGoogleLogout: o
676
+ }) => {
677
+ const a = b(f);
678
+ r(_, a) && S?.(), d?.(), c?.(), E && l?.("/"), o?.();
679
+ },
680
+ shouldShowErrorNotice: r,
681
+ isMachineDomain: b
682
+ };
683
+ };
684
+ var je = {}, F = {}, Ue = {}, dr;
685
+ function V() {
686
+ return dr || (dr = 1, (function(r) {
687
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.isEventSourceSupported = r.isReactNative = r.ReadyState = r.DEFAULT_HEARTBEAT = r.UNPARSABLE_JSON_OBJECT = r.DEFAULT_RECONNECT_INTERVAL_MS = r.DEFAULT_RECONNECT_LIMIT = r.SOCKET_IO_PING_CODE = r.SOCKET_IO_PATH = r.SOCKET_IO_PING_INTERVAL = r.DEFAULT_EVENT_SOURCE_OPTIONS = r.EMPTY_EVENT_HANDLERS = r.DEFAULT_OPTIONS = void 0;
688
+ var b = 1, O = 1e3 * b;
689
+ r.DEFAULT_OPTIONS = {}, r.EMPTY_EVENT_HANDLERS = {}, r.DEFAULT_EVENT_SOURCE_OPTIONS = {
690
+ withCredentials: !1,
691
+ events: r.EMPTY_EVENT_HANDLERS
692
+ }, r.SOCKET_IO_PING_INTERVAL = 25 * O, r.SOCKET_IO_PATH = "/socket.io/?EIO=3&transport=websocket", r.SOCKET_IO_PING_CODE = "2", r.DEFAULT_RECONNECT_LIMIT = 20, r.DEFAULT_RECONNECT_INTERVAL_MS = 5e3, r.UNPARSABLE_JSON_OBJECT = {}, r.DEFAULT_HEARTBEAT = {
693
+ message: "ping",
694
+ timeout: 6e4,
695
+ interval: 25e3
696
+ };
697
+ var _;
698
+ (function(E) {
699
+ E[E.UNINSTANTIATED = -1] = "UNINSTANTIATED", E[E.CONNECTING = 0] = "CONNECTING", E[E.OPEN = 1] = "OPEN", E[E.CLOSING = 2] = "CLOSING", E[E.CLOSED = 3] = "CLOSED";
700
+ })(_ || (r.ReadyState = _ = {}));
701
+ var f = function() {
1319
702
  try {
1320
- return Qe(e), !1;
703
+ return "EventSource" in globalThis;
1321
704
  } catch {
1322
- return !0;
705
+ return !1;
1323
706
  }
707
+ };
708
+ r.isReactNative = typeof navigator < "u" && navigator.product === "ReactNative", r.isEventSourceSupported = !r.isReactNative && f();
709
+ })(Ue)), Ue;
710
+ }
711
+ var Se = {}, We = {}, _r;
712
+ function Je() {
713
+ return _r || (_r = 1, (function(r) {
714
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.resetWebSockets = r.sharedWebSockets = void 0, r.sharedWebSockets = {};
715
+ var b = function(O) {
716
+ if (O && r.sharedWebSockets.hasOwnProperty(O))
717
+ delete r.sharedWebSockets[O];
718
+ else
719
+ for (var _ in r.sharedWebSockets)
720
+ r.sharedWebSockets.hasOwnProperty(_) && delete r.sharedWebSockets[_];
721
+ };
722
+ r.resetWebSockets = b;
723
+ })(We)), We;
724
+ }
725
+ var te = {}, K = {}, Er;
726
+ function He() {
727
+ if (Er) return K;
728
+ Er = 1, Object.defineProperty(K, "__esModule", { value: !0 }), K.setUpSocketIOPing = K.appendQueryParams = K.parseSocketIOUrl = void 0;
729
+ var r = V(), b = function(f) {
730
+ if (f) {
731
+ var E = /^https|wss/.test(f), S = f.replace(/^(https?|wss?)(:\/\/)?/, ""), d = S.replace(/\/$/, ""), c = E ? "wss" : "ws";
732
+ return "".concat(c, "://").concat(d).concat(r.SOCKET_IO_PATH);
733
+ } else if (f === "") {
734
+ var E = /^https/.test(window.location.protocol), c = E ? "wss" : "ws", l = window.location.port ? ":".concat(window.location.port) : "";
735
+ return "".concat(c, "://").concat(window.location.hostname).concat(l).concat(r.SOCKET_IO_PATH);
1324
736
  }
1325
- function Qe(e) {
1326
- return "" + e;
1327
- }
1328
- function ze(e) {
1329
- if (Ur(e))
1330
- return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", jr(e)), Qe(e);
1331
- }
1332
- var Xe = o.ReactCurrentOwner, Wr = {
1333
- key: !0,
1334
- ref: !0,
1335
- __self: !0,
1336
- __source: !0
1337
- }, Ze, er;
1338
- function Fr(e) {
1339
- if (ve.call(e, "ref")) {
1340
- var s = Object.getOwnPropertyDescriptor(e, "ref").get;
1341
- if (s && s.isReactWarning)
1342
- return !1;
737
+ return f;
738
+ };
739
+ K.parseSocketIOUrl = b;
740
+ var O = function(f, E) {
741
+ E === void 0 && (E = {});
742
+ var S = /\?([\w]+=[\w]+)/, d = S.test(f), c = "".concat(Object.entries(E).reduce(function(l, o) {
743
+ var a = o[0], i = o[1];
744
+ return l + "".concat(a, "=").concat(i, "&");
745
+ }, "").slice(0, -1));
746
+ return "".concat(f).concat(d ? "&" : "?").concat(c);
747
+ };
748
+ K.appendQueryParams = O;
749
+ var _ = function(f, E) {
750
+ E === void 0 && (E = r.SOCKET_IO_PING_INTERVAL);
751
+ var S = function() {
752
+ return f(r.SOCKET_IO_PING_CODE);
753
+ };
754
+ return window.setInterval(S, E);
755
+ };
756
+ return K.setUpSocketIOPing = _, K;
757
+ }
758
+ var Pe = {}, Sr;
759
+ function Ir() {
760
+ if (Sr) return Pe;
761
+ Sr = 1, Object.defineProperty(Pe, "__esModule", { value: !0 }), Pe.heartbeat = O;
762
+ var r = V();
763
+ function b(_) {
764
+ return Array.isArray(_) ? _.reduce(function(f, E) {
765
+ return f.current > E.current ? f : E;
766
+ }).current : _.current;
767
+ }
768
+ function O(_, f, E) {
769
+ var S = E || {}, d = S.interval, c = d === void 0 ? r.DEFAULT_HEARTBEAT.interval : d, l = S.timeout, o = l === void 0 ? r.DEFAULT_HEARTBEAT.timeout : l, a = S.message, i = a === void 0 ? r.DEFAULT_HEARTBEAT.message : a, t = Math.max(100, c / 10), n = Date.now(), v = setInterval(function() {
770
+ var h = Date.now(), u = b(f);
771
+ if (u + o <= h)
772
+ console.warn("Heartbeat timed out, closing connection, last message received ".concat(h - u, "ms ago, last ping sent ").concat(h - n, "ms ago")), _.close();
773
+ else if (u + c <= h && n + c <= h)
774
+ try {
775
+ typeof i == "function" ? _.send(i()) : _.send(i), n = h;
776
+ } catch (y) {
777
+ console.error("Heartbeat failed, closing connection", y instanceof Error ? y.message : y), _.close();
778
+ }
779
+ }, t);
780
+ return _.addEventListener("close", function() {
781
+ clearInterval(v);
782
+ }), function() {
783
+ };
784
+ }
785
+ return Pe;
786
+ }
787
+ var he = {}, Fe = {}, hr;
788
+ function Ve() {
789
+ return hr || (hr = 1, (function(r) {
790
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.resetSubscribers = r.removeSubscriber = r.addSubscriber = r.hasSubscribers = r.getSubscribers = void 0;
791
+ var b = {}, O = [], _ = function(c) {
792
+ return (0, r.hasSubscribers)(c) ? Array.from(b[c]) : O;
793
+ };
794
+ r.getSubscribers = _;
795
+ var f = function(c) {
796
+ var l;
797
+ return ((l = b[c]) === null || l === void 0 ? void 0 : l.size) > 0;
798
+ };
799
+ r.hasSubscribers = f;
800
+ var E = function(c, l) {
801
+ b[c] = b[c] || /* @__PURE__ */ new Set(), b[c].add(l);
802
+ };
803
+ r.addSubscriber = E;
804
+ var S = function(c, l) {
805
+ b[c].delete(l);
806
+ };
807
+ r.removeSubscriber = S;
808
+ var d = function(c) {
809
+ if (c && b.hasOwnProperty(c))
810
+ delete b[c];
811
+ else
812
+ for (var l in b)
813
+ b.hasOwnProperty(l) && delete b[l];
814
+ };
815
+ r.resetSubscribers = d;
816
+ })(Fe)), Fe;
817
+ }
818
+ var yr;
819
+ function $e() {
820
+ if (yr) return he;
821
+ yr = 1, Object.defineProperty(he, "__esModule", { value: !0 }), he.assertIsWebSocket = O, he.resetGlobalState = _;
822
+ var r = Je(), b = Ve();
823
+ function O(f, E) {
824
+ if (!E && !(f instanceof WebSocket))
825
+ throw new Error("");
826
+ }
827
+ function _(f) {
828
+ (0, b.resetSubscribers)(f), (0, r.resetWebSockets)(f);
829
+ }
830
+ return he;
831
+ }
832
+ var br;
833
+ function _t() {
834
+ if (br) return te;
835
+ br = 1;
836
+ var r = te && te.__assign || function() {
837
+ return r = Object.assign || function(o) {
838
+ for (var a, i = 1, t = arguments.length; i < t; i++) {
839
+ a = arguments[i];
840
+ for (var n in a) Object.prototype.hasOwnProperty.call(a, n) && (o[n] = a[n]);
1343
841
  }
1344
- return e.ref !== void 0;
1345
- }
1346
- function qr(e) {
1347
- if (ve.call(e, "key")) {
1348
- var s = Object.getOwnPropertyDescriptor(e, "key").get;
1349
- if (s && s.isReactWarning)
1350
- return !1;
842
+ return o;
843
+ }, r.apply(this, arguments);
844
+ };
845
+ Object.defineProperty(te, "__esModule", { value: !0 }), te.attachListeners = void 0;
846
+ var b = He(), O = Ir(), _ = V(), f = $e(), E = function(o, a, i, t) {
847
+ o.onmessage = function(n) {
848
+ var v;
849
+ a.current.onMessage && a.current.onMessage(n), typeof t?.current == "number" && (t.current = Date.now()), !(typeof a.current.filter == "function" && a.current.filter(n) !== !0) && (a.current.heartbeat && typeof a.current.heartbeat != "boolean" && ((v = a.current.heartbeat) === null || v === void 0 ? void 0 : v.returnMessage) === n.data || i(n));
850
+ };
851
+ }, S = function(o, a, i, t, n) {
852
+ o.onopen = function(v) {
853
+ if (a.current.onOpen && a.current.onOpen(v), t.current = 0, i(_.ReadyState.OPEN), a.current.heartbeat && o instanceof WebSocket) {
854
+ var h = typeof a.current.heartbeat == "boolean" ? void 0 : a.current.heartbeat;
855
+ n.current = Date.now(), (0, O.heartbeat)(o, n, h);
1351
856
  }
1352
- return e.key !== void 0;
1353
- }
1354
- function Gr(e, s) {
1355
- typeof e.ref == "string" && Xe.current;
1356
- }
1357
- function Jr(e, s) {
1358
- {
1359
- var b = function() {
1360
- Ze || (Ze = !0, y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
1361
- };
1362
- b.isReactWarning = !0, Object.defineProperty(e, "key", {
1363
- get: b,
1364
- configurable: !0
1365
- });
857
+ };
858
+ }, d = function(o, a, i, t, n) {
859
+ if (_.isEventSourceSupported && o instanceof EventSource)
860
+ return function() {
861
+ };
862
+ (0, f.assertIsWebSocket)(o, a.current.skipAssert);
863
+ var v;
864
+ return o.onclose = function(h) {
865
+ var u;
866
+ if (a.current.onClose && a.current.onClose(h), i(_.ReadyState.CLOSED), a.current.shouldReconnect && a.current.shouldReconnect(h)) {
867
+ var y = (u = a.current.reconnectAttempts) !== null && u !== void 0 ? u : _.DEFAULT_RECONNECT_LIMIT;
868
+ if (n.current < y) {
869
+ var C = typeof a.current.reconnectInterval == "function" ? a.current.reconnectInterval(n.current) : a.current.reconnectInterval;
870
+ v = window.setTimeout(function() {
871
+ n.current++, t();
872
+ }, C ?? _.DEFAULT_RECONNECT_INTERVAL_MS);
873
+ } else
874
+ a.current.onReconnectStop && a.current.onReconnectStop(y), console.warn("Max reconnect attempts of ".concat(y, " exceeded"));
1366
875
  }
1367
- }
1368
- function Vr(e, s) {
1369
- {
1370
- var b = function() {
1371
- er || (er = !0, y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
1372
- };
1373
- b.isReactWarning = !0, Object.defineProperty(e, "ref", {
1374
- get: b,
1375
- configurable: !0
1376
- });
876
+ }, function() {
877
+ return v && window.clearTimeout(v);
878
+ };
879
+ }, c = function(o, a, i, t, n) {
880
+ var v;
881
+ return o.onerror = function(h) {
882
+ var u;
883
+ if (a.current.onError && a.current.onError(h), _.isEventSourceSupported && o instanceof EventSource && (a.current.onClose && a.current.onClose(r(r({}, h), { code: 1006, reason: "An error occurred with the EventSource: ".concat(h), wasClean: !1 })), i(_.ReadyState.CLOSED), o.close()), a.current.retryOnError)
884
+ if (n.current < ((u = a.current.reconnectAttempts) !== null && u !== void 0 ? u : _.DEFAULT_RECONNECT_LIMIT)) {
885
+ var y = typeof a.current.reconnectInterval == "function" ? a.current.reconnectInterval(n.current) : a.current.reconnectInterval;
886
+ v = window.setTimeout(function() {
887
+ n.current++, t();
888
+ }, y ?? _.DEFAULT_RECONNECT_INTERVAL_MS);
889
+ } else
890
+ a.current.onReconnectStop && a.current.onReconnectStop(a.current.reconnectAttempts), console.warn("Max reconnect attempts of ".concat(a.current.reconnectAttempts, " exceeded"));
891
+ }, function() {
892
+ return v && window.clearTimeout(v);
893
+ };
894
+ }, l = function(o, a, i, t, n, v, h) {
895
+ var u = a.setLastMessage, y = a.setReadyState, C, P, T;
896
+ return i.current.fromSocketIO && (C = (0, b.setUpSocketIOPing)(h)), E(o, i, u, v), S(o, i, y, n, v), P = d(o, i, y, t, n), T = c(o, i, y, t, n), function() {
897
+ y(_.ReadyState.CLOSING), P(), T(), o.close(), C && clearInterval(C);
898
+ };
899
+ };
900
+ return te.attachListeners = l, te;
901
+ }
902
+ var ne = {}, gr;
903
+ function Et() {
904
+ if (gr) return ne;
905
+ gr = 1;
906
+ var r = ne && ne.__assign || function() {
907
+ return r = Object.assign || function(a) {
908
+ for (var i, t = 1, n = arguments.length; t < n; t++) {
909
+ i = arguments[t];
910
+ for (var v in i) Object.prototype.hasOwnProperty.call(i, v) && (a[v] = i[v]);
1377
911
  }
1378
- }
1379
- var Hr = function(e, s, b, p, w, I, R) {
1380
- var m = {
1381
- // This tag allows us to uniquely identify this as a React Element
1382
- $$typeof: g,
1383
- // Built-in properties that belong on the element
1384
- type: e,
1385
- key: s,
1386
- ref: b,
1387
- props: R,
1388
- // Record the component responsible for creating this element.
1389
- _owner: I
1390
- };
1391
- return m._store = {}, Object.defineProperty(m._store, "validated", {
1392
- configurable: !1,
1393
- enumerable: !1,
1394
- writable: !0,
1395
- value: !1
1396
- }), Object.defineProperty(m, "_self", {
1397
- configurable: !1,
1398
- enumerable: !1,
1399
- writable: !1,
1400
- value: p
1401
- }), Object.defineProperty(m, "_source", {
1402
- configurable: !1,
1403
- enumerable: !1,
1404
- writable: !1,
1405
- value: w
1406
- }), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
912
+ return a;
913
+ }, r.apply(this, arguments);
914
+ };
915
+ Object.defineProperty(ne, "__esModule", { value: !0 }), ne.attachSharedListeners = void 0;
916
+ var b = Je(), O = V(), _ = Ve(), f = He(), E = Ir(), S = function(a, i, t) {
917
+ a.onmessage = function(n) {
918
+ (0, _.getSubscribers)(i).forEach(function(v) {
919
+ var h;
920
+ v.optionsRef.current.onMessage && v.optionsRef.current.onMessage(n), typeof ((h = v?.lastMessageTime) === null || h === void 0 ? void 0 : h.current) == "number" && (v.lastMessageTime.current = Date.now()), !(typeof v.optionsRef.current.filter == "function" && v.optionsRef.current.filter(n) !== !0) && (t && typeof t != "boolean" && t?.returnMessage === n.data || v.setLastMessage(n));
921
+ });
1407
922
  };
1408
- function $r(e, s, b, p, w) {
1409
- {
1410
- var I, R = {}, m = null, U = null;
1411
- b !== void 0 && (ze(b), m = "" + b), qr(s) && (ze(s.key), m = "" + s.key), Fr(s) && (U = s.ref, Gr(s, w));
1412
- for (I in s)
1413
- ve.call(s, I) && !Wr.hasOwnProperty(I) && (R[I] = s[I]);
1414
- if (e && e.defaultProps) {
1415
- var N = e.defaultProps;
1416
- for (I in N)
1417
- R[I] === void 0 && (R[I] = N[I]);
923
+ }, d = function(a, i, t) {
924
+ a.onopen = function(n) {
925
+ var v = (0, _.getSubscribers)(i);
926
+ v.forEach(function(h) {
927
+ h.reconnectCount.current = 0, h.optionsRef.current.onOpen && h.optionsRef.current.onOpen(n), h.setReadyState(O.ReadyState.OPEN), t && a instanceof WebSocket && (h.lastMessageTime.current = Date.now());
928
+ }), t && a instanceof WebSocket && (0, E.heartbeat)(a, v.map(function(h) {
929
+ return h.lastMessageTime;
930
+ }), typeof t == "boolean" ? void 0 : t);
931
+ };
932
+ }, c = function(a, i) {
933
+ a instanceof WebSocket && (a.onclose = function(t) {
934
+ (0, _.getSubscribers)(i).forEach(function(n) {
935
+ n.optionsRef.current.onClose && n.optionsRef.current.onClose(t), n.setReadyState(O.ReadyState.CLOSED);
936
+ }), delete b.sharedWebSockets[i], (0, _.getSubscribers)(i).forEach(function(n) {
937
+ var v;
938
+ if (n.optionsRef.current.shouldReconnect && n.optionsRef.current.shouldReconnect(t)) {
939
+ var h = (v = n.optionsRef.current.reconnectAttempts) !== null && v !== void 0 ? v : O.DEFAULT_RECONNECT_LIMIT;
940
+ if (n.reconnectCount.current < h) {
941
+ var u = typeof n.optionsRef.current.reconnectInterval == "function" ? n.optionsRef.current.reconnectInterval(n.reconnectCount.current) : n.optionsRef.current.reconnectInterval;
942
+ setTimeout(function() {
943
+ n.reconnectCount.current++, n.reconnect.current();
944
+ }, u ?? O.DEFAULT_RECONNECT_INTERVAL_MS);
945
+ } else
946
+ n.optionsRef.current.onReconnectStop && n.optionsRef.current.onReconnectStop(n.optionsRef.current.reconnectAttempts), console.warn("Max reconnect attempts of ".concat(h, " exceeded"));
1418
947
  }
1419
- if (m || U) {
1420
- var M = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
1421
- m && Jr(R, M), U && Vr(R, M);
948
+ });
949
+ });
950
+ }, l = function(a, i) {
951
+ a.onerror = function(t) {
952
+ (0, _.getSubscribers)(i).forEach(function(n) {
953
+ n.optionsRef.current.onError && n.optionsRef.current.onError(t), O.isEventSourceSupported && a instanceof EventSource && (n.optionsRef.current.onClose && n.optionsRef.current.onClose(r(r({}, t), { code: 1006, reason: "An error occurred with the EventSource: ".concat(t), wasClean: !1 })), n.setReadyState(O.ReadyState.CLOSED));
954
+ }), O.isEventSourceSupported && a instanceof EventSource && a.close();
955
+ };
956
+ }, o = function(a, i, t, n) {
957
+ var v;
958
+ return t.current.fromSocketIO && (v = (0, f.setUpSocketIOPing)(n)), S(a, i, t.current.heartbeat), c(a, i), d(a, i, t.current.heartbeat), l(a, i), function() {
959
+ v && clearInterval(v);
960
+ };
961
+ };
962
+ return ne.attachSharedListeners = o, ne;
963
+ }
964
+ var Or;
965
+ function St() {
966
+ if (Or) return Se;
967
+ Or = 1, Object.defineProperty(Se, "__esModule", { value: !0 }), Se.createOrJoinSocket = void 0;
968
+ var r = Je(), b = V(), O = _t(), _ = Et(), f = Ve(), E = function(d, c, l, o, a) {
969
+ return function() {
970
+ if ((0, f.removeSubscriber)(d, c), !(0, f.hasSubscribers)(d)) {
971
+ try {
972
+ var i = r.sharedWebSockets[d];
973
+ i instanceof WebSocket && (i.onclose = function(t) {
974
+ l.current.onClose && l.current.onClose(t), o(b.ReadyState.CLOSED);
975
+ }), i.close();
976
+ } catch {
1422
977
  }
1423
- return Hr(e, m, U, w, p, Xe.current, R);
978
+ a && a(), delete r.sharedWebSockets[d];
1424
979
  }
980
+ };
981
+ }, S = function(d, c, l, o, a, i, t, n, v) {
982
+ if (!b.isEventSourceSupported && o.current.eventSourceOptions)
983
+ throw b.isReactNative ? new Error("EventSource is not supported in ReactNative") : new Error("EventSource is not supported");
984
+ if (o.current.share) {
985
+ var h = null;
986
+ r.sharedWebSockets[c] === void 0 ? (r.sharedWebSockets[c] = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols), d.current = r.sharedWebSockets[c], l(b.ReadyState.CONNECTING), h = (0, _.attachSharedListeners)(r.sharedWebSockets[c], c, o, v)) : (d.current = r.sharedWebSockets[c], l(r.sharedWebSockets[c].readyState));
987
+ var u = {
988
+ setLastMessage: a,
989
+ setReadyState: l,
990
+ optionsRef: o,
991
+ reconnectCount: t,
992
+ lastMessageTime: n,
993
+ reconnect: i
994
+ };
995
+ return (0, f.addSubscriber)(c, u), E(c, u, o, l, h);
996
+ } else {
997
+ if (d.current = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols), l(b.ReadyState.CONNECTING), !d.current)
998
+ throw new Error("WebSocket failed to be created");
999
+ return (0, O.attachListeners)(d.current, {
1000
+ setLastMessage: a,
1001
+ setReadyState: l
1002
+ }, o, i.current, t, n, v);
1425
1003
  }
1426
- var Ne = o.ReactCurrentOwner, rr = o.ReactDebugCurrentFrame;
1427
- function ce(e) {
1428
- if (e) {
1429
- var s = e._owner, b = me(e.type, e._source, s ? s.type : null);
1430
- rr.setExtraStackFrame(b);
1431
- } else
1432
- rr.setExtraStackFrame(null);
1433
- }
1434
- var Me;
1435
- Me = !1;
1436
- function De(e) {
1437
- return typeof e == "object" && e !== null && e.$$typeof === g;
1438
- }
1439
- function tr() {
1440
- {
1441
- if (Ne.current) {
1442
- var e = L(Ne.current.type);
1443
- if (e)
1444
- return `
1445
-
1446
- Check the render method of \`` + e + "`.";
1447
- }
1448
- return "";
1004
+ };
1005
+ return Se.createOrJoinSocket = S, Se;
1006
+ }
1007
+ var x = {}, pr;
1008
+ function ht() {
1009
+ return pr || (pr = 1, (function(r) {
1010
+ var b = x && x.__awaiter || function(c, l, o, a) {
1011
+ function i(t) {
1012
+ return t instanceof o ? t : new o(function(n) {
1013
+ n(t);
1014
+ });
1449
1015
  }
1450
- }
1451
- function Yr(e) {
1452
- return "";
1453
- }
1454
- var nr = {};
1455
- function Br(e) {
1456
- {
1457
- var s = tr();
1458
- if (!s) {
1459
- var b = typeof e == "string" ? e : e.displayName || e.name;
1460
- b && (s = `
1461
-
1462
- Check the top-level render call using <` + b + ">.");
1016
+ return new (o || (o = Promise))(function(t, n) {
1017
+ function v(y) {
1018
+ try {
1019
+ u(a.next(y));
1020
+ } catch (C) {
1021
+ n(C);
1022
+ }
1463
1023
  }
1464
- return s;
1465
- }
1466
- }
1467
- function ar(e, s) {
1468
- {
1469
- if (!e._store || e._store.validated || e.key != null)
1470
- return;
1471
- e._store.validated = !0;
1472
- var b = Br(s);
1473
- if (nr[b])
1474
- return;
1475
- nr[b] = !0;
1476
- var p = "";
1477
- e && e._owner && e._owner !== Ne.current && (p = " It was passed a child from " + L(e._owner.type) + "."), ce(e), y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', b, p), ce(null);
1478
- }
1479
- }
1480
- function ur(e, s) {
1481
- {
1482
- if (typeof e != "object")
1483
- return;
1484
- if (ke(e))
1485
- for (var b = 0; b < e.length; b++) {
1486
- var p = e[b];
1487
- De(p) && ar(p, s);
1024
+ function h(y) {
1025
+ try {
1026
+ u(a.throw(y));
1027
+ } catch (C) {
1028
+ n(C);
1488
1029
  }
1489
- else if (De(e))
1490
- e._store && (e._store.validated = !0);
1491
- else if (e) {
1492
- var w = E(e);
1493
- if (typeof w == "function" && w !== e.entries)
1494
- for (var I = w.call(e), R; !(R = I.next()).done; )
1495
- De(R.value) && ar(R.value, s);
1496
1030
  }
1031
+ function u(y) {
1032
+ y.done ? t(y.value) : i(y.value).then(v, h);
1033
+ }
1034
+ u((a = a.apply(c, l || [])).next());
1035
+ });
1036
+ }, O = x && x.__generator || function(c, l) {
1037
+ var o = { label: 0, sent: function() {
1038
+ if (t[0] & 1) throw t[1];
1039
+ return t[1];
1040
+ }, trys: [], ops: [] }, a, i, t, n = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
1041
+ return n.next = v(0), n.throw = v(1), n.return = v(2), typeof Symbol == "function" && (n[Symbol.iterator] = function() {
1042
+ return this;
1043
+ }), n;
1044
+ function v(u) {
1045
+ return function(y) {
1046
+ return h([u, y]);
1047
+ };
1497
1048
  }
1498
- }
1499
- function Kr(e) {
1500
- {
1501
- var s = e.type;
1502
- if (s == null || typeof s == "string")
1503
- return;
1504
- var b;
1505
- if (typeof s == "function")
1506
- b = s.propTypes;
1507
- else if (typeof s == "object" && (s.$$typeof === c || // Note: Memo only checks outer props here.
1508
- // Inner props are checked in the reconciler.
1509
- s.$$typeof === a))
1510
- b = s.propTypes;
1511
- else
1512
- return;
1513
- if (b) {
1514
- var p = L(s);
1515
- Dr(b, e.props, "prop", p, e);
1516
- } else if (s.PropTypes !== void 0 && !Me) {
1517
- Me = !0;
1518
- var w = L(s);
1519
- y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", w || "Unknown");
1049
+ function h(u) {
1050
+ if (a) throw new TypeError("Generator is already executing.");
1051
+ for (; n && (n = 0, u[0] && (o = 0)), o; ) try {
1052
+ if (a = 1, i && (t = u[0] & 2 ? i.return : u[0] ? i.throw || ((t = i.return) && t.call(i), 0) : i.next) && !(t = t.call(i, u[1])).done) return t;
1053
+ switch (i = 0, t && (u = [u[0] & 2, t.value]), u[0]) {
1054
+ case 0:
1055
+ case 1:
1056
+ t = u;
1057
+ break;
1058
+ case 4:
1059
+ return o.label++, { value: u[1], done: !1 };
1060
+ case 5:
1061
+ o.label++, i = u[1], u = [0];
1062
+ continue;
1063
+ case 7:
1064
+ u = o.ops.pop(), o.trys.pop();
1065
+ continue;
1066
+ default:
1067
+ if (t = o.trys, !(t = t.length > 0 && t[t.length - 1]) && (u[0] === 6 || u[0] === 2)) {
1068
+ o = 0;
1069
+ continue;
1070
+ }
1071
+ if (u[0] === 3 && (!t || u[1] > t[0] && u[1] < t[3])) {
1072
+ o.label = u[1];
1073
+ break;
1074
+ }
1075
+ if (u[0] === 6 && o.label < t[1]) {
1076
+ o.label = t[1], t = u;
1077
+ break;
1078
+ }
1079
+ if (t && o.label < t[2]) {
1080
+ o.label = t[2], o.ops.push(u);
1081
+ break;
1082
+ }
1083
+ t[2] && o.ops.pop(), o.trys.pop();
1084
+ continue;
1085
+ }
1086
+ u = l.call(c, o);
1087
+ } catch (y) {
1088
+ u = [6, y], i = 0;
1089
+ } finally {
1090
+ a = t = 0;
1520
1091
  }
1521
- typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
1092
+ if (u[0] & 5) throw u[1];
1093
+ return { value: u[0] ? u[1] : void 0, done: !0 };
1522
1094
  }
1523
- }
1524
- function xr(e) {
1525
- {
1526
- for (var s = Object.keys(e.props), b = 0; b < s.length; b++) {
1527
- var p = s[b];
1528
- if (p !== "children" && p !== "key") {
1529
- ce(e), y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", p), ce(null);
1530
- break;
1095
+ }, _ = x && x.__spreadArray || function(c, l, o) {
1096
+ if (o || arguments.length === 2) for (var a = 0, i = l.length, t; a < i; a++)
1097
+ (t || !(a in l)) && (t || (t = Array.prototype.slice.call(l, 0, a)), t[a] = l[a]);
1098
+ return c.concat(t || Array.prototype.slice.call(l));
1099
+ };
1100
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.getUrl = void 0;
1101
+ var f = He(), E = V(), S = function(c) {
1102
+ return new Promise(function(l) {
1103
+ return window.setTimeout(l, c);
1104
+ });
1105
+ }, d = function(c, l) {
1106
+ for (var o = [], a = 2; a < arguments.length; a++)
1107
+ o[a - 2] = arguments[a];
1108
+ return b(void 0, _([c, l], o, !0), void 0, function(i, t, n) {
1109
+ var v, h, u, y, C, P, T, A;
1110
+ return n === void 0 && (n = 0), O(this, function(k) {
1111
+ switch (k.label) {
1112
+ case 0:
1113
+ if (typeof i != "function") return [3, 10];
1114
+ k.label = 1;
1115
+ case 1:
1116
+ return k.trys.push([1, 3, , 9]), [4, i()];
1117
+ case 2:
1118
+ return v = k.sent(), [3, 9];
1119
+ case 3:
1120
+ return k.sent(), t.current.retryOnError ? (h = (P = t.current.reconnectAttempts) !== null && P !== void 0 ? P : E.DEFAULT_RECONNECT_LIMIT, n < h ? (u = typeof t.current.reconnectInterval == "function" ? t.current.reconnectInterval(n) : t.current.reconnectInterval, [4, S(u ?? E.DEFAULT_RECONNECT_INTERVAL_MS)]) : [3, 5]) : [3, 7];
1121
+ case 4:
1122
+ return k.sent(), [2, (0, r.getUrl)(i, t, n + 1)];
1123
+ case 5:
1124
+ return (A = (T = t.current).onReconnectStop) === null || A === void 0 || A.call(T, n), [2, null];
1125
+ case 6:
1126
+ return [3, 8];
1127
+ case 7:
1128
+ return [2, null];
1129
+ case 8:
1130
+ return [3, 9];
1131
+ case 9:
1132
+ return [3, 11];
1133
+ case 10:
1134
+ v = i, k.label = 11;
1135
+ case 11:
1136
+ return y = t.current.fromSocketIO ? (0, f.parseSocketIOUrl)(v) : v, C = t.current.queryParams ? (0, f.appendQueryParams)(y, t.current.queryParams) : y, [2, C];
1531
1137
  }
1138
+ });
1139
+ });
1140
+ };
1141
+ r.getUrl = d;
1142
+ })(x)), x;
1143
+ }
1144
+ var qe = {}, Tr;
1145
+ function yt() {
1146
+ return Tr || (Tr = 1, (function(r) {
1147
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.websocketWrapper = void 0;
1148
+ var b = function(O, _) {
1149
+ return new Proxy(O, {
1150
+ get: function(f, E) {
1151
+ var S = f[E];
1152
+ return E === "reconnect" ? _ : typeof S == "function" ? (console.error("Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket."), function() {
1153
+ }) : S;
1154
+ },
1155
+ set: function(f, E, S) {
1156
+ return /^on/.test(E) ? (console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."), !1) : (f[E] = S, !0);
1532
1157
  }
1533
- e.ref !== null && (ce(e), y("Invalid attribute `ref` supplied to `React.Fragment`."), ce(null));
1158
+ });
1159
+ };
1160
+ r.websocketWrapper = b, r.default = r.websocketWrapper;
1161
+ })(qe)), qe;
1162
+ }
1163
+ var mr;
1164
+ function Ye() {
1165
+ if (mr) return F;
1166
+ mr = 1;
1167
+ var r = F && F.__assign || function() {
1168
+ return r = Object.assign || function(i) {
1169
+ for (var t, n = 1, v = arguments.length; n < v; n++) {
1170
+ t = arguments[n];
1171
+ for (var h in t) Object.prototype.hasOwnProperty.call(t, h) && (i[h] = t[h]);
1534
1172
  }
1173
+ return i;
1174
+ }, r.apply(this, arguments);
1175
+ }, b = F && F.__awaiter || function(i, t, n, v) {
1176
+ function h(u) {
1177
+ return u instanceof n ? u : new n(function(y) {
1178
+ y(u);
1179
+ });
1535
1180
  }
1536
- var or = {};
1537
- function cr(e, s, b, p, w, I) {
1538
- {
1539
- var R = Ie(e);
1540
- if (!R) {
1541
- var m = "";
1542
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (m += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
1543
- var U = Yr();
1544
- U ? m += U : m += tr();
1545
- var N;
1546
- e === null ? N = "null" : ke(e) ? N = "array" : e !== void 0 && e.$$typeof === g ? (N = "<" + (L(e.type) || "Unknown") + " />", m = " Did you accidentally export a JSX literal instead of a component?") : N = typeof e, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", N, m);
1547
- }
1548
- var M = $r(e, s, b, w, I);
1549
- if (M == null)
1550
- return M;
1551
- if (R) {
1552
- var q = s.children;
1553
- if (q !== void 0)
1554
- if (p)
1555
- if (ke(q)) {
1556
- for (var ie = 0; ie < q.length; ie++)
1557
- ur(q[ie], e);
1558
- Object.freeze && Object.freeze(q);
1559
- } else
1560
- y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
1561
- else
1562
- ur(q, e);
1181
+ return new (n || (n = Promise))(function(u, y) {
1182
+ function C(A) {
1183
+ try {
1184
+ T(v.next(A));
1185
+ } catch (k) {
1186
+ y(k);
1563
1187
  }
1564
- if (ve.call(s, "key")) {
1565
- var re = L(e), W = Object.keys(s).filter(function(rt) {
1566
- return rt !== "key";
1567
- }), Le = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
1568
- if (!or[re + Le]) {
1569
- var et = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
1570
- y(`A props object containing a "key" prop is being spread into JSX:
1571
- let props = %s;
1572
- <%s {...props} />
1573
- React keys must be passed directly to JSX without using spread:
1574
- let props = %s;
1575
- <%s key={someKey} {...props} />`, Le, re, et, re), or[re + Le] = !0;
1576
- }
1188
+ }
1189
+ function P(A) {
1190
+ try {
1191
+ T(v.throw(A));
1192
+ } catch (k) {
1193
+ y(k);
1577
1194
  }
1578
- return e === h ? xr(M) : Kr(M), M;
1579
1195
  }
1196
+ function T(A) {
1197
+ A.done ? u(A.value) : h(A.value).then(C, P);
1198
+ }
1199
+ T((v = v.apply(i, t || [])).next());
1200
+ });
1201
+ }, O = F && F.__generator || function(i, t) {
1202
+ var n = { label: 0, sent: function() {
1203
+ if (u[0] & 1) throw u[1];
1204
+ return u[1];
1205
+ }, trys: [], ops: [] }, v, h, u, y = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
1206
+ return y.next = C(0), y.throw = C(1), y.return = C(2), typeof Symbol == "function" && (y[Symbol.iterator] = function() {
1207
+ return this;
1208
+ }), y;
1209
+ function C(T) {
1210
+ return function(A) {
1211
+ return P([T, A]);
1212
+ };
1580
1213
  }
1581
- function Qr(e, s, b) {
1582
- return cr(e, s, b, !0);
1583
- }
1584
- function zr(e, s, b) {
1585
- return cr(e, s, b, !1);
1214
+ function P(T) {
1215
+ if (v) throw new TypeError("Generator is already executing.");
1216
+ for (; y && (y = 0, T[0] && (n = 0)), n; ) try {
1217
+ if (v = 1, h && (u = T[0] & 2 ? h.return : T[0] ? h.throw || ((u = h.return) && u.call(h), 0) : h.next) && !(u = u.call(h, T[1])).done) return u;
1218
+ switch (h = 0, u && (T = [T[0] & 2, u.value]), T[0]) {
1219
+ case 0:
1220
+ case 1:
1221
+ u = T;
1222
+ break;
1223
+ case 4:
1224
+ return n.label++, { value: T[1], done: !1 };
1225
+ case 5:
1226
+ n.label++, h = T[1], T = [0];
1227
+ continue;
1228
+ case 7:
1229
+ T = n.ops.pop(), n.trys.pop();
1230
+ continue;
1231
+ default:
1232
+ if (u = n.trys, !(u = u.length > 0 && u[u.length - 1]) && (T[0] === 6 || T[0] === 2)) {
1233
+ n = 0;
1234
+ continue;
1235
+ }
1236
+ if (T[0] === 3 && (!u || T[1] > u[0] && T[1] < u[3])) {
1237
+ n.label = T[1];
1238
+ break;
1239
+ }
1240
+ if (T[0] === 6 && n.label < u[1]) {
1241
+ n.label = u[1], u = T;
1242
+ break;
1243
+ }
1244
+ if (u && n.label < u[2]) {
1245
+ n.label = u[2], n.ops.push(T);
1246
+ break;
1247
+ }
1248
+ u[2] && n.ops.pop(), n.trys.pop();
1249
+ continue;
1250
+ }
1251
+ T = t.call(i, n);
1252
+ } catch (A) {
1253
+ T = [6, A], h = 0;
1254
+ } finally {
1255
+ v = u = 0;
1256
+ }
1257
+ if (T[0] & 5) throw T[1];
1258
+ return { value: T[0] ? T[1] : void 0, done: !0 };
1586
1259
  }
1587
- var Xr = zr, Zr = Qr;
1588
- he.Fragment = h, he.jsx = Xr, he.jsxs = Zr;
1589
- })()), he;
1260
+ }, _ = F && F.__importDefault || function(i) {
1261
+ return i && i.__esModule ? i : { default: i };
1262
+ };
1263
+ Object.defineProperty(F, "__esModule", { value: !0 }), F.useWebSocket = void 0;
1264
+ var f = ye, E = it, S = V(), d = St(), c = ht(), l = _(yt()), o = $e(), a = function(i, t, n) {
1265
+ t === void 0 && (t = S.DEFAULT_OPTIONS), n === void 0 && (n = !0);
1266
+ var v = (0, f.useState)(null), h = v[0], u = v[1], y = (0, f.useState)({}), C = y[0], P = y[1], T = (0, f.useMemo)(function() {
1267
+ if (!t.disableJson && h)
1268
+ try {
1269
+ return JSON.parse(h.data);
1270
+ } catch {
1271
+ return S.UNPARSABLE_JSON_OBJECT;
1272
+ }
1273
+ return null;
1274
+ }, [h, t.disableJson]), A = (0, f.useRef)(null), k = (0, f.useRef)(null), se = (0, f.useRef)(function() {
1275
+ }), le = (0, f.useRef)(0), Ie = (0, f.useRef)(Date.now()), be = (0, f.useRef)([]), J = (0, f.useRef)(null), L = (0, f.useRef)(t);
1276
+ L.current = t;
1277
+ var G = A.current && C[A.current] !== void 0 ? C[A.current] : i !== null && n === !0 ? S.ReadyState.CONNECTING : S.ReadyState.UNINSTANTIATED, X = t.queryParams ? JSON.stringify(t.queryParams) : null, $ = (0, f.useCallback)(function(D, j) {
1278
+ var Y;
1279
+ if (j === void 0 && (j = !0), S.isEventSourceSupported && k.current instanceof EventSource) {
1280
+ console.warn("Unable to send a message from an eventSource");
1281
+ return;
1282
+ }
1283
+ ((Y = k.current) === null || Y === void 0 ? void 0 : Y.readyState) === S.ReadyState.OPEN ? ((0, o.assertIsWebSocket)(k.current, L.current.skipAssert), k.current.send(D)) : j && be.current.push(D);
1284
+ }, []), ge = (0, f.useCallback)(function(D, j) {
1285
+ j === void 0 && (j = !0), $(JSON.stringify(D), j);
1286
+ }, [$]), Oe = (0, f.useCallback)(function() {
1287
+ return L.current.share !== !0 || S.isEventSourceSupported && k.current instanceof EventSource ? k.current : (J.current === null && k.current && ((0, o.assertIsWebSocket)(k.current, L.current.skipAssert), J.current = (0, l.default)(k.current, se)), J.current);
1288
+ }, []);
1289
+ return (0, f.useEffect)(function() {
1290
+ if (i !== null && n === !0) {
1291
+ var D, j = !1, Y = !0, fe = function() {
1292
+ return b(void 0, void 0, void 0, function() {
1293
+ var Z, z, pe;
1294
+ return O(this, function(oe) {
1295
+ switch (oe.label) {
1296
+ case 0:
1297
+ return Z = A, [4, (0, c.getUrl)(i, L)];
1298
+ case 1:
1299
+ return Z.current = oe.sent(), A.current === null ? (console.error("Failed to get a valid URL. WebSocket connection aborted."), A.current = "ABORTED", (0, E.flushSync)(function() {
1300
+ return P(function(B) {
1301
+ return r(r({}, B), { ABORTED: S.ReadyState.CLOSED });
1302
+ });
1303
+ }), [
1304
+ 2
1305
+ /*return*/
1306
+ ]) : (z = function(B) {
1307
+ j || (0, E.flushSync)(function() {
1308
+ return u(B);
1309
+ });
1310
+ }, pe = function(B) {
1311
+ j || (0, E.flushSync)(function() {
1312
+ return P(function(ue) {
1313
+ var ee;
1314
+ return r(r({}, ue), A.current && (ee = {}, ee[A.current] = B, ee));
1315
+ });
1316
+ });
1317
+ }, Y && (D = (0, d.createOrJoinSocket)(k, A.current, pe, L, z, se, le, Ie, $)), [
1318
+ 2
1319
+ /*return*/
1320
+ ]);
1321
+ }
1322
+ });
1323
+ });
1324
+ };
1325
+ return se.current = function() {
1326
+ j || (J.current && (J.current = null), D?.(), fe());
1327
+ }, fe(), function() {
1328
+ j = !0, Y = !1, J.current && (J.current = null), D?.(), u(null);
1329
+ };
1330
+ } else (i === null || n === !1) && (le.current = 0, P(function(Z) {
1331
+ var z;
1332
+ return r(r({}, Z), A.current && (z = {}, z[A.current] = S.ReadyState.CLOSED, z));
1333
+ }));
1334
+ }, [i, n, X, $]), (0, f.useEffect)(function() {
1335
+ G === S.ReadyState.OPEN && be.current.splice(0).forEach(function(D) {
1336
+ $(D);
1337
+ });
1338
+ }, [G]), {
1339
+ sendMessage: $,
1340
+ sendJsonMessage: ge,
1341
+ lastMessage: h,
1342
+ lastJsonMessage: T,
1343
+ readyState: G,
1344
+ getWebSocket: Oe
1345
+ };
1346
+ };
1347
+ return F.useWebSocket = a, F;
1590
1348
  }
1591
- var Cr;
1592
- function Rt() {
1593
- return Cr || (Cr = 1, process.env.NODE_ENV === "production" ? Pe.exports = Tt() : Pe.exports = mt()), Pe.exports;
1349
+ var ae = {}, Rr;
1350
+ function bt() {
1351
+ if (Rr) return ae;
1352
+ Rr = 1;
1353
+ var r = ae && ae.__assign || function() {
1354
+ return r = Object.assign || function(d) {
1355
+ for (var c, l = 1, o = arguments.length; l < o; l++) {
1356
+ c = arguments[l];
1357
+ for (var a in c) Object.prototype.hasOwnProperty.call(c, a) && (d[a] = c[a]);
1358
+ }
1359
+ return d;
1360
+ }, r.apply(this, arguments);
1361
+ };
1362
+ Object.defineProperty(ae, "__esModule", { value: !0 }), ae.useSocketIO = void 0;
1363
+ var b = ye, O = Ye(), _ = V(), f = {
1364
+ type: "empty",
1365
+ payload: null
1366
+ }, E = function(d) {
1367
+ if (!d || !d.data)
1368
+ return f;
1369
+ var c = d.data.match(/\[.*]/);
1370
+ if (!c)
1371
+ return f;
1372
+ var l = JSON.parse(c);
1373
+ return !Array.isArray(l) || !l[1] ? f : {
1374
+ type: l[0],
1375
+ payload: l[1]
1376
+ };
1377
+ }, S = function(d, c, l) {
1378
+ c === void 0 && (c = _.DEFAULT_OPTIONS), l === void 0 && (l = !0);
1379
+ var o = (0, b.useMemo)(function() {
1380
+ return r(r({}, c), { fromSocketIO: !0 });
1381
+ }, []), a = (0, O.useWebSocket)(d, o, l), i = a.sendMessage, t = a.sendJsonMessage, n = a.lastMessage, v = a.readyState, h = a.getWebSocket, u = (0, b.useMemo)(function() {
1382
+ return E(n);
1383
+ }, [n]);
1384
+ return {
1385
+ sendMessage: i,
1386
+ sendJsonMessage: t,
1387
+ lastMessage: u,
1388
+ lastJsonMessage: u,
1389
+ readyState: v,
1390
+ getWebSocket: h
1391
+ };
1392
+ };
1393
+ return ae.useSocketIO = S, ae;
1594
1394
  }
1595
- var wr = Rt();
1596
- function Mt({ children: r, ...g }) {
1597
- const O = Ge(() => st(g), [g]), v = Ge(
1598
- () => new nt({
1599
- defaultOptions: {
1600
- queries: {
1601
- refetchOnWindowFocus: !1,
1602
- retry: 1
1603
- }
1395
+ var Q = {}, Cr;
1396
+ function gt() {
1397
+ if (Cr) return Q;
1398
+ Cr = 1;
1399
+ var r = Q && Q.__assign || function() {
1400
+ return r = Object.assign || function(S) {
1401
+ for (var d, c = 1, l = arguments.length; c < l; c++) {
1402
+ d = arguments[c];
1403
+ for (var o in d) Object.prototype.hasOwnProperty.call(d, o) && (S[o] = d[o]);
1604
1404
  }
1605
- }),
1606
- []
1607
- );
1608
- return /* @__PURE__ */ wr.jsx(at, { client: v, children: /* @__PURE__ */ wr.jsx(Ar.Provider, { value: { client: O, ...g }, children: r }) });
1405
+ return S;
1406
+ }, r.apply(this, arguments);
1407
+ }, b = Q && Q.__rest || function(S, d) {
1408
+ var c = {};
1409
+ for (var l in S) Object.prototype.hasOwnProperty.call(S, l) && d.indexOf(l) < 0 && (c[l] = S[l]);
1410
+ if (S != null && typeof Object.getOwnPropertySymbols == "function")
1411
+ for (var o = 0, l = Object.getOwnPropertySymbols(S); o < l.length; o++)
1412
+ d.indexOf(l[o]) < 0 && Object.prototype.propertyIsEnumerable.call(S, l[o]) && (c[l[o]] = S[l[o]]);
1413
+ return c;
1414
+ };
1415
+ Object.defineProperty(Q, "__esModule", { value: !0 }), Q.useEventSource = void 0;
1416
+ var O = ye, _ = Ye(), f = V(), E = function(S, d, c) {
1417
+ d === void 0 && (d = f.DEFAULT_EVENT_SOURCE_OPTIONS);
1418
+ var l = d.withCredentials, o = d.events, a = b(d, ["withCredentials", "events"]);
1419
+ c === void 0 && (c = !0);
1420
+ var i = r(r({}, a), { eventSourceOptions: {
1421
+ withCredentials: l
1422
+ } }), t = (0, O.useRef)(f.EMPTY_EVENT_HANDLERS);
1423
+ o && (t.current = o);
1424
+ var n = (0, _.useWebSocket)(S, i, c), v = n.lastMessage, h = n.readyState, u = n.getWebSocket;
1425
+ return (0, O.useEffect)(function() {
1426
+ v?.type && Object.entries(t.current).forEach(function(y) {
1427
+ var C = y[0], P = y[1];
1428
+ C === v.type && P(v);
1429
+ });
1430
+ }, [v]), {
1431
+ lastEvent: v,
1432
+ readyState: h,
1433
+ getEventSource: u
1434
+ };
1435
+ };
1436
+ return Q.useEventSource = E, Q;
1609
1437
  }
1438
+ var wr;
1439
+ function Ot() {
1440
+ return wr || (wr = 1, (function(r) {
1441
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.resetGlobalState = r.useEventSource = r.ReadyState = r.useSocketIO = r.default = void 0;
1442
+ var b = Ye();
1443
+ Object.defineProperty(r, "default", { enumerable: !0, get: function() {
1444
+ return b.useWebSocket;
1445
+ } });
1446
+ var O = bt();
1447
+ Object.defineProperty(r, "useSocketIO", { enumerable: !0, get: function() {
1448
+ return O.useSocketIO;
1449
+ } });
1450
+ var _ = V();
1451
+ Object.defineProperty(r, "ReadyState", { enumerable: !0, get: function() {
1452
+ return _.ReadyState;
1453
+ } });
1454
+ var f = gt();
1455
+ Object.defineProperty(r, "useEventSource", { enumerable: !0, get: function() {
1456
+ return f.useEventSource;
1457
+ } });
1458
+ var E = $e();
1459
+ Object.defineProperty(r, "resetGlobalState", { enumerable: !0, get: function() {
1460
+ return E.resetGlobalState;
1461
+ } });
1462
+ })(je)), je;
1463
+ }
1464
+ var pt = Ot();
1465
+ const Tt = /* @__PURE__ */ st(pt), H = {
1466
+ DEPOSIT: "deposit",
1467
+ TRANS_CODE: "transCode",
1468
+ ERROR: "error",
1469
+ UPDATE_MEMBER: "update_member",
1470
+ MAINTAIN_NOTICE: "maintain_notice",
1471
+ MAINTAIN_NOTICE_MEMBER: "maintain_notice_member",
1472
+ RELOAD: "reload",
1473
+ TRANSFER_IN_GAME: "transfer_in_game",
1474
+ CHECK_REQUEST: "CHECK_RREQUEST",
1475
+ CASH_REGISTER_LIMIT: "cash_register_limit"
1476
+ }, mt = 3e4, Mt = ({
1477
+ socketUrl: r,
1478
+ socketHandlers: b = {},
1479
+ options: O = {}
1480
+ }) => {
1481
+ const _ = ir(!1), f = ir(b), {
1482
+ sendMessage: E,
1483
+ // 發送普通訊息
1484
+ sendJsonMessage: S,
1485
+ // 發送 JSON 訊息
1486
+ lastMessage: d,
1487
+ // 最後接收到的訊息
1488
+ // lastJsonMessage, // 最後接收到的 JSON 訊息
1489
+ readyState: c
1490
+ // WebSocket 連線狀態
1491
+ // getWebSocket, // 獲取 WebSocket 實例
1492
+ } = Tt(r, {
1493
+ queryParams: { key: "wsky" },
1494
+ onOpen: () => console.log("連線成功"),
1495
+ shouldReconnect: () => _.current === !1,
1496
+ reconnectAttempts: 9999,
1497
+ reconnectInterval: 1e3,
1498
+ ...O
1499
+ }), l = Ge(() => {
1500
+ try {
1501
+ return JSON.parse(d?.data);
1502
+ } catch {
1503
+ return null;
1504
+ }
1505
+ }, [d?.data]);
1506
+ return Ce(() => {
1507
+ const o = setInterval(
1508
+ () => E("ping"),
1509
+ mt
1510
+ );
1511
+ return () => clearInterval(o);
1512
+ }, [E]), Ce(() => {
1513
+ f.current = b;
1514
+ }, [b]), Ce(() => {
1515
+ if (!l) return;
1516
+ const {
1517
+ onDeposit: o,
1518
+ onTransCode: a,
1519
+ onError: i,
1520
+ onUpdateMember: t,
1521
+ onMaintainNotice: n,
1522
+ onMaintainNoticeMember: v,
1523
+ onReload: h,
1524
+ onTransferInGame: u,
1525
+ onCashRegisterLimit: y
1526
+ } = f.current, C = we(l, "type", ""), P = {
1527
+ memberInfoUid: we(l, "member_info_uid", null),
1528
+ data: we(l, "data", null),
1529
+ memo: we(l, "memo", null)
1530
+ };
1531
+ switch (C) {
1532
+ case H.DEPOSIT:
1533
+ o?.(P);
1534
+ break;
1535
+ case H.TRANS_CODE:
1536
+ a?.(P);
1537
+ break;
1538
+ case H.ERROR:
1539
+ i?.(P);
1540
+ break;
1541
+ case H.UPDATE_MEMBER:
1542
+ t?.(P);
1543
+ break;
1544
+ case H.MAINTAIN_NOTICE:
1545
+ n?.(P);
1546
+ break;
1547
+ case H.MAINTAIN_NOTICE_MEMBER:
1548
+ v?.(P);
1549
+ break;
1550
+ case H.RELOAD:
1551
+ h?.(P);
1552
+ break;
1553
+ case H.TRANSFER_IN_GAME:
1554
+ case H.CHECK_REQUEST:
1555
+ u?.(P);
1556
+ break;
1557
+ case H.CASH_REGISTER_LIMIT:
1558
+ y?.(P);
1559
+ break;
1560
+ default:
1561
+ console.warn("Unknown socket type:", C);
1562
+ break;
1563
+ }
1564
+ }, [l]), Ce(() => () => _.current = !0, []), {
1565
+ sendMessage: E,
1566
+ sendJsonMessage: S,
1567
+ readyState: c
1568
+ // WebSocket 連線狀態
1569
+ };
1570
+ }, Rt = () => {
1571
+ const { client: r } = Pr(), b = de(
1572
+ async (S) => {
1573
+ const { mac_address: d = "", app_version: c = "", anydesk_id: l = "" } = S, { data: o } = await r.post("/cash-register/login", {
1574
+ mac_address: d,
1575
+ app_version: c,
1576
+ anydesk_id: l
1577
+ });
1578
+ return o;
1579
+ },
1580
+ [r]
1581
+ ), O = de(async () => r.get("/member/getMemberInfo"), [r]), _ = de(async () => {
1582
+ const { data: S } = await r.get("/getGameList");
1583
+ return S;
1584
+ }, [r]), f = de(async () => {
1585
+ const { data: S } = await r.get("/getNowCurrencyExchange");
1586
+ return S;
1587
+ }, [r]), E = de(async () => {
1588
+ const { data: S } = await r.get("/getFavoriteGame");
1589
+ return S;
1590
+ }, [r]);
1591
+ return {
1592
+ machineLoginApi: b,
1593
+ userInfoApi: O,
1594
+ userGameListApi: _,
1595
+ userFavoriteGameApi: E,
1596
+ userCurrencyExchangeApi: f
1597
+ };
1598
+ }, Dt = () => {
1599
+ const { getToken: r } = Pr(), { userInfoApi: b } = Rt(), O = ut({
1600
+ queries: [
1601
+ {
1602
+ queryKey: ["getMemberInfo"],
1603
+ queryFn: async () => await b(),
1604
+ refetchInterval: 5e4
1605
+ }
1606
+ ],
1607
+ enabled: !!r
1608
+ }), { data: _, isFetching: f, error: E } = O[0] || {};
1609
+ return { data: _, isFetching: f, error: E };
1610
+ };
1610
1611
  export {
1611
1612
  Ar as ApiCtx,
1612
- Mt as ApiProvider,
1613
+ kt as ApiProvider,
1614
+ Nt as createLogoutHandler,
1613
1615
  Pr as useApiContext,
1614
- Nt as useClientWebSocket,
1615
- kt as usePeriodicDataUpdater
1616
+ Mt as useClientWebSocket,
1617
+ Dt as usePeriodicDataUpdater
1616
1618
  };