@devtable/settings-form 9.6.0 → 9.8.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.
@@ -1,21 +1,21 @@
1
- import * as Z from "react";
2
- import H, { useEffect as Te, forwardRef as ze, useState as lr, useMemo as ur } from "react";
3
- import { Box as I, TextInput as D, Divider as Oe, Group as z, NumberInput as Wr, PasswordInput as de, Button as T, Modal as ne, Stack as Ae, Alert as Yr, SegmentedControl as Br, useMantineTheme as Kr, Tooltip as Gr, Text as ue, LoadingOverlay as xe, Table as ke, Select as Hr, Switch as Jr } from "@mantine/core";
4
- import { showNotification as V, updateNotification as x } from "@mantine/notifications";
5
- import { Recycle as Xr, AlertCircle as Qr, PlaylistAdd as De, Trash as je, Edit as Zr } from "tabler-icons-react";
6
- import et from "axios";
7
- import rt from "crypto-js";
8
- import tt from "lodash";
9
- import { useForm as J, Controller as R } from "react-hook-form";
10
- import { useBoolean as nt, useRequest as G } from "ahooks";
11
- import at, { loader as Ee } from "@monaco-editor/react";
12
- import { useModals as fe, closeAllModals as it } from "@mantine/modals";
13
- var te = {}, ot = {
1
+ import B, { useEffect as ze, forwardRef as Ae, useState as ur, useMemo as dr } from "react";
2
+ import { Box as I, TextInput as O, Divider as de, Group as z, NumberInput as Br, PasswordInput as fe, Button as R, Modal as X, Stack as Oe, Alert as Kr, SegmentedControl as Gr, Tooltip as Ce, Text as te, ActionIcon as Hr, LoadingOverlay as xe, Table as De, Select as Jr, Switch as Xr } from "@mantine/core";
3
+ import { showNotification as V, updateNotification as A } from "@mantine/notifications";
4
+ import { Recycle as Qr, AlertCircle as Zr, PlaylistAdd as ke, Trash as Ie, Edit as et } from "tabler-icons-react";
5
+ import rt from "axios";
6
+ import tt from "crypto-js";
7
+ import nt from "lodash";
8
+ import { useForm as K, Controller as P } from "react-hook-form";
9
+ import { useBoolean as it, useRequest as J } from "ahooks";
10
+ import at, { loader as Te } from "@monaco-editor/react";
11
+ import { useModals as pe, closeAllModals as ot } from "@mantine/modals";
12
+ import { IconLock as fr, IconEdit as or, IconNetwork as st, IconBrandMysql as ct, IconDatabase as lt } from "@tabler/icons";
13
+ var ne = {}, ut = {
14
14
  get exports() {
15
- return te;
15
+ return ne;
16
16
  },
17
17
  set exports(t) {
18
- te = t;
18
+ ne = t;
19
19
  }
20
20
  }, ee = {};
21
21
  /**
@@ -27,23 +27,23 @@ var te = {}, ot = {
27
27
  * This source code is licensed under the MIT license found in the
28
28
  * LICENSE file in the root directory of this source tree.
29
29
  */
30
- var or;
31
- function st() {
32
- if (or)
30
+ var sr;
31
+ function dt() {
32
+ if (sr)
33
33
  return ee;
34
- or = 1;
35
- var t = H, n = Symbol.for("react.element"), i = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, l = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
36
- function c(d, p, b) {
37
- var f, h = {}, _ = null, k = null;
38
- b !== void 0 && (_ = "" + b), p.key !== void 0 && (_ = "" + p.key), p.ref !== void 0 && (k = p.ref);
39
- for (f in p)
40
- o.call(p, f) && !s.hasOwnProperty(f) && (h[f] = p[f]);
34
+ sr = 1;
35
+ var t = B, n = Symbol.for("react.element"), o = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, c = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
36
+ function l(d, g, w) {
37
+ var f, h = {}, _ = null, j = null;
38
+ w !== void 0 && (_ = "" + w), g.key !== void 0 && (_ = "" + g.key), g.ref !== void 0 && (j = g.ref);
39
+ for (f in g)
40
+ a.call(g, f) && !s.hasOwnProperty(f) && (h[f] = g[f]);
41
41
  if (d && d.defaultProps)
42
- for (f in p = d.defaultProps, p)
43
- h[f] === void 0 && (h[f] = p[f]);
44
- return { $$typeof: n, type: d, key: _, ref: k, props: h, _owner: l.current };
42
+ for (f in g = d.defaultProps, g)
43
+ h[f] === void 0 && (h[f] = g[f]);
44
+ return { $$typeof: n, type: d, key: _, ref: j, props: h, _owner: c.current };
45
45
  }
46
- return ee.Fragment = i, ee.jsx = c, ee.jsxs = c, ee;
46
+ return ee.Fragment = o, ee.jsx = l, ee.jsxs = l, ee;
47
47
  }
48
48
  var re = {};
49
49
  /**
@@ -55,70 +55,70 @@ var re = {};
55
55
  * This source code is licensed under the MIT license found in the
56
56
  * LICENSE file in the root directory of this source tree.
57
57
  */
58
- var sr;
59
- function ct() {
60
- return sr || (sr = 1, process.env.NODE_ENV !== "production" && function() {
61
- var t = H, n = Symbol.for("react.element"), i = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), c = Symbol.for("react.provider"), d = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), k = Symbol.for("react.offscreen"), q = Symbol.iterator, he = "@@iterator";
62
- function me(e) {
58
+ var cr;
59
+ function ft() {
60
+ return cr || (cr = 1, process.env.NODE_ENV !== "production" && function() {
61
+ var t = B, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), d = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), q = Symbol.iterator, he = "@@iterator";
62
+ function be(e) {
63
63
  if (e === null || typeof e != "object")
64
64
  return null;
65
- var a = q && e[q] || e[he];
66
- return typeof a == "function" ? a : null;
65
+ var i = q && e[q] || e[he];
66
+ return typeof i == "function" ? i : null;
67
67
  }
68
- var U = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
69
- function O(e) {
68
+ var $ = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
69
+ function x(e) {
70
70
  {
71
- for (var a = arguments.length, u = new Array(a > 1 ? a - 1 : 0), g = 1; g < a; g++)
72
- u[g - 1] = arguments[g];
73
- dr("error", e, u);
71
+ for (var i = arguments.length, u = new Array(i > 1 ? i - 1 : 0), p = 1; p < i; p++)
72
+ u[p - 1] = arguments[p];
73
+ pr("error", e, u);
74
74
  }
75
75
  }
76
- function dr(e, a, u) {
76
+ function pr(e, i, u) {
77
77
  {
78
- var g = U.ReactDebugCurrentFrame, S = g.getStackAddendum();
79
- S !== "" && (a += "%s", u = u.concat([S]));
80
- var y = u.map(function(w) {
81
- return String(w);
78
+ var p = $.ReactDebugCurrentFrame, S = p.getStackAddendum();
79
+ S !== "" && (i += "%s", u = u.concat([S]));
80
+ var y = u.map(function(v) {
81
+ return String(v);
82
82
  });
83
- y.unshift("Warning: " + a), Function.prototype.apply.call(console[e], console, y);
83
+ y.unshift("Warning: " + i), Function.prototype.apply.call(console[e], console, y);
84
84
  }
85
85
  }
86
- var fr = !1, pr = !1, gr = !1, hr = !1, mr = !1, Fe;
86
+ var gr = !1, mr = !1, hr = !1, br = !1, vr = !1, Fe;
87
87
  Fe = Symbol.for("react.module.reference");
88
- function vr(e) {
89
- return !!(typeof e == "string" || typeof e == "function" || e === o || e === s || mr || e === l || e === b || e === f || hr || e === k || fr || pr || gr || typeof e == "object" && e !== null && (e.$$typeof === _ || e.$$typeof === h || e.$$typeof === c || e.$$typeof === d || e.$$typeof === p || // This needs to include all possible module reference object
88
+ function wr(e) {
89
+ return !!(typeof e == "string" || typeof e == "function" || e === a || e === s || vr || e === c || e === w || e === f || br || e === j || gr || mr || hr || typeof e == "object" && e !== null && (e.$$typeof === _ || e.$$typeof === h || e.$$typeof === l || e.$$typeof === d || e.$$typeof === g || // This needs to include all possible module reference object
90
90
  // types supported by any Flight configuration anywhere since
91
91
  // we don't know which Flight build this will end up being used
92
92
  // with.
93
93
  e.$$typeof === Fe || e.getModuleId !== void 0));
94
94
  }
95
- function br(e, a, u) {
96
- var g = e.displayName;
97
- if (g)
98
- return g;
99
- var S = a.displayName || a.name || "";
95
+ function Sr(e, i, u) {
96
+ var p = e.displayName;
97
+ if (p)
98
+ return p;
99
+ var S = i.displayName || i.name || "";
100
100
  return S !== "" ? u + "(" + S + ")" : u;
101
101
  }
102
102
  function qe(e) {
103
103
  return e.displayName || "Context";
104
104
  }
105
- function L(e) {
105
+ function U(e) {
106
106
  if (e == null)
107
107
  return null;
108
- if (typeof e.tag == "number" && O("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
108
+ if (typeof e.tag == "number" && x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
109
109
  return e.displayName || e.name || null;
110
110
  if (typeof e == "string")
111
111
  return e;
112
112
  switch (e) {
113
- case o:
113
+ case a:
114
114
  return "Fragment";
115
- case i:
115
+ case o:
116
116
  return "Portal";
117
117
  case s:
118
118
  return "Profiler";
119
- case l:
119
+ case c:
120
120
  return "StrictMode";
121
- case b:
121
+ case w:
122
122
  return "Suspense";
123
123
  case f:
124
124
  return "SuspenseList";
@@ -126,20 +126,20 @@ function ct() {
126
126
  if (typeof e == "object")
127
127
  switch (e.$$typeof) {
128
128
  case d:
129
- var a = e;
130
- return qe(a) + ".Consumer";
131
- case c:
129
+ var i = e;
130
+ return qe(i) + ".Consumer";
131
+ case l:
132
132
  var u = e;
133
133
  return qe(u._context) + ".Provider";
134
- case p:
135
- return br(e, e.render, "ForwardRef");
134
+ case g:
135
+ return Sr(e, e.render, "ForwardRef");
136
136
  case h:
137
- var g = e.displayName || null;
138
- return g !== null ? g : L(e.type) || "Memo";
137
+ var p = e.displayName || null;
138
+ return p !== null ? p : U(e.type) || "Memo";
139
139
  case _: {
140
- var S = e, y = S._payload, w = S._init;
140
+ var S = e, y = S._payload, v = S._init;
141
141
  try {
142
- return L(w(y));
142
+ return U(v(y));
143
143
  } catch {
144
144
  return null;
145
145
  }
@@ -147,14 +147,14 @@ function ct() {
147
147
  }
148
148
  return null;
149
149
  }
150
- var W = Object.assign, X = 0, Le, Me, Ne, Ue, Ve, $e, We;
150
+ var Y = Object.assign, Q = 0, Le, Ne, Ue, Me, Ve, $e, We;
151
151
  function Ye() {
152
152
  }
153
153
  Ye.__reactDisabledLog = !0;
154
- function wr() {
154
+ function _r() {
155
155
  {
156
- if (X === 0) {
157
- Le = console.log, Me = console.info, Ne = console.warn, Ue = console.error, Ve = console.group, $e = console.groupCollapsed, We = console.groupEnd;
156
+ if (Q === 0) {
157
+ Le = console.log, Ne = console.info, Ue = console.warn, Me = console.error, Ve = console.group, $e = console.groupCollapsed, We = console.groupEnd;
158
158
  var e = {
159
159
  configurable: !0,
160
160
  enumerable: !0,
@@ -171,208 +171,208 @@ function ct() {
171
171
  groupEnd: e
172
172
  });
173
173
  }
174
- X++;
174
+ Q++;
175
175
  }
176
176
  }
177
- function Sr() {
177
+ function yr() {
178
178
  {
179
- if (X--, X === 0) {
179
+ if (Q--, Q === 0) {
180
180
  var e = {
181
181
  configurable: !0,
182
182
  enumerable: !0,
183
183
  writable: !0
184
184
  };
185
185
  Object.defineProperties(console, {
186
- log: W({}, e, {
186
+ log: Y({}, e, {
187
187
  value: Le
188
188
  }),
189
- info: W({}, e, {
190
- value: Me
191
- }),
192
- warn: W({}, e, {
189
+ info: Y({}, e, {
193
190
  value: Ne
194
191
  }),
195
- error: W({}, e, {
192
+ warn: Y({}, e, {
196
193
  value: Ue
197
194
  }),
198
- group: W({}, e, {
195
+ error: Y({}, e, {
196
+ value: Me
197
+ }),
198
+ group: Y({}, e, {
199
199
  value: Ve
200
200
  }),
201
- groupCollapsed: W({}, e, {
201
+ groupCollapsed: Y({}, e, {
202
202
  value: $e
203
203
  }),
204
- groupEnd: W({}, e, {
204
+ groupEnd: Y({}, e, {
205
205
  value: We
206
206
  })
207
207
  });
208
208
  }
209
- X < 0 && O("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
209
+ Q < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
210
210
  }
211
211
  }
212
- var ve = U.ReactCurrentDispatcher, be;
213
- function ae(e, a, u) {
212
+ var ve = $.ReactCurrentDispatcher, we;
213
+ function ie(e, i, u) {
214
214
  {
215
- if (be === void 0)
215
+ if (we === void 0)
216
216
  try {
217
217
  throw Error();
218
218
  } catch (S) {
219
- var g = S.stack.trim().match(/\n( *(at )?)/);
220
- be = g && g[1] || "";
219
+ var p = S.stack.trim().match(/\n( *(at )?)/);
220
+ we = p && p[1] || "";
221
221
  }
222
222
  return `
223
- ` + be + e;
223
+ ` + we + e;
224
224
  }
225
225
  }
226
- var we = !1, ie;
226
+ var Se = !1, ae;
227
227
  {
228
- var _r = typeof WeakMap == "function" ? WeakMap : Map;
229
- ie = new _r();
228
+ var Pr = typeof WeakMap == "function" ? WeakMap : Map;
229
+ ae = new Pr();
230
230
  }
231
- function Be(e, a) {
232
- if (!e || we)
231
+ function Be(e, i) {
232
+ if (!e || Se)
233
233
  return "";
234
234
  {
235
- var u = ie.get(e);
235
+ var u = ae.get(e);
236
236
  if (u !== void 0)
237
237
  return u;
238
238
  }
239
- var g;
240
- we = !0;
239
+ var p;
240
+ Se = !0;
241
241
  var S = Error.prepareStackTrace;
242
242
  Error.prepareStackTrace = void 0;
243
243
  var y;
244
- y = ve.current, ve.current = null, wr();
244
+ y = ve.current, ve.current = null, _r();
245
245
  try {
246
- if (a) {
247
- var w = function() {
246
+ if (i) {
247
+ var v = function() {
248
248
  throw Error();
249
249
  };
250
- if (Object.defineProperty(w.prototype, "props", {
250
+ if (Object.defineProperty(v.prototype, "props", {
251
251
  set: function() {
252
252
  throw Error();
253
253
  }
254
254
  }), typeof Reflect == "object" && Reflect.construct) {
255
255
  try {
256
- Reflect.construct(w, []);
256
+ Reflect.construct(v, []);
257
257
  } catch (M) {
258
- g = M;
258
+ p = M;
259
259
  }
260
- Reflect.construct(e, [], w);
260
+ Reflect.construct(e, [], v);
261
261
  } else {
262
262
  try {
263
- w.call();
263
+ v.call();
264
264
  } catch (M) {
265
- g = M;
265
+ p = M;
266
266
  }
267
- e.call(w.prototype);
267
+ e.call(v.prototype);
268
268
  }
269
269
  } else {
270
270
  try {
271
271
  throw Error();
272
272
  } catch (M) {
273
- g = M;
273
+ p = M;
274
274
  }
275
275
  e();
276
276
  }
277
277
  } catch (M) {
278
- if (M && g && typeof M.stack == "string") {
279
- for (var m = M.stack.split(`
280
- `), A = g.stack.split(`
281
- `), P = m.length - 1, E = A.length - 1; P >= 1 && E >= 0 && m[P] !== A[E]; )
282
- E--;
283
- for (; P >= 1 && E >= 0; P--, E--)
284
- if (m[P] !== A[E]) {
285
- if (P !== 1 || E !== 1)
278
+ if (M && p && typeof M.stack == "string") {
279
+ for (var b = M.stack.split(`
280
+ `), D = p.stack.split(`
281
+ `), E = b.length - 1, T = D.length - 1; E >= 1 && T >= 0 && b[E] !== D[T]; )
282
+ T--;
283
+ for (; E >= 1 && T >= 0; E--, T--)
284
+ if (b[E] !== D[T]) {
285
+ if (E !== 1 || T !== 1)
286
286
  do
287
- if (P--, E--, E < 0 || m[P] !== A[E]) {
287
+ if (E--, T--, T < 0 || b[E] !== D[T]) {
288
288
  var F = `
289
- ` + m[P].replace(" at new ", " at ");
290
- return e.displayName && F.includes("<anonymous>") && (F = F.replace("<anonymous>", e.displayName)), typeof e == "function" && ie.set(e, F), F;
289
+ ` + b[E].replace(" at new ", " at ");
290
+ return e.displayName && F.includes("<anonymous>") && (F = F.replace("<anonymous>", e.displayName)), typeof e == "function" && ae.set(e, F), F;
291
291
  }
292
- while (P >= 1 && E >= 0);
292
+ while (E >= 1 && T >= 0);
293
293
  break;
294
294
  }
295
295
  }
296
296
  } finally {
297
- we = !1, ve.current = y, Sr(), Error.prepareStackTrace = S;
297
+ Se = !1, ve.current = y, yr(), Error.prepareStackTrace = S;
298
298
  }
299
- var K = e ? e.displayName || e.name : "", ir = K ? ae(K) : "";
300
- return typeof e == "function" && ie.set(e, ir), ir;
299
+ var H = e ? e.displayName || e.name : "", ar = H ? ie(H) : "";
300
+ return typeof e == "function" && ae.set(e, ar), ar;
301
301
  }
302
- function yr(e, a, u) {
302
+ function Rr(e, i, u) {
303
303
  return Be(e, !1);
304
304
  }
305
- function Rr(e) {
306
- var a = e.prototype;
307
- return !!(a && a.isReactComponent);
305
+ function Er(e) {
306
+ var i = e.prototype;
307
+ return !!(i && i.isReactComponent);
308
308
  }
309
- function oe(e, a, u) {
309
+ function oe(e, i, u) {
310
310
  if (e == null)
311
311
  return "";
312
312
  if (typeof e == "function")
313
- return Be(e, Rr(e));
313
+ return Be(e, Er(e));
314
314
  if (typeof e == "string")
315
- return ae(e);
315
+ return ie(e);
316
316
  switch (e) {
317
- case b:
318
- return ae("Suspense");
317
+ case w:
318
+ return ie("Suspense");
319
319
  case f:
320
- return ae("SuspenseList");
320
+ return ie("SuspenseList");
321
321
  }
322
322
  if (typeof e == "object")
323
323
  switch (e.$$typeof) {
324
- case p:
325
- return yr(e.render);
324
+ case g:
325
+ return Rr(e.render);
326
326
  case h:
327
- return oe(e.type, a, u);
327
+ return oe(e.type, i, u);
328
328
  case _: {
329
- var g = e, S = g._payload, y = g._init;
329
+ var p = e, S = p._payload, y = p._init;
330
330
  try {
331
- return oe(y(S), a, u);
331
+ return oe(y(S), i, u);
332
332
  } catch {
333
333
  }
334
334
  }
335
335
  }
336
336
  return "";
337
337
  }
338
- var se = Object.prototype.hasOwnProperty, Ke = {}, Ge = U.ReactDebugCurrentFrame;
338
+ var se = Object.prototype.hasOwnProperty, Ke = {}, Ge = $.ReactDebugCurrentFrame;
339
339
  function ce(e) {
340
340
  if (e) {
341
- var a = e._owner, u = oe(e.type, e._source, a ? a.type : null);
341
+ var i = e._owner, u = oe(e.type, e._source, i ? i.type : null);
342
342
  Ge.setExtraStackFrame(u);
343
343
  } else
344
344
  Ge.setExtraStackFrame(null);
345
345
  }
346
- function Pr(e, a, u, g, S) {
346
+ function Tr(e, i, u, p, S) {
347
347
  {
348
348
  var y = Function.call.bind(se);
349
- for (var w in e)
350
- if (y(e, w)) {
351
- var m = void 0;
349
+ for (var v in e)
350
+ if (y(e, v)) {
351
+ var b = void 0;
352
352
  try {
353
- if (typeof e[w] != "function") {
354
- var A = Error((g || "React class") + ": " + u + " type `" + w + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[w] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
355
- throw A.name = "Invariant Violation", A;
353
+ if (typeof e[v] != "function") {
354
+ var D = Error((p || "React class") + ": " + u + " type `" + v + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[v] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
355
+ throw D.name = "Invariant Violation", D;
356
356
  }
357
- m = e[w](a, w, g, u, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
358
- } catch (P) {
359
- m = P;
357
+ b = e[v](i, v, p, u, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
358
+ } catch (E) {
359
+ b = E;
360
360
  }
361
- m && !(m instanceof Error) && (ce(S), O("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", g || "React class", u, w, typeof m), ce(null)), m instanceof Error && !(m.message in Ke) && (Ke[m.message] = !0, ce(S), O("Failed %s type: %s", u, m.message), ce(null));
361
+ b && !(b instanceof Error) && (ce(S), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", p || "React class", u, v, typeof b), ce(null)), b instanceof Error && !(b.message in Ke) && (Ke[b.message] = !0, ce(S), x("Failed %s type: %s", u, b.message), ce(null));
362
362
  }
363
363
  }
364
364
  }
365
- var Er = Array.isArray;
366
- function Se(e) {
367
- return Er(e);
365
+ var Cr = Array.isArray;
366
+ function _e(e) {
367
+ return Cr(e);
368
368
  }
369
- function Cr(e) {
369
+ function zr(e) {
370
370
  {
371
- var a = typeof Symbol == "function" && Symbol.toStringTag, u = a && e[Symbol.toStringTag] || e.constructor.name || "Object";
371
+ var i = typeof Symbol == "function" && Symbol.toStringTag, u = i && e[Symbol.toStringTag] || e.constructor.name || "Object";
372
372
  return u;
373
373
  }
374
374
  }
375
- function Tr(e) {
375
+ function Ar(e) {
376
376
  try {
377
377
  return He(e), !1;
378
378
  } catch {
@@ -383,42 +383,42 @@ function ct() {
383
383
  return "" + e;
384
384
  }
385
385
  function Je(e) {
386
- if (Tr(e))
387
- return O("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Cr(e)), He(e);
386
+ if (Ar(e))
387
+ return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", zr(e)), He(e);
388
388
  }
389
- var Q = U.ReactCurrentOwner, zr = {
389
+ var Z = $.ReactCurrentOwner, Or = {
390
390
  key: !0,
391
391
  ref: !0,
392
392
  __self: !0,
393
393
  __source: !0
394
- }, Xe, Qe, _e;
395
- _e = {};
396
- function Or(e) {
394
+ }, Xe, Qe, ye;
395
+ ye = {};
396
+ function xr(e) {
397
397
  if (se.call(e, "ref")) {
398
- var a = Object.getOwnPropertyDescriptor(e, "ref").get;
399
- if (a && a.isReactWarning)
398
+ var i = Object.getOwnPropertyDescriptor(e, "ref").get;
399
+ if (i && i.isReactWarning)
400
400
  return !1;
401
401
  }
402
402
  return e.ref !== void 0;
403
403
  }
404
- function Ar(e) {
404
+ function Dr(e) {
405
405
  if (se.call(e, "key")) {
406
- var a = Object.getOwnPropertyDescriptor(e, "key").get;
407
- if (a && a.isReactWarning)
406
+ var i = Object.getOwnPropertyDescriptor(e, "key").get;
407
+ if (i && i.isReactWarning)
408
408
  return !1;
409
409
  }
410
410
  return e.key !== void 0;
411
411
  }
412
- function xr(e, a) {
413
- if (typeof e.ref == "string" && Q.current && a && Q.current.stateNode !== a) {
414
- var u = L(Q.current.type);
415
- _e[u] || (O('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', L(Q.current.type), e.ref), _e[u] = !0);
412
+ function kr(e, i) {
413
+ if (typeof e.ref == "string" && Z.current && i && Z.current.stateNode !== i) {
414
+ var u = U(Z.current.type);
415
+ ye[u] || (x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', U(Z.current.type), e.ref), ye[u] = !0);
416
416
  }
417
417
  }
418
- function kr(e, a) {
418
+ function Ir(e, i) {
419
419
  {
420
420
  var u = function() {
421
- Xe || (Xe = !0, O("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", a));
421
+ Xe || (Xe = !0, x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", i));
422
422
  };
423
423
  u.isReactWarning = !0, Object.defineProperty(e, "key", {
424
424
  get: u,
@@ -426,10 +426,10 @@ function ct() {
426
426
  });
427
427
  }
428
428
  }
429
- function Dr(e, a) {
429
+ function jr(e, i) {
430
430
  {
431
431
  var u = function() {
432
- Qe || (Qe = !0, O("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", a));
432
+ Qe || (Qe = !0, x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", i));
433
433
  };
434
434
  u.isReactWarning = !0, Object.defineProperty(e, "ref", {
435
435
  get: u,
@@ -437,70 +437,70 @@ function ct() {
437
437
  });
438
438
  }
439
439
  }
440
- var jr = function(e, a, u, g, S, y, w) {
441
- var m = {
440
+ var Fr = function(e, i, u, p, S, y, v) {
441
+ var b = {
442
442
  // This tag allows us to uniquely identify this as a React Element
443
443
  $$typeof: n,
444
444
  // Built-in properties that belong on the element
445
445
  type: e,
446
- key: a,
446
+ key: i,
447
447
  ref: u,
448
- props: w,
448
+ props: v,
449
449
  // Record the component responsible for creating this element.
450
450
  _owner: y
451
451
  };
452
- return m._store = {}, Object.defineProperty(m._store, "validated", {
452
+ return b._store = {}, Object.defineProperty(b._store, "validated", {
453
453
  configurable: !1,
454
454
  enumerable: !1,
455
455
  writable: !0,
456
456
  value: !1
457
- }), Object.defineProperty(m, "_self", {
457
+ }), Object.defineProperty(b, "_self", {
458
458
  configurable: !1,
459
459
  enumerable: !1,
460
460
  writable: !1,
461
- value: g
462
- }), Object.defineProperty(m, "_source", {
461
+ value: p
462
+ }), Object.defineProperty(b, "_source", {
463
463
  configurable: !1,
464
464
  enumerable: !1,
465
465
  writable: !1,
466
466
  value: S
467
- }), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
467
+ }), Object.freeze && (Object.freeze(b.props), Object.freeze(b)), b;
468
468
  };
469
- function Ir(e, a, u, g, S) {
469
+ function qr(e, i, u, p, S) {
470
470
  {
471
- var y, w = {}, m = null, A = null;
472
- u !== void 0 && (Je(u), m = "" + u), Ar(a) && (Je(a.key), m = "" + a.key), Or(a) && (A = a.ref, xr(a, S));
473
- for (y in a)
474
- se.call(a, y) && !zr.hasOwnProperty(y) && (w[y] = a[y]);
471
+ var y, v = {}, b = null, D = null;
472
+ u !== void 0 && (Je(u), b = "" + u), Dr(i) && (Je(i.key), b = "" + i.key), xr(i) && (D = i.ref, kr(i, S));
473
+ for (y in i)
474
+ se.call(i, y) && !Or.hasOwnProperty(y) && (v[y] = i[y]);
475
475
  if (e && e.defaultProps) {
476
- var P = e.defaultProps;
477
- for (y in P)
478
- w[y] === void 0 && (w[y] = P[y]);
476
+ var E = e.defaultProps;
477
+ for (y in E)
478
+ v[y] === void 0 && (v[y] = E[y]);
479
479
  }
480
- if (m || A) {
481
- var E = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
482
- m && kr(w, E), A && Dr(w, E);
480
+ if (b || D) {
481
+ var T = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
482
+ b && Ir(v, T), D && jr(v, T);
483
483
  }
484
- return jr(e, m, A, S, g, Q.current, w);
484
+ return Fr(e, b, D, S, p, Z.current, v);
485
485
  }
486
486
  }
487
- var ye = U.ReactCurrentOwner, Ze = U.ReactDebugCurrentFrame;
488
- function B(e) {
487
+ var Pe = $.ReactCurrentOwner, Ze = $.ReactDebugCurrentFrame;
488
+ function G(e) {
489
489
  if (e) {
490
- var a = e._owner, u = oe(e.type, e._source, a ? a.type : null);
490
+ var i = e._owner, u = oe(e.type, e._source, i ? i.type : null);
491
491
  Ze.setExtraStackFrame(u);
492
492
  } else
493
493
  Ze.setExtraStackFrame(null);
494
494
  }
495
495
  var Re;
496
496
  Re = !1;
497
- function Pe(e) {
497
+ function Ee(e) {
498
498
  return typeof e == "object" && e !== null && e.$$typeof === n;
499
499
  }
500
500
  function er() {
501
501
  {
502
- if (ye.current) {
503
- var e = L(ye.current.type);
502
+ if (Pe.current) {
503
+ var e = U(Pe.current.type);
504
504
  if (e)
505
505
  return `
506
506
 
@@ -509,163 +509,163 @@ Check the render method of \`` + e + "`.";
509
509
  return "";
510
510
  }
511
511
  }
512
- function Fr(e) {
512
+ function Lr(e) {
513
513
  {
514
514
  if (e !== void 0) {
515
- var a = e.fileName.replace(/^.*[\\\/]/, ""), u = e.lineNumber;
515
+ var i = e.fileName.replace(/^.*[\\\/]/, ""), u = e.lineNumber;
516
516
  return `
517
517
 
518
- Check your code at ` + a + ":" + u + ".";
518
+ Check your code at ` + i + ":" + u + ".";
519
519
  }
520
520
  return "";
521
521
  }
522
522
  }
523
523
  var rr = {};
524
- function qr(e) {
524
+ function Nr(e) {
525
525
  {
526
- var a = er();
527
- if (!a) {
526
+ var i = er();
527
+ if (!i) {
528
528
  var u = typeof e == "string" ? e : e.displayName || e.name;
529
- u && (a = `
529
+ u && (i = `
530
530
 
531
531
  Check the top-level render call using <` + u + ">.");
532
532
  }
533
- return a;
533
+ return i;
534
534
  }
535
535
  }
536
- function tr(e, a) {
536
+ function tr(e, i) {
537
537
  {
538
538
  if (!e._store || e._store.validated || e.key != null)
539
539
  return;
540
540
  e._store.validated = !0;
541
- var u = qr(a);
541
+ var u = Nr(i);
542
542
  if (rr[u])
543
543
  return;
544
544
  rr[u] = !0;
545
- var g = "";
546
- e && e._owner && e._owner !== ye.current && (g = " It was passed a child from " + L(e._owner.type) + "."), B(e), O('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', u, g), B(null);
545
+ var p = "";
546
+ e && e._owner && e._owner !== Pe.current && (p = " It was passed a child from " + U(e._owner.type) + "."), G(e), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', u, p), G(null);
547
547
  }
548
548
  }
549
- function nr(e, a) {
549
+ function nr(e, i) {
550
550
  {
551
551
  if (typeof e != "object")
552
552
  return;
553
- if (Se(e))
553
+ if (_e(e))
554
554
  for (var u = 0; u < e.length; u++) {
555
- var g = e[u];
556
- Pe(g) && tr(g, a);
555
+ var p = e[u];
556
+ Ee(p) && tr(p, i);
557
557
  }
558
- else if (Pe(e))
558
+ else if (Ee(e))
559
559
  e._store && (e._store.validated = !0);
560
560
  else if (e) {
561
- var S = me(e);
561
+ var S = be(e);
562
562
  if (typeof S == "function" && S !== e.entries)
563
- for (var y = S.call(e), w; !(w = y.next()).done; )
564
- Pe(w.value) && tr(w.value, a);
563
+ for (var y = S.call(e), v; !(v = y.next()).done; )
564
+ Ee(v.value) && tr(v.value, i);
565
565
  }
566
566
  }
567
567
  }
568
- function Lr(e) {
568
+ function Ur(e) {
569
569
  {
570
- var a = e.type;
571
- if (a == null || typeof a == "string")
570
+ var i = e.type;
571
+ if (i == null || typeof i == "string")
572
572
  return;
573
573
  var u;
574
- if (typeof a == "function")
575
- u = a.propTypes;
576
- else if (typeof a == "object" && (a.$$typeof === p || // Note: Memo only checks outer props here.
574
+ if (typeof i == "function")
575
+ u = i.propTypes;
576
+ else if (typeof i == "object" && (i.$$typeof === g || // Note: Memo only checks outer props here.
577
577
  // Inner props are checked in the reconciler.
578
- a.$$typeof === h))
579
- u = a.propTypes;
578
+ i.$$typeof === h))
579
+ u = i.propTypes;
580
580
  else
581
581
  return;
582
582
  if (u) {
583
- var g = L(a);
584
- Pr(u, e.props, "prop", g, e);
585
- } else if (a.PropTypes !== void 0 && !Re) {
583
+ var p = U(i);
584
+ Tr(u, e.props, "prop", p, e);
585
+ } else if (i.PropTypes !== void 0 && !Re) {
586
586
  Re = !0;
587
- var S = L(a);
588
- O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", S || "Unknown");
587
+ var S = U(i);
588
+ x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", S || "Unknown");
589
589
  }
590
- typeof a.getDefaultProps == "function" && !a.getDefaultProps.isReactClassApproved && O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
590
+ typeof i.getDefaultProps == "function" && !i.getDefaultProps.isReactClassApproved && x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
591
591
  }
592
592
  }
593
593
  function Mr(e) {
594
594
  {
595
- for (var a = Object.keys(e.props), u = 0; u < a.length; u++) {
596
- var g = a[u];
597
- if (g !== "children" && g !== "key") {
598
- B(e), O("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", g), B(null);
595
+ for (var i = Object.keys(e.props), u = 0; u < i.length; u++) {
596
+ var p = i[u];
597
+ if (p !== "children" && p !== "key") {
598
+ G(e), x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", p), G(null);
599
599
  break;
600
600
  }
601
601
  }
602
- e.ref !== null && (B(e), O("Invalid attribute `ref` supplied to `React.Fragment`."), B(null));
602
+ e.ref !== null && (G(e), x("Invalid attribute `ref` supplied to `React.Fragment`."), G(null));
603
603
  }
604
604
  }
605
- function ar(e, a, u, g, S, y) {
605
+ function ir(e, i, u, p, S, y) {
606
606
  {
607
- var w = vr(e);
608
- if (!w) {
609
- var m = "";
610
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (m += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
611
- var A = Fr(S);
612
- A ? m += A : m += er();
613
- var P;
614
- e === null ? P = "null" : Se(e) ? P = "array" : e !== void 0 && e.$$typeof === n ? (P = "<" + (L(e.type) || "Unknown") + " />", m = " Did you accidentally export a JSX literal instead of a component?") : P = typeof e, O("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", P, m);
607
+ var v = wr(e);
608
+ if (!v) {
609
+ var b = "";
610
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (b += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
611
+ var D = Lr(S);
612
+ D ? b += D : b += er();
613
+ var E;
614
+ e === null ? E = "null" : _e(e) ? E = "array" : e !== void 0 && e.$$typeof === n ? (E = "<" + (U(e.type) || "Unknown") + " />", b = " Did you accidentally export a JSX literal instead of a component?") : E = typeof e, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", E, b);
615
615
  }
616
- var E = Ir(e, a, u, S, y);
617
- if (E == null)
618
- return E;
619
- if (w) {
620
- var F = a.children;
616
+ var T = qr(e, i, u, S, y);
617
+ if (T == null)
618
+ return T;
619
+ if (v) {
620
+ var F = i.children;
621
621
  if (F !== void 0)
622
- if (g)
623
- if (Se(F)) {
624
- for (var K = 0; K < F.length; K++)
625
- nr(F[K], e);
622
+ if (p)
623
+ if (_e(F)) {
624
+ for (var H = 0; H < F.length; H++)
625
+ nr(F[H], e);
626
626
  Object.freeze && Object.freeze(F);
627
627
  } else
628
- O("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
628
+ x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
629
629
  else
630
630
  nr(F, e);
631
631
  }
632
- return e === o ? Mr(E) : Lr(E), E;
632
+ return e === a ? Mr(T) : Ur(T), T;
633
633
  }
634
634
  }
635
- function Nr(e, a, u) {
636
- return ar(e, a, u, !0);
635
+ function Vr(e, i, u) {
636
+ return ir(e, i, u, !0);
637
637
  }
638
- function Ur(e, a, u) {
639
- return ar(e, a, u, !1);
638
+ function $r(e, i, u) {
639
+ return ir(e, i, u, !1);
640
640
  }
641
- var Vr = Ur, $r = Nr;
642
- re.Fragment = o, re.jsx = Vr, re.jsxs = $r;
641
+ var Wr = $r, Yr = Vr;
642
+ re.Fragment = a, re.jsx = Wr, re.jsxs = Yr;
643
643
  }()), re;
644
644
  }
645
645
  (function(t) {
646
- process.env.NODE_ENV === "production" ? t.exports = st() : t.exports = ct();
647
- })(ot);
648
- const N = te.Fragment, r = te.jsx, v = te.jsxs;
649
- function lt(t) {
646
+ process.env.NODE_ENV === "production" ? t.exports = dt() : t.exports = ft();
647
+ })(ut);
648
+ const L = ne.Fragment, r = ne.jsx, m = ne.jsxs;
649
+ function pt(t) {
650
650
  t = t || {};
651
- const n = Object.keys(t).sort(), i = [];
652
- for (let o = 0; o < n.length; o++) {
653
- const l = n[o];
654
- if (l != "authentication" && t[l])
655
- i.push(n[o] + "=" + (typeof t[l] == "object" ? JSON.stringify(t[l]) : t[l]));
651
+ const n = Object.keys(t).sort(), o = [];
652
+ for (let a = 0; a < n.length; a++) {
653
+ const c = n[a];
654
+ if (c != "authentication" && t[c])
655
+ o.push(n[a] + "=" + (typeof t[c] == "object" ? JSON.stringify(t[c]) : t[c]));
656
656
  else {
657
- const s = Object.keys(t[l]).sort();
658
- for (let c = 0; c < s.length; c++) {
659
- const d = s[c];
660
- d != "sign" && t[l][d] && i.push(s[c] + "=" + (typeof t[l][d] == "object" ? JSON.stringify(t[l][d]) : t[l][d]));
657
+ const s = Object.keys(t[c]).sort();
658
+ for (let l = 0; l < s.length; l++) {
659
+ const d = s[l];
660
+ d != "sign" && t[c][d] && o.push(s[l] + "=" + (typeof t[c][d] == "object" ? JSON.stringify(t[c][d]) : t[c][d]));
661
661
  }
662
662
  }
663
663
  }
664
- return i.sort().join("&");
664
+ return o.sort().join("&");
665
665
  }
666
- function ut(t, n) {
667
- let i = lt(t);
668
- return i += "&key=" + n, rt.MD5(i).toString().toUpperCase();
666
+ function gt(t, n) {
667
+ let o = pt(t);
668
+ return o += "&key=" + n, tt.MD5(o).toString().toUpperCase();
669
669
  }
670
670
  const C = {
671
671
  baseURL: "http://localhost:31200",
@@ -678,7 +678,7 @@ const C = {
678
678
  return {
679
679
  app_id: this.app_id,
680
680
  nonce_str: n,
681
- sign: ut({
681
+ sign: gt({
682
682
  app_id: this.app_id,
683
683
  nonce_str: n,
684
684
  ...t
@@ -686,33 +686,33 @@ const C = {
686
686
  };
687
687
  },
688
688
  getRequest(t) {
689
- return (n, i, o = {}) => {
690
- const l = window.localStorage.getItem("token"), s = {
689
+ return (n, o, a = {}) => {
690
+ const c = window.localStorage.getItem("token"), s = {
691
691
  "X-Requested-With": "XMLHttpRequest",
692
- "Content-Type": o.string ? "application/x-www-form-urlencoded" : "application/json",
693
- authorization: l ? `bearer ${l}` : "",
694
- ...o.headers
695
- }, c = {
692
+ "Content-Type": a.string ? "application/x-www-form-urlencoded" : "application/json",
693
+ authorization: c ? `bearer ${c}` : "",
694
+ ...a.headers
695
+ }, l = {
696
696
  baseURL: this.baseURL,
697
697
  method: t,
698
698
  url: n,
699
- params: t === "GET" ? i : o.params,
699
+ params: t === "GET" ? o : a.params,
700
700
  headers: s
701
701
  };
702
- return ["POST", "PUT"].includes(t) && (c.data = o.string ? JSON.stringify(i) : i, c.data.authentication = this.getAuthentication(c.data)), et(c).then((d) => d.data).catch((d) => tt.has(d, "response.data.detail.message") ? Promise.reject(new Error(d.response.data.detail.message)) : Promise.reject(d));
702
+ return ["POST", "PUT"].includes(t) && (l.data = a.string ? JSON.stringify(o) : o, l.data.authentication = this.getAuthentication(l.data)), rt(l).then((d) => d.data).catch((d) => nt.has(d, "response.data.detail.message") ? Promise.reject(new Error(d.response.data.detail.message)) : Promise.reject(d));
703
703
  };
704
704
  }
705
705
  };
706
- function pe(t) {
706
+ function ge(t) {
707
707
  C.baseURL !== t.apiBaseURL && (C.baseURL = t.apiBaseURL), t.app_id && (C.app_id = t.app_id), t.app_secret && (C.app_secret = t.app_secret);
708
708
  }
709
- const dt = {
709
+ const mt = {
710
710
  login: async (t, n) => {
711
- const i = {
711
+ const o = {
712
712
  name: t,
713
713
  password: n
714
714
  };
715
- return await C.getRequest("POST")("/account/login", i);
715
+ return await C.getRequest("POST")("/account/login", o);
716
716
  },
717
717
  list: async () => await C.getRequest("POST")("/account/list", {
718
718
  filter: {},
@@ -733,27 +733,27 @@ const dt = {
733
733
  * update current account
734
734
  */
735
735
  update: async (t, n) => {
736
- const i = {
737
- name: t,
738
- email: n
736
+ const o = {
737
+ name: t.trim(),
738
+ email: n.trim()
739
739
  };
740
- return await C.getRequest("PUT")("/account/update", i);
740
+ return await C.getRequest("PUT")("/account/update", o);
741
741
  },
742
742
  /**
743
743
  * change current account's password
744
744
  */
745
745
  changepassword: async (t, n) => {
746
- const i = {
747
- old_password: t,
748
- new_password: n
746
+ const o = {
747
+ old_password: t.trim(),
748
+ new_password: n.trim()
749
749
  };
750
- return await C.getRequest("POST")("/account/changepassword", i);
750
+ return await C.getRequest("POST")("/account/changepassword", o);
751
751
  },
752
- create: async (t, n, i, o) => await C.getRequest("POST")("/account/create", {
753
- name: t,
754
- email: n,
755
- password: i,
756
- role_id: o
752
+ create: async (t, n, o, a) => await C.getRequest("POST")("/account/create", {
753
+ name: t.trim(),
754
+ email: n.trim(),
755
+ password: o.trim(),
756
+ role_id: a
757
757
  }),
758
758
  edit: async (t) => (t.reset_password || (t.new_password = void 0), await C.getRequest("PUT")("/account/edit", t)),
759
759
  delete: async (t) => {
@@ -762,7 +762,7 @@ const dt = {
762
762
  id: t
763
763
  });
764
764
  }
765
- }, ft = {
765
+ }, ht = {
766
766
  list: async () => await C.getRequest("POST")("/api/key/list", {
767
767
  filter: {
768
768
  search: ""
@@ -786,7 +786,7 @@ const dt = {
786
786
  id: t
787
787
  });
788
788
  }
789
- }, pt = {
789
+ }, bt = {
790
790
  list: async () => await C.getRequest("POST")("/datasource/list", {
791
791
  filter: {},
792
792
  sort: [{
@@ -798,42 +798,46 @@ const dt = {
798
798
  pagesize: 100
799
799
  }
800
800
  }),
801
- create: async (t, n, i) => await C.getRequest("POST")("/datasource/create", {
801
+ create: async (t, n, o) => await C.getRequest("POST")("/datasource/create", {
802
802
  type: t,
803
803
  key: n,
804
- config: i
804
+ config: o
805
+ }),
806
+ update: async (t, n) => await C.getRequest("PUT")("/datasource/update", {
807
+ id: t,
808
+ config: n
805
809
  }),
806
810
  delete: async (t) => {
807
811
  await C.getRequest("POST")("/datasource/delete", {
808
812
  id: t
809
813
  });
810
814
  }
811
- }, gt = {
815
+ }, vt = {
812
816
  list: async () => await C.getRequest("GET")("/role/list", {})
813
- }, j = {
814
- datasource: pt,
815
- account: dt,
816
- role: gt,
817
- api_key: ft
818
- }, Y = {
817
+ }, k = {
818
+ datasource: bt,
819
+ account: mt,
820
+ role: vt,
821
+ api_key: ht
822
+ }, N = {
819
823
  size: "sm",
820
824
  spacing: "md",
821
825
  button: {
822
826
  size: "xs"
823
827
  }
824
828
  };
825
- function ht({
829
+ function wt({
826
830
  submit: t,
827
- styles: n = Y,
828
- type: i
831
+ styles: n = N,
832
+ type: o
829
833
  }) {
830
834
  const {
831
- control: o,
832
- setValue: l,
835
+ control: a,
836
+ setValue: c,
833
837
  handleSubmit: s
834
- } = J({
838
+ } = K({
835
839
  defaultValues: {
836
- type: i,
840
+ type: o,
837
841
  key: "",
838
842
  config: {
839
843
  host: "",
@@ -844,79 +848,79 @@ function ht({
844
848
  }
845
849
  }
846
850
  });
847
- return Te(() => {
848
- l("type", i);
849
- }, [l, i]), /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: s(t), children: [
850
- /* @__PURE__ */ r(R, { name: "key", control: o, render: ({
851
- field: c
852
- }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Name", placeholder: "A unique name", ...c }) }),
853
- /* @__PURE__ */ r(Oe, { label: "Connection Info", labelPosition: "center" }),
854
- /* @__PURE__ */ v(z, { grow: !0, children: [
855
- /* @__PURE__ */ r(R, { name: "config.host", control: o, render: ({
856
- field: c
857
- }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Host", sx: {
851
+ return ze(() => {
852
+ c("type", o);
853
+ }, [c, o]), /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ m("form", { onSubmit: s(t), children: [
854
+ /* @__PURE__ */ r(P, { name: "key", control: a, render: ({
855
+ field: l
856
+ }) => /* @__PURE__ */ r(O, { mb: n.spacing, size: n.size, required: !0, label: "Name", placeholder: "A unique name", ...l }) }),
857
+ /* @__PURE__ */ r(de, { label: "Connection Info", labelPosition: "center" }),
858
+ /* @__PURE__ */ m(z, { grow: !0, children: [
859
+ /* @__PURE__ */ r(P, { name: "config.host", control: a, render: ({
860
+ field: l
861
+ }) => /* @__PURE__ */ r(O, { mb: n.spacing, size: n.size, required: !0, label: "Host", sx: {
858
862
  flexGrow: 1
859
- }, ...c }) }),
860
- /* @__PURE__ */ r(R, { name: "config.port", control: o, render: ({
861
- field: c
862
- }) => /* @__PURE__ */ r(Wr, { mb: n.spacing, size: n.size, required: !0, label: "Port", hideControls: !0, sx: {
863
+ }, ...l }) }),
864
+ /* @__PURE__ */ r(P, { name: "config.port", control: a, render: ({
865
+ field: l
866
+ }) => /* @__PURE__ */ r(Br, { mb: n.spacing, size: n.size, required: !0, label: "Port", hideControls: !0, sx: {
863
867
  width: "8em"
864
- }, ...c }) })
868
+ }, ...l }) })
865
869
  ] }),
866
- /* @__PURE__ */ r(R, { name: "config.username", control: o, render: ({
867
- field: c
868
- }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...c }) }),
869
- /* @__PURE__ */ r(R, { name: "config.password", control: o, render: ({
870
- field: c
871
- }) => /* @__PURE__ */ r(de, { mb: n.spacing, size: n.size, required: !0, label: "Password", ...c }) }),
872
- /* @__PURE__ */ r(R, { name: "config.database", control: o, render: ({
873
- field: c
874
- }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Database", ...c }) }),
875
- /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: n.button.size, children: "Save" }) })
870
+ /* @__PURE__ */ r(P, { name: "config.username", control: a, render: ({
871
+ field: l
872
+ }) => /* @__PURE__ */ r(O, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...l }) }),
873
+ /* @__PURE__ */ r(P, { name: "config.password", control: a, render: ({
874
+ field: l
875
+ }) => /* @__PURE__ */ r(fe, { mb: n.spacing, size: n.size, required: !0, label: "Password", ...l }) }),
876
+ /* @__PURE__ */ r(P, { name: "config.database", control: a, render: ({
877
+ field: l
878
+ }) => /* @__PURE__ */ r(O, { mb: n.spacing, size: n.size, required: !0, label: "Database", ...l }) }),
879
+ /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(R, { type: "submit", size: n.button.size, children: "Save" }) })
876
880
  ] }) });
877
881
  }
878
- const mt = ({
882
+ const St = ({
879
883
  value: t,
880
884
  onChange: n
881
885
  }) => /* @__PURE__ */ r(I, { sx: {
882
886
  position: "relative"
883
- }, children: /* @__PURE__ */ r(at, { height: "500px", defaultLanguage: "javascript", value: t, onChange: (o) => {
884
- o && n(o);
887
+ }, children: /* @__PURE__ */ r(at, { height: "500px", defaultLanguage: "javascript", value: t, onChange: (a) => {
888
+ a && n(a);
885
889
  }, theme: "vs-dark", options: {
886
890
  minimap: {
887
891
  enabled: !1
888
892
  }
889
- } }) }), cr = ze(({
893
+ } }) }), ue = Ae(({
890
894
  value: t,
891
895
  onChange: n,
892
- label: i,
893
- modalTitle: o,
894
- defaultValue: l,
896
+ label: o,
897
+ modalTitle: a,
898
+ defaultValue: c,
895
899
  styles: s
896
- }, c) => {
900
+ }, l) => {
897
901
  const [d, {
898
- setTrue: p,
899
- setFalse: b
900
- }] = nt(), [f, h] = lr(t), _ = () => {
901
- b(), n(f);
902
- }, k = () => {
903
- b(), h(t);
902
+ setTrue: g,
903
+ setFalse: w
904
+ }] = it(), [f, h] = ur(t), _ = () => {
905
+ w(), n(f);
906
+ }, j = () => {
907
+ w(), h(t);
904
908
  }, q = () => {
905
- h(l);
909
+ h(c);
906
910
  };
907
- return Te(() => {
911
+ return ze(() => {
908
912
  h(t);
909
- }, [t]), /* @__PURE__ */ v(N, { children: [
910
- /* @__PURE__ */ r(T, { variant: "filled", size: s.button.size, onClick: p, sx: {
913
+ }, [t]), /* @__PURE__ */ m(L, { children: [
914
+ /* @__PURE__ */ r(R, { variant: "filled", size: s.button.size, onClick: g, sx: {
911
915
  flexGrow: 1
912
- }, children: i }),
913
- /* @__PURE__ */ r(ne, { size: 800, title: o, opened: d, onClose: b, closeOnClickOutside: !1, withCloseButton: !1, children: d && /* @__PURE__ */ v(Ae, { children: [
914
- /* @__PURE__ */ r(mt, { value: f, onChange: h }),
915
- /* @__PURE__ */ v(z, { position: "apart", children: [
916
- /* @__PURE__ */ r(T, { onClick: q, color: "red", leftIcon: /* @__PURE__ */ r(Xr, { size: 20 }), children: "Rest" }),
917
- /* @__PURE__ */ v(z, { position: "right", children: [
918
- /* @__PURE__ */ r(T, { onClick: k, variant: "subtle", children: "Cancel" }),
919
- /* @__PURE__ */ r(T, { onClick: _, children: "OK" })
916
+ }, children: o }),
917
+ /* @__PURE__ */ r(X, { size: 800, title: a, opened: d, onClose: w, closeOnClickOutside: !1, withCloseButton: !1, children: d && /* @__PURE__ */ m(Oe, { children: [
918
+ /* @__PURE__ */ r(St, { value: f, onChange: h }),
919
+ /* @__PURE__ */ m(z, { position: "apart", children: [
920
+ /* @__PURE__ */ r(R, { onClick: q, color: "red", leftIcon: /* @__PURE__ */ r(Qr, { size: 20 }), children: "Rest" }),
921
+ /* @__PURE__ */ m(z, { position: "right", children: [
922
+ /* @__PURE__ */ r(R, { onClick: j, variant: "subtle", children: "Cancel" }),
923
+ /* @__PURE__ */ r(R, { onClick: _, children: "OK" })
920
924
  ] })
921
925
  ] })
922
926
  ] }) })
@@ -927,15 +931,15 @@ const mt = ({
927
931
  post: ["function post_process(res, utils) {", " // your code goes here", " return data", "}"].join(`
928
932
  `)
929
933
  };
930
- function vt({
934
+ function _t({
931
935
  submit: t,
932
- styles: n = Y
936
+ styles: n = N
933
937
  }) {
934
938
  const {
935
- control: i,
936
- setValue: o,
937
- handleSubmit: l
938
- } = J({
939
+ control: o,
940
+ setValue: a,
941
+ handleSubmit: c
942
+ } = K({
939
943
  defaultValues: {
940
944
  type: "http",
941
945
  key: "",
@@ -948,44 +952,44 @@ function vt({
948
952
  }
949
953
  }
950
954
  });
951
- return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: l(t), children: [
952
- /* @__PURE__ */ r(R, { name: "key", control: i, render: ({
955
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ m("form", { onSubmit: c(t), children: [
956
+ /* @__PURE__ */ r(P, { name: "key", control: o, render: ({
953
957
  field: s
954
- }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Name", placeholder: "A unique name", ...s }) }),
955
- /* @__PURE__ */ r(Oe, { label: "Connection Info", labelPosition: "center" }),
956
- /* @__PURE__ */ r(R, { name: "config.host", control: i, render: ({
958
+ }) => /* @__PURE__ */ r(O, { mb: n.spacing, size: n.size, required: !0, label: "Name", placeholder: "A unique name", ...s }) }),
959
+ /* @__PURE__ */ r(de, { label: "Connection Info", labelPosition: "center" }),
960
+ /* @__PURE__ */ r(P, { name: "config.host", control: o, render: ({
957
961
  field: s
958
- }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Base URL", sx: {
962
+ }) => /* @__PURE__ */ r(O, { mb: n.spacing, size: n.size, required: !0, label: "Base URL", sx: {
959
963
  flexGrow: 1
960
964
  }, ...s }) }),
961
- /* @__PURE__ */ v(z, { grow: !0, children: [
962
- /* @__PURE__ */ r(R, { name: "config.processing.pre", control: i, render: ({
965
+ /* @__PURE__ */ m(z, { grow: !0, children: [
966
+ /* @__PURE__ */ r(P, { name: "config.processing.pre", control: o, render: ({
963
967
  field: s
964
- }) => /* @__PURE__ */ r(cr, { label: "Pre Processing", modalTitle: "This function will run before sending the request (for scenarios like encryption)", defaultValue: le.pre, ...s, styles: n }) }),
965
- /* @__PURE__ */ r(R, { name: "config.processing.post", control: i, render: ({
968
+ }) => /* @__PURE__ */ r(ue, { label: "Pre Processing", modalTitle: "This function will run before sending the request (for scenarios like encryption)", defaultValue: le.pre, ...s, styles: n }) }),
969
+ /* @__PURE__ */ r(P, { name: "config.processing.post", control: o, render: ({
966
970
  field: s
967
- }) => /* @__PURE__ */ r(cr, { label: "Post Processing", modalTitle: "This function will run after sending the request (for scenarios like decryption)", defaultValue: le.post, ...s, styles: n }) })
971
+ }) => /* @__PURE__ */ r(ue, { label: "Post Processing", modalTitle: "This function will run after sending the request (for scenarios like decryption)", defaultValue: le.post, ...s, styles: n }) })
968
972
  ] }),
969
- /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: n.button.size, children: "Save" }) })
973
+ /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(R, { type: "submit", size: n.button.size, children: "Save" }) })
970
974
  ] }) });
971
975
  }
972
- function bt({
973
- styles: t = Y
976
+ function yt({
977
+ styles: t = N
974
978
  }) {
975
- return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v(Yr, { mt: t.spacing, icon: /* @__PURE__ */ r(Qr, { size: 16 }), children: [
979
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ m(Kr, { mt: t.spacing, icon: /* @__PURE__ */ r(Zr, { size: 16 }), children: [
976
980
  "Only ",
977
981
  /* @__PURE__ */ r("b", { children: "SELECT" }),
978
982
  " privilege is needed."
979
983
  ] }) });
980
984
  }
981
- function wt({
985
+ function Pt({
982
986
  postSubmit: t,
983
- styles: n = Y
987
+ styles: n = N
984
988
  }) {
985
- const [i, o] = lr("postgresql"), l = async ({
989
+ const [o, a] = ur("postgresql"), c = async ({
986
990
  type: d,
987
- key: p,
988
- config: b
991
+ key: g,
992
+ config: w
989
993
  }) => {
990
994
  V({
991
995
  id: "for-creating",
@@ -996,25 +1000,25 @@ function wt({
996
1000
  try {
997
1001
  console.log({
998
1002
  type: d,
999
- key: p,
1000
- config: b
1001
- }), await j.datasource.create(d, p, b), x({
1003
+ key: g,
1004
+ config: w
1005
+ }), await k.datasource.create(d, g, w), A({
1002
1006
  id: "for-creating",
1003
1007
  title: "Successful",
1004
1008
  message: "Data source is added",
1005
1009
  color: "green"
1006
1010
  }), t();
1007
1011
  } catch (f) {
1008
- x({
1012
+ A({
1009
1013
  id: "for-creating",
1010
1014
  title: "Failed",
1011
1015
  message: f.message,
1012
1016
  color: "red"
1013
1017
  });
1014
1018
  }
1015
- }, s = i === "postgresql" || i === "mysql", c = i === "http";
1016
- return /* @__PURE__ */ v(I, { mx: "auto", children: [
1017
- /* @__PURE__ */ r(Br, { fullWidth: !0, mb: n.spacing, size: n.size, data: [{
1019
+ }, s = o === "postgresql" || o === "mysql", l = o === "http";
1020
+ return /* @__PURE__ */ m(I, { mx: "auto", children: [
1021
+ /* @__PURE__ */ r(Gr, { fullWidth: !0, mb: n.spacing, size: n.size, data: [{
1018
1022
  label: "PostgreSQL",
1019
1023
  value: "postgresql"
1020
1024
  }, {
@@ -1023,168 +1027,265 @@ function wt({
1023
1027
  }, {
1024
1028
  label: "HTTP",
1025
1029
  value: "http"
1026
- }], value: i, onChange: (d) => o(d) }),
1027
- s && /* @__PURE__ */ r(bt, { styles: n }),
1028
- s && /* @__PURE__ */ r(ht, { submit: l, styles: n, type: i }),
1029
- c && /* @__PURE__ */ r(vt, { submit: l, styles: n })
1030
+ }], value: o, onChange: (d) => a(d) }),
1031
+ s && /* @__PURE__ */ r(yt, { styles: n }),
1032
+ s && /* @__PURE__ */ r(wt, { submit: c, styles: n, type: o }),
1033
+ l && /* @__PURE__ */ r(_t, { submit: c, styles: n })
1030
1034
  ] });
1031
1035
  }
1032
- function St({
1036
+ function Rt({
1033
1037
  onSuccess: t,
1034
- styles: n = Y
1038
+ styles: n = N
1035
1039
  }) {
1036
- const [i, o] = H.useState(!1), l = () => o(!0), s = () => o(!1);
1037
- return /* @__PURE__ */ v(N, { children: [
1038
- /* @__PURE__ */ r(ne, { overflow: "inside", opened: i, onClose: () => o(!1), title: "Add a data source", trapFocus: !0, onDragStart: (d) => {
1040
+ const [o, a] = B.useState(!1), c = () => a(!0), s = () => a(!1);
1041
+ return /* @__PURE__ */ m(L, { children: [
1042
+ /* @__PURE__ */ r(X, { overflow: "inside", opened: o, onClose: () => a(!1), title: "Add a data source", trapFocus: !0, onDragStart: (d) => {
1039
1043
  d.stopPropagation();
1040
- }, children: /* @__PURE__ */ r(wt, { postSubmit: () => {
1044
+ }, children: /* @__PURE__ */ r(Pt, { postSubmit: () => {
1041
1045
  t(), s();
1042
1046
  }, styles: n }) }),
1043
- /* @__PURE__ */ r(T, { size: n.button.size, onClick: l, leftIcon: /* @__PURE__ */ r(De, { size: 20 }), children: "Add a Data Source" })
1047
+ /* @__PURE__ */ r(R, { size: n.button.size, onClick: c, leftIcon: /* @__PURE__ */ r(ke, { size: 20 }), children: "Add a Data Source" })
1044
1048
  ] });
1045
1049
  }
1046
- const _t = (t) => t.replace(/([^:])(\/\/+)/g, "$1/");
1047
- function yt(t) {
1048
- Te(() => {
1049
- if (Ee.__getMonacoInstance())
1050
+ const Et = (t) => t.replace(/([^:])(\/\/+)/g, "$1/");
1051
+ function Tt(t) {
1052
+ ze(() => {
1053
+ if (Te.__getMonacoInstance())
1050
1054
  return;
1051
1055
  console.log("loading monaco for @devtable/settings-form");
1052
- const i = _t(t);
1053
- Ee.config({
1056
+ const o = Et(t);
1057
+ Te.config({
1054
1058
  paths: {
1055
- vs: i
1059
+ vs: o
1056
1060
  }
1057
- }), Ee.init().then((o) => console.log("monaco instance:", o));
1061
+ }), Te.init().then((a) => console.log("monaco instance:", a));
1058
1062
  }, []);
1059
1063
  }
1060
- function Ce() {
1061
- return Ce = Object.assign ? Object.assign.bind() : function(t) {
1062
- for (var n = 1; n < arguments.length; n++) {
1063
- var i = arguments[n];
1064
- for (var o in i)
1065
- Object.prototype.hasOwnProperty.call(i, o) && (t[o] = i[o]);
1066
- }
1067
- return t;
1068
- }, Ce.apply(this, arguments);
1069
- }
1070
- function Rt(t, n) {
1071
- if (t == null)
1072
- return {};
1073
- var i, o, l = function(c, d) {
1074
- if (c == null)
1075
- return {};
1076
- var p, b, f = {}, h = Object.keys(c);
1077
- for (b = 0; b < h.length; b++)
1078
- p = h[b], d.indexOf(p) >= 0 || (f[p] = c[p]);
1079
- return f;
1080
- }(t, n);
1081
- if (Object.getOwnPropertySymbols) {
1082
- var s = Object.getOwnPropertySymbols(t);
1083
- for (o = 0; o < s.length; o++)
1084
- i = s[o], n.indexOf(i) >= 0 || Object.prototype.propertyIsEnumerable.call(t, i) && (l[i] = t[i]);
1085
- }
1086
- return l;
1087
- }
1088
- var Pt = ["size", "color", "stroke"];
1089
- function Et(t) {
1090
- var n = t.size, i = n === void 0 ? 24 : n, o = t.color, l = o === void 0 ? "currentColor" : o, s = t.stroke, c = s === void 0 ? 2 : s, d = Rt(t, Pt);
1091
- return Z.createElement("svg", Ce({ xmlns: "http://www.w3.org/2000/svg", className: "icon icon-tabler icon-tabler-lock", width: i, height: i, viewBox: "0 0 24 24", strokeWidth: c, stroke: l, fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, d), Z.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), Z.createElement("rect", { x: 5, y: 11, width: 14, height: 10, rx: 2 }), Z.createElement("circle", { cx: 12, cy: 16, r: 1 }), Z.createElement("path", { d: "M8 11v-4a4 4 0 0 1 8 0v4" }));
1092
- }
1093
1064
  function Ct({
1094
1065
  id: t,
1095
1066
  name: n,
1096
- isProtected: i,
1097
- onSuccess: o,
1098
- styles: l = Y
1067
+ isProtected: o,
1068
+ onSuccess: a,
1069
+ styles: c = N
1099
1070
  }) {
1100
- const s = fe(), c = async () => {
1071
+ const s = pe(), l = async () => {
1101
1072
  t && (V({
1102
1073
  id: "for-deleting",
1103
1074
  title: "Pending",
1104
1075
  message: "Deleting data source...",
1105
1076
  loading: !0
1106
- }), await j.datasource.delete(t), x({
1077
+ }), await k.datasource.delete(t), A({
1107
1078
  id: "for-deleting",
1108
1079
  title: "Successful",
1109
1080
  message: `Data source [${n}] is deleted`,
1110
1081
  color: "green"
1111
- }), o());
1082
+ }), a());
1112
1083
  }, d = () => s.openConfirmModal({
1113
1084
  title: "Delete this data source?",
1114
- children: /* @__PURE__ */ r(ue, { size: l.size, children: "This action won't affect your database." }),
1085
+ children: /* @__PURE__ */ r(te, { size: c.size, children: "This action won't affect your database." }),
1115
1086
  labels: {
1116
1087
  confirm: "Confirm",
1117
1088
  cancel: "Cancel"
1118
1089
  },
1119
1090
  onCancel: () => console.log("Cancel"),
1120
- onConfirm: c
1121
- }), p = Kr();
1122
- return i ? /* @__PURE__ */ r(Gr, { withArrow: !0, events: {
1091
+ onConfirm: l
1092
+ });
1093
+ return o ? /* @__PURE__ */ r(Ce, { withArrow: !0, events: {
1094
+ hover: !0,
1095
+ touch: !1,
1096
+ focus: !1
1097
+ }, label: "This is a preset datasource, it can not be deleted", children: /* @__PURE__ */ r(R, { size: c.button.size, color: "gray", variant: "light", leftIcon: /* @__PURE__ */ r(fr, { size: 16 }), sx: {
1098
+ transform: "none !important"
1099
+ }, children: "Delete" }) }) : /* @__PURE__ */ r(R, { size: c.button.size, color: "red", onClick: d, leftIcon: /* @__PURE__ */ r(Ie, { size: 16 }), children: "Delete" });
1100
+ }
1101
+ const lr = {
1102
+ pre: ["function pre_process({ method, url, params, headers, data }, utils) {", " // your code goes here", " return { method, url, params, headers, data }", "}"].join(`
1103
+ `),
1104
+ post: ["function post_process(res, utils) {", " // your code goes here", " return data", "}"].join(`
1105
+ `)
1106
+ };
1107
+ function zt({
1108
+ name: t,
1109
+ config: n,
1110
+ submit: o,
1111
+ styles: a = N
1112
+ }) {
1113
+ const {
1114
+ control: c,
1115
+ handleSubmit: s
1116
+ } = K({
1117
+ defaultValues: {
1118
+ config: n
1119
+ }
1120
+ });
1121
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ m("form", { onSubmit: s(o), children: [
1122
+ /* @__PURE__ */ r(O, { mb: a.spacing, size: a.size, required: !0, label: "Name", value: t, readOnly: !0 }),
1123
+ /* @__PURE__ */ r(de, { label: "Connection Info", labelPosition: "center" }),
1124
+ /* @__PURE__ */ r(P, { name: "config.host", control: c, render: ({
1125
+ field: l
1126
+ }) => /* @__PURE__ */ r(O, { mb: a.spacing, size: a.size, required: !0, label: "Base URL", sx: {
1127
+ flexGrow: 1
1128
+ }, ...l }) }),
1129
+ /* @__PURE__ */ m(z, { grow: !0, children: [
1130
+ /* @__PURE__ */ r(P, { name: "config.processing.pre", control: c, render: ({
1131
+ field: l
1132
+ }) => /* @__PURE__ */ r(ue, { label: "Pre Processing", modalTitle: "This function will run before sending the request (for scenarios like encryption)", defaultValue: lr.pre, ...l, styles: a }) }),
1133
+ /* @__PURE__ */ r(P, { name: "config.processing.post", control: c, render: ({
1134
+ field: l
1135
+ }) => /* @__PURE__ */ r(ue, { label: "Post Processing", modalTitle: "This function will run after sending the request (for scenarios like decryption)", defaultValue: lr.post, ...l, styles: a }) })
1136
+ ] }),
1137
+ /* @__PURE__ */ r(z, { position: "right", mt: a.spacing, children: /* @__PURE__ */ r(R, { type: "submit", size: a.button.size, children: "Save" }) })
1138
+ ] }) });
1139
+ }
1140
+ function At({
1141
+ dataSource: t,
1142
+ postSubmit: n,
1143
+ styles: o = N
1144
+ }) {
1145
+ const a = async ({
1146
+ config: c
1147
+ }) => {
1148
+ V({
1149
+ id: "for-updating",
1150
+ title: "Pending",
1151
+ message: "Editing data source...",
1152
+ loading: !0
1153
+ });
1154
+ try {
1155
+ console.log({
1156
+ config: c
1157
+ }), await k.datasource.update(t.id, c), A({
1158
+ id: "for-updating",
1159
+ title: "Successful",
1160
+ message: "Data source is updated",
1161
+ color: "green"
1162
+ }), n();
1163
+ } catch (s) {
1164
+ A({
1165
+ id: "for-updating",
1166
+ title: "Failed",
1167
+ message: s.message,
1168
+ color: "red"
1169
+ });
1170
+ }
1171
+ };
1172
+ return t.config ? /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ r(zt, { name: t.key, config: t.config, submit: a, styles: o }) }) : (console.error(new Error("unexpected empty config of a http datasource")), null);
1173
+ }
1174
+ function Ot({
1175
+ dataSource: t,
1176
+ onSuccess: n,
1177
+ styles: o = N
1178
+ }) {
1179
+ const [a, c] = B.useState(!1), s = () => c(!0), l = () => c(!1), d = () => {
1180
+ n(), l();
1181
+ };
1182
+ return t.is_preset ? /* @__PURE__ */ r(Ce, { withArrow: !0, events: {
1183
+ hover: !0,
1184
+ touch: !1,
1185
+ focus: !1
1186
+ }, label: "This is a preset datasource, it can not be changed", children: /* @__PURE__ */ r(R, { size: o.button.size, color: "gray", variant: "light", leftIcon: /* @__PURE__ */ r(fr, { size: 16 }), sx: {
1187
+ transform: "none !important"
1188
+ }, children: "Edit" }) }) : t.type !== "http" ? /* @__PURE__ */ r(Ce, { withArrow: !0, events: {
1123
1189
  hover: !0,
1124
1190
  touch: !1,
1125
1191
  focus: !1
1126
- }, label: "This is a preset datasource, it can not be deleted", children: /* @__PURE__ */ r("span", { children: /* @__PURE__ */ r(Et, { size: 16, color: p.colors.gray[7] }) }) }) : /* @__PURE__ */ r(T, { size: l.button.size, color: "red", onClick: d, leftIcon: /* @__PURE__ */ r(je, { size: 20 }), children: "Delete" });
1192
+ }, label: "Only HTTP datasources can be edited", children: /* @__PURE__ */ r(R, { size: o.button.size, color: "gray", variant: "light", leftIcon: /* @__PURE__ */ r(or, { size: 16 }), sx: {
1193
+ transform: "none !important"
1194
+ }, children: "Edit" }) }) : /* @__PURE__ */ m(L, { children: [
1195
+ /* @__PURE__ */ r(X, { overflow: "inside", opened: a, onClose: () => c(!1), title: "Add a data source", trapFocus: !0, onDragStart: (g) => {
1196
+ g.stopPropagation();
1197
+ }, children: /* @__PURE__ */ r(At, { dataSource: t, postSubmit: d, styles: o }) }),
1198
+ /* @__PURE__ */ r(R, { size: o.button.size, color: "blue", onClick: s, leftIcon: /* @__PURE__ */ r(or, { size: 16 }), children: "Edit" })
1199
+ ] });
1127
1200
  }
1128
- function Gt({
1129
- styles: t = Y,
1201
+ const xt = {
1202
+ http: "HTTP",
1203
+ mysql: "MySQL",
1204
+ postgresql: "PostgreSQL"
1205
+ }, Dt = {
1206
+ http: /* @__PURE__ */ r(st, {}),
1207
+ mysql: /* @__PURE__ */ r(ct, {}),
1208
+ postgresql: /* @__PURE__ */ r(lt, {})
1209
+ };
1210
+ function kt({
1211
+ type: t
1212
+ }) {
1213
+ return /* @__PURE__ */ m(z, { children: [
1214
+ /* @__PURE__ */ r(Hr, { size: "xs", sx: {
1215
+ transform: "none !important"
1216
+ }, children: Dt[t] }),
1217
+ /* @__PURE__ */ r(te, { sx: {
1218
+ cusor: "default",
1219
+ userSelect: "none"
1220
+ }, children: xt[t] })
1221
+ ] });
1222
+ }
1223
+ function tn({
1224
+ styles: t = N,
1130
1225
  config: n
1131
1226
  }) {
1132
- yt(n.monacoPath), pe(n);
1227
+ Tt(n.monacoPath), ge(n);
1133
1228
  const {
1134
- data: i = [],
1135
- loading: o,
1136
- refresh: l
1137
- } = G(async () => {
1229
+ data: o = [],
1230
+ loading: a,
1231
+ refresh: c
1232
+ } = J(async () => {
1138
1233
  const {
1139
1234
  data: s
1140
- } = await j.datasource.list();
1235
+ } = await k.datasource.list();
1141
1236
  return s;
1142
1237
  }, {
1143
1238
  refreshDeps: []
1144
1239
  });
1145
- return /* @__PURE__ */ v(N, { children: [
1146
- /* @__PURE__ */ r(z, { pt: t.spacing, position: "right", children: /* @__PURE__ */ r(St, { onSuccess: l }) }),
1147
- /* @__PURE__ */ v(I, { mt: t.spacing, sx: {
1240
+ return /* @__PURE__ */ m(L, { children: [
1241
+ /* @__PURE__ */ r(z, { pt: t.spacing, position: "right", children: /* @__PURE__ */ r(Rt, { onSuccess: c }) }),
1242
+ /* @__PURE__ */ m(I, { mt: t.spacing, sx: {
1148
1243
  position: "relative"
1149
1244
  }, children: [
1150
- /* @__PURE__ */ r(xe, { visible: o }),
1151
- /* @__PURE__ */ v(ke, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
1152
- /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ v("tr", { children: [
1245
+ /* @__PURE__ */ r(xe, { visible: a }),
1246
+ /* @__PURE__ */ m(De, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
1247
+ /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ m("tr", { children: [
1153
1248
  /* @__PURE__ */ r("th", { children: "Type" }),
1154
1249
  /* @__PURE__ */ r("th", { children: "Name" }),
1155
1250
  /* @__PURE__ */ r("th", { children: "Action" })
1156
1251
  ] }) }),
1157
- /* @__PURE__ */ r("tbody", { children: i.map(({
1158
- id: s,
1159
- key: c,
1160
- type: d,
1161
- is_preset: p
1162
- }) => /* @__PURE__ */ v("tr", { children: [
1163
- /* @__PURE__ */ r("td", { width: 200, children: d }),
1164
- /* @__PURE__ */ r("td", { children: c }),
1165
- /* @__PURE__ */ r("td", { width: 200, children: /* @__PURE__ */ r(z, { position: "left", children: /* @__PURE__ */ r(Ct, { isProtected: p, id: s, name: c, onSuccess: l }) }) })
1166
- ] }, c)) })
1252
+ /* @__PURE__ */ r("tbody", { children: o.map((s) => {
1253
+ const {
1254
+ id: l,
1255
+ key: d,
1256
+ type: g,
1257
+ is_preset: w
1258
+ } = s;
1259
+ return /* @__PURE__ */ m("tr", { children: [
1260
+ /* @__PURE__ */ r("td", { width: 200, children: /* @__PURE__ */ r(kt, { type: g }) }),
1261
+ /* @__PURE__ */ r("td", { children: d }),
1262
+ /* @__PURE__ */ r("td", { width: 400, children: /* @__PURE__ */ m(z, { position: "left", children: [
1263
+ /* @__PURE__ */ r(Ot, { dataSource: s, onSuccess: c, styles: t }),
1264
+ /* @__PURE__ */ r(Ct, { isProtected: w, id: l, name: d, onSuccess: c, styles: t })
1265
+ ] }) })
1266
+ ] }, d);
1267
+ }) })
1167
1268
  ] })
1168
1269
  ] })
1169
1270
  ] });
1170
1271
  }
1171
- const Tt = ze(({
1272
+ const It = Ae(({
1172
1273
  label: t,
1173
1274
  value: n,
1174
- description: i,
1175
- ...o
1176
- }, l) => /* @__PURE__ */ v(Ae, { spacing: 2, ref: l, ...o, children: [
1177
- /* @__PURE__ */ r(ue, { size: "sm", children: t }),
1178
- /* @__PURE__ */ r(ue, { size: "xs", color: "dimmed", className: "role-description", children: i })
1179
- ] })), Ie = ze(({
1275
+ description: o,
1276
+ ...a
1277
+ }, c) => /* @__PURE__ */ m(Oe, { spacing: 2, ref: c, ...a, children: [
1278
+ /* @__PURE__ */ r(te, { size: "sm", children: t }),
1279
+ /* @__PURE__ */ r(te, { size: "xs", color: "dimmed", className: "role-description", children: o })
1280
+ ] })), je = Ae(({
1180
1281
  styles: t,
1181
1282
  value: n,
1182
- onChange: i
1183
- }, o) => {
1283
+ onChange: o
1284
+ }, a) => {
1184
1285
  const {
1185
- data: l = [],
1286
+ data: c = [],
1186
1287
  loading: s
1187
- } = G(async () => (await j.role.list()).map((d) => ({
1288
+ } = J(async () => (await k.role.list()).map((d) => ({
1188
1289
  label: d.name,
1189
1290
  value: d.id,
1190
1291
  description: d.description,
@@ -1194,15 +1295,15 @@ const Tt = ze(({
1194
1295
  refreshDeps: []
1195
1296
  });
1196
1297
  return /* @__PURE__ */ r(
1197
- Hr,
1298
+ Jr,
1198
1299
  {
1199
- ref: o,
1300
+ ref: a,
1200
1301
  mb: t.spacing,
1201
1302
  size: t.size,
1202
1303
  required: !0,
1203
1304
  label: "Role",
1204
- itemComponent: Tt,
1205
- data: l,
1305
+ itemComponent: It,
1306
+ data: c,
1206
1307
  disabled: s,
1207
1308
  styles: () => ({
1208
1309
  item: {
@@ -1216,37 +1317,37 @@ const Tt = ze(({
1216
1317
  }
1217
1318
  }),
1218
1319
  value: n,
1219
- onChange: i
1320
+ onChange: o
1220
1321
  }
1221
1322
  );
1222
- }), $ = {
1323
+ }), W = {
1223
1324
  size: "sm",
1224
1325
  spacing: "md",
1225
1326
  button: {
1226
1327
  size: "xs"
1227
1328
  }
1228
1329
  };
1229
- function zt({
1330
+ function jt({
1230
1331
  postSubmit: t,
1231
- styles: n = $,
1232
- initialRoleID: i
1332
+ styles: n = W,
1333
+ initialRoleID: o
1233
1334
  }) {
1234
1335
  const {
1235
- control: o,
1236
- handleSubmit: l
1237
- } = J({
1336
+ control: a,
1337
+ handleSubmit: c
1338
+ } = K({
1238
1339
  defaultValues: {
1239
1340
  name: "",
1240
1341
  email: "",
1241
- role_id: i,
1342
+ role_id: o,
1242
1343
  password: ""
1243
1344
  }
1244
1345
  });
1245
- return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: l(async ({
1246
- name: c,
1346
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ m("form", { onSubmit: c(async ({
1347
+ name: l,
1247
1348
  email: d,
1248
- password: p,
1249
- role_id: b
1349
+ password: g,
1350
+ role_id: w
1250
1351
  }) => {
1251
1352
  try {
1252
1353
  V({
@@ -1254,14 +1355,14 @@ function zt({
1254
1355
  title: "Pending",
1255
1356
  message: "Adding account...",
1256
1357
  loading: !0
1257
- }), await j.account.create(c, d, p, b), x({
1358
+ }), await k.account.create(l, d, g, w), A({
1258
1359
  id: "for-creating",
1259
1360
  title: "Successful",
1260
1361
  message: "Account is added",
1261
1362
  color: "green"
1262
1363
  }), t();
1263
1364
  } catch (f) {
1264
- x({
1365
+ A({
1265
1366
  id: "for-creating",
1266
1367
  title: "Failed",
1267
1368
  message: f.message,
@@ -1269,43 +1370,43 @@ function zt({
1269
1370
  });
1270
1371
  }
1271
1372
  }), children: [
1272
- /* @__PURE__ */ r(R, { name: "name", control: o, render: ({
1273
- field: c
1274
- }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...c }) }),
1275
- /* @__PURE__ */ r(R, { name: "email", control: o, render: ({
1276
- field: c
1277
- }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Email", ...c }) }),
1278
- /* @__PURE__ */ r(R, { name: "password", control: o, render: ({
1279
- field: c
1280
- }) => /* @__PURE__ */ r(de, { mb: n.spacing, size: n.size, required: !0, label: "Password", description: "Password must be at least 8 characters long", ...c }) }),
1281
- /* @__PURE__ */ r(R, { name: "role_id", control: o, render: ({
1282
- field: c
1283
- }) => /* @__PURE__ */ r(Ie, { styles: n, ...c }) }),
1284
- /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: n.button.size, children: "Save" }) })
1373
+ /* @__PURE__ */ r(P, { name: "name", control: a, render: ({
1374
+ field: l
1375
+ }) => /* @__PURE__ */ r(O, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...l }) }),
1376
+ /* @__PURE__ */ r(P, { name: "email", control: a, render: ({
1377
+ field: l
1378
+ }) => /* @__PURE__ */ r(O, { mb: n.spacing, size: n.size, required: !0, label: "Email", ...l }) }),
1379
+ /* @__PURE__ */ r(P, { name: "password", control: a, render: ({
1380
+ field: l
1381
+ }) => /* @__PURE__ */ r(fe, { mb: n.spacing, size: n.size, required: !0, label: "Password", description: "Password must be at least 8 characters long", ...l }) }),
1382
+ /* @__PURE__ */ r(P, { name: "role_id", control: a, render: ({
1383
+ field: l
1384
+ }) => /* @__PURE__ */ r(je, { styles: n, ...l }) }),
1385
+ /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(R, { type: "submit", size: n.button.size, children: "Save" }) })
1285
1386
  ] }) });
1286
1387
  }
1287
- function Ot({
1388
+ function Ft({
1288
1389
  onSuccess: t,
1289
- styles: n = $,
1290
- initialRoleID: i
1390
+ styles: n = W,
1391
+ initialRoleID: o
1291
1392
  }) {
1292
- const [o, l] = H.useState(!1), s = () => l(!0), c = () => l(!1);
1293
- return /* @__PURE__ */ v(N, { children: [
1294
- /* @__PURE__ */ r(ne, { overflow: "inside", opened: o, onClose: () => l(!1), title: "Add an Account", trapFocus: !0, onDragStart: (p) => {
1295
- p.stopPropagation();
1296
- }, children: /* @__PURE__ */ r(zt, { postSubmit: () => {
1297
- t(), c();
1298
- }, styles: n, initialRoleID: i }) }),
1299
- /* @__PURE__ */ r(T, { size: n.button.size, onClick: s, leftIcon: /* @__PURE__ */ r(De, { size: 20 }), children: "Add an Account" })
1393
+ const [a, c] = B.useState(!1), s = () => c(!0), l = () => c(!1);
1394
+ return /* @__PURE__ */ m(L, { children: [
1395
+ /* @__PURE__ */ r(X, { overflow: "inside", opened: a, onClose: () => c(!1), title: "Add an Account", trapFocus: !0, onDragStart: (g) => {
1396
+ g.stopPropagation();
1397
+ }, children: /* @__PURE__ */ r(jt, { postSubmit: () => {
1398
+ t(), l();
1399
+ }, styles: n, initialRoleID: o }) }),
1400
+ /* @__PURE__ */ r(R, { size: n.button.size, onClick: s, leftIcon: /* @__PURE__ */ r(ke, { size: 20 }), children: "Add an Account" })
1300
1401
  ] });
1301
1402
  }
1302
- function At({
1403
+ function qt({
1303
1404
  id: t,
1304
1405
  name: n,
1305
- onSuccess: i,
1306
- styles: o = $
1406
+ onSuccess: o,
1407
+ styles: a = W
1307
1408
  }) {
1308
- const l = fe(), s = async () => {
1409
+ const c = pe(), s = async () => {
1309
1410
  if (t) {
1310
1411
  V({
1311
1412
  id: "for-deleting",
@@ -1314,14 +1415,14 @@ function At({
1314
1415
  loading: !0
1315
1416
  });
1316
1417
  try {
1317
- await j.account.delete(t), x({
1418
+ await k.account.delete(t), A({
1318
1419
  id: "for-deleting",
1319
1420
  title: "Successful",
1320
1421
  message: `Account [${n}] is deleted`,
1321
1422
  color: "green"
1322
- }), i();
1423
+ }), o();
1323
1424
  } catch (d) {
1324
- x({
1425
+ A({
1325
1426
  id: "for-deleting",
1326
1427
  title: "Failed",
1327
1428
  message: d.message,
@@ -1329,7 +1430,7 @@ function At({
1329
1430
  });
1330
1431
  }
1331
1432
  }
1332
- }, c = () => l.openConfirmModal({
1433
+ }, l = () => c.openConfirmModal({
1333
1434
  title: "Delete this account?",
1334
1435
  labels: {
1335
1436
  confirm: "Confirm",
@@ -1338,34 +1439,34 @@ function At({
1338
1439
  onCancel: () => console.log("Cancel"),
1339
1440
  onConfirm: s
1340
1441
  });
1341
- return /* @__PURE__ */ r(T, { size: o.button.size, color: "red", onClick: c, leftIcon: /* @__PURE__ */ r(je, { size: 20 }), children: "Delete" });
1442
+ return /* @__PURE__ */ r(R, { size: a.button.size, color: "red", onClick: l, leftIcon: /* @__PURE__ */ r(Ie, { size: 20 }), children: "Delete" });
1342
1443
  }
1343
- function xt({
1444
+ function Lt({
1344
1445
  id: t,
1345
1446
  name: n,
1346
- email: i,
1347
- role_id: o,
1348
- postSubmit: l,
1349
- styles: s = $
1447
+ email: o,
1448
+ role_id: a,
1449
+ postSubmit: c,
1450
+ styles: s = W
1350
1451
  }) {
1351
1452
  const {
1352
- control: c,
1453
+ control: l,
1353
1454
  handleSubmit: d,
1354
- watch: p
1355
- } = J({
1455
+ watch: g
1456
+ } = K({
1356
1457
  defaultValues: {
1357
1458
  name: n,
1358
- email: i,
1359
- role_id: o,
1459
+ email: o,
1460
+ role_id: a,
1360
1461
  reset_password: !1,
1361
1462
  new_password: ""
1362
1463
  }
1363
- }), b = async ({
1464
+ }), w = async ({
1364
1465
  name: _,
1365
- email: k,
1466
+ email: j,
1366
1467
  role_id: q,
1367
1468
  reset_password: he,
1368
- new_password: me
1469
+ new_password: be
1369
1470
  }) => {
1370
1471
  try {
1371
1472
  V({
@@ -1373,95 +1474,95 @@ function xt({
1373
1474
  title: "Pending",
1374
1475
  message: "Updating account...",
1375
1476
  loading: !0
1376
- }), await j.account.edit({
1477
+ }), await k.account.edit({
1377
1478
  id: t,
1378
- name: _,
1379
- email: k,
1479
+ name: _.trim(),
1480
+ email: j.trim(),
1380
1481
  role_id: q,
1381
1482
  reset_password: he,
1382
- new_password: me
1383
- }), x({
1483
+ new_password: be.trim()
1484
+ }), A({
1384
1485
  id: "for-updating",
1385
1486
  title: "Successful",
1386
1487
  message: "Account is updated",
1387
1488
  color: "green"
1388
- }), l();
1389
- } catch (U) {
1390
- x({
1489
+ }), c();
1490
+ } catch ($) {
1491
+ A({
1391
1492
  id: "for-updating",
1392
1493
  title: "Failed",
1393
- message: U.message,
1494
+ message: $.message,
1394
1495
  color: "red"
1395
1496
  });
1396
1497
  }
1397
- }, [f, h] = p(["reset_password", "new_password"]);
1398
- return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: d(b), children: [
1399
- /* @__PURE__ */ r(R, { name: "name", control: c, render: ({
1498
+ }, [f, h] = g(["reset_password", "new_password"]);
1499
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ m("form", { onSubmit: d(w), children: [
1500
+ /* @__PURE__ */ r(P, { name: "name", control: l, render: ({
1400
1501
  field: _
1401
- }) => /* @__PURE__ */ r(D, { mb: s.spacing, size: s.size, required: !0, label: "Username", ..._ }) }),
1402
- /* @__PURE__ */ r(R, { name: "email", control: c, render: ({
1502
+ }) => /* @__PURE__ */ r(O, { mb: s.spacing, size: s.size, required: !0, label: "Username", ..._ }) }),
1503
+ /* @__PURE__ */ r(P, { name: "email", control: l, render: ({
1403
1504
  field: _
1404
- }) => /* @__PURE__ */ r(D, { mb: s.spacing, size: s.size, required: !0, label: "Email", ..._ }) }),
1405
- /* @__PURE__ */ r(R, { name: "role_id", control: c, render: ({
1505
+ }) => /* @__PURE__ */ r(O, { mb: s.spacing, size: s.size, required: !0, label: "Email", ..._ }) }),
1506
+ /* @__PURE__ */ r(P, { name: "role_id", control: l, render: ({
1406
1507
  field: _
1407
- }) => /* @__PURE__ */ r(Ie, { styles: s, ..._ }) }),
1408
- /* @__PURE__ */ r(Oe, { my: 20, variant: "dashed", label: "", labelPosition: "center" }),
1409
- /* @__PURE__ */ r(R, { name: "reset_password", control: c, render: ({
1508
+ }) => /* @__PURE__ */ r(je, { styles: s, ..._ }) }),
1509
+ /* @__PURE__ */ r(de, { my: 20, variant: "dashed", label: "", labelPosition: "center" }),
1510
+ /* @__PURE__ */ r(P, { name: "reset_password", control: l, render: ({
1410
1511
  field: _
1411
- }) => /* @__PURE__ */ r(Jr, { mb: s.spacing, size: s.size, label: "Reset password", checked: _.value, onChange: (k) => _.onChange(k.currentTarget.checked), styles: {
1512
+ }) => /* @__PURE__ */ r(Xr, { mb: s.spacing, size: s.size, label: "Reset password", checked: _.value, onChange: (j) => _.onChange(j.currentTarget.checked), styles: {
1412
1513
  label: {
1413
1514
  verticalAlign: "middle"
1414
1515
  }
1415
1516
  } }) }),
1416
1517
  f && /* @__PURE__ */ r(
1417
- R,
1518
+ P,
1418
1519
  {
1419
1520
  name: "new_password",
1420
- control: c,
1521
+ control: l,
1421
1522
  render: ({
1422
1523
  field: _
1423
- }) => /* @__PURE__ */ r(de, { autoComplete: "off", mb: s.spacing, size: s.size, required: !0, description: "Password must be at least 8 characters long", label: "New Password", ..._ })
1524
+ }) => /* @__PURE__ */ r(fe, { autoComplete: "off", mb: s.spacing, size: s.size, required: !0, description: "Password must be at least 8 characters long", label: "New Password", ..._ })
1424
1525
  }
1425
1526
  ),
1426
- /* @__PURE__ */ r(z, { position: "right", mt: s.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: s.button.size, children: "Submit" }) })
1527
+ /* @__PURE__ */ r(z, { position: "right", mt: s.spacing, children: /* @__PURE__ */ r(R, { type: "submit", size: s.button.size, children: "Submit" }) })
1427
1528
  ] }) });
1428
1529
  }
1429
- function kt({
1530
+ function Nt({
1430
1531
  account: t,
1431
1532
  onSuccess: n,
1432
- styles: i = $
1533
+ styles: o = W
1433
1534
  }) {
1434
- const [o, l] = H.useState(!1), s = () => l(!0), c = () => l(!1), d = () => {
1435
- n(), c();
1535
+ const [a, c] = B.useState(!1), s = () => c(!0), l = () => c(!1), d = () => {
1536
+ n(), l();
1436
1537
  };
1437
- return /* @__PURE__ */ v(N, { children: [
1438
- /* @__PURE__ */ r(ne, { overflow: "inside", opened: o, onClose: () => l(!1), title: `Editing ${t.name}`, trapFocus: !0, onDragStart: (p) => {
1439
- p.stopPropagation();
1440
- }, children: /* @__PURE__ */ r(xt, { ...t, postSubmit: d, styles: i }) }),
1441
- /* @__PURE__ */ r(T, { size: i.button.size, onClick: s, leftIcon: /* @__PURE__ */ r(Zr, { size: 20 }), children: "Edit" })
1538
+ return /* @__PURE__ */ m(L, { children: [
1539
+ /* @__PURE__ */ r(X, { overflow: "inside", opened: a, onClose: () => c(!1), title: `Editing ${t.name}`, trapFocus: !0, onDragStart: (g) => {
1540
+ g.stopPropagation();
1541
+ }, children: /* @__PURE__ */ r(Lt, { ...t, postSubmit: d, styles: o }) }),
1542
+ /* @__PURE__ */ r(R, { size: o.button.size, onClick: s, leftIcon: /* @__PURE__ */ r(et, { size: 20 }), children: "Edit" })
1442
1543
  ] });
1443
1544
  }
1444
- function Ht({
1445
- styles: t = $,
1545
+ function nn({
1546
+ styles: t = W,
1446
1547
  config: n
1447
1548
  }) {
1448
- var b;
1449
- pe(n);
1549
+ var w;
1550
+ ge(n);
1450
1551
  const {
1451
- data: i = [],
1452
- loading: o,
1453
- refresh: l
1454
- } = G(async () => {
1552
+ data: o = [],
1553
+ loading: a,
1554
+ refresh: c
1555
+ } = J(async () => {
1455
1556
  const {
1456
1557
  data: f
1457
- } = await j.account.list();
1558
+ } = await k.account.list();
1458
1559
  return f;
1459
1560
  }, {
1460
1561
  refreshDeps: []
1461
1562
  }), {
1462
1563
  data: s = [],
1463
- loading: c
1464
- } = G(async () => (await j.role.list()).map((h) => ({
1564
+ loading: l
1565
+ } = J(async () => (await k.role.list()).map((h) => ({
1465
1566
  label: h.name,
1466
1567
  value: h.id,
1467
1568
  description: h.description,
@@ -1469,34 +1570,34 @@ function Ht({
1469
1570
  // SUPERADMIN
1470
1571
  })), {
1471
1572
  refreshDeps: []
1472
- }), d = ur(() => s.reduce((f, h) => (f.set(h.value, h.label), f), /* @__PURE__ */ new Map()), [s]), p = (f) => d.get(f) ?? f;
1473
- return /* @__PURE__ */ v(N, { children: [
1474
- /* @__PURE__ */ r(z, { pt: t.spacing, position: "right", children: /* @__PURE__ */ r(Ot, { onSuccess: l, initialRoleID: ((b = s == null ? void 0 : s[0]) == null ? void 0 : b.value) ?? 0 }) }),
1475
- /* @__PURE__ */ v(I, { mt: t.spacing, sx: {
1573
+ }), d = dr(() => s.reduce((f, h) => (f.set(h.value, h.label), f), /* @__PURE__ */ new Map()), [s]), g = (f) => d.get(f) ?? f;
1574
+ return /* @__PURE__ */ m(L, { children: [
1575
+ /* @__PURE__ */ r(z, { pt: t.spacing, position: "right", children: /* @__PURE__ */ r(Ft, { onSuccess: c, initialRoleID: ((w = s == null ? void 0 : s[0]) == null ? void 0 : w.value) ?? 0 }) }),
1576
+ /* @__PURE__ */ m(I, { mt: t.spacing, sx: {
1476
1577
  position: "relative"
1477
1578
  }, children: [
1478
- /* @__PURE__ */ r(xe, { visible: o || c }),
1479
- /* @__PURE__ */ v(ke, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
1480
- /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ v("tr", { children: [
1579
+ /* @__PURE__ */ r(xe, { visible: a || l }),
1580
+ /* @__PURE__ */ m(De, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
1581
+ /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ m("tr", { children: [
1481
1582
  /* @__PURE__ */ r("th", { children: "Username" }),
1482
1583
  /* @__PURE__ */ r("th", { children: "Email" }),
1483
1584
  /* @__PURE__ */ r("th", { children: "Role" }),
1484
1585
  /* @__PURE__ */ r("th", { children: "Action" })
1485
1586
  ] }) }),
1486
- /* @__PURE__ */ r("tbody", { children: i.map((f) => {
1587
+ /* @__PURE__ */ r("tbody", { children: o.map((f) => {
1487
1588
  const {
1488
1589
  id: h,
1489
1590
  name: _,
1490
- email: k,
1591
+ email: j,
1491
1592
  role_id: q
1492
1593
  } = f;
1493
- return /* @__PURE__ */ v("tr", { children: [
1594
+ return /* @__PURE__ */ m("tr", { children: [
1494
1595
  /* @__PURE__ */ r("td", { width: 200, children: _ }),
1495
- /* @__PURE__ */ r("td", { width: 200, children: k }),
1496
- /* @__PURE__ */ r("td", { width: 200, children: p(q) }),
1497
- /* @__PURE__ */ r("td", { width: 200, children: /* @__PURE__ */ v(z, { position: "left", children: [
1498
- /* @__PURE__ */ r(kt, { account: f, onSuccess: l }),
1499
- /* @__PURE__ */ r(At, { id: h, name: _, onSuccess: l })
1596
+ /* @__PURE__ */ r("td", { width: 200, children: j }),
1597
+ /* @__PURE__ */ r("td", { width: 200, children: g(q) }),
1598
+ /* @__PURE__ */ r("td", { width: 200, children: /* @__PURE__ */ m(z, { position: "left", children: [
1599
+ /* @__PURE__ */ r(Nt, { account: f, onSuccess: c }),
1600
+ /* @__PURE__ */ r(qt, { id: h, name: _, onSuccess: c })
1500
1601
  ] }) })
1501
1602
  ] }, h);
1502
1603
  }) })
@@ -1504,22 +1605,22 @@ function Ht({
1504
1605
  ] })
1505
1606
  ] });
1506
1607
  }
1507
- function Dt({
1608
+ function Ut({
1508
1609
  postSubmit: t,
1509
- styles: n = $
1610
+ styles: n = W
1510
1611
  }) {
1511
1612
  const {
1512
- control: i,
1513
- handleSubmit: o
1514
- } = J({
1613
+ control: o,
1614
+ handleSubmit: a
1615
+ } = K({
1515
1616
  defaultValues: {
1516
1617
  name: "",
1517
1618
  password: ""
1518
1619
  }
1519
1620
  });
1520
- return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: o(async ({
1621
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ m("form", { onSubmit: a(async ({
1521
1622
  name: s,
1522
- password: c
1623
+ password: l
1523
1624
  }) => {
1524
1625
  try {
1525
1626
  V({
@@ -1528,15 +1629,15 @@ function Dt({
1528
1629
  message: "Loggin in...",
1529
1630
  loading: !0
1530
1631
  });
1531
- const d = await j.account.login(s, c);
1532
- window.localStorage.setItem("token", d.token), x({
1632
+ const d = await k.account.login(s.trim(), l.trim());
1633
+ window.localStorage.setItem("token", d.token), A({
1533
1634
  id: "for-login",
1534
1635
  title: "Successful",
1535
1636
  message: "Logged in",
1536
1637
  color: "green"
1537
1638
  }), t(d);
1538
1639
  } catch (d) {
1539
- x({
1640
+ A({
1540
1641
  id: "for-login",
1541
1642
  title: "Login Failed",
1542
1643
  message: d.message,
@@ -1544,47 +1645,47 @@ function Dt({
1544
1645
  });
1545
1646
  }
1546
1647
  }), children: [
1547
- /* @__PURE__ */ r(R, { name: "name", control: i, render: ({
1648
+ /* @__PURE__ */ r(P, { name: "name", control: o, render: ({
1548
1649
  field: s
1549
- }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...s }) }),
1550
- /* @__PURE__ */ r(R, { name: "password", control: i, render: ({
1650
+ }) => /* @__PURE__ */ r(O, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...s }) }),
1651
+ /* @__PURE__ */ r(P, { name: "password", control: o, render: ({
1551
1652
  field: s
1552
- }) => /* @__PURE__ */ r(de, { mb: n.spacing, size: n.size, required: !0, label: "Password", ...s }) }),
1553
- /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: n.button.size, children: "Submit" }) })
1653
+ }) => /* @__PURE__ */ r(fe, { mb: n.spacing, size: n.size, required: !0, label: "Password", ...s }) }),
1654
+ /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(R, { type: "submit", size: n.button.size, children: "Submit" }) })
1554
1655
  ] }) });
1555
1656
  }
1556
- function Jt({
1557
- styles: t = $,
1657
+ function an({
1658
+ styles: t = W,
1558
1659
  config: n,
1559
- onSuccess: i
1660
+ onSuccess: o
1560
1661
  }) {
1561
- return pe(n), /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(I, { mt: t.spacing, sx: {
1662
+ return ge(n), /* @__PURE__ */ r(L, { children: /* @__PURE__ */ r(I, { mt: t.spacing, sx: {
1562
1663
  position: "relative"
1563
- }, children: /* @__PURE__ */ r(Dt, { styles: t, postSubmit: i }) }) });
1664
+ }, children: /* @__PURE__ */ r(Ut, { styles: t, postSubmit: o }) }) });
1564
1665
  }
1565
- const ge = {
1666
+ const me = {
1566
1667
  size: "sm",
1567
1668
  spacing: "md",
1568
1669
  button: {
1569
1670
  size: "xs"
1570
1671
  }
1571
1672
  };
1572
- function jt({
1673
+ function Mt({
1573
1674
  postSubmit: t,
1574
- styles: n = ge,
1575
- initialRoleID: i
1675
+ styles: n = me,
1676
+ initialRoleID: o
1576
1677
  }) {
1577
1678
  const {
1578
- control: o,
1579
- handleSubmit: l
1580
- } = J({
1679
+ control: a,
1680
+ handleSubmit: c
1681
+ } = K({
1581
1682
  defaultValues: {
1582
1683
  name: "",
1583
- role_id: i
1684
+ role_id: o
1584
1685
  }
1585
1686
  });
1586
- return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: l(async ({
1587
- name: c,
1687
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ m("form", { onSubmit: c(async ({
1688
+ name: l,
1588
1689
  role_id: d
1589
1690
  }) => {
1590
1691
  try {
@@ -1595,76 +1696,76 @@ function jt({
1595
1696
  loading: !0
1596
1697
  });
1597
1698
  const {
1598
- app_id: p,
1599
- app_secret: b
1600
- } = await j.api_key.create(c, d);
1601
- x({
1699
+ app_id: g,
1700
+ app_secret: w
1701
+ } = await k.api_key.create(l, d);
1702
+ A({
1602
1703
  id: "for-creating",
1603
1704
  title: "Successful",
1604
1705
  message: "API Key is added",
1605
1706
  color: "green"
1606
- }), t(p, b);
1607
- } catch (p) {
1608
- x({
1707
+ }), t(g, w);
1708
+ } catch (g) {
1709
+ A({
1609
1710
  id: "for-creating",
1610
1711
  title: "Failed",
1611
- message: p.message,
1712
+ message: g.message,
1612
1713
  color: "red"
1613
1714
  });
1614
1715
  }
1615
1716
  }), children: [
1616
- /* @__PURE__ */ r(R, { name: "name", control: o, render: ({
1617
- field: c
1618
- }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Name", ...c }) }),
1619
- /* @__PURE__ */ r(R, { name: "role_id", control: o, render: ({
1620
- field: c
1621
- }) => /* @__PURE__ */ r(Ie, { styles: n, ...c }) }),
1622
- /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: n.button.size, children: "Save" }) })
1717
+ /* @__PURE__ */ r(P, { name: "name", control: a, render: ({
1718
+ field: l
1719
+ }) => /* @__PURE__ */ r(O, { mb: n.spacing, size: n.size, required: !0, label: "Name", ...l }) }),
1720
+ /* @__PURE__ */ r(P, { name: "role_id", control: a, render: ({
1721
+ field: l
1722
+ }) => /* @__PURE__ */ r(je, { styles: n, ...l }) }),
1723
+ /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(R, { type: "submit", size: n.button.size, children: "Save" }) })
1623
1724
  ] }) });
1624
1725
  }
1625
- function It({
1726
+ function Vt({
1626
1727
  onSuccess: t,
1627
- styles: n = ge,
1628
- initialRoleID: i
1728
+ styles: n = me,
1729
+ initialRoleID: o
1629
1730
  }) {
1630
- const o = fe(), [l, s] = H.useState(!1), c = () => s(!0), d = () => s(!1);
1631
- return /* @__PURE__ */ v(N, { children: [
1632
- /* @__PURE__ */ r(ne, { overflow: "inside", opened: l, onClose: () => s(!1), title: "Add an API Key", trapFocus: !0, onDragStart: (b) => {
1633
- b.stopPropagation();
1634
- }, children: /* @__PURE__ */ r(jt, { postSubmit: (b, f) => {
1635
- d(), o.openModal({
1731
+ const a = pe(), [c, s] = B.useState(!1), l = () => s(!0), d = () => s(!1);
1732
+ return /* @__PURE__ */ m(L, { children: [
1733
+ /* @__PURE__ */ r(X, { overflow: "inside", opened: c, onClose: () => s(!1), title: "Add an API Key", trapFocus: !0, onDragStart: (w) => {
1734
+ w.stopPropagation();
1735
+ }, children: /* @__PURE__ */ r(Mt, { postSubmit: (w, f) => {
1736
+ d(), a.openModal({
1636
1737
  title: "API Key is generated",
1637
- children: /* @__PURE__ */ v(Ae, { children: [
1638
- /* @__PURE__ */ r(ue, { color: "dimmed", children: "Make sure you save it - you won't be able to access it again." }),
1639
- /* @__PURE__ */ r(D, { defaultValue: b, disabled: !0, label: "APP ID", styles: {
1738
+ children: /* @__PURE__ */ m(Oe, { children: [
1739
+ /* @__PURE__ */ r(te, { color: "dimmed", children: "Make sure you save it - you won't be able to access it again." }),
1740
+ /* @__PURE__ */ r(O, { defaultValue: w, disabled: !0, label: "APP ID", styles: {
1640
1741
  input: {
1641
1742
  cursor: "text !important"
1642
1743
  }
1643
1744
  } }),
1644
- /* @__PURE__ */ r(D, { defaultValue: f, disabled: !0, label: "APP Secret", styles: {
1745
+ /* @__PURE__ */ r(O, { defaultValue: f, disabled: !0, label: "APP Secret", styles: {
1645
1746
  input: {
1646
1747
  cursor: "text !important"
1647
1748
  }
1648
1749
  } }),
1649
- /* @__PURE__ */ r(T, { size: "sm", onClick: () => {
1650
- it();
1750
+ /* @__PURE__ */ r(R, { size: "sm", onClick: () => {
1751
+ ot();
1651
1752
  }, children: "I've saved this API Key" })
1652
1753
  ] }),
1653
1754
  onClose: () => {
1654
1755
  t();
1655
1756
  }
1656
1757
  });
1657
- }, styles: n, initialRoleID: i }) }),
1658
- /* @__PURE__ */ r(T, { size: n.button.size, onClick: c, leftIcon: /* @__PURE__ */ r(De, { size: 20 }), children: "Add an API Key" })
1758
+ }, styles: n, initialRoleID: o }) }),
1759
+ /* @__PURE__ */ r(R, { size: n.button.size, onClick: l, leftIcon: /* @__PURE__ */ r(ke, { size: 20 }), children: "Add an API Key" })
1659
1760
  ] });
1660
1761
  }
1661
- function Ft({
1762
+ function $t({
1662
1763
  id: t,
1663
1764
  name: n,
1664
- onSuccess: i,
1665
- styles: o = ge
1765
+ onSuccess: o,
1766
+ styles: a = me
1666
1767
  }) {
1667
- const l = fe(), s = async () => {
1768
+ const c = pe(), s = async () => {
1668
1769
  if (t) {
1669
1770
  V({
1670
1771
  id: "for-deleting",
@@ -1673,14 +1774,14 @@ function Ft({
1673
1774
  loading: !0
1674
1775
  });
1675
1776
  try {
1676
- await j.api_key.delete(t), x({
1777
+ await k.api_key.delete(t), A({
1677
1778
  id: "for-deleting",
1678
1779
  title: "Successful",
1679
1780
  message: `API Key [${n}] is deleted`,
1680
1781
  color: "green"
1681
- }), i();
1782
+ }), o();
1682
1783
  } catch (d) {
1683
- x({
1784
+ A({
1684
1785
  id: "for-deleting",
1685
1786
  title: "Failed",
1686
1787
  message: d.message,
@@ -1688,7 +1789,7 @@ function Ft({
1688
1789
  });
1689
1790
  }
1690
1791
  }
1691
- }, c = () => l.openConfirmModal({
1792
+ }, l = () => c.openConfirmModal({
1692
1793
  title: "Delete this api-key?",
1693
1794
  labels: {
1694
1795
  confirm: "Confirm",
@@ -1697,29 +1798,29 @@ function Ft({
1697
1798
  onCancel: () => console.log("Cancel"),
1698
1799
  onConfirm: s
1699
1800
  });
1700
- return /* @__PURE__ */ r(T, { size: o.button.size, color: "red", onClick: c, leftIcon: /* @__PURE__ */ r(je, { size: 20 }), children: "Delete" });
1801
+ return /* @__PURE__ */ r(R, { size: a.button.size, color: "red", onClick: l, leftIcon: /* @__PURE__ */ r(Ie, { size: 20 }), children: "Delete" });
1701
1802
  }
1702
- function Xt({
1703
- styles: t = ge,
1803
+ function on({
1804
+ styles: t = me,
1704
1805
  config: n
1705
1806
  }) {
1706
- var b;
1707
- pe(n);
1807
+ var w;
1808
+ ge(n);
1708
1809
  const {
1709
- data: i = [],
1710
- loading: o,
1711
- refresh: l
1712
- } = G(async () => {
1810
+ data: o = [],
1811
+ loading: a,
1812
+ refresh: c
1813
+ } = J(async () => {
1713
1814
  const {
1714
1815
  data: f
1715
- } = await j.api_key.list();
1816
+ } = await k.api_key.list();
1716
1817
  return f;
1717
1818
  }, {
1718
1819
  refreshDeps: []
1719
1820
  }), {
1720
1821
  data: s = [],
1721
- loading: c
1722
- } = G(async () => (await j.role.list()).map((h) => ({
1822
+ loading: l
1823
+ } = J(async () => (await k.role.list()).map((h) => ({
1723
1824
  label: h.name,
1724
1825
  value: h.id,
1725
1826
  description: h.description,
@@ -1727,51 +1828,51 @@ function Xt({
1727
1828
  // SUPERADMIN
1728
1829
  })), {
1729
1830
  refreshDeps: []
1730
- }), d = ur(() => s.reduce((f, h) => (f.set(h.value, h.label), f), /* @__PURE__ */ new Map()), [s]), p = (f) => d.get(f) ?? f;
1731
- return /* @__PURE__ */ v(N, { children: [
1732
- /* @__PURE__ */ r(z, { pt: t.spacing, position: "right", children: /* @__PURE__ */ r(It, { onSuccess: l, initialRoleID: ((b = s == null ? void 0 : s[0]) == null ? void 0 : b.value) ?? 0 }) }),
1733
- /* @__PURE__ */ v(I, { mt: t.spacing, sx: {
1831
+ }), d = dr(() => s.reduce((f, h) => (f.set(h.value, h.label), f), /* @__PURE__ */ new Map()), [s]), g = (f) => d.get(f) ?? f;
1832
+ return /* @__PURE__ */ m(L, { children: [
1833
+ /* @__PURE__ */ r(z, { pt: t.spacing, position: "right", children: /* @__PURE__ */ r(Vt, { onSuccess: c, initialRoleID: ((w = s == null ? void 0 : s[0]) == null ? void 0 : w.value) ?? 0 }) }),
1834
+ /* @__PURE__ */ m(I, { mt: t.spacing, sx: {
1734
1835
  position: "relative"
1735
1836
  }, children: [
1736
- /* @__PURE__ */ r(xe, { visible: o || c }),
1737
- /* @__PURE__ */ v(ke, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
1738
- /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ v("tr", { children: [
1837
+ /* @__PURE__ */ r(xe, { visible: a || l }),
1838
+ /* @__PURE__ */ m(De, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
1839
+ /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ m("tr", { children: [
1739
1840
  /* @__PURE__ */ r("th", { children: "Name" }),
1740
1841
  /* @__PURE__ */ r("th", { children: "APP ID" }),
1741
1842
  /* @__PURE__ */ r("th", { children: "Role" }),
1742
1843
  /* @__PURE__ */ r("th", { children: "Action" })
1743
1844
  ] }) }),
1744
- /* @__PURE__ */ r("tbody", { children: i.map((f) => {
1845
+ /* @__PURE__ */ r("tbody", { children: o.map((f) => {
1745
1846
  const {
1746
1847
  id: h,
1747
1848
  name: _,
1748
- app_id: k,
1849
+ app_id: j,
1749
1850
  role_id: q
1750
1851
  } = f;
1751
- return /* @__PURE__ */ v("tr", { children: [
1852
+ return /* @__PURE__ */ m("tr", { children: [
1752
1853
  /* @__PURE__ */ r("td", { width: 200, children: _ }),
1753
- /* @__PURE__ */ r("td", { width: 200, children: k }),
1754
- /* @__PURE__ */ r("td", { width: 200, children: p(q) }),
1755
- /* @__PURE__ */ r("td", { width: 200, children: /* @__PURE__ */ r(z, { position: "left", children: /* @__PURE__ */ r(Ft, { id: h, name: _, onSuccess: l }) }) })
1854
+ /* @__PURE__ */ r("td", { width: 200, children: j }),
1855
+ /* @__PURE__ */ r("td", { width: 200, children: g(q) }),
1856
+ /* @__PURE__ */ r("td", { width: 200, children: /* @__PURE__ */ r(z, { position: "left", children: /* @__PURE__ */ r($t, { id: h, name: _, onSuccess: c }) }) })
1756
1857
  ] }, h);
1757
1858
  }) })
1758
1859
  ] })
1759
1860
  ] })
1760
1861
  ] });
1761
1862
  }
1762
- const Qt = () => import("./package-69bf9452.mjs").then(({
1863
+ const sn = () => import("./package-55721e19.mjs").then(({
1763
1864
  version: t
1764
1865
  }) => (console.log(`[@devtable/dashboard] version: ${t}`), t));
1765
1866
  export {
1766
- Xt as APIKeyList,
1767
- Ht as AccountList,
1768
- It as AddAPIKey,
1769
- Ot as AddAccount,
1770
- St as AddDataSource,
1771
- Gt as DataSourceList,
1772
- Ft as DeleteAPIKey,
1773
- At as DeleteAccount,
1867
+ on as APIKeyList,
1868
+ nn as AccountList,
1869
+ Vt as AddAPIKey,
1870
+ Ft as AddAccount,
1871
+ Rt as AddDataSource,
1872
+ tn as DataSourceList,
1873
+ $t as DeleteAPIKey,
1874
+ qt as DeleteAccount,
1774
1875
  Ct as DeleteDataSource,
1775
- Jt as Login,
1776
- Qt as getVersion
1876
+ an as Login,
1877
+ sn as getVersion
1777
1878
  };