@luminix/core 0.0.1-beta.3 → 0.0.1-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/contracts/Builder.d.ts +49 -0
  2. package/dist/contracts/Collection.d.ts +190 -0
  3. package/dist/contracts/ModelCollection.d.ts +9 -0
  4. package/dist/contracts/Plugin.d.ts +8 -0
  5. package/dist/contracts/PropertyBag.d.ts +21 -0
  6. package/dist/contracts/Relation/BelongsTo.d.ts +20 -0
  7. package/dist/contracts/Relation/BelongsToMany.d.ts +31 -0
  8. package/dist/contracts/Relation/HasMany.d.ts +21 -0
  9. package/dist/contracts/Relation/HasOne.d.ts +15 -0
  10. package/dist/contracts/Relation/HasOneOrMany.d.ts +10 -0
  11. package/dist/contracts/Relation/MorphMany.d.ts +21 -0
  12. package/dist/contracts/Relation/MorphOne.d.ts +15 -0
  13. package/dist/contracts/Relation/MorphOneOrMany.d.ts +10 -0
  14. package/dist/contracts/Relation/MorphTo.d.ts +8 -0
  15. package/dist/contracts/Relation/MorphToMany.d.ts +16 -0
  16. package/dist/contracts/Relation.d.ts +44 -0
  17. package/dist/core.js +678 -653
  18. package/dist/exceptions/AttributeNotFillableException.d.ts +4 -0
  19. package/dist/exceptions/FacadeNotFoundException.d.ts +4 -0
  20. package/dist/exceptions/MethodNotImplementedException.d.ts +4 -0
  21. package/dist/exceptions/ModelInvalidRelatedTypeException.d.ts +4 -0
  22. package/dist/exceptions/ModelNotFoundException.d.ts +4 -0
  23. package/dist/exceptions/ModelNotPersistedException.d.ts +4 -0
  24. package/dist/exceptions/ModelWithoutPrimaryKeyException.d.ts +4 -0
  25. package/dist/exceptions/NoEmbedException.d.ts +4 -0
  26. package/dist/exceptions/NoInverseRelationException.d.ts +4 -0
  27. package/dist/exceptions/NotModelException.d.ts +4 -0
  28. package/dist/exceptions/NotReducibleException.d.ts +4 -0
  29. package/dist/exceptions/ReducerOverrideException.d.ts +4 -0
  30. package/dist/exceptions/RouteNotFoundException.d.ts +4 -0
  31. package/dist/exceptions/UnsupportedRelationException.d.ts +4 -0
  32. package/dist/facades/App.d.ts +30 -0
  33. package/dist/facades/Auth.d.ts +14 -0
  34. package/dist/facades/Error.d.ts +15 -0
  35. package/dist/facades/Log.d.ts +14 -0
  36. package/dist/facades/Model.d.ts +41 -0
  37. package/dist/facades/Route.d.ts +32 -0
  38. package/dist/helpers/app.d.ts +5 -0
  39. package/dist/helpers/auth.d.ts +3 -0
  40. package/dist/helpers/collect.d.ts +1 -0
  41. package/dist/helpers/config.d.ts +5 -0
  42. package/dist/helpers/error.d.ts +4 -0
  43. package/dist/helpers/log.d.ts +5 -0
  44. package/dist/helpers/model.d.ts +6 -0
  45. package/dist/helpers/route.d.ts +5 -0
  46. package/dist/index.d.ts +24 -0
  47. package/dist/mixins/BaseModel.d.ts +5 -0
  48. package/dist/mixins/HasEvents.d.ts +15 -0
  49. package/dist/mixins/Reducible.d.ts +17 -0
  50. package/dist/support/collection.d.ts +4 -0
  51. package/dist/support/model.d.ts +3 -0
  52. package/dist/support/reader.d.ts +2 -0
  53. package/dist/support/searchParams.d.ts +1 -0
  54. package/dist/types/App.d.ts +72 -0
  55. package/dist/types/Auth.d.ts +13 -0
  56. package/dist/types/Builder.d.ts +47 -0
  57. package/dist/types/Collection.d.ts +1804 -0
  58. package/dist/types/Config.d.ts +29 -0
  59. package/dist/types/Error.d.ts +31 -0
  60. package/dist/types/Event.d.ts +14 -0
  61. package/dist/types/Log.d.ts +37 -0
  62. package/dist/types/Model.d.ts +165 -0
  63. package/dist/types/Plugin.d.ts +4 -0
  64. package/dist/types/PropertyBag.d.ts +25 -0
  65. package/dist/types/Reducer.d.ts +17 -0
  66. package/dist/types/Relation.d.ts +30 -0
  67. package/dist/types/Route.d.ts +22 -0
  68. package/dist/types/Support.d.ts +7 -0
  69. package/package.json +1 -1
  70. package/vite.config.js +2 -2
