@devtable/settings-form 5.7.2 → 5.8.1

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,34 +1,35 @@
1
- import { Modal as se, Button as x, Box as L, SegmentedControl as qr, TextInput as I, Divider as er, Group as j, NumberInput as Lr, PasswordInput as ce, Text as oe, LoadingOverlay as Re, Table as Pe, Stack as rr, Select as Nr, Switch as Ur } from "@mantine/core";
2
- import { showNotification as M, updateNotification as z } from "@mantine/notifications";
1
+ import { Modal as se, Button as x, Box as L, SegmentedControl as qr, TextInput as j, Divider as er, Group as I, NumberInput as Lr, PasswordInput as ce, useMantineTheme as Mr, Tooltip as Nr, Text as oe, LoadingOverlay as Re, Table as Pe, Stack as rr, Select as $r, Switch as Ur } from "@mantine/core";
2
+ import { showNotification as $, updateNotification as A } from "@mantine/notifications";
3
3
  import J, { forwardRef as tr, useMemo as nr } from "react";
4
4
  import { useForm as ee, Controller as E } from "react-hook-form";
5
- import { PlaylistAdd as Ee, Trash as Ce, Edit as Mr } from "tabler-icons-react";
6
- import $r from "axios";
7
- import Wr from "crypto-js";
5
+ import { PlaylistAdd as Ee, Trash as Ce, Edit as Wr } from "tabler-icons-react";
6
+ import Vr from "axios";
7
+ import Yr from "crypto-js";
8
+ import Kr from "lodash";
8
9
  import { useRequest as G } from "ahooks";
