@ssgc/alert-console 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +6 -0
- package/dist/index.es.js +4828 -0
- package/package.json +5 -7
- package/dist/index.cjs +0 -65
- package/dist/index.es +0 -5981
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,4828 @@
|
|
|
1
|
+
import * as ae from "react";
|
|
2
|
+
import Ts, { useState as C, useMemo as ue, createContext as Es, useContext as Cs, useEffect as me, useRef as Os } from "react";
|
|
3
|
+
import { Select as le, Table as ut, Row as Ee, Col as ee, Input as ks, Tag as Ye, Progress as Us, Space as Z, Tooltip as Ps, Button as de, Dropdown as Fs, Typography as Me, Spin as dt, Checkbox as Te, Divider as Pe, TimePicker as It, message as Ms, Tabs as ht, Card as et, Steps as Ds, Modal as Ls, Carousel as Bs } from "antd";
|
|
4
|
+
import { MessageOutlined as Qs, MailOutlined as qs, MoreOutlined as Ws, EditOutlined as zs, LeftOutlined as Hs, RightOutlined as Ys } from "@ant-design/icons";
|
|
5
|
+
import { toast as xe } from "react-toastify";
|
|
6
|
+
function Gs(e) {
|
|
7
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
8
|
+
}
|
|
9
|
+
var Be = { exports: {} }, Oe = {};
|
|
10
|
+
var Tt;
|
|
11
|
+
function Xs() {
|
|
12
|
+
if (Tt) return Oe;
|
|
13
|
+
Tt = 1;
|
|
14
|
+
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
15
|
+
function s(r, i, a) {
|
|
16
|
+
var l = null;
|
|
17
|
+
if (a !== void 0 && (l = "" + a), i.key !== void 0 && (l = "" + i.key), "key" in i) {
|
|
18
|
+
a = {};
|
|
19
|
+
for (var o in i)
|
|
20
|
+
o !== "key" && (a[o] = i[o]);
|
|
21
|
+
} else a = i;
|
|
22
|
+
return i = a.ref, {
|
|
23
|
+
$$typeof: e,
|
|
24
|
+
type: r,
|
|
25
|
+
key: l,
|
|
26
|
+
ref: i !== void 0 ? i : null,
|
|
27
|
+
props: a
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return Oe.Fragment = t, Oe.jsx = s, Oe.jsxs = s, Oe;
|
|
31
|
+
}
|
|
32
|
+
var ke = {};
|
|
33
|
+
var Et;
|
|
34
|
+
function Js() {
|
|
35
|
+
return Et || (Et = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
36
|
+
function e(c) {
|
|
37
|
+
if (c == null) return null;
|
|
38
|
+
if (typeof c == "function")
|
|
39
|
+
return c.$$typeof === b ? null : c.displayName || c.name || null;
|
|
40
|
+
if (typeof c == "string") return c;
|
|
41
|
+
switch (c) {
|
|
42
|
+
case P:
|
|
43
|
+
return "Fragment";
|
|
44
|
+
case q:
|
|
45
|
+
return "Profiler";
|
|
46
|
+
case W:
|
|
47
|
+
return "StrictMode";
|
|
48
|
+
case V:
|
|
49
|
+
return "Suspense";
|
|
50
|
+
case w:
|
|
51
|
+
return "SuspenseList";
|
|
52
|
+
case R:
|
|
53
|
+
return "Activity";
|
|
54
|
+
}
|
|
55
|
+
if (typeof c == "object")
|
|
56
|
+
switch (typeof c.tag == "number" && console.error(
|
|
57
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
58
|
+
), c.$$typeof) {
|
|
59
|
+
case E:
|
|
60
|
+
return "Portal";
|
|
61
|
+
case J:
|
|
62
|
+
return c.displayName || "Context";
|
|
63
|
+
case Y:
|
|
64
|
+
return (c._context.displayName || "Context") + ".Consumer";
|
|
65
|
+
case X:
|
|
66
|
+
var f = c.render;
|
|
67
|
+
return c = c.displayName, c || (c = f.displayName || f.name || "", c = c !== "" ? "ForwardRef(" + c + ")" : "ForwardRef"), c;
|
|
68
|
+
case I:
|
|
69
|
+
return f = c.displayName || null, f !== null ? f : e(c.type) || "Memo";
|
|
70
|
+
case M:
|
|
71
|
+
f = c._payload, c = c._init;
|
|
72
|
+
try {
|
|
73
|
+
return e(c(f));
|
|
74
|
+
} catch {
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
function t(c) {
|
|
80
|
+
return "" + c;
|
|
81
|
+
}
|
|
82
|
+
function s(c) {
|
|
83
|
+
try {
|
|
84
|
+
t(c);
|
|
85
|
+
var f = !1;
|
|
86
|
+
} catch {
|
|
87
|
+
f = !0;
|
|
88
|
+
}
|
|
89
|
+
if (f) {
|
|
90
|
+
f = console;
|
|
91
|
+
var O = f.error, k = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object";
|
|
92
|
+
return O.call(
|
|
93
|
+
f,
|
|
94
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
95
|
+
k
|
|
96
|
+
), t(c);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function r(c) {
|
|
100
|
+
if (c === P) return "<>";
|
|
101
|
+
if (typeof c == "object" && c !== null && c.$$typeof === M)
|
|
102
|
+
return "<...>";
|
|
103
|
+
try {
|
|
104
|
+
var f = e(c);
|
|
105
|
+
return f ? "<" + f + ">" : "<...>";
|
|
106
|
+
} catch {
|
|
107
|
+
return "<...>";
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function i() {
|
|
111
|
+
var c = B.A;
|
|
112
|
+
return c === null ? null : c.getOwner();
|
|
113
|
+
}
|
|
114
|
+
function a() {
|
|
115
|
+
return Error("react-stack-top-frame");
|
|
116
|
+
}
|
|
117
|
+
function l(c) {
|
|
118
|
+
if (z.call(c, "key")) {
|
|
119
|
+
var f = Object.getOwnPropertyDescriptor(c, "key").get;
|
|
120
|
+
if (f && f.isReactWarning) return !1;
|
|
121
|
+
}
|
|
122
|
+
return c.key !== void 0;
|
|
123
|
+
}
|
|
124
|
+
function o(c, f) {
|
|
125
|
+
function O() {
|
|
126
|
+
d || (d = !0, console.error(
|
|
127
|
+
"%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://react.dev/link/special-props)",
|
|
128
|
+
f
|
|
129
|
+
));
|
|
130
|
+
}
|
|
131
|
+
O.isReactWarning = !0, Object.defineProperty(c, "key", {
|
|
132
|
+
get: O,
|
|
133
|
+
configurable: !0
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function g() {
|
|
137
|
+
var c = e(this.type);
|
|
138
|
+
return S[c] || (S[c] = !0, console.error(
|
|
139
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
140
|
+
)), c = this.props.ref, c !== void 0 ? c : null;
|
|
141
|
+
}
|
|
142
|
+
function x(c, f, O, k, H, _) {
|
|
143
|
+
var Q = O.ref;
|
|
144
|
+
return c = {
|
|
145
|
+
$$typeof: j,
|
|
146
|
+
type: c,
|
|
147
|
+
key: f,
|
|
148
|
+
props: O,
|
|
149
|
+
_owner: k
|
|
150
|
+
}, (Q !== void 0 ? Q : null) !== null ? Object.defineProperty(c, "ref", {
|
|
151
|
+
enumerable: !1,
|
|
152
|
+
get: g
|
|
153
|
+
}) : Object.defineProperty(c, "ref", { enumerable: !1, value: null }), c._store = {}, Object.defineProperty(c._store, "validated", {
|
|
154
|
+
configurable: !1,
|
|
155
|
+
enumerable: !1,
|
|
156
|
+
writable: !0,
|
|
157
|
+
value: 0
|
|
158
|
+
}), Object.defineProperty(c, "_debugInfo", {
|
|
159
|
+
configurable: !1,
|
|
160
|
+
enumerable: !1,
|
|
161
|
+
writable: !0,
|
|
162
|
+
value: null
|
|
163
|
+
}), Object.defineProperty(c, "_debugStack", {
|
|
164
|
+
configurable: !1,
|
|
165
|
+
enumerable: !1,
|
|
166
|
+
writable: !0,
|
|
167
|
+
value: H
|
|
168
|
+
}), Object.defineProperty(c, "_debugTask", {
|
|
169
|
+
configurable: !1,
|
|
170
|
+
enumerable: !1,
|
|
171
|
+
writable: !0,
|
|
172
|
+
value: _
|
|
173
|
+
}), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
|
|
174
|
+
}
|
|
175
|
+
function p(c, f, O, k, H, _) {
|
|
176
|
+
var Q = f.children;
|
|
177
|
+
if (Q !== void 0)
|
|
178
|
+
if (k)
|
|
179
|
+
if (v(Q)) {
|
|
180
|
+
for (k = 0; k < Q.length; k++)
|
|
181
|
+
T(Q[k]);
|
|
182
|
+
Object.freeze && Object.freeze(Q);
|
|
183
|
+
} else
|
|
184
|
+
console.error(
|
|
185
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
186
|
+
);
|
|
187
|
+
else T(Q);
|
|
188
|
+
if (z.call(f, "key")) {
|
|
189
|
+
Q = e(c);
|
|
190
|
+
var oe = Object.keys(f).filter(function(se) {
|
|
191
|
+
return se !== "key";
|
|
192
|
+
});
|
|
193
|
+
k = 0 < oe.length ? "{key: someKey, " + oe.join(": ..., ") + ": ...}" : "{key: someKey}", N[Q + k] || (oe = 0 < oe.length ? "{" + oe.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
194
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
195
|
+
let props = %s;
|
|
196
|
+
<%s {...props} />
|
|
197
|
+
React keys must be passed directly to JSX without using spread:
|
|
198
|
+
let props = %s;
|
|
199
|
+
<%s key={someKey} {...props} />`,
|
|
200
|
+
k,
|
|
201
|
+
Q,
|
|
202
|
+
oe,
|
|
203
|
+
Q
|
|
204
|
+
), N[Q + k] = !0);
|
|
205
|
+
}
|
|
206
|
+
if (Q = null, O !== void 0 && (s(O), Q = "" + O), l(f) && (s(f.key), Q = "" + f.key), "key" in f) {
|
|
207
|
+
O = {};
|
|
208
|
+
for (var te in f)
|
|
209
|
+
te !== "key" && (O[te] = f[te]);
|
|
210
|
+
} else O = f;
|
|
211
|
+
return Q && o(
|
|
212
|
+
O,
|
|
213
|
+
typeof c == "function" ? c.displayName || c.name || "Unknown" : c
|
|
214
|
+
), x(
|
|
215
|
+
c,
|
|
216
|
+
Q,
|
|
217
|
+
O,
|
|
218
|
+
i(),
|
|
219
|
+
H,
|
|
220
|
+
_
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
function T(c) {
|
|
224
|
+
m(c) ? c._store && (c._store.validated = 1) : typeof c == "object" && c !== null && c.$$typeof === M && (c._payload.status === "fulfilled" ? m(c._payload.value) && c._payload.value._store && (c._payload.value._store.validated = 1) : c._store && (c._store.validated = 1));
|
|
225
|
+
}
|
|
226
|
+
function m(c) {
|
|
227
|
+
return typeof c == "object" && c !== null && c.$$typeof === j;
|
|
228
|
+
}
|
|
229
|
+
var A = Ts, j = /* @__PURE__ */ Symbol.for("react.transitional.element"), E = /* @__PURE__ */ Symbol.for("react.portal"), P = /* @__PURE__ */ Symbol.for("react.fragment"), W = /* @__PURE__ */ Symbol.for("react.strict_mode"), q = /* @__PURE__ */ Symbol.for("react.profiler"), Y = /* @__PURE__ */ Symbol.for("react.consumer"), J = /* @__PURE__ */ Symbol.for("react.context"), X = /* @__PURE__ */ Symbol.for("react.forward_ref"), V = /* @__PURE__ */ Symbol.for("react.suspense"), w = /* @__PURE__ */ Symbol.for("react.suspense_list"), I = /* @__PURE__ */ Symbol.for("react.memo"), M = /* @__PURE__ */ Symbol.for("react.lazy"), R = /* @__PURE__ */ Symbol.for("react.activity"), b = /* @__PURE__ */ Symbol.for("react.client.reference"), B = A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, z = Object.prototype.hasOwnProperty, v = Array.isArray, h = console.createTask ? console.createTask : function() {
|
|
230
|
+
return null;
|
|
231
|
+
};
|
|
232
|
+
A = {
|
|
233
|
+
react_stack_bottom_frame: function(c) {
|
|
234
|
+
return c();
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
var d, S = {}, y = A.react_stack_bottom_frame.bind(
|
|
238
|
+
A,
|
|
239
|
+
a
|
|
240
|
+
)(), u = h(r(a)), N = {};
|
|
241
|
+
ke.Fragment = P, ke.jsx = function(c, f, O) {
|
|
242
|
+
var k = 1e4 > B.recentlyCreatedOwnerStacks++;
|
|
243
|
+
return p(
|
|
244
|
+
c,
|
|
245
|
+
f,
|
|
246
|
+
O,
|
|
247
|
+
!1,
|
|
248
|
+
k ? Error("react-stack-top-frame") : y,
|
|
249
|
+
k ? h(r(c)) : u
|
|
250
|
+
);
|
|
251
|
+
}, ke.jsxs = function(c, f, O) {
|
|
252
|
+
var k = 1e4 > B.recentlyCreatedOwnerStacks++;
|
|
253
|
+
return p(
|
|
254
|
+
c,
|
|
255
|
+
f,
|
|
256
|
+
O,
|
|
257
|
+
!0,
|
|
258
|
+
k ? Error("react-stack-top-frame") : y,
|
|
259
|
+
k ? h(r(c)) : u
|
|
260
|
+
);
|
|
261
|
+
};
|
|
262
|
+
})()), ke;
|
|
263
|
+
}
|
|
264
|
+
var Ct;
|
|
265
|
+
function Vs() {
|
|
266
|
+
return Ct || (Ct = 1, process.env.NODE_ENV === "production" ? Be.exports = Xs() : Be.exports = Js()), Be.exports;
|
|
267
|
+
}
|
|
268
|
+
var n = Vs();
|
|
269
|
+
const Ks = "#FF3B30", Zs = "#FF9500", _s = "#FFCC00", $s = "#34C759", Qe = {
|
|
270
|
+
critical: Ks,
|
|
271
|
+
high: Zs,
|
|
272
|
+
medium: _s,
|
|
273
|
+
low: $s
|
|
274
|
+
}, Ot = {
|
|
275
|
+
Critical: Qe.critical,
|
|
276
|
+
High: Qe.high,
|
|
277
|
+
Medium: Qe.medium,
|
|
278
|
+
Low: Qe.low
|
|
279
|
+
};
|
|
280
|
+
function er(e) {
|
|
281
|
+
return Ot[e] || Ot.Low;
|
|
282
|
+
}
|
|
283
|
+
function kt(e) {
|
|
284
|
+
if (!e || typeof e != "string") return 0;
|
|
285
|
+
const t = e.trim().split(":");
|
|
286
|
+
if (t.length !== 3) return 0;
|
|
287
|
+
const [s, r, i] = t, a = Number.parseInt(s, 10), l = Number.parseInt(r, 10), o = Number.parseFloat(i || "0"), g = Number.isFinite(a) ? a : 0, x = Number.isFinite(l) ? l : 0, p = Number.isFinite(o) ? o : 0;
|
|
288
|
+
return g * 3600 + x * 60 + p;
|
|
289
|
+
}
|
|
290
|
+
function tr(e) {
|
|
291
|
+
const t = e.thirdPartyIds ?? e.ThirdPartyIds ?? e.thirdPartyId ?? e.ThirdPartyId ?? "", s = Array.isArray(t) ? t.join(",") : String(t ?? "");
|
|
292
|
+
if (!s || !s.trim()) return [];
|
|
293
|
+
const r = s.split(",").map((l) => parseInt(String(l).trim(), 10)).filter((l) => Number.isFinite(l)), i = /* @__PURE__ */ new Set(), a = [];
|
|
294
|
+
return r.forEach((l) => {
|
|
295
|
+
i.has(l) || (i.add(l), a.push(l));
|
|
296
|
+
}), a;
|
|
297
|
+
}
|
|
298
|
+
const sr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFMAAAA/CAYAAACchPQhAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAvcSURBVHgB7Vx7cE7pGX/O+b5cRVbcIiSb7FbpYlUWVa0lNeGPdtKYlq5Bu7TDH3ZY2mJ0OovFH0u1nS0zTLdTjRrjMqoWU8atiqnFFA2CIGyjidiIRG5f8p13n9+b8x7nOw5hJufkMvnNnO+c897P8z2393nfc4jcoTkOXQjheq0OpC1fvlzHgXt1Ng9Z3qwny9rakPVUnrpX5VWbqo69ruPe6tetjhqPKmsvp8raxqw5+3P2Sc+D8+H4HMjKygoOHz48iq+jBw8eHI1rdSANZ5Wuzpxuv5b11IE8VUbVUdfOdl3SI/rCvb0dMy1alXP2pcbi6DtibLZ2rWd1tBUEXex/lJMDJSEZxIW0CRMmvNa3b9qfYmJivq7rWjfqhEQ4bFBFRdWnhYVXFuXm5t7mJIPpJY+nCk+ZMiVw6tSpr9y//+Ch6MQzUVpaVvHJJ3lDMjIyYiG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uRDlVznj5Q0b5MM+WJ/tAVj0Vs4zOnQwnINNmH+cx5aMdIixiLMRNlOtrS+xH1ZBk9LcQh6CBf+1mDB/Lz84M8CUG33kYMsvd2rnCmypkqU1xlYgrqYHWEj6LgWoY2YRLIa+Tj5f+Bxt5lXdTDYgEPYW4f72/zWTGXh3cGf7Icqwxk6eXJPDar8cg+ZVm0Z7VQiWzXfEb/fGgcZQ2wSMRYQvpE6H3jwuph8RUpfF5GPiCAj3rA0tdfbRNWPyD32UReS8jyZsh2zOfIsnC+mF2D0hlTUFAQshqL1Tis+jaXt7qm3i2WmtU4MjMzNX0W4rNloFPfb92Y4+fya4EWh0xXTWXMXySMTFMt6veVF1ku7AuC5rNm+iAgWXxVMaKeYtGnOsDnMLdrif8DWg9F7eg3nUsAAAAASUVORK5CYII=";
|
|
299
|
+
function Ke({ value: e, onChange: t, options: s, className: r, dropdownWidth: i }) {
|
|
300
|
+
return /* @__PURE__ */ n.jsx(
|
|
301
|
+
le,
|
|
302
|
+
{
|
|
303
|
+
className: r,
|
|
304
|
+
options: s,
|
|
305
|
+
value: e,
|
|
306
|
+
onChange: t,
|
|
307
|
+
dropdownMatchSelectWidth: i ?? 260
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
const or = [
|
|
312
|
+
{ label: "All levels", value: "All" },
|
|
313
|
+
{ label: "Critical", value: "Critical" },
|
|
314
|
+
{ label: "High", value: "High" },
|
|
315
|
+
{ label: "Medium", value: "Medium" },
|
|
316
|
+
{ label: "Low", value: "Low" }
|
|
317
|
+
];
|
|
318
|
+
function lr({ value: e, onChange: t, options: s }) {
|
|
319
|
+
return /* @__PURE__ */ n.jsx(Ke, { className: "w-[140px]", value: e, onChange: t, options: s || or });
|
|
320
|
+
}
|
|
321
|
+
const cr = [
|
|
322
|
+
{ label: "All Types", value: "All" },
|
|
323
|
+
{ label: "Weapon Detection", value: "Weapon" },
|
|
324
|
+
{ label: "Unauthorized Access", value: "Unauthorized" },
|
|
325
|
+
{ label: "Aggressive Behavior", value: "Aggressive" }
|
|
326
|
+
];
|
|
327
|
+
function ur({ value: e, onChange: t, options: s }) {
|
|
328
|
+
return /* @__PURE__ */ n.jsx(Ke, { className: "w-[220px]", dropdownWidth: 280, value: e, onChange: t, options: s || cr });
|
|
329
|
+
}
|
|
330
|
+
function dr({ value: e, onChange: t, options: s }) {
|
|
331
|
+
return /* @__PURE__ */ n.jsx(Ke, { className: "w-[100px]", value: e, onChange: t, options: s || [] });
|
|
332
|
+
}
|
|
333
|
+
const hr = [
|
|
334
|
+
{ label: "All", value: "All" },
|
|
335
|
+
{ label: "SOS", value: "SOS" },
|
|
336
|
+
{ label: "911", value: "911" },
|
|
337
|
+
{ label: "Aegix", value: "Aegix" },
|
|
338
|
+
{ label: "Eli", value: "Eli" },
|
|
339
|
+
{ label: "Skydio", value: "Skydio" }
|
|
340
|
+
];
|
|
341
|
+
function fr({ value: e, onChange: t, options: s }) {
|
|
342
|
+
return /* @__PURE__ */ n.jsx(Ke, { className: "w-[130px]", value: e, onChange: t, options: s || hr });
|
|
343
|
+
}
|
|
344
|
+
function mr({
|
|
345
|
+
columns: e,
|
|
346
|
+
data: t,
|
|
347
|
+
loading: s = !1,
|
|
348
|
+
pageSize: r = 10,
|
|
349
|
+
rowKey: i = "id",
|
|
350
|
+
toolbar: a,
|
|
351
|
+
tableProps: l
|
|
352
|
+
}) {
|
|
353
|
+
return /* @__PURE__ */ n.jsxs("div", { children: [
|
|
354
|
+
a,
|
|
355
|
+
/* @__PURE__ */ n.jsx(
|
|
356
|
+
ut,
|
|
357
|
+
{
|
|
358
|
+
rowKey: i,
|
|
359
|
+
dataSource: t,
|
|
360
|
+
columns: e,
|
|
361
|
+
loading: s,
|
|
362
|
+
pagination: {
|
|
363
|
+
pageSize: r,
|
|
364
|
+
showSizeChanger: !0,
|
|
365
|
+
showTotal: (o) => `Total: ${o}`
|
|
366
|
+
},
|
|
367
|
+
bordered: !0,
|
|
368
|
+
...l
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
] });
|
|
372
|
+
}
|
|
373
|
+
function $t({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOptions: i, spaceOptions: a, renderActions: l, onAlertIdClick: o }) {
|
|
374
|
+
const g = {
|
|
375
|
+
Critical: "#FFE2E2",
|
|
376
|
+
High: "#FF95004D",
|
|
377
|
+
Medium: "#FEF9C2",
|
|
378
|
+
Low: "#E0EDFF"
|
|
379
|
+
}, x = {
|
|
380
|
+
Critical: "#FF3B30",
|
|
381
|
+
High: "#FFB86A",
|
|
382
|
+
Medium: "#FFCC00",
|
|
383
|
+
Low: "#007AFF"
|
|
384
|
+
}, [p, T] = C("All"), [m, A] = C("All"), [j, E] = C("All"), [P, W] = C("All"), [q, Y] = C(""), J = {
|
|
385
|
+
1: { title: "911 Inform", kind: "img", src: ar, alt: "911 Inform" },
|
|
386
|
+
2: { title: "SKYDIO", kind: "img", src: sr, alt: "Skydio" },
|
|
387
|
+
3: { title: "RapidSOS", kind: "img", src: ir, alt: "RapidSOS" },
|
|
388
|
+
// Treat EXGIS as AEGIX based on available asset
|
|
389
|
+
4: { title: "AEGIX", kind: "img", src: rr, alt: "Aegix" },
|
|
390
|
+
5: { title: "Eli Technologies", kind: "img", src: nr, alt: "Eli Technologies" },
|
|
391
|
+
6: { title: "Email", kind: "icon", icon: /* @__PURE__ */ n.jsx(qs, {}) },
|
|
392
|
+
7: { title: "SMS", kind: "icon", icon: /* @__PURE__ */ n.jsx(Qs, {}) }
|
|
393
|
+
}, X = ue(() => {
|
|
394
|
+
const R = /* @__PURE__ */ new Set();
|
|
395
|
+
(e || []).forEach((B) => {
|
|
396
|
+
const z = B.anomalyName;
|
|
397
|
+
typeof z == "string" && z.trim().length > 0 && R.add(z.trim());
|
|
398
|
+
});
|
|
399
|
+
const b = Array.from(R).map((B) => ({ label: B, value: B }));
|
|
400
|
+
return [{ label: "All Types", value: "All" }, ...b];
|
|
401
|
+
}, [e]), V = ue(() => (e || []).filter((R) => {
|
|
402
|
+
const b = p === "All" || R.priority === p, B = `${R.id} ${R.description} ${R.statusType}`.toLowerCase(), z = !q || B.includes(q.toLowerCase()), v = m === "All" || (R.anomalyName || "").toLowerCase() === m.toLowerCase();
|
|
403
|
+
return b && z && v && !0 && !0;
|
|
404
|
+
}), [e, p, q]), w = X, I = [
|
|
405
|
+
{
|
|
406
|
+
title: "Severity",
|
|
407
|
+
dataIndex: "priority",
|
|
408
|
+
key: "priority",
|
|
409
|
+
width: 120,
|
|
410
|
+
render: (R) => /* @__PURE__ */ n.jsx(Ye, { className: "px-[10px] py-[2px]", style: { border: `2px solid ${x[R]}`, backgroundColor: g[R] }, children: R })
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
title: "Alert Timestamp",
|
|
414
|
+
dataIndex: "timestamp",
|
|
415
|
+
key: "timestamp",
|
|
416
|
+
width: 220,
|
|
417
|
+
render: (R, b) => {
|
|
418
|
+
const B = b.timeElapsed ? b.timeElapsed : void 0, z = b.timeRemaining ? b.timeRemaining : void 0, v = B ? kt(B) : 0, h = z ? kt(z) : 0, d = Math.round(v / (v + h) * 100);
|
|
419
|
+
return /* @__PURE__ */ n.jsxs("div", { children: [
|
|
420
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
421
|
+
/* @__PURE__ */ n.jsx("span", { className: "w-[70px]", children: "Elapsed:" }),
|
|
422
|
+
/* @__PURE__ */ n.jsx("span", { className: "font-medium", children: B ?? "-" })
|
|
423
|
+
] }),
|
|
424
|
+
/* @__PURE__ */ n.jsx(Us, { percent: d, showInfo: !1, size: "small", strokeColor: er(b.priority) }),
|
|
425
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
426
|
+
/* @__PURE__ */ n.jsx("span", { className: "w-[70px]", children: "Remaining" }),
|
|
427
|
+
/* @__PURE__ */ n.jsx("span", { className: "font-medium", children: z ?? "-" })
|
|
428
|
+
] })
|
|
429
|
+
] });
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
title: "Status",
|
|
434
|
+
dataIndex: "statusType",
|
|
435
|
+
key: "statusType",
|
|
436
|
+
width: 140
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
title: "Description",
|
|
440
|
+
dataIndex: "description",
|
|
441
|
+
key: "description",
|
|
442
|
+
render: (R, b) => /* @__PURE__ */ n.jsxs("div", { children: [
|
|
443
|
+
/* @__PURE__ */ n.jsx(
|
|
444
|
+
"a",
|
|
445
|
+
{
|
|
446
|
+
onClick: (B) => {
|
|
447
|
+
B.preventDefault(), o?.(b);
|
|
448
|
+
},
|
|
449
|
+
className: "inline-block mb-1",
|
|
450
|
+
children: b.clientId
|
|
451
|
+
}
|
|
452
|
+
),
|
|
453
|
+
/* @__PURE__ */ n.jsx("div", { className: "text-black/65", children: R })
|
|
454
|
+
] })
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
title: "Actions",
|
|
458
|
+
key: "actions",
|
|
459
|
+
width: 320,
|
|
460
|
+
render: (R, b) => {
|
|
461
|
+
if (l) return /* @__PURE__ */ n.jsx(n.Fragment, { children: l(b) });
|
|
462
|
+
const B = tr(b);
|
|
463
|
+
return B.length ? /* @__PURE__ */ n.jsx(Z, { size: "middle", children: B.map((z) => {
|
|
464
|
+
const v = J[z];
|
|
465
|
+
if (!v) return null;
|
|
466
|
+
const h = `${g[b.priority]} border ${x[b.priority]}`;
|
|
467
|
+
return /* @__PURE__ */ n.jsx(Ps, { title: v.title, children: /* @__PURE__ */ n.jsx(
|
|
468
|
+
de,
|
|
469
|
+
{
|
|
470
|
+
size: "large",
|
|
471
|
+
icon: v.kind === "img" && v.src ? /* @__PURE__ */ n.jsx("img", { src: v.src, alt: v.alt || v.title }) : v.icon,
|
|
472
|
+
className: h
|
|
473
|
+
}
|
|
474
|
+
) }, z);
|
|
475
|
+
}) }) : null;
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
title: "Tracker",
|
|
480
|
+
key: "tracker",
|
|
481
|
+
width: 140,
|
|
482
|
+
render: (R, b) => /* @__PURE__ */ n.jsx(
|
|
483
|
+
"a",
|
|
484
|
+
{
|
|
485
|
+
onClick: (B) => {
|
|
486
|
+
B.preventDefault(), o?.(b, { tab: "track" });
|
|
487
|
+
},
|
|
488
|
+
className: "text-blue-600 hover:underline",
|
|
489
|
+
children: "Tracker"
|
|
490
|
+
}
|
|
491
|
+
)
|
|
492
|
+
}
|
|
493
|
+
], M = r && r.length ? r : I;
|
|
494
|
+
return /* @__PURE__ */ n.jsx("div", { children: /* @__PURE__ */ n.jsx(
|
|
495
|
+
mr,
|
|
496
|
+
{
|
|
497
|
+
rowKey: "id",
|
|
498
|
+
data: V,
|
|
499
|
+
columns: M,
|
|
500
|
+
loading: t,
|
|
501
|
+
pageSize: s,
|
|
502
|
+
toolbar: /* @__PURE__ */ n.jsxs(Ee, { gutter: [12, 12], className: "mb-3", align: "middle", children: [
|
|
503
|
+
/* @__PURE__ */ n.jsx(ee, { flex: "none", children: /* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
504
|
+
/* @__PURE__ */ n.jsx("span", { children: "Severity" }),
|
|
505
|
+
/* @__PURE__ */ n.jsx(lr, { value: p, onChange: T, options: i })
|
|
506
|
+
] }) }),
|
|
507
|
+
/* @__PURE__ */ n.jsx(ee, { flex: "none", children: /* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
508
|
+
/* @__PURE__ */ n.jsx("span", { children: "Anomaly type" }),
|
|
509
|
+
/* @__PURE__ */ n.jsx(ur, { value: m, onChange: A, options: w })
|
|
510
|
+
] }) }),
|
|
511
|
+
/* @__PURE__ */ n.jsx(ee, { flex: "none", children: /* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
512
|
+
/* @__PURE__ */ n.jsx("span", { children: "Space" }),
|
|
513
|
+
/* @__PURE__ */ n.jsx(dr, { value: j, onChange: E, options: a })
|
|
514
|
+
] }) }),
|
|
515
|
+
/* @__PURE__ */ n.jsx(ee, { flex: "none", children: /* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
516
|
+
/* @__PURE__ */ n.jsx("span", { children: "Action Taken" }),
|
|
517
|
+
/* @__PURE__ */ n.jsx(fr, { value: P, onChange: W })
|
|
518
|
+
] }) }),
|
|
519
|
+
/* @__PURE__ */ n.jsx(ee, { flex: "auto" }),
|
|
520
|
+
/* @__PURE__ */ n.jsx(ee, { flex: "none", children: /* @__PURE__ */ n.jsx(
|
|
521
|
+
ks.Search,
|
|
522
|
+
{
|
|
523
|
+
allowClear: !0,
|
|
524
|
+
placeholder: "Search",
|
|
525
|
+
onSearch: Y,
|
|
526
|
+
onChange: (R) => Y(R.target.value),
|
|
527
|
+
className: "w-[260px] ",
|
|
528
|
+
enterButton: !0
|
|
529
|
+
}
|
|
530
|
+
) })
|
|
531
|
+
] })
|
|
532
|
+
}
|
|
533
|
+
) });
|
|
534
|
+
}
|
|
535
|
+
var Ce = class {
|
|
536
|
+
constructor() {
|
|
537
|
+
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
538
|
+
}
|
|
539
|
+
subscribe(e) {
|
|
540
|
+
return this.listeners.add(e), this.onSubscribe(), () => {
|
|
541
|
+
this.listeners.delete(e), this.onUnsubscribe();
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
hasListeners() {
|
|
545
|
+
return this.listeners.size > 0;
|
|
546
|
+
}
|
|
547
|
+
onSubscribe() {
|
|
548
|
+
}
|
|
549
|
+
onUnsubscribe() {
|
|
550
|
+
}
|
|
551
|
+
}, pr = {
|
|
552
|
+
// We need the wrapper function syntax below instead of direct references to
|
|
553
|
+
// global setTimeout etc.
|
|
554
|
+
//
|
|
555
|
+
// BAD: `setTimeout: setTimeout`
|
|
556
|
+
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
557
|
+
//
|
|
558
|
+
// If we use direct references here, then anything that wants to spy on or
|
|
559
|
+
// replace the global setTimeout (like tests) won't work since we'll already
|
|
560
|
+
// have a hard reference to the original implementation at the time when this
|
|
561
|
+
// file was imported.
|
|
562
|
+
setTimeout: (e, t) => setTimeout(e, t),
|
|
563
|
+
clearTimeout: (e) => clearTimeout(e),
|
|
564
|
+
setInterval: (e, t) => setInterval(e, t),
|
|
565
|
+
clearInterval: (e) => clearInterval(e)
|
|
566
|
+
}, yr = class {
|
|
567
|
+
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
568
|
+
// type at app boot; and if we leave that type, then any new timer provider
|
|
569
|
+
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
570
|
+
//
|
|
571
|
+
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
572
|
+
// this class is unsafe internally to allow for extension.
|
|
573
|
+
#e = pr;
|
|
574
|
+
#t = !1;
|
|
575
|
+
setTimeoutProvider(e) {
|
|
576
|
+
process.env.NODE_ENV !== "production" && this.#t && e !== this.#e && console.error(
|
|
577
|
+
"[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
|
|
578
|
+
{ previous: this.#e, provider: e }
|
|
579
|
+
), this.#e = e, process.env.NODE_ENV !== "production" && (this.#t = !1);
|
|
580
|
+
}
|
|
581
|
+
setTimeout(e, t) {
|
|
582
|
+
return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setTimeout(e, t);
|
|
583
|
+
}
|
|
584
|
+
clearTimeout(e) {
|
|
585
|
+
this.#e.clearTimeout(e);
|
|
586
|
+
}
|
|
587
|
+
setInterval(e, t) {
|
|
588
|
+
return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setInterval(e, t);
|
|
589
|
+
}
|
|
590
|
+
clearInterval(e) {
|
|
591
|
+
this.#e.clearInterval(e);
|
|
592
|
+
}
|
|
593
|
+
}, we = new yr();
|
|
594
|
+
function gr(e) {
|
|
595
|
+
setTimeout(e, 0);
|
|
596
|
+
}
|
|
597
|
+
var je = typeof window > "u" || "Deno" in globalThis;
|
|
598
|
+
function ce() {
|
|
599
|
+
}
|
|
600
|
+
function Ar(e, t) {
|
|
601
|
+
return typeof e == "function" ? e(t) : e;
|
|
602
|
+
}
|
|
603
|
+
function rt(e) {
|
|
604
|
+
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
605
|
+
}
|
|
606
|
+
function es(e, t) {
|
|
607
|
+
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
608
|
+
}
|
|
609
|
+
function be(e, t) {
|
|
610
|
+
return typeof e == "function" ? e(t) : e;
|
|
611
|
+
}
|
|
612
|
+
function fe(e, t) {
|
|
613
|
+
return typeof e == "function" ? e(t) : e;
|
|
614
|
+
}
|
|
615
|
+
function Ut(e, t) {
|
|
616
|
+
const {
|
|
617
|
+
type: s = "all",
|
|
618
|
+
exact: r,
|
|
619
|
+
fetchStatus: i,
|
|
620
|
+
predicate: a,
|
|
621
|
+
queryKey: l,
|
|
622
|
+
stale: o
|
|
623
|
+
} = e;
|
|
624
|
+
if (l) {
|
|
625
|
+
if (r) {
|
|
626
|
+
if (t.queryHash !== ft(l, t.options))
|
|
627
|
+
return !1;
|
|
628
|
+
} else if (!Fe(t.queryKey, l))
|
|
629
|
+
return !1;
|
|
630
|
+
}
|
|
631
|
+
if (s !== "all") {
|
|
632
|
+
const g = t.isActive();
|
|
633
|
+
if (s === "active" && !g || s === "inactive" && g)
|
|
634
|
+
return !1;
|
|
635
|
+
}
|
|
636
|
+
return !(typeof o == "boolean" && t.isStale() !== o || i && i !== t.state.fetchStatus || a && !a(t));
|
|
637
|
+
}
|
|
638
|
+
function Pt(e, t) {
|
|
639
|
+
const { exact: s, status: r, predicate: i, mutationKey: a } = e;
|
|
640
|
+
if (a) {
|
|
641
|
+
if (!t.options.mutationKey)
|
|
642
|
+
return !1;
|
|
643
|
+
if (s) {
|
|
644
|
+
if (Re(t.options.mutationKey) !== Re(a))
|
|
645
|
+
return !1;
|
|
646
|
+
} else if (!Fe(t.options.mutationKey, a))
|
|
647
|
+
return !1;
|
|
648
|
+
}
|
|
649
|
+
return !(r && t.state.status !== r || i && !i(t));
|
|
650
|
+
}
|
|
651
|
+
function ft(e, t) {
|
|
652
|
+
return (t?.queryKeyHashFn || Re)(e);
|
|
653
|
+
}
|
|
654
|
+
function Re(e) {
|
|
655
|
+
return JSON.stringify(
|
|
656
|
+
e,
|
|
657
|
+
(t, s) => it(s) ? Object.keys(s).sort().reduce((r, i) => (r[i] = s[i], r), {}) : s
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
function Fe(e, t) {
|
|
661
|
+
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) => Fe(e[s], t[s])) : !1;
|
|
662
|
+
}
|
|
663
|
+
var vr = Object.prototype.hasOwnProperty;
|
|
664
|
+
function nt(e, t) {
|
|
665
|
+
if (e === t)
|
|
666
|
+
return e;
|
|
667
|
+
const s = Ft(e) && Ft(t);
|
|
668
|
+
if (!s && !(it(e) && it(t))) return t;
|
|
669
|
+
const i = (s ? e : Object.keys(e)).length, a = s ? t : Object.keys(t), l = a.length, o = s ? new Array(l) : {};
|
|
670
|
+
let g = 0;
|
|
671
|
+
for (let x = 0; x < l; x++) {
|
|
672
|
+
const p = s ? x : a[x], T = e[p], m = t[p];
|
|
673
|
+
if (T === m) {
|
|
674
|
+
o[p] = T, (s ? x < i : vr.call(e, p)) && g++;
|
|
675
|
+
continue;
|
|
676
|
+
}
|
|
677
|
+
if (T === null || m === null || typeof T != "object" || typeof m != "object") {
|
|
678
|
+
o[p] = m;
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
const A = nt(T, m);
|
|
682
|
+
o[p] = A, A === T && g++;
|
|
683
|
+
}
|
|
684
|
+
return i === l && g === i ? e : o;
|
|
685
|
+
}
|
|
686
|
+
function Xe(e, t) {
|
|
687
|
+
if (!t || Object.keys(e).length !== Object.keys(t).length)
|
|
688
|
+
return !1;
|
|
689
|
+
for (const s in e)
|
|
690
|
+
if (e[s] !== t[s])
|
|
691
|
+
return !1;
|
|
692
|
+
return !0;
|
|
693
|
+
}
|
|
694
|
+
function Ft(e) {
|
|
695
|
+
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
696
|
+
}
|
|
697
|
+
function it(e) {
|
|
698
|
+
if (!Mt(e))
|
|
699
|
+
return !1;
|
|
700
|
+
const t = e.constructor;
|
|
701
|
+
if (t === void 0)
|
|
702
|
+
return !0;
|
|
703
|
+
const s = t.prototype;
|
|
704
|
+
return !(!Mt(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
705
|
+
}
|
|
706
|
+
function Mt(e) {
|
|
707
|
+
return Object.prototype.toString.call(e) === "[object Object]";
|
|
708
|
+
}
|
|
709
|
+
function xr(e) {
|
|
710
|
+
return new Promise((t) => {
|
|
711
|
+
we.setTimeout(t, e);
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
function at(e, t, s) {
|
|
715
|
+
if (typeof s.structuralSharing == "function")
|
|
716
|
+
return s.structuralSharing(e, t);
|
|
717
|
+
if (s.structuralSharing !== !1) {
|
|
718
|
+
if (process.env.NODE_ENV !== "production")
|
|
719
|
+
try {
|
|
720
|
+
return nt(e, t);
|
|
721
|
+
} catch (r) {
|
|
722
|
+
throw console.error(
|
|
723
|
+
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${r}`
|
|
724
|
+
), r;
|
|
725
|
+
}
|
|
726
|
+
return nt(e, t);
|
|
727
|
+
}
|
|
728
|
+
return t;
|
|
729
|
+
}
|
|
730
|
+
function br(e, t, s = 0) {
|
|
731
|
+
const r = [...e, t];
|
|
732
|
+
return s && r.length > s ? r.slice(1) : r;
|
|
733
|
+
}
|
|
734
|
+
function Sr(e, t, s = 0) {
|
|
735
|
+
const r = [t, ...e];
|
|
736
|
+
return s && r.length > s ? r.slice(0, -1) : r;
|
|
737
|
+
}
|
|
738
|
+
var Je = /* @__PURE__ */ Symbol();
|
|
739
|
+
function ts(e, t) {
|
|
740
|
+
return process.env.NODE_ENV !== "production" && e.queryFn === Je && console.error(
|
|
741
|
+
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
742
|
+
), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === Je ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
743
|
+
}
|
|
744
|
+
function mt(e, t) {
|
|
745
|
+
return typeof e == "function" ? e(...t) : !!e;
|
|
746
|
+
}
|
|
747
|
+
function wr(e, t, s) {
|
|
748
|
+
let r = !1, i;
|
|
749
|
+
return Object.defineProperty(e, "signal", {
|
|
750
|
+
enumerable: !0,
|
|
751
|
+
get: () => (i ??= t(), r || (r = !0, i.aborted ? s() : i.addEventListener("abort", s, { once: !0 })), i)
|
|
752
|
+
}), e;
|
|
753
|
+
}
|
|
754
|
+
var jr = class extends Ce {
|
|
755
|
+
#e;
|
|
756
|
+
#t;
|
|
757
|
+
#s;
|
|
758
|
+
constructor() {
|
|
759
|
+
super(), this.#s = (e) => {
|
|
760
|
+
if (!je && window.addEventListener) {
|
|
761
|
+
const t = () => e();
|
|
762
|
+
return window.addEventListener("visibilitychange", t, !1), () => {
|
|
763
|
+
window.removeEventListener("visibilitychange", t);
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
onSubscribe() {
|
|
769
|
+
this.#t || this.setEventListener(this.#s);
|
|
770
|
+
}
|
|
771
|
+
onUnsubscribe() {
|
|
772
|
+
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
773
|
+
}
|
|
774
|
+
setEventListener(e) {
|
|
775
|
+
this.#s = e, this.#t?.(), this.#t = e((t) => {
|
|
776
|
+
typeof t == "boolean" ? this.setFocused(t) : this.onFocus();
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
setFocused(e) {
|
|
780
|
+
this.#e !== e && (this.#e = e, this.onFocus());
|
|
781
|
+
}
|
|
782
|
+
onFocus() {
|
|
783
|
+
const e = this.isFocused();
|
|
784
|
+
this.listeners.forEach((t) => {
|
|
785
|
+
t(e);
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
isFocused() {
|
|
789
|
+
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
790
|
+
}
|
|
791
|
+
}, pt = new jr();
|
|
792
|
+
function ot() {
|
|
793
|
+
let e, t;
|
|
794
|
+
const s = new Promise((i, a) => {
|
|
795
|
+
e = i, t = a;
|
|
796
|
+
});
|
|
797
|
+
s.status = "pending", s.catch(() => {
|
|
798
|
+
});
|
|
799
|
+
function r(i) {
|
|
800
|
+
Object.assign(s, i), delete s.resolve, delete s.reject;
|
|
801
|
+
}
|
|
802
|
+
return s.resolve = (i) => {
|
|
803
|
+
r({
|
|
804
|
+
status: "fulfilled",
|
|
805
|
+
value: i
|
|
806
|
+
}), e(i);
|
|
807
|
+
}, s.reject = (i) => {
|
|
808
|
+
r({
|
|
809
|
+
status: "rejected",
|
|
810
|
+
reason: i
|
|
811
|
+
}), t(i);
|
|
812
|
+
}, s;
|
|
813
|
+
}
|
|
814
|
+
var Rr = gr;
|
|
815
|
+
function Nr() {
|
|
816
|
+
let e = [], t = 0, s = (o) => {
|
|
817
|
+
o();
|
|
818
|
+
}, r = (o) => {
|
|
819
|
+
o();
|
|
820
|
+
}, i = Rr;
|
|
821
|
+
const a = (o) => {
|
|
822
|
+
t ? e.push(o) : i(() => {
|
|
823
|
+
s(o);
|
|
824
|
+
});
|
|
825
|
+
}, l = () => {
|
|
826
|
+
const o = e;
|
|
827
|
+
e = [], o.length && i(() => {
|
|
828
|
+
r(() => {
|
|
829
|
+
o.forEach((g) => {
|
|
830
|
+
s(g);
|
|
831
|
+
});
|
|
832
|
+
});
|
|
833
|
+
});
|
|
834
|
+
};
|
|
835
|
+
return {
|
|
836
|
+
batch: (o) => {
|
|
837
|
+
let g;
|
|
838
|
+
t++;
|
|
839
|
+
try {
|
|
840
|
+
g = o();
|
|
841
|
+
} finally {
|
|
842
|
+
t--, t || l();
|
|
843
|
+
}
|
|
844
|
+
return g;
|
|
845
|
+
},
|
|
846
|
+
/**
|
|
847
|
+
* All calls to the wrapped function will be batched.
|
|
848
|
+
*/
|
|
849
|
+
batchCalls: (o) => (...g) => {
|
|
850
|
+
a(() => {
|
|
851
|
+
o(...g);
|
|
852
|
+
});
|
|
853
|
+
},
|
|
854
|
+
schedule: a,
|
|
855
|
+
/**
|
|
856
|
+
* Use this method to set a custom notify function.
|
|
857
|
+
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
858
|
+
*/
|
|
859
|
+
setNotifyFunction: (o) => {
|
|
860
|
+
s = o;
|
|
861
|
+
},
|
|
862
|
+
/**
|
|
863
|
+
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
864
|
+
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
865
|
+
*/
|
|
866
|
+
setBatchNotifyFunction: (o) => {
|
|
867
|
+
r = o;
|
|
868
|
+
},
|
|
869
|
+
setScheduler: (o) => {
|
|
870
|
+
i = o;
|
|
871
|
+
}
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
var ne = Nr(), Ir = class extends Ce {
|
|
875
|
+
#e = !0;
|
|
876
|
+
#t;
|
|
877
|
+
#s;
|
|
878
|
+
constructor() {
|
|
879
|
+
super(), this.#s = (e) => {
|
|
880
|
+
if (!je && window.addEventListener) {
|
|
881
|
+
const t = () => e(!0), s = () => e(!1);
|
|
882
|
+
return window.addEventListener("online", t, !1), window.addEventListener("offline", s, !1), () => {
|
|
883
|
+
window.removeEventListener("online", t), window.removeEventListener("offline", s);
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
onSubscribe() {
|
|
889
|
+
this.#t || this.setEventListener(this.#s);
|
|
890
|
+
}
|
|
891
|
+
onUnsubscribe() {
|
|
892
|
+
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
893
|
+
}
|
|
894
|
+
setEventListener(e) {
|
|
895
|
+
this.#s = e, this.#t?.(), this.#t = e(this.setOnline.bind(this));
|
|
896
|
+
}
|
|
897
|
+
setOnline(e) {
|
|
898
|
+
this.#e !== e && (this.#e = e, this.listeners.forEach((s) => {
|
|
899
|
+
s(e);
|
|
900
|
+
}));
|
|
901
|
+
}
|
|
902
|
+
isOnline() {
|
|
903
|
+
return this.#e;
|
|
904
|
+
}
|
|
905
|
+
}, Ve = new Ir();
|
|
906
|
+
function Tr(e) {
|
|
907
|
+
return Math.min(1e3 * 2 ** e, 3e4);
|
|
908
|
+
}
|
|
909
|
+
function ss(e) {
|
|
910
|
+
return (e ?? "online") === "online" ? Ve.isOnline() : !0;
|
|
911
|
+
}
|
|
912
|
+
var lt = class extends Error {
|
|
913
|
+
constructor(e) {
|
|
914
|
+
super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
function rs(e) {
|
|
918
|
+
let t = !1, s = 0, r;
|
|
919
|
+
const i = ot(), a = () => i.status !== "pending", l = (E) => {
|
|
920
|
+
if (!a()) {
|
|
921
|
+
const P = new lt(E);
|
|
922
|
+
m(P), e.onCancel?.(P);
|
|
923
|
+
}
|
|
924
|
+
}, o = () => {
|
|
925
|
+
t = !0;
|
|
926
|
+
}, g = () => {
|
|
927
|
+
t = !1;
|
|
928
|
+
}, x = () => pt.isFocused() && (e.networkMode === "always" || Ve.isOnline()) && e.canRun(), p = () => ss(e.networkMode) && e.canRun(), T = (E) => {
|
|
929
|
+
a() || (r?.(), i.resolve(E));
|
|
930
|
+
}, m = (E) => {
|
|
931
|
+
a() || (r?.(), i.reject(E));
|
|
932
|
+
}, A = () => new Promise((E) => {
|
|
933
|
+
r = (P) => {
|
|
934
|
+
(a() || x()) && E(P);
|
|
935
|
+
}, e.onPause?.();
|
|
936
|
+
}).then(() => {
|
|
937
|
+
r = void 0, a() || e.onContinue?.();
|
|
938
|
+
}), j = () => {
|
|
939
|
+
if (a())
|
|
940
|
+
return;
|
|
941
|
+
let E;
|
|
942
|
+
const P = s === 0 ? e.initialPromise : void 0;
|
|
943
|
+
try {
|
|
944
|
+
E = P ?? e.fn();
|
|
945
|
+
} catch (W) {
|
|
946
|
+
E = Promise.reject(W);
|
|
947
|
+
}
|
|
948
|
+
Promise.resolve(E).then(T).catch((W) => {
|
|
949
|
+
if (a())
|
|
950
|
+
return;
|
|
951
|
+
const q = e.retry ?? (je ? 0 : 3), Y = e.retryDelay ?? Tr, J = typeof Y == "function" ? Y(s, W) : Y, X = q === !0 || typeof q == "number" && s < q || typeof q == "function" && q(s, W);
|
|
952
|
+
if (t || !X) {
|
|
953
|
+
m(W);
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
s++, e.onFail?.(s, W), xr(J).then(() => x() ? void 0 : A()).then(() => {
|
|
957
|
+
t ? m(W) : j();
|
|
958
|
+
});
|
|
959
|
+
});
|
|
960
|
+
};
|
|
961
|
+
return {
|
|
962
|
+
promise: i,
|
|
963
|
+
status: () => i.status,
|
|
964
|
+
cancel: l,
|
|
965
|
+
continue: () => (r?.(), i),
|
|
966
|
+
cancelRetry: o,
|
|
967
|
+
continueRetry: g,
|
|
968
|
+
canStart: p,
|
|
969
|
+
start: () => (p() ? j() : A().then(j), i)
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
var ns = class {
|
|
973
|
+
#e;
|
|
974
|
+
destroy() {
|
|
975
|
+
this.clearGcTimeout();
|
|
976
|
+
}
|
|
977
|
+
scheduleGc() {
|
|
978
|
+
this.clearGcTimeout(), rt(this.gcTime) && (this.#e = we.setTimeout(() => {
|
|
979
|
+
this.optionalRemove();
|
|
980
|
+
}, this.gcTime));
|
|
981
|
+
}
|
|
982
|
+
updateGcTime(e) {
|
|
983
|
+
this.gcTime = Math.max(
|
|
984
|
+
this.gcTime || 0,
|
|
985
|
+
e ?? (je ? 1 / 0 : 300 * 1e3)
|
|
986
|
+
);
|
|
987
|
+
}
|
|
988
|
+
clearGcTimeout() {
|
|
989
|
+
this.#e && (we.clearTimeout(this.#e), this.#e = void 0);
|
|
990
|
+
}
|
|
991
|
+
}, Er = class extends ns {
|
|
992
|
+
#e;
|
|
993
|
+
#t;
|
|
994
|
+
#s;
|
|
995
|
+
#n;
|
|
996
|
+
#r;
|
|
997
|
+
#a;
|
|
998
|
+
#o;
|
|
999
|
+
constructor(e) {
|
|
1000
|
+
super(), this.#o = !1, this.#a = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#n = e.client, this.#s = this.#n.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#e = Lt(this.options), this.state = e.state ?? this.#e, this.scheduleGc();
|
|
1001
|
+
}
|
|
1002
|
+
get meta() {
|
|
1003
|
+
return this.options.meta;
|
|
1004
|
+
}
|
|
1005
|
+
get promise() {
|
|
1006
|
+
return this.#r?.promise;
|
|
1007
|
+
}
|
|
1008
|
+
setOptions(e) {
|
|
1009
|
+
if (this.options = { ...this.#a, ...e }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
1010
|
+
const t = Lt(this.options);
|
|
1011
|
+
t.data !== void 0 && (this.setState(
|
|
1012
|
+
Dt(t.data, t.dataUpdatedAt)
|
|
1013
|
+
), this.#e = t);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
optionalRemove() {
|
|
1017
|
+
!this.observers.length && this.state.fetchStatus === "idle" && this.#s.remove(this);
|
|
1018
|
+
}
|
|
1019
|
+
setData(e, t) {
|
|
1020
|
+
const s = at(this.state.data, e, this.options);
|
|
1021
|
+
return this.#i({
|
|
1022
|
+
data: s,
|
|
1023
|
+
type: "success",
|
|
1024
|
+
dataUpdatedAt: t?.updatedAt,
|
|
1025
|
+
manual: t?.manual
|
|
1026
|
+
}), s;
|
|
1027
|
+
}
|
|
1028
|
+
setState(e, t) {
|
|
1029
|
+
this.#i({ type: "setState", state: e, setStateOptions: t });
|
|
1030
|
+
}
|
|
1031
|
+
cancel(e) {
|
|
1032
|
+
const t = this.#r?.promise;
|
|
1033
|
+
return this.#r?.cancel(e), t ? t.then(ce).catch(ce) : Promise.resolve();
|
|
1034
|
+
}
|
|
1035
|
+
destroy() {
|
|
1036
|
+
super.destroy(), this.cancel({ silent: !0 });
|
|
1037
|
+
}
|
|
1038
|
+
reset() {
|
|
1039
|
+
this.destroy(), this.setState(this.#e);
|
|
1040
|
+
}
|
|
1041
|
+
isActive() {
|
|
1042
|
+
return this.observers.some(
|
|
1043
|
+
(e) => fe(e.options.enabled, this) !== !1
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
isDisabled() {
|
|
1047
|
+
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === Je || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
1048
|
+
}
|
|
1049
|
+
isStatic() {
|
|
1050
|
+
return this.getObserversCount() > 0 ? this.observers.some(
|
|
1051
|
+
(e) => be(e.options.staleTime, this) === "static"
|
|
1052
|
+
) : !1;
|
|
1053
|
+
}
|
|
1054
|
+
isStale() {
|
|
1055
|
+
return this.getObserversCount() > 0 ? this.observers.some(
|
|
1056
|
+
(e) => e.getCurrentResult().isStale
|
|
1057
|
+
) : this.state.data === void 0 || this.state.isInvalidated;
|
|
1058
|
+
}
|
|
1059
|
+
isStaleByTime(e = 0) {
|
|
1060
|
+
return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !es(this.state.dataUpdatedAt, e);
|
|
1061
|
+
}
|
|
1062
|
+
onFocus() {
|
|
1063
|
+
this.observers.find((t) => t.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#r?.continue();
|
|
1064
|
+
}
|
|
1065
|
+
onOnline() {
|
|
1066
|
+
this.observers.find((t) => t.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), this.#r?.continue();
|
|
1067
|
+
}
|
|
1068
|
+
addObserver(e) {
|
|
1069
|
+
this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), this.#s.notify({ type: "observerAdded", query: this, observer: e }));
|
|
1070
|
+
}
|
|
1071
|
+
removeObserver(e) {
|
|
1072
|
+
this.observers.includes(e) && (this.observers = this.observers.filter((t) => t !== e), this.observers.length || (this.#r && (this.#o ? this.#r.cancel({ revert: !0 }) : this.#r.cancelRetry()), this.scheduleGc()), this.#s.notify({ type: "observerRemoved", query: this, observer: e }));
|
|
1073
|
+
}
|
|
1074
|
+
getObserversCount() {
|
|
1075
|
+
return this.observers.length;
|
|
1076
|
+
}
|
|
1077
|
+
invalidate() {
|
|
1078
|
+
this.state.isInvalidated || this.#i({ type: "invalidate" });
|
|
1079
|
+
}
|
|
1080
|
+
async fetch(e, t) {
|
|
1081
|
+
if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
|
|
1082
|
+
// re-start the fetch; there is a chance that the query is still in a
|
|
1083
|
+
// pending state when that happens
|
|
1084
|
+
this.#r?.status() !== "rejected") {
|
|
1085
|
+
if (this.state.data !== void 0 && t?.cancelRefetch)
|
|
1086
|
+
this.cancel({ silent: !0 });
|
|
1087
|
+
else if (this.#r)
|
|
1088
|
+
return this.#r.continueRetry(), this.#r.promise;
|
|
1089
|
+
}
|
|
1090
|
+
if (e && this.setOptions(e), !this.options.queryFn) {
|
|
1091
|
+
const o = this.observers.find((g) => g.options.queryFn);
|
|
1092
|
+
o && this.setOptions(o.options);
|
|
1093
|
+
}
|
|
1094
|
+
process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
|
|
1095
|
+
"As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"
|
|
1096
|
+
));
|
|
1097
|
+
const s = new AbortController(), r = (o) => {
|
|
1098
|
+
Object.defineProperty(o, "signal", {
|
|
1099
|
+
enumerable: !0,
|
|
1100
|
+
get: () => (this.#o = !0, s.signal)
|
|
1101
|
+
});
|
|
1102
|
+
}, i = () => {
|
|
1103
|
+
const o = ts(this.options, t), x = (() => {
|
|
1104
|
+
const p = {
|
|
1105
|
+
client: this.#n,
|
|
1106
|
+
queryKey: this.queryKey,
|
|
1107
|
+
meta: this.meta
|
|
1108
|
+
};
|
|
1109
|
+
return r(p), p;
|
|
1110
|
+
})();
|
|
1111
|
+
return this.#o = !1, this.options.persister ? this.options.persister(
|
|
1112
|
+
o,
|
|
1113
|
+
x,
|
|
1114
|
+
this
|
|
1115
|
+
) : o(x);
|
|
1116
|
+
}, l = (() => {
|
|
1117
|
+
const o = {
|
|
1118
|
+
fetchOptions: t,
|
|
1119
|
+
options: this.options,
|
|
1120
|
+
queryKey: this.queryKey,
|
|
1121
|
+
client: this.#n,
|
|
1122
|
+
state: this.state,
|
|
1123
|
+
fetchFn: i
|
|
1124
|
+
};
|
|
1125
|
+
return r(o), o;
|
|
1126
|
+
})();
|
|
1127
|
+
this.options.behavior?.onFetch(l, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== l.fetchOptions?.meta) && this.#i({ type: "fetch", meta: l.fetchOptions?.meta }), this.#r = rs({
|
|
1128
|
+
initialPromise: t?.initialPromise,
|
|
1129
|
+
fn: l.fetchFn,
|
|
1130
|
+
onCancel: (o) => {
|
|
1131
|
+
o instanceof lt && o.revert && this.setState({
|
|
1132
|
+
...this.#t,
|
|
1133
|
+
fetchStatus: "idle"
|
|
1134
|
+
}), s.abort();
|
|
1135
|
+
},
|
|
1136
|
+
onFail: (o, g) => {
|
|
1137
|
+
this.#i({ type: "failed", failureCount: o, error: g });
|
|
1138
|
+
},
|
|
1139
|
+
onPause: () => {
|
|
1140
|
+
this.#i({ type: "pause" });
|
|
1141
|
+
},
|
|
1142
|
+
onContinue: () => {
|
|
1143
|
+
this.#i({ type: "continue" });
|
|
1144
|
+
},
|
|
1145
|
+
retry: l.options.retry,
|
|
1146
|
+
retryDelay: l.options.retryDelay,
|
|
1147
|
+
networkMode: l.options.networkMode,
|
|
1148
|
+
canRun: () => !0
|
|
1149
|
+
});
|
|
1150
|
+
try {
|
|
1151
|
+
const o = await this.#r.start();
|
|
1152
|
+
if (o === void 0)
|
|
1153
|
+
throw process.env.NODE_ENV !== "production" && console.error(
|
|
1154
|
+
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
1155
|
+
), new Error(`${this.queryHash} data is undefined`);
|
|
1156
|
+
return this.setData(o), this.#s.config.onSuccess?.(o, this), this.#s.config.onSettled?.(
|
|
1157
|
+
o,
|
|
1158
|
+
this.state.error,
|
|
1159
|
+
this
|
|
1160
|
+
), o;
|
|
1161
|
+
} catch (o) {
|
|
1162
|
+
if (o instanceof lt) {
|
|
1163
|
+
if (o.silent)
|
|
1164
|
+
return this.#r.promise;
|
|
1165
|
+
if (o.revert) {
|
|
1166
|
+
if (this.state.data === void 0)
|
|
1167
|
+
throw o;
|
|
1168
|
+
return this.state.data;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
throw this.#i({
|
|
1172
|
+
type: "error",
|
|
1173
|
+
error: o
|
|
1174
|
+
}), this.#s.config.onError?.(
|
|
1175
|
+
o,
|
|
1176
|
+
this
|
|
1177
|
+
), this.#s.config.onSettled?.(
|
|
1178
|
+
this.state.data,
|
|
1179
|
+
o,
|
|
1180
|
+
this
|
|
1181
|
+
), o;
|
|
1182
|
+
} finally {
|
|
1183
|
+
this.scheduleGc();
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
#i(e) {
|
|
1187
|
+
const t = (s) => {
|
|
1188
|
+
switch (e.type) {
|
|
1189
|
+
case "failed":
|
|
1190
|
+
return {
|
|
1191
|
+
...s,
|
|
1192
|
+
fetchFailureCount: e.failureCount,
|
|
1193
|
+
fetchFailureReason: e.error
|
|
1194
|
+
};
|
|
1195
|
+
case "pause":
|
|
1196
|
+
return {
|
|
1197
|
+
...s,
|
|
1198
|
+
fetchStatus: "paused"
|
|
1199
|
+
};
|
|
1200
|
+
case "continue":
|
|
1201
|
+
return {
|
|
1202
|
+
...s,
|
|
1203
|
+
fetchStatus: "fetching"
|
|
1204
|
+
};
|
|
1205
|
+
case "fetch":
|
|
1206
|
+
return {
|
|
1207
|
+
...s,
|
|
1208
|
+
...is(s.data, this.options),
|
|
1209
|
+
fetchMeta: e.meta ?? null
|
|
1210
|
+
};
|
|
1211
|
+
case "success":
|
|
1212
|
+
const r = {
|
|
1213
|
+
...s,
|
|
1214
|
+
...Dt(e.data, e.dataUpdatedAt),
|
|
1215
|
+
dataUpdateCount: s.dataUpdateCount + 1,
|
|
1216
|
+
...!e.manual && {
|
|
1217
|
+
fetchStatus: "idle",
|
|
1218
|
+
fetchFailureCount: 0,
|
|
1219
|
+
fetchFailureReason: null
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
return this.#t = e.manual ? r : void 0, r;
|
|
1223
|
+
case "error":
|
|
1224
|
+
const i = e.error;
|
|
1225
|
+
return {
|
|
1226
|
+
...s,
|
|
1227
|
+
error: i,
|
|
1228
|
+
errorUpdateCount: s.errorUpdateCount + 1,
|
|
1229
|
+
errorUpdatedAt: Date.now(),
|
|
1230
|
+
fetchFailureCount: s.fetchFailureCount + 1,
|
|
1231
|
+
fetchFailureReason: i,
|
|
1232
|
+
fetchStatus: "idle",
|
|
1233
|
+
status: "error",
|
|
1234
|
+
// flag existing data as invalidated if we get a background error
|
|
1235
|
+
// note that "no data" always means stale so we can set unconditionally here
|
|
1236
|
+
isInvalidated: !0
|
|
1237
|
+
};
|
|
1238
|
+
case "invalidate":
|
|
1239
|
+
return {
|
|
1240
|
+
...s,
|
|
1241
|
+
isInvalidated: !0
|
|
1242
|
+
};
|
|
1243
|
+
case "setState":
|
|
1244
|
+
return {
|
|
1245
|
+
...s,
|
|
1246
|
+
...e.state
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
};
|
|
1250
|
+
this.state = t(this.state), ne.batch(() => {
|
|
1251
|
+
this.observers.forEach((s) => {
|
|
1252
|
+
s.onQueryUpdate();
|
|
1253
|
+
}), this.#s.notify({ query: this, type: "updated", action: e });
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
function is(e, t) {
|
|
1258
|
+
return {
|
|
1259
|
+
fetchFailureCount: 0,
|
|
1260
|
+
fetchFailureReason: null,
|
|
1261
|
+
fetchStatus: ss(t.networkMode) ? "fetching" : "paused",
|
|
1262
|
+
...e === void 0 && {
|
|
1263
|
+
error: null,
|
|
1264
|
+
status: "pending"
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1268
|
+
function Dt(e, t) {
|
|
1269
|
+
return {
|
|
1270
|
+
data: e,
|
|
1271
|
+
dataUpdatedAt: t ?? Date.now(),
|
|
1272
|
+
error: null,
|
|
1273
|
+
isInvalidated: !1,
|
|
1274
|
+
status: "success"
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
function Lt(e) {
|
|
1278
|
+
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = t !== void 0, r = s ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
1279
|
+
return {
|
|
1280
|
+
data: t,
|
|
1281
|
+
dataUpdateCount: 0,
|
|
1282
|
+
dataUpdatedAt: s ? r ?? Date.now() : 0,
|
|
1283
|
+
error: null,
|
|
1284
|
+
errorUpdateCount: 0,
|
|
1285
|
+
errorUpdatedAt: 0,
|
|
1286
|
+
fetchFailureCount: 0,
|
|
1287
|
+
fetchFailureReason: null,
|
|
1288
|
+
fetchMeta: null,
|
|
1289
|
+
isInvalidated: !1,
|
|
1290
|
+
status: s ? "success" : "pending",
|
|
1291
|
+
fetchStatus: "idle"
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
var Cr = class extends Ce {
|
|
1295
|
+
constructor(e, t) {
|
|
1296
|
+
super(), this.options = t, this.#e = e, this.#i = null, this.#o = ot(), this.bindMethods(), this.setOptions(t);
|
|
1297
|
+
}
|
|
1298
|
+
#e;
|
|
1299
|
+
#t = void 0;
|
|
1300
|
+
#s = void 0;
|
|
1301
|
+
#n = void 0;
|
|
1302
|
+
#r;
|
|
1303
|
+
#a;
|
|
1304
|
+
#o;
|
|
1305
|
+
#i;
|
|
1306
|
+
#p;
|
|
1307
|
+
#h;
|
|
1308
|
+
// This property keeps track of the last query with defined data.
|
|
1309
|
+
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
1310
|
+
#f;
|
|
1311
|
+
#c;
|
|
1312
|
+
#u;
|
|
1313
|
+
#l;
|
|
1314
|
+
#m = /* @__PURE__ */ new Set();
|
|
1315
|
+
bindMethods() {
|
|
1316
|
+
this.refetch = this.refetch.bind(this);
|
|
1317
|
+
}
|
|
1318
|
+
onSubscribe() {
|
|
1319
|
+
this.listeners.size === 1 && (this.#t.addObserver(this), Bt(this.#t, this.options) ? this.#d() : this.updateResult(), this.#v());
|
|
1320
|
+
}
|
|
1321
|
+
onUnsubscribe() {
|
|
1322
|
+
this.hasListeners() || this.destroy();
|
|
1323
|
+
}
|
|
1324
|
+
shouldFetchOnReconnect() {
|
|
1325
|
+
return ct(
|
|
1326
|
+
this.#t,
|
|
1327
|
+
this.options,
|
|
1328
|
+
this.options.refetchOnReconnect
|
|
1329
|
+
);
|
|
1330
|
+
}
|
|
1331
|
+
shouldFetchOnWindowFocus() {
|
|
1332
|
+
return ct(
|
|
1333
|
+
this.#t,
|
|
1334
|
+
this.options,
|
|
1335
|
+
this.options.refetchOnWindowFocus
|
|
1336
|
+
);
|
|
1337
|
+
}
|
|
1338
|
+
destroy() {
|
|
1339
|
+
this.listeners = /* @__PURE__ */ new Set(), this.#x(), this.#b(), this.#t.removeObserver(this);
|
|
1340
|
+
}
|
|
1341
|
+
setOptions(e) {
|
|
1342
|
+
const t = this.options, s = this.#t;
|
|
1343
|
+
if (this.options = this.#e.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof fe(this.options.enabled, this.#t) != "boolean")
|
|
1344
|
+
throw new Error(
|
|
1345
|
+
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
1346
|
+
);
|
|
1347
|
+
this.#S(), this.#t.setOptions(this.options), t._defaulted && !Xe(this.options, t) && this.#e.getQueryCache().notify({
|
|
1348
|
+
type: "observerOptionsUpdated",
|
|
1349
|
+
query: this.#t,
|
|
1350
|
+
observer: this
|
|
1351
|
+
});
|
|
1352
|
+
const r = this.hasListeners();
|
|
1353
|
+
r && Qt(
|
|
1354
|
+
this.#t,
|
|
1355
|
+
s,
|
|
1356
|
+
this.options,
|
|
1357
|
+
t
|
|
1358
|
+
) && this.#d(), this.updateResult(), r && (this.#t !== s || fe(this.options.enabled, this.#t) !== fe(t.enabled, this.#t) || be(this.options.staleTime, this.#t) !== be(t.staleTime, this.#t)) && this.#y();
|
|
1359
|
+
const i = this.#g();
|
|
1360
|
+
r && (this.#t !== s || fe(this.options.enabled, this.#t) !== fe(t.enabled, this.#t) || i !== this.#l) && this.#A(i);
|
|
1361
|
+
}
|
|
1362
|
+
getOptimisticResult(e) {
|
|
1363
|
+
const t = this.#e.getQueryCache().build(this.#e, e), s = this.createResult(t, e);
|
|
1364
|
+
return kr(this, s) && (this.#n = s, this.#a = this.options, this.#r = this.#t.state), s;
|
|
1365
|
+
}
|
|
1366
|
+
getCurrentResult() {
|
|
1367
|
+
return this.#n;
|
|
1368
|
+
}
|
|
1369
|
+
trackResult(e, t) {
|
|
1370
|
+
return new Proxy(e, {
|
|
1371
|
+
get: (s, r) => (this.trackProp(r), t?.(r), r === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && this.#o.status === "pending" && this.#o.reject(
|
|
1372
|
+
new Error(
|
|
1373
|
+
"experimental_prefetchInRender feature flag is not enabled"
|
|
1374
|
+
)
|
|
1375
|
+
)), Reflect.get(s, r))
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
trackProp(e) {
|
|
1379
|
+
this.#m.add(e);
|
|
1380
|
+
}
|
|
1381
|
+
getCurrentQuery() {
|
|
1382
|
+
return this.#t;
|
|
1383
|
+
}
|
|
1384
|
+
refetch({ ...e } = {}) {
|
|
1385
|
+
return this.fetch({
|
|
1386
|
+
...e
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
fetchOptimistic(e) {
|
|
1390
|
+
const t = this.#e.defaultQueryOptions(e), s = this.#e.getQueryCache().build(this.#e, t);
|
|
1391
|
+
return s.fetch().then(() => this.createResult(s, t));
|
|
1392
|
+
}
|
|
1393
|
+
fetch(e) {
|
|
1394
|
+
return this.#d({
|
|
1395
|
+
...e,
|
|
1396
|
+
cancelRefetch: e.cancelRefetch ?? !0
|
|
1397
|
+
}).then(() => (this.updateResult(), this.#n));
|
|
1398
|
+
}
|
|
1399
|
+
#d(e) {
|
|
1400
|
+
this.#S();
|
|
1401
|
+
let t = this.#t.fetch(
|
|
1402
|
+
this.options,
|
|
1403
|
+
e
|
|
1404
|
+
);
|
|
1405
|
+
return e?.throwOnError || (t = t.catch(ce)), t;
|
|
1406
|
+
}
|
|
1407
|
+
#y() {
|
|
1408
|
+
this.#x();
|
|
1409
|
+
const e = be(
|
|
1410
|
+
this.options.staleTime,
|
|
1411
|
+
this.#t
|
|
1412
|
+
);
|
|
1413
|
+
if (je || this.#n.isStale || !rt(e))
|
|
1414
|
+
return;
|
|
1415
|
+
const s = es(this.#n.dataUpdatedAt, e) + 1;
|
|
1416
|
+
this.#c = we.setTimeout(() => {
|
|
1417
|
+
this.#n.isStale || this.updateResult();
|
|
1418
|
+
}, s);
|
|
1419
|
+
}
|
|
1420
|
+
#g() {
|
|
1421
|
+
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
|
|
1422
|
+
}
|
|
1423
|
+
#A(e) {
|
|
1424
|
+
this.#b(), this.#l = e, !(je || fe(this.options.enabled, this.#t) === !1 || !rt(this.#l) || this.#l === 0) && (this.#u = we.setInterval(() => {
|
|
1425
|
+
(this.options.refetchIntervalInBackground || pt.isFocused()) && this.#d();
|
|
1426
|
+
}, this.#l));
|
|
1427
|
+
}
|
|
1428
|
+
#v() {
|
|
1429
|
+
this.#y(), this.#A(this.#g());
|
|
1430
|
+
}
|
|
1431
|
+
#x() {
|
|
1432
|
+
this.#c && (we.clearTimeout(this.#c), this.#c = void 0);
|
|
1433
|
+
}
|
|
1434
|
+
#b() {
|
|
1435
|
+
this.#u && (we.clearInterval(this.#u), this.#u = void 0);
|
|
1436
|
+
}
|
|
1437
|
+
createResult(e, t) {
|
|
1438
|
+
const s = this.#t, r = this.options, i = this.#n, a = this.#r, l = this.#a, g = e !== s ? e.state : this.#s, { state: x } = e;
|
|
1439
|
+
let p = { ...x }, T = !1, m;
|
|
1440
|
+
if (t._optimisticResults) {
|
|
1441
|
+
const I = this.hasListeners(), M = !I && Bt(e, t), R = I && Qt(e, s, t, r);
|
|
1442
|
+
(M || R) && (p = {
|
|
1443
|
+
...p,
|
|
1444
|
+
...is(x.data, e.options)
|
|
1445
|
+
}), t._optimisticResults === "isRestoring" && (p.fetchStatus = "idle");
|
|
1446
|
+
}
|
|
1447
|
+
let { error: A, errorUpdatedAt: j, status: E } = p;
|
|
1448
|
+
m = p.data;
|
|
1449
|
+
let P = !1;
|
|
1450
|
+
if (t.placeholderData !== void 0 && m === void 0 && E === "pending") {
|
|
1451
|
+
let I;
|
|
1452
|
+
i?.isPlaceholderData && t.placeholderData === l?.placeholderData ? (I = i.data, P = !0) : I = typeof t.placeholderData == "function" ? t.placeholderData(
|
|
1453
|
+
this.#f?.state.data,
|
|
1454
|
+
this.#f
|
|
1455
|
+
) : t.placeholderData, I !== void 0 && (E = "success", m = at(
|
|
1456
|
+
i?.data,
|
|
1457
|
+
I,
|
|
1458
|
+
t
|
|
1459
|
+
), T = !0);
|
|
1460
|
+
}
|
|
1461
|
+
if (t.select && m !== void 0 && !P)
|
|
1462
|
+
if (i && m === a?.data && t.select === this.#p)
|
|
1463
|
+
m = this.#h;
|
|
1464
|
+
else
|
|
1465
|
+
try {
|
|
1466
|
+
this.#p = t.select, m = t.select(m), m = at(i?.data, m, t), this.#h = m, this.#i = null;
|
|
1467
|
+
} catch (I) {
|
|
1468
|
+
this.#i = I;
|
|
1469
|
+
}
|
|
1470
|
+
this.#i && (A = this.#i, m = this.#h, j = Date.now(), E = "error");
|
|
1471
|
+
const W = p.fetchStatus === "fetching", q = E === "pending", Y = E === "error", J = q && W, X = m !== void 0, w = {
|
|
1472
|
+
status: E,
|
|
1473
|
+
fetchStatus: p.fetchStatus,
|
|
1474
|
+
isPending: q,
|
|
1475
|
+
isSuccess: E === "success",
|
|
1476
|
+
isError: Y,
|
|
1477
|
+
isInitialLoading: J,
|
|
1478
|
+
isLoading: J,
|
|
1479
|
+
data: m,
|
|
1480
|
+
dataUpdatedAt: p.dataUpdatedAt,
|
|
1481
|
+
error: A,
|
|
1482
|
+
errorUpdatedAt: j,
|
|
1483
|
+
failureCount: p.fetchFailureCount,
|
|
1484
|
+
failureReason: p.fetchFailureReason,
|
|
1485
|
+
errorUpdateCount: p.errorUpdateCount,
|
|
1486
|
+
isFetched: p.dataUpdateCount > 0 || p.errorUpdateCount > 0,
|
|
1487
|
+
isFetchedAfterMount: p.dataUpdateCount > g.dataUpdateCount || p.errorUpdateCount > g.errorUpdateCount,
|
|
1488
|
+
isFetching: W,
|
|
1489
|
+
isRefetching: W && !q,
|
|
1490
|
+
isLoadingError: Y && !X,
|
|
1491
|
+
isPaused: p.fetchStatus === "paused",
|
|
1492
|
+
isPlaceholderData: T,
|
|
1493
|
+
isRefetchError: Y && X,
|
|
1494
|
+
isStale: yt(e, t),
|
|
1495
|
+
refetch: this.refetch,
|
|
1496
|
+
promise: this.#o,
|
|
1497
|
+
isEnabled: fe(t.enabled, e) !== !1
|
|
1498
|
+
};
|
|
1499
|
+
if (this.options.experimental_prefetchInRender) {
|
|
1500
|
+
const I = (b) => {
|
|
1501
|
+
w.status === "error" ? b.reject(w.error) : w.data !== void 0 && b.resolve(w.data);
|
|
1502
|
+
}, M = () => {
|
|
1503
|
+
const b = this.#o = w.promise = ot();
|
|
1504
|
+
I(b);
|
|
1505
|
+
}, R = this.#o;
|
|
1506
|
+
switch (R.status) {
|
|
1507
|
+
case "pending":
|
|
1508
|
+
e.queryHash === s.queryHash && I(R);
|
|
1509
|
+
break;
|
|
1510
|
+
case "fulfilled":
|
|
1511
|
+
(w.status === "error" || w.data !== R.value) && M();
|
|
1512
|
+
break;
|
|
1513
|
+
case "rejected":
|
|
1514
|
+
(w.status !== "error" || w.error !== R.reason) && M();
|
|
1515
|
+
break;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
return w;
|
|
1519
|
+
}
|
|
1520
|
+
updateResult() {
|
|
1521
|
+
const e = this.#n, t = this.createResult(this.#t, this.options);
|
|
1522
|
+
if (this.#r = this.#t.state, this.#a = this.options, this.#r.data !== void 0 && (this.#f = this.#t), Xe(t, e))
|
|
1523
|
+
return;
|
|
1524
|
+
this.#n = t;
|
|
1525
|
+
const s = () => {
|
|
1526
|
+
if (!e)
|
|
1527
|
+
return !0;
|
|
1528
|
+
const { notifyOnChangeProps: r } = this.options, i = typeof r == "function" ? r() : r;
|
|
1529
|
+
if (i === "all" || !i && !this.#m.size)
|
|
1530
|
+
return !0;
|
|
1531
|
+
const a = new Set(
|
|
1532
|
+
i ?? this.#m
|
|
1533
|
+
);
|
|
1534
|
+
return this.options.throwOnError && a.add("error"), Object.keys(this.#n).some((l) => {
|
|
1535
|
+
const o = l;
|
|
1536
|
+
return this.#n[o] !== e[o] && a.has(o);
|
|
1537
|
+
});
|
|
1538
|
+
};
|
|
1539
|
+
this.#w({ listeners: s() });
|
|
1540
|
+
}
|
|
1541
|
+
#S() {
|
|
1542
|
+
const e = this.#e.getQueryCache().build(this.#e, this.options);
|
|
1543
|
+
if (e === this.#t)
|
|
1544
|
+
return;
|
|
1545
|
+
const t = this.#t;
|
|
1546
|
+
this.#t = e, this.#s = e.state, this.hasListeners() && (t?.removeObserver(this), e.addObserver(this));
|
|
1547
|
+
}
|
|
1548
|
+
onQueryUpdate() {
|
|
1549
|
+
this.updateResult(), this.hasListeners() && this.#v();
|
|
1550
|
+
}
|
|
1551
|
+
#w(e) {
|
|
1552
|
+
ne.batch(() => {
|
|
1553
|
+
e.listeners && this.listeners.forEach((t) => {
|
|
1554
|
+
t(this.#n);
|
|
1555
|
+
}), this.#e.getQueryCache().notify({
|
|
1556
|
+
query: this.#t,
|
|
1557
|
+
type: "observerResultsUpdated"
|
|
1558
|
+
});
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
function Or(e, t) {
|
|
1563
|
+
return fe(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
1564
|
+
}
|
|
1565
|
+
function Bt(e, t) {
|
|
1566
|
+
return Or(e, t) || e.state.data !== void 0 && ct(e, t, t.refetchOnMount);
|
|
1567
|
+
}
|
|
1568
|
+
function ct(e, t, s) {
|
|
1569
|
+
if (fe(t.enabled, e) !== !1 && be(t.staleTime, e) !== "static") {
|
|
1570
|
+
const r = typeof s == "function" ? s(e) : s;
|
|
1571
|
+
return r === "always" || r !== !1 && yt(e, t);
|
|
1572
|
+
}
|
|
1573
|
+
return !1;
|
|
1574
|
+
}
|
|
1575
|
+
function Qt(e, t, s, r) {
|
|
1576
|
+
return (e !== t || fe(r.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") && yt(e, s);
|
|
1577
|
+
}
|
|
1578
|
+
function yt(e, t) {
|
|
1579
|
+
return fe(t.enabled, e) !== !1 && e.isStaleByTime(be(t.staleTime, e));
|
|
1580
|
+
}
|
|
1581
|
+
function kr(e, t) {
|
|
1582
|
+
return !Xe(e.getCurrentResult(), t);
|
|
1583
|
+
}
|
|
1584
|
+
function qt(e) {
|
|
1585
|
+
return {
|
|
1586
|
+
onFetch: (t, s) => {
|
|
1587
|
+
const r = t.options, i = t.fetchOptions?.meta?.fetchMore?.direction, a = t.state.data?.pages || [], l = t.state.data?.pageParams || [];
|
|
1588
|
+
let o = { pages: [], pageParams: [] }, g = 0;
|
|
1589
|
+
const x = async () => {
|
|
1590
|
+
let p = !1;
|
|
1591
|
+
const T = (j) => {
|
|
1592
|
+
wr(
|
|
1593
|
+
j,
|
|
1594
|
+
() => t.signal,
|
|
1595
|
+
() => p = !0
|
|
1596
|
+
);
|
|
1597
|
+
}, m = ts(t.options, t.fetchOptions), A = async (j, E, P) => {
|
|
1598
|
+
if (p)
|
|
1599
|
+
return Promise.reject();
|
|
1600
|
+
if (E == null && j.pages.length)
|
|
1601
|
+
return Promise.resolve(j);
|
|
1602
|
+
const q = (() => {
|
|
1603
|
+
const V = {
|
|
1604
|
+
client: t.client,
|
|
1605
|
+
queryKey: t.queryKey,
|
|
1606
|
+
pageParam: E,
|
|
1607
|
+
direction: P ? "backward" : "forward",
|
|
1608
|
+
meta: t.options.meta
|
|
1609
|
+
};
|
|
1610
|
+
return T(V), V;
|
|
1611
|
+
})(), Y = await m(q), { maxPages: J } = t.options, X = P ? Sr : br;
|
|
1612
|
+
return {
|
|
1613
|
+
pages: X(j.pages, Y, J),
|
|
1614
|
+
pageParams: X(j.pageParams, E, J)
|
|
1615
|
+
};
|
|
1616
|
+
};
|
|
1617
|
+
if (i && a.length) {
|
|
1618
|
+
const j = i === "backward", E = j ? Ur : Wt, P = {
|
|
1619
|
+
pages: a,
|
|
1620
|
+
pageParams: l
|
|
1621
|
+
}, W = E(r, P);
|
|
1622
|
+
o = await A(P, W, j);
|
|
1623
|
+
} else {
|
|
1624
|
+
const j = e ?? a.length;
|
|
1625
|
+
do {
|
|
1626
|
+
const E = g === 0 ? l[0] ?? r.initialPageParam : Wt(r, o);
|
|
1627
|
+
if (g > 0 && E == null)
|
|
1628
|
+
break;
|
|
1629
|
+
o = await A(o, E), g++;
|
|
1630
|
+
} while (g < j);
|
|
1631
|
+
}
|
|
1632
|
+
return o;
|
|
1633
|
+
};
|
|
1634
|
+
t.options.persister ? t.fetchFn = () => t.options.persister?.(
|
|
1635
|
+
x,
|
|
1636
|
+
{
|
|
1637
|
+
client: t.client,
|
|
1638
|
+
queryKey: t.queryKey,
|
|
1639
|
+
meta: t.options.meta,
|
|
1640
|
+
signal: t.signal
|
|
1641
|
+
},
|
|
1642
|
+
s
|
|
1643
|
+
) : t.fetchFn = x;
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
}
|
|
1647
|
+
function Wt(e, { pages: t, pageParams: s }) {
|
|
1648
|
+
const r = t.length - 1;
|
|
1649
|
+
return t.length > 0 ? e.getNextPageParam(
|
|
1650
|
+
t[r],
|
|
1651
|
+
t,
|
|
1652
|
+
s[r],
|
|
1653
|
+
s
|
|
1654
|
+
) : void 0;
|
|
1655
|
+
}
|
|
1656
|
+
function Ur(e, { pages: t, pageParams: s }) {
|
|
1657
|
+
return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, s[0], s) : void 0;
|
|
1658
|
+
}
|
|
1659
|
+
var Pr = class extends ns {
|
|
1660
|
+
#e;
|
|
1661
|
+
#t;
|
|
1662
|
+
#s;
|
|
1663
|
+
#n;
|
|
1664
|
+
constructor(e) {
|
|
1665
|
+
super(), this.#e = e.client, this.mutationId = e.mutationId, this.#s = e.mutationCache, this.#t = [], this.state = e.state || as(), this.setOptions(e.options), this.scheduleGc();
|
|
1666
|
+
}
|
|
1667
|
+
setOptions(e) {
|
|
1668
|
+
this.options = e, this.updateGcTime(this.options.gcTime);
|
|
1669
|
+
}
|
|
1670
|
+
get meta() {
|
|
1671
|
+
return this.options.meta;
|
|
1672
|
+
}
|
|
1673
|
+
addObserver(e) {
|
|
1674
|
+
this.#t.includes(e) || (this.#t.push(e), this.clearGcTimeout(), this.#s.notify({
|
|
1675
|
+
type: "observerAdded",
|
|
1676
|
+
mutation: this,
|
|
1677
|
+
observer: e
|
|
1678
|
+
}));
|
|
1679
|
+
}
|
|
1680
|
+
removeObserver(e) {
|
|
1681
|
+
this.#t = this.#t.filter((t) => t !== e), this.scheduleGc(), this.#s.notify({
|
|
1682
|
+
type: "observerRemoved",
|
|
1683
|
+
mutation: this,
|
|
1684
|
+
observer: e
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
optionalRemove() {
|
|
1688
|
+
this.#t.length || (this.state.status === "pending" ? this.scheduleGc() : this.#s.remove(this));
|
|
1689
|
+
}
|
|
1690
|
+
continue() {
|
|
1691
|
+
return this.#n?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
1692
|
+
this.execute(this.state.variables);
|
|
1693
|
+
}
|
|
1694
|
+
async execute(e) {
|
|
1695
|
+
const t = () => {
|
|
1696
|
+
this.#r({ type: "continue" });
|
|
1697
|
+
}, s = {
|
|
1698
|
+
client: this.#e,
|
|
1699
|
+
meta: this.options.meta,
|
|
1700
|
+
mutationKey: this.options.mutationKey
|
|
1701
|
+
};
|
|
1702
|
+
this.#n = rs({
|
|
1703
|
+
fn: () => this.options.mutationFn ? this.options.mutationFn(e, s) : Promise.reject(new Error("No mutationFn found")),
|
|
1704
|
+
onFail: (a, l) => {
|
|
1705
|
+
this.#r({ type: "failed", failureCount: a, error: l });
|
|
1706
|
+
},
|
|
1707
|
+
onPause: () => {
|
|
1708
|
+
this.#r({ type: "pause" });
|
|
1709
|
+
},
|
|
1710
|
+
onContinue: t,
|
|
1711
|
+
retry: this.options.retry ?? 0,
|
|
1712
|
+
retryDelay: this.options.retryDelay,
|
|
1713
|
+
networkMode: this.options.networkMode,
|
|
1714
|
+
canRun: () => this.#s.canRun(this)
|
|
1715
|
+
});
|
|
1716
|
+
const r = this.state.status === "pending", i = !this.#n.canStart();
|
|
1717
|
+
try {
|
|
1718
|
+
if (r)
|
|
1719
|
+
t();
|
|
1720
|
+
else {
|
|
1721
|
+
this.#r({ type: "pending", variables: e, isPaused: i }), await this.#s.config.onMutate?.(
|
|
1722
|
+
e,
|
|
1723
|
+
this,
|
|
1724
|
+
s
|
|
1725
|
+
);
|
|
1726
|
+
const l = await this.options.onMutate?.(
|
|
1727
|
+
e,
|
|
1728
|
+
s
|
|
1729
|
+
);
|
|
1730
|
+
l !== this.state.context && this.#r({
|
|
1731
|
+
type: "pending",
|
|
1732
|
+
context: l,
|
|
1733
|
+
variables: e,
|
|
1734
|
+
isPaused: i
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1737
|
+
const a = await this.#n.start();
|
|
1738
|
+
return await this.#s.config.onSuccess?.(
|
|
1739
|
+
a,
|
|
1740
|
+
e,
|
|
1741
|
+
this.state.context,
|
|
1742
|
+
this,
|
|
1743
|
+
s
|
|
1744
|
+
), await this.options.onSuccess?.(
|
|
1745
|
+
a,
|
|
1746
|
+
e,
|
|
1747
|
+
this.state.context,
|
|
1748
|
+
s
|
|
1749
|
+
), await this.#s.config.onSettled?.(
|
|
1750
|
+
a,
|
|
1751
|
+
null,
|
|
1752
|
+
this.state.variables,
|
|
1753
|
+
this.state.context,
|
|
1754
|
+
this,
|
|
1755
|
+
s
|
|
1756
|
+
), await this.options.onSettled?.(
|
|
1757
|
+
a,
|
|
1758
|
+
null,
|
|
1759
|
+
e,
|
|
1760
|
+
this.state.context,
|
|
1761
|
+
s
|
|
1762
|
+
), this.#r({ type: "success", data: a }), a;
|
|
1763
|
+
} catch (a) {
|
|
1764
|
+
try {
|
|
1765
|
+
await this.#s.config.onError?.(
|
|
1766
|
+
a,
|
|
1767
|
+
e,
|
|
1768
|
+
this.state.context,
|
|
1769
|
+
this,
|
|
1770
|
+
s
|
|
1771
|
+
);
|
|
1772
|
+
} catch (l) {
|
|
1773
|
+
Promise.reject(l);
|
|
1774
|
+
}
|
|
1775
|
+
try {
|
|
1776
|
+
await this.options.onError?.(
|
|
1777
|
+
a,
|
|
1778
|
+
e,
|
|
1779
|
+
this.state.context,
|
|
1780
|
+
s
|
|
1781
|
+
);
|
|
1782
|
+
} catch (l) {
|
|
1783
|
+
Promise.reject(l);
|
|
1784
|
+
}
|
|
1785
|
+
try {
|
|
1786
|
+
await this.#s.config.onSettled?.(
|
|
1787
|
+
void 0,
|
|
1788
|
+
a,
|
|
1789
|
+
this.state.variables,
|
|
1790
|
+
this.state.context,
|
|
1791
|
+
this,
|
|
1792
|
+
s
|
|
1793
|
+
);
|
|
1794
|
+
} catch (l) {
|
|
1795
|
+
Promise.reject(l);
|
|
1796
|
+
}
|
|
1797
|
+
try {
|
|
1798
|
+
await this.options.onSettled?.(
|
|
1799
|
+
void 0,
|
|
1800
|
+
a,
|
|
1801
|
+
e,
|
|
1802
|
+
this.state.context,
|
|
1803
|
+
s
|
|
1804
|
+
);
|
|
1805
|
+
} catch (l) {
|
|
1806
|
+
Promise.reject(l);
|
|
1807
|
+
}
|
|
1808
|
+
throw this.#r({ type: "error", error: a }), a;
|
|
1809
|
+
} finally {
|
|
1810
|
+
this.#s.runNext(this);
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
#r(e) {
|
|
1814
|
+
const t = (s) => {
|
|
1815
|
+
switch (e.type) {
|
|
1816
|
+
case "failed":
|
|
1817
|
+
return {
|
|
1818
|
+
...s,
|
|
1819
|
+
failureCount: e.failureCount,
|
|
1820
|
+
failureReason: e.error
|
|
1821
|
+
};
|
|
1822
|
+
case "pause":
|
|
1823
|
+
return {
|
|
1824
|
+
...s,
|
|
1825
|
+
isPaused: !0
|
|
1826
|
+
};
|
|
1827
|
+
case "continue":
|
|
1828
|
+
return {
|
|
1829
|
+
...s,
|
|
1830
|
+
isPaused: !1
|
|
1831
|
+
};
|
|
1832
|
+
case "pending":
|
|
1833
|
+
return {
|
|
1834
|
+
...s,
|
|
1835
|
+
context: e.context,
|
|
1836
|
+
data: void 0,
|
|
1837
|
+
failureCount: 0,
|
|
1838
|
+
failureReason: null,
|
|
1839
|
+
error: null,
|
|
1840
|
+
isPaused: e.isPaused,
|
|
1841
|
+
status: "pending",
|
|
1842
|
+
variables: e.variables,
|
|
1843
|
+
submittedAt: Date.now()
|
|
1844
|
+
};
|
|
1845
|
+
case "success":
|
|
1846
|
+
return {
|
|
1847
|
+
...s,
|
|
1848
|
+
data: e.data,
|
|
1849
|
+
failureCount: 0,
|
|
1850
|
+
failureReason: null,
|
|
1851
|
+
error: null,
|
|
1852
|
+
status: "success",
|
|
1853
|
+
isPaused: !1
|
|
1854
|
+
};
|
|
1855
|
+
case "error":
|
|
1856
|
+
return {
|
|
1857
|
+
...s,
|
|
1858
|
+
data: void 0,
|
|
1859
|
+
error: e.error,
|
|
1860
|
+
failureCount: s.failureCount + 1,
|
|
1861
|
+
failureReason: e.error,
|
|
1862
|
+
isPaused: !1,
|
|
1863
|
+
status: "error"
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
};
|
|
1867
|
+
this.state = t(this.state), ne.batch(() => {
|
|
1868
|
+
this.#t.forEach((s) => {
|
|
1869
|
+
s.onMutationUpdate(e);
|
|
1870
|
+
}), this.#s.notify({
|
|
1871
|
+
mutation: this,
|
|
1872
|
+
type: "updated",
|
|
1873
|
+
action: e
|
|
1874
|
+
});
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
};
|
|
1878
|
+
function as() {
|
|
1879
|
+
return {
|
|
1880
|
+
context: void 0,
|
|
1881
|
+
data: void 0,
|
|
1882
|
+
error: null,
|
|
1883
|
+
failureCount: 0,
|
|
1884
|
+
failureReason: null,
|
|
1885
|
+
isPaused: !1,
|
|
1886
|
+
status: "idle",
|
|
1887
|
+
variables: void 0,
|
|
1888
|
+
submittedAt: 0
|
|
1889
|
+
};
|
|
1890
|
+
}
|
|
1891
|
+
var Fr = class extends Ce {
|
|
1892
|
+
constructor(e = {}) {
|
|
1893
|
+
super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#s = 0;
|
|
1894
|
+
}
|
|
1895
|
+
#e;
|
|
1896
|
+
#t;
|
|
1897
|
+
#s;
|
|
1898
|
+
build(e, t, s) {
|
|
1899
|
+
const r = new Pr({
|
|
1900
|
+
client: e,
|
|
1901
|
+
mutationCache: this,
|
|
1902
|
+
mutationId: ++this.#s,
|
|
1903
|
+
options: e.defaultMutationOptions(t),
|
|
1904
|
+
state: s
|
|
1905
|
+
});
|
|
1906
|
+
return this.add(r), r;
|
|
1907
|
+
}
|
|
1908
|
+
add(e) {
|
|
1909
|
+
this.#e.add(e);
|
|
1910
|
+
const t = qe(e);
|
|
1911
|
+
if (typeof t == "string") {
|
|
1912
|
+
const s = this.#t.get(t);
|
|
1913
|
+
s ? s.push(e) : this.#t.set(t, [e]);
|
|
1914
|
+
}
|
|
1915
|
+
this.notify({ type: "added", mutation: e });
|
|
1916
|
+
}
|
|
1917
|
+
remove(e) {
|
|
1918
|
+
if (this.#e.delete(e)) {
|
|
1919
|
+
const t = qe(e);
|
|
1920
|
+
if (typeof t == "string") {
|
|
1921
|
+
const s = this.#t.get(t);
|
|
1922
|
+
if (s)
|
|
1923
|
+
if (s.length > 1) {
|
|
1924
|
+
const r = s.indexOf(e);
|
|
1925
|
+
r !== -1 && s.splice(r, 1);
|
|
1926
|
+
} else s[0] === e && this.#t.delete(t);
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
this.notify({ type: "removed", mutation: e });
|
|
1930
|
+
}
|
|
1931
|
+
canRun(e) {
|
|
1932
|
+
const t = qe(e);
|
|
1933
|
+
if (typeof t == "string") {
|
|
1934
|
+
const r = this.#t.get(t)?.find(
|
|
1935
|
+
(i) => i.state.status === "pending"
|
|
1936
|
+
);
|
|
1937
|
+
return !r || r === e;
|
|
1938
|
+
} else
|
|
1939
|
+
return !0;
|
|
1940
|
+
}
|
|
1941
|
+
runNext(e) {
|
|
1942
|
+
const t = qe(e);
|
|
1943
|
+
return typeof t == "string" ? this.#t.get(t)?.find((r) => r !== e && r.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
|
|
1944
|
+
}
|
|
1945
|
+
clear() {
|
|
1946
|
+
ne.batch(() => {
|
|
1947
|
+
this.#e.forEach((e) => {
|
|
1948
|
+
this.notify({ type: "removed", mutation: e });
|
|
1949
|
+
}), this.#e.clear(), this.#t.clear();
|
|
1950
|
+
});
|
|
1951
|
+
}
|
|
1952
|
+
getAll() {
|
|
1953
|
+
return Array.from(this.#e);
|
|
1954
|
+
}
|
|
1955
|
+
find(e) {
|
|
1956
|
+
const t = { exact: !0, ...e };
|
|
1957
|
+
return this.getAll().find(
|
|
1958
|
+
(s) => Pt(t, s)
|
|
1959
|
+
);
|
|
1960
|
+
}
|
|
1961
|
+
findAll(e = {}) {
|
|
1962
|
+
return this.getAll().filter((t) => Pt(e, t));
|
|
1963
|
+
}
|
|
1964
|
+
notify(e) {
|
|
1965
|
+
ne.batch(() => {
|
|
1966
|
+
this.listeners.forEach((t) => {
|
|
1967
|
+
t(e);
|
|
1968
|
+
});
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
resumePausedMutations() {
|
|
1972
|
+
const e = this.getAll().filter((t) => t.state.isPaused);
|
|
1973
|
+
return ne.batch(
|
|
1974
|
+
() => Promise.all(
|
|
1975
|
+
e.map((t) => t.continue().catch(ce))
|
|
1976
|
+
)
|
|
1977
|
+
);
|
|
1978
|
+
}
|
|
1979
|
+
};
|
|
1980
|
+
function qe(e) {
|
|
1981
|
+
return e.options.scope?.id;
|
|
1982
|
+
}
|
|
1983
|
+
var Mr = class extends Ce {
|
|
1984
|
+
#e;
|
|
1985
|
+
#t = void 0;
|
|
1986
|
+
#s;
|
|
1987
|
+
#n;
|
|
1988
|
+
constructor(e, t) {
|
|
1989
|
+
super(), this.#e = e, this.setOptions(t), this.bindMethods(), this.#r();
|
|
1990
|
+
}
|
|
1991
|
+
bindMethods() {
|
|
1992
|
+
this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
|
|
1993
|
+
}
|
|
1994
|
+
setOptions(e) {
|
|
1995
|
+
const t = this.options;
|
|
1996
|
+
this.options = this.#e.defaultMutationOptions(e), Xe(this.options, t) || this.#e.getMutationCache().notify({
|
|
1997
|
+
type: "observerOptionsUpdated",
|
|
1998
|
+
mutation: this.#s,
|
|
1999
|
+
observer: this
|
|
2000
|
+
}), t?.mutationKey && this.options.mutationKey && Re(t.mutationKey) !== Re(this.options.mutationKey) ? this.reset() : this.#s?.state.status === "pending" && this.#s.setOptions(this.options);
|
|
2001
|
+
}
|
|
2002
|
+
onUnsubscribe() {
|
|
2003
|
+
this.hasListeners() || this.#s?.removeObserver(this);
|
|
2004
|
+
}
|
|
2005
|
+
onMutationUpdate(e) {
|
|
2006
|
+
this.#r(), this.#a(e);
|
|
2007
|
+
}
|
|
2008
|
+
getCurrentResult() {
|
|
2009
|
+
return this.#t;
|
|
2010
|
+
}
|
|
2011
|
+
reset() {
|
|
2012
|
+
this.#s?.removeObserver(this), this.#s = void 0, this.#r(), this.#a();
|
|
2013
|
+
}
|
|
2014
|
+
mutate(e, t) {
|
|
2015
|
+
return this.#n = t, this.#s?.removeObserver(this), this.#s = this.#e.getMutationCache().build(this.#e, this.options), this.#s.addObserver(this), this.#s.execute(e);
|
|
2016
|
+
}
|
|
2017
|
+
#r() {
|
|
2018
|
+
const e = this.#s?.state ?? as();
|
|
2019
|
+
this.#t = {
|
|
2020
|
+
...e,
|
|
2021
|
+
isPending: e.status === "pending",
|
|
2022
|
+
isSuccess: e.status === "success",
|
|
2023
|
+
isError: e.status === "error",
|
|
2024
|
+
isIdle: e.status === "idle",
|
|
2025
|
+
mutate: this.mutate,
|
|
2026
|
+
reset: this.reset
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
#a(e) {
|
|
2030
|
+
ne.batch(() => {
|
|
2031
|
+
if (this.#n && this.hasListeners()) {
|
|
2032
|
+
const t = this.#t.variables, s = this.#t.context, r = {
|
|
2033
|
+
client: this.#e,
|
|
2034
|
+
meta: this.options.meta,
|
|
2035
|
+
mutationKey: this.options.mutationKey
|
|
2036
|
+
};
|
|
2037
|
+
if (e?.type === "success") {
|
|
2038
|
+
try {
|
|
2039
|
+
this.#n.onSuccess?.(
|
|
2040
|
+
e.data,
|
|
2041
|
+
t,
|
|
2042
|
+
s,
|
|
2043
|
+
r
|
|
2044
|
+
);
|
|
2045
|
+
} catch (i) {
|
|
2046
|
+
Promise.reject(i);
|
|
2047
|
+
}
|
|
2048
|
+
try {
|
|
2049
|
+
this.#n.onSettled?.(
|
|
2050
|
+
e.data,
|
|
2051
|
+
null,
|
|
2052
|
+
t,
|
|
2053
|
+
s,
|
|
2054
|
+
r
|
|
2055
|
+
);
|
|
2056
|
+
} catch (i) {
|
|
2057
|
+
Promise.reject(i);
|
|
2058
|
+
}
|
|
2059
|
+
} else if (e?.type === "error") {
|
|
2060
|
+
try {
|
|
2061
|
+
this.#n.onError?.(
|
|
2062
|
+
e.error,
|
|
2063
|
+
t,
|
|
2064
|
+
s,
|
|
2065
|
+
r
|
|
2066
|
+
);
|
|
2067
|
+
} catch (i) {
|
|
2068
|
+
Promise.reject(i);
|
|
2069
|
+
}
|
|
2070
|
+
try {
|
|
2071
|
+
this.#n.onSettled?.(
|
|
2072
|
+
void 0,
|
|
2073
|
+
e.error,
|
|
2074
|
+
t,
|
|
2075
|
+
s,
|
|
2076
|
+
r
|
|
2077
|
+
);
|
|
2078
|
+
} catch (i) {
|
|
2079
|
+
Promise.reject(i);
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
this.listeners.forEach((t) => {
|
|
2084
|
+
t(this.#t);
|
|
2085
|
+
});
|
|
2086
|
+
});
|
|
2087
|
+
}
|
|
2088
|
+
}, Dr = class extends Ce {
|
|
2089
|
+
constructor(e = {}) {
|
|
2090
|
+
super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
|
|
2091
|
+
}
|
|
2092
|
+
#e;
|
|
2093
|
+
build(e, t, s) {
|
|
2094
|
+
const r = t.queryKey, i = t.queryHash ?? ft(r, t);
|
|
2095
|
+
let a = this.get(i);
|
|
2096
|
+
return a || (a = new Er({
|
|
2097
|
+
client: e,
|
|
2098
|
+
queryKey: r,
|
|
2099
|
+
queryHash: i,
|
|
2100
|
+
options: e.defaultQueryOptions(t),
|
|
2101
|
+
state: s,
|
|
2102
|
+
defaultOptions: e.getQueryDefaults(r)
|
|
2103
|
+
}), this.add(a)), a;
|
|
2104
|
+
}
|
|
2105
|
+
add(e) {
|
|
2106
|
+
this.#e.has(e.queryHash) || (this.#e.set(e.queryHash, e), this.notify({
|
|
2107
|
+
type: "added",
|
|
2108
|
+
query: e
|
|
2109
|
+
}));
|
|
2110
|
+
}
|
|
2111
|
+
remove(e) {
|
|
2112
|
+
const t = this.#e.get(e.queryHash);
|
|
2113
|
+
t && (e.destroy(), t === e && this.#e.delete(e.queryHash), this.notify({ type: "removed", query: e }));
|
|
2114
|
+
}
|
|
2115
|
+
clear() {
|
|
2116
|
+
ne.batch(() => {
|
|
2117
|
+
this.getAll().forEach((e) => {
|
|
2118
|
+
this.remove(e);
|
|
2119
|
+
});
|
|
2120
|
+
});
|
|
2121
|
+
}
|
|
2122
|
+
get(e) {
|
|
2123
|
+
return this.#e.get(e);
|
|
2124
|
+
}
|
|
2125
|
+
getAll() {
|
|
2126
|
+
return [...this.#e.values()];
|
|
2127
|
+
}
|
|
2128
|
+
find(e) {
|
|
2129
|
+
const t = { exact: !0, ...e };
|
|
2130
|
+
return this.getAll().find(
|
|
2131
|
+
(s) => Ut(t, s)
|
|
2132
|
+
);
|
|
2133
|
+
}
|
|
2134
|
+
findAll(e = {}) {
|
|
2135
|
+
const t = this.getAll();
|
|
2136
|
+
return Object.keys(e).length > 0 ? t.filter((s) => Ut(e, s)) : t;
|
|
2137
|
+
}
|
|
2138
|
+
notify(e) {
|
|
2139
|
+
ne.batch(() => {
|
|
2140
|
+
this.listeners.forEach((t) => {
|
|
2141
|
+
t(e);
|
|
2142
|
+
});
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
onFocus() {
|
|
2146
|
+
ne.batch(() => {
|
|
2147
|
+
this.getAll().forEach((e) => {
|
|
2148
|
+
e.onFocus();
|
|
2149
|
+
});
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
onOnline() {
|
|
2153
|
+
ne.batch(() => {
|
|
2154
|
+
this.getAll().forEach((e) => {
|
|
2155
|
+
e.onOnline();
|
|
2156
|
+
});
|
|
2157
|
+
});
|
|
2158
|
+
}
|
|
2159
|
+
}, Lr = class {
|
|
2160
|
+
#e;
|
|
2161
|
+
#t;
|
|
2162
|
+
#s;
|
|
2163
|
+
#n;
|
|
2164
|
+
#r;
|
|
2165
|
+
#a;
|
|
2166
|
+
#o;
|
|
2167
|
+
#i;
|
|
2168
|
+
constructor(e = {}) {
|
|
2169
|
+
this.#e = e.queryCache || new Dr(), this.#t = e.mutationCache || new Fr(), this.#s = e.defaultOptions || {}, this.#n = /* @__PURE__ */ new Map(), this.#r = /* @__PURE__ */ new Map(), this.#a = 0;
|
|
2170
|
+
}
|
|
2171
|
+
mount() {
|
|
2172
|
+
this.#a++, this.#a === 1 && (this.#o = pt.subscribe(async (e) => {
|
|
2173
|
+
e && (await this.resumePausedMutations(), this.#e.onFocus());
|
|
2174
|
+
}), this.#i = Ve.subscribe(async (e) => {
|
|
2175
|
+
e && (await this.resumePausedMutations(), this.#e.onOnline());
|
|
2176
|
+
}));
|
|
2177
|
+
}
|
|
2178
|
+
unmount() {
|
|
2179
|
+
this.#a--, this.#a === 0 && (this.#o?.(), this.#o = void 0, this.#i?.(), this.#i = void 0);
|
|
2180
|
+
}
|
|
2181
|
+
isFetching(e) {
|
|
2182
|
+
return this.#e.findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
2183
|
+
}
|
|
2184
|
+
isMutating(e) {
|
|
2185
|
+
return this.#t.findAll({ ...e, status: "pending" }).length;
|
|
2186
|
+
}
|
|
2187
|
+
/**
|
|
2188
|
+
* Imperative (non-reactive) way to retrieve data for a QueryKey.
|
|
2189
|
+
* Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
|
|
2190
|
+
*
|
|
2191
|
+
* Hint: Do not use this function inside a component, because it won't receive updates.
|
|
2192
|
+
* Use `useQuery` to create a `QueryObserver` that subscribes to changes.
|
|
2193
|
+
*/
|
|
2194
|
+
getQueryData(e) {
|
|
2195
|
+
const t = this.defaultQueryOptions({ queryKey: e });
|
|
2196
|
+
return this.#e.get(t.queryHash)?.state.data;
|
|
2197
|
+
}
|
|
2198
|
+
ensureQueryData(e) {
|
|
2199
|
+
const t = this.defaultQueryOptions(e), s = this.#e.build(this, t), r = s.state.data;
|
|
2200
|
+
return r === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(be(t.staleTime, s)) && this.prefetchQuery(t), Promise.resolve(r));
|
|
2201
|
+
}
|
|
2202
|
+
getQueriesData(e) {
|
|
2203
|
+
return this.#e.findAll(e).map(({ queryKey: t, state: s }) => {
|
|
2204
|
+
const r = s.data;
|
|
2205
|
+
return [t, r];
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2208
|
+
setQueryData(e, t, s) {
|
|
2209
|
+
const r = this.defaultQueryOptions({ queryKey: e }), a = this.#e.get(
|
|
2210
|
+
r.queryHash
|
|
2211
|
+
)?.state.data, l = Ar(t, a);
|
|
2212
|
+
if (l !== void 0)
|
|
2213
|
+
return this.#e.build(this, r).setData(l, { ...s, manual: !0 });
|
|
2214
|
+
}
|
|
2215
|
+
setQueriesData(e, t, s) {
|
|
2216
|
+
return ne.batch(
|
|
2217
|
+
() => this.#e.findAll(e).map(({ queryKey: r }) => [
|
|
2218
|
+
r,
|
|
2219
|
+
this.setQueryData(r, t, s)
|
|
2220
|
+
])
|
|
2221
|
+
);
|
|
2222
|
+
}
|
|
2223
|
+
getQueryState(e) {
|
|
2224
|
+
const t = this.defaultQueryOptions({ queryKey: e });
|
|
2225
|
+
return this.#e.get(
|
|
2226
|
+
t.queryHash
|
|
2227
|
+
)?.state;
|
|
2228
|
+
}
|
|
2229
|
+
removeQueries(e) {
|
|
2230
|
+
const t = this.#e;
|
|
2231
|
+
ne.batch(() => {
|
|
2232
|
+
t.findAll(e).forEach((s) => {
|
|
2233
|
+
t.remove(s);
|
|
2234
|
+
});
|
|
2235
|
+
});
|
|
2236
|
+
}
|
|
2237
|
+
resetQueries(e, t) {
|
|
2238
|
+
const s = this.#e;
|
|
2239
|
+
return ne.batch(() => (s.findAll(e).forEach((r) => {
|
|
2240
|
+
r.reset();
|
|
2241
|
+
}), this.refetchQueries(
|
|
2242
|
+
{
|
|
2243
|
+
type: "active",
|
|
2244
|
+
...e
|
|
2245
|
+
},
|
|
2246
|
+
t
|
|
2247
|
+
)));
|
|
2248
|
+
}
|
|
2249
|
+
cancelQueries(e, t = {}) {
|
|
2250
|
+
const s = { revert: !0, ...t }, r = ne.batch(
|
|
2251
|
+
() => this.#e.findAll(e).map((i) => i.cancel(s))
|
|
2252
|
+
);
|
|
2253
|
+
return Promise.all(r).then(ce).catch(ce);
|
|
2254
|
+
}
|
|
2255
|
+
invalidateQueries(e, t = {}) {
|
|
2256
|
+
return ne.batch(() => (this.#e.findAll(e).forEach((s) => {
|
|
2257
|
+
s.invalidate();
|
|
2258
|
+
}), e?.refetchType === "none" ? Promise.resolve() : this.refetchQueries(
|
|
2259
|
+
{
|
|
2260
|
+
...e,
|
|
2261
|
+
type: e?.refetchType ?? e?.type ?? "active"
|
|
2262
|
+
},
|
|
2263
|
+
t
|
|
2264
|
+
)));
|
|
2265
|
+
}
|
|
2266
|
+
refetchQueries(e, t = {}) {
|
|
2267
|
+
const s = {
|
|
2268
|
+
...t,
|
|
2269
|
+
cancelRefetch: t.cancelRefetch ?? !0
|
|
2270
|
+
}, r = ne.batch(
|
|
2271
|
+
() => this.#e.findAll(e).filter((i) => !i.isDisabled() && !i.isStatic()).map((i) => {
|
|
2272
|
+
let a = i.fetch(void 0, s);
|
|
2273
|
+
return s.throwOnError || (a = a.catch(ce)), i.state.fetchStatus === "paused" ? Promise.resolve() : a;
|
|
2274
|
+
})
|
|
2275
|
+
);
|
|
2276
|
+
return Promise.all(r).then(ce);
|
|
2277
|
+
}
|
|
2278
|
+
fetchQuery(e) {
|
|
2279
|
+
const t = this.defaultQueryOptions(e);
|
|
2280
|
+
t.retry === void 0 && (t.retry = !1);
|
|
2281
|
+
const s = this.#e.build(this, t);
|
|
2282
|
+
return s.isStaleByTime(
|
|
2283
|
+
be(t.staleTime, s)
|
|
2284
|
+
) ? s.fetch(t) : Promise.resolve(s.state.data);
|
|
2285
|
+
}
|
|
2286
|
+
prefetchQuery(e) {
|
|
2287
|
+
return this.fetchQuery(e).then(ce).catch(ce);
|
|
2288
|
+
}
|
|
2289
|
+
fetchInfiniteQuery(e) {
|
|
2290
|
+
return e.behavior = qt(e.pages), this.fetchQuery(e);
|
|
2291
|
+
}
|
|
2292
|
+
prefetchInfiniteQuery(e) {
|
|
2293
|
+
return this.fetchInfiniteQuery(e).then(ce).catch(ce);
|
|
2294
|
+
}
|
|
2295
|
+
ensureInfiniteQueryData(e) {
|
|
2296
|
+
return e.behavior = qt(e.pages), this.ensureQueryData(e);
|
|
2297
|
+
}
|
|
2298
|
+
resumePausedMutations() {
|
|
2299
|
+
return Ve.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
|
|
2300
|
+
}
|
|
2301
|
+
getQueryCache() {
|
|
2302
|
+
return this.#e;
|
|
2303
|
+
}
|
|
2304
|
+
getMutationCache() {
|
|
2305
|
+
return this.#t;
|
|
2306
|
+
}
|
|
2307
|
+
getDefaultOptions() {
|
|
2308
|
+
return this.#s;
|
|
2309
|
+
}
|
|
2310
|
+
setDefaultOptions(e) {
|
|
2311
|
+
this.#s = e;
|
|
2312
|
+
}
|
|
2313
|
+
setQueryDefaults(e, t) {
|
|
2314
|
+
this.#n.set(Re(e), {
|
|
2315
|
+
queryKey: e,
|
|
2316
|
+
defaultOptions: t
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
getQueryDefaults(e) {
|
|
2320
|
+
const t = [...this.#n.values()], s = {};
|
|
2321
|
+
return t.forEach((r) => {
|
|
2322
|
+
Fe(e, r.queryKey) && Object.assign(s, r.defaultOptions);
|
|
2323
|
+
}), s;
|
|
2324
|
+
}
|
|
2325
|
+
setMutationDefaults(e, t) {
|
|
2326
|
+
this.#r.set(Re(e), {
|
|
2327
|
+
mutationKey: e,
|
|
2328
|
+
defaultOptions: t
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
getMutationDefaults(e) {
|
|
2332
|
+
const t = [...this.#r.values()], s = {};
|
|
2333
|
+
return t.forEach((r) => {
|
|
2334
|
+
Fe(e, r.mutationKey) && Object.assign(s, r.defaultOptions);
|
|
2335
|
+
}), s;
|
|
2336
|
+
}
|
|
2337
|
+
defaultQueryOptions(e) {
|
|
2338
|
+
if (e._defaulted)
|
|
2339
|
+
return e;
|
|
2340
|
+
const t = {
|
|
2341
|
+
...this.#s.queries,
|
|
2342
|
+
...this.getQueryDefaults(e.queryKey),
|
|
2343
|
+
...e,
|
|
2344
|
+
_defaulted: !0
|
|
2345
|
+
};
|
|
2346
|
+
return t.queryHash || (t.queryHash = ft(
|
|
2347
|
+
t.queryKey,
|
|
2348
|
+
t
|
|
2349
|
+
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === Je && (t.enabled = !1), t;
|
|
2350
|
+
}
|
|
2351
|
+
defaultMutationOptions(e) {
|
|
2352
|
+
return e?._defaulted ? e : {
|
|
2353
|
+
...this.#s.mutations,
|
|
2354
|
+
...e?.mutationKey && this.getMutationDefaults(e.mutationKey),
|
|
2355
|
+
...e,
|
|
2356
|
+
_defaulted: !0
|
|
2357
|
+
};
|
|
2358
|
+
}
|
|
2359
|
+
clear() {
|
|
2360
|
+
this.#e.clear(), this.#t.clear();
|
|
2361
|
+
}
|
|
2362
|
+
}, os = ae.createContext(
|
|
2363
|
+
void 0
|
|
2364
|
+
), gt = (e) => {
|
|
2365
|
+
const t = ae.useContext(os);
|
|
2366
|
+
if (!t)
|
|
2367
|
+
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
2368
|
+
return t;
|
|
2369
|
+
}, Br = ({
|
|
2370
|
+
client: e,
|
|
2371
|
+
children: t
|
|
2372
|
+
}) => (ae.useEffect(() => (e.mount(), () => {
|
|
2373
|
+
e.unmount();
|
|
2374
|
+
}), [e]), /* @__PURE__ */ n.jsx(os.Provider, { value: e, children: t })), ls = ae.createContext(!1), Qr = () => ae.useContext(ls);
|
|
2375
|
+
ls.Provider;
|
|
2376
|
+
function qr() {
|
|
2377
|
+
let e = !1;
|
|
2378
|
+
return {
|
|
2379
|
+
clearReset: () => {
|
|
2380
|
+
e = !1;
|
|
2381
|
+
},
|
|
2382
|
+
reset: () => {
|
|
2383
|
+
e = !0;
|
|
2384
|
+
},
|
|
2385
|
+
isReset: () => e
|
|
2386
|
+
};
|
|
2387
|
+
}
|
|
2388
|
+
var Wr = ae.createContext(qr()), zr = () => ae.useContext(Wr), Hr = (e, t, s) => {
|
|
2389
|
+
const r = s?.state.error && typeof e.throwOnError == "function" ? mt(e.throwOnError, [s.state.error, s]) : e.throwOnError;
|
|
2390
|
+
(e.suspense || e.experimental_prefetchInRender || r) && (t.isReset() || (e.retryOnMount = !1));
|
|
2391
|
+
}, Yr = (e) => {
|
|
2392
|
+
ae.useEffect(() => {
|
|
2393
|
+
e.clearReset();
|
|
2394
|
+
}, [e]);
|
|
2395
|
+
}, Gr = ({
|
|
2396
|
+
result: e,
|
|
2397
|
+
errorResetBoundary: t,
|
|
2398
|
+
throwOnError: s,
|
|
2399
|
+
query: r,
|
|
2400
|
+
suspense: i
|
|
2401
|
+
}) => e.isError && !t.isReset() && !e.isFetching && r && (i && e.data === void 0 || mt(s, [e.error, r])), Xr = (e) => {
|
|
2402
|
+
if (e.suspense) {
|
|
2403
|
+
const s = (i) => i === "static" ? i : Math.max(i ?? 1e3, 1e3), r = e.staleTime;
|
|
2404
|
+
e.staleTime = typeof r == "function" ? (...i) => s(r(...i)) : s(r), typeof e.gcTime == "number" && (e.gcTime = Math.max(
|
|
2405
|
+
e.gcTime,
|
|
2406
|
+
1e3
|
|
2407
|
+
));
|
|
2408
|
+
}
|
|
2409
|
+
}, Jr = (e, t) => e.isLoading && e.isFetching && !t, Vr = (e, t) => e?.suspense && t.isPending, zt = (e, t, s) => t.fetchOptimistic(e).catch(() => {
|
|
2410
|
+
s.clearReset();
|
|
2411
|
+
});
|
|
2412
|
+
function Kr(e, t, s) {
|
|
2413
|
+
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
2414
|
+
throw new Error(
|
|
2415
|
+
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
2416
|
+
);
|
|
2417
|
+
const r = Qr(), i = zr(), a = gt(), l = a.defaultQueryOptions(e);
|
|
2418
|
+
a.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
2419
|
+
l
|
|
2420
|
+
);
|
|
2421
|
+
const o = a.getQueryCache().get(l.queryHash);
|
|
2422
|
+
process.env.NODE_ENV !== "production" && (l.queryFn || console.error(
|
|
2423
|
+
`[${l.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
|
|
2424
|
+
)), l._optimisticResults = r ? "isRestoring" : "optimistic", Xr(l), Hr(l, i, o), Yr(i);
|
|
2425
|
+
const g = !a.getQueryCache().get(l.queryHash), [x] = ae.useState(
|
|
2426
|
+
() => new t(
|
|
2427
|
+
a,
|
|
2428
|
+
l
|
|
2429
|
+
)
|
|
2430
|
+
), p = x.getOptimisticResult(l), T = !r && e.subscribed !== !1;
|
|
2431
|
+
if (ae.useSyncExternalStore(
|
|
2432
|
+
ae.useCallback(
|
|
2433
|
+
(m) => {
|
|
2434
|
+
const A = T ? x.subscribe(ne.batchCalls(m)) : ce;
|
|
2435
|
+
return x.updateResult(), A;
|
|
2436
|
+
},
|
|
2437
|
+
[x, T]
|
|
2438
|
+
),
|
|
2439
|
+
() => x.getCurrentResult(),
|
|
2440
|
+
() => x.getCurrentResult()
|
|
2441
|
+
), ae.useEffect(() => {
|
|
2442
|
+
x.setOptions(l);
|
|
2443
|
+
}, [l, x]), Vr(l, p))
|
|
2444
|
+
throw zt(l, x, i);
|
|
2445
|
+
if (Gr({
|
|
2446
|
+
result: p,
|
|
2447
|
+
errorResetBoundary: i,
|
|
2448
|
+
throwOnError: l.throwOnError,
|
|
2449
|
+
query: o,
|
|
2450
|
+
suspense: l.suspense
|
|
2451
|
+
}))
|
|
2452
|
+
throw p.error;
|
|
2453
|
+
return a.getDefaultOptions().queries?._experimental_afterQuery?.(
|
|
2454
|
+
l,
|
|
2455
|
+
p
|
|
2456
|
+
), l.experimental_prefetchInRender && !je && Jr(p, r) && (g ? (
|
|
2457
|
+
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
2458
|
+
zt(l, x, i)
|
|
2459
|
+
) : (
|
|
2460
|
+
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
2461
|
+
o?.promise
|
|
2462
|
+
))?.catch(ce).finally(() => {
|
|
2463
|
+
x.updateResult();
|
|
2464
|
+
}), l.notifyOnChangeProps ? p : x.trackResult(p);
|
|
2465
|
+
}
|
|
2466
|
+
function At(e, t) {
|
|
2467
|
+
return Kr(e, Cr);
|
|
2468
|
+
}
|
|
2469
|
+
function Zr(e, t) {
|
|
2470
|
+
const s = gt(), [r] = ae.useState(
|
|
2471
|
+
() => new Mr(
|
|
2472
|
+
s,
|
|
2473
|
+
e
|
|
2474
|
+
)
|
|
2475
|
+
);
|
|
2476
|
+
ae.useEffect(() => {
|
|
2477
|
+
r.setOptions(e);
|
|
2478
|
+
}, [r, e]);
|
|
2479
|
+
const i = ae.useSyncExternalStore(
|
|
2480
|
+
ae.useCallback(
|
|
2481
|
+
(l) => r.subscribe(ne.batchCalls(l)),
|
|
2482
|
+
[r]
|
|
2483
|
+
),
|
|
2484
|
+
() => r.getCurrentResult(),
|
|
2485
|
+
() => r.getCurrentResult()
|
|
2486
|
+
), a = ae.useCallback(
|
|
2487
|
+
(l, o) => {
|
|
2488
|
+
r.mutate(l, o).catch(ce);
|
|
2489
|
+
},
|
|
2490
|
+
[r]
|
|
2491
|
+
);
|
|
2492
|
+
if (i.error && mt(r.options.throwOnError, [i.error]))
|
|
2493
|
+
throw i.error;
|
|
2494
|
+
return { ...i, mutate: a, mutateAsync: i.mutate };
|
|
2495
|
+
}
|
|
2496
|
+
const _r = "", $r = "", en = "", tn = "", Ht = {
|
|
2497
|
+
snl: {
|
|
2498
|
+
alerts: _r,
|
|
2499
|
+
rules: $r
|
|
2500
|
+
},
|
|
2501
|
+
schools: {
|
|
2502
|
+
alerts: en,
|
|
2503
|
+
rules: tn
|
|
2504
|
+
}
|
|
2505
|
+
};
|
|
2506
|
+
function sn() {
|
|
2507
|
+
try {
|
|
2508
|
+
const e = localStorage.getItem("authToken");
|
|
2509
|
+
return e ? { Authorization: `Bearer ${e}` } : {};
|
|
2510
|
+
} catch {
|
|
2511
|
+
return {};
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
function Yt(e, t) {
|
|
2515
|
+
if (!t) return e;
|
|
2516
|
+
const s = new URL(e);
|
|
2517
|
+
return Object.entries(t).forEach(([r, i]) => {
|
|
2518
|
+
i != null && String(i).length > 0 && s.searchParams.set(r, String(i));
|
|
2519
|
+
}), s.toString();
|
|
2520
|
+
}
|
|
2521
|
+
async function Ae(e, t) {
|
|
2522
|
+
const s = {
|
|
2523
|
+
...t.headers,
|
|
2524
|
+
...sn()
|
|
2525
|
+
}, r = await fetch(e, { ...t, headers: s });
|
|
2526
|
+
if (r.status === 401)
|
|
2527
|
+
throw window.location.href = "/login", new Error("Unauthorized");
|
|
2528
|
+
if (r.status === 204) return {};
|
|
2529
|
+
const i = await r.text();
|
|
2530
|
+
let a = {};
|
|
2531
|
+
if (i)
|
|
2532
|
+
try {
|
|
2533
|
+
a = JSON.parse(i);
|
|
2534
|
+
} catch {
|
|
2535
|
+
a = { ok: r.ok, status: r.status, raw: i };
|
|
2536
|
+
}
|
|
2537
|
+
if (!r.ok) {
|
|
2538
|
+
const l = a?.errorMessage || a?.message || `HTTP ${r.status}`;
|
|
2539
|
+
throw new Error(l);
|
|
2540
|
+
}
|
|
2541
|
+
return a;
|
|
2542
|
+
}
|
|
2543
|
+
function cs(e) {
|
|
2544
|
+
console.log("baseurl", e);
|
|
2545
|
+
const t = {
|
|
2546
|
+
"Content-Type": "application/json",
|
|
2547
|
+
...e.headers || {}
|
|
2548
|
+
};
|
|
2549
|
+
return {
|
|
2550
|
+
async listAlerts() {
|
|
2551
|
+
const s = new URL("/api/Alert", e.baseUrl).toString(), r = await Ae(s, {
|
|
2552
|
+
method: "GET",
|
|
2553
|
+
headers: t
|
|
2554
|
+
});
|
|
2555
|
+
return Array.isArray(r) ? r : [];
|
|
2556
|
+
},
|
|
2557
|
+
async getAlertStatusList() {
|
|
2558
|
+
const s = new URL("/api/Alert/AlertStatusList", e.baseUrl).toString(), r = await Ae(s, {
|
|
2559
|
+
method: "GET",
|
|
2560
|
+
headers: t
|
|
2561
|
+
});
|
|
2562
|
+
return Array.isArray(r) ? r : r && typeof r == "object" && Array.isArray(r.data) ? r.data : [];
|
|
2563
|
+
},
|
|
2564
|
+
async getAlertsReport(s) {
|
|
2565
|
+
const r = new URL("/Alerts/GetAlertsReport", e.baseUrl).toString(), i = Yt(r, s), a = await Ae(i, {
|
|
2566
|
+
method: "GET",
|
|
2567
|
+
headers: t
|
|
2568
|
+
});
|
|
2569
|
+
return Array.isArray(a) ? a : [];
|
|
2570
|
+
},
|
|
2571
|
+
async updateAlertStatus(s) {
|
|
2572
|
+
const r = new URL("/api/Alert/status", e.baseUrl).toString();
|
|
2573
|
+
return Ae(r, {
|
|
2574
|
+
method: "PUT",
|
|
2575
|
+
headers: t,
|
|
2576
|
+
body: JSON.stringify(s ?? {})
|
|
2577
|
+
});
|
|
2578
|
+
},
|
|
2579
|
+
async getAdminSettings() {
|
|
2580
|
+
const s = new URL("/api/Alert/GetAdminSettings", e.baseUrl).toString(), r = await Ae(s, {
|
|
2581
|
+
method: "GET",
|
|
2582
|
+
headers: t
|
|
2583
|
+
});
|
|
2584
|
+
if (r && typeof r == "object") {
|
|
2585
|
+
if ("data" in r) return r.data;
|
|
2586
|
+
if ("userId" in r) return r;
|
|
2587
|
+
}
|
|
2588
|
+
return null;
|
|
2589
|
+
},
|
|
2590
|
+
async setAdminSettings(s) {
|
|
2591
|
+
const r = new URL("/api/Alert/SetAdminSettings", e.baseUrl).toString(), i = {
|
|
2592
|
+
userId: 0,
|
|
2593
|
+
isAdminSetting: !0,
|
|
2594
|
+
sortBy: s?.sortBy ?? "",
|
|
2595
|
+
groupBy: s?.groupBy ?? ""
|
|
2596
|
+
};
|
|
2597
|
+
return Ae(r, {
|
|
2598
|
+
method: "POST",
|
|
2599
|
+
headers: t,
|
|
2600
|
+
body: JSON.stringify(i)
|
|
2601
|
+
});
|
|
2602
|
+
},
|
|
2603
|
+
async getPreferenceSettings() {
|
|
2604
|
+
const s = new URL("/api/Alert/GetPreferenceSettings", e.baseUrl).toString(), r = await Ae(s, {
|
|
2605
|
+
method: "GET",
|
|
2606
|
+
headers: t
|
|
2607
|
+
});
|
|
2608
|
+
if (r && typeof r == "object") {
|
|
2609
|
+
if ("data" in r) return r.data;
|
|
2610
|
+
if ("anomalyIds" in r) return r;
|
|
2611
|
+
}
|
|
2612
|
+
return null;
|
|
2613
|
+
},
|
|
2614
|
+
async setPreferenceSettings(s) {
|
|
2615
|
+
const r = new URL("/api/Alert/SetPreferenceSettings", e.baseUrl).toString();
|
|
2616
|
+
return Ae(r, {
|
|
2617
|
+
method: "POST",
|
|
2618
|
+
headers: t,
|
|
2619
|
+
body: JSON.stringify(s ?? {})
|
|
2620
|
+
});
|
|
2621
|
+
},
|
|
2622
|
+
async getAlertNotifications(s) {
|
|
2623
|
+
const r = new URL("/api/Alert/GetNotifications", e.baseUrl).toString(), i = Yt(r, { alertId: s }), a = await Ae(i, {
|
|
2624
|
+
method: "GET",
|
|
2625
|
+
headers: t
|
|
2626
|
+
});
|
|
2627
|
+
return Array.isArray(a) ? a : a && typeof a == "object" && Array.isArray(a.data) ? a.data : [];
|
|
2628
|
+
}
|
|
2629
|
+
};
|
|
2630
|
+
}
|
|
2631
|
+
function rn() {
|
|
2632
|
+
try {
|
|
2633
|
+
const e = localStorage.getItem("authToken");
|
|
2634
|
+
return e ? { Authorization: `Bearer ${e}` } : {};
|
|
2635
|
+
} catch {
|
|
2636
|
+
return {};
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
async function We(e, t) {
|
|
2640
|
+
const s = {
|
|
2641
|
+
...t.headers,
|
|
2642
|
+
...rn()
|
|
2643
|
+
}, r = await fetch(e, { ...t, headers: s });
|
|
2644
|
+
if (r.status === 401)
|
|
2645
|
+
throw window.location.href = "/login", new Error("Unauthorized");
|
|
2646
|
+
if (r.status === 204) return {};
|
|
2647
|
+
const i = await r.text();
|
|
2648
|
+
let a = {};
|
|
2649
|
+
if (i)
|
|
2650
|
+
try {
|
|
2651
|
+
a = JSON.parse(i);
|
|
2652
|
+
} catch {
|
|
2653
|
+
a = { ok: r.ok, status: r.status, raw: i };
|
|
2654
|
+
}
|
|
2655
|
+
if (!r.ok) {
|
|
2656
|
+
const l = a?.errorMessage || a?.message || `HTTP ${r.status}`;
|
|
2657
|
+
throw new Error(l);
|
|
2658
|
+
}
|
|
2659
|
+
return a;
|
|
2660
|
+
}
|
|
2661
|
+
function us(e) {
|
|
2662
|
+
console.log("cfg", e);
|
|
2663
|
+
const t = {
|
|
2664
|
+
"Content-Type": "application/json",
|
|
2665
|
+
...e.headers || {}
|
|
2666
|
+
}, s = new URL("/api/Rules", e.baseUrl).toString(), r = new URL("/api/Rules/lookups", e.baseUrl).toString();
|
|
2667
|
+
return console.log("url", s), {
|
|
2668
|
+
async getRules() {
|
|
2669
|
+
const i = await We(s, { method: "GET", headers: t });
|
|
2670
|
+
return Array.isArray(i) ? i : [];
|
|
2671
|
+
},
|
|
2672
|
+
async setEscalationSettings(i) {
|
|
2673
|
+
return We(s, {
|
|
2674
|
+
method: "POST",
|
|
2675
|
+
headers: t,
|
|
2676
|
+
body: JSON.stringify(i ?? {})
|
|
2677
|
+
});
|
|
2678
|
+
},
|
|
2679
|
+
async getLookups() {
|
|
2680
|
+
return We(r, { method: "GET", headers: t });
|
|
2681
|
+
},
|
|
2682
|
+
async updateRule(i, a) {
|
|
2683
|
+
const l = `${s}/${i}`;
|
|
2684
|
+
return We(l, {
|
|
2685
|
+
method: "PUT",
|
|
2686
|
+
headers: t,
|
|
2687
|
+
body: JSON.stringify(a ?? {})
|
|
2688
|
+
});
|
|
2689
|
+
}
|
|
2690
|
+
};
|
|
2691
|
+
}
|
|
2692
|
+
function nn() {
|
|
2693
|
+
try {
|
|
2694
|
+
const e = localStorage.getItem("authToken");
|
|
2695
|
+
return e ? { Authorization: `Bearer ${e}` } : {};
|
|
2696
|
+
} catch {
|
|
2697
|
+
return {};
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
function Gt(e, t) {
|
|
2701
|
+
if (!t) return e;
|
|
2702
|
+
const s = new URL(e);
|
|
2703
|
+
return Object.entries(t).forEach(([r, i]) => {
|
|
2704
|
+
i != null && String(i).length > 0 && s.searchParams.set(r, String(i));
|
|
2705
|
+
}), s.toString();
|
|
2706
|
+
}
|
|
2707
|
+
async function ve(e, t) {
|
|
2708
|
+
const s = {
|
|
2709
|
+
...t.headers,
|
|
2710
|
+
...nn()
|
|
2711
|
+
}, r = await fetch(e, { ...t, headers: s });
|
|
2712
|
+
if (r.status === 401)
|
|
2713
|
+
throw window.location.href = "/login", new Error("Unauthorized");
|
|
2714
|
+
if (r.status === 204) return {};
|
|
2715
|
+
const i = await r.text();
|
|
2716
|
+
let a = {};
|
|
2717
|
+
if (i)
|
|
2718
|
+
try {
|
|
2719
|
+
a = JSON.parse(i);
|
|
2720
|
+
} catch {
|
|
2721
|
+
a = { ok: r.ok, status: r.status, raw: i };
|
|
2722
|
+
}
|
|
2723
|
+
if (!r.ok) {
|
|
2724
|
+
const l = a?.Message || `HTTP ${r.status}`;
|
|
2725
|
+
throw new Error(l);
|
|
2726
|
+
}
|
|
2727
|
+
return a;
|
|
2728
|
+
}
|
|
2729
|
+
const ie = (...e) => e.find((t) => t != null);
|
|
2730
|
+
function an(e) {
|
|
2731
|
+
return {
|
|
2732
|
+
// important: do not fall back to `id` here; only AlertId/alertId are considered the Alert ID
|
|
2733
|
+
id: String(ie(e?.AlertId, e?.alertId) ?? ""),
|
|
2734
|
+
priority: ie(e?.Priority, e?.priority, "Low"),
|
|
2735
|
+
timestamp: ie(e?.Timestamp, e?.timestamp, ""),
|
|
2736
|
+
statusType: ie(e?.Status, e?.statusType, ""),
|
|
2737
|
+
description: ie(e?.Description, e?.description, ""),
|
|
2738
|
+
eventName: ie(e?.EventName, e?.eventName),
|
|
2739
|
+
ruleName: ie(e?.RuleName, e?.ruleName),
|
|
2740
|
+
spaceName: ie(e?.SpaceName, e?.spaceName),
|
|
2741
|
+
assignTeam: ie(e?.AssignTeam, e?.assignTeam),
|
|
2742
|
+
cameraName: ie(e?.CameraName, e?.cameraName),
|
|
2743
|
+
type: ie(e?.Type, e?.type),
|
|
2744
|
+
mediaDetails: ie(e?.MediaDetails, e?.mediaDetails),
|
|
2745
|
+
additionalMedia: ie(e?.AdditionalMedia, e?.additionalMedia),
|
|
2746
|
+
timeElapsed: ie(e?.TimeElapsed, e?.timeElapsed),
|
|
2747
|
+
timeRemaining: ie(e?.TimeRemaining, e?.timeRemaining),
|
|
2748
|
+
anomalyName: ie(e?.AnomalyName, e?.anomalyName),
|
|
2749
|
+
alertDetails: ie(e?.AlertDetails, e?.alertDetails),
|
|
2750
|
+
statusHistory: ie(e?.StatusHistory, e?.statusHistory)
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2753
|
+
function ds(e) {
|
|
2754
|
+
const t = {
|
|
2755
|
+
"Content-Type": "application/json",
|
|
2756
|
+
...e.headers || {}
|
|
2757
|
+
};
|
|
2758
|
+
return {
|
|
2759
|
+
async listAlerts() {
|
|
2760
|
+
const s = new URL("/api/detectionpolicy/alerts?customerId=99e5c8b5-b9d4-4d35-8885-7f121c532664", e.baseUrl).toString(), r = await ve(s, {
|
|
2761
|
+
method: "GET",
|
|
2762
|
+
headers: t
|
|
2763
|
+
});
|
|
2764
|
+
return Array.isArray(r?.Items) ? (r?.Items).map(an) : [];
|
|
2765
|
+
},
|
|
2766
|
+
async getAlertStatusList() {
|
|
2767
|
+
const s = new URL("/api/detectionpolicy/alerts/StatusList", e.baseUrl).toString(), r = await ve(s, {
|
|
2768
|
+
method: "GET",
|
|
2769
|
+
headers: t
|
|
2770
|
+
});
|
|
2771
|
+
return Array.isArray(r) ? r : [];
|
|
2772
|
+
},
|
|
2773
|
+
async getAlertsReport(s) {
|
|
2774
|
+
const r = new URL(
|
|
2775
|
+
"/api/detectionpolicy/alerts/GetAlertsReport",
|
|
2776
|
+
e.baseUrl
|
|
2777
|
+
).toString(), i = Gt(r, s), a = await ve(i, {
|
|
2778
|
+
method: "GET",
|
|
2779
|
+
headers: t
|
|
2780
|
+
});
|
|
2781
|
+
return Array.isArray(a) ? a : [];
|
|
2782
|
+
},
|
|
2783
|
+
async updateAlertStatus(s) {
|
|
2784
|
+
const r = new URL("/api/detectionpolicy/alerts/Log", e.baseUrl).toString(), i = {
|
|
2785
|
+
AlertId: s.alertId ?? s.alertUniqueId ?? s.AlertId,
|
|
2786
|
+
Status: s.status ?? s.Status ?? "",
|
|
2787
|
+
Notes: s.notes ?? s.Notes ?? ""
|
|
2788
|
+
};
|
|
2789
|
+
return ve(r, {
|
|
2790
|
+
method: "POST",
|
|
2791
|
+
headers: t,
|
|
2792
|
+
body: JSON.stringify(i)
|
|
2793
|
+
});
|
|
2794
|
+
},
|
|
2795
|
+
async getAdminSettings() {
|
|
2796
|
+
const s = new URL(
|
|
2797
|
+
"/api/detectionpolicy/alerts/GetAdminSettings",
|
|
2798
|
+
e.baseUrl
|
|
2799
|
+
).toString(), r = await ve(s, {
|
|
2800
|
+
method: "GET",
|
|
2801
|
+
headers: t
|
|
2802
|
+
});
|
|
2803
|
+
if (r && typeof r == "object") {
|
|
2804
|
+
if ("data" in r) return r.data;
|
|
2805
|
+
if ("userId" in r) return r;
|
|
2806
|
+
}
|
|
2807
|
+
return null;
|
|
2808
|
+
},
|
|
2809
|
+
async setAdminSettings(s) {
|
|
2810
|
+
const r = new URL(
|
|
2811
|
+
"/api/detectionpolicy/alerts/SetAdminSettings",
|
|
2812
|
+
e.baseUrl
|
|
2813
|
+
).toString(), i = {
|
|
2814
|
+
userId: 0,
|
|
2815
|
+
isAdminSetting: !0,
|
|
2816
|
+
sortBy: s?.sortBy ?? "",
|
|
2817
|
+
groupBy: s?.groupBy ?? ""
|
|
2818
|
+
};
|
|
2819
|
+
return ve(r, {
|
|
2820
|
+
method: "POST",
|
|
2821
|
+
headers: t,
|
|
2822
|
+
body: JSON.stringify(i)
|
|
2823
|
+
});
|
|
2824
|
+
},
|
|
2825
|
+
async getPreferenceSettings() {
|
|
2826
|
+
const s = new URL(
|
|
2827
|
+
"/api/detectionpolicy/alerts/GetPreferenceSettings",
|
|
2828
|
+
e.baseUrl
|
|
2829
|
+
).toString(), r = await ve(s, {
|
|
2830
|
+
method: "GET",
|
|
2831
|
+
headers: t
|
|
2832
|
+
});
|
|
2833
|
+
if (r && typeof r == "object") {
|
|
2834
|
+
if ("data" in r) return r.data;
|
|
2835
|
+
if ("anomalyIds" in r) return r;
|
|
2836
|
+
}
|
|
2837
|
+
return null;
|
|
2838
|
+
},
|
|
2839
|
+
async setPreferenceSettings(s) {
|
|
2840
|
+
const r = new URL(
|
|
2841
|
+
"/api/detectionpolicy/alerts/SetPreferenceSettings",
|
|
2842
|
+
e.baseUrl
|
|
2843
|
+
).toString();
|
|
2844
|
+
return ve(r, {
|
|
2845
|
+
method: "POST",
|
|
2846
|
+
headers: t,
|
|
2847
|
+
body: JSON.stringify(s ?? {})
|
|
2848
|
+
});
|
|
2849
|
+
},
|
|
2850
|
+
async getAlertNotifications(s) {
|
|
2851
|
+
const r = new URL(
|
|
2852
|
+
"/api/detectionpolicy/alerts/GetNotifications",
|
|
2853
|
+
e.baseUrl
|
|
2854
|
+
).toString(), i = Gt(r, { alertId: s }), a = await ve(i, {
|
|
2855
|
+
method: "GET",
|
|
2856
|
+
headers: t
|
|
2857
|
+
});
|
|
2858
|
+
return Array.isArray(a) ? a : a && typeof a == "object" && Array.isArray(a.data) ? a.data : [];
|
|
2859
|
+
}
|
|
2860
|
+
};
|
|
2861
|
+
}
|
|
2862
|
+
function on() {
|
|
2863
|
+
try {
|
|
2864
|
+
const e = localStorage.getItem("authToken");
|
|
2865
|
+
return e ? { Authorization: `Bearer ${e}` } : {};
|
|
2866
|
+
} catch {
|
|
2867
|
+
return {};
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
async function ze(e, t) {
|
|
2871
|
+
const s = {
|
|
2872
|
+
...t.headers,
|
|
2873
|
+
...on()
|
|
2874
|
+
}, r = await fetch(e, { ...t, headers: s });
|
|
2875
|
+
if (r.status === 401)
|
|
2876
|
+
throw window.location.href = "/login", new Error("Unauthorized");
|
|
2877
|
+
if (r.status === 204) return {};
|
|
2878
|
+
const i = await r.text();
|
|
2879
|
+
let a = {};
|
|
2880
|
+
if (i)
|
|
2881
|
+
try {
|
|
2882
|
+
a = JSON.parse(i);
|
|
2883
|
+
} catch {
|
|
2884
|
+
a = { ok: r.ok, status: r.status, raw: i };
|
|
2885
|
+
}
|
|
2886
|
+
if (!r.ok) {
|
|
2887
|
+
const l = a?.errorMessage || a?.message || `HTTP ${r.status}`;
|
|
2888
|
+
throw new Error(l);
|
|
2889
|
+
}
|
|
2890
|
+
return a;
|
|
2891
|
+
}
|
|
2892
|
+
function ln(e) {
|
|
2893
|
+
const t = {
|
|
2894
|
+
"Content-Type": "application/json",
|
|
2895
|
+
...e.headers || {}
|
|
2896
|
+
}, s = new URL("/api/detectionpolicy/rules", e.baseUrl).toString(), r = new URL("/api/detectionpolicy/rules/lookups", e.baseUrl).toString();
|
|
2897
|
+
return {
|
|
2898
|
+
async getRules() {
|
|
2899
|
+
const i = await ze(s, { method: "GET", headers: t });
|
|
2900
|
+
return Array.isArray(i) ? i : [];
|
|
2901
|
+
},
|
|
2902
|
+
async setEscalationSettings(i) {
|
|
2903
|
+
return ze(s, {
|
|
2904
|
+
method: "POST",
|
|
2905
|
+
headers: t,
|
|
2906
|
+
body: JSON.stringify(i ?? {})
|
|
2907
|
+
});
|
|
2908
|
+
},
|
|
2909
|
+
async getLookups() {
|
|
2910
|
+
return ze(r, { method: "GET", headers: t });
|
|
2911
|
+
},
|
|
2912
|
+
async updateRule(i, a) {
|
|
2913
|
+
const l = `${s}/${i}`;
|
|
2914
|
+
return ze(l, {
|
|
2915
|
+
method: "PUT",
|
|
2916
|
+
headers: t,
|
|
2917
|
+
body: JSON.stringify(a ?? {})
|
|
2918
|
+
});
|
|
2919
|
+
}
|
|
2920
|
+
};
|
|
2921
|
+
}
|
|
2922
|
+
const hs = Es(null);
|
|
2923
|
+
function cn({
|
|
2924
|
+
tenant: e = "snl",
|
|
2925
|
+
override: t,
|
|
2926
|
+
children: s
|
|
2927
|
+
}) {
|
|
2928
|
+
const r = ue(() => {
|
|
2929
|
+
const a = t?.alertsBaseUrl || Ht[e]?.alerts || "", l = t?.rulesBaseUrl || Ht[e]?.rules || "", o = t?.headers;
|
|
2930
|
+
return { tenant: e, alertsBaseUrl: a, rulesBaseUrl: l, headers: o };
|
|
2931
|
+
}, [
|
|
2932
|
+
e,
|
|
2933
|
+
t?.alertsBaseUrl,
|
|
2934
|
+
t?.rulesBaseUrl,
|
|
2935
|
+
JSON.stringify(t?.headers || {})
|
|
2936
|
+
]), i = ue(() => {
|
|
2937
|
+
const a = r.tenant === "schools" ? ds({ baseUrl: r.alertsBaseUrl, headers: r.headers }) : cs({ baseUrl: r.alertsBaseUrl, headers: r.headers }), l = r.tenant === "schools" ? ln({ baseUrl: r.rulesBaseUrl, headers: r.headers }) : us({ baseUrl: r.rulesBaseUrl, headers: r.headers });
|
|
2938
|
+
return { config: r, alerts: a, rules: l };
|
|
2939
|
+
}, [r]);
|
|
2940
|
+
return /* @__PURE__ */ n.jsx(hs.Provider, { value: i, children: s });
|
|
2941
|
+
}
|
|
2942
|
+
function De() {
|
|
2943
|
+
const e = Cs(hs);
|
|
2944
|
+
if (!e) throw new Error("useApi must be used inside ApiProvider");
|
|
2945
|
+
return e;
|
|
2946
|
+
}
|
|
2947
|
+
function fs() {
|
|
2948
|
+
const { alerts: e } = De(), t = gt();
|
|
2949
|
+
return Zr({
|
|
2950
|
+
mutationFn: (s) => e.updateAlertStatus(s),
|
|
2951
|
+
onSuccess: () => {
|
|
2952
|
+
t.invalidateQueries({ queryKey: ["alerts", "list"] }), t.invalidateQueries({ queryKey: ["alerts", "report"] });
|
|
2953
|
+
}
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2956
|
+
function un(e, t) {
|
|
2957
|
+
return e.toLocaleTimeString([], {
|
|
2958
|
+
hour: "2-digit",
|
|
2959
|
+
minute: "2-digit",
|
|
2960
|
+
second: "2-digit",
|
|
2961
|
+
hour12: !0,
|
|
2962
|
+
timeZone: t
|
|
2963
|
+
});
|
|
2964
|
+
}
|
|
2965
|
+
function dn(e, t) {
|
|
2966
|
+
try {
|
|
2967
|
+
const i = new Intl.DateTimeFormat("en-US", { timeZone: t, timeZoneName: "short" }).formatToParts(e).find((l) => l.type === "timeZoneName")?.value;
|
|
2968
|
+
let a;
|
|
2969
|
+
try {
|
|
2970
|
+
const o = new Intl.DateTimeFormat("en-US", { timeZone: t, timeZoneName: "shortOffset" }).formatToParts(e).find((g) => g.type === "timeZoneName");
|
|
2971
|
+
o?.value && o.value.startsWith("GMT") && (a = o.value.replace("GMT", ""));
|
|
2972
|
+
} catch {
|
|
2973
|
+
}
|
|
2974
|
+
return { abbr: i, offset: a };
|
|
2975
|
+
} catch {
|
|
2976
|
+
return {};
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
function hn(e) {
|
|
2980
|
+
if (!e) return "-";
|
|
2981
|
+
try {
|
|
2982
|
+
const t = new Date(e), s = (x) => String(x).padStart(2, "0"), r = s(t.getMonth() + 1), i = s(t.getDate()), a = t.getFullYear(), l = s(t.getHours()), o = s(t.getMinutes()), g = s(t.getSeconds());
|
|
2983
|
+
return `${r}/${i}/${a} ${l}:${o}:${g}`;
|
|
2984
|
+
} catch {
|
|
2985
|
+
return "-";
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
function tt(e) {
|
|
2989
|
+
if (!e) return "-";
|
|
2990
|
+
try {
|
|
2991
|
+
return new Date(e).toLocaleString("en-US", {
|
|
2992
|
+
day: "2-digit",
|
|
2993
|
+
month: "2-digit",
|
|
2994
|
+
year: "numeric",
|
|
2995
|
+
hour: "2-digit",
|
|
2996
|
+
minute: "2-digit",
|
|
2997
|
+
second: "2-digit"
|
|
2998
|
+
});
|
|
2999
|
+
} catch {
|
|
3000
|
+
return "-";
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
function fn({
|
|
3004
|
+
alerts: e,
|
|
3005
|
+
loading: t = !1,
|
|
3006
|
+
pageSize: s = 10,
|
|
3007
|
+
completedStatus: r = "Completed",
|
|
3008
|
+
severityOptions: i,
|
|
3009
|
+
anomalyOptions: a,
|
|
3010
|
+
spaceOptions: l,
|
|
3011
|
+
onAlertIdClick: o
|
|
3012
|
+
}) {
|
|
3013
|
+
const g = fs(), x = async (m) => {
|
|
3014
|
+
try {
|
|
3015
|
+
await g.mutateAsync({
|
|
3016
|
+
alertUniqueId: m.alertId ?? m.id,
|
|
3017
|
+
alertId: m.id,
|
|
3018
|
+
status: "Reopen",
|
|
3019
|
+
notes: "",
|
|
3020
|
+
modifiedBy: 0
|
|
3021
|
+
});
|
|
3022
|
+
} catch {
|
|
3023
|
+
}
|
|
3024
|
+
}, p = [
|
|
3025
|
+
{
|
|
3026
|
+
title: "Severity",
|
|
3027
|
+
dataIndex: "priority",
|
|
3028
|
+
key: "priority",
|
|
3029
|
+
width: 120
|
|
3030
|
+
},
|
|
3031
|
+
{
|
|
3032
|
+
title: "Timestamp",
|
|
3033
|
+
dataIndex: "timestamp",
|
|
3034
|
+
key: "timestamp",
|
|
3035
|
+
width: 200,
|
|
3036
|
+
render: (m) => hn(m)
|
|
3037
|
+
},
|
|
3038
|
+
{
|
|
3039
|
+
title: "Status",
|
|
3040
|
+
dataIndex: "statusType",
|
|
3041
|
+
key: "statusType",
|
|
3042
|
+
width: 140
|
|
3043
|
+
},
|
|
3044
|
+
{
|
|
3045
|
+
title: "Description",
|
|
3046
|
+
dataIndex: "description",
|
|
3047
|
+
key: "description",
|
|
3048
|
+
render: (m, A) => /* @__PURE__ */ n.jsxs("div", { children: [
|
|
3049
|
+
/* @__PURE__ */ n.jsxs(
|
|
3050
|
+
"a",
|
|
3051
|
+
{
|
|
3052
|
+
onClick: (j) => {
|
|
3053
|
+
j.preventDefault(), o?.(A);
|
|
3054
|
+
},
|
|
3055
|
+
className: "inline-block mb-1",
|
|
3056
|
+
children: [
|
|
3057
|
+
"ALT - ",
|
|
3058
|
+
A.id,
|
|
3059
|
+
" (Alert ID no)"
|
|
3060
|
+
]
|
|
3061
|
+
}
|
|
3062
|
+
),
|
|
3063
|
+
/* @__PURE__ */ n.jsx("div", { className: "text-black/65", children: m })
|
|
3064
|
+
] })
|
|
3065
|
+
},
|
|
3066
|
+
{
|
|
3067
|
+
title: "",
|
|
3068
|
+
key: "menu",
|
|
3069
|
+
width: 60,
|
|
3070
|
+
align: "right",
|
|
3071
|
+
render: (m, A) => /* @__PURE__ */ n.jsx(
|
|
3072
|
+
Fs,
|
|
3073
|
+
{
|
|
3074
|
+
trigger: ["click"],
|
|
3075
|
+
menu: {
|
|
3076
|
+
items: [
|
|
3077
|
+
{ key: "reopen", label: "Reopen" }
|
|
3078
|
+
],
|
|
3079
|
+
onClick: ({ key: j }) => {
|
|
3080
|
+
j === "reopen" && x(A);
|
|
3081
|
+
}
|
|
3082
|
+
},
|
|
3083
|
+
children: /* @__PURE__ */ n.jsx(de, { type: "text", icon: /* @__PURE__ */ n.jsx(Ws, {}) })
|
|
3084
|
+
}
|
|
3085
|
+
)
|
|
3086
|
+
}
|
|
3087
|
+
], T = (e || []).filter(
|
|
3088
|
+
(m) => (m.statusType || "").toLowerCase() === r.toLowerCase()
|
|
3089
|
+
);
|
|
3090
|
+
return /* @__PURE__ */ n.jsx(
|
|
3091
|
+
$t,
|
|
3092
|
+
{
|
|
3093
|
+
data: T,
|
|
3094
|
+
loading: t,
|
|
3095
|
+
pageSize: s,
|
|
3096
|
+
columns: p,
|
|
3097
|
+
severityOptions: i,
|
|
3098
|
+
anomalyOptions: a,
|
|
3099
|
+
spaceOptions: l,
|
|
3100
|
+
renderActions: void 0,
|
|
3101
|
+
onAlertIdClick: o
|
|
3102
|
+
}
|
|
3103
|
+
);
|
|
3104
|
+
}
|
|
3105
|
+
const mn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGIAAABiCAYAAACrpQYOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABZkSURBVHgB7V1pcFTFFu4AAQLImkhYAygQlsIKCAgiCrIoKFZplUv5QBFRn2AV6lPrgYBboQLyQ0tcwEdZLIqoiIKWIoR9E8GIrD42ZYcAEQIiS7/zde7X9gyTkLkzkwz15qsacufeO/d299dn6dN9miQtUAmUOsqoBOICCSLiBAki4g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8PEd+8BSSjlOwG8RIwtFQqw2WYz55ookY7bnn7v75PXr18/eR32Mxhg2bJgljIQEb5wINVdfyKkrKqZCixa6soRRqknY/aqMDBMNDt5PPJjYzp07G0kE0MPZy2fNmmXfS7sRK3XkokS2GyUZOeJisiHY09BoyNoH0BiuNwNJQg63S0BRu10G3+f+xQcrL4YMGWIkCnBtAaSC3hM6Cu0G9qIFLvvtRglWBD2erqu7pSeW5mAWD3D9ewDLU0DKLbfcYnYvLs4esJwxQzgCG3W5+726nhskkQE87sJJspnnUBLbU5foJu1ceYdlKNiQffTo0eY7FqtxKT9Svd5//32Tkxf8GwKrrbGQDPkJWPCFVSJYGY6ESix6E3ti8hVwzHxo7aQQAPiNBOvMomX8FqsW8S6sFsTa2uzsbLPUnhvJxxy6FMAehg1TECJX6u/tSKlKMkTXv/LKKwHbSUcKjIQxa4jNsJS6eL0sJIj7gkca1g4Xpfb/R7gVhY1Awyt18Sa5+DRs2NAM9DBbBmK4ffWlnk/PCWHqa6+91joJ3GGN74Abi1356b2V9E75QKn+/xEAVAG3hVi5cqV69NFH1YYNG8x3ZqMGLyaGGpEpWbP2FOoDKgjnsCAZKkfmko3qQh6F+9vg50GVjRw50iS4YPE01BDKEqsM2CKh4wSuGsCOkggjMDjo5xPKa1Ke+sFqC3pqfHdpL2oodYkIRrBxRr6cDOLU3Llzzcpy7A3I1N5LAT0bKVXipalbb73V/M8pEsYwxpfVLpXeHwJxR4SLUI2FbFZ4SsjxlgipyWmGegOBUC9QU1gEjDWoSA/Azgfujjg6Tv8LtLgm4v8Jif+ZMU6QICJOkCAiTpAgIk6QICJOkCAiTpAgIk6QICJOkCAiTpAgIk6QICJO8D8Ymc0Ji7s1fgAAAABJRU5ErkJggg==";
|
|
3106
|
+
function pn({ label: e = "USA", timeZone: t = "America/New_York", updateIntervalMs: s = 1e3, className: r }) {
|
|
3107
|
+
const [i, a] = C(/* @__PURE__ */ new Date());
|
|
3108
|
+
me(() => {
|
|
3109
|
+
const x = setInterval(() => a(/* @__PURE__ */ new Date()), s);
|
|
3110
|
+
return () => clearInterval(x);
|
|
3111
|
+
}, [s]);
|
|
3112
|
+
const l = ue(() => un(i, t), [i, t]), { abbr: o, offset: g } = ue(() => dn(i, t), [i, t]);
|
|
3113
|
+
return /* @__PURE__ */ n.jsxs("div", { className: `flex items-center gap-3 ${r || ""}`, children: [
|
|
3114
|
+
/* @__PURE__ */ n.jsx("div", { className: "flex items-center justify-center w-20 h-20", children: /* @__PURE__ */ n.jsx("img", { src: mn, alt: "clock", className: "" }) }),
|
|
3115
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-col items-baseline gap-1", children: [
|
|
3116
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-2 text-sm text-gray-600", children: [
|
|
3117
|
+
/* @__PURE__ */ n.jsx("span", { className: "uppercase", children: e }),
|
|
3118
|
+
o && /* @__PURE__ */ n.jsx("span", { className: "px-1.5 py-0.5 rounded-md border text-[10px] leading-none text-gray-600 bg-gray-50", children: o }),
|
|
3119
|
+
g && /* @__PURE__ */ n.jsx("span", { className: "text-xs text-gray-500", children: g })
|
|
3120
|
+
] }),
|
|
3121
|
+
/* @__PURE__ */ n.jsx("div", { className: "text-2xl font-semibold text-gray-700 tracking-wide", children: l })
|
|
3122
|
+
] })
|
|
3123
|
+
] });
|
|
3124
|
+
}
|
|
3125
|
+
const yn = [{ SeverityId: 1, Code: "LOW", DisplayName: "Low", SortOrder: 10, IsActive: !0 }, { SeverityId: 2, Code: "MEDIUM", DisplayName: "Medium", SortOrder: 20, IsActive: !0 }, { SeverityId: 3, Code: "HIGH", DisplayName: "High", SortOrder: 30, IsActive: !0 }, { SeverityId: 4, Code: "CRITICAL", DisplayName: "Critical", SortOrder: 40, IsActive: !0 }], gn = [{ RuleId: "0938aa00-dfa7-4258-805a-67396366c776", RuleVersionId: "36d2d581-57c3-45c3-8705-8235935fdf96", Name: "License Plate Recognition", Description: "License Plate Recognition", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 3, AnomalyId: "915976ef-4eb6-4f7b-bbe6-e53862517fc9", Level: "global" }, { RuleId: "2437286a-db6a-4d35-814e-9ac49f158dde", RuleVersionId: "00000000-0000-0000-0000-000000000000", Name: "Monitor And Track Onsite Vehicle timelog", Description: "Monitor And Track Onsite Vehicle timelog", VersionCount: 0, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 3, AnomalyId: "9fd651ab-4312-4826-84b6-94d735894477", Level: "global" }, { RuleId: "b99120ba-7a83-4ade-b5d9-a420550fe351", RuleVersionId: "d7b14dae-a7b1-474e-a357-199182c02ac3", Name: "Watchlist person detected", Description: "Watchlist person detected", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 4, AnomalyId: "bb3a3d3a-73a3-4f5a-8804-1baadbd0d412", Level: "global" }, { RuleId: "ffc2c24f-adb7-4aba-ace7-f19c54e21530", RuleVersionId: "6ab3178f-bf77-4a1e-898d-1d5dbef749c5", Name: "Weapon Detection", Description: "Weapon Detection", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 4, AnomalyId: "ac82c3a2-72e6-4f9c-88fb-851a3ca3c4de", Level: "global" }], An = [{ userRoleId: 1, userRoleName: "Super Admin" }, { userRoleId: 2, userRoleName: "Security Officer" }, { userRoleId: 3, userRoleName: "Security Admin" }, { userRoleId: 4, userRoleName: "Regulatory Officer/First Responder" }, { userRoleId: 5, userRoleName: "User" }], Ne = {
|
|
3126
|
+
severities: yn,
|
|
3127
|
+
rules: gn,
|
|
3128
|
+
userRoles: An
|
|
3129
|
+
}, { Text: Xt } = Me;
|
|
3130
|
+
function vn({ sortBy: e, groupBy: t, onChange: s, showActions: r, onSave: i, onClear: a }) {
|
|
3131
|
+
return /* @__PURE__ */ n.jsxs(Ee, { gutter: [16, 16], align: "middle", children: [
|
|
3132
|
+
/* @__PURE__ */ n.jsx(ee, { xs: 24, md: 4, children: /* @__PURE__ */ n.jsxs(Z, { className: "w-full items-center", direction: "horizontal", size: 12, children: [
|
|
3133
|
+
/* @__PURE__ */ n.jsx(Xt, { className: "text-gray-600", children: "Sort by:" }),
|
|
3134
|
+
/* @__PURE__ */ n.jsx(
|
|
3135
|
+
le,
|
|
3136
|
+
{
|
|
3137
|
+
placeholder: "By Severity",
|
|
3138
|
+
value: e,
|
|
3139
|
+
onChange: (l) => s({ sortBy: l }),
|
|
3140
|
+
options: [
|
|
3141
|
+
{ label: "By Severity", value: "By Severity" },
|
|
3142
|
+
{ label: "By Created Date", value: "By Created Date" }
|
|
3143
|
+
],
|
|
3144
|
+
className: "w-full"
|
|
3145
|
+
}
|
|
3146
|
+
)
|
|
3147
|
+
] }) }),
|
|
3148
|
+
/* @__PURE__ */ n.jsx(ee, { xs: 24, md: 4, children: /* @__PURE__ */ n.jsxs(Z, { className: "w-full items-center", direction: "horizontal", size: 12, children: [
|
|
3149
|
+
/* @__PURE__ */ n.jsx(Xt, { className: "text-gray-600", children: "Group alerts by:" }),
|
|
3150
|
+
/* @__PURE__ */ n.jsx(
|
|
3151
|
+
le,
|
|
3152
|
+
{
|
|
3153
|
+
value: t,
|
|
3154
|
+
onChange: (l) => s({ groupBy: l }),
|
|
3155
|
+
options: [
|
|
3156
|
+
{ label: "By severity", value: "By severity" },
|
|
3157
|
+
{ label: "By Rules", value: "By Rules" }
|
|
3158
|
+
],
|
|
3159
|
+
className: "w-full"
|
|
3160
|
+
}
|
|
3161
|
+
)
|
|
3162
|
+
] }) }),
|
|
3163
|
+
/* @__PURE__ */ n.jsx(ee, { xs: 24, md: 8, style: { alignSelf: "end" }, children: r ? /* @__PURE__ */ n.jsxs(Z, { className: "w-full", direction: "horizontal", size: 8, children: [
|
|
3164
|
+
/* @__PURE__ */ n.jsx(de, { onClick: a, children: "Clear" }),
|
|
3165
|
+
/* @__PURE__ */ n.jsx(de, { type: "primary", onClick: i, children: "Save" })
|
|
3166
|
+
] }) : null })
|
|
3167
|
+
] });
|
|
3168
|
+
}
|
|
3169
|
+
const xn = "", vt = us({ baseUrl: xn });
|
|
3170
|
+
async function bn() {
|
|
3171
|
+
return vt.getRules();
|
|
3172
|
+
}
|
|
3173
|
+
async function xt() {
|
|
3174
|
+
return vt.getLookups();
|
|
3175
|
+
}
|
|
3176
|
+
async function ms(e, t) {
|
|
3177
|
+
return vt.updateRule(e, t);
|
|
3178
|
+
}
|
|
3179
|
+
const { Text: Ue } = Me;
|
|
3180
|
+
function Sn(e) {
|
|
3181
|
+
const {
|
|
3182
|
+
// escBasis, setEscBasis,
|
|
3183
|
+
// selectedSeverity, setSelectedSeverity,
|
|
3184
|
+
selectedRule: t,
|
|
3185
|
+
setSelectedRule: s,
|
|
3186
|
+
ruleOptions: r,
|
|
3187
|
+
minsOptions: i,
|
|
3188
|
+
roleOptions: a,
|
|
3189
|
+
l1mins: l,
|
|
3190
|
+
setL1mins: o,
|
|
3191
|
+
l1roles: g,
|
|
3192
|
+
setL1roles: x,
|
|
3193
|
+
l2mins: p,
|
|
3194
|
+
setL2mins: T,
|
|
3195
|
+
l2roles: m,
|
|
3196
|
+
setL2roles: A,
|
|
3197
|
+
l3mins: j,
|
|
3198
|
+
setL3mins: E,
|
|
3199
|
+
l3roles: P,
|
|
3200
|
+
setL3roles: W,
|
|
3201
|
+
actions: q,
|
|
3202
|
+
setActions: Y,
|
|
3203
|
+
thirdPartyIds: J,
|
|
3204
|
+
setThirdPartyIds: X,
|
|
3205
|
+
humanLoop: V,
|
|
3206
|
+
setHumanLoop: w,
|
|
3207
|
+
onClear: I,
|
|
3208
|
+
onSave: M,
|
|
3209
|
+
saving: R,
|
|
3210
|
+
onActionTypesLoaded: b
|
|
3211
|
+
} = e, [B, z] = C([]), [v, h] = C([]), [d, S] = C(!1);
|
|
3212
|
+
return me(() => {
|
|
3213
|
+
let y = !1;
|
|
3214
|
+
return (async () => {
|
|
3215
|
+
try {
|
|
3216
|
+
S(!0);
|
|
3217
|
+
const u = await xt();
|
|
3218
|
+
if (y || !u || !Array.isArray(u.actionTypes)) return;
|
|
3219
|
+
const N = u.actionTypes.map((f) => ({ label: f.name, value: String(f.actionTypeId) }));
|
|
3220
|
+
z(N), b && b(u.actionTypes);
|
|
3221
|
+
const c = Array.isArray(u.thirdParties) ? u.thirdParties.map((f) => ({ label: f.thirdPartyName, value: f.thirdPartyId })) : [];
|
|
3222
|
+
h(c);
|
|
3223
|
+
} catch (u) {
|
|
3224
|
+
console.error("Error loading lookups", u);
|
|
3225
|
+
} finally {
|
|
3226
|
+
y || S(!1);
|
|
3227
|
+
}
|
|
3228
|
+
})(), () => {
|
|
3229
|
+
y = !0;
|
|
3230
|
+
};
|
|
3231
|
+
}, []), /* @__PURE__ */ n.jsx(dt, { spinning: !!R || d, children: /* @__PURE__ */ n.jsxs(Ee, { gutter: [16, 16], align: "bottom", className: "mb-2", children: [
|
|
3232
|
+
/* @__PURE__ */ n.jsx(ee, { xs: 24, lg: 5, children: /* @__PURE__ */ n.jsx(Z, { className: "w-full", direction: "vertical", size: 4, children: /* @__PURE__ */ n.jsx(le, { placeholder: "Rules", value: t, onChange: s, options: r, className: "w-full" }) }) }),
|
|
3233
|
+
/* @__PURE__ */ n.jsx(ee, { xs: 24, lg: 3, children: /* @__PURE__ */ n.jsxs(Z, { direction: "vertical", size: 4, className: "w-full", children: [
|
|
3234
|
+
/* @__PURE__ */ n.jsx(Ue, { className: "text-gray-700 font-medium", children: "Level 1" }),
|
|
3235
|
+
/* @__PURE__ */ n.jsxs(Z, { className: "w-full", children: [
|
|
3236
|
+
/* @__PURE__ */ n.jsx(le, { placeholder: "Mins", value: l, onChange: o, options: i }),
|
|
3237
|
+
/* @__PURE__ */ n.jsx(le, { mode: "multiple", placeholder: "Escalate to", className: "min-w-[120px] w-full", value: g, onChange: x, options: a })
|
|
3238
|
+
] })
|
|
3239
|
+
] }) }),
|
|
3240
|
+
/* @__PURE__ */ n.jsx(ee, { xs: 24, lg: 3, children: /* @__PURE__ */ n.jsxs(Z, { direction: "vertical", size: 4, className: "w-full", children: [
|
|
3241
|
+
/* @__PURE__ */ n.jsx(Ue, { className: "text-gray-700 font-medium", children: "Level 2" }),
|
|
3242
|
+
/* @__PURE__ */ n.jsxs(Z, { className: "w-full", children: [
|
|
3243
|
+
/* @__PURE__ */ n.jsx(le, { placeholder: "Mins", value: p, onChange: T, options: i }),
|
|
3244
|
+
/* @__PURE__ */ n.jsx(le, { mode: "multiple", placeholder: "Escalate to", className: "min-w-[120px] w-full", value: m, onChange: A, options: a })
|
|
3245
|
+
] })
|
|
3246
|
+
] }) }),
|
|
3247
|
+
/* @__PURE__ */ n.jsx(ee, { xs: 24, lg: 3, children: /* @__PURE__ */ n.jsxs(Z, { direction: "vertical", size: 4, className: "w-full", children: [
|
|
3248
|
+
/* @__PURE__ */ n.jsx(Ue, { className: "text-gray-700 font-medium", children: "Level 3" }),
|
|
3249
|
+
/* @__PURE__ */ n.jsxs(Z, { className: "w-full", children: [
|
|
3250
|
+
/* @__PURE__ */ n.jsx(le, { placeholder: "Mins", value: j, onChange: E, options: i }),
|
|
3251
|
+
/* @__PURE__ */ n.jsx(le, { mode: "multiple", placeholder: "Escalate to", className: "min-w-[120px] w-full", value: P, onChange: W, options: a })
|
|
3252
|
+
] })
|
|
3253
|
+
] }) }),
|
|
3254
|
+
/* @__PURE__ */ n.jsx(ee, { xs: 24, lg: 6, children: /* @__PURE__ */ n.jsxs(Z, { direction: "vertical", size: 4, className: "w-full", children: [
|
|
3255
|
+
/* @__PURE__ */ n.jsx(Ue, { className: "text-gray-700 font-medium", children: "Pick Actions" }),
|
|
3256
|
+
/* @__PURE__ */ n.jsx(Z, { className: "w-full", children: /* @__PURE__ */ n.jsx(le, { mode: "multiple", placeholder: "Select response actions", className: "min-w-[260px] w-full", value: q, onChange: Y, options: B }) })
|
|
3257
|
+
] }) }),
|
|
3258
|
+
/* @__PURE__ */ n.jsx(ee, { xs: 24, lg: 16, children: /* @__PURE__ */ n.jsxs(Z, { direction: "vertical", size: 4, className: "w-full", children: [
|
|
3259
|
+
/* @__PURE__ */ n.jsx(Ue, { className: "text-gray-700 font-medium", children: "Third Party App" }),
|
|
3260
|
+
/* @__PURE__ */ n.jsxs(Z, { className: "w-full", children: [
|
|
3261
|
+
/* @__PURE__ */ n.jsx(
|
|
3262
|
+
le,
|
|
3263
|
+
{
|
|
3264
|
+
mode: "multiple",
|
|
3265
|
+
placeholder: "Third Party app",
|
|
3266
|
+
className: "min-w-[180px] w-full",
|
|
3267
|
+
value: J,
|
|
3268
|
+
onChange: X,
|
|
3269
|
+
options: v
|
|
3270
|
+
}
|
|
3271
|
+
),
|
|
3272
|
+
/* @__PURE__ */ n.jsx(Te, { checked: V, onChange: (y) => w(y.target.checked), children: "Human-In-Loop" }),
|
|
3273
|
+
/* @__PURE__ */ n.jsx(de, { onClick: I, children: "Clear" }),
|
|
3274
|
+
/* @__PURE__ */ n.jsx(de, { type: "primary", onClick: M, loading: !!R, children: "Save" })
|
|
3275
|
+
] })
|
|
3276
|
+
] }) })
|
|
3277
|
+
] }) });
|
|
3278
|
+
}
|
|
3279
|
+
function wn({ entries: e, userRoles: t, onEdit: s, loading: r }) {
|
|
3280
|
+
const i = new Map(t.map((l) => [l.userRoleId, l.userRoleName])), a = (l) => l.map((o) => i.get(o) || String(o)).join(", ");
|
|
3281
|
+
return /* @__PURE__ */ n.jsx(
|
|
3282
|
+
ut,
|
|
3283
|
+
{
|
|
3284
|
+
rowKey: "id",
|
|
3285
|
+
dataSource: e,
|
|
3286
|
+
pagination: !1,
|
|
3287
|
+
loading: r,
|
|
3288
|
+
columns: [
|
|
3289
|
+
{ title: "Rule", dataIndex: "ruleOrSeverityLabel", key: "rule" },
|
|
3290
|
+
{
|
|
3291
|
+
title: "Level 1",
|
|
3292
|
+
key: "l1",
|
|
3293
|
+
render: (l, o) => /* @__PURE__ */ n.jsxs("span", { children: [
|
|
3294
|
+
o.l1.minutes ? `No Action taken in (${o.l1.minutes} Mins)` : "-",
|
|
3295
|
+
o.l1.roles?.length ? `, Escalate to (${a(o.l1.roles)})` : ""
|
|
3296
|
+
] })
|
|
3297
|
+
},
|
|
3298
|
+
{
|
|
3299
|
+
title: "Level 2",
|
|
3300
|
+
key: "l2",
|
|
3301
|
+
render: (l, o) => /* @__PURE__ */ n.jsxs("span", { children: [
|
|
3302
|
+
o.l2.minutes ? `No Action taken in (${o.l2.minutes} Mins)` : "-",
|
|
3303
|
+
o.l2.roles?.length ? `, Escalate to (${a(o.l2.roles)})` : ""
|
|
3304
|
+
] })
|
|
3305
|
+
},
|
|
3306
|
+
{
|
|
3307
|
+
title: "Level 3",
|
|
3308
|
+
key: "l3",
|
|
3309
|
+
render: (l, o) => /* @__PURE__ */ n.jsxs("span", { children: [
|
|
3310
|
+
o.l3.minutes ? `No Action taken in (${o.l3.minutes} Mins)` : "-",
|
|
3311
|
+
o.l3.roles?.length ? `, Escalate to (${a(o.l3.roles)})` : ""
|
|
3312
|
+
] })
|
|
3313
|
+
},
|
|
3314
|
+
{
|
|
3315
|
+
title: "Pick Actions",
|
|
3316
|
+
key: "actionsCol",
|
|
3317
|
+
render: (l, o) => o.actions && o.actions.length ? o.actions.join(", ") : "-"
|
|
3318
|
+
},
|
|
3319
|
+
{
|
|
3320
|
+
title: "Notify",
|
|
3321
|
+
key: "notify",
|
|
3322
|
+
render: (l, o) => o.notify && o.notify.length ? o.notify.join(", ") : "-"
|
|
3323
|
+
},
|
|
3324
|
+
{
|
|
3325
|
+
title: "Human in loop",
|
|
3326
|
+
key: "humanLoop",
|
|
3327
|
+
render: (l, o) => o.humanLoop ? "Yes" : "No"
|
|
3328
|
+
},
|
|
3329
|
+
{
|
|
3330
|
+
title: "Actions",
|
|
3331
|
+
key: "ops",
|
|
3332
|
+
render: (l, o) => /* @__PURE__ */ n.jsx(de, { type: "text", onClick: () => s(o.id), children: /* @__PURE__ */ n.jsx(zs, {}) })
|
|
3333
|
+
}
|
|
3334
|
+
]
|
|
3335
|
+
}
|
|
3336
|
+
);
|
|
3337
|
+
}
|
|
3338
|
+
const { Title: jn } = Me;
|
|
3339
|
+
function Rn({ userRoles: e, rules: t, rawRules: s }) {
|
|
3340
|
+
const [r, i] = C(!1), [a, l] = C({}), o = ue(() => e.map((m) => ({ label: m.userRoleName, value: m.userRoleId })), [e]), g = ue(
|
|
3341
|
+
() => (t || []).map((m, A) => ({
|
|
3342
|
+
key: m.RuleId || m.Name || String(A),
|
|
3343
|
+
ruleName: m.Name || "-",
|
|
3344
|
+
ruleDesc: m.Description || ""
|
|
3345
|
+
})),
|
|
3346
|
+
[t]
|
|
3347
|
+
), x = ue(() => {
|
|
3348
|
+
if (!Array.isArray(s) || !s.length) return {};
|
|
3349
|
+
const m = {};
|
|
3350
|
+
for (const A of g) {
|
|
3351
|
+
const j = s.find(
|
|
3352
|
+
(P) => P?.ruleId === A.key || P?.ruleName === A.key || P?.RuleId === A.key || P?.ruleName === A.ruleName || // fallback by name
|
|
3353
|
+
P?.Name === A.ruleName
|
|
3354
|
+
), E = Array.isArray(j?.userRoleIds) ? j.userRoleIds : [];
|
|
3355
|
+
E.length && (m[A.key] = E);
|
|
3356
|
+
}
|
|
3357
|
+
return m;
|
|
3358
|
+
}, [s, g]), p = () => {
|
|
3359
|
+
l({});
|
|
3360
|
+
}, T = async () => {
|
|
3361
|
+
try {
|
|
3362
|
+
if (!s || !Array.isArray(s) || Object.keys(a).length === 0) {
|
|
3363
|
+
xe.info("No changes to save");
|
|
3364
|
+
return;
|
|
3365
|
+
}
|
|
3366
|
+
i(!0);
|
|
3367
|
+
const m = Object.entries(a).map(async ([A, j]) => {
|
|
3368
|
+
const E = s.find(
|
|
3369
|
+
(q) => q?.ruleId === A || q?.ruleName === A || q?.RuleId === A
|
|
3370
|
+
), P = typeof E?.recordId == "number" ? E.recordId : void 0;
|
|
3371
|
+
if (!E || typeof P != "number")
|
|
3372
|
+
throw new Error(`Unable to find recordId for rule ${A}`);
|
|
3373
|
+
const W = {
|
|
3374
|
+
...E,
|
|
3375
|
+
ruleId: A,
|
|
3376
|
+
// ensure ruleId matches the selected rule
|
|
3377
|
+
userRoleIds: Array.isArray(j) ? j : [],
|
|
3378
|
+
actions: [
|
|
3379
|
+
{
|
|
3380
|
+
actionTypeId: 4,
|
|
3381
|
+
actionTypeUniqueId: "bc0973d4-9be0-4efb-8545-c9112ba06c1f",
|
|
3382
|
+
name: "Audible Warning",
|
|
3383
|
+
notificationType: "Alarm",
|
|
3384
|
+
category: "Hardware",
|
|
3385
|
+
description: "Test",
|
|
3386
|
+
isSystemDefined: !0,
|
|
3387
|
+
isActive: !0,
|
|
3388
|
+
displayOrder: 0
|
|
3389
|
+
}
|
|
3390
|
+
]
|
|
3391
|
+
};
|
|
3392
|
+
return ms(P, W);
|
|
3393
|
+
});
|
|
3394
|
+
await Promise.all(m), xe.success("Alert assignment saved");
|
|
3395
|
+
} catch (m) {
|
|
3396
|
+
const A = m instanceof Error ? m.message : "Failed to save alert assignment";
|
|
3397
|
+
xe.error(A);
|
|
3398
|
+
} finally {
|
|
3399
|
+
i(!1);
|
|
3400
|
+
}
|
|
3401
|
+
};
|
|
3402
|
+
return /* @__PURE__ */ n.jsxs("div", { className: "w-full", children: [
|
|
3403
|
+
/* @__PURE__ */ n.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ n.jsx(jn, { level: 4, className: "!mb-4", children: "Alert Assignment" }) }),
|
|
3404
|
+
/* @__PURE__ */ n.jsx(
|
|
3405
|
+
ut,
|
|
3406
|
+
{
|
|
3407
|
+
rowKey: "key",
|
|
3408
|
+
dataSource: g,
|
|
3409
|
+
loading: r,
|
|
3410
|
+
pagination: !1,
|
|
3411
|
+
columns: [
|
|
3412
|
+
{ title: "Rule Name", dataIndex: "ruleName", key: "ruleName" },
|
|
3413
|
+
{ title: "Description", dataIndex: "ruleDesc", key: "ruleDesc" },
|
|
3414
|
+
{
|
|
3415
|
+
title: "Assign Team",
|
|
3416
|
+
key: "assign",
|
|
3417
|
+
render: (m, A) => /* @__PURE__ */ n.jsx(
|
|
3418
|
+
le,
|
|
3419
|
+
{
|
|
3420
|
+
mode: "multiple",
|
|
3421
|
+
placeholder: "Dropdown with Multi select",
|
|
3422
|
+
className: "w-full",
|
|
3423
|
+
value: a[A.key] ?? x[A.key] ?? [],
|
|
3424
|
+
onChange: (j) => l((E) => ({ ...E, [A.key]: j })),
|
|
3425
|
+
options: o
|
|
3426
|
+
}
|
|
3427
|
+
)
|
|
3428
|
+
}
|
|
3429
|
+
]
|
|
3430
|
+
}
|
|
3431
|
+
),
|
|
3432
|
+
/* @__PURE__ */ n.jsxs(Z, { className: "mt-4", children: [
|
|
3433
|
+
/* @__PURE__ */ n.jsx(de, { onClick: p, disabled: r, children: "Clear" }),
|
|
3434
|
+
/* @__PURE__ */ n.jsx(de, { type: "primary", onClick: T, loading: r, disabled: r, children: "Save" })
|
|
3435
|
+
] })
|
|
3436
|
+
] });
|
|
3437
|
+
}
|
|
3438
|
+
const Nn = "snl", Jt = "", Le = String(Nn) === "schools" ? ds({ baseUrl: Jt }) : cs({ baseUrl: Jt });
|
|
3439
|
+
async function In(e) {
|
|
3440
|
+
return Le.getAlertNotifications(e);
|
|
3441
|
+
}
|
|
3442
|
+
async function Tn() {
|
|
3443
|
+
return Le.getAdminSettings();
|
|
3444
|
+
}
|
|
3445
|
+
async function En(e) {
|
|
3446
|
+
return Le.setAdminSettings(e);
|
|
3447
|
+
}
|
|
3448
|
+
async function Cn() {
|
|
3449
|
+
return Le.getPreferenceSettings();
|
|
3450
|
+
}
|
|
3451
|
+
async function On(e) {
|
|
3452
|
+
return Le.setPreferenceSettings(e);
|
|
3453
|
+
}
|
|
3454
|
+
var Ge = { exports: {} }, kn = Ge.exports, Vt;
|
|
3455
|
+
function Un() {
|
|
3456
|
+
return Vt || (Vt = 1, (function(e, t) {
|
|
3457
|
+
(function(s, r) {
|
|
3458
|
+
e.exports = r();
|
|
3459
|
+
})(kn, (function() {
|
|
3460
|
+
var s = 1e3, r = 6e4, i = 36e5, a = "millisecond", l = "second", o = "minute", g = "hour", x = "day", p = "week", T = "month", m = "quarter", A = "year", j = "date", E = "Invalid Date", P = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, W = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, q = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(v) {
|
|
3461
|
+
var h = ["th", "st", "nd", "rd"], d = v % 100;
|
|
3462
|
+
return "[" + v + (h[(d - 20) % 10] || h[d] || h[0]) + "]";
|
|
3463
|
+
} }, Y = function(v, h, d) {
|
|
3464
|
+
var S = String(v);
|
|
3465
|
+
return !S || S.length >= h ? v : "" + Array(h + 1 - S.length).join(d) + v;
|
|
3466
|
+
}, J = { s: Y, z: function(v) {
|
|
3467
|
+
var h = -v.utcOffset(), d = Math.abs(h), S = Math.floor(d / 60), y = d % 60;
|
|
3468
|
+
return (h <= 0 ? "+" : "-") + Y(S, 2, "0") + ":" + Y(y, 2, "0");
|
|
3469
|
+
}, m: function v(h, d) {
|
|
3470
|
+
if (h.date() < d.date()) return -v(d, h);
|
|
3471
|
+
var S = 12 * (d.year() - h.year()) + (d.month() - h.month()), y = h.clone().add(S, T), u = d - y < 0, N = h.clone().add(S + (u ? -1 : 1), T);
|
|
3472
|
+
return +(-(S + (d - y) / (u ? y - N : N - y)) || 0);
|
|
3473
|
+
}, a: function(v) {
|
|
3474
|
+
return v < 0 ? Math.ceil(v) || 0 : Math.floor(v);
|
|
3475
|
+
}, p: function(v) {
|
|
3476
|
+
return { M: T, y: A, w: p, d: x, D: j, h: g, m: o, s: l, ms: a, Q: m }[v] || String(v || "").toLowerCase().replace(/s$/, "");
|
|
3477
|
+
}, u: function(v) {
|
|
3478
|
+
return v === void 0;
|
|
3479
|
+
} }, X = "en", V = {};
|
|
3480
|
+
V[X] = q;
|
|
3481
|
+
var w = "$isDayjsObject", I = function(v) {
|
|
3482
|
+
return v instanceof B || !(!v || !v[w]);
|
|
3483
|
+
}, M = function v(h, d, S) {
|
|
3484
|
+
var y;
|
|
3485
|
+
if (!h) return X;
|
|
3486
|
+
if (typeof h == "string") {
|
|
3487
|
+
var u = h.toLowerCase();
|
|
3488
|
+
V[u] && (y = u), d && (V[u] = d, y = u);
|
|
3489
|
+
var N = h.split("-");
|
|
3490
|
+
if (!y && N.length > 1) return v(N[0]);
|
|
3491
|
+
} else {
|
|
3492
|
+
var c = h.name;
|
|
3493
|
+
V[c] = h, y = c;
|
|
3494
|
+
}
|
|
3495
|
+
return !S && y && (X = y), y || !S && X;
|
|
3496
|
+
}, R = function(v, h) {
|
|
3497
|
+
if (I(v)) return v.clone();
|
|
3498
|
+
var d = typeof h == "object" ? h : {};
|
|
3499
|
+
return d.date = v, d.args = arguments, new B(d);
|
|
3500
|
+
}, b = J;
|
|
3501
|
+
b.l = M, b.i = I, b.w = function(v, h) {
|
|
3502
|
+
return R(v, { locale: h.$L, utc: h.$u, x: h.$x, $offset: h.$offset });
|
|
3503
|
+
};
|
|
3504
|
+
var B = (function() {
|
|
3505
|
+
function v(d) {
|
|
3506
|
+
this.$L = M(d.locale, null, !0), this.parse(d), this.$x = this.$x || d.x || {}, this[w] = !0;
|
|
3507
|
+
}
|
|
3508
|
+
var h = v.prototype;
|
|
3509
|
+
return h.parse = function(d) {
|
|
3510
|
+
this.$d = (function(S) {
|
|
3511
|
+
var y = S.date, u = S.utc;
|
|
3512
|
+
if (y === null) return /* @__PURE__ */ new Date(NaN);
|
|
3513
|
+
if (b.u(y)) return /* @__PURE__ */ new Date();
|
|
3514
|
+
if (y instanceof Date) return new Date(y);
|
|
3515
|
+
if (typeof y == "string" && !/Z$/i.test(y)) {
|
|
3516
|
+
var N = y.match(P);
|
|
3517
|
+
if (N) {
|
|
3518
|
+
var c = N[2] - 1 || 0, f = (N[7] || "0").substring(0, 3);
|
|
3519
|
+
return u ? new Date(Date.UTC(N[1], c, N[3] || 1, N[4] || 0, N[5] || 0, N[6] || 0, f)) : new Date(N[1], c, N[3] || 1, N[4] || 0, N[5] || 0, N[6] || 0, f);
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3522
|
+
return new Date(y);
|
|
3523
|
+
})(d), this.init();
|
|
3524
|
+
}, h.init = function() {
|
|
3525
|
+
var d = this.$d;
|
|
3526
|
+
this.$y = d.getFullYear(), this.$M = d.getMonth(), this.$D = d.getDate(), this.$W = d.getDay(), this.$H = d.getHours(), this.$m = d.getMinutes(), this.$s = d.getSeconds(), this.$ms = d.getMilliseconds();
|
|
3527
|
+
}, h.$utils = function() {
|
|
3528
|
+
return b;
|
|
3529
|
+
}, h.isValid = function() {
|
|
3530
|
+
return this.$d.toString() !== E;
|
|
3531
|
+
}, h.isSame = function(d, S) {
|
|
3532
|
+
var y = R(d);
|
|
3533
|
+
return this.startOf(S) <= y && y <= this.endOf(S);
|
|
3534
|
+
}, h.isAfter = function(d, S) {
|
|
3535
|
+
return R(d) < this.startOf(S);
|
|
3536
|
+
}, h.isBefore = function(d, S) {
|
|
3537
|
+
return this.endOf(S) < R(d);
|
|
3538
|
+
}, h.$g = function(d, S, y) {
|
|
3539
|
+
return b.u(d) ? this[S] : this.set(y, d);
|
|
3540
|
+
}, h.unix = function() {
|
|
3541
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
3542
|
+
}, h.valueOf = function() {
|
|
3543
|
+
return this.$d.getTime();
|
|
3544
|
+
}, h.startOf = function(d, S) {
|
|
3545
|
+
var y = this, u = !!b.u(S) || S, N = b.p(d), c = function(te, se) {
|
|
3546
|
+
var G = b.w(y.$u ? Date.UTC(y.$y, se, te) : new Date(y.$y, se, te), y);
|
|
3547
|
+
return u ? G : G.endOf(x);
|
|
3548
|
+
}, f = function(te, se) {
|
|
3549
|
+
return b.w(y.toDate()[te].apply(y.toDate("s"), (u ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(se)), y);
|
|
3550
|
+
}, O = this.$W, k = this.$M, H = this.$D, _ = "set" + (this.$u ? "UTC" : "");
|
|
3551
|
+
switch (N) {
|
|
3552
|
+
case A:
|
|
3553
|
+
return u ? c(1, 0) : c(31, 11);
|
|
3554
|
+
case T:
|
|
3555
|
+
return u ? c(1, k) : c(0, k + 1);
|
|
3556
|
+
case p:
|
|
3557
|
+
var Q = this.$locale().weekStart || 0, oe = (O < Q ? O + 7 : O) - Q;
|
|
3558
|
+
return c(u ? H - oe : H + (6 - oe), k);
|
|
3559
|
+
case x:
|
|
3560
|
+
case j:
|
|
3561
|
+
return f(_ + "Hours", 0);
|
|
3562
|
+
case g:
|
|
3563
|
+
return f(_ + "Minutes", 1);
|
|
3564
|
+
case o:
|
|
3565
|
+
return f(_ + "Seconds", 2);
|
|
3566
|
+
case l:
|
|
3567
|
+
return f(_ + "Milliseconds", 3);
|
|
3568
|
+
default:
|
|
3569
|
+
return this.clone();
|
|
3570
|
+
}
|
|
3571
|
+
}, h.endOf = function(d) {
|
|
3572
|
+
return this.startOf(d, !1);
|
|
3573
|
+
}, h.$set = function(d, S) {
|
|
3574
|
+
var y, u = b.p(d), N = "set" + (this.$u ? "UTC" : ""), c = (y = {}, y[x] = N + "Date", y[j] = N + "Date", y[T] = N + "Month", y[A] = N + "FullYear", y[g] = N + "Hours", y[o] = N + "Minutes", y[l] = N + "Seconds", y[a] = N + "Milliseconds", y)[u], f = u === x ? this.$D + (S - this.$W) : S;
|
|
3575
|
+
if (u === T || u === A) {
|
|
3576
|
+
var O = this.clone().set(j, 1);
|
|
3577
|
+
O.$d[c](f), O.init(), this.$d = O.set(j, Math.min(this.$D, O.daysInMonth())).$d;
|
|
3578
|
+
} else c && this.$d[c](f);
|
|
3579
|
+
return this.init(), this;
|
|
3580
|
+
}, h.set = function(d, S) {
|
|
3581
|
+
return this.clone().$set(d, S);
|
|
3582
|
+
}, h.get = function(d) {
|
|
3583
|
+
return this[b.p(d)]();
|
|
3584
|
+
}, h.add = function(d, S) {
|
|
3585
|
+
var y, u = this;
|
|
3586
|
+
d = Number(d);
|
|
3587
|
+
var N = b.p(S), c = function(k) {
|
|
3588
|
+
var H = R(u);
|
|
3589
|
+
return b.w(H.date(H.date() + Math.round(k * d)), u);
|
|
3590
|
+
};
|
|
3591
|
+
if (N === T) return this.set(T, this.$M + d);
|
|
3592
|
+
if (N === A) return this.set(A, this.$y + d);
|
|
3593
|
+
if (N === x) return c(1);
|
|
3594
|
+
if (N === p) return c(7);
|
|
3595
|
+
var f = (y = {}, y[o] = r, y[g] = i, y[l] = s, y)[N] || 1, O = this.$d.getTime() + d * f;
|
|
3596
|
+
return b.w(O, this);
|
|
3597
|
+
}, h.subtract = function(d, S) {
|
|
3598
|
+
return this.add(-1 * d, S);
|
|
3599
|
+
}, h.format = function(d) {
|
|
3600
|
+
var S = this, y = this.$locale();
|
|
3601
|
+
if (!this.isValid()) return y.invalidDate || E;
|
|
3602
|
+
var u = d || "YYYY-MM-DDTHH:mm:ssZ", N = b.z(this), c = this.$H, f = this.$m, O = this.$M, k = y.weekdays, H = y.months, _ = y.meridiem, Q = function(se, G, he, pe) {
|
|
3603
|
+
return se && (se[G] || se(S, u)) || he[G].slice(0, pe);
|
|
3604
|
+
}, oe = function(se) {
|
|
3605
|
+
return b.s(c % 12 || 12, se, "0");
|
|
3606
|
+
}, te = _ || function(se, G, he) {
|
|
3607
|
+
var pe = se < 12 ? "AM" : "PM";
|
|
3608
|
+
return he ? pe.toLowerCase() : pe;
|
|
3609
|
+
};
|
|
3610
|
+
return u.replace(W, (function(se, G) {
|
|
3611
|
+
return G || (function(he) {
|
|
3612
|
+
switch (he) {
|
|
3613
|
+
case "YY":
|
|
3614
|
+
return String(S.$y).slice(-2);
|
|
3615
|
+
case "YYYY":
|
|
3616
|
+
return b.s(S.$y, 4, "0");
|
|
3617
|
+
case "M":
|
|
3618
|
+
return O + 1;
|
|
3619
|
+
case "MM":
|
|
3620
|
+
return b.s(O + 1, 2, "0");
|
|
3621
|
+
case "MMM":
|
|
3622
|
+
return Q(y.monthsShort, O, H, 3);
|
|
3623
|
+
case "MMMM":
|
|
3624
|
+
return Q(H, O);
|
|
3625
|
+
case "D":
|
|
3626
|
+
return S.$D;
|
|
3627
|
+
case "DD":
|
|
3628
|
+
return b.s(S.$D, 2, "0");
|
|
3629
|
+
case "d":
|
|
3630
|
+
return String(S.$W);
|
|
3631
|
+
case "dd":
|
|
3632
|
+
return Q(y.weekdaysMin, S.$W, k, 2);
|
|
3633
|
+
case "ddd":
|
|
3634
|
+
return Q(y.weekdaysShort, S.$W, k, 3);
|
|
3635
|
+
case "dddd":
|
|
3636
|
+
return k[S.$W];
|
|
3637
|
+
case "H":
|
|
3638
|
+
return String(c);
|
|
3639
|
+
case "HH":
|
|
3640
|
+
return b.s(c, 2, "0");
|
|
3641
|
+
case "h":
|
|
3642
|
+
return oe(1);
|
|
3643
|
+
case "hh":
|
|
3644
|
+
return oe(2);
|
|
3645
|
+
case "a":
|
|
3646
|
+
return te(c, f, !0);
|
|
3647
|
+
case "A":
|
|
3648
|
+
return te(c, f, !1);
|
|
3649
|
+
case "m":
|
|
3650
|
+
return String(f);
|
|
3651
|
+
case "mm":
|
|
3652
|
+
return b.s(f, 2, "0");
|
|
3653
|
+
case "s":
|
|
3654
|
+
return String(S.$s);
|
|
3655
|
+
case "ss":
|
|
3656
|
+
return b.s(S.$s, 2, "0");
|
|
3657
|
+
case "SSS":
|
|
3658
|
+
return b.s(S.$ms, 3, "0");
|
|
3659
|
+
case "Z":
|
|
3660
|
+
return N;
|
|
3661
|
+
}
|
|
3662
|
+
return null;
|
|
3663
|
+
})(se) || N.replace(":", "");
|
|
3664
|
+
}));
|
|
3665
|
+
}, h.utcOffset = function() {
|
|
3666
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
3667
|
+
}, h.diff = function(d, S, y) {
|
|
3668
|
+
var u, N = this, c = b.p(S), f = R(d), O = (f.utcOffset() - this.utcOffset()) * r, k = this - f, H = function() {
|
|
3669
|
+
return b.m(N, f);
|
|
3670
|
+
};
|
|
3671
|
+
switch (c) {
|
|
3672
|
+
case A:
|
|
3673
|
+
u = H() / 12;
|
|
3674
|
+
break;
|
|
3675
|
+
case T:
|
|
3676
|
+
u = H();
|
|
3677
|
+
break;
|
|
3678
|
+
case m:
|
|
3679
|
+
u = H() / 3;
|
|
3680
|
+
break;
|
|
3681
|
+
case p:
|
|
3682
|
+
u = (k - O) / 6048e5;
|
|
3683
|
+
break;
|
|
3684
|
+
case x:
|
|
3685
|
+
u = (k - O) / 864e5;
|
|
3686
|
+
break;
|
|
3687
|
+
case g:
|
|
3688
|
+
u = k / i;
|
|
3689
|
+
break;
|
|
3690
|
+
case o:
|
|
3691
|
+
u = k / r;
|
|
3692
|
+
break;
|
|
3693
|
+
case l:
|
|
3694
|
+
u = k / s;
|
|
3695
|
+
break;
|
|
3696
|
+
default:
|
|
3697
|
+
u = k;
|
|
3698
|
+
}
|
|
3699
|
+
return y ? u : b.a(u);
|
|
3700
|
+
}, h.daysInMonth = function() {
|
|
3701
|
+
return this.endOf(T).$D;
|
|
3702
|
+
}, h.$locale = function() {
|
|
3703
|
+
return V[this.$L];
|
|
3704
|
+
}, h.locale = function(d, S) {
|
|
3705
|
+
if (!d) return this.$L;
|
|
3706
|
+
var y = this.clone(), u = M(d, S, !0);
|
|
3707
|
+
return u && (y.$L = u), y;
|
|
3708
|
+
}, h.clone = function() {
|
|
3709
|
+
return b.w(this.$d, this);
|
|
3710
|
+
}, h.toDate = function() {
|
|
3711
|
+
return new Date(this.valueOf());
|
|
3712
|
+
}, h.toJSON = function() {
|
|
3713
|
+
return this.isValid() ? this.toISOString() : null;
|
|
3714
|
+
}, h.toISOString = function() {
|
|
3715
|
+
return this.$d.toISOString();
|
|
3716
|
+
}, h.toString = function() {
|
|
3717
|
+
return this.$d.toUTCString();
|
|
3718
|
+
}, v;
|
|
3719
|
+
})(), z = B.prototype;
|
|
3720
|
+
return R.prototype = z, [["$ms", a], ["$s", l], ["$m", o], ["$H", g], ["$W", x], ["$M", T], ["$y", A], ["$D", j]].forEach((function(v) {
|
|
3721
|
+
z[v[1]] = function(h) {
|
|
3722
|
+
return this.$g(h, v[0], v[1]);
|
|
3723
|
+
};
|
|
3724
|
+
})), R.extend = function(v, h) {
|
|
3725
|
+
return v.$i || (v(h, B, R), v.$i = !0), R;
|
|
3726
|
+
}, R.locale = M, R.isDayjs = I, R.unix = function(v) {
|
|
3727
|
+
return R(1e3 * v);
|
|
3728
|
+
}, R.en = V[X], R.Ls = V, R.p = {}, R;
|
|
3729
|
+
}));
|
|
3730
|
+
})(Ge)), Ge.exports;
|
|
3731
|
+
}
|
|
3732
|
+
var Pn = Un();
|
|
3733
|
+
const Fn = /* @__PURE__ */ Gs(Pn);
|
|
3734
|
+
function ps(e) {
|
|
3735
|
+
if (!e) return "By Severity";
|
|
3736
|
+
const t = e.trim().toLowerCase();
|
|
3737
|
+
return t.includes("created") ? "By Created Date" : t.includes("updated") || t.includes("modified") ? "By Updated Date" : "By Severity";
|
|
3738
|
+
}
|
|
3739
|
+
function Mn(e) {
|
|
3740
|
+
return e && e.trim().toLowerCase().includes("rule") ? "By Rules" : "By severity";
|
|
3741
|
+
}
|
|
3742
|
+
function Dn(e) {
|
|
3743
|
+
if (!e || typeof e != "string") return { hours: 0, minutes: 0, seconds: 0 };
|
|
3744
|
+
const t = e.split(":").map((a) => parseInt(a, 10)), s = Number.isFinite(t[0]) ? t[0] : 0, r = Number.isFinite(t[1]) ? t[1] : 0, i = Number.isFinite(t[2]) ? t[2] : 0;
|
|
3745
|
+
return { hours: s, minutes: r, seconds: i };
|
|
3746
|
+
}
|
|
3747
|
+
function Kt(e) {
|
|
3748
|
+
const { hours: t, minutes: s, seconds: r } = Dn(e);
|
|
3749
|
+
return Fn().hour(t).minute(s).second(r).millisecond(0);
|
|
3750
|
+
}
|
|
3751
|
+
const { Title: Zt } = Me;
|
|
3752
|
+
function Ln({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: i }) {
|
|
3753
|
+
const [a, l] = C("By Severity"), [o, g] = C("By severity"), [x, p] = C("By Severity"), [T, m] = C("By severity"), [A, j] = C(!1), [E, P] = C(!1), [W, q] = C(null), [Y, J] = C("rules"), [X, V] = C(), [w, I] = C();
|
|
3754
|
+
console.log("usr", s);
|
|
3755
|
+
const [M, R] = C(), [b, B] = C([]), [z, v] = C(), [h, d] = C([]), [S, y] = C(), [u, N] = C([]), [c, f] = C([]), [O, k] = C([]), [H, _] = C(!1), [Q, oe] = C({}), [te, se] = C({}), [G, he] = C(s || []), [pe, Ze] = C([]), [gs, bt] = C(!1), [As, St] = C(!1);
|
|
3756
|
+
me(() => {
|
|
3757
|
+
if (!r || !r.length) return;
|
|
3758
|
+
const U = Object.keys(Q).length > 0 || Object.keys(te).length > 0;
|
|
3759
|
+
if (pe.length && !U) return;
|
|
3760
|
+
const D = r.map((F, L) => {
|
|
3761
|
+
const re = t.find((ge) => ge.RuleId === (F.ruleId || F.ruleName))?.Name || F.ruleName || F.Name || "-", $ = F.escalationSettings || {}, K = typeof $.level1UserRoleId == "number" && $.level1UserRoleId > 0 ? [$.level1UserRoleId] : [], ye = typeof $.level2UserRoleId == "number" && $.level2UserRoleId > 0 ? [$.level2UserRoleId] : [], _e = typeof $.level3UserRoleId == "number" && $.level3UserRoleId > 0 ? [$.level3UserRoleId] : [], jt = (Array.isArray($.escalationSettingsActionTypeIds) ? $.escalationSettingsActionTypeIds : []).map((ge) => Q[ge] || String(ge)), Nt = (Array.isArray($.thirdPartyId) ? $.thirdPartyId : []).map((ge) => te[ge] || String(ge)), $e = typeof $.humanLoop == "boolean" ? $.humanLoop : null;
|
|
3762
|
+
return {
|
|
3763
|
+
id: String(F.ruleId || F.ruleName || L),
|
|
3764
|
+
ruleOrSeverityLabel: re,
|
|
3765
|
+
l1: { minutes: $.level1PostAssistTime ?? void 0, roles: K },
|
|
3766
|
+
l2: { minutes: $.level2PostAssistTime ?? void 0, roles: ye },
|
|
3767
|
+
l3: { minutes: $.level3PostAssistTime ?? void 0, roles: _e },
|
|
3768
|
+
actions: jt,
|
|
3769
|
+
notify: Nt,
|
|
3770
|
+
humanLoop: $e
|
|
3771
|
+
};
|
|
3772
|
+
});
|
|
3773
|
+
Ze(D);
|
|
3774
|
+
}, [r, t, Q, te]);
|
|
3775
|
+
const vs = ue(
|
|
3776
|
+
() => e.map((U) => ({ label: U.DisplayName, value: U.SeverityId })),
|
|
3777
|
+
[e]
|
|
3778
|
+
), xs = ue(
|
|
3779
|
+
() => t.map((U) => ({ label: U.Name, value: U.RuleId })),
|
|
3780
|
+
[t]
|
|
3781
|
+
), bs = ue(
|
|
3782
|
+
() => G.map((U) => ({ label: U.userRoleName, value: U.userRoleId })),
|
|
3783
|
+
[G]
|
|
3784
|
+
), Ss = ue(() => [1, 3, 5, 10, 15, 20, 30, 45, 60].map((U) => ({ label: `${U}`, value: U })), []);
|
|
3785
|
+
me(() => {
|
|
3786
|
+
let U = !1;
|
|
3787
|
+
async function D() {
|
|
3788
|
+
try {
|
|
3789
|
+
P(!0), q(null);
|
|
3790
|
+
const F = await Tn();
|
|
3791
|
+
if (!U && F) {
|
|
3792
|
+
const L = ps(F.sortBy), re = Mn(F.groupBy);
|
|
3793
|
+
l(L), g(re), p(L), m(re), j(!1);
|
|
3794
|
+
}
|
|
3795
|
+
} catch (F) {
|
|
3796
|
+
if (!U) {
|
|
3797
|
+
const L = F instanceof Error ? F.message : "Failed to load admin settings";
|
|
3798
|
+
q(L);
|
|
3799
|
+
}
|
|
3800
|
+
} finally {
|
|
3801
|
+
U || P(!1);
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
return D(), () => {
|
|
3805
|
+
U = !0;
|
|
3806
|
+
};
|
|
3807
|
+
}, []), me(() => {
|
|
3808
|
+
if (!w) return;
|
|
3809
|
+
const D = (r || []).find(
|
|
3810
|
+
(F) => F?.ruleId === w || F?.ruleName === w || F?.RuleId === w
|
|
3811
|
+
)?.escalationSettings;
|
|
3812
|
+
if (D && typeof D == "object") {
|
|
3813
|
+
R(D.level1PostAssistTime ?? void 0), B(D.level1UserRoleId ? [D.level1UserRoleId] : []), v(D.level2PostAssistTime ?? void 0), d(D.level2UserRoleId ? [D.level2UserRoleId] : []), y(D.level3PostAssistTime ?? void 0), N(D.level3UserRoleId ? [D.level3UserRoleId] : []);
|
|
3814
|
+
const F = Array.isArray(D.escalationSettingsActionTypeIds) ? D.escalationSettingsActionTypeIds : [];
|
|
3815
|
+
f(F.map((L) => String(L))), k(Array.isArray(D.thirdPartyId) ? D.thirdPartyId : []), _(!!D.humanLoop);
|
|
3816
|
+
}
|
|
3817
|
+
}, [Y, w, r]);
|
|
3818
|
+
const ws = async () => {
|
|
3819
|
+
try {
|
|
3820
|
+
St(!0);
|
|
3821
|
+
const U = await bn(), F = (Array.isArray(U) ? U : Array.isArray(U?.data) ? U.data : []).map((L, re) => {
|
|
3822
|
+
const $ = t.find((Se) => Se.RuleId === (L.ruleId || L.ruleName))?.Name || L.ruleName || L.Name || "-", K = L.escalationSettings || {}, ye = typeof K.level1UserRoleId == "number" && K.level1UserRoleId > 0 ? [K.level1UserRoleId] : [], _e = typeof K.level2UserRoleId == "number" && K.level2UserRoleId > 0 ? [K.level2UserRoleId] : [], wt = typeof K.level3UserRoleId == "number" && K.level3UserRoleId > 0 ? [K.level3UserRoleId] : [], Rt = (Array.isArray(K.escalationSettingsActionTypeIds) ? K.escalationSettingsActionTypeIds : []).map((Se) => Q[Se] || String(Se)), $e = (Array.isArray(K.thirdPartyId) ? K.thirdPartyId : []).map((Se) => te[Se] || String(Se)), ge = typeof K.humanLoop == "boolean" ? K.humanLoop : null;
|
|
3823
|
+
return {
|
|
3824
|
+
id: String(L.ruleId || L.ruleName || re),
|
|
3825
|
+
ruleOrSeverityLabel: $,
|
|
3826
|
+
l1: { minutes: K.level1PostAssistTime ?? void 0, roles: ye },
|
|
3827
|
+
l2: { minutes: K.level2PostAssistTime ?? void 0, roles: _e },
|
|
3828
|
+
l3: { minutes: K.level3PostAssistTime ?? void 0, roles: wt },
|
|
3829
|
+
actions: Rt,
|
|
3830
|
+
notify: $e,
|
|
3831
|
+
humanLoop: ge
|
|
3832
|
+
};
|
|
3833
|
+
});
|
|
3834
|
+
Ze(F);
|
|
3835
|
+
} catch (U) {
|
|
3836
|
+
console.error("Failed to refetch entries", U);
|
|
3837
|
+
} finally {
|
|
3838
|
+
St(!1);
|
|
3839
|
+
}
|
|
3840
|
+
};
|
|
3841
|
+
me(() => {
|
|
3842
|
+
let U = !1;
|
|
3843
|
+
return (async () => {
|
|
3844
|
+
try {
|
|
3845
|
+
const D = await xt();
|
|
3846
|
+
if (U || !D) return;
|
|
3847
|
+
const F = {};
|
|
3848
|
+
if (Array.isArray(D.thirdParties))
|
|
3849
|
+
for (const re of D.thirdParties)
|
|
3850
|
+
typeof re.thirdPartyId == "number" && (F[re.thirdPartyId] = re.thirdPartyName);
|
|
3851
|
+
se(F);
|
|
3852
|
+
const L = Array.isArray(D.userRoles) ? D.userRoles.map((re) => ({
|
|
3853
|
+
userRoleId: re.userRoleId ?? re.id,
|
|
3854
|
+
userRoleName: re.userRoleName ?? re.name
|
|
3855
|
+
})) : [];
|
|
3856
|
+
U || he(L.length ? L : s || []);
|
|
3857
|
+
} catch {
|
|
3858
|
+
}
|
|
3859
|
+
})(), () => {
|
|
3860
|
+
U = !0;
|
|
3861
|
+
};
|
|
3862
|
+
}, []);
|
|
3863
|
+
const js = async () => {
|
|
3864
|
+
try {
|
|
3865
|
+
const U = await En({ sortBy: a, groupBy: o });
|
|
3866
|
+
console.log("resp", U), U?.responseStatus && U?.data && xe.success(U.data), p(a), m(o), j(!1);
|
|
3867
|
+
} catch {
|
|
3868
|
+
}
|
|
3869
|
+
}, Rs = () => {
|
|
3870
|
+
l(x), g(T), j(!1);
|
|
3871
|
+
}, Ns = async () => {
|
|
3872
|
+
bt(!0), i?.({
|
|
3873
|
+
ruleId: w,
|
|
3874
|
+
levels: [
|
|
3875
|
+
{ minutes: M, roles: b },
|
|
3876
|
+
{ minutes: z, roles: h },
|
|
3877
|
+
{ minutes: S, roles: u }
|
|
3878
|
+
],
|
|
3879
|
+
actions: c,
|
|
3880
|
+
thirdPartyIds: O,
|
|
3881
|
+
humanLoop: H
|
|
3882
|
+
});
|
|
3883
|
+
try {
|
|
3884
|
+
if (w) {
|
|
3885
|
+
const F = Array.isArray(c) ? c.map((ye) => Number(ye)) : [], L = (r || []).find(
|
|
3886
|
+
(ye) => ye?.ruleId === w || ye?.ruleName === w || ye?.RuleId === w
|
|
3887
|
+
), re = typeof L?.recordId == "number" ? L.recordId : void 0;
|
|
3888
|
+
if (!L || typeof re != "number") {
|
|
3889
|
+
xe.error("Unable to find rule recordId for update");
|
|
3890
|
+
return;
|
|
3891
|
+
}
|
|
3892
|
+
const $ = {
|
|
3893
|
+
...L,
|
|
3894
|
+
actions: [
|
|
3895
|
+
//this will definitely be remoed
|
|
3896
|
+
{
|
|
3897
|
+
actionTypeId: 4,
|
|
3898
|
+
actionTypeUniqueId: "bc0973d4-9be0-4efb-8545-c9112ba06c1f",
|
|
3899
|
+
name: "Audible Warning",
|
|
3900
|
+
notificationType: "Alarm",
|
|
3901
|
+
category: "Hardware",
|
|
3902
|
+
description: "Test",
|
|
3903
|
+
isSystemDefined: !0,
|
|
3904
|
+
isActive: !0,
|
|
3905
|
+
displayOrder: 0
|
|
3906
|
+
}
|
|
3907
|
+
],
|
|
3908
|
+
escalationSettings: {
|
|
3909
|
+
level1UserRoleId: Array.isArray(b) && b.length ? b[0] : 0,
|
|
3910
|
+
level1PostAssistTime: M ?? 0,
|
|
3911
|
+
level2UserRoleId: Array.isArray(h) && h.length ? h[0] : 0,
|
|
3912
|
+
level2PostAssistTime: z ?? 0,
|
|
3913
|
+
level3UserRoleId: Array.isArray(u) && u.length ? u[0] : 0,
|
|
3914
|
+
level3PostAssistTime: S ?? 0,
|
|
3915
|
+
escalationSettingsActionTypeIds: F,
|
|
3916
|
+
thirdPartyId: Array.isArray(O) ? O : [],
|
|
3917
|
+
humanLoop: H
|
|
3918
|
+
}
|
|
3919
|
+
}, K = await ms(re, $);
|
|
3920
|
+
if (K?.responseStatus || K?.ok || K) {
|
|
3921
|
+
xe.success("Escalation settings saved"), await ws(), I(void 0), R(void 0), B([]), v(void 0), d([]), y(void 0), N([]), f([]), k([]), _(!1);
|
|
3922
|
+
return;
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
} catch (F) {
|
|
3926
|
+
console.error(F);
|
|
3927
|
+
} finally {
|
|
3928
|
+
bt(!1);
|
|
3929
|
+
}
|
|
3930
|
+
const D = t.find((F) => F.RuleId === w)?.Name || "-";
|
|
3931
|
+
Ze((F) => [
|
|
3932
|
+
...F,
|
|
3933
|
+
{
|
|
3934
|
+
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
3935
|
+
ruleOrSeverityLabel: D,
|
|
3936
|
+
l1: { minutes: M, roles: b },
|
|
3937
|
+
l2: { minutes: z, roles: h },
|
|
3938
|
+
l3: { minutes: S, roles: u },
|
|
3939
|
+
actions: (Array.isArray(c) ? c : []).map((L) => {
|
|
3940
|
+
const re = Number(L);
|
|
3941
|
+
return Q[re] || String(L);
|
|
3942
|
+
}),
|
|
3943
|
+
notify: (Array.isArray(O) ? O : []).map((L) => te[L] || String(L)),
|
|
3944
|
+
humanLoop: !!H
|
|
3945
|
+
}
|
|
3946
|
+
]);
|
|
3947
|
+
}, Is = () => {
|
|
3948
|
+
l("By Severity"), g("By severity"), J("rules"), V(void 0), I(void 0), R(void 0), B([]), v(void 0), d([]), y(void 0), N([]), f([]), k([]), _(!1);
|
|
3949
|
+
};
|
|
3950
|
+
return /* @__PURE__ */ n.jsxs("div", { className: "w-full", children: [
|
|
3951
|
+
/* @__PURE__ */ n.jsxs("div", { className: "mb-6", children: [
|
|
3952
|
+
/* @__PURE__ */ n.jsx(Zt, { level: 4, className: "!mb-2", children: "Admin Settings" }),
|
|
3953
|
+
/* @__PURE__ */ n.jsxs(dt, { spinning: E, children: [
|
|
3954
|
+
W ? /* @__PURE__ */ n.jsxs("div", { className: "text-sm text-red-600 mb-2", children: [
|
|
3955
|
+
"Failed to load settings: ",
|
|
3956
|
+
W
|
|
3957
|
+
] }) : null,
|
|
3958
|
+
/* @__PURE__ */ n.jsx(
|
|
3959
|
+
vn,
|
|
3960
|
+
{
|
|
3961
|
+
sortBy: a,
|
|
3962
|
+
groupBy: o,
|
|
3963
|
+
onChange: (U) => {
|
|
3964
|
+
U.sortBy && (l(U.sortBy), j(!0)), U.groupBy && (g(U.groupBy), j(!0));
|
|
3965
|
+
},
|
|
3966
|
+
showActions: A,
|
|
3967
|
+
onSave: js,
|
|
3968
|
+
onClear: Rs
|
|
3969
|
+
}
|
|
3970
|
+
)
|
|
3971
|
+
] })
|
|
3972
|
+
] }),
|
|
3973
|
+
/* @__PURE__ */ n.jsx(Pe, { className: "my-6" }),
|
|
3974
|
+
/* @__PURE__ */ n.jsxs("div", { children: [
|
|
3975
|
+
/* @__PURE__ */ n.jsx(Zt, { level: 4, className: "!mb-4", children: "Escalation Settings" }),
|
|
3976
|
+
/* @__PURE__ */ n.jsx(
|
|
3977
|
+
Sn,
|
|
3978
|
+
{
|
|
3979
|
+
escBasis: Y,
|
|
3980
|
+
setEscBasis: J,
|
|
3981
|
+
selectedSeverity: X,
|
|
3982
|
+
setSelectedSeverity: V,
|
|
3983
|
+
selectedRule: w,
|
|
3984
|
+
setSelectedRule: I,
|
|
3985
|
+
severityOptions: vs,
|
|
3986
|
+
ruleOptions: xs,
|
|
3987
|
+
minsOptions: Ss,
|
|
3988
|
+
roleOptions: bs,
|
|
3989
|
+
l1mins: M,
|
|
3990
|
+
setL1mins: R,
|
|
3991
|
+
l1roles: b,
|
|
3992
|
+
setL1roles: B,
|
|
3993
|
+
l2mins: z,
|
|
3994
|
+
setL2mins: v,
|
|
3995
|
+
l2roles: h,
|
|
3996
|
+
setL2roles: d,
|
|
3997
|
+
l3mins: S,
|
|
3998
|
+
setL3mins: y,
|
|
3999
|
+
l3roles: u,
|
|
4000
|
+
setL3roles: N,
|
|
4001
|
+
actions: c,
|
|
4002
|
+
setActions: f,
|
|
4003
|
+
thirdPartyIds: O,
|
|
4004
|
+
setThirdPartyIds: k,
|
|
4005
|
+
humanLoop: H,
|
|
4006
|
+
setHumanLoop: _,
|
|
4007
|
+
onClear: Is,
|
|
4008
|
+
onSave: Ns,
|
|
4009
|
+
saving: gs,
|
|
4010
|
+
onActionTypesLoaded: (U) => {
|
|
4011
|
+
const D = {};
|
|
4012
|
+
for (const F of U)
|
|
4013
|
+
typeof F.actionTypeId == "number" && (D[F.actionTypeId] = F.name);
|
|
4014
|
+
oe(D);
|
|
4015
|
+
}
|
|
4016
|
+
}
|
|
4017
|
+
)
|
|
4018
|
+
] }),
|
|
4019
|
+
/* @__PURE__ */ n.jsx(Pe, { className: "my-6" }),
|
|
4020
|
+
/* @__PURE__ */ n.jsx(
|
|
4021
|
+
wn,
|
|
4022
|
+
{
|
|
4023
|
+
entries: pe,
|
|
4024
|
+
userRoles: G,
|
|
4025
|
+
loading: As,
|
|
4026
|
+
onEdit: (U) => {
|
|
4027
|
+
J("rules");
|
|
4028
|
+
const D = pe.find((L) => L.id === U), F = t.find((L) => L.RuleId === U) || (D ? t.find((L) => L.Name === D.ruleOrSeverityLabel) : void 0);
|
|
4029
|
+
I(F ? F.RuleId : U);
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
4032
|
+
),
|
|
4033
|
+
/* @__PURE__ */ n.jsx(Pe, { className: "my-6" }),
|
|
4034
|
+
/* @__PURE__ */ n.jsx(Rn, { userRoles: G, rules: t, rawRules: r }),
|
|
4035
|
+
/* @__PURE__ */ n.jsx(Pe, {})
|
|
4036
|
+
] });
|
|
4037
|
+
}
|
|
4038
|
+
const { Title: _t, Text: He } = Me;
|
|
4039
|
+
function Bn({ severities: e, rules: t, onSave: s, onCancel: r }) {
|
|
4040
|
+
const i = [
|
|
4041
|
+
{ label: "By Severity", value: "By Severity" },
|
|
4042
|
+
{ label: "By Created Date", value: "By Created Date" }
|
|
4043
|
+
], [a, l] = C("By Severity"), [o, g] = C(/* @__PURE__ */ new Set()), [x, p] = C(null), [T, m] = C(null), [A, j] = C({ inApp: !1, sms: !1, email: !1, walkie: !1 }), [E, P] = C([]), [W, q] = C(!0), [Y, J] = C(!1);
|
|
4044
|
+
me(() => {
|
|
4045
|
+
let w = !1;
|
|
4046
|
+
return (async () => {
|
|
4047
|
+
try {
|
|
4048
|
+
const I = await Cn();
|
|
4049
|
+
if (w || !I) return;
|
|
4050
|
+
j({
|
|
4051
|
+
inApp: !!I.inApp,
|
|
4052
|
+
//convert to bool - as the resp is str
|
|
4053
|
+
sms: !!I.sms,
|
|
4054
|
+
email: !!I.email,
|
|
4055
|
+
walkie: !!I.walkieIntegration
|
|
4056
|
+
});
|
|
4057
|
+
const M = ps(I.sortBy);
|
|
4058
|
+
l(M === "By Created Date" ? "By Created Date" : "By Severity"), p(Kt(I.doNotDisturbStart)), m(Kt(I.doNotDisturbEnd)), Array.isArray(I.anomalyIds) && g(new Set(I.anomalyIds.map((R) => String(R))));
|
|
4059
|
+
} catch (I) {
|
|
4060
|
+
console.error("Error in loading my preferences: ", I);
|
|
4061
|
+
}
|
|
4062
|
+
})(), () => {
|
|
4063
|
+
w = !0;
|
|
4064
|
+
};
|
|
4065
|
+
}, []), me(() => {
|
|
4066
|
+
let w = !1;
|
|
4067
|
+
return (async () => {
|
|
4068
|
+
try {
|
|
4069
|
+
q(!0);
|
|
4070
|
+
const I = await xt();
|
|
4071
|
+
if (w || !I) return;
|
|
4072
|
+
const M = Array.isArray(I.anomalies) ? I.anomalies : [];
|
|
4073
|
+
P(M);
|
|
4074
|
+
} catch (I) {
|
|
4075
|
+
console.error("Failed to load anomalies lookups", I);
|
|
4076
|
+
} finally {
|
|
4077
|
+
w || q(!1);
|
|
4078
|
+
}
|
|
4079
|
+
})(), () => {
|
|
4080
|
+
w = !0;
|
|
4081
|
+
};
|
|
4082
|
+
}, []);
|
|
4083
|
+
const X = (w) => {
|
|
4084
|
+
g((I) => {
|
|
4085
|
+
const M = new Set(I);
|
|
4086
|
+
return M.has(w) ? M.delete(w) : M.add(w), M;
|
|
4087
|
+
});
|
|
4088
|
+
}, V = async () => {
|
|
4089
|
+
s?.({
|
|
4090
|
+
sortBy: a,
|
|
4091
|
+
subscribedRuleIds: Array.from(o),
|
|
4092
|
+
dnd: {
|
|
4093
|
+
from: x,
|
|
4094
|
+
to: T
|
|
4095
|
+
},
|
|
4096
|
+
channels: A
|
|
4097
|
+
});
|
|
4098
|
+
try {
|
|
4099
|
+
J(!0);
|
|
4100
|
+
const w = x ? x.format?.("HH:mm:ss") ?? "00:00:00" : "00:00:00", I = T ? T.format?.("HH:mm:ss") ?? "00:00:00" : "00:00:00", M = Array.from(o).map((b) => Number(b)).filter((b) => Number.isFinite(b)), R = await On({
|
|
4101
|
+
anomalyIds: M,
|
|
4102
|
+
doNotDisturbStart: w,
|
|
4103
|
+
doNotDisturbEnd: I,
|
|
4104
|
+
inApp: !!A.inApp,
|
|
4105
|
+
sms: !!A.sms,
|
|
4106
|
+
email: !!A.email,
|
|
4107
|
+
walkieIntegration: !!A.walkie,
|
|
4108
|
+
sortBy: a
|
|
4109
|
+
});
|
|
4110
|
+
R?.responseStatus && Ms.success(R?.data || "Preferences updated successfully.");
|
|
4111
|
+
} catch (w) {
|
|
4112
|
+
console.error("Error in saving my preferences: ", w);
|
|
4113
|
+
} finally {
|
|
4114
|
+
J(!1);
|
|
4115
|
+
}
|
|
4116
|
+
};
|
|
4117
|
+
return /* @__PURE__ */ n.jsxs("div", { className: "w-full", children: [
|
|
4118
|
+
/* @__PURE__ */ n.jsx(Ee, { gutter: [16, 16], align: "middle", className: "mb-4", children: /* @__PURE__ */ n.jsx(ee, { xs: 24, md: 8, children: /* @__PURE__ */ n.jsxs(Z, { direction: "horizontal", size: 12, className: "w-full items-center", children: [
|
|
4119
|
+
/* @__PURE__ */ n.jsx(He, { className: "text-gray-600", children: "Sort By:" }),
|
|
4120
|
+
/* @__PURE__ */ n.jsx(le, { className: "w-[240px]", value: a, options: i, onChange: l })
|
|
4121
|
+
] }) }) }),
|
|
4122
|
+
/* @__PURE__ */ n.jsxs("div", { className: "mb-4", children: [
|
|
4123
|
+
/* @__PURE__ */ n.jsx(_t, { level: 5, className: "!mb-2", children: "Anomalies" }),
|
|
4124
|
+
W ? /* @__PURE__ */ n.jsx("div", { className: "py-4", children: /* @__PURE__ */ n.jsx(dt, {}) }) : /* @__PURE__ */ n.jsx(Z, { direction: "vertical", size: 10, className: "w-full", children: (Array.isArray(E) ? E : []).map((w) => {
|
|
4125
|
+
const I = String(w.recordId), M = w.anomalyName;
|
|
4126
|
+
return /* @__PURE__ */ n.jsx(Te, { checked: o.has(I), onChange: () => X(I), children: M }, I);
|
|
4127
|
+
}) })
|
|
4128
|
+
] }),
|
|
4129
|
+
/* @__PURE__ */ n.jsxs("div", { className: "mb-4", children: [
|
|
4130
|
+
/* @__PURE__ */ n.jsx(_t, { level: 5, className: "!mb-2", children: "Notification Timing & Channels" }),
|
|
4131
|
+
/* @__PURE__ */ n.jsx(Ee, { gutter: [16, 16], align: "middle", className: "mb-3", children: /* @__PURE__ */ n.jsx(ee, { xs: 24, md: 12, children: /* @__PURE__ */ n.jsxs(Z, { direction: "horizontal", size: 12, className: "w-full items-center", children: [
|
|
4132
|
+
/* @__PURE__ */ n.jsx(He, { children: "Do Not Disturb mode:" }),
|
|
4133
|
+
/* @__PURE__ */ n.jsxs(Z, { size: 12, className: "w-full", children: [
|
|
4134
|
+
/* @__PURE__ */ n.jsxs(Z, { direction: "horizontal", size: 8, className: "items-center", children: [
|
|
4135
|
+
/* @__PURE__ */ n.jsx(He, { children: "From" }),
|
|
4136
|
+
/* @__PURE__ */ n.jsx(It, { value: x, onChange: (w) => p(w), format: "HH:mm" })
|
|
4137
|
+
] }),
|
|
4138
|
+
/* @__PURE__ */ n.jsxs(Z, { direction: "horizontal", size: 8, className: "items-center", children: [
|
|
4139
|
+
/* @__PURE__ */ n.jsx(He, { children: "To" }),
|
|
4140
|
+
/* @__PURE__ */ n.jsx(It, { value: T, onChange: (w) => m(w), format: "HH:mm" })
|
|
4141
|
+
] })
|
|
4142
|
+
] })
|
|
4143
|
+
] }) }) }),
|
|
4144
|
+
/* @__PURE__ */ n.jsxs(Ee, { gutter: [24, 12], children: [
|
|
4145
|
+
/* @__PURE__ */ n.jsx(ee, { children: /* @__PURE__ */ n.jsx(Te, { checked: A.inApp, onChange: (w) => j({ ...A, inApp: w.target.checked }), children: "In-app" }) }),
|
|
4146
|
+
/* @__PURE__ */ n.jsx(ee, { children: /* @__PURE__ */ n.jsx(Te, { checked: A.sms, onChange: (w) => j({ ...A, sms: w.target.checked }), children: "SMS" }) }),
|
|
4147
|
+
/* @__PURE__ */ n.jsx(ee, { children: /* @__PURE__ */ n.jsx(Te, { checked: A.email, onChange: (w) => j({ ...A, email: w.target.checked }), children: "Email" }) }),
|
|
4148
|
+
/* @__PURE__ */ n.jsx(ee, { children: /* @__PURE__ */ n.jsx(Te, { checked: A.walkie, onChange: (w) => j({ ...A, walkie: w.target.checked }), children: "Walkie system integration" }) })
|
|
4149
|
+
] })
|
|
4150
|
+
] }),
|
|
4151
|
+
/* @__PURE__ */ n.jsx(Pe, {}),
|
|
4152
|
+
/* @__PURE__ */ n.jsxs(Z, { className: "gap-3", children: [
|
|
4153
|
+
/* @__PURE__ */ n.jsx(de, { onClick: r, disabled: Y, children: "Cancel" }),
|
|
4154
|
+
/* @__PURE__ */ n.jsx(de, { type: "primary", onClick: V, loading: Y, children: "Save" })
|
|
4155
|
+
] })
|
|
4156
|
+
] });
|
|
4157
|
+
}
|
|
4158
|
+
function Qn({ severities: e, rules: t, userRoles: s, rawRules: r }) {
|
|
4159
|
+
const [i, a] = C("global");
|
|
4160
|
+
return /* @__PURE__ */ n.jsxs("div", { className: "w-full", children: [
|
|
4161
|
+
/* @__PURE__ */ n.jsxs("div", { className: "inline-flex rounded-xl overflow-hidden border border-gray-200 mb-4", children: [
|
|
4162
|
+
/* @__PURE__ */ n.jsx(
|
|
4163
|
+
"button",
|
|
4164
|
+
{
|
|
4165
|
+
onClick: () => a("global"),
|
|
4166
|
+
className: `px-5 py-2 text-base font-medium outline-none ${i === "global" ? " bg-black text-white" : " bg-white text-black"}`,
|
|
4167
|
+
style: { border: "0" },
|
|
4168
|
+
children: "Global Settings"
|
|
4169
|
+
}
|
|
4170
|
+
),
|
|
4171
|
+
/* @__PURE__ */ n.jsx(
|
|
4172
|
+
"button",
|
|
4173
|
+
{
|
|
4174
|
+
onClick: () => a("prefs"),
|
|
4175
|
+
className: `px-5 py-2 text-base font-medium outline-none ${i === "prefs" ? "bg-black text-white" : "bg-white"}`,
|
|
4176
|
+
children: "My Preferences"
|
|
4177
|
+
}
|
|
4178
|
+
)
|
|
4179
|
+
] }),
|
|
4180
|
+
i === "global" ? /* @__PURE__ */ n.jsx(Ln, { severities: e, rules: t, userRoles: s, rawRules: r }) : /* @__PURE__ */ n.jsx(Bn, { severities: e, rules: t })
|
|
4181
|
+
] });
|
|
4182
|
+
}
|
|
4183
|
+
const qn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIZSURBVHgBnZW/b9NAFMe/z3H6i1ZNJUBFQsL/QQkLCFBtRhhKF1ibhBmpXbtgFlYqsTG0gRGWwgAjMb8EYmjYGN0pCCrVVaX+SBxf37PiqHWcOu5Xsux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7iJawcTiCkMMIUlj7Jo8zr6Yv/EfRXXIqRnzUxnP9u46Id8Q5Sslq3+pqWErHAPKqvxROC/ZMuJwKJ8bkPouUkrYUqgt5IgMDKAxfAYT8nAZnmR2A5J47YSjrFKyOYpZN2SiIJ8YjRqVfASyAFVg9s2F2gXwRsClMXdnYcFpq5PyiQ8KEilaywc79+aEow2i7fdCF46SIpuTvCGi2kWSXjCM4QqS4Zl3yjwQ0UySwrBfGRJNjQKW4ZrmEpL45CxUDTGWdgmoZgxOoDA6zxYgr7ZudhWk3x6Sp4kl0nZmgujQhcH5Cvqy/Hxi5hdL+dgsWxR2rma4FkLeDw+PMM243+t2YB0jDDI9nMBquyWqI3tjmLYguQfqDzxebty/DIcnePr9jfePVfDhSzv2/Hs8LAY3kMmFfTCl+rl3uu1GWF6Jx+X3vkpa+58jeeNyXvY3Pd8N+a0hvgK9ge3hMTmG5CPTnSICWcFpXaDfZUcAck99yOnZM/id3hcmAFV/hgEilU6p0TcH2gpZYS98xc/kXUJ8YImPFzfeLh0cgXbMp8n/yD3ySPZSK0MWKAAAAAElFTkSuQmCC";
|
|
4184
|
+
function zn(e) {
|
|
4185
|
+
const t = (e.status || "").toLowerCase() === "completed" ? /* @__PURE__ */ n.jsx("img", { src: qn, alt: "completed", style: { width: 20, height: 20 } }) : /* @__PURE__ */ n.jsx("img", { src: Wn, alt: "pending", style: { width: 20, height: 20 } });
|
|
4186
|
+
return {
|
|
4187
|
+
title: /* @__PURE__ */ n.jsxs("div", { className: "flex flex-col gap-0 min-w-0", children: [
|
|
4188
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-col", children: [
|
|
4189
|
+
/* @__PURE__ */ n.jsx("span", { className: "block text-sm break-words mb-1 overflow-visible whitespace-normal", children: /* @__PURE__ */ n.jsx("b", { children: e.title }) }),
|
|
4190
|
+
e.description ? /* @__PURE__ */ n.jsx("span", { className: "text-gray-500 text-xs", children: e.description }) : null
|
|
4191
|
+
] }),
|
|
4192
|
+
e.timestamp ? /* @__PURE__ */ n.jsx("span", { className: "text-gray-500 text-xs", children: e.timestamp }) : null
|
|
4193
|
+
] }),
|
|
4194
|
+
icon: t,
|
|
4195
|
+
description: null
|
|
4196
|
+
};
|
|
4197
|
+
}
|
|
4198
|
+
function Hn({ data: e }) {
|
|
4199
|
+
return /* @__PURE__ */ n.jsx("div", { className: "w-full", children: /* @__PURE__ */ n.jsx(
|
|
4200
|
+
ht,
|
|
4201
|
+
{
|
|
4202
|
+
type: "card",
|
|
4203
|
+
items: [
|
|
4204
|
+
{
|
|
4205
|
+
key: "action",
|
|
4206
|
+
label: "Action Taken",
|
|
4207
|
+
children: /* @__PURE__ */ n.jsxs("div", { className: "w-full", children: [
|
|
4208
|
+
/* @__PURE__ */ n.jsx(et, { className: "mb-4 rounded-md", bordered: !0, children: /* @__PURE__ */ n.jsxs("div", { className: "grid grid-cols-4 gap-6 text-xs", children: [
|
|
4209
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
4210
|
+
/* @__PURE__ */ n.jsx("span", { className: "text-gray-500", children: "Alert ID" }),
|
|
4211
|
+
/* @__PURE__ */ n.jsx("span", { className: "text-black", children: e.summary.alertId })
|
|
4212
|
+
] }),
|
|
4213
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
4214
|
+
/* @__PURE__ */ n.jsx("span", { className: "text-gray-500", children: "Incident ID" }),
|
|
4215
|
+
/* @__PURE__ */ n.jsx("span", { className: "text-black", children: e.summary.incidentId })
|
|
4216
|
+
] }),
|
|
4217
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
4218
|
+
/* @__PURE__ */ n.jsx("span", { className: "text-gray-500", children: "Severity" }),
|
|
4219
|
+
/* @__PURE__ */ n.jsx("span", { className: "text-black", children: e.summary.severity })
|
|
4220
|
+
] }),
|
|
4221
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
4222
|
+
/* @__PURE__ */ n.jsx("span", { className: "text-gray-500", children: "Location" }),
|
|
4223
|
+
/* @__PURE__ */ n.jsx("span", { className: "text-black", children: e.summary.location })
|
|
4224
|
+
] })
|
|
4225
|
+
] }) }),
|
|
4226
|
+
/* @__PURE__ */ n.jsxs(et, { className: "rounded-md", bordered: !0, children: [
|
|
4227
|
+
/* @__PURE__ */ n.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ n.jsx("h4", { className: "text-sm text-black font-medium", children: "Response Timeline/ Audit trail/log" }) }),
|
|
4228
|
+
/* @__PURE__ */ n.jsx("div", { className: "mt-2", children: /* @__PURE__ */ n.jsx(
|
|
4229
|
+
Ds,
|
|
4230
|
+
{
|
|
4231
|
+
direction: "vertical",
|
|
4232
|
+
size: "small",
|
|
4233
|
+
current: 1,
|
|
4234
|
+
items: (e.timeline || []).map(zn)
|
|
4235
|
+
}
|
|
4236
|
+
) })
|
|
4237
|
+
] })
|
|
4238
|
+
] })
|
|
4239
|
+
},
|
|
4240
|
+
{
|
|
4241
|
+
key: "notification",
|
|
4242
|
+
label: "Notification Sent",
|
|
4243
|
+
children: /* @__PURE__ */ n.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
4244
|
+
(e.notifications || []).map((t, s) => /* @__PURE__ */ n.jsxs(et, { className: "rounded-md", bordered: !0, children: [
|
|
4245
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex items-start justify-between", children: [
|
|
4246
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-col", children: [
|
|
4247
|
+
/* @__PURE__ */ n.jsx("h4", { className: "text-sm text-black font-medium", children: t.channelLabel }),
|
|
4248
|
+
/* @__PURE__ */ n.jsx("span", { className: "text-xs text-gray-500 mt-1", children: t.sentAt })
|
|
4249
|
+
] }),
|
|
4250
|
+
/* @__PURE__ */ n.jsxs("span", { className: "text-[11px] px-2 py-1 rounded-full bg-green-50 text-green-700 border border-green-200", children: [
|
|
4251
|
+
t.delivered,
|
|
4252
|
+
"/",
|
|
4253
|
+
t.total,
|
|
4254
|
+
" Delivered"
|
|
4255
|
+
] })
|
|
4256
|
+
] }),
|
|
4257
|
+
/* @__PURE__ */ n.jsxs("div", { className: "mt-4 text-xs", children: [
|
|
4258
|
+
/* @__PURE__ */ n.jsxs("div", { className: "text-black", children: [
|
|
4259
|
+
" ",
|
|
4260
|
+
t.messageTitle
|
|
4261
|
+
] }),
|
|
4262
|
+
t.messageBody ? /* @__PURE__ */ n.jsx("div", { className: "text-gray-600", children: t.messageBody }) : null
|
|
4263
|
+
] }),
|
|
4264
|
+
/* @__PURE__ */ n.jsxs("div", { className: "mt-4", children: [
|
|
4265
|
+
/* @__PURE__ */ n.jsxs("div", { className: "text-xs text-black font-medium", children: [
|
|
4266
|
+
"Recipients (",
|
|
4267
|
+
t.total,
|
|
4268
|
+
")"
|
|
4269
|
+
] }),
|
|
4270
|
+
/* @__PURE__ */ n.jsx("div", { className: "mt-2 flex flex-col gap-3 text-xs", children: (t.recipients || []).map((r, i) => /* @__PURE__ */ n.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
4271
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-col", children: [
|
|
4272
|
+
/* @__PURE__ */ n.jsx("span", { className: "text-black", children: r.name }),
|
|
4273
|
+
/* @__PURE__ */ n.jsxs("span", { className: "text-gray-500", children: [
|
|
4274
|
+
r.role,
|
|
4275
|
+
" . ",
|
|
4276
|
+
r.phone
|
|
4277
|
+
] })
|
|
4278
|
+
] }),
|
|
4279
|
+
/* @__PURE__ */ n.jsx("span", { className: `text-[11px] px-3 py-[2px] rounded ${r.status === "Delivered" ? "bg-green-50 text-green-700 border border-green-200" : "bg-red-50 text-red-700 border border-red-200"}`, children: r.status })
|
|
4280
|
+
] }, i)) })
|
|
4281
|
+
] })
|
|
4282
|
+
] }, s)),
|
|
4283
|
+
e.notifications?.length ? null : /* @__PURE__ */ n.jsx("span", { className: "text-gray-500 text-xs", children: "No notifications." })
|
|
4284
|
+
] })
|
|
4285
|
+
}
|
|
4286
|
+
// {
|
|
4287
|
+
// key: "rapidsos",
|
|
4288
|
+
// label: "RapidSOS",
|
|
4289
|
+
// children: (
|
|
4290
|
+
// <Card className="rounded-md" bordered>
|
|
4291
|
+
// <div className="flex flex-col gap-2 text-xs">
|
|
4292
|
+
// {(data.rapidSOS || []).map((r, idx) => (
|
|
4293
|
+
// <div key={idx} className="flex justify-between gap-2 border-b border-gray-100 pb-2">
|
|
4294
|
+
// <span className="text-black">{r.event}</span>
|
|
4295
|
+
// <span className="text-gray-500">{r.details || ''}</span>
|
|
4296
|
+
// <span className="text-gray-500">{r.timestamp}</span>
|
|
4297
|
+
// </div>
|
|
4298
|
+
// ))}
|
|
4299
|
+
// {!data.rapidSOS?.length ? <span className="text-gray-500">No RapidSOS records.</span> : null}
|
|
4300
|
+
// </div>
|
|
4301
|
+
// </Card>
|
|
4302
|
+
// ),
|
|
4303
|
+
// },
|
|
4304
|
+
]
|
|
4305
|
+
}
|
|
4306
|
+
) });
|
|
4307
|
+
}
|
|
4308
|
+
const Ie = {
|
|
4309
|
+
summary: {
|
|
4310
|
+
alertId: "ALT - 002 #",
|
|
4311
|
+
incidentId: "#000000",
|
|
4312
|
+
severity: "High",
|
|
4313
|
+
location: "Block B, Classroom 204"
|
|
4314
|
+
},
|
|
4315
|
+
timeline: [
|
|
4316
|
+
{
|
|
4317
|
+
status: "Completed",
|
|
4318
|
+
title: "Emergency Services Dispatched",
|
|
4319
|
+
description: "AMB-412 and MED-7 confirmed dispatch and began response.",
|
|
4320
|
+
timestamp: "27/06/2025, 16:00:00"
|
|
4321
|
+
},
|
|
4322
|
+
{
|
|
4323
|
+
status: "Completed",
|
|
4324
|
+
title: "Call Connected to PSAP",
|
|
4325
|
+
description: "Call routed to Springfield Emergency Communications Center.",
|
|
4326
|
+
timestamp: "27/06/2025, 16:00:00"
|
|
4327
|
+
},
|
|
4328
|
+
{
|
|
4329
|
+
status: "Completed",
|
|
4330
|
+
title: "911 Call Initiated",
|
|
4331
|
+
description: "Emergency call placed from school administration office.",
|
|
4332
|
+
timestamp: "27/06/2025, 16:00:00"
|
|
4333
|
+
},
|
|
4334
|
+
{
|
|
4335
|
+
status: "Inprogress",
|
|
4336
|
+
title: "First Unit On Scene",
|
|
4337
|
+
description: "Police Unit 24 arrived and confirmed situation.",
|
|
4338
|
+
timestamp: "29/06/2025, 18:00:00"
|
|
4339
|
+
}
|
|
4340
|
+
],
|
|
4341
|
+
rapidSOS: [
|
|
4342
|
+
{
|
|
4343
|
+
event: "Caller connected to PSAP",
|
|
4344
|
+
timestamp: "27/06/2025, 16:00:05",
|
|
4345
|
+
details: "RapidSOS session created"
|
|
4346
|
+
}
|
|
4347
|
+
]
|
|
4348
|
+
};
|
|
4349
|
+
function Yn(e) {
|
|
4350
|
+
if (!e || typeof e != "string") return !1;
|
|
4351
|
+
const t = e.split("?")[0].toLowerCase();
|
|
4352
|
+
return t.endsWith(".mp4") || t.endsWith(".webm") || t.endsWith(".ogg") || t.endsWith(".m3u8");
|
|
4353
|
+
}
|
|
4354
|
+
function Gn(e) {
|
|
4355
|
+
const t = (e?.mediaType || e?.type || "").toString().toLowerCase();
|
|
4356
|
+
return t === "video" || t === "mp4" ? !0 : Yn(e?.mediaUrl || e);
|
|
4357
|
+
}
|
|
4358
|
+
function st(e) {
|
|
4359
|
+
const t = e;
|
|
4360
|
+
return t ? Array.isArray(t) ? t : [t] : [];
|
|
4361
|
+
}
|
|
4362
|
+
const Xn = ({ isModalOpen: e, handleModalClose: t, selectedRow: s, fetchAlertLogs: r, alertStatusList: i = [], alertStatusLoading: a = !1, initialTab: l = "details" }) => {
|
|
4363
|
+
const [o, g] = C(), [x, p] = C(""), [T, m] = C(!1), A = Os(null), [j, E] = C("details"), [P, W] = C(void 0), q = fs(), Y = s?.originalData || {}, {
|
|
4364
|
+
eventName: J,
|
|
4365
|
+
alertId: X,
|
|
4366
|
+
timestamp: V,
|
|
4367
|
+
description: w,
|
|
4368
|
+
spaceName: I,
|
|
4369
|
+
assignTeam: M,
|
|
4370
|
+
priority: R,
|
|
4371
|
+
type: b,
|
|
4372
|
+
statusType: B,
|
|
4373
|
+
id: z,
|
|
4374
|
+
alertDetails: v,
|
|
4375
|
+
statusHistory: h,
|
|
4376
|
+
mediaDetails: d
|
|
4377
|
+
} = Y;
|
|
4378
|
+
me(() => {
|
|
4379
|
+
const u = z;
|
|
4380
|
+
if (j !== "track" || !u) return;
|
|
4381
|
+
let N = !1;
|
|
4382
|
+
return (async () => {
|
|
4383
|
+
try {
|
|
4384
|
+
const c = await In(u);
|
|
4385
|
+
if (N) return;
|
|
4386
|
+
const f = /* @__PURE__ */ new Map();
|
|
4387
|
+
(c || []).forEach((k) => {
|
|
4388
|
+
const H = String(k?.notificationType || "Unknown"), _ = f.get(H) || [];
|
|
4389
|
+
_.push(k), f.set(H, _);
|
|
4390
|
+
});
|
|
4391
|
+
const O = Array.from(f.entries()).map(([k, H]) => {
|
|
4392
|
+
const _ = H.map((G) => {
|
|
4393
|
+
const he = String(G?.messageStatus || "").toLowerCase(), pe = he === "delivered" ? "Delivered" : he === "failed" ? "Failed" : "Queued";
|
|
4394
|
+
return {
|
|
4395
|
+
name: G?.receipientName || G?.recipientName || "-",
|
|
4396
|
+
role: G?.receipientRoleName || "",
|
|
4397
|
+
phone: G?.receipentPhoneNumber || G?.recipientPhoneNumber || G?.receipientEmail || G?.recipientEmail || "",
|
|
4398
|
+
status: pe
|
|
4399
|
+
};
|
|
4400
|
+
}), Q = _.filter((G) => G.status === "Delivered").length, oe = H.map((G) => G?.sentAt).filter(Boolean).sort((G, he) => new Date(he).getTime() - new Date(G).getTime())[0], te = H[0] || {}, se = [te?.severityName, te?.anomalyName].filter(Boolean).join(" - ") || `${k} Notification`;
|
|
4401
|
+
return {
|
|
4402
|
+
channelLabel: `${k} Notification`,
|
|
4403
|
+
sentAt: oe || "",
|
|
4404
|
+
messageTitle: se,
|
|
4405
|
+
messageBody: "",
|
|
4406
|
+
total: _.length,
|
|
4407
|
+
delivered: Q,
|
|
4408
|
+
recipients: _
|
|
4409
|
+
};
|
|
4410
|
+
});
|
|
4411
|
+
W(O);
|
|
4412
|
+
} catch {
|
|
4413
|
+
W(void 0);
|
|
4414
|
+
}
|
|
4415
|
+
})(), () => {
|
|
4416
|
+
N = !0;
|
|
4417
|
+
};
|
|
4418
|
+
}, [j, z]), me(() => {
|
|
4419
|
+
e && E(l);
|
|
4420
|
+
}, [e, l]);
|
|
4421
|
+
const S = (i || []).map((u) => ({
|
|
4422
|
+
value: u.value,
|
|
4423
|
+
label: u.statusName
|
|
4424
|
+
})), y = async () => {
|
|
4425
|
+
try {
|
|
4426
|
+
m(!0);
|
|
4427
|
+
const u = {
|
|
4428
|
+
alertUniqueId: X,
|
|
4429
|
+
alertId: z,
|
|
4430
|
+
status: o !== void 0 ? String(o) : void 0,
|
|
4431
|
+
notes: x.trim(),
|
|
4432
|
+
modifiedBy: 0
|
|
4433
|
+
};
|
|
4434
|
+
(await q.mutateAsync(u))?.ok ? (xe.success("Alert status updated successfully", {
|
|
4435
|
+
autoClose: 1500,
|
|
4436
|
+
onClose: () => {
|
|
4437
|
+
r(), t();
|
|
4438
|
+
}
|
|
4439
|
+
}), g(void 0), p("")) : xe.error("Failed to update alert status");
|
|
4440
|
+
} catch (u) {
|
|
4441
|
+
console.error("Error updating alert status:", u), xe.error("Failed to update alert status. Please try again.");
|
|
4442
|
+
} finally {
|
|
4443
|
+
m(!1);
|
|
4444
|
+
}
|
|
4445
|
+
};
|
|
4446
|
+
return /* @__PURE__ */ n.jsx(
|
|
4447
|
+
Ls,
|
|
4448
|
+
{
|
|
4449
|
+
open: e,
|
|
4450
|
+
onCancel: t,
|
|
4451
|
+
width: 1e3,
|
|
4452
|
+
footer: j === "details" ? /* @__PURE__ */ n.jsxs("div", { className: "flex flex-row gap-2 justify-start", children: [
|
|
4453
|
+
/* @__PURE__ */ n.jsx(de, { onClick: t, className: "bg-[#6C757D] text-white", children: "Cancel" }),
|
|
4454
|
+
/* @__PURE__ */ n.jsx(
|
|
4455
|
+
de,
|
|
4456
|
+
{
|
|
4457
|
+
type: "primary",
|
|
4458
|
+
onClick: y,
|
|
4459
|
+
loading: T,
|
|
4460
|
+
children: T ? "Saving..." : "Save Changes"
|
|
4461
|
+
}
|
|
4462
|
+
)
|
|
4463
|
+
] }) : null,
|
|
4464
|
+
children: s && /* @__PURE__ */ n.jsx(
|
|
4465
|
+
ht,
|
|
4466
|
+
{
|
|
4467
|
+
activeKey: j,
|
|
4468
|
+
onChange: (u) => E(u),
|
|
4469
|
+
items: [
|
|
4470
|
+
{
|
|
4471
|
+
key: "details",
|
|
4472
|
+
label: "Alert Detail",
|
|
4473
|
+
children: /* @__PURE__ */ n.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
4474
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
4475
|
+
/* @__PURE__ */ n.jsx("div", { className: "text-sm font-bold", children: J || "Alert Event" }),
|
|
4476
|
+
v?.firstName ? /* @__PURE__ */ n.jsxs("div", { className: "text-sm text-gray-500", children: [
|
|
4477
|
+
"Resident ID/Name: ",
|
|
4478
|
+
v?.firstName,
|
|
4479
|
+
" ",
|
|
4480
|
+
v?.lastName || "",
|
|
4481
|
+
" ",
|
|
4482
|
+
v?.residentId || ""
|
|
4483
|
+
] }) : null,
|
|
4484
|
+
/* @__PURE__ */ n.jsxs("div", { className: "text-sm text-gray-500", children: [
|
|
4485
|
+
"Timestamp: ",
|
|
4486
|
+
tt(V)
|
|
4487
|
+
] }),
|
|
4488
|
+
/* @__PURE__ */ n.jsxs("div", { className: "font-sm text-gray-500", children: [
|
|
4489
|
+
/* @__PURE__ */ n.jsx("b", { className: "text-black text-sm/6", children: "Description:" }),
|
|
4490
|
+
" ",
|
|
4491
|
+
w || "No description available"
|
|
4492
|
+
] }),
|
|
4493
|
+
I && /* @__PURE__ */ n.jsxs("div", { className: "font-sm text-gray-500", children: [
|
|
4494
|
+
"Space: ",
|
|
4495
|
+
I
|
|
4496
|
+
] }),
|
|
4497
|
+
M && /* @__PURE__ */ n.jsxs("div", { className: "font-sm text-gray-500", children: [
|
|
4498
|
+
"Assigned to: ",
|
|
4499
|
+
M
|
|
4500
|
+
] }),
|
|
4501
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex gap-2 justify-start mt-3", children: [
|
|
4502
|
+
/* @__PURE__ */ n.jsxs(Ye, { className: "font-sm text-gray-500 rounded-[8px] py-2 px-3", children: [
|
|
4503
|
+
"Severity: ",
|
|
4504
|
+
R || "N/A"
|
|
4505
|
+
] }),
|
|
4506
|
+
/* @__PURE__ */ n.jsxs(Ye, { className: "font-sm text-gray-500 rounded-[8px] py-2 px-3", children: [
|
|
4507
|
+
"Shared With: ",
|
|
4508
|
+
b || "N/A"
|
|
4509
|
+
] }),
|
|
4510
|
+
/* @__PURE__ */ n.jsxs(Ye, { className: "font-sm text-gray-500 rounded-[8px] py-2 px-3", children: [
|
|
4511
|
+
"Status: ",
|
|
4512
|
+
B || "N/A"
|
|
4513
|
+
] })
|
|
4514
|
+
] }),
|
|
4515
|
+
/* @__PURE__ */ n.jsx("div", { className: "w-full flex flex-col justify-start items-start mt-2 font-bold", children: /* @__PURE__ */ n.jsxs("div", { className: "w-full mt-4", children: [
|
|
4516
|
+
/* @__PURE__ */ n.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ n.jsx(
|
|
4517
|
+
le,
|
|
4518
|
+
{
|
|
4519
|
+
placeholder: "Change Status",
|
|
4520
|
+
className: "w-full text-gray-500",
|
|
4521
|
+
onChange: (u) => g(u),
|
|
4522
|
+
value: o,
|
|
4523
|
+
options: S,
|
|
4524
|
+
loading: a
|
|
4525
|
+
}
|
|
4526
|
+
) }),
|
|
4527
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-col gap-2 mt-3", children: [
|
|
4528
|
+
/* @__PURE__ */ n.jsx("label", { className: "text-xs text-gray-500 font-medium", children: "Action Taken (Comments)" }),
|
|
4529
|
+
o ? /* @__PURE__ */ n.jsxs("label", { className: "text-xs text-gray-500 font-medium", htmlFor: "action-details-input", children: [
|
|
4530
|
+
"Enter ",
|
|
4531
|
+
S.find((u) => u.value === o)?.label
|
|
4532
|
+
] }) : null,
|
|
4533
|
+
/* @__PURE__ */ n.jsx(
|
|
4534
|
+
"textarea",
|
|
4535
|
+
{
|
|
4536
|
+
id: "action-details-input",
|
|
4537
|
+
placeholder: "Enter details...",
|
|
4538
|
+
className: "w-full text-gray-500 h-20 border border-grey-500 rounded-md p-2",
|
|
4539
|
+
value: x,
|
|
4540
|
+
onChange: (u) => p(u.target.value)
|
|
4541
|
+
}
|
|
4542
|
+
)
|
|
4543
|
+
] }),
|
|
4544
|
+
/* @__PURE__ */ n.jsxs("div", { className: "border border-[#DFE4EA] rounded-md px-4 py-2 flex flex-row justify-between items-center mt-4 mb-8", children: [
|
|
4545
|
+
/* @__PURE__ */ n.jsx("label", { className: "text-xs font-medium", children: "Alert notification will be sent to all Family Members." }),
|
|
4546
|
+
/* @__PURE__ */ n.jsx("button", { className: "bg-[#000000] text-white rounded-md px-4 py-2 text-xs", children: "Notify Family" })
|
|
4547
|
+
] })
|
|
4548
|
+
] }) })
|
|
4549
|
+
] }),
|
|
4550
|
+
/* @__PURE__ */ n.jsx("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ n.jsxs("div", { className: "w-full mt-1", children: [
|
|
4551
|
+
/* @__PURE__ */ n.jsxs("div", { className: "w-full flex items-center justify-between", children: [
|
|
4552
|
+
/* @__PURE__ */ n.jsx("h3", { className: "text-black font-bold text-sm", children: "Camera Footage" }),
|
|
4553
|
+
st(d).length ? /* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4554
|
+
/* @__PURE__ */ n.jsx(
|
|
4555
|
+
"button",
|
|
4556
|
+
{
|
|
4557
|
+
type: "button",
|
|
4558
|
+
onClick: () => A.current?.prev?.(),
|
|
4559
|
+
className: "w-6 h-6 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 text-gray-600",
|
|
4560
|
+
"aria-label": "Previous media",
|
|
4561
|
+
children: /* @__PURE__ */ n.jsx(Hs, { style: { fontSize: 12 } })
|
|
4562
|
+
}
|
|
4563
|
+
),
|
|
4564
|
+
/* @__PURE__ */ n.jsx(
|
|
4565
|
+
"button",
|
|
4566
|
+
{
|
|
4567
|
+
type: "button",
|
|
4568
|
+
onClick: () => A.current?.next?.(),
|
|
4569
|
+
className: "w-6 h-6 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 text-gray-600",
|
|
4570
|
+
"aria-label": "Next media",
|
|
4571
|
+
children: /* @__PURE__ */ n.jsx(Ys, { style: { fontSize: 12 } })
|
|
4572
|
+
}
|
|
4573
|
+
)
|
|
4574
|
+
] }) : null
|
|
4575
|
+
] }),
|
|
4576
|
+
st(d).length ? /* @__PURE__ */ n.jsx("div", { className: "w-full", children: /* @__PURE__ */ n.jsx(Bs, { ref: A, dots: !0, className: "w-full", children: st(d).map((u, N) => /* @__PURE__ */ n.jsxs("div", { className: "flex justify-center items-center", children: [
|
|
4577
|
+
Gn(u) ? /* @__PURE__ */ n.jsxs(
|
|
4578
|
+
"video",
|
|
4579
|
+
{
|
|
4580
|
+
width: "240",
|
|
4581
|
+
height: "200",
|
|
4582
|
+
controls: !0,
|
|
4583
|
+
className: "max-w-full max-h-[90vh] object-contain rounded-lg shadow-lg",
|
|
4584
|
+
children: [
|
|
4585
|
+
/* @__PURE__ */ n.jsx("source", { src: u.mediaUrl || u }),
|
|
4586
|
+
"Your browser does not support the video tag."
|
|
4587
|
+
]
|
|
4588
|
+
}
|
|
4589
|
+
) : /* @__PURE__ */ n.jsx(
|
|
4590
|
+
"img",
|
|
4591
|
+
{
|
|
4592
|
+
src: u.mediaUrl || u,
|
|
4593
|
+
alt: u.caption || `media-${N}`,
|
|
4594
|
+
className: "max-w-full max-h-[90vh] object-contain rounded-lg shadow-lg"
|
|
4595
|
+
}
|
|
4596
|
+
),
|
|
4597
|
+
u.caption && /* @__PURE__ */ n.jsx("p", { className: "text-xs text-gray-500 mt-1", children: u.caption })
|
|
4598
|
+
] }, N)) }) }) : null
|
|
4599
|
+
] }) })
|
|
4600
|
+
] })
|
|
4601
|
+
},
|
|
4602
|
+
{
|
|
4603
|
+
key: "track",
|
|
4604
|
+
label: "Track Incident",
|
|
4605
|
+
children: (() => {
|
|
4606
|
+
const u = {
|
|
4607
|
+
alertId: X ?? z ?? Ie.summary.alertId,
|
|
4608
|
+
incidentId: Ie.summary.incidentId,
|
|
4609
|
+
severity: R || Ie.summary.severity,
|
|
4610
|
+
location: I || Ie.summary.location
|
|
4611
|
+
}, N = h && h.length ? h.map((f) => ({
|
|
4612
|
+
status: (f?.status || f?.eventStatus || "").toLowerCase() === "completed" ? "Completed" : "Inprogress",
|
|
4613
|
+
title: f?.status || f?.eventStatus || "Status Update",
|
|
4614
|
+
description: f?.description || f?.actionNotes || "",
|
|
4615
|
+
timestamp: f?.createdDate ? `${tt(f?.createdDate)}` : f?.timestamp ? `${tt(f?.timestamp)}` : ""
|
|
4616
|
+
})) : Ie.timeline, c = {
|
|
4617
|
+
summary: u,
|
|
4618
|
+
timeline: N,
|
|
4619
|
+
notifications: P ?? [],
|
|
4620
|
+
rapidSOS: Ie.rapidSOS
|
|
4621
|
+
};
|
|
4622
|
+
return /* @__PURE__ */ n.jsx(Hn, { data: c });
|
|
4623
|
+
})()
|
|
4624
|
+
}
|
|
4625
|
+
]
|
|
4626
|
+
}
|
|
4627
|
+
)
|
|
4628
|
+
}
|
|
4629
|
+
);
|
|
4630
|
+
};
|
|
4631
|
+
function Jn() {
|
|
4632
|
+
const { alerts: e } = De(), t = At({
|
|
4633
|
+
queryKey: ["alerts", "statusList"],
|
|
4634
|
+
queryFn: () => e.getAlertStatusList(),
|
|
4635
|
+
staleTime: 5 * 6e4
|
|
4636
|
+
});
|
|
4637
|
+
return {
|
|
4638
|
+
list: t.data ?? [],
|
|
4639
|
+
loading: t.isLoading,
|
|
4640
|
+
error: t.error,
|
|
4641
|
+
refetch: t.refetch
|
|
4642
|
+
};
|
|
4643
|
+
}
|
|
4644
|
+
function ys({ alerts: e, loading: t = !1, columns: s }) {
|
|
4645
|
+
const [r, i] = C(!1), [a, l] = C(null), [o, g] = C("details"), { list: x, loading: p } = Jn();
|
|
4646
|
+
function T(j, E) {
|
|
4647
|
+
l(j), g(E?.tab ?? "details"), i(!0);
|
|
4648
|
+
}
|
|
4649
|
+
function m() {
|
|
4650
|
+
i(!1);
|
|
4651
|
+
}
|
|
4652
|
+
me(() => {
|
|
4653
|
+
}, []);
|
|
4654
|
+
const A = a ? {
|
|
4655
|
+
originalData: {
|
|
4656
|
+
// include the full selected alert so alll modal fieldsare present
|
|
4657
|
+
...a,
|
|
4658
|
+
// ensure alertId is available even if backend uses id
|
|
4659
|
+
alertId: a.alertId ?? a.id,
|
|
4660
|
+
mediaDetails: a.mediaDetails
|
|
4661
|
+
}
|
|
4662
|
+
} : null;
|
|
4663
|
+
return /* @__PURE__ */ n.jsxs("div", { className: "p-6 flex flex-col items-start justify-start min-h-screen w-full", children: [
|
|
4664
|
+
/* @__PURE__ */ n.jsxs("div", { className: "w-1/2 flex items-center justify-between mb-4", children: [
|
|
4665
|
+
/* @__PURE__ */ n.jsx("h2", { className: "text-[32px] font-bold text-black", children: "Alert Console" }),
|
|
4666
|
+
/* @__PURE__ */ n.jsx(pn, { label: "USA", timeZone: "America/New_York" })
|
|
4667
|
+
] }),
|
|
4668
|
+
/* @__PURE__ */ n.jsx(
|
|
4669
|
+
ht,
|
|
4670
|
+
{
|
|
4671
|
+
defaultActiveKey: "active",
|
|
4672
|
+
className: "w-full",
|
|
4673
|
+
tabBarStyle: { fontSize: 24 },
|
|
4674
|
+
items: [
|
|
4675
|
+
{
|
|
4676
|
+
key: "active",
|
|
4677
|
+
label: "Active",
|
|
4678
|
+
children: /* @__PURE__ */ n.jsx($t, { data: e, loading: t, pageSize: 10, columns: s || [], onAlertIdClick: T })
|
|
4679
|
+
},
|
|
4680
|
+
{
|
|
4681
|
+
key: "archived",
|
|
4682
|
+
label: "Archived",
|
|
4683
|
+
children: /* @__PURE__ */ n.jsx(fn, { alerts: e, loading: t, columns: s || [], onAlertIdClick: T })
|
|
4684
|
+
},
|
|
4685
|
+
{
|
|
4686
|
+
key: "settings",
|
|
4687
|
+
label: "Settings",
|
|
4688
|
+
children: /* @__PURE__ */ n.jsx(Vn, {})
|
|
4689
|
+
}
|
|
4690
|
+
// {
|
|
4691
|
+
// key: "reports",
|
|
4692
|
+
// label: "Reports",
|
|
4693
|
+
// children: <ReportsPanel />,
|
|
4694
|
+
// },
|
|
4695
|
+
]
|
|
4696
|
+
}
|
|
4697
|
+
),
|
|
4698
|
+
/* @__PURE__ */ n.jsx(
|
|
4699
|
+
Xn,
|
|
4700
|
+
{
|
|
4701
|
+
isModalOpen: r,
|
|
4702
|
+
handleModalClose: m,
|
|
4703
|
+
selectedRow: A,
|
|
4704
|
+
fetchAlertLogs: () => {
|
|
4705
|
+
},
|
|
4706
|
+
alertStatusList: x,
|
|
4707
|
+
alertStatusLoading: p,
|
|
4708
|
+
initialTab: o
|
|
4709
|
+
}
|
|
4710
|
+
)
|
|
4711
|
+
] });
|
|
4712
|
+
}
|
|
4713
|
+
function Vn() {
|
|
4714
|
+
const [e, t] = C([]), [s, r] = C([]), [i, a] = C([]), { rules: l } = De();
|
|
4715
|
+
return me(() => {
|
|
4716
|
+
let o = !0;
|
|
4717
|
+
return (async () => {
|
|
4718
|
+
try {
|
|
4719
|
+
const g = await l.getRules();
|
|
4720
|
+
if (!o) return;
|
|
4721
|
+
a(Array.isArray(g) ? g : []);
|
|
4722
|
+
const x = (g || []).map((p, T) => ({
|
|
4723
|
+
RuleId: p.ruleId || p.ruleName || String(T),
|
|
4724
|
+
Name: p.ruleName || p.Name || "-",
|
|
4725
|
+
Description: p.ruleDesc || p.Description || "",
|
|
4726
|
+
SeverityId: 0
|
|
4727
|
+
}));
|
|
4728
|
+
t(x.length ? x : Ne.rules);
|
|
4729
|
+
try {
|
|
4730
|
+
const p = await l.getLookups(), T = Array.isArray(p?.userRoles) ? p.userRoles.map((m) => ({
|
|
4731
|
+
userRoleId: m.userRoleId ?? m.id,
|
|
4732
|
+
userRoleName: m.userRoleName ?? m.name
|
|
4733
|
+
})) : [];
|
|
4734
|
+
r(T.length ? T : Ne.userRoles);
|
|
4735
|
+
} catch {
|
|
4736
|
+
r(Ne.userRoles);
|
|
4737
|
+
}
|
|
4738
|
+
} catch {
|
|
4739
|
+
t(Ne.rules), r(Ne.userRoles);
|
|
4740
|
+
}
|
|
4741
|
+
})(), () => {
|
|
4742
|
+
o = !1;
|
|
4743
|
+
};
|
|
4744
|
+
}, []), /* @__PURE__ */ n.jsx(
|
|
4745
|
+
Qn,
|
|
4746
|
+
{
|
|
4747
|
+
severities: Ne.severities,
|
|
4748
|
+
rules: e,
|
|
4749
|
+
userRoles: s,
|
|
4750
|
+
rawRules: i
|
|
4751
|
+
}
|
|
4752
|
+
);
|
|
4753
|
+
}
|
|
4754
|
+
function Kn() {
|
|
4755
|
+
const { alerts: e } = De(), t = At({
|
|
4756
|
+
queryKey: ["alerts", "list"],
|
|
4757
|
+
queryFn: () => e.listAlerts(),
|
|
4758
|
+
staleTime: 3e4
|
|
4759
|
+
});
|
|
4760
|
+
return {
|
|
4761
|
+
alerts: t.data ?? [],
|
|
4762
|
+
loading: t.isLoading,
|
|
4763
|
+
error: t.error,
|
|
4764
|
+
refetch: t.refetch
|
|
4765
|
+
};
|
|
4766
|
+
}
|
|
4767
|
+
function Zn(e) {
|
|
4768
|
+
const { alerts: t, loading: s } = Kn();
|
|
4769
|
+
return /* @__PURE__ */ n.jsx(ys, { alerts: t, loading: s, columns: e.columns });
|
|
4770
|
+
}
|
|
4771
|
+
function si({
|
|
4772
|
+
tenant: e,
|
|
4773
|
+
apiDomain: t,
|
|
4774
|
+
rulesDomain: s,
|
|
4775
|
+
headers: r,
|
|
4776
|
+
alerts: i,
|
|
4777
|
+
loading: a,
|
|
4778
|
+
columns: l
|
|
4779
|
+
}) {
|
|
4780
|
+
const [o] = C(() => new Lr()), g = ue(
|
|
4781
|
+
() => ({
|
|
4782
|
+
alertsBaseUrl: t,
|
|
4783
|
+
rulesBaseUrl: s || t,
|
|
4784
|
+
headers: r || void 0
|
|
4785
|
+
}),
|
|
4786
|
+
[t, s, r]
|
|
4787
|
+
);
|
|
4788
|
+
return /* @__PURE__ */ n.jsx(Br, { client: o, children: /* @__PURE__ */ n.jsx(cn, { tenant: e, override: g, children: Array.isArray(i) ? /* @__PURE__ */ n.jsx(ys, { alerts: i, loading: !!a, columns: l }) : /* @__PURE__ */ n.jsx(Zn, { columns: l }) }) });
|
|
4789
|
+
}
|
|
4790
|
+
function ri(e) {
|
|
4791
|
+
const { alerts: t } = De(), s = At({
|
|
4792
|
+
queryKey: ["alerts", "report", e],
|
|
4793
|
+
queryFn: () => t.getAlertsReport(e),
|
|
4794
|
+
staleTime: 6e4
|
|
4795
|
+
});
|
|
4796
|
+
return {
|
|
4797
|
+
data: s.data ?? [],
|
|
4798
|
+
loading: s.isLoading,
|
|
4799
|
+
error: s.error,
|
|
4800
|
+
refetch: s.refetch
|
|
4801
|
+
};
|
|
4802
|
+
}
|
|
4803
|
+
const ni = [
|
|
4804
|
+
{ title: "ID", dataIndex: "id", key: "id", width: 120 },
|
|
4805
|
+
{ title: "Priority", dataIndex: "priority", key: "priority", width: 120 },
|
|
4806
|
+
{ title: "Timestamp", dataIndex: "timestamp", key: "timestamp", width: 220 },
|
|
4807
|
+
{ title: "Status", dataIndex: "statusType", key: "statusType", width: 140 },
|
|
4808
|
+
{ title: "Description", dataIndex: "description", key: "description" }
|
|
4809
|
+
];
|
|
4810
|
+
export {
|
|
4811
|
+
Rn as AlertAssignment,
|
|
4812
|
+
ys as AlertConsole,
|
|
4813
|
+
si as AlertConsoleWidget,
|
|
4814
|
+
$t as AlertsTable,
|
|
4815
|
+
cn as ApiProvider,
|
|
4816
|
+
fn as ArchivedTable,
|
|
4817
|
+
pn as Clock,
|
|
4818
|
+
mr as DataTable,
|
|
4819
|
+
Bn as MyPreferencesPanel,
|
|
4820
|
+
Ln as SettingsPanel,
|
|
4821
|
+
Qn as SettingsTabs,
|
|
4822
|
+
ni as exampleAlertColumns,
|
|
4823
|
+
Jn as useAlertStatusList,
|
|
4824
|
+
Kn as useAlerts,
|
|
4825
|
+
ri as useAlertsReport,
|
|
4826
|
+
De as useApi,
|
|
4827
|
+
fs as useUpdateAlertStatus
|
|
4828
|
+
};
|