package/dist/core.js CHANGED
@@ -1,40 +1,41 @@
1
- var me = Object.defineProperty;
2
- var G = (n) => {
1
+ var Qe = Object.defineProperty;
2
+ var U = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
- var ge = (n, e, t) => e in n ? me(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
- var p = (n, e, t) => ge(n, typeof e != "symbol" ? e + "" : e, t), F = (n, e, t) => e.has(n) || G("Cannot " + t);
7
- var o = (n, e, t) => (F(n, e, "read from private field"), t ? t.call(n) : e.get(n)), q = (n, e, t) => e.has(n) ? G("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), P = (n, e, t, r) => (F(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t), V = (n, e, t) => (F(n, e, "access private method"), t);
5
+ var Ce = (n, e, t) => e in n ? Qe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
+ var g = (n, e, t) => Ce(n, typeof e != "symbol" ? e + "" : e, t), F = (n, e, t) => e.has(n) || U("Cannot " + t);
7
+ var o = (n, e, t) => (F(n, e, "read from private field"), t ? t.call(n) : e.get(n)), q = (n, e, t) => e.has(n) ? U("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), P = (n, e, t, r) => (F(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t), D = (n, e, t) => (F(n, e, "access private method"), t);
8
8
  import f from "lodash";
9
- import { produce as B, isDraftable as ye } from "immer";
10
- import K, { isAxiosError as we } from "axios";
11
- class O extends Error {
12
- constructor(e) {
13
- super(`[Luminix] Facade "${e}" not found`);
9
+ import { produce as v, isDraftable as Le } from "immer";
10
+ import K, { isAxiosError as Je } from "axios";
11
+ var X, Y;
12
+ class Ue extends (Y = Error, X = Symbol.toStringTag, Y) {
13
+ constructor(t) {
14
+ super(`[Luminix] Facade "${t}" not found`);
15
+ g(this, X, "FacadeNotFoundException");
14
16
  }
15
17
  }
16
- p(O, "name", "FacadeNotFoundException");
17
- class be {
18
+ class De {
18
19
  constructor(e) {
19
- p(this, "_user");
20
+ g(this, "_user");
20
21
  this.app = e;
21
22
  }
22
23
  attempt(e, t = !1, r) {
23
- const s = document.createElement("form");
24
- s.method = "post", s.action = this.app.make("route").url("login"), s.style.display = "none";
25
- const i = this.app.make("config").get("auth.csrf");
26
- if (typeof i == "string") {
27
- const c = document.createElement("input");
28
- c.type = "hidden", c.name = "_token", c.value = i, s.appendChild(c);
24
+ const i = document.createElement("form");
25
+ i.method = "post", i.action = this.app.make("route").url("login"), i.style.display = "none";
26
+ const s = this.app.make("config").get("auth.csrf");
27
+ if (typeof s == "string") {
28
+ const l = document.createElement("input");
29
+ l.type = "hidden", l.name = "_token", l.value = s, i.appendChild(l);
29
30
  }
30
31
  const u = document.createElement("input");
31
- u.type = "email", u.name = "email", u.value = e.email, s.appendChild(u);
32
+ u.type = "email", u.name = "email", u.value = e.email, i.appendChild(u);
32
33
  const a = document.createElement("input");
33
- if (a.type = "password", a.name = "password", a.value = e.password, s.appendChild(a), t) {
34
- const c = document.createElement("input");
35
- c.type = "checkbox", c.name = "remember", c.value = "1", c.checked = !0, s.appendChild(c);
34
+ if (a.type = "password", a.name = "password", a.value = e.password, i.appendChild(a), t) {
35
+ const l = document.createElement("input");
36
+ l.type = "checkbox", l.name = "remember", l.value = "1", l.checked = !0, i.appendChild(l);
36
37
  }
37
- r && s.addEventListener("submit", r), document.body.appendChild(s), s.submit();
38
+ r && i.addEventListener("submit", r), document.body.appendChild(i), i.submit();
38
39
  }
39
40
  check() {
40
41
  return !!this.app.make("config").get("auth.user");
@@ -44,17 +45,17 @@ class be {
44
45
  t.method = "post", t.action = this.app.make("route").url("logout"), t.style.display = "none";
45
46
  const r = this.app.make("config").get("auth.csrf");
46
47
  if (typeof r == "string") {
47
- const s = document.createElement("input");
48
- s.type = "hidden", s.name = "_token", s.value = r, t.appendChild(s);
48
+ const i = document.createElement("input");
49
+ i.type = "hidden", i.name = "_token", i.value = r, t.appendChild(i);
49
50
  }
50
51
  document.body.appendChild(t), e && t.addEventListener("submit", e), t.submit();
51
52
  }
52
53
  user() {
53
54
  if (!this._user) {
54
- const { model: e, config: t } = this.app.make(), r = e.make("user"), s = t.get("auth.user");
55
- if (!s)
55
+ const { model: e, config: t } = this.app.make(), r = e.make("user"), i = t.get("auth.user");
56
+ if (!i)
56
57
  return null;
57
- this._user = new r(s);
58
+ this._user = new r(i);
58
59
  }
59
60
  return this._user;
60
61
  }
@@ -63,7 +64,7 @@ class be {
63
64
  return ((e = this.user()) == null ? void 0 : e.getKey()) || null;
64
65
  }
65
66
  }
66
- class Ee {
67
+ class He {
67
68
  constructor(e) {
68
69
  this._debug = e;
69
70
  }
@@ -92,9 +93,9 @@ class Ee {
92
93
  this._debug && console.debug(...e);
93
94
  }
94
95
  }
95
- class v {
96
+ class A {
96
97
  constructor(e) {
97
- p(this, "locked", []);
98
+ g(this, "locked", []);
98
99
  this.bag = e, Object.freeze(this.bag);
99
100
  }
100
101
  get(e, t) {
@@ -110,14 +111,14 @@ class v {
110
111
  throw new Error("Cannot set the root path when there are locked paths");
111
112
  if (typeof t != "object" || t === null)
112
113
  throw new TypeError("Value must be an object");
113
- this.bag = B(this.bag, () => t), this.emit("change", {
114
+ this.bag = v(this.bag, () => t), this.emit("change", {
114
115
  path: e,
115
116
  value: t,
116
117
  type: "set"
117
118
  });
118
119
  return;
119
120
  }
120
- this.bag = B(this.bag, (r) => {
121
+ this.bag = v(this.bag, (r) => {
121
122
  f.set(r, e, t);
122
123
  }), this.emit("change", {
123
124
  path: e,
@@ -129,10 +130,10 @@ class v {
129
130
  if (typeof t != "object" || t === null)
130
131
  throw new TypeError("Value must be an object");
131
132
  if (e === ".") {
132
- if (this.locked.some((s) => f.has(t, s)))
133
+ if (this.locked.some((i) => f.has(t, i)))
133
134
  throw new Error(`Cannot merge a path "${e}" that would override a locked path`);
134
- this.bag = B(this.bag, (s) => ({
135
- ...s,
135
+ this.bag = v(this.bag, (i) => ({
136
+ ...i,
136
137
  ...t
137
138
  })), this.emit("change", {
138
139
  path: e,
@@ -157,7 +158,7 @@ class v {
157
158
  delete(e) {
158
159
  if (this.locked.some((t) => e.startsWith(t)))
159
160
  throw new Error(`Cannot delete a locked path "${e}"`);
160
- this.bag = B(this.bag, (t) => {
161
+ this.bag = v(this.bag, (t) => {
161
162
  f.unset(t, e);
162
163
  }), this.emit("change", {
163
164
  path: e,
@@ -171,7 +172,7 @@ class v {
171
172
  this.locked.push(e);
172
173
  }
173
174
  clone() {
174
- return new v(this.bag);
175
+ return new A(this.bag);
175
176
  }
176
177
  all() {
177
178
  return this.bag;
@@ -190,93 +191,94 @@ class v {
190
191
  emit(e, t) {
191
192
  }
192
193
  }
193
- function A(n) {
194
- var e, t, r, s, i, k;
195
- return s = class extends (t = n, e = Symbol.toStringTag, t) {
194
+ function S(n) {
195
+ var e, t, r, i, Ae, u;
196
+ return u = class extends (t = n, e = Symbol.toStringTag, t) {
196
197
  constructor(...d) {
197
198
  super(...d);
198
199
  q(this, i);
199
200
  q(this, r);
200
- p(this, e, n.name);
201
- P(this, r, V(this, i, k).call(this));
201
+ g(this, e, n.name);
202
+ P(this, r, D(this, i, Ae).call(this));
202
203
  }
203
- on(d, g) {
204
+ on(d, p) {
204
205
  if (typeof d != "string")
205
206
  throw new TypeError("event must be a string");
206
- if (typeof g != "function")
207
+ if (typeof p != "function")
207
208
  throw new TypeError("callback must be a function");
208
- return o(this, r).on(d, g);
209
+ return o(this, r).on(d, p);
209
210
  }
210
- once(d, g) {
211
+ once(d, p) {
211
212
  if (typeof d != "string")
212
213
  throw new TypeError("event must be a string");
213
- if (typeof g != "function")
214
+ if (typeof p != "function")
214
215
  throw new TypeError("callback must be a function");
215
- const b = o(this, r).on(d, (m) => {
216
- b(), g(m);
216
+ const y = o(this, r).on(d, (m) => {
217
+ y(), p(m);
217
218
  });
218
219
  }
219
- emit(d, g = {}) {
220
+ emit(d, p = {}) {
220
221
  if (typeof d != "string")
221
222
  throw new TypeError("event must be a string");
222
- if (typeof g != "object")
223
+ if (typeof p != "object")
223
224
  throw new TypeError("data must be an object");
224
225
  o(this, r).emit(d, {
225
- ...g,
226
+ ...p,
226
227
  source: this
227
228
  });
228
229
  }
229
- }, r = new WeakMap(), i = new WeakSet(), k = function() {
230
+ }, r = new WeakMap(), i = new WeakSet(), Ae = function() {
230
231
  return {
231
- emit(d, g) {
232
- for (let b = 0, m = this.events[d] || [], x = m.length; b < x; b++)
233
- m[b](g);
232
+ emit(d, p) {
233
+ for (let y = 0, m = this.events[d] || [], E = m.length; y < E; y++)
234
+ m[y](p);
234
235
  },
235
236
  events: {},
236
- on(d, g) {
237
- var b;
238
- return ((b = this.events)[d] || (b[d] = [])).push(g), () => {
237
+ on(d, p) {
238
+ var y;
239
+ return ((y = this.events)[d] || (y[d] = [])).push(p), () => {
239
240
  var m;
240
- this.events[d] = (m = this.events[d]) == null ? void 0 : m.filter((x) => g !== x);
241
+ this.events[d] = (m = this.events[d]) == null ? void 0 : m.filter((E) => p !== E);
241
242
  };
242
243
  }
243
244
  };
244
- }, p(s, "name", n.name), s;
245
+ }, u;
245
246
  }
246
- function X(...n) {
247
- return n.reduce((e, t) => e.flatMap((r) => t.map((s) => [r, s].flat())));
247
+ function H(...n) {
248
+ return n.reduce((e, t) => e.flatMap((r) => t.map((i) => [r, i].flat())));
248
249
  }
249
- function T(n) {
250
+ function $(n) {
250
251
  return !(typeof n != "object" || n === null || !Reflect.has(n, "constructor") || Reflect.get(n.constructor, "name") !== "Collection");
251
252
  }
252
- class y extends Error {
253
+ var Z, z;
254
+ class w extends (z = Error, Z = Symbol.toStringTag, z) {
253
255
  constructor() {
254
256
  super("[Luminix] Method not implemented.");
257
+ g(this, Z, "MethodNotImplementedException");
255
258
  }
256
259
  }
257
- p(y, "name", "MethodNotImplementedException");
258
- function l(n = [], e = L) {
260
+ function c(n = [], e = Q) {
259
261
  if (!Array.isArray(n))
260
262
  throw new TypeError("collect() expects an array");
261
- return new (A(e))([...n]);
263
+ return new (S(e))([...n]);
262
264
  }
263
- const $ = (n) => {
265
+ const T = (n) => {
264
266
  n.emit("change", {
265
267
  items: n.all()
266
268
  });
267
269
  }, I = (n, e) => Array.isArray(n) ? n[e] ?? null : n.get(e);
268
- var Z, z, h;
269
- class L {
270
+ var O, k, h;
271
+ class Q {
270
272
  constructor(e = []) {
271
- // static name = 'Collection';
273
+ // [Symbol.toStringTag] = 'Collection';
272
274
  q(this, h);
273
- p(this, Z, "Collection");
275
+ g(this, O, "Collection");
274
276
  P(this, h, e);
275
277
  }
276
278
  get items() {
277
279
  return [...o(this, h)];
278
280
  }
279
- [(z = Symbol.iterator, Z = Symbol.toStringTag, z)]() {
281
+ [(k = Symbol.iterator, O = Symbol.toStringTag, k)]() {
280
282
  return o(this, h)[Symbol.iterator]();
281
283
  }
282
284
  all() {
@@ -292,34 +294,34 @@ class L {
292
294
  const t = [];
293
295
  for (let r = 0; r < o(this, h).length; r += e)
294
296
  t.push(o(this, h).slice(r, r + e));
295
- return l(t.map((r) => l(r)));
297
+ return c(t.map((r) => c(r)));
296
298
  }
297
299
  chunkWhile(e) {
298
300
  const t = [];
299
- let r = l();
300
- for (let s = 0; s < o(this, h).length; s++)
301
- e(o(this, h)[s], s, r) ? r.push(o(this, h)[s]) : (t.push(r), r = l());
302
- return r.count() > 0 && t.push(r), l(t);
301
+ let r = c();
302
+ for (let i = 0; i < o(this, h).length; i++)
303
+ e(o(this, h)[i], i, r) ? r.push(o(this, h)[i]) : (t.push(r), r = c());
304
+ return r.count() > 0 && t.push(r), c(t);
303
305
  }
304
306
  collapse() {
305
- return l(o(this, h).flat());
307
+ return c(o(this, h).flat());
306
308
  }
307
309
  collect() {
308
- return l(o(this, h));
310
+ return c(o(this, h));
309
311
  }
310
312
  combine(e) {
311
313
  const t = {};
312
- return o(this, h).forEach((r, s) => {
314
+ return o(this, h).forEach((r, i) => {
313
315
  if (typeof r != "string")
314
316
  throw new TypeError("The `combine` method expects the keys to be strings");
315
- t[r] = I(e, s);
317
+ t[r] = I(e, i);
316
318
  }), t;
317
319
  }
318
320
  concat(e) {
319
- return Array.isArray(e) ? l([...o(this, h), ...e]) : l([...o(this, h), ...e.all()]);
321
+ return Array.isArray(e) ? c([...o(this, h), ...e]) : c([...o(this, h), ...e.all()]);
320
322
  }
321
323
  contains(e, t) {
322
- return typeof e == "function" ? o(this, h).some((r, s) => e(r, s, this)) : o(this, h).some((r) => {
324
+ return typeof e == "function" ? o(this, h).some((r, i) => e(r, i, this)) : o(this, h).some((r) => {
323
325
  if (typeof t > "u")
324
326
  return r == e;
325
327
  if (typeof e != "string")
@@ -331,7 +333,7 @@ class L {
331
333
  return o(this, h).length === 1;
332
334
  }
333
335
  containsStrict(e, t) {
334
- return typeof e == "function" ? o(this, h).some((r, s) => e(r, s, this)) : o(this, h).some((r) => {
336
+ return typeof e == "function" ? o(this, h).some((r, i) => e(r, i, this)) : o(this, h).some((r) => {
335
337
  if (typeof t > "u")
336
338
  return r === e;
337
339
  if (typeof e != "string")
@@ -343,9 +345,9 @@ class L {
343
345
  return o(this, h).length;
344
346
  }
345
347
  countBy(e) {
346
- return typeof e == "function" ? o(this, h).reduce((t, r, s) => {
347
- const i = e(r, s, this);
348
- return t[i] = t[i] ? t[i] + 1 : 1, t;
348
+ return typeof e == "function" ? o(this, h).reduce((t, r, i) => {
349
+ const s = e(r, i, this);
350
+ return t[s] = t[s] ? t[s] + 1 : 1, t;
349
351
  }, {}) : o(this, h).reduce((t, r) => {
350
352
  if (!["string", "number"].includes(typeof r))
351
353
  throw new TypeError("The countBy method expects the items to be strings or numbers");
@@ -353,16 +355,16 @@ class L {
353
355
  }, {});
354
356
  }
355
357
  crossJoin(...e) {
356
- return l(X(
358
+ return c(H(
357
359
  o(this, h),
358
360
  ...e.map((t) => Array.isArray(t) ? t : t.all())
359
361
  ));
360
362
  }
361
363
  diff(e) {
362
- return Array.isArray(e) ? l(o(this, h).filter((t) => !e.includes(t))) : l(o(this, h).filter((t) => !e.contains(t)));
364
+ return Array.isArray(e) ? c(o(this, h).filter((t) => !e.includes(t))) : c(o(this, h).filter((t) => !e.contains(t)));
363
365
  }
364
366
  doesntContain(e, t) {
365
- return typeof e == "function" ? o(this, h).every((r, s) => !e(r, s, this)) : o(this, h).every((r) => {
367
+ return typeof e == "function" ? o(this, h).every((r, i) => !e(r, i, this)) : o(this, h).every((r) => {
366
368
  if (typeof t > "u")
367
369
  return r != e;
368
370
  if (typeof e != "string")
@@ -374,10 +376,10 @@ class L {
374
376
  console.log(this.toArray());
375
377
  }
376
378
  duplicates(e) {
377
- return l(typeof e == "string" ? o(this, h).reduce((t, r, s) => (o(this, h).slice(s + 1).some((i) => i[e] == r[e]) && t.push(r[e]), t), []) : o(this, h).reduce((t, r, s) => (o(this, h).slice(s + 1).some((i) => i == r) && t.push(r), t), []));
379
+ return c(typeof e == "string" ? o(this, h).reduce((t, r, i) => (o(this, h).slice(i + 1).some((s) => s[e] == r[e]) && t.push(r[e]), t), []) : o(this, h).reduce((t, r, i) => (o(this, h).slice(i + 1).some((s) => s == r) && t.push(r), t), []));
378
380
  }
379
381
  duplicatesStrict(e) {
380
- return l(typeof e == "string" ? o(this, h).reduce((t, r, s) => (o(this, h).slice(s + 1).some((i) => i[e] === r[e]) && t.push(r[e]), t), []) : o(this, h).reduce((t, r, s) => (o(this, h).slice(s + 1).some((i) => i === r) && t.push(r), t), []));
382
+ return c(typeof e == "string" ? o(this, h).reduce((t, r, i) => (o(this, h).slice(i + 1).some((s) => s[e] === r[e]) && t.push(r[e]), t), []) : o(this, h).reduce((t, r, i) => (o(this, h).slice(i + 1).some((s) => s === r) && t.push(r), t), []));
381
383
  }
382
384
  each(e) {
383
385
  let t = 0;
@@ -390,7 +392,7 @@ class L {
390
392
  }
391
393
  eachSpread(e) {
392
394
  for (const t of this) {
393
- if (!Array.isArray(t) && !T(t))
395
+ if (!Array.isArray(t) && !$(t))
394
396
  throw new TypeError("The items in the collection must be arrays or collections");
395
397
  const r = Array.isArray(t) ? t : t.all();
396
398
  if (e(...r) === !1)
@@ -400,19 +402,19 @@ class L {
400
402
  }
401
403
  ensure(e) {
402
404
  const t = Array.isArray(e) ? e : [e];
403
- return o(this, h).forEach((r, s) => {
404
- if (!t.some((i) => typeof i == "string" ? typeof r === i : r instanceof i))
405
- throw new TypeError(`The item at index ${s} is not of the expected type`);
405
+ return o(this, h).forEach((r, i) => {
406
+ if (!t.some((s) => typeof s == "string" ? typeof r === s : r instanceof s))
407
+ throw new TypeError(`The item at index ${i} is not of the expected type`);
406
408
  }), this;
407
409
  }
408
410
  every(e) {
409
411
  return o(this, h).every((t, r) => e(t, r, this));
410
412
  }
411
413
  except(e) {
412
- return l(o(this, h).filter((t, r) => !e.includes(r)));
414
+ return c(o(this, h).filter((t, r) => !e.includes(r)));
413
415
  }
414
416
  filter(e) {
415
- return l(o(this, h).filter((t, r) => typeof e != "function" ? !!t : e(t, r, this)));
417
+ return c(o(this, h).filter((t, r) => typeof e != "function" ? !!t : e(t, r, this)));
416
418
  }
417
419
  first(e) {
418
420
  return typeof e == "function" ? o(this, h).find((t, r) => e(t, r, this)) ?? null : o(this, h)[0] ?? null;
@@ -427,38 +429,38 @@ class L {
427
429
  if (typeof e != "string")
428
430
  throw new TypeError("The key must be a string");
429
431
  if (typeof t > "u")
430
- return this.first((s) => !!s[e]);
432
+ return this.first((i) => !!i[e]);
431
433
  if (typeof r > "u")
432
- return o(this, h).find((s) => s[e] == t) ?? null;
434
+ return o(this, h).find((i) => i[e] == t) ?? null;
433
435
  if (typeof t != "string")
434
436
  throw new TypeError("The operator must be a string");
435
- return r === null ? o(this, h).find((s) => s[e] === null) ?? null : o(this, h).find((s) => {
437
+ return r === null ? o(this, h).find((i) => i[e] === null) ?? null : o(this, h).find((i) => {
436
438
  switch (t) {
437
439
  case "=":
438
- return s[e] == r;
440
+ return i[e] == r;
439
441
  case "!=":
440
- return s[e] != r;
442
+ return i[e] != r;
441
443
  case ">":
442
- return s[e] > r;
444
+ return i[e] > r;
443
445
  case "<":
444
- return s[e] < r;
446
+ return i[e] < r;
445
447
  case ">=":
446
- return s[e] >= r;
448
+ return i[e] >= r;
447
449
  case "<=":
448
- return s[e] <= r;
450
+ return i[e] <= r;
449
451
  default:
450
452
  throw new Error("Unsupported operator");
451
453
  }
452
454
  }) ?? null;
453
455
  }
454
456
  flatMap(e) {
455
- return l(o(this, h).flatMap((t, r) => e(t, r, this)));
457
+ return c(o(this, h).flatMap((t, r) => e(t, r, this)));
456
458
  }
457
459
  forget(e) {
458
- return o(this, h).splice(e, 1), $(this), this;
460
+ return o(this, h).splice(e, 1), T(this), this;
459
461
  }
460
462
  forPage(e, t) {
461
- return l(o(this, h).slice((e - 1) * t, e * t));
463
+ return c(o(this, h).slice((e - 1) * t, e * t));
462
464
  }
463
465
  get(e, t) {
464
466
  if (typeof e != "number")
@@ -467,19 +469,19 @@ class L {
467
469
  }
468
470
  groupBy(e) {
469
471
  const t = Array.isArray(e) ? e : [e];
470
- return o(this, h).reduce((r, s, i) => {
471
- const u = t.map((c) => {
472
- if (typeof c == "function") {
473
- const d = c(s, i, this);
472
+ return o(this, h).reduce((r, i, s) => {
473
+ const u = t.map((l) => {
474
+ if (typeof l == "function") {
475
+ const d = l(i, s, this);
474
476
  return Array.isArray(d) ? d : [d];
475
477
  }
476
- return [String(s[c])];
478
+ return [String(i[l])];
477
479
  });
478
- return X(...u).forEach((c) => {
479
- const d = Array.isArray(c) ? c.join(".") : c;
480
+ return H(...u).forEach((l) => {
481
+ const d = Array.isArray(l) ? l.join(".") : l;
480
482
  f.set(r, d, [
481
483
  ...f.get(r, d, []),
482
- s
484
+ i
483
485
  ]);
484
486
  }), r;
485
487
  }, {});
@@ -499,7 +501,7 @@ class L {
499
501
  return o(this, h).join(e);
500
502
  }
501
503
  if (typeof e == "function")
502
- return o(this, h).map((r, s) => e(r, s, this)).join(t);
504
+ return o(this, h).map((r, i) => e(r, i, this)).join(t);
503
505
  if (typeof e != "string")
504
506
  throw new TypeError("The key must be a string");
505
507
  if (!o(this, h).every((r) => typeof r == "object"))
@@ -507,7 +509,7 @@ class L {
507
509
  return o(this, h).map((r) => r[e]).join(t);
508
510
  }
509
511
  intersect(e) {
510
- return Array.isArray(e) ? l(o(this, h).filter((t) => e.includes(t))) : l(o(this, h).filter((t) => e.contains(t)));
512
+ return Array.isArray(e) ? c(o(this, h).filter((t) => e.includes(t))) : c(o(this, h).filter((t) => e.contains(t)));
511
513
  }
512
514
  isEmpty() {
513
515
  return o(this, h).length === 0;
@@ -520,7 +522,7 @@ class L {
520
522
  }
521
523
  keyBy(e) {
522
524
  if (typeof e == "function")
523
- return o(this, h).reduce((t, r, s) => (t[e(r, s, this)] = r, t), {});
525
+ return o(this, h).reduce((t, r, i) => (t[e(r, i, this)] = r, t), {});
524
526
  if (typeof e != "string")
525
527
  throw new TypeError("The key must be a string");
526
528
  return o(this, h).reduce((t, r) => (t[String(r[e])] = r, t), {});
@@ -529,31 +531,31 @@ class L {
529
531
  return typeof e == "function" ? o(this, h).toReversed().find((t, r) => e(t, r, this)) ?? null : o(this, h)[o(this, h).length - 1] ?? null;
530
532
  }
531
533
  map(e) {
532
- return l(o(this, h).map((t, r) => e(t, r, this)));
534
+ return c(o(this, h).map((t, r) => e(t, r, this)));
533
535
  }
534
536
  mapInto(e) {
535
- return l(o(this, h).map((t) => new e(t)));
537
+ return c(o(this, h).map((t) => new e(t)));
536
538
  }
537
539
  mapSpread(e) {
538
- return l(o(this, h).map((t) => {
539
- if (!Array.isArray(t) && !T(t))
540
+ return c(o(this, h).map((t) => {
541
+ if (!Array.isArray(t) && !$(t))
540
542
  throw new TypeError("The items in the collection must be arrays or collections");
541
543
  const r = Array.isArray(t) ? t : t.all();
542
544
  return e(...r);
543
545
  }));
544
546
  }
545
547
  mapToGroups(e) {
546
- return o(this, h).reduce((t, r, s) => {
547
- const i = e(r, s, this);
548
- return Object.entries(i).forEach(([u, a]) => {
548
+ return o(this, h).reduce((t, r, i) => {
549
+ const s = e(r, i, this);
550
+ return Object.entries(s).forEach(([u, a]) => {
549
551
  t[u] = t[u] ?? [], t[u].push(a);
550
552
  }), t;
551
553
  }, {});
552
554
  }
553
555
  mapWithKeys(e) {
554
- return o(this, h).reduce((t, r, s) => {
555
- const i = e(r, s, this);
556
- return Object.entries(i).forEach(([u, a]) => {
556
+ return o(this, h).reduce((t, r, i) => {
557
+ const s = e(r, i, this);
558
+ return Object.entries(s).forEach(([u, a]) => {
557
559
  t[u] = a;
558
560
  }), t;
559
561
  }, {});
@@ -563,33 +565,33 @@ class L {
563
565
  }
564
566
  median(e) {
565
567
  if (typeof e == "string") {
566
- const s = this.pluck(e).sort(), i = Math.floor(s.count() / 2);
567
- return s.count() % 2 === 0 ? l([I(s, i - 1), I(s, i)]).avg() : I(s, i);
568
+ const i = this.pluck(e).sort(), s = Math.floor(i.count() / 2);
569
+ return i.count() % 2 === 0 ? c([I(i, s - 1), I(i, s)]).avg() : I(i, s);
568
570
  }
569
571
  const t = o(this, h).toSorted(), r = Math.floor(t.length / 2);
570
- return t.length % 2 === 0 ? l([t[r - 1], t[r]]).avg() : t[r] ?? null;
572
+ return t.length % 2 === 0 ? c([t[r - 1], t[r]]).avg() : t[r] ?? null;
571
573
  }
572
574
  merge(e) {
573
- return Array.isArray(e) ? l([...o(this, h), ...e]) : l([...o(this, h), ...e.all()]);
575
+ return Array.isArray(e) ? c([...o(this, h), ...e]) : c([...o(this, h), ...e.all()]);
574
576
  }
575
577
  min(e) {
576
578
  return typeof e == "string" ? o(this, h).reduce((t, r) => r[e] < t ? r[e] : t, o(this, h)[0][e]) : o(this, h).reduce((t, r) => r < t ? r : t, o(this, h)[0]);
577
579
  }
578
580
  mode(e) {
579
- const t = typeof e == "string" ? this.filter((s) => ["number", "string"].includes(typeof s[e])).countBy((s) => s[e]) : this.countBy(), r = Math.max(...Object.values(t));
580
- return Object.entries(t).filter(([, s]) => s === r).map(([s]) => s);
581
+ const t = typeof e == "string" ? this.filter((i) => ["number", "string"].includes(typeof i[e])).countBy((i) => i[e]) : this.countBy(), r = Math.max(...Object.values(t));
582
+ return Object.entries(t).filter(([, i]) => i === r).map(([i]) => i);
581
583
  }
582
584
  nth(e, t = 0) {
583
585
  return this.chunk(e).filter((r) => r.count() > t).map((r) => r.get(t));
584
586
  }
585
587
  only(e) {
586
- return l(o(this, h).filter((t, r) => e.includes(r)));
588
+ return c(o(this, h).filter((t, r) => e.includes(r)));
587
589
  }
588
590
  pad(e, t = null) {
589
591
  const r = o(this, h).slice();
590
592
  for (; r.length < Math.abs(e); )
591
593
  e > 0 ? r.push(t) : r.unshift(t);
592
- return l(r);
594
+ return c(r);
593
595
  }
594
596
  partition(e) {
595
597
  return [
@@ -610,10 +612,10 @@ class L {
610
612
  }
611
613
  pipeThrough(e) {
612
614
  return e.reduce((t, r) => {
613
- if (!T(t) && !Array.isArray(t))
615
+ if (!$(t) && !Array.isArray(t))
614
616
  throw new TypeError("The pipeline expects the carry to be a collection or an array");
615
617
  return r(
616
- T(t) ? t : l(t)
618
+ $(t) ? t : c(t)
617
619
  );
618
620
  }, this);
619
621
  }
@@ -622,64 +624,64 @@ class L {
622
624
  }
623
625
  pop(e = 1) {
624
626
  const t = o(this, h).splice(o(this, h).length - e, e);
625
- return $(this), e === 1 ? t[0] ?? null : l(t);
627
+ return T(this), e === 1 ? t[0] ?? null : c(t);
626
628
  }
627
629
  prepend(e) {
628
630
  const t = o(this, h).unshift(e);
629
- return $(this), t;
631
+ return T(this), t;
630
632
  }
631
633
  pull(e) {
632
634
  const t = o(this, h).splice(e, 1)[0] ?? null;
633
- return $(this), t;
635
+ return T(this), t;
634
636
  }
635
637
  push(...e) {
636
638
  const t = o(this, h).push(...e);
637
- return $(this), t;
639
+ return T(this), t;
638
640
  }
639
641
  put(e, t) {
640
- return o(this, h).splice(e, 1, t), $(this), this;
642
+ return o(this, h).splice(e, 1, t), T(this), this;
641
643
  }
642
644
  random(e = 1) {
643
645
  if (o(this, h).length < e)
644
646
  throw new Error("The collection has fewer items than the requested amount");
645
- const t = l(f.sampleSize(o(this, h), e));
647
+ const t = c(f.sampleSize(o(this, h), e));
646
648
  return e === 1 ? t.first() : t;
647
649
  }
648
650
  reduce(e, t = null) {
649
- return o(this, h).reduce((r, s, i) => e(r, s, i, this), t);
651
+ return o(this, h).reduce((r, i, s) => e(r, i, s, this), t);
650
652
  }
651
653
  reject(e) {
652
654
  return this.filter((t, r) => !e(t, r, this));
653
655
  }
654
656
  replace(e) {
655
657
  const t = o(this, h).slice();
656
- return Object.entries(e).forEach(([r, s]) => {
657
- t[parseInt(r)] = s;
658
- }), l(t);
658
+ return Object.entries(e).forEach(([r, i]) => {
659
+ t[parseInt(r)] = i;
660
+ }), c(t);
659
661
  }
660
662
  reverse() {
661
- return l(o(this, h).toReversed());
663
+ return c(o(this, h).toReversed());
662
664
  }
663
665
  search(e, t = !1) {
664
- if (typeof e != "function" || o(this, h).every((s) => typeof s == "function")) {
665
- const s = o(this, h).findIndex((i) => t ? i === e : i == e);
666
- return s === -1 ? !1 : s;
666
+ if (typeof e != "function" || o(this, h).every((i) => typeof i == "function")) {
667
+ const i = o(this, h).findIndex((s) => t ? s === e : s == e);
668
+ return i === -1 ? !1 : i;
667
669
  }
668
- const r = o(this, h).findIndex((s, i) => e(s, i, this));
670
+ const r = o(this, h).findIndex((i, s) => e(i, s, this));
669
671
  return r === -1 ? !1 : r;
670
672
  }
671
673
  select(e) {
672
- return this.map((t) => e.reduce((r, s) => (r[s] = t[s], r), {}));
674
+ return this.map((t) => e.reduce((r, i) => (r[i] = t[i], r), {}));
673
675
  }
674
676
  shift(e = 1) {
675
677
  const t = o(this, h).splice(0, e);
676
- return $(this), e === 1 ? t[0] ?? null : l(t);
678
+ return T(this), e === 1 ? t[0] ?? null : c(t);
677
679
  }
678
680
  shuffle() {
679
- return l(f.shuffle(o(this, h)));
681
+ return c(f.shuffle(o(this, h)));
680
682
  }
681
683
  skip(e) {
682
- return l(o(this, h).slice(e));
684
+ return c(o(this, h).slice(e));
683
685
  }
684
686
  skipUntil(e) {
685
687
  return typeof e == "function" ? this.skip(o(this, h).findIndex((t, r) => e(t, r, this))) : this.skip(o(this, h).findIndex((t) => t == e));
@@ -688,13 +690,13 @@ class L {
688
690
  return typeof e == "function" ? this.skip(o(this, h).findIndex((t, r) => !e(t, r, this))) : this.skip(o(this, h).findIndex((t) => t != e));
689
691
  }
690
692
  slice(e, t) {
691
- return l(typeof t > "u" ? o(this, h).slice(e) : typeof e > "u" ? o(this, h).slice(0, t) : o(this, h).slice(e, e + t));
693
+ return c(typeof t > "u" ? o(this, h).slice(e) : typeof e > "u" ? o(this, h).slice(0, t) : o(this, h).slice(e, e + t));
692
694
  }
693
695
  sliding(e, t = 1) {
694
696
  const r = [];
695
- for (let s = 0; s < o(this, h).length && !(s + e > o(this, h).length); s += t)
696
- r.push(o(this, h).slice(s, s + e));
697
- return l(r.map((s) => l(s)));
697
+ for (let i = 0; i < o(this, h).length && !(i + e > o(this, h).length); i += t)
698
+ r.push(o(this, h).slice(i, i + e));
699
+ return c(r.map((i) => c(i)));
698
700
  }
699
701
  sole(e, t) {
700
702
  if (typeof e == "function") {
@@ -711,26 +713,26 @@ class L {
711
713
  return this.contains(...e);
712
714
  }
713
715
  sort(e) {
714
- return l(o(this, h).toSorted(e));
716
+ return c(o(this, h).toSorted(e));
715
717
  }
716
718
  sortBy(e, t = "asc") {
717
719
  if (typeof e == "function") {
718
720
  let r = -1;
719
- return l(o(this, h).toSorted((s, i) => (r++, e(s, r, this) - e(i, r, this))));
721
+ return c(o(this, h).toSorted((i, s) => (r++, e(i, r, this) - e(s, r, this))));
720
722
  }
721
723
  if (Array.isArray(e))
722
- return e.every((r) => Array.isArray(r)) ? l(o(this, h).toSorted((r, s) => {
723
- for (const [i, u] of e) {
724
- const a = r[i] ?? -1 / 0, c = s[i] ?? -1 / 0;
725
- if (a > c)
724
+ return e.every((r) => Array.isArray(r)) ? c(o(this, h).toSorted((r, i) => {
725
+ for (const [s, u] of e) {
726
+ const a = r[s] ?? -1 / 0, l = i[s] ?? -1 / 0;
727
+ if (a > l)
726
728
  return u === "asc" ? 1 : -1;
727
- if (a < c)
729
+ if (a < l)
728
730
  return u === "asc" ? -1 : 1;
729
731
  }
730
732
  return 0;
731
- })) : l(o(this, h).toSorted((r, s) => {
732
- for (const i of e) {
733
- const u = i(r, s);
733
+ })) : c(o(this, h).toSorted((r, i) => {
734
+ for (const s of e) {
735
+ const u = s(r, i);
734
736
  if (u !== 0)
735
737
  return u;
736
738
  }
@@ -738,31 +740,31 @@ class L {
738
740
  }));
739
741
  if (typeof e != "string")
740
742
  throw new TypeError("The key must be a string");
741
- return l(o(this, h).toSorted((r, s) => {
742
- const i = r[e] ?? -1 / 0, u = s[e] ?? -1 / 0;
743
- return i > u ? t === "asc" ? 1 : -1 : i < u ? t === "asc" ? -1 : 1 : 0;
743
+ return c(o(this, h).toSorted((r, i) => {
744
+ const s = r[e] ?? -1 / 0, u = i[e] ?? -1 / 0;
745
+ return s > u ? t === "asc" ? 1 : -1 : s < u ? t === "asc" ? -1 : 1 : 0;
744
746
  }));
745
747
  }
746
748
  sortDesc() {
747
749
  return this.sort((e, t) => e > t ? -1 : e < t ? 1 : 0);
748
750
  }
749
751
  splice(e, t, ...r) {
750
- const s = t === void 0 ? o(this, h).length : t, i = o(this, h).splice(e, s, ...r);
751
- return $(this), l(i);
752
+ const i = t === void 0 ? o(this, h).length : t, s = o(this, h).splice(e, i, ...r);
753
+ return T(this), c(s);
752
754
  }
753
755
  split(e) {
754
756
  const t = [];
755
757
  for (let r = 0; r < e; r++) {
756
- const s = o(this, h).slice(
758
+ const i = o(this, h).slice(
757
759
  t.flat().length,
758
760
  t.flat().length + Math.min(
759
761
  Math.ceil((o(this, h).length - t.flat().length) / (e - r)),
760
762
  o(this, h).length - t.flat().length
761
763
  )
762
764
  );
763
- t.push(l(s));
765
+ t.push(c(i));
764
766
  }
765
- return l(t);
767
+ return c(t);
766
768
  }
767
769
  splitIn(e) {
768
770
  const t = Math.ceil(o(this, h).length / e);
@@ -770,10 +772,10 @@ class L {
770
772
  }
771
773
  sum(e) {
772
774
  return typeof e == "string" ? o(this, h).reduce((t, r) => {
773
- const s = r[e];
774
- if (typeof s != "number")
775
+ const i = r[e];
776
+ if (typeof i != "number")
775
777
  throw new TypeError("The items must be numbers");
776
- return t + s;
778
+ return t + i;
777
779
  }, 0) : o(this, h).reduce((t, r) => {
778
780
  if (typeof r != "number")
779
781
  throw new TypeError("The items must be numbers");
@@ -781,7 +783,7 @@ class L {
781
783
  }, 0);
782
784
  }
783
785
  take(e) {
784
- return l(o(this, h).slice(0, e));
786
+ return c(o(this, h).slice(0, e));
785
787
  }
786
788
  takeUntil(e) {
787
789
  return typeof e == "function" ? this.take(o(this, h).findIndex((t, r) => e(t, r, this))) : this.take(o(this, h).findIndex((t) => t == e));
@@ -802,13 +804,13 @@ class L {
802
804
  transform(e) {
803
805
  for (const [t, r] of o(this, h).entries())
804
806
  o(this, h).splice(t, 1, e(r, t, this));
805
- return $(this), this;
807
+ return T(this), this;
806
808
  }
807
809
  unique(e) {
808
- return l(typeof e == "string" ? o(this, h).filter((t, r) => !o(this, h).some((s, i) => s[e] == t[e] && i !== r)) : [...new Set(o(this, h))]);
810
+ return c(typeof e == "string" ? o(this, h).filter((t, r) => !o(this, h).some((i, s) => i[e] == t[e] && s !== r)) : [...new Set(o(this, h))]);
809
811
  }
810
812
  uniqueStrict(e) {
811
- return l(typeof e == "string" ? o(this, h).filter((t, r) => !o(this, h).some((s, i) => s[e] === t[e] && i !== r)) : [...new Set(o(this, h))]);
813
+ return c(typeof e == "string" ? o(this, h).filter((t, r) => !o(this, h).some((i, s) => i[e] === t[e] && s !== r)) : [...new Set(o(this, h))]);
812
814
  }
813
815
  unless(e, t, r) {
814
816
  return e ? typeof r == "function" && r(this) : t(this), this;
@@ -833,112 +835,117 @@ class L {
833
835
  }
834
836
  where(e, t, r) {
835
837
  if (typeof r > "u")
836
- return l(o(this, h).filter((i) => i[e] == t));
838
+ return c(o(this, h).filter((s) => s[e] == t));
837
839
  if (typeof t != "string")
838
840
  throw new TypeError("The operator must be a string");
839
841
  if (r === null)
840
- return l(o(this, h).filter((i) => i[e] === null));
841
- const s = {
842
- "=": (i) => i[e] == r,
843
- "!=": (i) => i[e] != r,
844
- ">": (i) => i[e] > r,
845
- "<": (i) => i[e] < r,
846
- ">=": (i) => i[e] >= r,
847
- "<=": (i) => i[e] <= r
842
+ return c(o(this, h).filter((s) => s[e] === null));
843
+ const i = {
844
+ "=": (s) => s[e] == r,
845
+ "!=": (s) => s[e] != r,
846
+ ">": (s) => s[e] > r,
847
+ "<": (s) => s[e] < r,
848
+ ">=": (s) => s[e] >= r,
849
+ "<=": (s) => s[e] <= r
848
850
  };
849
- if (!(t in s))
851
+ if (!(t in i))
850
852
  throw new Error("Unsupported operator");
851
- return l(o(this, h).filter((i, u) => s[t](i, u, this)));
853
+ return c(o(this, h).filter((s, u) => i[t](s, u, this)));
852
854
  }
853
855
  whereStrict(e, t, r) {
854
856
  if (typeof r > "u")
855
- return l(o(this, h).filter((i) => i[e] === t));
857
+ return c(o(this, h).filter((s) => s[e] === t));
856
858
  if (typeof t != "string")
857
859
  throw new TypeError("The operator must be a string");
858
860
  if (r === null)
859
- return l(o(this, h).filter((i) => i[e] === null));
860
- const s = {
861
- "=": (i) => i[e] === r,
862
- "!=": (i) => i[e] !== r,
863
- ">": (i) => i[e] > r,
864
- "<": (i) => i[e] < r,
865
- ">=": (i) => i[e] >= r,
866
- "<=": (i) => i[e] <= r
861
+ return c(o(this, h).filter((s) => s[e] === null));
862
+ const i = {
863
+ "=": (s) => s[e] === r,
864
+ "!=": (s) => s[e] !== r,
865
+ ">": (s) => s[e] > r,
866
+ "<": (s) => s[e] < r,
867
+ ">=": (s) => s[e] >= r,
868
+ "<=": (s) => s[e] <= r
867
869
  };
868
- if (!(t in s))
870
+ if (!(t in i))
869
871
  throw new Error("Unsupported operator");
870
- return l(o(this, h).filter((i, u) => s[t](i, u, this)));
872
+ return c(o(this, h).filter((s, u) => i[t](s, u, this)));
871
873
  }
872
874
  whereBetween(e, [t, r]) {
873
- return l(o(this, h).filter((s) => s[e] >= t && s[e] <= r));
875
+ return c(o(this, h).filter((i) => i[e] >= t && i[e] <= r));
874
876
  }
875
877
  whereIn(e, t) {
876
- return l(o(this, h).filter((r) => t.includes(r[e])));
878
+ return c(o(this, h).filter((r) => t.includes(r[e])));
877
879
  }
878
880
  whereInstanceOf(e) {
879
- return l(o(this, h).filter((t) => t instanceof e));
881
+ return c(o(this, h).filter((t) => t instanceof e));
880
882
  }
881
883
  whereNotBetween(e, [t, r]) {
882
- return l(o(this, h).filter((s) => s[e] < t || s[e] > r));
884
+ return c(o(this, h).filter((i) => i[e] < t || i[e] > r));
883
885
  }
884
886
  whereNotIn(e, t) {
885
- return l(o(this, h).filter((r) => !t.includes(r[e])));
887
+ return c(o(this, h).filter((r) => !t.includes(r[e])));
886
888
  }
887
889
  whereNotNull(e) {
888
- return l(o(this, h).filter((t) => t[e] !== null));
890
+ return c(o(this, h).filter((t) => t[e] !== null));
889
891
  }
890
892
  whereNull(e) {
891
- return l(o(this, h).filter((t) => t[e] === null));
893
+ return c(o(this, h).filter((t) => t[e] === null));
892
894
  }
893
895
  zip(e) {
894
- return Array.isArray(e) ? l(
896
+ return Array.isArray(e) ? c(
895
897
  o(this, h).map((t, r) => [t, e[r] ?? null])
896
- ) : l(
898
+ ) : c(
897
899
  o(this, h).map((t, r) => [t, e.get(r)])
898
900
  );
899
901
  }
900
902
  // HasEvents methods
901
903
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
902
904
  on(e, t) {
903
- throw new y();
905
+ throw new w();
904
906
  }
905
907
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
906
908
  once(e, t) {
907
- throw new y();
909
+ throw new w();
908
910
  }
909
911
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
910
912
  emit(e, t) {
911
- throw new y();
913
+ throw new w();
912
914
  }
913
915
  }
914
916
  h = new WeakMap();
915
- const J = A(L);
916
- class Q extends L {
917
- intersect(e) {
918
- return this.filter((t) => e.some((r) => r.getKey() === t.getKey()));
917
+ const C = S(Q);
918
+ var ee, te;
919
+ class W extends (te = Q, ee = Symbol.toStringTag, te) {
920
+ constructor() {
921
+ super(...arguments);
922
+ g(this, ee, "Collection");
923
+ }
924
+ intersect(t) {
925
+ return this.filter((r) => t.some((i) => i.getKey() === r.getKey()));
919
926
  }
920
927
  }
921
- p(Q, "name", "Collection");
922
- const S = (...n) => {
928
+ const R = (...n) => {
923
929
  const e = new URLSearchParams();
924
930
  return n.forEach((t) => {
925
931
  const [, ...r] = t.split("?");
926
- new URLSearchParams(r.join("")).forEach((i, u) => {
927
- e.set(u, i);
932
+ new URLSearchParams(r.join("")).forEach((s, u) => {
933
+ e.set(u, s);
928
934
  });
929
935
  }), e;
930
936
  };
931
- class ee extends Error {
932
- constructor(e) {
933
- super(`[Luminix] Model "${e}" does not have a primary key`);
937
+ var re, se;
938
+ class We extends (se = Error, re = Symbol.toStringTag, se) {
939
+ constructor(t) {
940
+ super(`[Luminix] Model "${t}" does not have a primary key`);
941
+ g(this, re, "ModelWithoutPrimaryKeyException");
934
942
  }
935
943
  }
936
- p(ee, "name", "ModelWithoutPrimaryKeyException");
937
- const xe = A(v);
938
- class _e {
944
+ const Ge = S(A);
945
+ class Ve {
939
946
  constructor(e, t, r = {}) {
940
- p(this, "bag");
941
- this.facades = e, this.abstract = t, this.query = r, this.bag = new xe(r), this.bag.on("change", () => {
947
+ g(this, "bag");
948
+ this.facades = e, this.abstract = t, this.query = r, this.bag = new Ge(r), this.bag.on("change", () => {
942
949
  this.emit("change", {
943
950
  data: this.bag
944
951
  });
@@ -946,15 +953,15 @@ class _e {
946
953
  }
947
954
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
948
955
  on(e, t) {
949
- throw new y();
956
+ throw new w();
950
957
  }
951
958
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
952
959
  once(e, t) {
953
- throw new y();
960
+ throw new w();
954
961
  }
955
962
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
956
963
  emit(e, t) {
957
- throw new y();
964
+ throw new w();
958
965
  }
959
966
  lock(e) {
960
967
  this.bag.lock(e);
@@ -981,7 +988,7 @@ class _e {
981
988
  return this.bag.set(`where.${f.camelCase(e)}`, t), this;
982
989
  if (typeof t != "string")
983
990
  throw new Error(`Invalid operator ${t} provided for where clause.`);
984
- const i = {
991
+ const s = {
985
992
  "=": "",
986
993
  "!=": "NotEquals",
987
994
  ">": "GreaterThan",
@@ -989,7 +996,7 @@ class _e {
989
996
  "<": "LessThan",
990
997
  "<=": "LessThanOrEquals"
991
998
  }[t] || f.upperFirst(f.camelCase(t));
992
- return this.bag.set(`where.${f.camelCase(e)}${i}`, r), this;
999
+ return this.bag.set(`where.${f.camelCase(e)}${s}`, r), this;
993
1000
  }
994
1001
  orderBy(e, t = "asc") {
995
1002
  return this.bag.set("order_by", `${e}:${t}`), this;
@@ -1011,36 +1018,36 @@ class _e {
1011
1018
  const { data: r } = await this.facades.route.call(`luminix.${this.abstract}.index`, {
1012
1019
  params: this.bag.all(),
1013
1020
  errorBag: `${this.abstract}.fetch`
1014
- }), s = this.facades.model.make(this.abstract), i = l(r.data.map((u) => {
1015
- const a = new s(u);
1021
+ }), i = this.facades.model.make(this.abstract), s = c(r.data.map((u) => {
1022
+ const a = new i(u);
1016
1023
  return a.exists = !0, this.facades.model.emit("fetch", {
1017
1024
  class: this.abstract,
1018
1025
  model: a
1019
1026
  }), a;
1020
- }), Q);
1027
+ }), W);
1021
1028
  if (t) {
1022
1029
  const [u] = t.split("?");
1023
1030
  return {
1024
1031
  ...r,
1025
- data: i,
1032
+ data: s,
1026
1033
  links: {
1027
- first: `${u}?${S(t, r.links.first).toString()}`,
1028
- last: `${u}?${S(t, r.links.last).toString()}`,
1029
- next: r.links.next && `${u}?${S(t, r.links.next).toString()}`,
1030
- prev: r.links.prev && `${u}?${S(t, r.links.prev).toString()}`
1034
+ first: `${u}?${R(t, r.links.first).toString()}`,
1035
+ last: `${u}?${R(t, r.links.last).toString()}`,
1036
+ next: r.links.next && `${u}?${R(t, r.links.next).toString()}`,
1037
+ prev: r.links.prev && `${u}?${R(t, r.links.prev).toString()}`
1031
1038
  },
1032
1039
  meta: {
1033
1040
  ...r.meta,
1034
1041
  links: r.meta.links.map((a) => ({
1035
1042
  ...a,
1036
- url: a.url && `${u}?${S(t, a.url).toString()}`
1043
+ url: a.url && `${u}?${R(t, a.url).toString()}`
1037
1044
  }))
1038
1045
  }
1039
1046
  };
1040
1047
  }
1041
1048
  return {
1042
1049
  ...r,
1043
- data: i
1050
+ data: s
1044
1051
  };
1045
1052
  } catch (r) {
1046
1053
  throw this.emit("error", {
@@ -1065,7 +1072,7 @@ class _e {
1065
1072
  async find(e) {
1066
1073
  const t = this.facades.model.schema(this.abstract).primaryKey;
1067
1074
  if (!t)
1068
- throw new ee(this.abstract);
1075
+ throw new We(this.abstract);
1069
1076
  const r = await this.where(t, e).limit(1).exec(1);
1070
1077
  return this.emit("success", {
1071
1078
  response: r,
@@ -1076,11 +1083,11 @@ class _e {
1076
1083
  const e = this.facades.config.get("luminix.backend.api.max_per_page", 150), t = await this.limit(e).exec(1), r = t.meta.last_page;
1077
1084
  if (r === 1)
1078
1085
  return t.data;
1079
- const s = Array.from({ length: r - 1 }, (a, c) => c + 2), i = await Promise.all(
1080
- s.map((a) => this.limit(e).exec(a))
1081
- ), u = l(
1082
- i.reduce((a, c) => (a.push(...c.data), a), t.data).all(),
1083
- Q
1086
+ const i = Array.from({ length: r - 1 }, (a, l) => l + 2), s = await Promise.all(
1087
+ i.map((a) => this.limit(e).exec(a))
1088
+ ), u = c(
1089
+ s.reduce((a, l) => (a.push(...l.data), a), t.data).all(),
1090
+ W
1084
1091
  );
1085
1092
  return this.emit("success", {
1086
1093
  response: {
@@ -1091,39 +1098,43 @@ class _e {
1091
1098
  }), u;
1092
1099
  }
1093
1100
  }
1094
- const Me = A(_e);
1095
- class M extends Error {
1096
- constructor(e) {
1097
- super(`[Luminix] Expected ${e} to be reducible.`);
1101
+ const Xe = S(Ve);
1102
+ var ie, ne;
1103
+ class _ extends (ne = Error, ie = Symbol.toStringTag, ne) {
1104
+ constructor(t) {
1105
+ super(`[Luminix] Expected ${t} to be reducible.`);
1106
+ g(this, ie, "NotReducibleException");
1098
1107
  }
1099
1108
  }
1100
- p(M, "name", "NotReducibleException");
1101
- class E extends TypeError {
1102
- constructor(e, t = "Model") {
1103
- super(`[Luminix] "${e}" expects ${t}`);
1109
+ var oe, he;
1110
+ class x extends (he = TypeError, oe = Symbol.toStringTag, he) {
1111
+ constructor(t, r = "Model") {
1112
+ super(`[Luminix] "${t}" expects ${r}`);
1113
+ g(this, oe, "NotModelException");
1104
1114
  }
1105
1115
  }
1106
- p(E, "name", "NotModelException");
1107
- class te extends Error {
1108
- constructor(e, t, r, s) {
1109
- super(`[Luminix] Could not determine inverse relation for "${t}" in model "${e}". Please specify a relation in model "${r}" of type ${s} that points back to "${e}".`);
1116
+ var ue, ae;
1117
+ class Ye extends (ae = Error, ue = Symbol.toStringTag, ae) {
1118
+ constructor(t, r, i, s) {
1119
+ super(`[Luminix] Could not determine inverse relation for "${r}" in model "${t}". Please specify a relation in model "${i}" of type ${s} that points back to "${t}".`);
1120
+ g(this, ue, "NoInverseRelationException");
1110
1121
  }
1111
1122
  }
1112
- p(te, "name", "NoInverseRelationException");
1113
- class re extends Error {
1114
- constructor(e) {
1115
- super(`[Luminix] Relation "${e}" is not supported`);
1123
+ var le, ce;
1124
+ class Ze extends (ce = Error, le = Symbol.toStringTag, ce) {
1125
+ constructor(t) {
1126
+ super(`[Luminix] Relation "${t}" is not supported`);
1127
+ g(this, le, "UnsupportedRelationException");
1116
1128
  }
1117
1129
  }
1118
- p(re, "name", "UnsupportedRelationException");
1119
- function w(n) {
1130
+ function b(n) {
1120
1131
  return typeof n == "object" && n !== null && n.__isModel === !0;
1121
1132
  }
1122
1133
  class j {
1123
- constructor(e, t, r, s = null) {
1124
- p(this, "unsubscribeQuery", null);
1125
- if (this.meta = e, this.facades = t, this.parent = r, this.items = s, s !== null && !w(s) && !(T(s) && s.every(w)))
1126
- throw new E("Relation.constructor()", "Model, Collection<Model> or null");
1134
+ constructor(e, t, r, i = null) {
1135
+ g(this, "unsubscribeQuery", null);
1136
+ if (this.meta = e, this.facades = t, this.parent = r, this.items = i, i !== null && !b(i) && !($(i) && i.every(b)))
1137
+ throw new x("Relation.constructor()", "Model, Collection<Model> or null");
1127
1138
  }
1128
1139
  make(e) {
1129
1140
  const t = this.getRelated();
@@ -1139,13 +1150,13 @@ class j {
1139
1150
  if (this.isMultiple()) {
1140
1151
  if (!Array.isArray(e))
1141
1152
  throw new TypeError("Relation.make() expects an array");
1142
- this.set(l(e.map((r) => new t(r))));
1153
+ this.set(c(e.map((r) => new t(r))));
1143
1154
  }
1144
1155
  }
1145
1156
  guessInverseRelation() {
1146
1157
  const { relations: e } = this.getRelated().getSchema();
1147
1158
  if (typeof this.facades.model.guessInverseRelation != "function")
1148
- throw new M("ModelFacade");
1159
+ throw new _("ModelFacade");
1149
1160
  const t = this.getType(), r = this.facades.model.guessInverseRelation({
1150
1161
  HasOne: ["BelongsTo"],
1151
1162
  HasMany: ["BelongsTo"],
@@ -1157,18 +1168,18 @@ class j {
1157
1168
  MorphToMany: ["MorphToMany"]
1158
1169
  }, this.parent, t, this.getRelated());
1159
1170
  if (!(t in r))
1160
- throw new re(t);
1161
- for (const s in e) {
1162
- const i = e[s];
1163
- if ((i.model === this.parent.getType() || ["MorphOne", "MorphMany"].includes(t)) && r[t].includes(i.type))
1164
- return s;
1171
+ throw new Ze(t);
1172
+ for (const i in e) {
1173
+ const s = e[i];
1174
+ if ((s.model === this.parent.getType() || ["MorphOne", "MorphMany"].includes(t)) && r[t].includes(s.type))
1175
+ return i;
1165
1176
  }
1166
- throw new te(this.parent.getType(), t, this.getRelated().getSchemaName(), r[t].join(" or "));
1177
+ throw new Ye(this.parent.getType(), t, this.getRelated().getSchemaName(), r[t].join(" or "));
1167
1178
  }
1168
1179
  set(e) {
1169
- if (e !== null && !w(e) && !(T(e) && e.every(w)))
1170
- throw new E("Relation.set()", "Model, Collection<Model> or null");
1171
- !this.items || w(this.items) ? this.items = e : T(e) && this.items.splice(0, this.items.count(), ...e);
1180
+ if (e !== null && !b(e) && !($(e) && e.every(b)))
1181
+ throw new x("Relation.set()", "Model, Collection<Model> or null");
1182
+ !this.items || b(this.items) ? this.items = e : $(e) && this.items.splice(0, this.items.count(), ...e);
1172
1183
  }
1173
1184
  getForeignKey() {
1174
1185
  return this.meta.foreignKey;
@@ -1198,10 +1209,10 @@ class j {
1198
1209
  return this.items;
1199
1210
  }
1200
1211
  isSingle() {
1201
- return w(this.items);
1212
+ return b(this.items);
1202
1213
  }
1203
1214
  isMultiple() {
1204
- return T(this.items);
1215
+ return $(this.items);
1205
1216
  }
1206
1217
  getParent() {
1207
1218
  return this.parent;
@@ -1246,45 +1257,50 @@ class j {
1246
1257
  // return this.query().find(id);
1247
1258
  // }
1248
1259
  }
1249
- class U extends Error {
1250
- constructor(e, t) {
1251
- super(`[Luminix] Attribute "${t}" in model "${e}" is not fillable`);
1260
+ var de, fe;
1261
+ class Ne extends (fe = Error, de = Symbol.toStringTag, fe) {
1262
+ constructor(t, r) {
1263
+ super(`[Luminix] Attribute "${r}" in model "${t}" is not fillable`);
1264
+ g(this, de, "AttributeNotFillableException");
1252
1265
  }
1253
1266
  }
1254
- p(U, "name", "AttributeNotFillableException");
1255
- class D extends Error {
1256
- constructor(e, t) {
1257
- super(`[Luminix] Model "${e}" must be persisted before calling "${t}"`);
1267
+ var pe, me;
1268
+ class Re extends (me = Error, pe = Symbol.toStringTag, me) {
1269
+ constructor(t, r) {
1270
+ super(`[Luminix] Model "${t}" must be persisted before calling "${r}"`);
1271
+ g(this, pe, "ModelNotPersistedException");
1258
1272
  }
1259
1273
  }
1260
- p(D, "name", "ModelNotPersistedException");
1261
- function $e(n, e) {
1274
+ function ze(n, e) {
1275
+ var r;
1276
+ r = Symbol.toStringTag;
1262
1277
  class t {
1263
1278
  constructor(s = {}) {
1264
- p(this, "_attributes", new v({}));
1265
- p(this, "_original", {});
1266
- p(this, "_relations", {});
1267
- p(this, "_changedKeys", []);
1268
- p(this, "exists", !1);
1279
+ g(this, "_attributes", new A({}));
1280
+ g(this, "_original", {});
1281
+ g(this, "_relations", {});
1282
+ g(this, "_changedKeys", []);
1283
+ g(this, "exists", !1);
1284
+ g(this, r, f.upperFirst(f.camelCase(e)));
1269
1285
  this.makeRelations(), this.makeAttributes(s);
1270
1286
  }
1271
- cast(s, i) {
1272
- return s == null || !i ? s : ["boolean", "bool"].includes(i) ? !!s : ["date", "datetime", "immutable_date", "immutable_datetime"].includes(i) && typeof s == "string" ? new Date(s) : ["float", "double", "integer", "int"].includes(i) || i.startsWith("decimal:") ? Number(s) : s;
1287
+ cast(s, u) {
1288
+ return s == null || !u ? s : ["boolean", "bool"].includes(u) ? !!s : ["date", "datetime", "immutable_date", "immutable_datetime"].includes(u) && typeof s == "string" ? new Date(s) : ["float", "double", "integer", "int"].includes(u) || u.startsWith("decimal:") ? Number(s) : s;
1273
1289
  }
1274
- mutate(s, i) {
1275
- return s == null || !i ? s : ["boolean", "bool"].includes(i) ? !!s : ["date", "datetime", "immutable_date", "immutable_datetime"].includes(i) && s instanceof Date ? s.toISOString() : ["float", "double", "integer", "int"].includes(i) || i.startsWith("decimal:") ? Number(s) : s;
1290
+ mutate(s, u) {
1291
+ return s == null || !u ? s : ["boolean", "bool"].includes(u) ? !!s : ["date", "datetime", "immutable_date", "immutable_datetime"].includes(u) && s instanceof Date ? s.toISOString() : ["float", "double", "integer", "int"].includes(u) || u.startsWith("decimal:") ? Number(s) : s;
1276
1292
  }
1277
1293
  makeRelations() {
1278
1294
  const { relations: s } = n.model.schema(e);
1279
1295
  if (this._relations = {}, !s)
1280
1296
  return;
1281
1297
  if (typeof n.model.relationMap != "function")
1282
- throw new M("ModelFacade");
1283
- const i = n.model.relationMap({}, e);
1284
- Object.entries(s).forEach(([u, a]) => {
1285
- const { type: c } = a, d = c in i ? i[c] : j;
1286
- this._relations[u] = new d(
1287
- { name: u, ...a },
1298
+ throw new _("ModelFacade");
1299
+ const u = n.model.relationMap({}, e);
1300
+ Object.entries(s).forEach(([a, l]) => {
1301
+ const { type: d } = l, p = d in u ? u[d] : j;
1302
+ this._relations[a] = new p(
1303
+ { name: a, ...l },
1288
1304
  n,
1289
1305
  this,
1290
1306
  null
@@ -1292,12 +1308,12 @@ function $e(n, e) {
1292
1308
  });
1293
1309
  }
1294
1310
  makeAttributes(s) {
1295
- const { relations: i } = n.model.schema(e), u = Object.keys(i || {}), a = f.omit(s, u);
1296
- if (this.fillable.filter((c) => !(c in a)).forEach((c) => {
1297
- a[c] = null;
1298
- }), i && Object.keys(i).forEach((c) => {
1299
- this.relation(f.camelCase(c)).make(s[c]);
1300
- }), !this.validateJsonObject(a)) {
1311
+ const { relations: u } = n.model.schema(e), a = Object.keys(u || {}), l = f.omit(s, a);
1312
+ if (this.fillable.filter((d) => !(d in l)).forEach((d) => {
1313
+ l[d] = null;
1314
+ }), u && Object.keys(u).forEach((d) => {
1315
+ this.relation(f.camelCase(d)).make(s[d]);
1316
+ }), !this.validateJsonObject(l)) {
1301
1317
  if (n.config.get("app.env", "production") === "production")
1302
1318
  throw new TypeError(`[Luminix] Invalid attributes for model "${e}"`);
1303
1319
  n.log.warning(`Invalid attributes for model "${e}".
@@ -1306,7 +1322,7 @@ function $e(n, e) {
1306
1322
  abstract: e
1307
1323
  });
1308
1324
  }
1309
- this._attributes = new v(a), this._original = a, this._changedKeys = [];
1325
+ this._attributes = new A(l), this._original = l, this._changedKeys = [];
1310
1326
  }
1311
1327
  makePrimaryKeyReplacer() {
1312
1328
  return {
@@ -1360,23 +1376,23 @@ function $e(n, e) {
1360
1376
  model: this
1361
1377
  });
1362
1378
  }
1363
- dispatchErrorEvent(s, i) {
1379
+ dispatchErrorEvent(s, u) {
1364
1380
  this.emit("error", {
1365
1381
  error: s,
1366
- operation: i
1382
+ operation: u
1367
1383
  }), n.model.emit("error", {
1368
1384
  class: e,
1369
1385
  model: this,
1370
1386
  error: s,
1371
- operation: i
1387
+ operation: u
1372
1388
  });
1373
1389
  }
1374
1390
  updateChangedKeys(s) {
1375
- const i = (u, a) => typeof u == "object" && u !== null ? f.isEqual(u, a) : u == a;
1376
- !this._changedKeys.includes(s) && !i(this._original[s], this._attributes.get("key")) ? this._changedKeys.push(s) : this._changedKeys.includes(s) && i(this._original[s], this._attributes.get("key")) && this._changedKeys.splice(this._changedKeys.indexOf(s), 1);
1391
+ const u = (a, l) => typeof a == "object" && a !== null ? f.isEqual(a, l) : a == l;
1392
+ !this._changedKeys.includes(s) && !u(this._original[s], this._attributes.get("key")) ? this._changedKeys.push(s) : this._changedKeys.includes(s) && u(this._original[s], this._attributes.get("key")) && this._changedKeys.splice(this._changedKeys.indexOf(s), 1);
1377
1393
  }
1378
1394
  validateJsonObject(s) {
1379
- return typeof s != "object" || s === null ? !1 : Object.entries(s).every(([, i]) => ["boolean", "number", "string"].includes(typeof i) || i === null || this.validateJsonObject(i) || Array.isArray(i) && i.every((u) => this.validateJsonObject(u)));
1395
+ return typeof s != "object" || s === null ? !1 : Object.entries(s).every(([, u]) => ["boolean", "number", "string"].includes(typeof u) || u === null || this.validateJsonObject(u) || Array.isArray(u) && u.every((a) => this.validateJsonObject(a)));
1380
1396
  }
1381
1397
  get attributes() {
1382
1398
  return this._attributes.all();
@@ -1410,42 +1426,42 @@ function $e(n, e) {
1410
1426
  return this._changedKeys.length > 0;
1411
1427
  }
1412
1428
  getAttribute(s) {
1413
- let i = this._attributes.get(s, null);
1414
- s in this.casts && (i = this.cast(i, this.casts[s]));
1415
- const u = n.model[`model${f.upperFirst(f.camelCase(e))}Get${f.upperFirst(f.camelCase(s))}Attribute`];
1416
- if (typeof u != "function")
1417
- throw new M("ModelFacade");
1418
- return u.bind(n.model)(i, this);
1419
- }
1420
- setAttribute(s, i) {
1429
+ let u = this._attributes.get(s, null);
1430
+ s in this.casts && (u = this.cast(u, this.casts[s]));
1431
+ const a = n.model[`model${f.upperFirst(f.camelCase(e))}Get${f.upperFirst(f.camelCase(s))}Attribute`];
1432
+ if (typeof a != "function")
1433
+ throw new _("ModelFacade");
1434
+ return a.bind(n.model)(u, this);
1435
+ }
1436
+ setAttribute(s, u) {
1421
1437
  if (!this.fillable.includes(s)) {
1422
1438
  if (n.config.get("app.env", "production") === "production")
1423
- throw new U(e, s);
1439
+ throw new Ne(e, s);
1424
1440
  n.log.warning(`[Luminix] Trying to set a non-fillable attribute "${s}" in model "${e}".
1425
1441
  This will throw an error in production.`);
1426
1442
  return;
1427
1443
  }
1428
- const u = n.model[`model${f.upperFirst(f.camelCase(e))}Set${f.upperFirst(f.camelCase(s))}Attribute`];
1429
- if (typeof u != "function")
1430
- throw new M("ModelFacade");
1431
- const a = u.bind(n.model)(
1432
- this.mutate(i, this.casts[s]),
1444
+ const a = n.model[`model${f.upperFirst(f.camelCase(e))}Set${f.upperFirst(f.camelCase(s))}Attribute`];
1445
+ if (typeof a != "function")
1446
+ throw new _("ModelFacade");
1447
+ const l = a.bind(n.model)(
1448
+ this.mutate(u, this.casts[s]),
1433
1449
  this
1434
1450
  );
1435
- if (!this.validateJsonObject({ [s]: a })) {
1451
+ if (!this.validateJsonObject({ [s]: l })) {
1436
1452
  if (n.config.get("app.env", "production") === "production")
1437
1453
  throw new TypeError(`[Luminix] Attribute "${s}" in model "${e}" must be a boolean, number, string or null`);
1438
1454
  n.log.warning(`Invalid type for attribute "${s}" in model "${e}" after mutation.
1439
1455
  This will throw an error in production.`, {
1440
1456
  key: s,
1441
- value: i,
1442
- mutated: a,
1457
+ value: u,
1458
+ mutated: l,
1443
1459
  cast: this.casts[s],
1444
1460
  item: this.toJson()
1445
1461
  });
1446
1462
  return;
1447
1463
  }
1448
- this._attributes.set(s, a), this.updateChangedKeys(s), this.dispatchChangeEvent({ [s]: a });
1464
+ this._attributes.set(s, l), this.updateChangedKeys(s), this.dispatchChangeEvent({ [s]: l });
1449
1465
  }
1450
1466
  getKey() {
1451
1467
  return this.getAttribute(this.primaryKey);
@@ -1454,28 +1470,28 @@ function $e(n, e) {
1454
1470
  return this.primaryKey;
1455
1471
  }
1456
1472
  fill(s) {
1457
- const i = f.pick(s, this.fillable), u = Object.entries(i).reduce((a, [c, d]) => {
1458
- const g = n.model[`model${f.upperFirst(f.camelCase(e))}Set${f.upperFirst(f.camelCase(c))}Attribute`];
1459
- if (typeof g != "function")
1460
- throw new M("ModelFacade");
1461
- return a[c] = g.bind(n.model)(
1462
- this.mutate(d, this.casts[c]),
1473
+ const u = f.pick(s, this.fillable), a = Object.entries(u).reduce((l, [d, p]) => {
1474
+ const y = n.model[`model${f.upperFirst(f.camelCase(e))}Set${f.upperFirst(f.camelCase(d))}Attribute`];
1475
+ if (typeof y != "function")
1476
+ throw new _("ModelFacade");
1477
+ return l[d] = y.bind(n.model)(
1478
+ this.mutate(p, this.casts[d]),
1463
1479
  this
1464
- ), a;
1480
+ ), l;
1465
1481
  }, {});
1466
- if (!this.validateJsonObject(u)) {
1482
+ if (!this.validateJsonObject(a)) {
1467
1483
  if (n.config.get("app.env", "production") === "production")
1468
1484
  throw new TypeError(`[Luminix] Invalid attributes for model "${e}"`);
1469
1485
  n.log.warning(`Invalid attributes for model "${e}" after mutation.
1470
1486
  This will throw an error in production.`, {
1471
1487
  attributes: s,
1472
- mutatedAttributes: u,
1488
+ mutatedAttributes: a,
1473
1489
  item: this.toJson(),
1474
1490
  casts: this.casts
1475
1491
  });
1476
1492
  return;
1477
1493
  }
1478
- this._attributes.merge(".", u), Object.keys(u).forEach((a) => this.updateChangedKeys(a)), this.dispatchChangeEvent(u);
1494
+ this._attributes.merge(".", a), Object.keys(a).forEach((l) => this.updateChangedKeys(l)), this.dispatchChangeEvent(a);
1479
1495
  }
1480
1496
  dump() {
1481
1497
  n.log.info({
@@ -1484,16 +1500,16 @@ function $e(n, e) {
1484
1500
  });
1485
1501
  }
1486
1502
  toJson() {
1487
- const s = Object.entries(this.relations).reduce((u, [a, c]) => (c.isLoaded() && (c.isSingle() ? u[f.snakeCase(a)] = c.getLoadedItems().toJson() : c.isMultiple() && (u[f.snakeCase(a)] = c.getLoadedItems().map((d) => d.toJson()).all())), u), {}), i = n.model[`model${f.upperFirst(f.camelCase(e))}Json`];
1488
- if (typeof i != "function")
1489
- throw new M("ModelFacade");
1490
- return i.bind(n.model)({
1503
+ const s = Object.entries(this.relations).reduce((a, [l, d]) => (d.isLoaded() && (d.isSingle() ? a[f.snakeCase(l)] = d.getLoadedItems().toJson() : d.isMultiple() && (a[f.snakeCase(l)] = d.getLoadedItems().map((p) => p.toJson()).all())), a), {}), u = n.model[`model${f.upperFirst(f.camelCase(e))}Json`];
1504
+ if (typeof u != "function")
1505
+ throw new _("ModelFacade");
1506
+ return u.bind(n.model)({
1491
1507
  ...this.attributes,
1492
1508
  ...s
1493
1509
  }, this);
1494
1510
  }
1495
1511
  diff() {
1496
- return this._changedKeys.reduce((s, i) => (s[i] = this._attributes.get(i), s), {});
1512
+ return this._changedKeys.reduce((s, u) => (s[u] = this._attributes.get(u), s), {});
1497
1513
  }
1498
1514
  getType() {
1499
1515
  return e;
@@ -1504,7 +1520,7 @@ function $e(n, e) {
1504
1520
  }
1505
1521
  async refresh() {
1506
1522
  if (!this.exists)
1507
- throw new D(e, "refresh");
1523
+ throw new Re(e, "refresh");
1508
1524
  const { data: s } = await n.route.call([
1509
1525
  `luminix.${e}.show`,
1510
1526
  this.makePrimaryKeyReplacer()
@@ -1516,33 +1532,33 @@ function $e(n, e) {
1516
1532
  async save(s = {}) {
1517
1533
  try {
1518
1534
  const {
1519
- additionalPayload: i = {},
1520
- sendsOnlyModifiedFields: u = !0
1521
- } = s, a = this.exists, c = a ? [
1535
+ additionalPayload: u = {},
1536
+ sendsOnlyModifiedFields: a = !0
1537
+ } = s, l = this.exists, d = l ? [
1522
1538
  `luminix.${e}.update`,
1523
1539
  this.makePrimaryKeyReplacer()
1524
- ] : `luminix.${e}.store`, d = await n.route.call(
1525
- c,
1540
+ ] : `luminix.${e}.store`, p = await n.route.call(
1541
+ d,
1526
1542
  {
1527
1543
  data: {
1528
1544
  ...f.pick(
1529
- u && a ? this.diff() : this.attributes,
1545
+ a && l ? this.diff() : this.attributes,
1530
1546
  this.fillable
1531
1547
  ),
1532
- ...i
1548
+ ...u
1533
1549
  },
1534
- errorBag: a ? `${e}[${this.getKey()}].update` : `${e}.store`
1550
+ errorBag: l ? `${e}[${this.getKey()}].update` : `${e}.store`
1535
1551
  }
1536
1552
  );
1537
- if ([200, 201].includes(d.status))
1538
- return this.makeAttributes(d.data), this.exists = !0, this.dispatchSaveEvent(), a ? this.dispatchUpdateEvent(d.data) : this.dispatchCreateEvent(d.data), d;
1539
- throw d;
1540
- } catch (i) {
1541
- throw n.log.error(i), this.dispatchErrorEvent(i, "save"), i;
1553
+ if ([200, 201].includes(p.status))
1554
+ return this.makeAttributes(p.data), this.exists = !0, this.dispatchSaveEvent(), l ? this.dispatchUpdateEvent(p.data) : this.dispatchCreateEvent(p.data), p;
1555
+ throw p;
1556
+ } catch (u) {
1557
+ throw n.log.error(u), this.dispatchErrorEvent(u, "save"), u;
1542
1558
  }
1543
1559
  }
1544
1560
  async push() {
1545
- throw new y();
1561
+ throw new w();
1546
1562
  }
1547
1563
  async delete() {
1548
1564
  try {
@@ -1561,20 +1577,20 @@ function $e(n, e) {
1561
1577
  }
1562
1578
  async update(s) {
1563
1579
  try {
1564
- const i = await n.route.call([
1580
+ const u = await n.route.call([
1565
1581
  `luminix.${e}.update`,
1566
1582
  this.makePrimaryKeyReplacer()
1567
1583
  ], {
1568
1584
  data: s,
1569
1585
  errorBag: `${e}[${this.getKey()}].update`
1570
1586
  });
1571
- if (i.status === 200) {
1572
- this.makeAttributes(i.data), this.dispatchUpdateEvent(i.data);
1587
+ if (u.status === 200) {
1588
+ this.makeAttributes(u.data), this.dispatchUpdateEvent(u.data);
1573
1589
  return;
1574
1590
  }
1575
- throw i;
1576
- } catch (i) {
1577
- throw n.log.error(i), this.dispatchErrorEvent(i, "save"), i;
1591
+ throw u;
1592
+ } catch (u) {
1593
+ throw n.log.error(u), this.dispatchErrorEvent(u, "save"), u;
1578
1594
  }
1579
1595
  }
1580
1596
  async forceDelete() {
@@ -1622,7 +1638,7 @@ function $e(n, e) {
1622
1638
  return n.model.schema(e);
1623
1639
  }
1624
1640
  static query() {
1625
- return new Me(n, e);
1641
+ return new Xe(n, e);
1626
1642
  }
1627
1643
  static where(...s) {
1628
1644
  return this.query().where(...s);
@@ -1633,14 +1649,14 @@ function $e(n, e) {
1633
1649
  static whereNotNull(s) {
1634
1650
  return this.query().whereNotNull(s);
1635
1651
  }
1636
- static whereBetween(s, i) {
1637
- return this.query().whereBetween(s, i);
1652
+ static whereBetween(s, u) {
1653
+ return this.query().whereBetween(s, u);
1638
1654
  }
1639
- static whereNotBetween(s, i) {
1640
- return this.query().whereNotBetween(s, i);
1655
+ static whereNotBetween(s, u) {
1656
+ return this.query().whereNotBetween(s, u);
1641
1657
  }
1642
- static orderBy(s, i = "asc") {
1643
- return this.query().orderBy(s, i);
1658
+ static orderBy(s, u = "asc") {
1659
+ return this.query().orderBy(s, u);
1644
1660
  }
1645
1661
  static searchBy(s) {
1646
1662
  return this.query().searchBy(s);
@@ -1651,8 +1667,8 @@ function $e(n, e) {
1651
1667
  static limit(s) {
1652
1668
  return this.query().limit(s);
1653
1669
  }
1654
- static get(s = 1, i) {
1655
- return this.query().get(s, i);
1670
+ static get(s = 1, u) {
1671
+ return this.query().get(s, u);
1656
1672
  }
1657
1673
  static find(s) {
1658
1674
  return this.query().find(s);
@@ -1661,12 +1677,12 @@ function $e(n, e) {
1661
1677
  return this.query().first();
1662
1678
  }
1663
1679
  static async create(s) {
1664
- const i = n.model.make(e), u = new i();
1665
- return u.fill(s), await u.save(), u;
1680
+ const u = n.model.make(e), a = new u();
1681
+ return a.fill(s), await a.save(), a;
1666
1682
  }
1667
- static async update(s, i) {
1668
- const u = n.model.make(e), a = new u({ id: s });
1669
- return a.fill(i), a.exists = !0, await a.save(), a;
1683
+ static async update(s, u) {
1684
+ const a = n.model.make(e), l = new a({ id: s });
1685
+ return l.fill(u), l.exists = !0, await l.save(), l;
1670
1686
  }
1671
1687
  static delete(s) {
1672
1688
  if (Array.isArray(s))
@@ -1674,8 +1690,8 @@ function $e(n, e) {
1674
1690
  params: { ids: s },
1675
1691
  errorBag: `${e}.deleteMany`
1676
1692
  });
1677
- const i = n.model.make(e);
1678
- return new i({ id: s }).delete();
1693
+ const u = n.model.make(e);
1694
+ return new u({ id: s }).delete();
1679
1695
  }
1680
1696
  static async restore(s) {
1681
1697
  if (Array.isArray(s))
@@ -1683,8 +1699,8 @@ function $e(n, e) {
1683
1699
  data: { ids: s },
1684
1700
  errorBag: `${e}.restoreMany`
1685
1701
  });
1686
- const i = n.model.make(e);
1687
- return new i({ id: s }).restore();
1702
+ const u = n.model.make(e);
1703
+ return new u({ id: s }).restore();
1688
1704
  }
1689
1705
  static forceDelete(s) {
1690
1706
  if (Array.isArray(s))
@@ -1692,8 +1708,8 @@ function $e(n, e) {
1692
1708
  params: { ids: s, force: !0 },
1693
1709
  errorBag: `${e}.forceDeleteMany`
1694
1710
  });
1695
- const i = n.model.make(e);
1696
- return new i({ id: s }).forceDelete();
1711
+ const u = n.model.make(e);
1712
+ return new u({ id: s }).forceDelete();
1697
1713
  }
1698
1714
  static singular() {
1699
1715
  return n.model.schema(e).displayName.singular;
@@ -1702,94 +1718,97 @@ function $e(n, e) {
1702
1718
  return n.model.schema(e).displayName.plural;
1703
1719
  }
1704
1720
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1705
- on(s, i) {
1706
- throw new y();
1721
+ on(s, u) {
1722
+ throw new w();
1707
1723
  }
1708
1724
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1709
- once(s, i) {
1710
- throw new y();
1725
+ once(s, u) {
1726
+ throw new w();
1711
1727
  }
1712
1728
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1713
- emit(s, i) {
1714
- throw new y();
1729
+ emit(s, u) {
1730
+ throw new w();
1715
1731
  }
1716
1732
  }
1717
- return p(t, "name", f.upperFirst(f.camelCase(e))), A(t);
1733
+ return S(t);
1718
1734
  }
1719
- function Te(n, e, t) {
1720
- var r;
1721
- return r = class extends t {
1722
- constructor(s = {}) {
1723
- return super(s), new Proxy(this, {
1724
- get: (i, u) => {
1725
- if (u === "__isModel")
1735
+ function Oe(n, e, t) {
1736
+ var r, i;
1737
+ return class extends (i = t, r = Symbol.toStringTag, i) {
1738
+ constructor(u = {}) {
1739
+ super(u);
1740
+ g(this, r, f.upperFirst(f.camelCase(e)));
1741
+ return new Proxy(this, {
1742
+ get: (a, l) => {
1743
+ if (l === "__isModel")
1726
1744
  return !0;
1727
- if (u in i) {
1728
- const c = i[u];
1729
- return typeof c == "function" ? c.bind(i) : c;
1745
+ if (l in a) {
1746
+ const p = a[l];
1747
+ return typeof p == "function" ? p.bind(a) : p;
1730
1748
  }
1731
- if (u !== f.camelCase(u))
1749
+ if (l !== f.camelCase(l))
1732
1750
  return;
1733
- const a = f.snakeCase(u);
1734
- if (Object.keys(i.relations).includes(a))
1735
- return i.relations[a].getLoadedItems();
1736
- if (u.endsWith("Relation") && Object.keys(i.relations).includes(f.snakeCase(u.slice(0, -8))))
1737
- return () => i.relation(u.slice(0, -8));
1738
- if (Object.keys(i.attributes).includes(a))
1739
- return i.getAttribute(a);
1740
- if (n.model.hasReducer(`model${i.constructor.name}Get${f.upperFirst(u)}Attribute`)) {
1741
- const c = n.model[`model${i.constructor.name}Get${f.upperFirst(u)}Attribute`];
1742
- if (typeof c != "function")
1743
- throw new M("ModelFacade");
1744
- return c.bind(n.model)(void 0, i);
1751
+ const d = f.snakeCase(l);
1752
+ if (Object.keys(a.relations).includes(d))
1753
+ return a.relations[d].getLoadedItems();
1754
+ if (l.endsWith("Relation") && Object.keys(a.relations).includes(f.snakeCase(l.slice(0, -8))))
1755
+ return () => a.relation(l.slice(0, -8));
1756
+ if (Object.keys(a.attributes).includes(d))
1757
+ return a.getAttribute(d);
1758
+ if (n.model.hasReducer(`model${a.constructor.name}Get${f.upperFirst(l)}Attribute`)) {
1759
+ const p = n.model[`model${a.constructor.name}Get${f.upperFirst(l)}Attribute`];
1760
+ if (typeof p != "function")
1761
+ throw new _("ModelFacade");
1762
+ return p.bind(n.model)(void 0, a);
1745
1763
  }
1746
- return Reflect.get(i, u);
1764
+ return Reflect.get(a, l);
1747
1765
  },
1748
- set: (i, u, a) => {
1749
- if (u in i && typeof i[u] != "function")
1750
- return Reflect.set(i, u, a);
1751
- if (i.fillable.includes(f.snakeCase(u)))
1752
- return i.setAttribute(
1753
- f.snakeCase(u),
1754
- a
1766
+ set: (a, l, d) => {
1767
+ if (l in a && typeof a[l] != "function")
1768
+ return Reflect.set(a, l, d);
1769
+ if (a.fillable.includes(f.snakeCase(l)))
1770
+ return a.setAttribute(
1771
+ f.snakeCase(l),
1772
+ d
1755
1773
  ), !0;
1756
- throw new U(e, f.snakeCase(u));
1774
+ throw new Ne(e, f.snakeCase(l));
1757
1775
  }
1758
1776
  });
1759
1777
  }
1760
- }, p(r, "name", f.upperFirst(f.camelCase(e))), r;
1778
+ };
1761
1779
  }
1762
- class se extends Error {
1763
- constructor(e, t) {
1764
- super(`[Luminix] Cannot create reducer '${e}' on '${t}' as it is a reserved property`);
1780
+ var ge, ye;
1781
+ class ke extends (ye = Error, ge = Symbol.toStringTag, ye) {
1782
+ constructor(t, r) {
1783
+ super(`[Luminix] Cannot create reducer '${t}' on '${r}' as it is a reserved property`);
1784
+ g(this, ge, "ReducerOverrideException");
1765
1785
  }
1766
1786
  }
1767
- p(se, "name", "ReducerOverrideException");
1768
- function ie(n) {
1787
+ function ve(n) {
1769
1788
  return class extends n {
1770
1789
  constructor(...t) {
1771
1790
  super(...t);
1772
- p(this, "reducers", {});
1791
+ g(this, "reducers", {});
1773
1792
  return new Proxy(this, {
1774
- get(r, s, i) {
1775
- return typeof s == "symbol" || s in r ? Reflect.get(r, s, i) : (u, ...a) => {
1776
- const { [s]: c = l() } = r.reducers;
1777
- return ye(u) ? B(u, (d) => c.sortBy("priority").reduce((g, b) => b.callback(g, ...a), d)) : c.sortBy("priority").reduce((d, g) => g.callback(d, ...a), u);
1793
+ get(r, i, s) {
1794
+ return typeof i == "symbol" || i in r ? Reflect.get(r, i, s) : (u, ...a) => {
1795
+ const { [i]: l = c() } = r.reducers;
1796
+ return Le(u) ? v(u, (d) => l.sortBy("priority").reduce((p, y) => y.callback(p, ...a), d)) : l.sortBy("priority").reduce((d, p) => p.callback(d, ...a), u);
1778
1797
  };
1779
1798
  }
1780
1799
  });
1781
1800
  }
1782
- reducer(t, r, s = 10) {
1801
+ reducer(t, r, i = 10) {
1783
1802
  if (t in this)
1784
- throw new se(t, this);
1785
- return this.reducers[t] || (this.reducers[t] = l()), this.reducers[t].push({ callback: r, priority: s }), () => this.removeReducer(t, r);
1803
+ throw new ke(t, this);
1804
+ return this.reducers[t] || (this.reducers[t] = c()), this.reducers[t].push({ callback: r, priority: i }), () => this.removeReducer(t, r);
1786
1805
  }
1787
1806
  removeReducer(t, r) {
1788
- const s = this.reducers[t].search((i) => i.callback === r);
1789
- s !== !1 && this.reducers[t].pull(s);
1807
+ const i = this.reducers[t].search((s) => s.callback === r);
1808
+ i !== !1 && this.reducers[t].pull(i);
1790
1809
  }
1791
1810
  getReducer(t) {
1792
- return this.reducers[t] || (this.reducers[t] = l()), this.reducers[t];
1811
+ return this.reducers[t] || (this.reducers[t] = c()), this.reducers[t];
1793
1812
  }
1794
1813
  hasReducer(t) {
1795
1814
  return !!this.reducers[t] && this.reducers[t].count() > 0;
@@ -1802,23 +1821,25 @@ function ie(n) {
1802
1821
  }
1803
1822
  };
1804
1823
  }
1805
- class C extends Error {
1806
- constructor(e) {
1807
- super(`[Luminix] Model "${e}" not found`);
1824
+ var we, be;
1825
+ class G extends (be = Error, we = Symbol.toStringTag, be) {
1826
+ constructor(t) {
1827
+ super(`[Luminix] Model "${t}" not found`);
1828
+ g(this, we, "ModelNotFoundException");
1808
1829
  }
1809
1830
  }
1810
- p(C, "name", "ModelNotFoundException");
1811
- class N extends TypeError {
1812
- constructor(e, t, r) {
1813
- super(`[Luminix] "${e}" expects a related model of type "${t}". Received "${r}" instead.`);
1831
+ var Ee, xe;
1832
+ class B extends (xe = TypeError, Ee = Symbol.toStringTag, xe) {
1833
+ constructor(t, r, i) {
1834
+ super(`[Luminix] "${t}" expects a related model of type "${r}". Received "${i}" instead.`);
1835
+ g(this, Ee, "ModelInvalidRelatedTypeException");
1814
1836
  }
1815
1837
  }
1816
- p(N, "name", "ModelInvalidRelatedTypeException");
1817
- class ne extends j {
1818
- constructor(e, t, r, s = null) {
1819
- if (!w(s) && s !== null)
1820
- throw new E("BelongsTo.constructor()", "Model or null");
1821
- super(e, t, r, s), this.meta = e, this.facades = t, this.parent = r, this.items = s;
1838
+ class Be extends j {
1839
+ constructor(e, t, r, i = null) {
1840
+ if (!b(i) && i !== null)
1841
+ throw new x("BelongsTo.constructor()", "Model or null");
1842
+ super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i;
1822
1843
  }
1823
1844
  isSingle() {
1824
1845
  return !0;
@@ -1834,12 +1855,12 @@ class ne extends j {
1834
1855
  return this.query().first();
1835
1856
  }
1836
1857
  async associate(e) {
1837
- if (!w(e))
1838
- throw new E("BelongsTo.associate()");
1858
+ if (!b(e))
1859
+ throw new x("BelongsTo.associate()");
1839
1860
  if (e.getType() !== this.getRelated().getSchemaName())
1840
- throw new N("BelongsTo.associate()", this.getRelated().getSchemaName(), e.getType());
1861
+ throw new B("BelongsTo.associate()", this.getRelated().getSchemaName(), e.getType());
1841
1862
  if (!e.exists)
1842
- throw new D(this.getRelated().getSchemaName(), "save");
1863
+ throw new Re(this.getRelated().getSchemaName(), "save");
1843
1864
  return this.parent.update({
1844
1865
  [this.getForeignKey()]: e.getKey()
1845
1866
  });
@@ -1850,11 +1871,11 @@ class ne extends j {
1850
1871
  });
1851
1872
  }
1852
1873
  }
1853
- class oe extends j {
1854
- constructor(e, t, r, s = null) {
1855
- if (s !== null && !(s instanceof J && s.every(w)))
1856
- throw new E("BelongsToMany.constructor()", "Collection<Model> or null");
1857
- super(e, t, r, s), this.meta = e, this.facades = t, this.parent = r, this.items = s;
1874
+ class qe extends j {
1875
+ constructor(e, t, r, i = null) {
1876
+ if (i !== null && !(i instanceof C && i.every(b)))
1877
+ throw new x("BelongsToMany.constructor()", "Collection<Model> or null");
1878
+ super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i;
1858
1879
  }
1859
1880
  isSingle() {
1860
1881
  return !1;
@@ -1892,10 +1913,10 @@ class oe extends j {
1892
1913
  }
1893
1914
  async attach(e, t = {}) {
1894
1915
  if (await this.attachQuietly(e, t), this.items) {
1895
- const r = this.items.search((i) => i.getKey() === e), s = await this.getRelated().find(e);
1896
- if (!s)
1916
+ const r = this.items.search((s) => s.getKey() === e), i = await this.getRelated().find(e);
1917
+ if (!i)
1897
1918
  return;
1898
- r !== !1 ? this.items.put(r, s) : this.items.push(s);
1919
+ r !== !1 ? this.items.put(r, i) : this.items.push(i);
1899
1920
  } else
1900
1921
  this.items = await this.all();
1901
1922
  }
@@ -1955,24 +1976,24 @@ class oe extends j {
1955
1976
  this.items ? this.items.splice(0, this.items.count(), ...r) : this.items = r;
1956
1977
  }
1957
1978
  }
1958
- class H extends j {
1979
+ class L extends j {
1959
1980
  query() {
1960
1981
  const e = super.query(), t = this.guessInverseRelation();
1961
1982
  return e.where(t, this.parent.getKey()), e.lock(`where.${t}`), e;
1962
1983
  }
1963
1984
  async saveQuietly(e) {
1964
- if (!w(e))
1965
- throw new E("HasOneOrMany.saveQuietly()");
1985
+ if (!b(e))
1986
+ throw new x("HasOneOrMany.saveQuietly()");
1966
1987
  if (e.getType() !== this.getRelated().getSchemaName())
1967
- throw new N("HasOneOrMany.saveQuietly()", this.getRelated().getSchemaName(), e.getType());
1988
+ throw new B("HasOneOrMany.saveQuietly()", this.getRelated().getSchemaName(), e.getType());
1968
1989
  e.setAttribute(this.getForeignKey(), this.parent.getKey()), await e.save();
1969
1990
  }
1970
1991
  }
1971
- class Ae extends H {
1972
- constructor(e, t, r, s = null) {
1973
- if (!w(s) && s !== null)
1974
- throw new E("HasOne.constructor()", "Model or null");
1975
- super(e, t, r, s), this.meta = e, this.facades = t, this.parent = r, this.items = s;
1992
+ class et extends L {
1993
+ constructor(e, t, r, i = null) {
1994
+ if (!b(i) && i !== null)
1995
+ throw new x("HasOne.constructor()", "Model or null");
1996
+ super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i;
1976
1997
  }
1977
1998
  isSingle() {
1978
1999
  return !0;
@@ -1987,11 +2008,11 @@ class Ae extends H {
1987
2008
  await this.saveQuietly(e), this.items = e;
1988
2009
  }
1989
2010
  }
1990
- class ve extends H {
1991
- constructor(e, t, r, s = null) {
1992
- if (s !== null && !(s instanceof J && s.every(w)))
1993
- throw new E("HasMany.constructor()", "Collection<Model> or null");
1994
- super(e, t, r, s), this.meta = e, this.facades = t, this.parent = r, this.items = s;
2011
+ class tt extends L {
2012
+ constructor(e, t, r, i = null) {
2013
+ if (i !== null && !(i instanceof C && i.every(b)))
2014
+ throw new x("HasMany.constructor()", "Collection<Model> or null");
2015
+ super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i;
1995
2016
  }
1996
2017
  isSingle() {
1997
2018
  return !1;
@@ -2012,10 +2033,10 @@ class ve extends H {
2012
2033
  return this.query().find(e);
2013
2034
  }
2014
2035
  async saveManyQuietly(e) {
2015
- if (!Array.isArray(e) || !e.every(w))
2016
- throw new E("HasMany.saveManyQuietly()", "Model[]");
2036
+ if (!Array.isArray(e) || !e.every(b))
2037
+ throw new x("HasMany.saveManyQuietly()", "Model[]");
2017
2038
  if (!e.every((t) => t.getType() === this.getRelated().getSchemaName()))
2018
- throw new N("HasMany.saveManyQuietly()", this.getRelated().getSchemaName(), e.map((t) => t.getType()).join(", "));
2039
+ throw new B("HasMany.saveManyQuietly()", this.getRelated().getSchemaName(), e.map((t) => t.getType()).join(", "));
2019
2040
  await Promise.all(e.map((t) => (t.setAttribute(this.getForeignKey(), this.parent.getKey()), t.save())));
2020
2041
  }
2021
2042
  async saveMany(e) {
@@ -2027,7 +2048,7 @@ class ve extends H {
2027
2048
  await this.saveQuietly(e), this.items === null ? this.items = await this.all() : this.items.push(e);
2028
2049
  }
2029
2050
  }
2030
- class he extends H {
2051
+ class Ie extends L {
2031
2052
  query() {
2032
2053
  const e = this.getRelated().query();
2033
2054
  e.once("success", (r) => {
@@ -2037,19 +2058,19 @@ class he extends H {
2037
2058
  return e.where(t + "_id", this.parent.getKey()), e.where(t + "_type", this.getRelated().getSchemaName()), e.lock(`where.${t}_id`), e.lock(`where.${t}_type`), e;
2038
2059
  }
2039
2060
  async saveQuietly(e) {
2040
- if (!w(e))
2041
- throw new E("MorphOneOrMany.saveQuietly()");
2061
+ if (!b(e))
2062
+ throw new x("MorphOneOrMany.saveQuietly()");
2042
2063
  if (e.getType() !== this.getRelated().getSchemaName())
2043
- throw new N("MorphOneOrMany.saveQuietly()", this.getRelated().getSchemaName(), e.getType());
2064
+ throw new B("MorphOneOrMany.saveQuietly()", this.getRelated().getSchemaName(), e.getType());
2044
2065
  const t = this.guessInverseRelation();
2045
2066
  e.setAttribute(t + "_id", this.parent.getKey()), e.setAttribute(t + "_type", this.parent.getType()), await e.save();
2046
2067
  }
2047
2068
  }
2048
- class Re extends he {
2049
- constructor(e, t, r, s = null) {
2050
- if (s !== null && !(s instanceof J && s.every(w)))
2051
- throw new E("MorphMany.constructor()", "Collection<Model> or null");
2052
- super(e, t, r, s), this.meta = e, this.facades = t, this.parent = r, this.items = s;
2069
+ class rt extends Ie {
2070
+ constructor(e, t, r, i = null) {
2071
+ if (i !== null && !(i instanceof C && i.every(b)))
2072
+ throw new x("MorphMany.constructor()", "Collection<Model> or null");
2073
+ super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i;
2053
2074
  }
2054
2075
  isSingle() {
2055
2076
  return !1;
@@ -2070,10 +2091,10 @@ class Re extends he {
2070
2091
  return this.query().find(e);
2071
2092
  }
2072
2093
  async saveManyQuietly(e) {
2073
- if (!Array.isArray(e) || !e.every(w))
2074
- throw new E("MorphMany.saveManyQuietly()");
2094
+ if (!Array.isArray(e) || !e.every(b))
2095
+ throw new x("MorphMany.saveManyQuietly()");
2075
2096
  if (!e.every((t) => t.getType() === this.getRelated().getSchemaName()))
2076
- throw new N("MorphMany.saveManyQuietly()", this.getRelated().getSchemaName(), e.map((t) => t.getType()).join(", "));
2097
+ throw new B("MorphMany.saveManyQuietly()", this.getRelated().getSchemaName(), e.map((t) => t.getType()).join(", "));
2077
2098
  await Promise.all(e.map((t) => (t.setAttribute(this.getName() + "_id", this.parent.getKey()), t.setAttribute(this.getName() + "_type", this.parent.getType()), t.save())));
2078
2099
  }
2079
2100
  async save(e) {
@@ -2085,10 +2106,10 @@ class Re extends he {
2085
2106
  this.items ? this.items.splice(0, this.items.count(), ...t) : this.items = t;
2086
2107
  }
2087
2108
  }
2088
- class Ne extends he {
2089
- constructor(e, t, r, s = null) {
2090
- if (super(e, t, r, s), this.meta = e, this.facades = t, this.parent = r, this.items = s, s !== null && !w(s))
2091
- throw new E("MorphOne.constructor()", "Model or null");
2109
+ class st extends Ie {
2110
+ constructor(e, t, r, i = null) {
2111
+ if (super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i, i !== null && !b(i))
2112
+ throw new x("MorphOne.constructor()", "Model or null");
2092
2113
  }
2093
2114
  isSingle() {
2094
2115
  return !0;
@@ -2103,7 +2124,7 @@ class Ne extends he {
2103
2124
  await this.saveQuietly(e), this.items = e;
2104
2125
  }
2105
2126
  }
2106
- class Se extends ne {
2127
+ class it extends Be {
2107
2128
  getRelated() {
2108
2129
  return this.facades.model.make(
2109
2130
  this.parent.getAttribute(this.getName() + "_type")
@@ -2118,8 +2139,8 @@ class Se extends ne {
2118
2139
  // return super.query();
2119
2140
  // }
2120
2141
  async associate(e) {
2121
- if (!w(e))
2122
- throw new E("MorphTo.associate()");
2142
+ if (!b(e))
2143
+ throw new x("MorphTo.associate()");
2123
2144
  return e.exists || await e.save(), this.parent.update({
2124
2145
  [this.getName() + "_id"]: e.getKey(),
2125
2146
  [this.getName() + "_type"]: e.getType()
@@ -2132,49 +2153,52 @@ class Se extends ne {
2132
2153
  });
2133
2154
  }
2134
2155
  }
2135
- class Be extends oe {
2136
- constructor(e, t, r, s = null) {
2137
- super(e, t, r, s), this.meta = e, this.facades = t, this.parent = r, this.items = s;
2156
+ class nt extends qe {
2157
+ constructor(e, t, r, i = null) {
2158
+ super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i;
2138
2159
  }
2139
2160
  query() {
2140
2161
  const e = super.query(), t = this.guessInverseRelation();
2141
2162
  return e.where(t + "_id", this.parent.getKey()), e.where(t + "_type", this.parent.getType()), e.lock(`where.${t}_id`), e.lock(`where.${t}_type`), e;
2142
2163
  }
2143
2164
  }
2144
- class ue {
2165
+ var Me;
2166
+ Me = Symbol.toStringTag;
2167
+ class ot {
2145
2168
  constructor(e) {
2146
- p(this, "_models", {});
2169
+ g(this, "_models", {});
2170
+ g(this, Me, "ModelFacade");
2147
2171
  this._schema = e;
2148
2172
  }
2149
2173
  boot(e) {
2150
2174
  this._schema && (Object.keys(this._schema).forEach((t) => {
2151
2175
  const r = this[`model${f.upperFirst(f.camelCase(t))}`];
2152
2176
  if (typeof this.model != "function" || typeof r != "function")
2153
- throw new M("ModelFacade");
2154
- const s = this.model(
2155
- $e(e.make(), t),
2177
+ throw new _("ModelFacade");
2178
+ const i = this.model(
2179
+ ze(e.make(), t),
2156
2180
  t
2157
- ), i = r(s);
2158
- this._models[t] = Te(e.make(), t, i);
2181
+ ), s = r(i);
2182
+ this._models[t] = Oe(e.make(), t, s);
2159
2183
  }), this.reducer("relationMap", () => ({
2160
- BelongsTo: ne,
2161
- BelongsToMany: oe,
2162
- HasOne: Ae,
2163
- HasMany: ve,
2164
- MorphMany: Re,
2165
- MorphOne: Ne,
2166
- MorphTo: Se,
2167
- MorphToMany: Be
2184
+ BelongsTo: Be,
2185
+ BelongsToMany: qe,
2186
+ HasOne: et,
2187
+ HasMany: tt,
2188
+ MorphMany: rt,
2189
+ MorphOne: st,
2190
+ MorphTo: it,
2191
+ MorphToMany: nt
2168
2192
  }), 0));
2169
2193
  }
2170
2194
  schema(e) {
2171
2195
  if (!this._schema || e && !this._schema[e])
2172
- throw new C(e || "undefined");
2196
+ throw new G(e || "undefined");
2173
2197
  return e ? this._schema[e] : this._schema;
2174
2198
  }
2175
2199
  make(e) {
2176
2200
  if (e && !this._models[e])
2177
- throw new C(e);
2201
+ throw new G(e);
2178
2202
  return e ? this._models[e] : this._models;
2179
2203
  }
2180
2204
  toString() {
@@ -2182,68 +2206,68 @@ class ue {
2182
2206
  }
2183
2207
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2184
2208
  on(e, t) {
2185
- throw new y();
2209
+ throw new w();
2186
2210
  }
2187
2211
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2188
2212
  once(e, t) {
2189
- throw new y();
2213
+ throw new w();
2190
2214
  }
2191
2215
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2192
2216
  emit(e, t) {
2193
- throw new y();
2217
+ throw new w();
2194
2218
  }
2195
2219
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2196
2220
  reducer(e, t, r) {
2197
- throw new y();
2221
+ throw new w();
2198
2222
  }
2199
2223
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2200
2224
  removeReducer(e) {
2201
- throw new y();
2225
+ throw new w();
2202
2226
  }
2203
2227
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2204
2228
  getReducer(e) {
2205
- throw new y();
2229
+ throw new w();
2206
2230
  }
2207
2231
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2208
2232
  hasReducer(e) {
2209
- throw new y();
2233
+ throw new w();
2210
2234
  }
2211
2235
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2212
2236
  clearReducer(e) {
2213
- throw new y();
2237
+ throw new w();
2214
2238
  }
2215
2239
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2216
2240
  flushReducers() {
2217
- throw new y();
2241
+ throw new w();
2218
2242
  }
2219
2243
  }
2220
- p(ue, "name", "ModelFacade");
2221
- const qe = A(ie(ue));
2222
- class ae extends Error {
2244
+ const ht = S(ve(ot));
2245
+ var _e, Te;
2246
+ class ut extends (Te = Error, _e = Symbol.toStringTag, Te) {
2223
2247
  constructor() {
2224
2248
  super("[Luminix] Embed element not found. Make sure to include the `@luminixEmbed()` directive in your Blade template.");
2249
+ g(this, _e, "NoEmbedException");
2225
2250
  }
2226
2251
  }
2227
- p(ae, "name", "NoEmbedException");
2228
- const le = (n, e = "data") => {
2252
+ const Ke = (n, e = "data") => {
2229
2253
  if (!document.querySelector("#luminix-embed"))
2230
- throw new ae();
2254
+ throw new ut();
2231
2255
  const t = document.getElementById(`luminix-${e}::` + n);
2232
2256
  return t ? t.dataset.json && t.dataset.value ? JSON.parse(t.dataset.value) : t.dataset.value : null;
2233
- }, Y = A(v), Ie = (n) => we(n) && n.response !== void 0 && n.response.data !== null && "message" in n.response.data && typeof n.response.data.message == "string" && "errors" in n.response.data && typeof n.response.data.errors == "object" && n.response.data.errors !== null && Object.values(n.response.data.errors).every((e) => Array.isArray(e) && e.every((t) => typeof t == "string")) && n.response.status === 422;
2234
- let Ke = class {
2257
+ }, V = S(A), at = (n) => Je(n) && n.response !== void 0 && n.response.data !== null && "message" in n.response.data && typeof n.response.data.message == "string" && "errors" in n.response.data && typeof n.response.data.errors == "object" && n.response.data.errors !== null && Object.values(n.response.data.errors).every((e) => Array.isArray(e) && e.every((t) => typeof t == "string")) && n.response.status === 422;
2258
+ let lt = class {
2235
2259
  constructor() {
2236
- p(this, "bags");
2260
+ g(this, "bags");
2237
2261
  const e = {};
2238
2262
  document.querySelectorAll('#luminix-embed [id^="luminix-error"]').forEach((r) => {
2239
- const i = r.id.replace("luminix-error::", "");
2240
- e[i] = le(i, "error");
2263
+ const s = r.id.replace("luminix-error::", "");
2264
+ e[s] = Ke(s, "error");
2241
2265
  }), this.bags = {
2242
- default: new Y(e)
2266
+ default: new V(e)
2243
2267
  };
2244
2268
  }
2245
2269
  bag(e = "default") {
2246
- return this.bags[e] || (this.bags[e] = new Y({})), this.bags[e];
2270
+ return this.bags[e] || (this.bags[e] = new V({})), this.bags[e];
2247
2271
  }
2248
2272
  add(e, t, r = "default") {
2249
2273
  this.bag(r).set(e, t);
@@ -2261,13 +2285,14 @@ let Ke = class {
2261
2285
  this.bag(e).set(".", {});
2262
2286
  }
2263
2287
  };
2264
- class ce extends Error {
2265
- constructor(e) {
2266
- super(`[Luminix] Route "${e}" not found`);
2288
+ var $e, Se;
2289
+ class ct extends (Se = Error, $e = Symbol.toStringTag, Se) {
2290
+ constructor(t) {
2291
+ super(`[Luminix] Route "${t}" not found`);
2292
+ g(this, $e, "RouteNotFoundException");
2267
2293
  }
2268
2294
  }
2269
- p(ce, "name", "RouteNotFoundException");
2270
- class je {
2295
+ class dt {
2271
2296
  constructor(e, t, r = "") {
2272
2297
  this.routes = e, this.error = t, this.appUrl = r;
2273
2298
  }
@@ -2277,8 +2302,8 @@ class je {
2277
2302
  const [t, ...r] = e;
2278
2303
  if (typeof t != "string")
2279
2304
  return !1;
2280
- const s = ["get", "post", "put", "patch", "delete"];
2281
- return !!r.every((i) => s.includes(i));
2305
+ const i = ["get", "post", "put", "patch", "delete"];
2306
+ return !!r.every((s) => i.includes(s));
2282
2307
  }
2283
2308
  extractGenerator(e) {
2284
2309
  let t, r = !1;
@@ -2286,23 +2311,23 @@ class je {
2286
2311
  }
2287
2312
  get(e) {
2288
2313
  if (!this.exists(e))
2289
- throw new ce(e);
2314
+ throw new ct(e);
2290
2315
  return f.get(this.routes, e);
2291
2316
  }
2292
2317
  url(e) {
2293
- const [t, r] = this.extractGenerator(e), s = this.get(t)[0].replace(/^\/|\/$/g, ""), i = /{([^}]+)}/g;
2318
+ const [t, r] = this.extractGenerator(e), i = this.get(t)[0].replace(/^\/|\/$/g, ""), s = /{([^}]+)}/g;
2294
2319
  if (r === !1) {
2295
2320
  if (typeof this.replaceRouteParams != "function")
2296
- throw new M("RouteFacade");
2297
- return this.appUrl + this.replaceRouteParams(`/${s}`);
2321
+ throw new _("RouteFacade");
2322
+ return this.appUrl + this.replaceRouteParams(`/${i}`);
2298
2323
  }
2299
- const u = s.match(i), a = u ? u.map((m) => m.slice(1, -1)) : [], c = Object.keys(r), d = a.filter((m) => !c.includes(m)), g = c.filter((m) => !a.includes(m));
2324
+ const u = i.match(s), a = u ? u.map((m) => m.slice(1, -1)) : [], l = Object.keys(r), d = a.filter((m) => !l.includes(m)), p = l.filter((m) => !a.includes(m));
2300
2325
  if (d.length > 0)
2301
2326
  throw new TypeError(`Missing values for parameter(s): ${d.join(", ")}`);
2302
- if (g.length > 0)
2303
- throw new TypeError(`Unexpected parameters: ${g.join(", ")}`);
2304
- const b = a.reduce((m, x) => m.replace(`{${x}}`, `${r[x]}`), s);
2305
- return this.appUrl + `/${b}`;
2327
+ if (p.length > 0)
2328
+ throw new TypeError(`Unexpected parameters: ${p.join(", ")}`);
2329
+ const y = a.reduce((m, E) => m.replace(`{${E}}`, `${r[E]}`), i);
2330
+ return this.appUrl + `/${y}`;
2306
2331
  }
2307
2332
  methods(e) {
2308
2333
  const [t] = this.extractGenerator(e);
@@ -2313,37 +2338,37 @@ class je {
2313
2338
  }
2314
2339
  async call(e, t = {}) {
2315
2340
  if (typeof this.axiosOptions != "function" || typeof this.axiosError != "function")
2316
- throw new M("RouteFacade");
2317
- const [r, s] = this.extractGenerator(e), [, ...i] = this.get(r), u = this.url(s ? [r, s] : r), a = this.axiosOptions(t, r), { method: c = i[0], errorBag: d = "route.call", ...g } = a, { data: b, ...m } = g;
2341
+ throw new _("RouteFacade");
2342
+ const [r, i] = this.extractGenerator(e), [, ...s] = this.get(r), u = this.url(i ? [r, i] : r), a = this.axiosOptions(t, r), { method: l = s[0], errorBag: d = "route.call", ...p } = a, { data: y, ...m } = p;
2318
2343
  this.error.clear(d);
2319
2344
  try {
2320
- return ["get", "delete"].includes(c) ? await K[c](u, g) : await K[c](u, b, m);
2321
- } catch (x) {
2322
- if (Ie(x)) {
2323
- const { errors: fe } = x.response.data;
2324
- this.error.set(Object.entries(fe).reduce((W, [de, pe]) => (W[de] = pe.join(" "), W), {}));
2325
- } else K.isAxiosError(x) && this.error.set(
2326
- this.axiosError({ axios: x.message }, {
2327
- error: x,
2345
+ return ["get", "delete"].includes(l) ? await K[l](u, p) : await K[l](u, y, m);
2346
+ } catch (E) {
2347
+ if (at(E)) {
2348
+ const { errors: je } = E.response.data;
2349
+ this.error.set(Object.entries(je).reduce((J, [Fe, Pe]) => (J[Fe] = Pe.join(" "), J), {}));
2350
+ } else K.isAxiosError(E) && this.error.set(
2351
+ this.axiosError({ axios: E.message }, {
2352
+ error: E,
2328
2353
  name: r,
2329
- replace: s,
2354
+ replace: i,
2330
2355
  config: t
2331
2356
  }),
2332
2357
  d
2333
2358
  );
2334
- throw x;
2359
+ throw E;
2335
2360
  }
2336
2361
  }
2337
2362
  toString() {
2338
2363
  return "route";
2339
2364
  }
2340
2365
  }
2341
- const Fe = ie(je);
2342
- class Pe {
2366
+ const ft = ve(dt);
2367
+ class pt {
2343
2368
  constructor() {
2344
- p(this, "facades", {});
2345
- p(this, "booted", !1);
2346
- p(this, "_plugins", []);
2369
+ g(this, "facades", {});
2370
+ g(this, "booted", !1);
2371
+ g(this, "_plugins", []);
2347
2372
  }
2348
2373
  make(e = void 0) {
2349
2374
  if (!e)
@@ -2361,7 +2386,7 @@ class Pe {
2361
2386
  return this._plugins;
2362
2387
  }
2363
2388
  async boot(e = {}) {
2364
- var a, c, d, g, b;
2389
+ var a, l, d, p, y;
2365
2390
  if (this.booted)
2366
2391
  throw new window.Error("[Luminix] App already booted");
2367
2392
  this.booted = !0, (a = e.app) != null && a.debug && console.log("[Luminix] Booting started..."), this.emit("init", {
@@ -2369,20 +2394,20 @@ class Pe {
2369
2394
  this._plugins.push(m), typeof m.register == "function" && m.register(this);
2370
2395
  }
2371
2396
  });
2372
- const t = (((c = e.app) == null ? void 0 : c.url) ?? "") + (((d = e.app) == null ? void 0 : d.bootUrl) ?? "/luminix-api/init");
2397
+ const t = (((l = e.app) == null ? void 0 : l.url) ?? "") + (((d = e.app) == null ? void 0 : d.bootUrl) ?? "/luminix-api/init");
2373
2398
  if (typeof t == "string" && !document.getElementById("luminix-data::config")) {
2374
2399
  const { data: m } = await K.get(t);
2375
2400
  m && typeof m == "object" && f.merge(e, m);
2376
2401
  } else if (document.getElementById("luminix-data::config")) {
2377
- const m = le("config");
2402
+ const m = Ke("config");
2378
2403
  m && typeof m == "object" && f.merge(e, m);
2379
2404
  }
2380
- this.bind("log", new Ee(!!((g = e.app) != null && g.debug)));
2405
+ this.bind("log", new He(!!((p = e.app) != null && p.debug)));
2381
2406
  const { log: r } = this.facades, {
2382
- manifest: { routes: s = {}, models: i = {} } = {},
2407
+ manifest: { routes: i = {}, models: s = {} } = {},
2383
2408
  ...u
2384
2409
  } = e;
2385
- this.bind("config", new v(u)), this.facades.config.has("auth.user") || this.facades.config.set("auth.user", null), this.facades.config.lock("auth.user"), this.bind("error", new Ke()), this.bind("route", new Fe(s, this.facades.error, ((b = e.app) == null ? void 0 : b.url) ?? "")), this.bind("model", new qe(i)), this.bind("auth", new be(this)), this.emit("booting");
2410
+ this.bind("config", new A(u)), this.facades.config.has("auth.user") || this.facades.config.set("auth.user", null), this.facades.config.lock("auth.user"), this.bind("error", new lt()), this.bind("route", new ft(i, this.facades.error, ((y = e.app) == null ? void 0 : y.url) ?? "")), this.bind("model", new ht(s)), this.bind("auth", new De(this)), this.emit("booting");
2386
2411
  for (const m of Object.values(this.facades))
2387
2412
  typeof m == "object" && m !== null && "boot" in m && typeof m.boot == "function" && m.boot(this);
2388
2413
  for (const m of this._plugins)
@@ -2391,8 +2416,8 @@ class Pe {
2391
2416
  config: this.facades.config.all(),
2392
2417
  plugins: this._plugins,
2393
2418
  manifest: {
2394
- routes: s,
2395
- models: i
2419
+ routes: i,
2420
+ models: s
2396
2421
  }
2397
2422
  }), this.emit("booted"), this.facades;
2398
2423
  }
@@ -2409,49 +2434,49 @@ class Pe {
2409
2434
  throw new window.Error("Method not implemented.");
2410
2435
  }
2411
2436
  }
2412
- const Qe = A(Pe);
2413
- let _;
2414
- function R(n = void 0) {
2415
- if (_ || (_ = new Qe()), typeof n != "string")
2437
+ const mt = S(pt);
2438
+ let M;
2439
+ function N(n = void 0) {
2440
+ if (M || (M = new mt()), typeof n != "string")
2416
2441
  return {
2417
- boot: _.boot.bind(_),
2418
- make: _.make.bind(_),
2419
- plugins: _.plugins.bind(_),
2420
- on: _.once.bind(_)
2442
+ boot: M.boot.bind(M),
2443
+ make: M.make.bind(M),
2444
+ plugins: M.plugins.bind(M),
2445
+ on: M.once.bind(M)
2421
2446
  };
2422
- if (!_.has(n))
2423
- throw new O(n);
2424
- return _.make(n);
2447
+ if (!M.has(n))
2448
+ throw new Ue(n);
2449
+ return M.make(n);
2425
2450
  }
2426
- function We() {
2427
- return R("auth");
2451
+ function Mt() {
2452
+ return N("auth");
2428
2453
  }
2429
- function Ge(n) {
2430
- return l(n);
2454
+ function _t(n) {
2455
+ return c(n);
2431
2456
  }
2432
- function Ve(n, e) {
2433
- const t = R("config");
2457
+ function Tt(n, e) {
2458
+ const t = N("config");
2434
2459
  return typeof n > "u" ? t : t.get(n, e);
2435
2460
  }
2436
- function Xe(n, e = "default") {
2437
- return n ? R().make("error").get(n, e) : R().make("error");
2461
+ function $t(n, e = "default") {
2462
+ return n ? N().make("error").get(n, e) : N().make("error");
2438
2463
  }
2439
- function Ye(...n) {
2440
- const e = R("log");
2464
+ function St(...n) {
2465
+ const e = N("log");
2441
2466
  return n.length ? e.debug(...n) : e;
2442
2467
  }
2443
- function Ze(n) {
2444
- const e = R("model");
2468
+ function At(n) {
2469
+ const e = N("model");
2445
2470
  return n ? e.make(n) : e;
2446
2471
  }
2447
- function ze(n, e = !1) {
2448
- const t = R("route");
2472
+ function Nt(n, e = !1) {
2473
+ const t = N("route");
2449
2474
  return n ? e ? t.url([n, e]) : t.url(n) : t;
2450
2475
  }
2451
- class Oe {
2476
+ class Rt {
2452
2477
  constructor() {
2453
- p(this, "name");
2454
- p(this, "version");
2478
+ g(this, "name");
2479
+ g(this, "version");
2455
2480
  }
2456
2481
  register(e) {
2457
2482
  }
@@ -2459,19 +2484,19 @@ class Oe {
2459
2484
  }
2460
2485
  }
2461
2486
  export {
2462
- A as HasEvents,
2463
- Oe as Plugin,
2464
- v as PropertyBag,
2465
- ie as Reducible,
2466
- R as app,
2467
- We as auth,
2468
- Ge as collect,
2469
- Ve as config,
2470
- Xe as error,
2471
- T as isCollection,
2472
- w as isModel,
2473
- Ie as isValidationError,
2474
- Ye as log,
2475
- Ze as model,
2476
- ze as route
2487
+ S as HasEvents,
2488
+ Rt as Plugin,
2489
+ A as PropertyBag,
2490
+ ve as Reducible,
2491
+ N as app,
2492
+ Mt as auth,
2493
+ _t as collect,
2494
+ Tt as config,
2495
+ $t as error,
2496
+ $ as isCollection,
2497
+ b as isModel,
2498
+ at as isValidationError,
2499
+ St as log,
2500
+ At as model,
2501
+ Nt as route
2477
2502
  };