9
- import { useModals as le, closeAllModals as Vr } from "@mantine/modals";
10
- function Yr(t) {
10
+ import { useModals as le, closeAllModals as Br } from "@mantine/modals";
11
+ function Gr(t) {
11
12
  t = t || {};
12
- const n = Object.keys(t).sort(), s = [];
13
- for (let c = 0; c < n.length; c++) {
14
- const u = n[c];
15
- if (u != "authentication" && t[u])
16
- s.push(n[c] + "=" + (typeof t[u] == "object" ? JSON.stringify(t[u]) : t[u]));
13
+ const n = Object.keys(t).sort(), o = [];
14
+ for (let s = 0; s < n.length; s++) {
15
+ const l = n[s];
16
+ if (l != "authentication" && t[l])
17
+ o.push(n[s] + "=" + (typeof t[l] == "object" ? JSON.stringify(t[l]) : t[l]));
17
18
  else {
18
- const i = Object.keys(t[u]).sort();
19
- for (let l = 0; l < i.length; l++) {
20
- const d = i[l];
21
- d != "sign" && t[u][d] && s.push(
22
- i[l] + "=" + (typeof t[u][d] == "object" ? JSON.stringify(t[u][d]) : t[u][d])
19
+ const i = Object.keys(t[l]).sort();
20
+ for (let u = 0; u < i.length; u++) {
21
+ const d = i[u];
22
+ d != "sign" && t[l][d] && o.push(
23
+ i[u] + "=" + (typeof t[l][d] == "object" ? JSON.stringify(t[l][d]) : t[l][d])
23
24
  );
24
25
  }
25
26
  }
26
27
  }
27
- return s.sort().join("&");
28
+ return o.sort().join("&");
28
29
  }
29
- function Kr(t, n) {
30
- let s = Yr(t);
31
- return s += "&key=" + n, Wr.MD5(s).toString().toUpperCase();
30
+ function Jr(t, n) {
31
+ let o = Gr(t);
32
+ return o += "&key=" + n, Yr.MD5(o).toString().toUpperCase();
32
33
  }
33
34
  const C = {
34
35
  baseURL: "http://localhost:31200",
@@ -41,7 +42,7 @@ const C = {
41
42
  return {
42
43
  app_id: this.app_id,
43
44
  nonce_str: n,
44
- sign: Kr(
45
+ sign: Jr(
45
46
  {
46
47
  app_id: this.app_id,
47
48
  nonce_str: n,
@@ -52,33 +53,33 @@ const C = {
52
53
  };
53
54
  },
54
55
  getRequest(t) {
55
- return (n, s, c = {}) => {
56
- const u = window.localStorage.getItem("token"), i = {
56
+ return (n, o, s = {}) => {
57
+ const l = window.localStorage.getItem("token"), i = {
57
58
  "X-Requested-With": "XMLHttpRequest",
58
- "Content-Type": c.string ? "application/x-www-form-urlencoded" : "application/json",
59
- authorization: u ? `bearer ${u}` : "",
60
- ...c.headers
61
- }, l = {
59
+ "Content-Type": s.string ? "application/x-www-form-urlencoded" : "application/json",
60
+ authorization: l ? `bearer ${l}` : "",
61
+ ...s.headers
62
+ }, u = {
62
63
  baseURL: this.baseURL,
63
64
  method: t,
64
65
  url: n,
65
- params: t === "GET" ? s : c.params,
66
+ params: t === "GET" ? o : s.params,
66
67
  headers: i
67
68
  };
68
- return ["POST", "PUT"].includes(t) && (l.data = c.string ? JSON.stringify(s) : s, l.data.authentication = this.getAuthentication(l.data)), $r(l).then((d) => d.data).catch((d) => Promise.reject(d));
69
+ return ["POST", "PUT"].includes(t) && (u.data = s.string ? JSON.stringify(o) : o, u.data.authentication = this.getAuthentication(u.data)), Vr(u).then((d) => d.data).catch((d) => Kr.has(d, "response.data.detail.message") ? Promise.reject(new Error(d.response.data.detail.message)) : Promise.reject(d));
69
70
  };
70
71
  }
71
72
  };
72
73
  function ue(t) {
73
74
  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);
74
75
  }
75
- const Br = {
76
+ const Hr = {
76
77
  login: async (t, n) => {
77
- const s = {
78
+ const o = {
78
79
  name: t,
79
80
  password: n
80
81
  };
81
- return await C.getRequest("POST")("/account/login", s);
82
+ return await C.getRequest("POST")("/account/login", o);
82
83
  },
83
84
  list: async () => await C.getRequest("POST")("/account/list", {
84
85
  filter: {
@@ -95,31 +96,31 @@ const Br = {
95
96
  }),
96
97
  get: async () => await C.getRequest("GET")("/account/get", {}),
97
98
  update: async (t, n) => {
98
- const s = {
99
+ const o = {
99
100
  name: t,
100
101
  email: n
101
102
  };
102
- return await C.getRequest("PUT")("/account/update", s);
103
+ return await C.getRequest("PUT")("/account/update", o);
103
104
  },
104
105
  changepassword: async (t, n) => {
105
- const s = {
106
+ const o = {
106
107
  old_password: t,
107
108
  new_password: n
108
109
  };
109
- return await C.getRequest("POST")("/account/changepassword", s);
110
+ return await C.getRequest("POST")("/account/changepassword", o);
110
111
  },
111
- create: async (t, n, s, c) => await C.getRequest("POST")("/account/create", {
112
+ create: async (t, n, o, s) => await C.getRequest("POST")("/account/create", {
112
113
  name: t,
113
114
  email: n,
114
- password: s,
115
- role_id: c
115
+ password: o,
116
+ role_id: s
116
117
  }),
117
118
  edit: async (t) => (t.reset_password || (t.new_password = void 0), await C.getRequest("PUT")("/account/edit", t)),
118
119
  delete: async (t) => {
119
120
  if (!!t)
120
121
  return C.getRequest("POST")("/account/delete", { id: t });
121
122
  }
122
- }, Gr = {
123
+ }, Xr = {
123
124
  list: async () => await C.getRequest("POST")("/api/key/list", {
124
125
  filter: {
125
126
  search: ""
@@ -141,7 +142,7 @@ const Br = {
141
142
  if (!!t)
142
143
  return C.getRequest("POST")("/api/key/delete", { id: t });
143
144
  }
144
- }, Jr = {
145
+ }, Qr = {
145
146
  list: async () => await C.getRequest("POST")("/datasource/list", {
146
147
  filter: {},
147
148
  sort: {
@@ -153,23 +154,17 @@ const Br = {
153
154
  pagesize: 100
154
155
  }
155
156
  }),
156
- create: async (t, n, s) => {
157
- try {
158
- return await C.getRequest("POST")("/datasource/create", { type: t, key: n, config: s });
159
- } catch (c) {
160
- return console.error(c), !1;
161
- }
162
- },
157
+ create: async (t, n, o) => C.getRequest("POST")("/datasource/create", { type: t, key: n, config: o }),
163
158
  delete: async (t) => {
164
159
  await C.getRequest("POST")("/datasource/delete", { id: t });
165
160
  }
166
- }, Hr = {
161
+ }, Zr = {
167
162
  list: async () => await C.getRequest("GET")("/role/list", {})
168
- }, D = {
169
- datasource: Jr,
170
- account: Br,
171
- role: Hr,
172
- api_key: Gr
163
+ }, k = {
164
+ datasource: Qr,
165
+ account: Hr,
166
+ role: Zr,
167
+ api_key: Xr
173
168
  }, de = {
174
169
  size: "sm",
175
170
  spacing: "md",
@@ -188,22 +183,22 @@ var fe = { exports: {} }, Q = {};
188
183
  * LICENSE file in the root directory of this source tree.
189
184
  */
190
185
  var Qe;
191
- function Xr() {
186
+ function et() {
192
187
  if (Qe)
193
188
  return Q;
194
189
  Qe = 1;
195
- var t = J, n = Symbol.for("react.element"), s = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, u = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
196
- function l(d, h, y) {
190
+ var t = J, n = Symbol.for("react.element"), o = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, l = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
191
+ function u(d, g, y) {
197
192
  var _, v = {}, f = null, O = null;
198
- y !== void 0 && (f = "" + y), h.key !== void 0 && (f = "" + h.key), h.ref !== void 0 && (O = h.ref);
199
- for (_ in h)
200
- c.call(h, _) && !i.hasOwnProperty(_) && (v[_] = h[_]);
193
+ y !== void 0 && (f = "" + y), g.key !== void 0 && (f = "" + g.key), g.ref !== void 0 && (O = g.ref);
194
+ for (_ in g)
195
+ s.call(g, _) && !i.hasOwnProperty(_) && (v[_] = g[_]);
201
196
  if (d && d.defaultProps)
202
- for (_ in h = d.defaultProps, h)
203
- v[_] === void 0 && (v[_] = h[_]);
204
- return { $$typeof: n, type: d, key: f, ref: O, props: v, _owner: u.current };
197
+ for (_ in g = d.defaultProps, g)
198
+ v[_] === void 0 && (v[_] = g[_]);
199
+ return { $$typeof: n, type: d, key: f, ref: O, props: v, _owner: l.current };
205
200
  }
206
- return Q.Fragment = s, Q.jsx = l, Q.jsxs = l, Q;
201
+ return Q.Fragment = o, Q.jsx = u, Q.jsxs = u, Q;
207
202
  }
208
203
  var Z = {};
209
204
  /**
@@ -216,46 +211,46 @@ var Z = {};
216
211
  * LICENSE file in the root directory of this source tree.
217
212
  */
218
213
  var Ze;
219
- function Qr() {
214
+ function rt() {
220
215
  return Ze || (Ze = 1, process.env.NODE_ENV !== "production" && function() {
221
- var t = J, n = Symbol.for("react.element"), s = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), d = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), _ = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), N = Symbol.iterator, V = "@@iterator";
216
+ var t = J, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), d = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), _ = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), M = Symbol.iterator, V = "@@iterator";
222
217
  function ge(e) {
223
218
  if (e === null || typeof e != "object")
224
219
  return null;
225
- var a = N && e[N] || e[V];
220
+ var a = M && e[M] || e[V];
226
221
  return typeof a == "function" ? a : null;
227
222
  }
228
- var U = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
223
+ var N = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
229
224
  function T(e) {
230
225
  {
231
- for (var a = arguments.length, o = new Array(a > 1 ? a - 1 : 0), p = 1; p < a; p++)
232
- o[p - 1] = arguments[p];
233
- ar("error", e, o);
226
+ for (var a = arguments.length, c = new Array(a > 1 ? a - 1 : 0), p = 1; p < a; p++)
227
+ c[p - 1] = arguments[p];
228
+ ar("error", e, c);
234
229
  }
235
230
  }
236
- function ar(e, a, o) {
231
+ function ar(e, a, c) {
237
232
  {
238
- var p = U.ReactDebugCurrentFrame, b = p.getStackAddendum();
239
- b !== "" && (a += "%s", o = o.concat([b]));
240
- var S = o.map(function(m) {
233
+ var p = N.ReactDebugCurrentFrame, b = p.getStackAddendum();
234
+ b !== "" && (a += "%s", c = c.concat([b]));
235
+ var S = c.map(function(m) {
241
236
  return String(m);
242
237
  });
243
238
  S.unshift("Warning: " + a), Function.prototype.apply.call(console[e], console, S);
244
239
  }
245
240
  }
246
- var ir = !1, or = !1, sr = !1, cr = !1, lr = !1, Ae;
247
- Ae = Symbol.for("react.module.reference");
241
+ var ir = !1, or = !1, sr = !1, cr = !1, lr = !1, ze;
242
+ ze = Symbol.for("react.module.reference");
248
243
  function ur(e) {
249
- return !!(typeof e == "string" || typeof e == "function" || e === c || e === i || lr || e === u || e === y || e === _ || cr || e === O || ir || or || sr || typeof e == "object" && e !== null && (e.$$typeof === f || e.$$typeof === v || e.$$typeof === l || e.$$typeof === d || e.$$typeof === h || e.$$typeof === Ae || e.getModuleId !== void 0));
244
+ return !!(typeof e == "string" || typeof e == "function" || e === s || e === i || lr || e === l || e === y || e === _ || cr || e === O || ir || or || sr || typeof e == "object" && e !== null && (e.$$typeof === f || e.$$typeof === v || e.$$typeof === u || e.$$typeof === d || e.$$typeof === g || e.$$typeof === ze || e.getModuleId !== void 0));
250
245
  }
251
- function dr(e, a, o) {
246
+ function dr(e, a, c) {
252
247
  var p = e.displayName;
253
248
  if (p)
254
249
  return p;
255
250
  var b = a.displayName || a.name || "";
256
- return b !== "" ? o + "(" + b + ")" : o;
251
+ return b !== "" ? c + "(" + b + ")" : c;
257
252
  }
258
- function ze(e) {
253
+ function Ae(e) {
259
254
  return e.displayName || "Context";
260
255
  }
261
256
  function F(e) {
@@ -266,13 +261,13 @@ function Qr() {
266
261
  if (typeof e == "string")
267
262
  return e;
268
263
  switch (e) {
269
- case c:
270
- return "Fragment";
271
264
  case s:
265
+ return "Fragment";
266
+ case o:
272
267
  return "Portal";
273
268
  case i:
274
269
  return "Profiler";
275
- case u:
270
+ case l:
276
271
  return "StrictMode";
277
272
  case y:
278
273
  return "Suspense";
@@ -283,11 +278,11 @@ function Qr() {
283
278
  switch (e.$$typeof) {
284
279
  case d:
285
280
  var a = e;
286
- return ze(a) + ".Consumer";
287
- case l:
288
- var o = e;
289
- return ze(o._context) + ".Provider";
290
- case h:
281
+ return Ae(a) + ".Consumer";
282
+ case u:
283
+ var c = e;
284
+ return Ae(c._context) + ".Provider";
285
+ case g:
291
286
  return dr(e, e.render, "ForwardRef");
292
287
  case v:
293
288
  var p = e.displayName || null;
@@ -303,14 +298,14 @@ function Qr() {
303
298
  }
304
299
  return null;
305
300
  }
306
- var Y = Object.assign, H = 0, Oe, De, xe, ke, Ie, je, Fe;
301
+ var Y = Object.assign, H = 0, Oe, ke, xe, De, je, Ie, Fe;
307
302
  function qe() {
308
303
  }
309
304
  qe.__reactDisabledLog = !0;
310
305
  function fr() {
311
306
  {
312
307
  if (H === 0) {
313
- Oe = console.log, De = console.info, xe = console.warn, ke = console.error, Ie = console.group, je = console.groupCollapsed, Fe = console.groupEnd;
308
+ Oe = console.log, ke = console.info, xe = console.warn, De = console.error, je = console.group, Ie = console.groupCollapsed, Fe = console.groupEnd;
314
309
  var e = {
315
310
  configurable: !0,
316
311
  enumerable: !0,
@@ -343,19 +338,19 @@ function Qr() {
343
338
  value: Oe
344
339
  }),
345
340
  info: Y({}, e, {
346
- value: De
341
+ value: ke
347
342
  }),
348
343
  warn: Y({}, e, {
349
344
  value: xe
350
345
  }),
351
346
  error: Y({}, e, {
352
- value: ke
347
+ value: De
353
348
  }),
354
349
  group: Y({}, e, {
355
- value: Ie
350
+ value: je
356
351
  }),
357
352
  groupCollapsed: Y({}, e, {
358
- value: je
353
+ value: Ie
359
354
  }),
360
355
  groupEnd: Y({}, e, {
361
356
  value: Fe
@@ -365,18 +360,18 @@ function Qr() {
365
360
  H < 0 && T("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
366
361
  }
367
362
  }
368
- var me = U.ReactCurrentDispatcher, he;
369
- function re(e, a, o) {
363
+ var he = N.ReactCurrentDispatcher, me;
364
+ function re(e, a, c) {
370
365
  {
371
- if (he === void 0)
366
+ if (me === void 0)
372
367
  try {
373
368
  throw Error();
374
369
  } catch (b) {
375
370
  var p = b.stack.trim().match(/\n( *(at )?)/);
376
- he = p && p[1] || "";
371
+ me = p && p[1] || "";
377
372
  }
378
373
  return `
379
- ` + he + e;
374
+ ` + me + e;
380
375
  }
381
376
  }
382
377
  var ve = !1, te;
@@ -388,16 +383,16 @@ function Qr() {
388
383
  if (!e || ve)
389
384
  return "";
390
385
  {
391
- var o = te.get(e);
392
- if (o !== void 0)
393
- return o;
386
+ var c = te.get(e);
387
+ if (c !== void 0)
388
+ return c;
394
389
  }
395
390
  var p;
396
391
  ve = !0;
397
392
  var b = Error.prepareStackTrace;
398
393
  Error.prepareStackTrace = void 0;
399
394
  var S;
400
- S = me.current, me.current = null, fr();
395
+ S = he.current, he.current = null, fr();
401
396
  try {
402
397
  if (a) {
403
398
  var m = function() {
@@ -432,41 +427,41 @@ function Qr() {
432
427
  }
433
428
  } catch (q) {
434
429
  if (q && p && typeof q.stack == "string") {
435
- for (var g = q.stack.split(`
436
- `), A = p.stack.split(`
437
- `), R = g.length - 1, P = A.length - 1; R >= 1 && P >= 0 && g[R] !== A[P]; )
430
+ for (var h = q.stack.split(`
431
+ `), z = p.stack.split(`
432
+ `), R = h.length - 1, P = z.length - 1; R >= 1 && P >= 0 && h[R] !== z[P]; )
438
433
  P--;
439
434
  for (; R >= 1 && P >= 0; R--, P--)
440
- if (g[R] !== A[P]) {
435
+ if (h[R] !== z[P]) {
441
436
  if (R !== 1 || P !== 1)
442
437
  do
443
- if (R--, P--, P < 0 || g[R] !== A[P]) {
444
- var k = `
445
- ` + g[R].replace(" at new ", " at ");
446
- return e.displayName && k.includes("<anonymous>") && (k = k.replace("<anonymous>", e.displayName)), typeof e == "function" && te.set(e, k), k;
438
+ if (R--, P--, P < 0 || h[R] !== z[P]) {
439
+ var D = `
440
+ ` + h[R].replace(" at new ", " at ");
441
+ return e.displayName && D.includes("<anonymous>") && (D = D.replace("<anonymous>", e.displayName)), typeof e == "function" && te.set(e, D), D;
447
442
  }
448
443
  while (R >= 1 && P >= 0);
449
444
  break;
450
445
  }
451
446
  }
452
447
  } finally {
453
- ve = !1, me.current = S, pr(), Error.prepareStackTrace = b;
448
+ ve = !1, he.current = S, pr(), Error.prepareStackTrace = b;
454
449
  }
455
450
  var B = e ? e.displayName || e.name : "", Xe = B ? re(B) : "";
456
451
  return typeof e == "function" && te.set(e, Xe), Xe;
457
452
  }
458
- function mr(e, a, o) {
453
+ function hr(e, a, c) {
459
454
  return Le(e, !1);
460
455
  }
461
- function hr(e) {
456
+ function mr(e) {
462
457
  var a = e.prototype;
463
458
  return !!(a && a.isReactComponent);
464
459
  }
465
- function ne(e, a, o) {
460
+ function ne(e, a, c) {
466
461
  if (e == null)
467
462
  return "";
468
463
  if (typeof e == "function")
469
- return Le(e, hr(e));
464
+ return Le(e, mr(e));
470
465
  if (typeof e == "string")
471
466
  return re(e);
472
467
  switch (e) {
@@ -477,44 +472,44 @@ function Qr() {
477
472
  }
478
473
  if (typeof e == "object")
479
474
  switch (e.$$typeof) {
480
- case h:
481
- return mr(e.render);
475
+ case g:
476
+ return hr(e.render);
482
477
  case v:
483
- return ne(e.type, a, o);
478
+ return ne(e.type, a, c);
484
479
  case f: {
485
480
  var p = e, b = p._payload, S = p._init;
486
481
  try {
487
- return ne(S(b), a, o);
482
+ return ne(S(b), a, c);
488
483
  } catch {
489
484
  }
490
485
  }
491
486
  }
492
487
  return "";
493
488
  }
494
- var ae = Object.prototype.hasOwnProperty, Ne = {}, Ue = U.ReactDebugCurrentFrame;
489
+ var ae = Object.prototype.hasOwnProperty, Me = {}, Ne = N.ReactDebugCurrentFrame;
495
490
  function ie(e) {
496
491
  if (e) {
497
- var a = e._owner, o = ne(e.type, e._source, a ? a.type : null);
498
- Ue.setExtraStackFrame(o);
492
+ var a = e._owner, c = ne(e.type, e._source, a ? a.type : null);
493
+ Ne.setExtraStackFrame(c);
499
494
  } else
500
- Ue.setExtraStackFrame(null);
495
+ Ne.setExtraStackFrame(null);
501
496
  }
502
- function vr(e, a, o, p, b) {
497
+ function vr(e, a, c, p, b) {
503
498
  {
504
499
  var S = Function.call.bind(ae);
505
500
  for (var m in e)
506
501
  if (S(e, m)) {
507
- var g = void 0;
502
+ var h = void 0;
508
503
  try {
509
504
  if (typeof e[m] != "function") {
510
- var A = Error((p || "React class") + ": " + o + " type `" + m + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[m] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
511
- throw A.name = "Invariant Violation", A;
505
+ var z = Error((p || "React class") + ": " + c + " type `" + m + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[m] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
506
+ throw z.name = "Invariant Violation", z;
512
507
  }
513
- g = e[m](a, m, p, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
508
+ h = e[m](a, m, p, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
514
509
  } catch (R) {
515
- g = R;
510
+ h = R;
516
511
  }
517
- g && !(g instanceof Error) && (ie(b), T("%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", o, m, typeof g), ie(null)), g instanceof Error && !(g.message in Ne) && (Ne[g.message] = !0, ie(b), T("Failed %s type: %s", o, g.message), ie(null));
512
+ h && !(h instanceof Error) && (ie(b), T("%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", c, m, typeof h), ie(null)), h instanceof Error && !(h.message in Me) && (Me[h.message] = !0, ie(b), T("Failed %s type: %s", c, h.message), ie(null));
518
513
  }
519
514
  }
520
515
  }
@@ -524,25 +519,25 @@ function Qr() {
524
519
  }
525
520
  function wr(e) {
526
521
  {
527
- var a = typeof Symbol == "function" && Symbol.toStringTag, o = a && e[Symbol.toStringTag] || e.constructor.name || "Object";
528
- return o;
522
+ var a = typeof Symbol == "function" && Symbol.toStringTag, c = a && e[Symbol.toStringTag] || e.constructor.name || "Object";
523
+ return c;
529
524
  }
530
525
  }
531
526
  function Sr(e) {
532
527
  try {
533
- return Me(e), !1;
528
+ return $e(e), !1;
534
529
  } catch {
535
530
  return !0;
536
531
  }
537
532
  }
538
- function Me(e) {
533
+ function $e(e) {
539
534
  return "" + e;
540
535
  }
541
- function $e(e) {
536
+ function Ue(e) {
542
537
  if (Sr(e))
543
- return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", wr(e)), Me(e);
538
+ return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", wr(e)), $e(e);
544
539
  }
545
- var X = U.ReactCurrentOwner, _r = {
540
+ var X = N.ReactCurrentOwner, _r = {
546
541
  key: !0,
547
542
  ref: !0,
548
543
  __self: !0,
@@ -567,62 +562,62 @@ function Qr() {
567
562
  }
568
563
  function Pr(e, a) {
569
564
  if (typeof e.ref == "string" && X.current && a && X.current.stateNode !== a) {
570
- var o = F(X.current.type);
571
- we[o] || (T('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', F(X.current.type), e.ref), we[o] = !0);
565
+ var c = F(X.current.type);
566
+ we[c] || (T('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', F(X.current.type), e.ref), we[c] = !0);
572
567
  }
573
568
  }
574
569
  function Er(e, a) {
575
570
  {
576
- var o = function() {
571
+ var c = function() {
577
572
  We || (We = !0, T("%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));
578
573
  };
579
- o.isReactWarning = !0, Object.defineProperty(e, "key", {
580
- get: o,
574
+ c.isReactWarning = !0, Object.defineProperty(e, "key", {
575
+ get: c,
581
576
  configurable: !0
582
577
  });
583
578
  }
584
579
  }
585
580
  function Cr(e, a) {
586
581
  {
587
- var o = function() {
582
+ var c = function() {
588
583
  Ve || (Ve = !0, T("%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));
589
584
  };
590
- o.isReactWarning = !0, Object.defineProperty(e, "ref", {
591
- get: o,
585
+ c.isReactWarning = !0, Object.defineProperty(e, "ref", {
586
+ get: c,
592
587
  configurable: !0
593
588
  });
594
589
  }
595
590
  }
596
- var Tr = function(e, a, o, p, b, S, m) {
597
- var g = {
591
+ var Tr = function(e, a, c, p, b, S, m) {
592
+ var h = {
598
593
  $$typeof: n,
599
594
  type: e,
600
595
  key: a,
601
- ref: o,
596
+ ref: c,
602
597
  props: m,
603
598
  _owner: S
604
599
  };
605
- return g._store = {}, Object.defineProperty(g._store, "validated", {
600
+ return h._store = {}, Object.defineProperty(h._store, "validated", {
606
601
  configurable: !1,
607
602
  enumerable: !1,
608
603
  writable: !0,
609
604
  value: !1
610
- }), Object.defineProperty(g, "_self", {
605
+ }), Object.defineProperty(h, "_self", {
611
606
  configurable: !1,
612
607
  enumerable: !1,
613
608
  writable: !1,
614
609
  value: p
615
- }), Object.defineProperty(g, "_source", {
610
+ }), Object.defineProperty(h, "_source", {
616
611
  configurable: !1,
617
612
  enumerable: !1,
618
613
  writable: !1,
619
614
  value: b
620
- }), Object.freeze && (Object.freeze(g.props), Object.freeze(g)), g;
615
+ }), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
621
616
  };
622
- function Ar(e, a, o, p, b) {
617
+ function zr(e, a, c, p, b) {
623
618
  {
624
- var S, m = {}, g = null, A = null;
625
- o !== void 0 && ($e(o), g = "" + o), Rr(a) && ($e(a.key), g = "" + a.key), yr(a) && (A = a.ref, Pr(a, b));
619
+ var S, m = {}, h = null, z = null;
620
+ c !== void 0 && (Ue(c), h = "" + c), Rr(a) && (Ue(a.key), h = "" + a.key), yr(a) && (z = a.ref, Pr(a, b));
626
621
  for (S in a)
627
622
  ae.call(a, S) && !_r.hasOwnProperty(S) && (m[S] = a[S]);
628
623
  if (e && e.defaultProps) {
@@ -630,18 +625,18 @@ function Qr() {
630
625
  for (S in R)
631
626
  m[S] === void 0 && (m[S] = R[S]);
632
627
  }
633
- if (g || A) {
628
+ if (h || z) {
634
629
  var P = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
635
- g && Er(m, P), A && Cr(m, P);
630
+ h && Er(m, P), z && Cr(m, P);
636
631
  }
637
- return Tr(e, g, A, b, p, X.current, m);
632
+ return Tr(e, h, z, b, p, X.current, m);
638
633
  }
639
634
  }
640
- var Se = U.ReactCurrentOwner, Ye = U.ReactDebugCurrentFrame;
635
+ var Se = N.ReactCurrentOwner, Ye = N.ReactDebugCurrentFrame;
641
636
  function K(e) {
642
637
  if (e) {
643
- var a = e._owner, o = ne(e.type, e._source, a ? a.type : null);
644
- Ye.setExtraStackFrame(o);
638
+ var a = e._owner, c = ne(e.type, e._source, a ? a.type : null);
639
+ Ye.setExtraStackFrame(c);
645
640
  } else
646
641
  Ye.setExtraStackFrame(null);
647
642
  }
@@ -662,13 +657,13 @@ Check the render method of \`` + e + "`.";
662
657
  return "";
663
658
  }
664
659
  }
665
- function zr(e) {
660
+ function Ar(e) {
666
661
  {
667
662
  if (e !== void 0) {
668
- var a = e.fileName.replace(/^.*[\\\/]/, ""), o = e.lineNumber;
663
+ var a = e.fileName.replace(/^.*[\\\/]/, ""), c = e.lineNumber;
669
664
  return `
670
665
 
671
- Check your code at ` + a + ":" + o + ".";
666
+ Check your code at ` + a + ":" + c + ".";
672
667
  }
673
668
  return "";
674
669
  }
@@ -678,10 +673,10 @@ Check your code at ` + a + ":" + o + ".";
678
673
  {
679
674
  var a = Ke();
680
675
  if (!a) {
681
- var o = typeof e == "string" ? e : e.displayName || e.name;
682
- o && (a = `
676
+ var c = typeof e == "string" ? e : e.displayName || e.name;
677
+ c && (a = `
683
678
 
684
- Check the top-level render call using <` + o + ">.");
679
+ Check the top-level render call using <` + c + ">.");
685
680
  }
686
681
  return a;
687
682
  }
@@ -691,12 +686,12 @@ Check the top-level render call using <` + o + ">.");
691
686
  if (!e._store || e._store.validated || e.key != null)
692
687
  return;
693
688
  e._store.validated = !0;
694
- var o = Or(a);
695
- if (Be[o])
689
+ var c = Or(a);
690
+ if (Be[c])
696
691
  return;
697
- Be[o] = !0;
692
+ Be[c] = !0;
698
693
  var p = "";
699
- e && e._owner && e._owner !== Se.current && (p = " It was passed a child from " + F(e._owner.type) + "."), K(e), T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, p), K(null);
694
+ e && e._owner && e._owner !== Se.current && (p = " It was passed a child from " + F(e._owner.type) + "."), K(e), T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', c, p), K(null);
700
695
  }
701
696
  }
702
697
  function Je(e, a) {
@@ -704,8 +699,8 @@ Check the top-level render call using <` + o + ">.");
704
699
  if (typeof e != "object")
705
700
  return;
706
701
  if (be(e))
707
- for (var o = 0; o < e.length; o++) {
708
- var p = e[o];
702
+ for (var c = 0; c < e.length; c++) {
703
+ var p = e[c];
709
704
  ye(p) && Ge(p, a);
710
705
  }
711
706
  else if (ye(e))
@@ -718,21 +713,21 @@ Check the top-level render call using <` + o + ">.");
718
713
  }
719
714
  }
720
715
  }
721
- function Dr(e) {
716
+ function kr(e) {
722
717
  {
723
718
  var a = e.type;
724
719
  if (a == null || typeof a == "string")
725
720
  return;
726
- var o;
721
+ var c;
727
722
  if (typeof a == "function")
728
- o = a.propTypes;
729
- else if (typeof a == "object" && (a.$$typeof === h || a.$$typeof === v))
730
- o = a.propTypes;
723
+ c = a.propTypes;
724
+ else if (typeof a == "object" && (a.$$typeof === g || a.$$typeof === v))
725
+ c = a.propTypes;
731
726
  else
732
727
  return;
733
- if (o) {
728
+ if (c) {
734
729
  var p = F(a);
735
- vr(o, e.props, "prop", p, e);
730
+ vr(c, e.props, "prop", p, e);
736
731
  } else if (a.PropTypes !== void 0 && !_e) {
737
732
  _e = !0;
738
733
  var b = F(a);
@@ -743,8 +738,8 @@ Check the top-level render call using <` + o + ">.");
743
738
  }
744
739
  function xr(e) {
745
740
  {
746
- for (var a = Object.keys(e.props), o = 0; o < a.length; o++) {
747
- var p = a[o];
741
+ for (var a = Object.keys(e.props), c = 0; c < a.length; c++) {
742
+ var p = a[c];
748
743
  if (p !== "children" && p !== "key") {
749
744
  K(e), T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", p), K(null);
750
745
  break;
@@ -753,57 +748,57 @@ Check the top-level render call using <` + o + ">.");
753
748
  e.ref !== null && (K(e), T("Invalid attribute `ref` supplied to `React.Fragment`."), K(null));
754
749
  }
755
750
  }
756
- function He(e, a, o, p, b, S) {
751
+ function He(e, a, c, p, b, S) {
757
752
  {
758
753
  var m = ur(e);
759
754
  if (!m) {
760
- var g = "";
761
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (g += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
762
- var A = zr(b);
763
- A ? g += A : g += Ke();
755
+ var h = "";
756
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (h += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
757
+ var z = Ar(b);
758
+ z ? h += z : h += Ke();
764
759
  var R;
765
- e === null ? R = "null" : be(e) ? R = "array" : e !== void 0 && e.$$typeof === n ? (R = "<" + (F(e.type) || "Unknown") + " />", g = " Did you accidentally export a JSX literal instead of a component?") : R = typeof e, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, g);
760
+ e === null ? R = "null" : be(e) ? R = "array" : e !== void 0 && e.$$typeof === n ? (R = "<" + (F(e.type) || "Unknown") + " />", h = " Did you accidentally export a JSX literal instead of a component?") : R = typeof e, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, h);
766
761
  }
767
- var P = Ar(e, a, o, b, S);
762
+ var P = zr(e, a, c, b, S);
768
763
  if (P == null)
769
764
  return P;
770
765
  if (m) {
771
- var k = a.children;
772
- if (k !== void 0)
766
+ var D = a.children;
767
+ if (D !== void 0)
773
768
  if (p)
774
- if (be(k)) {
775
- for (var B = 0; B < k.length; B++)
776
- Je(k[B], e);
777
- Object.freeze && Object.freeze(k);
769
+ if (be(D)) {
770
+ for (var B = 0; B < D.length; B++)
771
+ Je(D[B], e);
772
+ Object.freeze && Object.freeze(D);
778
773
  } else
779
774
  T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
780
775
  else
781
- Je(k, e);
776
+ Je(D, e);
782
777
  }
783
- return e === c ? xr(P) : Dr(P), P;
778
+ return e === s ? xr(P) : kr(P), P;
784
779
  }
785
780
  }
786
- function kr(e, a, o) {
787
- return He(e, a, o, !0);
781
+ function Dr(e, a, c) {
782
+ return He(e, a, c, !0);
788
783
  }
789
- function Ir(e, a, o) {
790
- return He(e, a, o, !1);
784
+ function jr(e, a, c) {
785
+ return He(e, a, c, !1);
791
786
  }
792
- var jr = Ir, Fr = kr;
793
- Z.Fragment = c, Z.jsx = jr, Z.jsxs = Fr;
787
+ var Ir = jr, Fr = Dr;
788
+ Z.Fragment = s, Z.jsx = Ir, Z.jsxs = Fr;
794
789
  }()), Z;
795
790
  }
796
791
  (function(t) {
797
- process.env.NODE_ENV === "production" ? t.exports = Xr() : t.exports = Qr();
792
+ process.env.NODE_ENV === "production" ? t.exports = et() : t.exports = rt();
798
793
  })(fe);
799
- const $ = fe.exports.Fragment, r = fe.exports.jsx, w = fe.exports.jsxs;
800
- function Zr({
794
+ const U = fe.exports.Fragment, r = fe.exports.jsx, w = fe.exports.jsxs;
795
+ function tt({
801
796
  postSubmit: t,
802
797
  styles: n = de
803
798
  }) {
804
799
  const {
805
- control: s,
806
- handleSubmit: c
800
+ control: o,
801
+ handleSubmit: s
807
802
  } = ee({
808
803
  defaultValues: {
809
804
  type: "postgresql",
@@ -820,35 +815,36 @@ function Zr({
820
815
  return /* @__PURE__ */ r(L, {
821
816
  mx: "auto",
822
817
  children: /* @__PURE__ */ w("form", {
823
- onSubmit: c(async ({
818
+ onSubmit: s(async ({
824
819
  type: i,
825
- key: l,
820
+ key: u,
826
821
  config: d
827
822
  }) => {
828
- if (M({
823
+ $({
829
824
  id: "for-creating",
830
825
  title: "Pending",
831
826
  message: "Adding data source...",
832
827
  loading: !0
833
- }), !await D.datasource.create(i, l, d)) {
834
- z({
828
+ });
829
+ try {
830
+ await k.datasource.create(i, u, d), A({
831
+ id: "for-creating",
832
+ title: "Successful",
833
+ message: "Data source is added",
834
+ color: "green"
835
+ }), t();
836
+ } catch (g) {
837
+ A({
835
838
  id: "for-creating",
836
839
  title: "Failed",
837
- message: "Test connection failed with given info",
840
+ message: g.message,
838
841
  color: "red"
839
842
  });
840
- return;
841
843
  }
842
- z({
843
- id: "for-creating",
844
- title: "Successful",
845
- message: "Data source is added",
846
- color: "green"
847
- }), t();
848
844
  }),
849
845
  children: [/* @__PURE__ */ r(E, {
850
846
  name: "type",
851
- control: s,
847
+ control: o,
852
848
  render: ({
853
849
  field: i
854
850
  }) => /* @__PURE__ */ r(qr, {
@@ -870,10 +866,10 @@ function Zr({
870
866
  })
871
867
  }), /* @__PURE__ */ r(E, {
872
868
  name: "key",
873
- control: s,
869
+ control: o,
874
870
  render: ({
875
871
  field: i
876
- }) => /* @__PURE__ */ r(I, {
872
+ }) => /* @__PURE__ */ r(j, {
877
873
  mb: n.spacing,
878
874
  size: n.size,
879
875
  required: !0,
@@ -884,14 +880,14 @@ function Zr({
884
880
  }), /* @__PURE__ */ r(er, {
885
881
  label: "Connection Info",
886
882
  labelPosition: "center"
887
- }), /* @__PURE__ */ w(j, {
883
+ }), /* @__PURE__ */ w(I, {
888
884
  grow: !0,
889
885
  children: [/* @__PURE__ */ r(E, {
890
886
  name: "config.host",
891
- control: s,
887
+ control: o,
892
888
  render: ({
893
889
  field: i
894
- }) => /* @__PURE__ */ r(I, {
890
+ }) => /* @__PURE__ */ r(j, {
895
891
  mb: n.spacing,
896
892
  size: n.size,
897
893
  required: !0,
@@ -903,7 +899,7 @@ function Zr({
903
899
  })
904
900
  }), /* @__PURE__ */ r(E, {
905
901
  name: "config.port",
906
- control: s,
902
+ control: o,
907
903
  render: ({
908
904
  field: i
909
905
  }) => /* @__PURE__ */ r(Lr, {
@@ -920,10 +916,10 @@ function Zr({
920
916
  })]
921
917
  }), /* @__PURE__ */ r(E, {
922
918
  name: "config.username",
923
- control: s,
919
+ control: o,
924
920
  render: ({
925
921
  field: i
926
- }) => /* @__PURE__ */ r(I, {
922
+ }) => /* @__PURE__ */ r(j, {
927
923
  mb: n.spacing,
928
924
  size: n.size,
929
925
  required: !0,
@@ -932,7 +928,7 @@ function Zr({
932
928
  })
933
929
  }), /* @__PURE__ */ r(E, {
934
930
  name: "config.password",
935
- control: s,
931
+ control: o,
936
932
  render: ({
937
933
  field: i
938
934
  }) => /* @__PURE__ */ r(ce, {
@@ -944,17 +940,17 @@ function Zr({
944
940
  })
945
941
  }), /* @__PURE__ */ r(E, {
946
942
  name: "config.database",
947
- control: s,
943
+ control: o,
948
944
  render: ({
949
945
  field: i
950
- }) => /* @__PURE__ */ r(I, {
946
+ }) => /* @__PURE__ */ r(j, {
951
947
  mb: n.spacing,
952
948
  size: n.size,
953
949
  required: !0,
954
950
  label: "Database",
955
951
  ...i
956
952
  })
957
- }), /* @__PURE__ */ r(j, {
953
+ }), /* @__PURE__ */ r(I, {
958
954
  position: "right",
959
955
  mt: n.spacing,
960
956
  children: /* @__PURE__ */ r(x, {
@@ -966,22 +962,22 @@ function Zr({
966
962
  })
967
963
  });
968
964
  }
969
- function et({
965
+ function nt({
970
966
  onSuccess: t,
971
967
  styles: n = de
972
968
  }) {
973
- const [s, c] = J.useState(!1), u = () => c(!0), i = () => c(!1);
974
- return /* @__PURE__ */ w($, {
969
+ const [o, s] = J.useState(!1), l = () => s(!0), i = () => s(!1);
970
+ return /* @__PURE__ */ w(U, {
975
971
  children: [/* @__PURE__ */ r(se, {
976
972
  overflow: "inside",
977
- opened: s,
978
- onClose: () => c(!1),
973
+ opened: o,
974
+ onClose: () => s(!1),
979
975
  title: "Add a data source",
980
976
  trapFocus: !0,
981
977
  onDragStart: (d) => {
982
978
  d.stopPropagation();
983
979
  },
984
- children: /* @__PURE__ */ r(Zr, {
980
+ children: /* @__PURE__ */ r(tt, {
985
981
  postSubmit: () => {
986
982
  t(), i();
987
983
  },
@@ -989,7 +985,7 @@ function et({
989
985
  })
990
986
  }), /* @__PURE__ */ r(x, {
991
987
  size: n.button.size,
992
- onClick: u,
988
+ onClick: l,
993
989
  leftIcon: /* @__PURE__ */ r(Ee, {
994
990
  size: 20
995
991
  }),
@@ -997,28 +993,53 @@ function et({
997
993
  })]
998
994
  });
999
995
  }
1000
- function rt({
996
+ function at(t, n) {
997
+ if (t == null)
998
+ return {};
999
+ var o = {}, s = Object.keys(t), l, i;
1000
+ for (i = 0; i < s.length; i++)
1001
+ l = s[i], !(n.indexOf(l) >= 0) && (o[l] = t[l]);
1002
+ return o;
1003
+ }
1004
+ function it(t, n) {
1005
+ if (t == null)
1006
+ return {};
1007
+ var o = at(t, n), s, l;
1008
+ if (Object.getOwnPropertySymbols) {
1009
+ var i = Object.getOwnPropertySymbols(t);
1010
+ for (l = 0; l < i.length; l++)
1011
+ s = i[l], !(n.indexOf(s) >= 0) && (!Object.prototype.propertyIsEnumerable.call(t, s) || (o[s] = t[s]));
1012
+ }
1013
+ return o;
1014
+ }
1015
+ var ot = ["size", "color", "stroke"];
1016
+ function st(t) {
1017
+ var n = t.size, o = n === void 0 ? 24 : n, s = t.color, l = s === void 0 ? "currentColor" : s, i = t.stroke, u = i === void 0 ? 2 : i, d = it(t, ot);
1018
+ return /* @__PURE__ */ w("svg", { xmlns: "http://www.w3.org/2000/svg", className: "icon icon-tabler icon-tabler-lock", width: o, height: o, viewBox: "0 0 24 24", strokeWidth: u, stroke: l, fill: "none", strokeLinecap: "round", strokeLinejoin: "round", ...d, children: [/* @__PURE__ */ r("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), /* @__PURE__ */ r("rect", { x: 5, y: 11, width: 14, height: 10, rx: 2 }), /* @__PURE__ */ r("circle", { cx: 12, cy: 16, r: 1 }), /* @__PURE__ */ r("path", { d: "M8 11v-4a4 4 0 0 1 8 0v4" })] });
1019
+ }
1020
+ function ct({
1001
1021
  id: t,
1002
1022
  name: n,
1023
+ isProtected: o,
1003
1024
  onSuccess: s,
1004
- styles: c = de
1025
+ styles: l = de
1005
1026
  }) {
1006
- const u = le(), i = async () => {
1007
- !t || (M({
1027
+ const i = le(), u = async () => {
1028
+ !t || ($({
1008
1029
  id: "for-deleting",
1009
1030
  title: "Pending",
1010
1031
  message: "Deleting data source...",
1011
1032
  loading: !0
1012
- }), await D.datasource.delete(t), z({
1033
+ }), await k.datasource.delete(t), A({
1013
1034
  id: "for-deleting",
1014
1035
  title: "Successful",
1015
1036
  message: `Data source [${n}] is deleted`,
1016
1037
  color: "green"
1017
1038
  }), s());
1018
- }, l = () => u.openConfirmModal({
1039
+ }, d = () => i.openConfirmModal({
1019
1040
  title: "Delete this data source?",
1020
1041
  children: /* @__PURE__ */ r(oe, {
1021
- size: c.size,
1042
+ size: l.size,
1022
1043
  children: "This action won't affect your database."
1023
1044
  }),
1024
1045
  labels: {
@@ -1026,41 +1047,55 @@ function rt({
1026
1047
  cancel: "Cancel"
1027
1048
  },
1028
1049
  onCancel: () => console.log("Cancel"),
1029
- onConfirm: i
1030
- });
1031
- return /* @__PURE__ */ r(x, {
1032
- size: c.button.size,
1050
+ onConfirm: u
1051
+ }), g = Mr();
1052
+ return o ? /* @__PURE__ */ r(Nr, {
1053
+ withArrow: !0,
1054
+ events: {
1055
+ hover: !0,
1056
+ touch: !1,
1057
+ focus: !1
1058
+ },
1059
+ label: "This is a preset datasource, it can not be deleted",
1060
+ children: /* @__PURE__ */ r("span", {
1061
+ children: /* @__PURE__ */ r(st, {
1062
+ size: 16,
1063
+ color: g.colors.gray[7]
1064
+ })
1065
+ })
1066
+ }) : /* @__PURE__ */ r(x, {
1067
+ size: l.button.size,
1033
1068
  color: "red",
1034
- onClick: l,
1069
+ onClick: d,
1035
1070
  leftIcon: /* @__PURE__ */ r(Ce, {
1036
1071
  size: 20
1037
1072
  }),
1038
1073
  children: "Delete"
1039
1074
  });
1040
1075
  }
1041
- function _t({
1076
+ function At({
1042
1077
  styles: t = de,
1043
1078
  config: n
1044
1079
  }) {
1045
1080
  ue(n);
1046
1081
  const {
1047
- data: s = [],
1048
- loading: c,
1049
- refresh: u
1082
+ data: o = [],
1083
+ loading: s,
1084
+ refresh: l
1050
1085
  } = G(async () => {
1051
1086
  const {
1052
1087
  data: i
1053
- } = await D.datasource.list();
1088
+ } = await k.datasource.list();
1054
1089
  return i;
1055
1090
  }, {
1056
1091
  refreshDeps: []
1057
1092
  });
1058
- return /* @__PURE__ */ w($, {
1059
- children: [/* @__PURE__ */ r(j, {
1093
+ return /* @__PURE__ */ w(U, {
1094
+ children: [/* @__PURE__ */ r(I, {
1060
1095
  pt: t.spacing,
1061
1096
  position: "right",
1062
- children: /* @__PURE__ */ r(et, {
1063
- onSuccess: u
1097
+ children: /* @__PURE__ */ r(nt, {
1098
+ onSuccess: l
1064
1099
  })
1065
1100
  }), /* @__PURE__ */ w(L, {
1066
1101
  mt: t.spacing,
@@ -1068,7 +1103,7 @@ function _t({
1068
1103
  position: "relative"
1069
1104
  },
1070
1105
  children: [/* @__PURE__ */ r(Re, {
1071
- visible: c
1106
+ visible: s
1072
1107
  }), /* @__PURE__ */ w(Pe, {
1073
1108
  horizontalSpacing: t.spacing,
1074
1109
  verticalSpacing: t.spacing,
@@ -1085,42 +1120,44 @@ function _t({
1085
1120
  })]
1086
1121
  })
1087
1122
  }), /* @__PURE__ */ r("tbody", {
1088
- children: s.map(({
1123
+ children: o.map(({
1089
1124
  id: i,
1090
- key: l,
1091
- type: d
1125
+ key: u,
1126
+ type: d,
1127
+ is_preset: g
1092
1128
  }) => /* @__PURE__ */ w("tr", {
1093
1129
  children: [/* @__PURE__ */ r("td", {
1094
1130
  width: 200,
1095
1131
  children: d
1096
1132
  }), /* @__PURE__ */ r("td", {
1097
- children: l
1133
+ children: u
1098
1134
  }), /* @__PURE__ */ r("td", {
1099
1135
  width: 200,
1100
- children: /* @__PURE__ */ r(j, {
1136
+ children: /* @__PURE__ */ r(I, {
1101
1137
  position: "left",
1102
- children: /* @__PURE__ */ r(rt, {
1138
+ children: /* @__PURE__ */ r(ct, {
1139
+ isProtected: g,
1103
1140
  id: i,
1104
- name: l,
1105
- onSuccess: u
1141
+ name: u,
1142
+ onSuccess: l
1106
1143
  })
1107
1144
  })
1108
1145
  })]
1109
- }, l))
1146
+ }, u))
1110
1147
  })]
1111
1148
  })]
1112
1149
  })]
1113
1150
  });
1114
1151
  }
1115
- const tt = tr(({
1152
+ const lt = tr(({
1116
1153
  label: t,
1117
1154
  value: n,
1118
- description: s,
1119
- ...c
1120
- }, u) => /* @__PURE__ */ w(rr, {
1155
+ description: o,
1156
+ ...s
1157
+ }, l) => /* @__PURE__ */ w(rr, {
1121
1158
  spacing: 2,
1122
- ref: u,
1123
- ...c,
1159
+ ref: l,
1160
+ ...s,
1124
1161
  children: [/* @__PURE__ */ r(oe, {
1125
1162
  size: "sm",
1126
1163
  children: t
@@ -1128,17 +1165,17 @@ const tt = tr(({
1128
1165
  size: "xs",
1129
1166
  color: "dimmed",
1130
1167
  className: "role-description",
1131
- children: s
1168
+ children: o
1132
1169
  })]
1133
1170
  })), Te = tr(({
1134
1171
  styles: t,
1135
1172
  value: n,
1136
- onChange: s
1137
- }, c) => {
1173
+ onChange: o
1174
+ }, s) => {
1138
1175
  const {
1139
- data: u = [],
1176
+ data: l = [],
1140
1177
  loading: i
1141
- } = G(async () => (await D.role.list()).map((d) => ({
1178
+ } = G(async () => (await k.role.list()).map((d) => ({
1142
1179
  label: d.name,
1143
1180
  value: d.id,
1144
1181
  description: d.description,
@@ -1146,14 +1183,14 @@ const tt = tr(({
1146
1183
  })), {
1147
1184
  refreshDeps: []
1148
1185
  });
1149
- return /* @__PURE__ */ r(Nr, {
1150
- ref: c,
1186
+ return /* @__PURE__ */ r($r, {
1187
+ ref: s,
1151
1188
  mb: t.spacing,
1152
1189
  size: t.size,
1153
1190
  required: !0,
1154
1191
  label: "Role",
1155
- itemComponent: tt,
1156
- data: u,
1192
+ itemComponent: lt,
1193
+ data: l,
1157
1194
  disabled: i,
1158
1195
  styles: () => ({
1159
1196
  item: {
@@ -1167,7 +1204,7 @@ const tt = tr(({
1167
1204
  }
1168
1205
  }),
1169
1206
  value: n,
1170
- onChange: s
1207
+ onChange: o
1171
1208
  });
1172
1209
  }), W = {
1173
1210
  size: "sm",
@@ -1176,45 +1213,45 @@ const tt = tr(({
1176
1213
  size: "xs"
1177
1214
  }
1178
1215
  };
1179
- function nt({
1216
+ function ut({
1180
1217
  postSubmit: t,
1181
1218
  styles: n = W,
1182
- initialRoleID: s
1219
+ initialRoleID: o
1183
1220
  }) {
1184
1221
  const {
1185
- control: c,
1186
- handleSubmit: u
1222
+ control: s,
1223
+ handleSubmit: l
1187
1224
  } = ee({
1188
1225
  defaultValues: {
1189
1226
  name: "",
1190
1227
  email: "",
1191
- role_id: s,
1228
+ role_id: o,
1192
1229
  password: ""
1193
1230
  }
1194
1231
  });
1195
1232
  return /* @__PURE__ */ r(L, {
1196
1233
  mx: "auto",
1197
1234
  children: /* @__PURE__ */ w("form", {
1198
- onSubmit: u(async ({
1199
- name: l,
1235
+ onSubmit: l(async ({
1236
+ name: u,
1200
1237
  email: d,
1201
- password: h,
1238
+ password: g,
1202
1239
  role_id: y
1203
1240
  }) => {
1204
1241
  try {
1205
- M({
1242
+ $({
1206
1243
  id: "for-creating",
1207
1244
  title: "Pending",
1208
1245
  message: "Adding account...",
1209
1246
  loading: !0
1210
- }), await D.account.create(l, d, h, y), z({
1247
+ }), await k.account.create(u, d, g, y), A({
1211
1248
  id: "for-creating",
1212
1249
  title: "Successful",
1213
1250
  message: "Account is added",
1214
1251
  color: "green"
1215
1252
  }), t();
1216
1253
  } catch (_) {
1217
- z({
1254
+ A({
1218
1255
  id: "for-creating",
1219
1256
  title: "Failed",
1220
1257
  message: _.message,
@@ -1224,51 +1261,51 @@ function nt({
1224
1261
  }),
1225
1262
  children: [/* @__PURE__ */ r(E, {
1226
1263
  name: "name",
1227
- control: c,
1264
+ control: s,
1228
1265
  render: ({
1229
- field: l
1230
- }) => /* @__PURE__ */ r(I, {
1266
+ field: u
1267
+ }) => /* @__PURE__ */ r(j, {
1231
1268
  mb: n.spacing,
1232
1269
  size: n.size,
1233
1270
  required: !0,
1234
1271
  label: "Username",
1235
- ...l
1272
+ ...u
1236
1273
  })
1237
1274
  }), /* @__PURE__ */ r(E, {
1238
1275
  name: "email",
1239
- control: c,
1276
+ control: s,
1240
1277
  render: ({
1241
- field: l
1242
- }) => /* @__PURE__ */ r(I, {
1278
+ field: u
1279
+ }) => /* @__PURE__ */ r(j, {
1243
1280
  mb: n.spacing,
1244
1281
  size: n.size,
1245
1282
  required: !0,
1246
1283
  label: "Email",
1247
- ...l
1284
+ ...u
1248
1285
  })
1249
1286
  }), /* @__PURE__ */ r(E, {
1250
1287
  name: "password",
1251
- control: c,
1288
+ control: s,
1252
1289
  render: ({
1253
- field: l
1290
+ field: u
1254
1291
  }) => /* @__PURE__ */ r(ce, {
1255
1292
  mb: n.spacing,
1256
1293
  size: n.size,
1257
1294
  required: !0,
1258
1295
  label: "Password",
1259
1296
  description: "Password must be at least 8 characters long",
1260
- ...l
1297
+ ...u
1261
1298
  })
1262
1299
  }), /* @__PURE__ */ r(E, {
1263
1300
  name: "role_id",
1264
- control: c,
1301
+ control: s,
1265
1302
  render: ({
1266
- field: l
1303
+ field: u
1267
1304
  }) => /* @__PURE__ */ r(Te, {
1268
1305
  styles: n,
1269
- ...l
1306
+ ...u
1270
1307
  })
1271
- }), /* @__PURE__ */ r(j, {
1308
+ }), /* @__PURE__ */ r(I, {
1272
1309
  position: "right",
1273
1310
  mt: n.spacing,
1274
1311
  children: /* @__PURE__ */ r(x, {
@@ -1280,28 +1317,28 @@ function nt({
1280
1317
  })
1281
1318
  });
1282
1319
  }
1283
- function at({
1320
+ function dt({
1284
1321
  onSuccess: t,
1285
1322
  styles: n = W,
1286
- initialRoleID: s
1323
+ initialRoleID: o
1287
1324
  }) {
1288
- const [c, u] = J.useState(!1), i = () => u(!0), l = () => u(!1);
1289
- return /* @__PURE__ */ w($, {
1325
+ const [s, l] = J.useState(!1), i = () => l(!0), u = () => l(!1);
1326
+ return /* @__PURE__ */ w(U, {
1290
1327
  children: [/* @__PURE__ */ r(se, {
1291
1328
  overflow: "inside",
1292
- opened: c,
1293
- onClose: () => u(!1),
1329
+ opened: s,
1330
+ onClose: () => l(!1),
1294
1331
  title: "Add an Account",
1295
1332
  trapFocus: !0,
1296
- onDragStart: (h) => {
1297
- h.stopPropagation();
1333
+ onDragStart: (g) => {
1334
+ g.stopPropagation();
1298
1335
  },
1299
- children: /* @__PURE__ */ r(nt, {
1336
+ children: /* @__PURE__ */ r(ut, {
1300
1337
  postSubmit: () => {
1301
- t(), l();
1338
+ t(), u();
1302
1339
  },
1303
1340
  styles: n,
1304
- initialRoleID: s
1341
+ initialRoleID: o
1305
1342
  })
1306
1343
  }), /* @__PURE__ */ r(x, {
1307
1344
  size: n.button.size,
@@ -1313,29 +1350,29 @@ function at({
1313
1350
  })]
1314
1351
  });
1315
1352
  }
1316
- function it({
1353
+ function ft({
1317
1354
  id: t,
1318
1355
  name: n,
1319
- onSuccess: s,
1320
- styles: c = W
1356
+ onSuccess: o,
1357
+ styles: s = W
1321
1358
  }) {
1322
- const u = le(), i = async () => {
1359
+ const l = le(), i = async () => {
1323
1360
  if (!!t) {
1324
- M({
1361
+ $({
1325
1362
  id: "for-deleting",
1326
1363
  title: "Pending",
1327
1364
  message: "Deleting account...",
1328
1365
  loading: !0
1329
1366
  });
1330
1367
  try {
1331
- await D.account.delete(t), z({
1368
+ await k.account.delete(t), A({
1332
1369
  id: "for-deleting",
1333
1370
  title: "Successful",
1334
1371
  message: `Account [${n}] is deleted`,
1335
1372
  color: "green"
1336
- }), s();
1373
+ }), o();
1337
1374
  } catch (d) {
1338
- z({
1375
+ A({
1339
1376
  id: "for-deleting",
1340
1377
  title: "Failed",
1341
1378
  message: d.message,
@@ -1343,7 +1380,7 @@ function it({
1343
1380
  });
1344
1381
  }
1345
1382
  }
1346
- }, l = () => u.openConfirmModal({
1383
+ }, u = () => l.openConfirmModal({
1347
1384
  title: "Delete this account?",
1348
1385
  labels: {
1349
1386
  confirm: "Confirm",
@@ -1353,80 +1390,80 @@ function it({
1353
1390
  onConfirm: i
1354
1391
  });
1355
1392
  return /* @__PURE__ */ r(x, {
1356
- size: c.button.size,
1393
+ size: s.button.size,
1357
1394
  color: "red",
1358
- onClick: l,
1395
+ onClick: u,
1359
1396
  leftIcon: /* @__PURE__ */ r(Ce, {
1360
1397
  size: 20
1361
1398
  }),
1362
1399
  children: "Delete"
1363
1400
  });
1364
1401
  }
1365
- function ot({
1402
+ function pt({
1366
1403
  id: t,
1367
1404
  name: n,
1368
- email: s,
1369
- role_id: c,
1370
- postSubmit: u,
1405
+ email: o,
1406
+ role_id: s,
1407
+ postSubmit: l,
1371
1408
  styles: i = W
1372
1409
  }) {
1373
1410
  const {
1374
- control: l,
1411
+ control: u,
1375
1412
  handleSubmit: d,
1376
- watch: h
1413
+ watch: g
1377
1414
  } = ee({
1378
1415
  defaultValues: {
1379
1416
  name: n,
1380
- email: s,
1381
- role_id: c,
1417
+ email: o,
1418
+ role_id: s,
1382
1419
  reset_password: !1,
1383
1420
  new_password: ""
1384
1421
  }
1385
1422
  }), y = async ({
1386
1423
  name: f,
1387
1424
  email: O,
1388
- role_id: N,
1425
+ role_id: M,
1389
1426
  reset_password: V,
1390
1427
  new_password: ge
1391
1428
  }) => {
1392
1429
  try {
1393
- M({
1430
+ $({
1394
1431
  id: "for-updating",
1395
1432
  title: "Pending",
1396
1433
  message: "Updating account...",
1397
1434
  loading: !0
1398
- }), await D.account.edit({
1435
+ }), await k.account.edit({
1399
1436
  id: t,
1400
1437
  name: f,
1401
1438
  email: O,
1402
- role_id: N,
1439
+ role_id: M,
1403
1440
  reset_password: V,
1404
1441
  new_password: ge
1405
- }), z({
1442
+ }), A({
1406
1443
  id: "for-updating",
1407
1444
  title: "Successful",
1408
1445
  message: "Account is updated",
1409
1446
  color: "green"
1410
- }), u();
1411
- } catch (U) {
1412
- z({
1447
+ }), l();
1448
+ } catch (N) {
1449
+ A({
1413
1450
  id: "for-updating",
1414
1451
  title: "Failed",
1415
- message: U.message,
1452
+ message: N.message,
1416
1453
  color: "red"
1417
1454
  });
1418
1455
  }
1419
- }, [_, v] = h(["reset_password", "new_password"]);
1456
+ }, [_, v] = g(["reset_password", "new_password"]);
1420
1457
  return /* @__PURE__ */ r(L, {
1421
1458
  mx: "auto",
1422
1459
  children: /* @__PURE__ */ w("form", {
1423
1460
  onSubmit: d(y),
1424
1461
  children: [/* @__PURE__ */ r(E, {
1425
1462
  name: "name",
1426
- control: l,
1463
+ control: u,
1427
1464
  render: ({
1428
1465
  field: f
1429
- }) => /* @__PURE__ */ r(I, {
1466
+ }) => /* @__PURE__ */ r(j, {
1430
1467
  mb: i.spacing,
1431
1468
  size: i.size,
1432
1469
  required: !0,
@@ -1435,10 +1472,10 @@ function ot({
1435
1472
  })
1436
1473
  }), /* @__PURE__ */ r(E, {
1437
1474
  name: "email",
1438
- control: l,
1475
+ control: u,
1439
1476
  render: ({
1440
1477
  field: f
1441
- }) => /* @__PURE__ */ r(I, {
1478
+ }) => /* @__PURE__ */ r(j, {
1442
1479
  mb: i.spacing,
1443
1480
  size: i.size,
1444
1481
  required: !0,
@@ -1447,7 +1484,7 @@ function ot({
1447
1484
  })
1448
1485
  }), /* @__PURE__ */ r(E, {
1449
1486
  name: "role_id",
1450
- control: l,
1487
+ control: u,
1451
1488
  render: ({
1452
1489
  field: f
1453
1490
  }) => /* @__PURE__ */ r(Te, {
@@ -1461,7 +1498,7 @@ function ot({
1461
1498
  labelPosition: "center"
1462
1499
  }), /* @__PURE__ */ r(E, {
1463
1500
  name: "reset_password",
1464
- control: l,
1501
+ control: u,
1465
1502
  render: ({
1466
1503
  field: f
1467
1504
  }) => /* @__PURE__ */ r(Ur, {
@@ -1478,7 +1515,7 @@ function ot({
1478
1515
  })
1479
1516
  }), _ && /* @__PURE__ */ r(E, {
1480
1517
  name: "new_password",
1481
- control: l,
1518
+ control: u,
1482
1519
  render: ({
1483
1520
  field: f
1484
1521
  }) => /* @__PURE__ */ r(ce, {
@@ -1490,7 +1527,7 @@ function ot({
1490
1527
  label: "New Password",
1491
1528
  ...f
1492
1529
  })
1493
- }), /* @__PURE__ */ r(j, {
1530
+ }), /* @__PURE__ */ r(I, {
1494
1531
  position: "right",
1495
1532
  mt: i.spacing,
1496
1533
  children: /* @__PURE__ */ r(x, {
@@ -1502,76 +1539,76 @@ function ot({
1502
1539
  })
1503
1540
  });
1504
1541
  }
1505
- function st({
1542
+ function gt({
1506
1543
  account: t,
1507
1544
  onSuccess: n,
1508
- styles: s = W
1545
+ styles: o = W
1509
1546
  }) {
1510
- const [c, u] = J.useState(!1), i = () => u(!0), l = () => u(!1), d = () => {
1511
- n(), l();
1547
+ const [s, l] = J.useState(!1), i = () => l(!0), u = () => l(!1), d = () => {
1548
+ n(), u();
1512
1549
  };
1513
- return /* @__PURE__ */ w($, {
1550
+ return /* @__PURE__ */ w(U, {
1514
1551
  children: [/* @__PURE__ */ r(se, {
1515
1552
  overflow: "inside",
1516
- opened: c,
1517
- onClose: () => u(!1),
1553
+ opened: s,
1554
+ onClose: () => l(!1),
1518
1555
  title: `Editing ${t.name}`,
1519
1556
  trapFocus: !0,
1520
- onDragStart: (h) => {
1521
- h.stopPropagation();
1557
+ onDragStart: (g) => {
1558
+ g.stopPropagation();
1522
1559
  },
1523
- children: /* @__PURE__ */ r(ot, {
1560
+ children: /* @__PURE__ */ r(pt, {
1524
1561
  ...t,
1525
1562
  postSubmit: d,
1526
- styles: s
1563
+ styles: o
1527
1564
  })
1528
1565
  }), /* @__PURE__ */ r(x, {
1529
- size: s.button.size,
1566
+ size: o.button.size,
1530
1567
  onClick: i,
1531
- leftIcon: /* @__PURE__ */ r(Mr, {
1568
+ leftIcon: /* @__PURE__ */ r(Wr, {
1532
1569
  size: 20
1533
1570
  }),
1534
1571
  children: "Edit"
1535
1572
  })]
1536
1573
  });
1537
1574
  }
1538
- function yt({
1575
+ function Ot({
1539
1576
  styles: t = W,
1540
1577
  config: n
1541
1578
  }) {
1542
1579
  var y, _;
1543
1580
  ue(n);
1544
1581
  const {
1545
- data: s = [],
1546
- loading: c,
1547
- refresh: u
1582
+ data: o = [],
1583
+ loading: s,
1584
+ refresh: l
1548
1585
  } = G(async () => {
1549
1586
  const {
1550
1587
  data: v
1551
- } = await D.account.list();
1588
+ } = await k.account.list();
1552
1589
  return v;
1553
1590
  }, {
1554
1591
  refreshDeps: []
1555
1592
  }), {
1556
1593
  data: i = [],
1557
- loading: l
1558
- } = G(async () => (await D.role.list()).map((f) => ({
1594
+ loading: u
1595
+ } = G(async () => (await k.role.list()).map((f) => ({
1559
1596
  label: f.name,
1560
1597
  value: f.id,
1561
1598
  description: f.description,
1562
1599
  disabled: f.id === 50
1563
1600
  })), {
1564
1601
  refreshDeps: []
1565
- }), d = nr(() => i.reduce((v, f) => (v.set(f.value, f.label), v), /* @__PURE__ */ new Map()), [i]), h = (v) => {
1602
+ }), d = nr(() => i.reduce((v, f) => (v.set(f.value, f.label), v), /* @__PURE__ */ new Map()), [i]), g = (v) => {
1566
1603
  var f;
1567
1604
  return (f = d.get(v)) != null ? f : v;
1568
1605
  };
1569
- return /* @__PURE__ */ w($, {
1570
- children: [/* @__PURE__ */ r(j, {
1606
+ return /* @__PURE__ */ w(U, {
1607
+ children: [/* @__PURE__ */ r(I, {
1571
1608
  pt: t.spacing,
1572
1609
  position: "right",
1573
- children: /* @__PURE__ */ r(at, {
1574
- onSuccess: u,
1610
+ children: /* @__PURE__ */ r(dt, {
1611
+ onSuccess: l,
1575
1612
  initialRoleID: (_ = (y = i == null ? void 0 : i[0]) == null ? void 0 : y.value) != null ? _ : 0
1576
1613
  })
1577
1614
  }), /* @__PURE__ */ w(L, {
@@ -1580,7 +1617,7 @@ function yt({
1580
1617
  position: "relative"
1581
1618
  },
1582
1619
  children: [/* @__PURE__ */ r(Re, {
1583
- visible: c || l
1620
+ visible: s || u
1584
1621
  }), /* @__PURE__ */ w(Pe, {
1585
1622
  horizontalSpacing: t.spacing,
1586
1623
  verticalSpacing: t.spacing,
@@ -1599,11 +1636,11 @@ function yt({
1599
1636
  })]
1600
1637
  })
1601
1638
  }), /* @__PURE__ */ r("tbody", {
1602
- children: s.map((v) => {
1639
+ children: o.map((v) => {
1603
1640
  const {
1604
1641
  id: f,
1605
1642
  name: O,
1606
- email: N,
1643
+ email: M,
1607
1644
  role_id: V
1608
1645
  } = v;
1609
1646
  return /* @__PURE__ */ w("tr", {
@@ -1612,21 +1649,21 @@ function yt({
1612
1649
  children: O
1613
1650
  }), /* @__PURE__ */ r("td", {
1614
1651
  width: 200,
1615
- children: N
1652
+ children: M
1616
1653
  }), /* @__PURE__ */ r("td", {
1617
1654
  width: 200,
1618
- children: h(V)
1655
+ children: g(V)
1619
1656
  }), /* @__PURE__ */ r("td", {
1620
1657
  width: 200,
1621
- children: /* @__PURE__ */ w(j, {
1658
+ children: /* @__PURE__ */ w(I, {
1622
1659
  position: "left",
1623
- children: [/* @__PURE__ */ r(st, {
1660
+ children: [/* @__PURE__ */ r(gt, {
1624
1661
  account: v,
1625
- onSuccess: u
1626
- }), /* @__PURE__ */ r(it, {
1662
+ onSuccess: l
1663
+ }), /* @__PURE__ */ r(ft, {
1627
1664
  id: f,
1628
1665
  name: O,
1629
- onSuccess: u
1666
+ onSuccess: l
1630
1667
  })]
1631
1668
  })
1632
1669
  })]
@@ -1637,13 +1674,13 @@ function yt({
1637
1674
  })]
1638
1675
  });
1639
1676
  }
1640
- function ct({
1677
+ function ht({
1641
1678
  postSubmit: t,
1642
1679
  styles: n = W
1643
1680
  }) {
1644
1681
  const {
1645
- control: s,
1646
- handleSubmit: c
1682
+ control: o,
1683
+ handleSubmit: s
1647
1684
  } = ee({
1648
1685
  defaultValues: {
1649
1686
  name: "",
@@ -1653,26 +1690,26 @@ function ct({
1653
1690
  return /* @__PURE__ */ r(L, {
1654
1691
  mx: "auto",
1655
1692
  children: /* @__PURE__ */ w("form", {
1656
- onSubmit: c(async ({
1693
+ onSubmit: s(async ({
1657
1694
  name: i,
1658
- password: l
1695
+ password: u
1659
1696
  }) => {
1660
1697
  try {
1661
- M({
1698
+ $({
1662
1699
  id: "for-login",
1663
1700
  title: "Pending",
1664
1701
  message: "Loggin in...",
1665
1702
  loading: !0
1666
1703
  });
1667
- const d = await D.account.login(i, l);
1668
- window.localStorage.setItem("token", d.token), z({
1704
+ const d = await k.account.login(i, u);
1705
+ window.localStorage.setItem("token", d.token), A({
1669
1706
  id: "for-login",
1670
1707
  title: "Successful",
1671
1708
  message: "Logged in",
1672
1709
  color: "green"
1673
1710
  }), t(d);
1674
1711
  } catch (d) {
1675
- z({
1712
+ A({
1676
1713
  id: "for-login",
1677
1714
  title: "Login Failed",
1678
1715
  message: d.message,
@@ -1682,10 +1719,10 @@ function ct({
1682
1719
  }),
1683
1720
  children: [/* @__PURE__ */ r(E, {
1684
1721
  name: "name",
1685
- control: s,
1722
+ control: o,
1686
1723
  render: ({
1687
1724
  field: i
1688
- }) => /* @__PURE__ */ r(I, {
1725
+ }) => /* @__PURE__ */ r(j, {
1689
1726
  mb: n.spacing,
1690
1727
  size: n.size,
1691
1728
  required: !0,
@@ -1694,7 +1731,7 @@ function ct({
1694
1731
  })
1695
1732
  }), /* @__PURE__ */ r(E, {
1696
1733
  name: "password",
1697
- control: s,
1734
+ control: o,
1698
1735
  render: ({
1699
1736
  field: i
1700
1737
  }) => /* @__PURE__ */ r(ce, {
@@ -1704,7 +1741,7 @@ function ct({
1704
1741
  label: "Password",
1705
1742
  ...i
1706
1743
  })
1707
- }), /* @__PURE__ */ r(j, {
1744
+ }), /* @__PURE__ */ r(I, {
1708
1745
  position: "right",
1709
1746
  mt: n.spacing,
1710
1747
  children: /* @__PURE__ */ r(x, {
@@ -1716,20 +1753,20 @@ function ct({
1716
1753
  })
1717
1754
  });
1718
1755
  }
1719
- function Rt({
1756
+ function kt({
1720
1757
  styles: t = W,
1721
1758
  config: n,
1722
- onSuccess: s
1759
+ onSuccess: o
1723
1760
  }) {
1724
- return ue(n), /* @__PURE__ */ r($, {
1761
+ return ue(n), /* @__PURE__ */ r(U, {
1725
1762
  children: /* @__PURE__ */ r(L, {
1726
1763
  mt: t.spacing,
1727
1764
  sx: {
1728
1765
  position: "relative"
1729
1766
  },
1730
- children: /* @__PURE__ */ r(ct, {
1767
+ children: /* @__PURE__ */ r(ht, {
1731
1768
  styles: t,
1732
- postSubmit: s
1769
+ postSubmit: o
1733
1770
  })
1734
1771
  })
1735
1772
  });
@@ -1741,75 +1778,75 @@ const pe = {
1741
1778
  size: "xs"
1742
1779
  }
1743
1780
  };
1744
- function lt({
1781
+ function mt({
1745
1782
  postSubmit: t,
1746
1783
  styles: n = pe,
1747
- initialRoleID: s
1784
+ initialRoleID: o
1748
1785
  }) {
1749
1786
  const {
1750
- control: c,
1751
- handleSubmit: u
1787
+ control: s,
1788
+ handleSubmit: l
1752
1789
  } = ee({
1753
1790
  defaultValues: {
1754
1791
  name: "",
1755
- role_id: s
1792
+ role_id: o
1756
1793
  }
1757
1794
  });
1758
1795
  return /* @__PURE__ */ r(L, {
1759
1796
  mx: "auto",
1760
1797
  children: /* @__PURE__ */ w("form", {
1761
- onSubmit: u(async ({
1762
- name: l,
1798
+ onSubmit: l(async ({
1799
+ name: u,
1763
1800
  role_id: d
1764
1801
  }) => {
1765
1802
  try {
1766
- M({
1803
+ $({
1767
1804
  id: "for-creating",
1768
1805
  title: "Pending",
1769
1806
  message: "Adding API Key...",
1770
1807
  loading: !0
1771
1808
  });
1772
1809
  const {
1773
- app_id: h,
1810
+ app_id: g,
1774
1811
  app_secret: y
1775
- } = await D.api_key.create(l, d);
1776
- z({
1812
+ } = await k.api_key.create(u, d);
1813
+ A({
1777
1814
  id: "for-creating",
1778
1815
  title: "Successful",
1779
1816
  message: "API Key is added",
1780
1817
  color: "green"
1781
- }), t(h, y);
1782
- } catch (h) {
1783
- z({
1818
+ }), t(g, y);
1819
+ } catch (g) {
1820
+ A({
1784
1821
  id: "for-creating",
1785
1822
  title: "Failed",
1786
- message: h.message,
1823
+ message: g.message,
1787
1824
  color: "red"
1788
1825
  });
1789
1826
  }
1790
1827
  }),
1791
1828
  children: [/* @__PURE__ */ r(E, {
1792
1829
  name: "name",
1793
- control: c,
1830
+ control: s,
1794
1831
  render: ({
1795
- field: l
1796
- }) => /* @__PURE__ */ r(I, {
1832
+ field: u
1833
+ }) => /* @__PURE__ */ r(j, {
1797
1834
  mb: n.spacing,
1798
1835
  size: n.size,
1799
1836
  required: !0,
1800
1837
  label: "Name",
1801
- ...l
1838
+ ...u
1802
1839
  })
1803
1840
  }), /* @__PURE__ */ r(E, {
1804
1841
  name: "role_id",
1805
- control: c,
1842
+ control: s,
1806
1843
  render: ({
1807
- field: l
1844
+ field: u
1808
1845
  }) => /* @__PURE__ */ r(Te, {
1809
1846
  styles: n,
1810
- ...l
1847
+ ...u
1811
1848
  })
1812
- }), /* @__PURE__ */ r(j, {
1849
+ }), /* @__PURE__ */ r(I, {
1813
1850
  position: "right",
1814
1851
  mt: n.spacing,
1815
1852
  children: /* @__PURE__ */ r(x, {
@@ -1821,31 +1858,31 @@ function lt({
1821
1858
  })
1822
1859
  });
1823
1860
  }
1824
- function ut({
1861
+ function vt({
1825
1862
  onSuccess: t,
1826
1863
  styles: n = pe,
1827
- initialRoleID: s
1864
+ initialRoleID: o
1828
1865
  }) {
1829
- const c = le(), [u, i] = J.useState(!1), l = () => i(!0), d = () => i(!1);
1830
- return /* @__PURE__ */ w($, {
1866
+ const s = le(), [l, i] = J.useState(!1), u = () => i(!0), d = () => i(!1);
1867
+ return /* @__PURE__ */ w(U, {
1831
1868
  children: [/* @__PURE__ */ r(se, {
1832
1869
  overflow: "inside",
1833
- opened: u,
1870
+ opened: l,
1834
1871
  onClose: () => i(!1),
1835
1872
  title: "Add an API Key",
1836
1873
  trapFocus: !0,
1837
1874
  onDragStart: (y) => {
1838
1875
  y.stopPropagation();
1839
1876
  },
1840
- children: /* @__PURE__ */ r(lt, {
1877
+ children: /* @__PURE__ */ r(mt, {
1841
1878
  postSubmit: (y, _) => {
1842
- d(), c.openModal({
1879
+ d(), s.openModal({
1843
1880
  title: "API Key is generated",
1844
1881
  children: /* @__PURE__ */ w(rr, {
1845
1882
  children: [/* @__PURE__ */ r(oe, {
1846
1883
  color: "dimmed",
1847
1884
  children: "Make sure you save it - you won't be able to access it again."
1848
- }), /* @__PURE__ */ r(I, {
1885
+ }), /* @__PURE__ */ r(j, {
1849
1886
  defaultValue: y,
1850
1887
  disabled: !0,
1851
1888
  label: "APP ID",
@@ -1854,7 +1891,7 @@ function ut({
1854
1891
  cursor: "text !important"
1855
1892
  }
1856
1893
  }
1857
- }), /* @__PURE__ */ r(I, {
1894
+ }), /* @__PURE__ */ r(j, {
1858
1895
  defaultValue: _,
1859
1896
  disabled: !0,
1860
1897
  label: "APP Secret",
@@ -1866,7 +1903,7 @@ function ut({
1866
1903
  }), /* @__PURE__ */ r(x, {
1867
1904
  size: "sm",
1868
1905
  onClick: () => {
1869
- Vr();
1906
+ Br();
1870
1907
  },
1871
1908
  children: "I've saved this API Key"
1872
1909
  })]
@@ -1877,11 +1914,11 @@ function ut({
1877
1914
  });
1878
1915
  },
1879
1916
  styles: n,
1880
- initialRoleID: s
1917
+ initialRoleID: o
1881
1918
  })
1882
1919
  }), /* @__PURE__ */ r(x, {
1883
1920
  size: n.button.size,
1884
- onClick: l,
1921
+ onClick: u,
1885
1922
  leftIcon: /* @__PURE__ */ r(Ee, {
1886
1923
  size: 20
1887
1924
  }),
@@ -1889,29 +1926,29 @@ function ut({
1889
1926
  })]
1890
1927
  });
1891
1928
  }
1892
- function dt({
1929
+ function bt({
1893
1930
  id: t,
1894
1931
  name: n,
1895
- onSuccess: s,
1896
- styles: c = pe
1932
+ onSuccess: o,
1933
+ styles: s = pe
1897
1934
  }) {
1898
- const u = le(), i = async () => {
1935
+ const l = le(), i = async () => {
1899
1936
  if (!!t) {
1900
- M({
1937
+ $({
1901
1938
  id: "for-deleting",
1902
1939
  title: "Pending",
1903
1940
  message: "Deleting API Key...",
1904
1941
  loading: !0
1905
1942
  });
1906
1943
  try {
1907
- await D.api_key.delete(t), z({
1944
+ await k.api_key.delete(t), A({
1908
1945
  id: "for-deleting",
1909
1946
  title: "Successful",
1910
1947
  message: `API Key [${n}] is deleted`,
1911
1948
  color: "green"
1912
- }), s();
1949
+ }), o();
1913
1950
  } catch (d) {
1914
- z({
1951
+ A({
1915
1952
  id: "for-deleting",
1916
1953
  title: "Failed",
1917
1954
  message: d.message,
@@ -1919,7 +1956,7 @@ function dt({
1919
1956
  });
1920
1957
  }
1921
1958
  }
1922
- }, l = () => u.openConfirmModal({
1959
+ }, u = () => l.openConfirmModal({
1923
1960
  title: "Delete this api-key?",
1924
1961
  labels: {
1925
1962
  confirm: "Confirm",
@@ -1929,52 +1966,52 @@ function dt({
1929
1966
  onConfirm: i
1930
1967
  });
1931
1968
  return /* @__PURE__ */ r(x, {
1932
- size: c.button.size,
1969
+ size: s.button.size,
1933
1970
  color: "red",
1934
- onClick: l,
1971
+ onClick: u,
1935
1972
  leftIcon: /* @__PURE__ */ r(Ce, {
1936
1973
  size: 20
1937
1974
  }),
1938
1975
  children: "Delete"
1939
1976
  });
1940
1977
  }
1941
- function Pt({
1978
+ function xt({
1942
1979
  styles: t = pe,
1943
1980
  config: n
1944
1981
  }) {
1945
1982
  var y, _;
1946
1983
  ue(n);
1947
1984
  const {
1948
- data: s = [],
1949
- loading: c,
1950
- refresh: u
1985
+ data: o = [],
1986
+ loading: s,
1987
+ refresh: l
1951
1988
  } = G(async () => {
1952
1989
  const {
1953
1990
  data: v
1954
- } = await D.api_key.list();
1991
+ } = await k.api_key.list();
1955
1992
  return v;
1956
1993
  }, {
1957
1994
  refreshDeps: []
1958
1995
  }), {
1959
1996
  data: i = [],
1960
- loading: l
1961
- } = G(async () => (await D.role.list()).map((f) => ({
1997
+ loading: u
1998
+ } = G(async () => (await k.role.list()).map((f) => ({
1962
1999
  label: f.name,
1963
2000
  value: f.id,
1964
2001
  description: f.description,
1965
2002
  disabled: f.id === 50
1966
2003
  })), {
1967
2004
  refreshDeps: []
1968
- }), d = nr(() => i.reduce((v, f) => (v.set(f.value, f.label), v), /* @__PURE__ */ new Map()), [i]), h = (v) => {
2005
+ }), d = nr(() => i.reduce((v, f) => (v.set(f.value, f.label), v), /* @__PURE__ */ new Map()), [i]), g = (v) => {
1969
2006
  var f;
1970
2007
  return (f = d.get(v)) != null ? f : v;
1971
2008
  };
1972
- return /* @__PURE__ */ w($, {
1973
- children: [/* @__PURE__ */ r(j, {
2009
+ return /* @__PURE__ */ w(U, {
2010
+ children: [/* @__PURE__ */ r(I, {
1974
2011
  pt: t.spacing,
1975
2012
  position: "right",
1976
- children: /* @__PURE__ */ r(ut, {
1977
- onSuccess: u,
2013
+ children: /* @__PURE__ */ r(vt, {
2014
+ onSuccess: l,
1978
2015
  initialRoleID: (_ = (y = i == null ? void 0 : i[0]) == null ? void 0 : y.value) != null ? _ : 0
1979
2016
  })
1980
2017
  }), /* @__PURE__ */ w(L, {
@@ -1983,7 +2020,7 @@ function Pt({
1983
2020
  position: "relative"
1984
2021
  },
1985
2022
  children: [/* @__PURE__ */ r(Re, {
1986
- visible: c || l
2023
+ visible: s || u
1987
2024
  }), /* @__PURE__ */ w(Pe, {
1988
2025
  horizontalSpacing: t.spacing,
1989
2026
  verticalSpacing: t.spacing,
@@ -2002,11 +2039,11 @@ function Pt({
2002
2039
  })]
2003
2040
  })
2004
2041
  }), /* @__PURE__ */ r("tbody", {
2005
- children: s.map((v) => {
2042
+ children: o.map((v) => {
2006
2043
  const {
2007
2044
  id: f,
2008
2045
  name: O,
2009
- app_id: N,
2046
+ app_id: M,
2010
2047
  role_id: V
2011
2048
  } = v;
2012
2049
  return /* @__PURE__ */ w("tr", {
@@ -2015,18 +2052,18 @@ function Pt({
2015
2052
  children: O
2016
2053
  }), /* @__PURE__ */ r("td", {
2017
2054
  width: 200,
2018
- children: N
2055
+ children: M
2019
2056
  }), /* @__PURE__ */ r("td", {
2020
2057
  width: 200,
2021
- children: h(V)
2058
+ children: g(V)
2022
2059
  }), /* @__PURE__ */ r("td", {
2023
2060
  width: 200,
2024
- children: /* @__PURE__ */ r(j, {
2061
+ children: /* @__PURE__ */ r(I, {
2025
2062
  position: "left",
2026
- children: /* @__PURE__ */ r(dt, {
2063
+ children: /* @__PURE__ */ r(bt, {
2027
2064
  id: f,
2028
2065
  name: O,
2029
- onSuccess: u
2066
+ onSuccess: l
2030
2067
  })
2031
2068
  })
2032
2069
  })]
@@ -2038,14 +2075,14 @@ function Pt({
2038
2075
  });
2039
2076
  }
2040
2077
  export {
2041
- Pt as APIKeyList,
2042
- yt as AccountList,
2043
- ut as AddAPIKey,
2044
- at as AddAccount,
2045
- et as AddDataSource,
2046
- _t as DataSourceList,
2047
- dt as DeleteAPIKey,
2048
- it as DeleteAccount,
2049
- rt as DeleteDataSource,
2050
- Rt as Login
2078
+ xt as APIKeyList,
2079
+ Ot as AccountList,
2080
+ vt as AddAPIKey,
2081
+ dt as AddAccount,
2082
+ nt as AddDataSource,
2083
+ At as DataSourceList,
2084
+ bt as DeleteAPIKey,
2085
+ ft as DeleteAccount,
2086
+ ct as DeleteDataSource,
2087
+ kt as Login
2051
2088
  };