@qwanyx/stack 0.2.15 → 0.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,15 +1,15 @@
1
1
  var zt = Object.defineProperty;
2
2
  var Gt = (o, e, r) => e in o ? zt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[e] = r;
3
- var Ee = (o, e, r) => Gt(o, typeof e != "symbol" ? e + "" : e, r);
4
- import vt, { useState as U, useCallback as Y, useEffect as pe, useMemo as Et, useRef as dt } from "react";
3
+ var ve = (o, e, r) => Gt(o, typeof e != "symbol" ? e + "" : e, r);
4
+ import st, { useState as O, useCallback as H, useEffect as pe, useMemo as vt, useRef as ft } from "react";
5
5
  class yr {
6
6
  constructor(e) {
7
- Ee(this, "config");
7
+ ve(this, "config");
8
8
  // ===== FILE OPERATIONS =====
9
9
  /**
10
10
  * Options for file upload
11
11
  */
12
- Ee(this, "defaultUploadOptions", {
12
+ ve(this, "defaultUploadOptions", {
13
13
  maxSizeMB: 10,
14
14
  maxImageDimension: 0,
15
15
  // 0 = no resize
@@ -30,7 +30,7 @@ class yr {
30
30
  params: r
31
31
  };
32
32
  try {
33
- const a = await fetch(`${this.config.baseUrl}/spu/invoke`, {
33
+ const s = await fetch(`${this.config.baseUrl}/spu/invoke`, {
34
34
  method: "POST",
35
35
  headers: {
36
36
  "Content-Type": "application/json",
@@ -38,16 +38,16 @@ class yr {
38
38
  },
39
39
  body: JSON.stringify(u)
40
40
  });
41
- if (!a.ok) {
42
- const t = await a.text();
43
- throw new Error(`API error (${a.status}): ${t}`);
41
+ if (!s.ok) {
42
+ const t = await s.text();
43
+ throw new Error(`API error (${s.status}): ${t}`);
44
44
  }
45
- const n = await a.json();
45
+ const n = await s.json();
46
46
  if (!n.success && n.error)
47
47
  throw new Error(n.error);
48
48
  return n;
49
- } catch (a) {
50
- throw console.error("Graph API call failed:", a), a;
49
+ } catch (s) {
50
+ throw console.error("Graph API call failed:", s), s;
51
51
  }
52
52
  }
53
53
  /**
@@ -96,10 +96,10 @@ class yr {
96
96
  ...r,
97
97
  modified: (/* @__PURE__ */ new Date()).toISOString()
98
98
  }
99
- }, a = await this.callGraph("update_node", u);
100
- if (!a.result)
99
+ }, s = await this.callGraph("update_node", u);
100
+ if (!s.result)
101
101
  throw new Error("Failed to update node");
102
- return a.result;
102
+ return s.result;
103
103
  }
104
104
  /**
105
105
  * Delete a node
@@ -114,23 +114,23 @@ class yr {
114
114
  /**
115
115
  * Get children with edges (supports different display modes)
116
116
  */
117
- async getChildrenWithEdges(e, r = "children", u, a) {
117
+ async getChildrenWithEdges(e, r = "children", u, s) {
118
118
  return (await this.callGraph("get_children_with_edges", {
119
119
  node_id: e,
120
120
  display_mode: r,
121
121
  edge_type: u,
122
- node_type: a
122
+ node_type: s
123
123
  })).result || [];
124
124
  }
125
125
  /**
126
126
  * Add an edge between two nodes
127
127
  */
128
- async addEdge(e, r, u = "link", a) {
128
+ async addEdge(e, r, u = "link", s) {
129
129
  return await this.callGraph("add_edge", {
130
130
  source_id: e,
131
131
  target_id: r,
132
132
  edge_type: u,
133
- data: a
133
+ data: s
134
134
  });
135
135
  }
136
136
  /**
@@ -209,11 +209,11 @@ class yr {
209
209
  */
210
210
  fileToBase64(e) {
211
211
  return new Promise((r, u) => {
212
- const a = new FileReader();
213
- a.onload = () => {
214
- const t = a.result.split(",")[1];
212
+ const s = new FileReader();
213
+ s.onload = () => {
214
+ const t = s.result.split(",")[1];
215
215
  r(t);
216
- }, a.onerror = () => u(new Error("Failed to read file")), a.readAsDataURL(e);
216
+ }, s.onerror = () => u(new Error("Failed to read file")), s.readAsDataURL(e);
217
217
  });
218
218
  }
219
219
  /**
@@ -221,37 +221,37 @@ class yr {
221
221
  * Returns the original file if not an image or no resize needed
222
222
  */
223
223
  async resizeImage(e, r, u) {
224
- return e.type.startsWith("image/") ? new Promise((a) => {
224
+ return e.type.startsWith("image/") ? new Promise((s) => {
225
225
  const n = new Image(), t = URL.createObjectURL(e);
226
226
  n.onload = () => {
227
227
  if (URL.revokeObjectURL(t), n.width <= r && n.height <= r) {
228
- a(e);
228
+ s(e);
229
229
  return;
230
230
  }
231
231
  let i, l;
232
232
  n.width > n.height ? (i = r, l = Math.round(n.height / n.width * r)) : (l = r, i = Math.round(n.width / n.height * r));
233
- const d = document.createElement("canvas");
234
- d.width = i, d.height = l;
235
- const c = d.getContext("2d");
236
- if (!c) {
237
- a(e);
233
+ const c = document.createElement("canvas");
234
+ c.width = i, c.height = l;
235
+ const d = c.getContext("2d");
236
+ if (!d) {
237
+ s(e);
238
238
  return;
239
239
  }
240
- c.drawImage(n, 0, 0, i, l);
241
- const h = e.type === "image/png" ? "image/png" : "image/jpeg";
242
- d.toBlob(
240
+ d.drawImage(n, 0, 0, i, l);
241
+ const p = e.type === "image/png" ? "image/png" : "image/jpeg";
242
+ c.toBlob(
243
243
  (m) => {
244
244
  if (m) {
245
- const A = new File([m], e.name, { type: h });
246
- a(A);
245
+ const D = new File([m], e.name, { type: p });
246
+ s(D);
247
247
  } else
248
- a(e);
248
+ s(e);
249
249
  },
250
- h,
250
+ p,
251
251
  u
252
252
  );
253
253
  }, n.onerror = () => {
254
- URL.revokeObjectURL(t), a(e);
254
+ URL.revokeObjectURL(t), s(e);
255
255
  }, n.src = t;
256
256
  }) : e;
257
257
  }
@@ -262,8 +262,8 @@ class yr {
262
262
  * @param file - The File object to upload
263
263
  * @param options - Upload options (maxSizeMB, maxImageDimension, imageQuality)
264
264
  */
265
- async uploadFile(e, r, u, a = {}) {
266
- const n = { ...this.defaultUploadOptions, ...a };
265
+ async uploadFile(e, r, u, s = {}) {
266
+ const n = { ...this.defaultUploadOptions, ...s };
267
267
  try {
268
268
  let t = u;
269
269
  n.maxImageDimension > 0 && u.type.startsWith("image/") && (t = await this.resizeImage(u, n.maxImageDimension, n.imageQuality));
@@ -273,12 +273,12 @@ class yr {
273
273
  success: !1,
274
274
  error: `File too large (${(t.size / 1024 / 1024).toFixed(1)} MB). Max: ${n.maxSizeMB} MB`
275
275
  };
276
- const l = await this.fileToBase64(t), d = await this.callGraph("upload_file", {
276
+ const l = await this.fileToBase64(t), c = await this.callGraph("upload_file", {
277
277
  node_id: e,
278
278
  filename: r,
279
279
  content: l
280
280
  });
281
- return d.success ? { success: !0, path: d.path } : { success: !1, error: d.error || "Upload failed" };
281
+ return c.success ? { success: !0, path: c.path } : { success: !1, error: c.error || "Upload failed" };
282
282
  } catch (t) {
283
283
  return {
284
284
  success: !1,
@@ -291,10 +291,10 @@ class yr {
291
291
  * @param nodeId - The node to list files for
292
292
  */
293
293
  async listFiles(e) {
294
- var a;
295
- return (((a = (await this.callGraph("list_files", {
294
+ var s;
295
+ return (((s = (await this.callGraph("list_files", {
296
296
  node_id: e
297
- })).result) == null ? void 0 : a.files) || []).map((n) => ({
297
+ })).result) == null ? void 0 : s.files) || []).map((n) => ({
298
298
  filename: n.name,
299
299
  path: n.path
300
300
  }));
@@ -319,20 +319,20 @@ class yr {
319
319
  return `${this.config.baseUrl}/files/${this.config.system_id}/${e}/${r}`;
320
320
  }
321
321
  }
322
- const he = new TextEncoder(), ft = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ce = new Uint8Array(256);
323
- for (var _e = 0; _e < ft.length; _e++)
324
- Ce[ft.charCodeAt(_e)] = _e;
322
+ const he = new TextEncoder(), pt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ce = new Uint8Array(256);
323
+ for (var _e = 0; _e < pt.length; _e++)
324
+ Ce[pt.charCodeAt(_e)] = _e;
325
325
  function rt(o) {
326
326
  let e = Math.ceil(o.length / 4) * 3;
327
327
  const r = o.length;
328
328
  let u = 0;
329
329
  o.length % 4 === 3 ? e-- : o.length % 4 === 2 ? e -= 2 : o[o.length - 1] === "=" && (e--, o[o.length - 2] === "=" && e--);
330
- const a = new ArrayBuffer(e), n = new Uint8Array(a);
330
+ const s = new ArrayBuffer(e), n = new Uint8Array(s);
331
331
  for (let t = 0; t < r; t += 4) {
332
- let i = Ce[o.charCodeAt(t)], l = Ce[o.charCodeAt(t + 1)], d = Ce[o.charCodeAt(t + 2)], c = Ce[o.charCodeAt(t + 3)];
333
- n[u++] = i << 2 | l >> 4, n[u++] = (l & 15) << 4 | d >> 2, n[u++] = (d & 3) << 6 | c & 63;
332
+ let i = Ce[o.charCodeAt(t)], l = Ce[o.charCodeAt(t + 1)], c = Ce[o.charCodeAt(t + 2)], d = Ce[o.charCodeAt(t + 3)];
333
+ n[u++] = i << 2 | l >> 4, n[u++] = (l & 15) << 4 | c >> 2, n[u++] = (c & 3) << 6 | d & 63;
334
334
  }
335
- return a;
335
+ return s;
336
336
  }
337
337
  function Be(o) {
338
338
  o = o || "utf8";
@@ -344,59 +344,59 @@ function Be(o) {
344
344
  }
345
345
  return e;
346
346
  }
347
- async function Pe(o) {
347
+ async function Oe(o) {
348
348
  if ("arrayBuffer" in o)
349
349
  return await o.arrayBuffer();
350
350
  const e = new FileReader();
351
351
  return new Promise((r, u) => {
352
- e.onload = function(a) {
353
- r(a.target.result);
354
- }, e.onerror = function(a) {
352
+ e.onload = function(s) {
353
+ r(s.target.result);
354
+ }, e.onerror = function(s) {
355
355
  u(e.error);
356
356
  }, e.readAsArrayBuffer(o);
357
357
  });
358
358
  }
359
- function pt(o) {
359
+ function ht(o) {
360
360
  return o >= 48 && o <= 57 || o >= 97 && o <= 102 || o >= 65 && o <= 70 ? String.fromCharCode(o) : !1;
361
361
  }
362
362
  function Ht(o, e, r) {
363
363
  let u = o.indexOf("*");
364
364
  u >= 0 && (o = o.substr(0, u)), e = e.toUpperCase();
365
- let a;
365
+ let s;
366
366
  if (e === "Q") {
367
367
  r = r.replace(/=\s+([0-9a-fA-F])/g, "=$1").replace(/[_\s]/g, " ");
368
368
  let n = he.encode(r), t = [];
369
- for (let l = 0, d = n.length; l < d; l++) {
370
- let c = n[l];
371
- if (l <= d - 2 && c === 61) {
372
- let h = pt(n[l + 1]), m = pt(n[l + 2]);
373
- if (h && m) {
374
- let A = parseInt(h + m, 16);
375
- t.push(A), l += 2;
369
+ for (let l = 0, c = n.length; l < c; l++) {
370
+ let d = n[l];
371
+ if (l <= c - 2 && d === 61) {
372
+ let p = ht(n[l + 1]), m = ht(n[l + 2]);
373
+ if (p && m) {
374
+ let D = parseInt(p + m, 16);
375
+ t.push(D), l += 2;
376
376
  continue;
377
377
  }
378
378
  }
379
- t.push(c);
379
+ t.push(d);
380
380
  }
381
- a = new ArrayBuffer(t.length);
382
- let i = new DataView(a);
383
- for (let l = 0, d = t.length; l < d; l++)
381
+ s = new ArrayBuffer(t.length);
382
+ let i = new DataView(s);
383
+ for (let l = 0, c = t.length; l < c; l++)
384
384
  i.setUint8(l, t[l]);
385
- } else e === "B" ? a = rt(r.replace(/[^a-zA-Z0-9\+\/=]+/g, "")) : a = he.encode(r);
386
- return Be(o).decode(a);
385
+ } else e === "B" ? s = rt(r.replace(/[^a-zA-Z0-9\+\/=]+/g, "")) : s = he.encode(r);
386
+ return Be(o).decode(s);
387
387
  }
388
388
  function ke(o) {
389
389
  let e = !0;
390
390
  for (; ; ) {
391
391
  let r = (o || "").toString().replace(
392
392
  /(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,
393
- (u, a, n, t, i) => e && n === i && t.length % 4 === 0 && !/=$/.test(t) ? a + "__\0JOIN\0__" : u
393
+ (u, s, n, t, i) => e && n === i && t.length % 4 === 0 && !/=$/.test(t) ? s + "__\0JOIN\0__" : u
394
394
  ).replace(
395
395
  /(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,
396
- (u, a, n, t) => e && n === t ? a + "__\0JOIN\0__" : u
396
+ (u, s, n, t) => e && n === t ? s + "__\0JOIN\0__" : u
397
397
  ).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g, "").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g, "$1").replace(
398
398
  /=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,
399
- (u, a, n, t) => Ht(a, n, t)
399
+ (u, s, n, t) => Ht(s, n, t)
400
400
  );
401
401
  if (e && r.indexOf("�") >= 0)
402
402
  e = !1;
@@ -419,9 +419,9 @@ function Vt(o, e) {
419
419
  } else
420
420
  r.push(t.charCodeAt(0));
421
421
  }
422
- const u = new ArrayBuffer(r.length), a = new DataView(u);
422
+ const u = new ArrayBuffer(r.length), s = new DataView(u);
423
423
  for (let n = 0, t = r.length; n < t; n++)
424
- a.setUint8(n, r[n]);
424
+ s.setUint8(n, r[n]);
425
425
  return Be(e).decode(u);
426
426
  }
427
427
  function Wt(o) {
@@ -430,16 +430,16 @@ function Wt(o) {
430
430
  let u = r.match(/\*((\d+)\*?)?$/);
431
431
  if (!u)
432
432
  return;
433
- let a = r.substr(0, u.index).toLowerCase(), n = Number(u[2]) || 0, t;
434
- e.has(a) ? t = e.get(a) : (t = {
433
+ let s = r.substr(0, u.index).toLowerCase(), n = Number(u[2]) || 0, t;
434
+ e.has(s) ? t = e.get(s) : (t = {
435
435
  charset: !1,
436
436
  values: []
437
- }, e.set(a, t));
437
+ }, e.set(s, t));
438
438
  let i = o.params[r];
439
439
  n === 0 && u[0].charAt(u[0].length - 1) === "*" && (u = i.match(/^([^']*)'[^']*'(.*)$/)) && (t.charset = u[1] || "utf-8", i = u[2]), t.values.push({ nr: n, value: i }), delete o.params[r];
440
440
  }), e.forEach((r, u) => {
441
441
  o.params[u] = Vt(
442
- r.values.sort((a, n) => a.nr - n.nr).map((a) => a.value).join(""),
442
+ r.values.sort((s, n) => s.nr - n.nr).map((s) => s.value).join(""),
443
443
  r.charset
444
444
  );
445
445
  });
@@ -453,7 +453,7 @@ class Qt {
453
453
  `);
454
454
  }
455
455
  finalize() {
456
- return Pe(new Blob(this.chunks, { type: "application/octet-stream" }));
456
+ return Oe(new Blob(this.chunks, { type: "application/octet-stream" }));
457
457
  }
458
458
  }
459
459
  class Yt {
@@ -463,40 +463,40 @@ class Yt {
463
463
  update(e) {
464
464
  let r = this.decoder.decode(e);
465
465
  if (/[^a-zA-Z0-9+\/]/.test(r) && (r = r.replace(/[^a-zA-Z0-9+\/]+/g, "")), this.remainder += r, this.remainder.length >= this.maxChunkSize) {
466
- let u = Math.floor(this.remainder.length / 4) * 4, a;
467
- u === this.remainder.length ? (a = this.remainder, this.remainder = "") : (a = this.remainder.substr(0, u), this.remainder = this.remainder.substr(u)), a.length && this.chunks.push(rt(a));
466
+ let u = Math.floor(this.remainder.length / 4) * 4, s;
467
+ u === this.remainder.length ? (s = this.remainder, this.remainder = "") : (s = this.remainder.substr(0, u), this.remainder = this.remainder.substr(u)), s.length && this.chunks.push(rt(s));
468
468
  }
469
469
  }
470
470
  finalize() {
471
- return this.remainder && !/^=+$/.test(this.remainder) && this.chunks.push(rt(this.remainder)), Pe(new Blob(this.chunks, { type: "application/octet-stream" }));
471
+ return this.remainder && !/^=+$/.test(this.remainder) && this.chunks.push(rt(this.remainder)), Oe(new Blob(this.chunks, { type: "application/octet-stream" }));
472
472
  }
473
473
  }
474
- const ht = /^=[a-f0-9]{2}$/i, Jt = /(?==[a-f0-9]{2})/i, Kt = /=\r?\n/g, Xt = /=[a-fA-F0-9]?$/;
474
+ const gt = /^=[a-f0-9]{2}$/i, Jt = /(?==[a-f0-9]{2})/i, Kt = /=\r?\n/g, Xt = /=[a-fA-F0-9]?$/;
475
475
  class Zt {
476
476
  constructor(e) {
477
477
  e = e || {}, this.decoder = e.decoder || new TextDecoder(), this.maxChunkSize = 100 * 1024, this.remainder = "", this.chunks = [];
478
478
  }
479
479
  decodeQPBytes(e) {
480
480
  let r = new ArrayBuffer(e.length), u = new DataView(r);
481
- for (let a = 0, n = e.length; a < n; a++)
482
- u.setUint8(a, parseInt(e[a], 16));
481
+ for (let s = 0, n = e.length; s < n; s++)
482
+ u.setUint8(s, parseInt(e[s], 16));
483
483
  return r;
484
484
  }
485
485
  decodeChunks(e) {
486
486
  e = e.replace(Kt, "");
487
487
  let r = e.split(Jt), u = [];
488
- for (let a of r) {
489
- if (a.charAt(0) !== "=") {
490
- u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(a);
488
+ for (let s of r) {
489
+ if (s.charAt(0) !== "=") {
490
+ u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(s);
491
491
  continue;
492
492
  }
493
- if (a.length === 3) {
494
- ht.test(a) ? u.push(a.substr(1)) : (u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(a));
493
+ if (s.length === 3) {
494
+ gt.test(s) ? u.push(s.substr(1)) : (u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(s));
495
495
  continue;
496
496
  }
497
- if (a.length > 3) {
498
- const n = a.substr(0, 3);
499
- ht.test(n) ? (u.push(a.substr(1, 2)), this.chunks.push(this.decodeQPBytes(u)), u = [], a = a.substr(3), this.chunks.push(a)) : (u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(a));
497
+ if (s.length > 3) {
498
+ const n = s.substr(0, 3);
499
+ gt.test(n) ? (u.push(s.substr(1, 2)), this.chunks.push(this.decodeQPBytes(u)), u = [], s = s.substr(3), this.chunks.push(s)) : (u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(s));
500
500
  }
501
501
  }
502
502
  u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []);
@@ -520,10 +520,10 @@ class Zt {
520
520
  this.decodeChunks(r);
521
521
  }
522
522
  finalize() {
523
- return this.remainder.length && (this.decodeChunks(this.remainder), this.remainder = ""), Pe(new Blob(this.chunks, { type: "application/octet-stream" }));
523
+ return this.remainder.length && (this.decodeChunks(this.remainder), this.remainder = ""), Oe(new Blob(this.chunks, { type: "application/octet-stream" }));
524
524
  }
525
525
  }
526
- class gt {
526
+ class mt {
527
527
  constructor(e) {
528
528
  if (this.options = e || {}, this.postalMime = this.options.postalMime, this.root = !!this.options.parentNode, this.childNodes = [], this.options.parentNode) {
529
529
  if (this.parentNode = this.options.parentNode, this.depth = this.parentNode.depth + 1, this.depth > this.options.maxNestingDepth)
@@ -563,31 +563,31 @@ class gt {
563
563
  let r = {
564
564
  value: !1,
565
565
  params: {}
566
- }, u = !1, a = "", n = "value", t = !1, i = !1, l;
567
- for (let d = 0, c = e.length; d < c; d++)
568
- switch (l = e.charAt(d), n) {
566
+ }, u = !1, s = "", n = "value", t = !1, i = !1, l;
567
+ for (let c = 0, d = e.length; c < d; c++)
568
+ switch (l = e.charAt(c), n) {
569
569
  case "key":
570
570
  if (l === "=") {
571
- u = a.trim().toLowerCase(), n = "value", a = "";
571
+ u = s.trim().toLowerCase(), n = "value", s = "";
572
572
  break;
573
573
  }
574
- a += l;
574
+ s += l;
575
575
  break;
576
576
  case "value":
577
577
  if (i)
578
- a += l;
578
+ s += l;
579
579
  else if (l === "\\") {
580
580
  i = !0;
581
581
  continue;
582
- } else t && l === t ? t = !1 : !t && l === '"' ? t = l : !t && l === ";" ? (u === !1 ? r.value = a.trim() : r.params[u] = a.trim(), n = "key", a = "") : a += l;
582
+ } else t && l === t ? t = !1 : !t && l === '"' ? t = l : !t && l === ";" ? (u === !1 ? r.value = s.trim() : r.params[u] = s.trim(), n = "key", s = "") : s += l;
583
583
  i = !1;
584
584
  break;
585
585
  }
586
- return a = a.trim(), n === "value" ? u === !1 ? r.value = a : r.params[u] = a : a && (r.params[a.toLowerCase()] = ""), r.value && (r.value = r.value.toLowerCase()), Wt(r), r;
586
+ return s = s.trim(), n === "value" ? u === !1 ? r.value = s : r.params[u] = s : s && (r.params[s.toLowerCase()] = ""), r.value && (r.value = r.value.toLowerCase()), Wt(r), r;
587
587
  }
588
588
  decodeFlowedText(e, r) {
589
- return e.split(/\r?\n/).reduce((u, a) => / $/.test(u) && !/(^|\n)-- $/.test(u) ? r ? u.slice(0, -1) + a : u + a : u + `
590
- ` + a).replace(/^ /gm, "");
589
+ return e.split(/\r?\n/).reduce((u, s) => / $/.test(u) && !/(^|\n)-- $/.test(u) ? r ? u.slice(0, -1) + s : u + s : u + `
590
+ ` + s).replace(/^ /gm, "");
591
591
  }
592
592
  getTextContent() {
593
593
  if (!this.content)
@@ -603,8 +603,8 @@ class gt {
603
603
  ` + r, this.headerLines.splice(e, 1);
604
604
  else {
605
605
  r = r.replace(/\s+/g, " ");
606
- let u = r.indexOf(":"), a = u < 0 ? r.trim() : r.substr(0, u).trim(), n = u < 0 ? "" : r.substr(u + 1).trim();
607
- switch (this.headers.push({ key: a.toLowerCase(), originalKey: a, value: n }), a.toLowerCase()) {
606
+ let u = r.indexOf(":"), s = u < 0 ? r.trim() : r.substr(0, u).trim(), n = u < 0 ? "" : r.substr(u + 1).trim();
607
+ switch (this.headers.push({ key: s.toLowerCase(), originalKey: s, value: n }), s.toLowerCase()) {
608
608
  case "content-type":
609
609
  this.contentType.default && (this.contentType = { value: n, parsed: {} });
610
610
  break;
@@ -642,7 +642,7 @@ class gt {
642
642
  }
643
643
  }
644
644
  }
645
- const mt = {
645
+ const Dt = {
646
646
  "&AElig": "Æ",
647
647
  "&AElig;": "Æ",
648
648
  "&AMP": "&",
@@ -2878,24 +2878,24 @@ const mt = {
2878
2878
  };
2879
2879
  function er(o) {
2880
2880
  return o.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi, (e, r) => {
2881
- if (typeof mt[e] == "string")
2882
- return mt[e];
2881
+ if (typeof Dt[e] == "string")
2882
+ return Dt[e];
2883
2883
  if (r.charAt(0) !== "#" || e.charAt(e.length - 1) !== ";")
2884
2884
  return e;
2885
2885
  let u;
2886
2886
  r.charAt(1) === "x" ? u = parseInt(r.substr(2), 16) : u = parseInt(r.substr(1), 10);
2887
- var a = "";
2888
- return u >= 55296 && u <= 57343 || u > 1114111 ? "�" : (u > 65535 && (u -= 65536, a += String.fromCharCode(u >>> 10 & 1023 | 55296), u = 56320 | u & 1023), a += String.fromCharCode(u), a);
2887
+ var s = "";
2888
+ return u >= 55296 && u <= 57343 || u > 1114111 ? "�" : (u > 65535 && (u -= 65536, s += String.fromCharCode(u >>> 10 & 1023 | 55296), u = 56320 | u & 1023), s += String.fromCharCode(u), s);
2889
2889
  });
2890
2890
  }
2891
- function se(o) {
2891
+ function ae(o) {
2892
2892
  return o.trim().replace(/[<>"'?&]/g, (e) => {
2893
2893
  let r = e.charCodeAt(0).toString(16);
2894
2894
  return r.length < 2 && (r = "0" + r), "&#x" + r.toUpperCase() + ";";
2895
2895
  });
2896
2896
  }
2897
2897
  function tr(o) {
2898
- return "<div>" + se(o).replace(/\n/g, "<br />") + "</div>";
2898
+ return "<div>" + ae(o).replace(/\n/g, "<br />") + "</div>";
2899
2899
  }
2900
2900
  function rr(o) {
2901
2901
  return o = o.replace(/\r?\n/g, "").replace(/<\!\-\-.*?\-\->/gi, " ").replace(/<br\b[^>]*>/gi, `
@@ -2910,26 +2910,26 @@ function rr(o) {
2910
2910
  `).replace(/\n+$/, `
2911
2911
  `), o = er(o), o;
2912
2912
  }
2913
- function xt(o) {
2913
+ function Et(o) {
2914
2914
  return [].concat(o.name || []).concat(o.name ? `<${o.address}>` : o.address).join(" ");
2915
2915
  }
2916
2916
  function Ke(o) {
2917
- let e = [], r = (u, a) => {
2918
- if (a && e.push(", "), u.group) {
2917
+ let e = [], r = (u, s) => {
2918
+ if (s && e.push(", "), u.group) {
2919
2919
  let n = `${u.name}:`, t = ";";
2920
2920
  e.push(n), u.group.forEach(r), e.push(t);
2921
2921
  } else
2922
- e.push(xt(u));
2922
+ e.push(Et(u));
2923
2923
  };
2924
2924
  return o.forEach(r), e.join("");
2925
2925
  }
2926
2926
  function wt(o) {
2927
- return `<a href="mailto:${se(o.address)}" class="postal-email-address">${se(o.name || `<${o.address}>`)}</a>`;
2927
+ return `<a href="mailto:${ae(o.address)}" class="postal-email-address">${ae(o.name || `<${o.address}>`)}</a>`;
2928
2928
  }
2929
2929
  function Xe(o) {
2930
- let e = [], r = (u, a) => {
2931
- if (a && e.push('<span class="postal-email-address-separator">, </span>'), u.group) {
2932
- let n = `<span class="postal-email-address-group">${se(u.name)}:</span>`, t = '<span class="postal-email-address-group">;</span>';
2930
+ let e = [], r = (u, s) => {
2931
+ if (s && e.push('<span class="postal-email-address-separator">, </span>'), u.group) {
2932
+ let n = `<span class="postal-email-address-group">${ae(u.name)}:</span>`, t = '<span class="postal-email-address-group">;</span>';
2933
2933
  e.push(n), u.group.forEach(r), e.push(t);
2934
2934
  } else
2935
2935
  e.push(wt(u));
@@ -2938,8 +2938,8 @@ function Xe(o) {
2938
2938
  }
2939
2939
  function ur(o, e, r) {
2940
2940
  o = (o || "").toString(), e = e || 76;
2941
- let u = 0, a = o.length, n = "", t, i;
2942
- for (; u < a; ) {
2941
+ let u = 0, s = o.length, n = "", t, i;
2942
+ for (; u < s; ) {
2943
2943
  if (t = o.substr(u, e), t.length < e) {
2944
2944
  n += t;
2945
2945
  break;
@@ -2948,14 +2948,14 @@ function ur(o, e, r) {
2948
2948
  t = i[0], n += t, u += t.length;
2949
2949
  continue;
2950
2950
  } else (i = t.match(/(\s+)[^\s]*$/)) && i[0].length - (i[1] || "").length < t.length ? t = t.substr(0, t.length - (i[0].length - (i[1] || "").length)) : (i = o.substr(u + t.length).match(/^[^\s]+(\s*)/)) && (t = t + i[0].substr(0, i[0].length - 0));
2951
- n += t, u += t.length, u < a && (n += `\r
2951
+ n += t, u += t.length, u < s && (n += `\r
2952
2952
  `);
2953
2953
  }
2954
2954
  return n;
2955
2955
  }
2956
- function Dt(o) {
2956
+ function At(o) {
2957
2957
  let e = [];
2958
- if (o.from && e.push({ key: "From", val: xt(o.from) }), o.subject && e.push({ key: "Subject", val: o.subject }), o.date) {
2958
+ if (o.from && e.push({ key: "From", val: Et(o.from) }), o.subject && e.push({ key: "Subject", val: o.subject }), o.date) {
2959
2959
  let t = {
2960
2960
  year: "numeric",
2961
2961
  month: "numeric",
@@ -2970,23 +2970,23 @@ function Dt(o) {
2970
2970
  o.to && o.to.length && e.push({ key: "To", val: Ke(o.to) }), o.cc && o.cc.length && e.push({ key: "Cc", val: Ke(o.cc) }), o.bcc && o.bcc.length && e.push({ key: "Bcc", val: Ke(o.bcc) });
2971
2971
  let r = e.map((t) => t.key.length).reduce((t, i) => i > t ? i : t, 0);
2972
2972
  e = e.flatMap((t) => {
2973
- let i = r - t.key.length, l = `${t.key}: ${" ".repeat(i)}`, d = `${" ".repeat(t.key.length + 1)} ${" ".repeat(i)}`;
2974
- return ur(t.val, 80).split(/\r?\n/).map((h) => h.trim()).map((h, m) => `${m ? d : l}${h}`);
2973
+ let i = r - t.key.length, l = `${t.key}: ${" ".repeat(i)}`, c = `${" ".repeat(t.key.length + 1)} ${" ".repeat(i)}`;
2974
+ return ur(t.val, 80).split(/\r?\n/).map((p) => p.trim()).map((p, m) => `${m ? c : l}${p}`);
2975
2975
  });
2976
- let u = e.map((t) => t.length).reduce((t, i) => i > t ? i : t, 0), a = "-".repeat(u);
2976
+ let u = e.map((t) => t.length).reduce((t, i) => i > t ? i : t, 0), s = "-".repeat(u);
2977
2977
  return `
2978
- ${a}
2978
+ ${s}
2979
2979
  ${e.join(`
2980
2980
  `)}
2981
- ${a}
2981
+ ${s}
2982
2982
  `;
2983
2983
  }
2984
- function At(o) {
2984
+ function bt(o) {
2985
2985
  let e = [];
2986
2986
  if (o.from && e.push(
2987
2987
  `<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${wt(o.from)}</div>`
2988
2988
  ), o.subject && e.push(
2989
- `<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${se(
2989
+ `<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${ae(
2990
2990
  o.subject
2991
2991
  )}</div>`
2992
2992
  ), o.date) {
@@ -2998,11 +2998,11 @@ function At(o) {
2998
2998
  minute: "numeric",
2999
2999
  second: "numeric",
3000
3000
  hour12: !1
3001
- }, a = typeof Intl > "u" ? o.date : new Intl.DateTimeFormat("default", u).format(new Date(o.date));
3001
+ }, s = typeof Intl > "u" ? o.date : new Intl.DateTimeFormat("default", u).format(new Date(o.date));
3002
3002
  e.push(
3003
- `<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${se(
3003
+ `<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${ae(
3004
3004
  o.date
3005
- )}">${se(a)}</div>`
3005
+ )}">${ae(s)}</div>`
3006
3006
  );
3007
3007
  }
3008
3008
  return o.to && o.to.length && e.push(
@@ -3016,45 +3016,45 @@ function At(o) {
3016
3016
  <div class="postal-email-header-row">`
3017
3017
  )}${e.length ? "</div>" : ""}</div>`;
3018
3018
  }
3019
- function ar(o, e) {
3020
- let r = !1, u = "text", a, n = [], t = {
3019
+ function sr(o, e) {
3020
+ let r = !1, u = "text", s, n = [], t = {
3021
3021
  address: [],
3022
3022
  comment: [],
3023
3023
  group: [],
3024
3024
  text: [],
3025
3025
  textWasQuoted: []
3026
3026
  // Track which text tokens came from inside quotes
3027
- }, i, l, d = !1;
3027
+ }, i, l, c = !1;
3028
3028
  for (i = 0, l = o.length; i < l; i++) {
3029
- let c = o[i], h = i ? o[i - 1] : null;
3030
- if (c.type === "operator")
3031
- switch (c.value) {
3029
+ let d = o[i], p = i ? o[i - 1] : null;
3030
+ if (d.type === "operator")
3031
+ switch (d.value) {
3032
3032
  case "<":
3033
- u = "address", d = !1;
3033
+ u = "address", c = !1;
3034
3034
  break;
3035
3035
  case "(":
3036
- u = "comment", d = !1;
3036
+ u = "comment", c = !1;
3037
3037
  break;
3038
3038
  case ":":
3039
- u = "group", r = !0, d = !1;
3039
+ u = "group", r = !0, c = !1;
3040
3040
  break;
3041
3041
  case '"':
3042
- d = !d, u = "text";
3042
+ c = !c, u = "text";
3043
3043
  break;
3044
3044
  default:
3045
- u = "text", d = !1;
3045
+ u = "text", c = !1;
3046
3046
  break;
3047
3047
  }
3048
- else c.value && (u === "address" && (c.value = c.value.replace(/^[^<]*<\s*/, "")), h && h.noBreak && t[u].length ? (t[u][t[u].length - 1] += c.value, u === "text" && d && (t.textWasQuoted[t.textWasQuoted.length - 1] = !0)) : (t[u].push(c.value), u === "text" && t.textWasQuoted.push(d)));
3048
+ else d.value && (u === "address" && (d.value = d.value.replace(/^[^<]*<\s*/, "")), p && p.noBreak && t[u].length ? (t[u][t[u].length - 1] += d.value, u === "text" && c && (t.textWasQuoted[t.textWasQuoted.length - 1] = !0)) : (t[u].push(d.value), u === "text" && t.textWasQuoted.push(c)));
3049
3049
  }
3050
3050
  if (!t.text.length && t.comment.length && (t.text = t.comment, t.comment = []), r) {
3051
3051
  t.text = t.text.join(" ");
3052
- let c = [];
3052
+ let d = [];
3053
3053
  t.group.length && Fe(t.group.join(","), { _depth: e + 1 }).forEach((m) => {
3054
- m.group ? c = c.concat(m.group) : c.push(m);
3054
+ m.group ? d = d.concat(m.group) : d.push(m);
3055
3055
  }), n.push({
3056
- name: ke(t.text || a && a.name),
3057
- group: c
3056
+ name: ke(t.text || s && s.name),
3057
+ group: d
3058
3058
  });
3059
3059
  } else {
3060
3060
  if (!t.address.length && t.text.length) {
@@ -3063,28 +3063,28 @@ function ar(o, e) {
3063
3063
  t.address = t.text.splice(i, 1), t.textWasQuoted.splice(i, 1);
3064
3064
  break;
3065
3065
  }
3066
- let c = function(h) {
3067
- return t.address.length ? h : (t.address = [h.trim()], " ");
3066
+ let d = function(p) {
3067
+ return t.address.length ? p : (t.address = [p.trim()], " ");
3068
3068
  };
3069
3069
  if (!t.address.length)
3070
- for (i = t.text.length - 1; i >= 0 && !(!t.textWasQuoted[i] && (t.text[i] = t.text[i].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/, c).trim(), t.address.length)); i--)
3070
+ for (i = t.text.length - 1; i >= 0 && !(!t.textWasQuoted[i] && (t.text[i] = t.text[i].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/, d).trim(), t.address.length)); i--)
3071
3071
  ;
3072
3072
  }
3073
3073
  if (!t.text.length && t.comment.length && (t.text = t.comment, t.comment = []), t.address.length > 1 && (t.text = t.text.concat(t.address.splice(1))), t.text = t.text.join(" "), t.address = t.address.join(" "), !t.address && /^=\?[^=]+?=$/.test(t.text.trim())) {
3074
- const c = Fe(ke(t.text));
3075
- if (c && c.length)
3076
- return c;
3074
+ const d = Fe(ke(t.text));
3075
+ if (d && d.length)
3076
+ return d;
3077
3077
  }
3078
3078
  if (!t.address && r)
3079
3079
  return [];
3080
- a = {
3080
+ s = {
3081
3081
  address: t.address || t.text || "",
3082
3082
  name: ke(t.text || t.address || "")
3083
- }, a.address === a.name && ((a.address || "").match(/@/) ? a.name = "" : a.address = ""), n.push(a);
3083
+ }, s.address === s.name && ((s.address || "").match(/@/) ? s.name = "" : s.address = ""), n.push(s);
3084
3084
  }
3085
3085
  return n;
3086
3086
  }
3087
- class sr {
3087
+ class ar {
3088
3088
  constructor(e) {
3089
3089
  this.str = (e || "").toString(), this.operatorCurrent = "", this.operatorExpecting = "", this.node = null, this.escaped = !1, this.list = [], this.operators = {
3090
3090
  '"': '"',
@@ -3109,8 +3109,8 @@ class sr {
3109
3109
  tokenize() {
3110
3110
  let e = [];
3111
3111
  for (let r = 0, u = this.str.length; r < u; r++) {
3112
- let a = this.str.charAt(r), n = r < u - 1 ? this.str.charAt(r + 1) : null;
3113
- this.checkChar(a, n);
3112
+ let s = this.str.charAt(r), n = r < u - 1 ? this.str.charAt(r + 1) : null;
3113
+ this.checkChar(s, n);
3114
3114
  }
3115
3115
  return this.list.forEach((r) => {
3116
3116
  r.value = (r.value || "").toString().trim(), r.value && e.push(r);
@@ -3154,27 +3154,27 @@ function Fe(o, e) {
3154
3154
  let r = e._depth || 0;
3155
3155
  if (r > nr)
3156
3156
  return [];
3157
- let a = new sr(o).tokenize(), n = [], t = [], i = [];
3158
- if (a.forEach((l) => {
3157
+ let s = new ar(o).tokenize(), n = [], t = [], i = [];
3158
+ if (s.forEach((l) => {
3159
3159
  l.type === "operator" && (l.value === "," || l.value === ";") ? (t.length && n.push(t), t = []) : t.push(l);
3160
3160
  }), t.length && n.push(t), n.forEach((l) => {
3161
- l = ar(l, r), l.length && (i = i.concat(l));
3161
+ l = sr(l, r), l.length && (i = i.concat(l));
3162
3162
  }), e.flatten) {
3163
- let l = [], d = (c) => {
3164
- c.forEach((h) => {
3165
- if (h.group)
3166
- return d(h.group);
3167
- l.push(h);
3163
+ let l = [], c = (d) => {
3164
+ d.forEach((p) => {
3165
+ if (p.group)
3166
+ return c(p.group);
3167
+ l.push(p);
3168
3168
  });
3169
3169
  };
3170
- return d(i), l;
3170
+ return c(i), l;
3171
3171
  }
3172
3172
  return i;
3173
3173
  }
3174
3174
  function ir(o) {
3175
- for (var e = "", r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = new Uint8Array(o), a = u.byteLength, n = a % 3, t = a - n, i, l, d, c, h, m = 0; m < t; m = m + 3)
3176
- h = u[m] << 16 | u[m + 1] << 8 | u[m + 2], i = (h & 16515072) >> 18, l = (h & 258048) >> 12, d = (h & 4032) >> 6, c = h & 63, e += r[i] + r[l] + r[d] + r[c];
3177
- return n == 1 ? (h = u[t], i = (h & 252) >> 2, l = (h & 3) << 4, e += r[i] + r[l] + "==") : n == 2 && (h = u[t] << 8 | u[t + 1], i = (h & 64512) >> 10, l = (h & 1008) >> 4, d = (h & 15) << 2, e += r[i] + r[l] + r[d] + "="), e;
3175
+ for (var e = "", r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = new Uint8Array(o), s = u.byteLength, n = s % 3, t = s - n, i, l, c, d, p, m = 0; m < t; m = m + 3)
3176
+ p = u[m] << 16 | u[m + 1] << 8 | u[m + 2], i = (p & 16515072) >> 18, l = (p & 258048) >> 12, c = (p & 4032) >> 6, d = p & 63, e += r[i] + r[l] + r[c] + r[d];
3177
+ return n == 1 ? (p = u[t], i = (p & 252) >> 2, l = (p & 3) << 4, e += r[i] + r[l] + "==") : n == 2 && (p = u[t] << 8 | u[t + 1], i = (p & 64512) >> 10, l = (p & 1008) >> 4, c = (p & 15) << 2, e += r[i] + r[l] + r[c] + "="), e;
3178
3178
  }
3179
3179
  const or = 256, lr = 2 * 1024 * 1024;
3180
3180
  class Le {
@@ -3185,7 +3185,7 @@ class Le {
3185
3185
  this.options = e || {}, this.mimeOptions = {
3186
3186
  maxNestingDepth: this.options.maxNestingDepth || or,
3187
3187
  maxHeadersSize: this.options.maxHeadersSize || lr
3188
- }, this.root = this.currentNode = new gt({
3188
+ }, this.root = this.currentNode = new mt({
3189
3189
  postalMime: this,
3190
3190
  ...this.mimeOptions
3191
3191
  }), this.boundaries = [], this.textContent = {}, this.attachments = [], this.attachmentEncoding = (this.options.attachmentEncoding || "").toString().replace(/[-_\s]/g, "").trim().toLowerCase() || "arraybuffer", this.started = !1;
@@ -3196,8 +3196,8 @@ class Le {
3196
3196
  async processLine(e, r) {
3197
3197
  let u = this.boundaries;
3198
3198
  if (u.length && e.length > 2 && e[0] === 45 && e[1] === 45)
3199
- for (let a = u.length - 1; a >= 0; a--) {
3200
- let n = u[a];
3199
+ for (let s = u.length - 1; s >= 0; s--) {
3200
+ let n = u[s];
3201
3201
  if (e.length !== n.value.length + 2 && e.length !== n.value.length + 4)
3202
3202
  continue;
3203
3203
  let t = e.length === n.value.length + 4;
@@ -3210,7 +3210,7 @@ class Le {
3210
3210
  break;
3211
3211
  }
3212
3212
  if (i)
3213
- return t ? (await n.node.finalize(), this.currentNode = n.node.parentNode || this.root) : (await n.node.finalizeChildNodes(), this.currentNode = new gt({
3213
+ return t ? (await n.node.finalize(), this.currentNode = n.node.parentNode || this.root) : (await n.node.finalizeChildNodes(), this.currentNode = new mt({
3214
3214
  postalMime: this,
3215
3215
  parentNode: n.node,
3216
3216
  ...this.mimeOptions
@@ -3225,53 +3225,53 @@ class Le {
3225
3225
  done: this.readPos >= this.av.length
3226
3226
  });
3227
3227
  for (; this.readPos < this.av.length; ) {
3228
- const a = this.av[this.readPos++];
3229
- if (a !== 13 && a !== 10 && (r = this.readPos), a === 10)
3228
+ const s = this.av[this.readPos++];
3229
+ if (s !== 13 && s !== 10 && (r = this.readPos), s === 10)
3230
3230
  return u();
3231
3231
  }
3232
3232
  return u();
3233
3233
  }
3234
3234
  async processNodeTree() {
3235
- let e = {}, r = /* @__PURE__ */ new Set(), u = this.textMap = /* @__PURE__ */ new Map(), a = this.forceRfc822Attachments(), n = async (t, i, l) => {
3235
+ let e = {}, r = /* @__PURE__ */ new Set(), u = this.textMap = /* @__PURE__ */ new Map(), s = this.forceRfc822Attachments(), n = async (t, i, l) => {
3236
3236
  if (i = i || !1, l = l || !1, t.contentType.multipart)
3237
3237
  t.contentType.multipart === "alternative" ? i = t : t.contentType.multipart === "related" && (l = t);
3238
- else if (this.isInlineMessageRfc822(t) && !a) {
3239
- const d = new Le();
3240
- t.subMessage = await d.parse(t.content), u.has(t) || u.set(t, {});
3241
- let c = u.get(t);
3242
- (t.subMessage.text || !t.subMessage.html) && (c.plain = c.plain || [], c.plain.push({ type: "subMessage", value: t.subMessage }), r.add("plain")), t.subMessage.html && (c.html = c.html || [], c.html.push({ type: "subMessage", value: t.subMessage }), r.add("html")), d.textMap && d.textMap.forEach((h, m) => {
3243
- u.set(m, h);
3238
+ else if (this.isInlineMessageRfc822(t) && !s) {
3239
+ const c = new Le();
3240
+ t.subMessage = await c.parse(t.content), u.has(t) || u.set(t, {});
3241
+ let d = u.get(t);
3242
+ (t.subMessage.text || !t.subMessage.html) && (d.plain = d.plain || [], d.plain.push({ type: "subMessage", value: t.subMessage }), r.add("plain")), t.subMessage.html && (d.html = d.html || [], d.html.push({ type: "subMessage", value: t.subMessage }), r.add("html")), c.textMap && c.textMap.forEach((p, m) => {
3243
+ u.set(m, p);
3244
3244
  });
3245
- for (let h of t.subMessage.attachments || [])
3246
- this.attachments.push(h);
3245
+ for (let p of t.subMessage.attachments || [])
3246
+ this.attachments.push(p);
3247
3247
  } else if (this.isInlineTextNode(t)) {
3248
- let d = t.contentType.parsed.value.substr(t.contentType.parsed.value.indexOf("/") + 1), c = i || t;
3249
- u.has(c) || u.set(c, {});
3250
- let h = u.get(c);
3251
- h[d] = h[d] || [], h[d].push({ type: "text", value: t.getTextContent() }), r.add(d);
3248
+ let c = t.contentType.parsed.value.substr(t.contentType.parsed.value.indexOf("/") + 1), d = i || t;
3249
+ u.has(d) || u.set(d, {});
3250
+ let p = u.get(d);
3251
+ p[c] = p[c] || [], p[c].push({ type: "text", value: t.getTextContent() }), r.add(c);
3252
3252
  } else if (t.content) {
3253
- const d = t.contentDisposition.parsed.params.filename || t.contentType.parsed.params.name || null, c = {
3254
- filename: d ? ke(d) : null,
3253
+ const c = t.contentDisposition.parsed.params.filename || t.contentType.parsed.params.name || null, d = {
3254
+ filename: c ? ke(c) : null,
3255
3255
  mimeType: t.contentType.parsed.value,
3256
3256
  disposition: t.contentDisposition.parsed.value || null
3257
3257
  };
3258
- switch (l && t.contentId && (c.related = !0), t.contentDescription && (c.description = t.contentDescription), t.contentId && (c.contentId = t.contentId), t.contentType.parsed.value) {
3258
+ switch (l && t.contentId && (d.related = !0), t.contentDescription && (d.description = t.contentDescription), t.contentId && (d.contentId = t.contentId), t.contentType.parsed.value) {
3259
3259
  case "text/calendar":
3260
3260
  case "application/ics": {
3261
- t.contentType.parsed.params.method && (c.method = t.contentType.parsed.params.method.toString().toUpperCase().trim());
3262
- const h = t.getTextContent().replace(/\r?\n/g, `
3261
+ t.contentType.parsed.params.method && (d.method = t.contentType.parsed.params.method.toString().toUpperCase().trim());
3262
+ const p = t.getTextContent().replace(/\r?\n/g, `
3263
3263
  `).replace(/\n*$/, `
3264
3264
  `);
3265
- c.content = he.encode(h);
3265
+ d.content = he.encode(p);
3266
3266
  break;
3267
3267
  }
3268
3268
  default:
3269
- c.content = t.content;
3269
+ d.content = t.content;
3270
3270
  }
3271
- this.attachments.push(c);
3271
+ this.attachments.push(d);
3272
3272
  }
3273
- for (let d of t.childNodes)
3274
- await n(d, i, l);
3273
+ for (let c of t.childNodes)
3274
+ await n(c, i, l);
3275
3275
  };
3276
3276
  await n(this.root, !1, []), u.forEach((t) => {
3277
3277
  r.forEach((i) => {
@@ -3284,10 +3284,10 @@ class Le {
3284
3284
  case "subMessage":
3285
3285
  switch (i) {
3286
3286
  case "html":
3287
- e[i].push(At(l.value));
3287
+ e[i].push(bt(l.value));
3288
3288
  break;
3289
3289
  case "plain":
3290
- e[i].push(Dt(l.value));
3290
+ e[i].push(At(l.value));
3291
3291
  break;
3292
3292
  }
3293
3293
  break;
@@ -3303,25 +3303,25 @@ class Le {
3303
3303
  l = "html";
3304
3304
  break;
3305
3305
  }
3306
- (t[l] || []).forEach((d) => {
3307
- switch (d.type) {
3306
+ (t[l] || []).forEach((c) => {
3307
+ switch (c.type) {
3308
3308
  case "text":
3309
3309
  switch (i) {
3310
3310
  case "html":
3311
- e[i].push(tr(d.value));
3311
+ e[i].push(tr(c.value));
3312
3312
  break;
3313
3313
  case "plain":
3314
- e[i].push(rr(d.value));
3314
+ e[i].push(rr(c.value));
3315
3315
  break;
3316
3316
  }
3317
3317
  break;
3318
3318
  case "subMessage":
3319
3319
  switch (i) {
3320
3320
  case "html":
3321
- e[i].push(At(d.value));
3321
+ e[i].push(bt(c.value));
3322
3322
  break;
3323
3323
  case "plain":
3324
- e[i].push(Dt(d.value));
3324
+ e[i].push(At(c.value));
3325
3325
  break;
3326
3326
  }
3327
3327
  break;
@@ -3356,16 +3356,16 @@ class Le {
3356
3356
  return !0;
3357
3357
  let e = !1, r = (u) => {
3358
3358
  u.contentType.multipart || ["message/delivery-status", "message/feedback-report"].includes(u.contentType.parsed.value) && (e = !0);
3359
- for (let a of u.childNodes)
3360
- r(a);
3359
+ for (let s of u.childNodes)
3360
+ r(s);
3361
3361
  };
3362
3362
  return r(this.root), e;
3363
3363
  }
3364
3364
  async resolveStream(e) {
3365
3365
  let r = 0, u = [];
3366
- const a = e.getReader();
3366
+ const s = e.getReader();
3367
3367
  for (; ; ) {
3368
- const { done: i, value: l } = await a.read();
3368
+ const { done: i, value: l } = await s.read();
3369
3369
  if (i)
3370
3370
  break;
3371
3371
  u.push(l), r += l.length;
@@ -3377,10 +3377,10 @@ class Le {
3377
3377
  return n;
3378
3378
  }
3379
3379
  async parse(e) {
3380
- var a, n;
3380
+ var s, n;
3381
3381
  if (this.started)
3382
3382
  throw new Error("Can not reuse parser, create a new PostalMime object");
3383
- for (this.started = !0, e && typeof e.getReader == "function" && (e = await this.resolveStream(e)), e = e || new ArrayBuffer(0), typeof e == "string" && (e = he.encode(e)), (e instanceof Blob || Object.prototype.toString.call(e) === "[object Blob]") && (e = await Pe(e)), e.buffer instanceof ArrayBuffer && (e = new Uint8Array(e).buffer), this.buf = e, this.av = new Uint8Array(e), this.readPos = 0; this.readPos < this.av.length; ) {
3383
+ for (this.started = !0, e && typeof e.getReader == "function" && (e = await this.resolveStream(e)), e = e || new ArrayBuffer(0), typeof e == "string" && (e = he.encode(e)), (e instanceof Blob || Object.prototype.toString.call(e) === "[object Blob]") && (e = await Oe(e)), e.buffer instanceof ArrayBuffer && (e = new Uint8Array(e).buffer), this.buf = e, this.av = new Uint8Array(e), this.readPos = 0; this.readPos < this.av.length; ) {
3384
3384
  const t = this.readLine();
3385
3385
  await this.processLine(t.bytes, t.done);
3386
3386
  }
@@ -3400,23 +3400,23 @@ class Le {
3400
3400
  if (i && i.value) {
3401
3401
  const l = Fe(i.value);
3402
3402
  if (l && l.length && l[0].address) {
3403
- const d = t.replace(/\-(.)/g, (c, h) => h.toUpperCase());
3404
- r[d] = l[0].address;
3403
+ const c = t.replace(/\-(.)/g, (d, p) => p.toUpperCase());
3404
+ r[c] = l[0].address;
3405
3405
  }
3406
3406
  }
3407
3407
  }
3408
3408
  for (const t of ["to", "cc", "bcc", "reply-to"]) {
3409
- const i = this.root.headers.filter((d) => d.key === t);
3409
+ const i = this.root.headers.filter((c) => c.key === t);
3410
3410
  let l = [];
3411
- if (i.filter((d) => d && d.value).map((d) => Fe(d.value)).forEach((d) => l = l.concat(d || [])), l && l.length) {
3412
- const d = t.replace(/\-(.)/g, (c, h) => h.toUpperCase());
3413
- r[d] = l;
3411
+ if (i.filter((c) => c && c.value).map((c) => Fe(c.value)).forEach((c) => l = l.concat(c || [])), l && l.length) {
3412
+ const c = t.replace(/\-(.)/g, (d, p) => p.toUpperCase());
3413
+ r[c] = l;
3414
3414
  }
3415
3415
  }
3416
3416
  for (const t of ["subject", "message-id", "in-reply-to", "references"]) {
3417
3417
  const i = this.root.headers.find((l) => l.key === t);
3418
3418
  if (i && i.value) {
3419
- const l = t.replace(/\-(.)/g, (d, c) => c.toUpperCase());
3419
+ const l = t.replace(/\-(.)/g, (c, d) => d.toUpperCase());
3420
3420
  r[l] = ke(i.value);
3421
3421
  }
3422
3422
  }
@@ -3425,7 +3425,7 @@ class Le {
3425
3425
  let t = new Date(u.value);
3426
3426
  !t || t.toString() === "Invalid Date" ? t = u.value : t = t.toISOString(), r.date = t;
3427
3427
  }
3428
- switch ((a = this.textContent) != null && a.html && (r.html = this.textContent.html), (n = this.textContent) != null && n.plain && (r.text = this.textContent.plain), r.attachments = this.attachments, this.attachmentEncoding) {
3428
+ switch ((s = this.textContent) != null && s.html && (r.html = this.textContent.html), (n = this.textContent) != null && n.plain && (r.text = this.textContent.plain), r.attachments = this.attachments, this.attachmentEncoding) {
3429
3429
  case "arraybuffer":
3430
3430
  break;
3431
3431
  case "base64":
@@ -3445,7 +3445,7 @@ class Le {
3445
3445
  }
3446
3446
  class cr {
3447
3447
  constructor(e) {
3448
- Ee(this, "config");
3448
+ ve(this, "config");
3449
3449
  if (!e.system_id)
3450
3450
  throw new Error("MailClient: system_id is REQUIRED");
3451
3451
  this.config = e;
@@ -3454,7 +3454,7 @@ class cr {
3454
3454
  * Call a coprocessor (default: mail)
3455
3455
  */
3456
3456
  async callCoprocessor(e, r, u = {}) {
3457
- const a = {
3457
+ const s = {
3458
3458
  coprocessor: e,
3459
3459
  method: r,
3460
3460
  system_id: this.config.system_id,
@@ -3470,7 +3470,7 @@ class cr {
3470
3470
  "Content-Type": "application/json",
3471
3471
  Authorization: `Bearer ${this.getToken()}`
3472
3472
  },
3473
- body: JSON.stringify(a)
3473
+ body: JSON.stringify(s)
3474
3474
  });
3475
3475
  if (!n.ok) {
3476
3476
  const i = await n.text();
@@ -3560,10 +3560,10 @@ class cr {
3560
3560
  */
3561
3561
  async trashEmails(e, r) {
3562
3562
  const u = ["[Gmail]/Trash", "[Gmail]/Corbeille", "[Gmail]/Bin", "Trash"];
3563
- for (const a of u) {
3563
+ for (const s of u) {
3564
3564
  const n = [
3565
3565
  "SELECT INBOX",
3566
- ...r.map((l) => `UID MOVE ${l} ${a}`)
3566
+ ...r.map((l) => `UID MOVE ${l} ${s}`)
3567
3567
  ], i = (await this.imapExec(e, n)).responses.filter((l) => l.ok && l.command === "UID MOVE").length;
3568
3568
  if (i > 0)
3569
3569
  return { success: !0, moved: i };
@@ -3585,7 +3585,7 @@ class cr {
3585
3585
  * List available folders
3586
3586
  */
3587
3587
  async listFolders(e) {
3588
- const u = (await this.imapExec(e, ['LIST "" *'])).responses.find((a) => a.command === "LIST");
3588
+ const u = (await this.imapExec(e, ['LIST "" *'])).responses.find((s) => s.command === "LIST");
3589
3589
  return u != null && u.ok && u.folders ? { success: !0, folders: u.folders } : { success: !1, folders: [] };
3590
3590
  }
3591
3591
  /**
@@ -3593,44 +3593,44 @@ class cr {
3593
3593
  * This is the preferred method - all logic in TypeScript, backend is just a proxy
3594
3594
  */
3595
3595
  async listEmailsSorted(e, r = "INBOX", u = 20) {
3596
- const a = await this.imapExec(e, [
3596
+ const s = await this.imapExec(e, [
3597
3597
  `SELECT ${r}`,
3598
3598
  "FETCH 1:* (UID INTERNALDATE)"
3599
- ]), n = a.responses.find((A) => A.command === "SELECT");
3599
+ ]), n = s.responses.find((D) => D.command === "SELECT");
3600
3600
  if (!(n != null && n.ok))
3601
3601
  throw new Error(`Failed to select folder: ${(n == null ? void 0 : n.error) || "Unknown error"}`);
3602
- const t = a.responses.find((A) => A.command === "FETCH");
3602
+ const t = s.responses.find((D) => D.command === "FETCH");
3603
3603
  if (!(t != null && t.ok) || !t.messages)
3604
3604
  return {
3605
3605
  account: { id: e, label: "", email: "" },
3606
3606
  mailbox: { name: r, total: n.exists || 0 },
3607
3607
  messages: []
3608
3608
  };
3609
- const l = [...t.messages].sort((A, w) => {
3610
- const B = A.internalDate ? new Date(A.internalDate).getTime() : 0;
3611
- return (w.internalDate ? new Date(w.internalDate).getTime() : 0) - B;
3612
- }).slice(0, u).map((A) => A.uid).filter(Boolean);
3609
+ const l = [...t.messages].sort((D, E) => {
3610
+ const B = D.internalDate ? new Date(D.internalDate).getTime() : 0;
3611
+ return (E.internalDate ? new Date(E.internalDate).getTime() : 0) - B;
3612
+ }).slice(0, u).map((D) => D.uid).filter(Boolean);
3613
3613
  if (l.length === 0)
3614
3614
  return {
3615
3615
  account: { id: e, label: "", email: "" },
3616
3616
  mailbox: { name: r, total: n.exists || 0 },
3617
3617
  messages: []
3618
3618
  };
3619
- const c = (await this.imapExec(e, [
3619
+ const d = (await this.imapExec(e, [
3620
3620
  `SELECT ${r}`,
3621
3621
  `UID FETCH ${l.join(",")} (UID FLAGS ENVELOPE)`
3622
- ])).responses.find((A) => A.command === "UID FETCH");
3623
- if (!(c != null && c.ok) || !c.messages)
3624
- throw new Error(`Failed to fetch details: ${(c == null ? void 0 : c.error) || "Unknown error"}`);
3625
- const h = /* @__PURE__ */ new Map();
3626
- for (const A of c.messages)
3627
- A.uid && h.set(A.uid, A);
3628
- const m = l.map((A) => {
3629
- var I, b, N, y, q;
3630
- const w = h.get(A);
3631
- if (!w) return null;
3632
- const B = ((I = w.flags) == null ? void 0 : I.some((L) => L.includes("Seen"))) || !1, G = ((N = (b = w.envelope) == null ? void 0 : b.from) == null ? void 0 : N.email) || "Unknown", O = ((y = w.envelope) == null ? void 0 : y.subject) || "(No subject)", C = ((q = w.envelope) == null ? void 0 : q.date) || "";
3633
- return { uid: A, from: G, subject: O, date: C, seen: B };
3622
+ ])).responses.find((D) => D.command === "UID FETCH");
3623
+ if (!(d != null && d.ok) || !d.messages)
3624
+ throw new Error(`Failed to fetch details: ${(d == null ? void 0 : d.error) || "Unknown error"}`);
3625
+ const p = /* @__PURE__ */ new Map();
3626
+ for (const D of d.messages)
3627
+ D.uid && p.set(D.uid, D);
3628
+ const m = l.map((D) => {
3629
+ var U, g, k, y, q;
3630
+ const E = p.get(D);
3631
+ if (!E) return null;
3632
+ const B = ((U = E.flags) == null ? void 0 : U.some((P) => P.includes("Seen"))) || !1, M = ((k = (g = E.envelope) == null ? void 0 : g.from) == null ? void 0 : k.email) || "Unknown", L = ((y = E.envelope) == null ? void 0 : y.subject) || "(No subject)", C = ((q = E.envelope) == null ? void 0 : q.date) || "";
3633
+ return { uid: D, from: M, subject: L, date: C, seen: B };
3634
3634
  }).filter(Boolean);
3635
3635
  return {
3636
3636
  account: { id: e, label: "", email: "" },
@@ -3653,38 +3653,38 @@ class cr {
3653
3653
  * This handles CID embedded images by converting them to base64 data URIs
3654
3654
  */
3655
3655
  async getEmailParsed(e, r, u = "INBOX") {
3656
- var w, B, G, O;
3656
+ var E, B, M, L;
3657
3657
  const n = (await this.imapExec(e, [
3658
3658
  `SELECT "${u}"`,
3659
3659
  `UID FETCH ${r} (FLAGS BODY[])`
3660
3660
  ])).responses.find((C) => C.command === "UID FETCH");
3661
- if (!(n != null && n.ok) || !((w = n.messages) != null && w[0]))
3661
+ if (!(n != null && n.ok) || !((E = n.messages) != null && E[0]))
3662
3662
  return console.error("Failed to fetch raw email:", n == null ? void 0 : n.error), null;
3663
3663
  const t = n.messages[0], i = t.body || t.raw;
3664
3664
  if (!i)
3665
3665
  return console.error("No raw email content in response"), null;
3666
- const d = await new Le().parse(i), c = /* @__PURE__ */ new Map();
3667
- for (const C of d.attachments || [])
3666
+ const c = await new Le().parse(i), d = /* @__PURE__ */ new Map();
3667
+ for (const C of c.attachments || [])
3668
3668
  if (C.contentId) {
3669
- const I = this.contentToBase64(C.content), b = `data:${C.mimeType};base64,${I}`, N = C.contentId.replace(/^<|>$/g, "");
3670
- c.set(N, b), c.set(`<${N}>`, b);
3669
+ const U = this.contentToBase64(C.content), g = `data:${C.mimeType};base64,${U}`, k = C.contentId.replace(/^<|>$/g, "");
3670
+ d.set(k, g), d.set(`<${k}>`, g);
3671
3671
  }
3672
- let h = d.html || "";
3673
- h && c.size > 0 && (h = h.replace(/src=["']cid:([^"']+)["']/gi, (C, I) => {
3674
- const b = c.get(I) || c.get(`<${I}>`);
3675
- return b ? `src="${b}"` : C;
3672
+ let p = c.html || "";
3673
+ p && d.size > 0 && (p = p.replace(/src=["']cid:([^"']+)["']/gi, (C, U) => {
3674
+ const g = d.get(U) || d.get(`<${U}>`);
3675
+ return g ? `src="${g}"` : C;
3676
3676
  }));
3677
- const m = ((B = t.flags) == null ? void 0 : B.some((C) => C.toLowerCase().includes("seen"))) || !1, A = ((G = d.from) == null ? void 0 : G.address) || ((O = d.from) == null ? void 0 : O.name) || "Unknown";
3677
+ const m = ((B = t.flags) == null ? void 0 : B.some((C) => C.toLowerCase().includes("seen"))) || !1, D = ((M = c.from) == null ? void 0 : M.address) || ((L = c.from) == null ? void 0 : L.name) || "Unknown";
3678
3678
  return {
3679
3679
  uid: r,
3680
- from: A,
3681
- subject: d.subject || "(No subject)",
3682
- date: d.date || "",
3683
- body: h || d.text || "",
3684
- html: h,
3685
- text: d.text || "",
3680
+ from: D,
3681
+ subject: c.subject || "(No subject)",
3682
+ date: c.date || "",
3683
+ body: p || c.text || "",
3684
+ html: p,
3685
+ text: c.text || "",
3686
3686
  seen: m,
3687
- attachments: (d.attachments || []).map((C) => ({
3687
+ attachments: (c.attachments || []).map((C) => ({
3688
3688
  filename: C.filename || "attachment",
3689
3689
  mimeType: C.mimeType || "application/octet-stream",
3690
3690
  size: this.getContentSize(C.content)
@@ -3703,8 +3703,8 @@ class cr {
3703
3703
  }
3704
3704
  const r = e instanceof Uint8Array ? e : new Uint8Array(e);
3705
3705
  let u = "";
3706
- for (let a = 0; a < r.byteLength; a++)
3707
- u += String.fromCharCode(r[a]);
3706
+ for (let s = 0; s < r.byteLength; s++)
3707
+ u += String.fromCharCode(r[s]);
3708
3708
  return btoa(u);
3709
3709
  }
3710
3710
  /**
@@ -3775,7 +3775,7 @@ class dr {
3775
3775
  }
3776
3776
  class fr {
3777
3777
  constructor(e) {
3778
- Ee(this, "config");
3778
+ ve(this, "config");
3779
3779
  this.config = {
3780
3780
  timeout: 3e4,
3781
3781
  headers: {
@@ -3791,8 +3791,8 @@ class fr {
3791
3791
  if (!e || Object.keys(e).length === 0)
3792
3792
  return "";
3793
3793
  const r = new URLSearchParams();
3794
- Object.entries(e).forEach(([a, n]) => {
3795
- n != null && r.append(a, String(n));
3794
+ Object.entries(e).forEach(([s, n]) => {
3795
+ n != null && r.append(s, String(n));
3796
3796
  });
3797
3797
  const u = r.toString();
3798
3798
  return u ? `?${u}` : "";
@@ -3803,32 +3803,32 @@ class fr {
3803
3803
  async request(e, r = {}) {
3804
3804
  const {
3805
3805
  method: u = "GET",
3806
- headers: a = {},
3806
+ headers: s = {},
3807
3807
  body: n,
3808
3808
  params: t
3809
3809
  } = r, i = `${this.config.baseUrl}/${e}${this.buildQueryString(t)}`, l = {
3810
3810
  ...this.config.headers,
3811
3811
  ...dr.getAuthHeader(),
3812
- ...a
3813
- }, d = {
3812
+ ...s
3813
+ }, c = {
3814
3814
  method: u,
3815
3815
  headers: l
3816
3816
  };
3817
- n && u !== "GET" && (d.body = JSON.stringify(n));
3817
+ n && u !== "GET" && (c.body = JSON.stringify(n));
3818
3818
  try {
3819
- const c = new AbortController(), h = setTimeout(() => c.abort(), this.config.timeout), m = await fetch(i, {
3820
- ...d,
3821
- signal: c.signal
3819
+ const d = new AbortController(), p = setTimeout(() => d.abort(), this.config.timeout), m = await fetch(i, {
3820
+ ...c,
3821
+ signal: d.signal
3822
3822
  });
3823
- if (clearTimeout(h), !m.ok) {
3824
- const A = await m.json().catch(() => ({
3823
+ if (clearTimeout(p), !m.ok) {
3824
+ const D = await m.json().catch(() => ({
3825
3825
  message: m.statusText
3826
3826
  }));
3827
- throw new Error(A.message || `HTTP ${m.status}`);
3827
+ throw new Error(D.message || `HTTP ${m.status}`);
3828
3828
  }
3829
3829
  return await m.json();
3830
- } catch (c) {
3831
- throw c instanceof Error ? c : new Error("An unexpected error occurred");
3830
+ } catch (d) {
3831
+ throw d instanceof Error ? d : new Error("An unexpected error occurred");
3832
3832
  }
3833
3833
  }
3834
3834
  /**
@@ -3874,88 +3874,88 @@ class fr {
3874
3874
  return this.config.baseUrl;
3875
3875
  }
3876
3876
  }
3877
- let Oe = null;
3878
- function vr(o) {
3879
- return Oe = new fr(o), Oe;
3877
+ let Pe = null;
3878
+ function xr(o) {
3879
+ return Pe = new fr(o), Pe;
3880
3880
  }
3881
3881
  function Ct() {
3882
- if (!Oe)
3882
+ if (!Pe)
3883
3883
  throw new Error("API client not initialized. Call initializeApiClient() first.");
3884
- return Oe;
3884
+ return Pe;
3885
3885
  }
3886
3886
  function pr(o, e, r = {}) {
3887
3887
  const {
3888
3888
  enabled: u = !0,
3889
- refetchOnMount: a = !0,
3889
+ refetchOnMount: s = !0,
3890
3890
  onSuccess: n,
3891
3891
  onError: t
3892
- } = r, [i, l] = U(null), [d, c] = U(u), [h, m] = U(null), A = Y(async () => {
3892
+ } = r, [i, l] = O(null), [c, d] = O(u), [p, m] = O(null), D = H(async () => {
3893
3893
  if (u) {
3894
- c(!0), m(null);
3894
+ d(!0), m(null);
3895
3895
  try {
3896
3896
  const B = await Ct().get(o, e);
3897
3897
  l(B), n == null || n(B);
3898
- } catch (w) {
3899
- const B = w instanceof Error ? w : new Error("Unknown error");
3898
+ } catch (E) {
3899
+ const B = E instanceof Error ? E : new Error("Unknown error");
3900
3900
  m(B), t == null || t(B);
3901
3901
  } finally {
3902
- c(!1);
3902
+ d(!1);
3903
3903
  }
3904
3904
  }
3905
3905
  }, [o, JSON.stringify(e), u, n, t]);
3906
3906
  return pe(() => {
3907
- a && A();
3908
- }, [A, a]), {
3907
+ s && D();
3908
+ }, [D, s]), {
3909
3909
  data: i,
3910
- loading: d,
3911
- error: h,
3912
- refetch: A
3910
+ loading: c,
3911
+ error: p,
3912
+ refetch: D
3913
3913
  };
3914
3914
  }
3915
- function Er(o, e = "POST", r = {}) {
3916
- const { onSuccess: u, onError: a } = r, [n, t] = U(null), [i, l] = U(!1), [d, c] = U(null), h = Y(
3917
- async (A) => {
3918
- l(!0), c(null);
3915
+ function vr(o, e = "POST", r = {}) {
3916
+ const { onSuccess: u, onError: s } = r, [n, t] = O(null), [i, l] = O(!1), [c, d] = O(null), p = H(
3917
+ async (D) => {
3918
+ l(!0), d(null);
3919
3919
  try {
3920
- const w = Ct();
3920
+ const E = Ct();
3921
3921
  let B;
3922
3922
  switch (e) {
3923
3923
  case "POST":
3924
- B = await w.post(o, A);
3924
+ B = await E.post(o, D);
3925
3925
  break;
3926
3926
  case "PUT":
3927
- B = await w.put(o, A);
3927
+ B = await E.put(o, D);
3928
3928
  break;
3929
3929
  case "PATCH":
3930
- B = await w.patch(o, A);
3930
+ B = await E.patch(o, D);
3931
3931
  break;
3932
3932
  case "DELETE":
3933
- B = await w.delete(o);
3933
+ B = await E.delete(o);
3934
3934
  break;
3935
3935
  default:
3936
3936
  throw new Error(`Unsupported method: ${e}`);
3937
3937
  }
3938
- return t(B), u == null || u(B, A), B;
3939
- } catch (w) {
3940
- const B = w instanceof Error ? w : new Error("Unknown error");
3941
- return c(B), a == null || a(B, A), null;
3938
+ return t(B), u == null || u(B, D), B;
3939
+ } catch (E) {
3940
+ const B = E instanceof Error ? E : new Error("Unknown error");
3941
+ return d(B), s == null || s(B, D), null;
3942
3942
  } finally {
3943
3943
  l(!1);
3944
3944
  }
3945
3945
  },
3946
- [o, e, u, a]
3947
- ), m = Y(() => {
3948
- t(null), c(null), l(!1);
3946
+ [o, e, u, s]
3947
+ ), m = H(() => {
3948
+ t(null), d(null), l(!1);
3949
3949
  }, []);
3950
3950
  return {
3951
3951
  data: n,
3952
3952
  loading: i,
3953
- error: d,
3954
- mutate: h,
3953
+ error: c,
3954
+ mutate: p,
3955
3955
  reset: m
3956
3956
  };
3957
3957
  }
3958
- var ut = { exports: {} }, xe = {};
3958
+ var ut = { exports: {} }, Ee = {};
3959
3959
  /**
3960
3960
  * @license React
3961
3961
  * react-jsx-runtime.production.min.js
@@ -3965,19 +3965,19 @@ var ut = { exports: {} }, xe = {};
3965
3965
  * This source code is licensed under the MIT license found in the
3966
3966
  * LICENSE file in the root directory of this source tree.
3967
3967
  */
3968
- var bt;
3968
+ var yt;
3969
3969
  function hr() {
3970
- if (bt) return xe;
3971
- bt = 1;
3972
- var o = vt, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, a = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = { key: !0, ref: !0, __self: !0, __source: !0 };
3973
- function t(i, l, d) {
3974
- var c, h = {}, m = null, A = null;
3975
- d !== void 0 && (m = "" + d), l.key !== void 0 && (m = "" + l.key), l.ref !== void 0 && (A = l.ref);
3976
- for (c in l) u.call(l, c) && !n.hasOwnProperty(c) && (h[c] = l[c]);
3977
- if (i && i.defaultProps) for (c in l = i.defaultProps, l) h[c] === void 0 && (h[c] = l[c]);
3978
- return { $$typeof: e, type: i, key: m, ref: A, props: h, _owner: a.current };
3970
+ if (yt) return Ee;
3971
+ yt = 1;
3972
+ var o = st, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, s = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = { key: !0, ref: !0, __self: !0, __source: !0 };
3973
+ function t(i, l, c) {
3974
+ var d, p = {}, m = null, D = null;
3975
+ c !== void 0 && (m = "" + c), l.key !== void 0 && (m = "" + l.key), l.ref !== void 0 && (D = l.ref);
3976
+ for (d in l) u.call(l, d) && !n.hasOwnProperty(d) && (p[d] = l[d]);
3977
+ if (i && i.defaultProps) for (d in l = i.defaultProps, l) p[d] === void 0 && (p[d] = l[d]);
3978
+ return { $$typeof: e, type: i, key: m, ref: D, props: p, _owner: s.current };
3979
3979
  }
3980
- return xe.Fragment = r, xe.jsx = t, xe.jsxs = t, xe;
3980
+ return Ee.Fragment = r, Ee.jsx = t, Ee.jsxs = t, Ee;
3981
3981
  }
3982
3982
  var we = {};
3983
3983
  /**
@@ -3989,91 +3989,91 @@ var we = {};
3989
3989
  * This source code is licensed under the MIT license found in the
3990
3990
  * LICENSE file in the root directory of this source tree.
3991
3991
  */
3992
- var yt;
3992
+ var xt;
3993
3993
  function gr() {
3994
- return yt || (yt = 1, process.env.NODE_ENV !== "production" && function() {
3995
- var o = vt, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), n = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), i = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), w = Symbol.iterator, B = "@@iterator";
3996
- function G(s) {
3997
- if (s === null || typeof s != "object")
3994
+ return xt || (xt = 1, process.env.NODE_ENV !== "production" && function() {
3995
+ var o = st, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), n = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), i = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), D = Symbol.for("react.offscreen"), E = Symbol.iterator, B = "@@iterator";
3996
+ function M(a) {
3997
+ if (a === null || typeof a != "object")
3998
3998
  return null;
3999
- var p = w && s[w] || s[B];
4000
- return typeof p == "function" ? p : null;
3999
+ var h = E && a[E] || a[B];
4000
+ return typeof h == "function" ? h : null;
4001
4001
  }
4002
- var O = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
4003
- function C(s) {
4002
+ var L = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
4003
+ function C(a) {
4004
4004
  {
4005
- for (var p = arguments.length, g = new Array(p > 1 ? p - 1 : 0), E = 1; E < p; E++)
4006
- g[E - 1] = arguments[E];
4007
- I("error", s, g);
4005
+ for (var h = arguments.length, A = new Array(h > 1 ? h - 1 : 0), v = 1; v < h; v++)
4006
+ A[v - 1] = arguments[v];
4007
+ U("error", a, A);
4008
4008
  }
4009
4009
  }
4010
- function I(s, p, g) {
4010
+ function U(a, h, A) {
4011
4011
  {
4012
- var E = O.ReactDebugCurrentFrame, j = E.getStackAddendum();
4013
- j !== "" && (p += "%s", g = g.concat([j]));
4014
- var _ = g.map(function(S) {
4015
- return String(S);
4012
+ var v = L.ReactDebugCurrentFrame, _ = v.getStackAddendum();
4013
+ _ !== "" && (h += "%s", A = A.concat([_]));
4014
+ var R = A.map(function(j) {
4015
+ return String(j);
4016
4016
  });
4017
- _.unshift("Warning: " + p), Function.prototype.apply.call(console[s], console, _);
4017
+ R.unshift("Warning: " + h), Function.prototype.apply.call(console[a], console, R);
4018
4018
  }
4019
4019
  }
4020
- var b = !1, N = !1, y = !1, q = !1, L = !1, k;
4021
- k = Symbol.for("react.module.reference");
4022
- function R(s) {
4023
- return !!(typeof s == "string" || typeof s == "function" || s === u || s === n || L || s === a || s === d || s === c || q || s === A || b || N || y || typeof s == "object" && s !== null && (s.$$typeof === m || s.$$typeof === h || s.$$typeof === t || s.$$typeof === i || s.$$typeof === l || // This needs to include all possible module reference object
4020
+ var g = !1, k = !1, y = !1, q = !1, P = !1, F;
4021
+ F = Symbol.for("react.module.reference");
4022
+ function N(a) {
4023
+ return !!(typeof a == "string" || typeof a == "function" || a === u || a === n || P || a === s || a === c || a === d || q || a === D || g || k || y || typeof a == "object" && a !== null && (a.$$typeof === m || a.$$typeof === p || a.$$typeof === t || a.$$typeof === i || a.$$typeof === l || // This needs to include all possible module reference object
4024
4024
  // types supported by any Flight configuration anywhere since
4025
4025
  // we don't know which Flight build this will end up being used
4026
4026
  // with.
4027
- s.$$typeof === k || s.getModuleId !== void 0));
4027
+ a.$$typeof === F || a.getModuleId !== void 0));
4028
4028
  }
4029
- function v(s, p, g) {
4030
- var E = s.displayName;
4031
- if (E)
4032
- return E;
4033
- var j = p.displayName || p.name || "";
4034
- return j !== "" ? g + "(" + j + ")" : g;
4029
+ function x(a, h, A) {
4030
+ var v = a.displayName;
4031
+ if (v)
4032
+ return v;
4033
+ var _ = h.displayName || h.name || "";
4034
+ return _ !== "" ? A + "(" + _ + ")" : A;
4035
4035
  }
4036
- function H(s) {
4037
- return s.displayName || "Context";
4036
+ function V(a) {
4037
+ return a.displayName || "Context";
4038
4038
  }
4039
- function M(s) {
4040
- if (s == null)
4039
+ function z(a) {
4040
+ if (a == null)
4041
4041
  return null;
4042
- if (typeof s.tag == "number" && C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof s == "function")
4043
- return s.displayName || s.name || null;
4044
- if (typeof s == "string")
4045
- return s;
4046
- switch (s) {
4042
+ if (typeof a.tag == "number" && C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof a == "function")
4043
+ return a.displayName || a.name || null;
4044
+ if (typeof a == "string")
4045
+ return a;
4046
+ switch (a) {
4047
4047
  case u:
4048
4048
  return "Fragment";
4049
4049
  case r:
4050
4050
  return "Portal";
4051
4051
  case n:
4052
4052
  return "Profiler";
4053
- case a:
4053
+ case s:
4054
4054
  return "StrictMode";
4055
- case d:
4056
- return "Suspense";
4057
4055
  case c:
4056
+ return "Suspense";
4057
+ case d:
4058
4058
  return "SuspenseList";
4059
4059
  }
4060
- if (typeof s == "object")
4061
- switch (s.$$typeof) {
4060
+ if (typeof a == "object")
4061
+ switch (a.$$typeof) {
4062
4062
  case i:
4063
- var p = s;
4064
- return H(p) + ".Consumer";
4063
+ var h = a;
4064
+ return V(h) + ".Consumer";
4065
4065
  case t:
4066
- var g = s;
4067
- return H(g._context) + ".Provider";
4066
+ var A = a;
4067
+ return V(A._context) + ".Provider";
4068
4068
  case l:
4069
- return v(s, s.render, "ForwardRef");
4070
- case h:
4071
- var E = s.displayName || null;
4072
- return E !== null ? E : M(s.type) || "Memo";
4069
+ return x(a, a.render, "ForwardRef");
4070
+ case p:
4071
+ var v = a.displayName || null;
4072
+ return v !== null ? v : z(a.type) || "Memo";
4073
4073
  case m: {
4074
- var j = s, _ = j._payload, S = j._init;
4074
+ var _ = a, R = _._payload, j = _._init;
4075
4075
  try {
4076
- return M(S(_));
4076
+ return z(j(R));
4077
4077
  } catch {
4078
4078
  return null;
4079
4079
  }
@@ -4081,80 +4081,80 @@ function gr() {
4081
4081
  }
4082
4082
  return null;
4083
4083
  }
4084
- var T = Object.assign, z = 0, K, ge, me, Te, De, V, re;
4084
+ var S = Object.assign, G = 0, K, ge, me, Te, De, W, re;
4085
4085
  function ne() {
4086
4086
  }
4087
4087
  ne.__reactDisabledLog = !0;
4088
4088
  function Ue() {
4089
4089
  {
4090
- if (z === 0) {
4091
- K = console.log, ge = console.info, me = console.warn, Te = console.error, De = console.group, V = console.groupCollapsed, re = console.groupEnd;
4092
- var s = {
4090
+ if (G === 0) {
4091
+ K = console.log, ge = console.info, me = console.warn, Te = console.error, De = console.group, W = console.groupCollapsed, re = console.groupEnd;
4092
+ var a = {
4093
4093
  configurable: !0,
4094
4094
  enumerable: !0,
4095
4095
  value: ne,
4096
4096
  writable: !0
4097
4097
  };
4098
4098
  Object.defineProperties(console, {
4099
- info: s,
4100
- log: s,
4101
- warn: s,
4102
- error: s,
4103
- group: s,
4104
- groupCollapsed: s,
4105
- groupEnd: s
4099
+ info: a,
4100
+ log: a,
4101
+ warn: a,
4102
+ error: a,
4103
+ group: a,
4104
+ groupCollapsed: a,
4105
+ groupEnd: a
4106
4106
  });
4107
4107
  }
4108
- z++;
4108
+ G++;
4109
4109
  }
4110
4110
  }
4111
4111
  function Ie() {
4112
4112
  {
4113
- if (z--, z === 0) {
4114
- var s = {
4113
+ if (G--, G === 0) {
4114
+ var a = {
4115
4115
  configurable: !0,
4116
4116
  enumerable: !0,
4117
4117
  writable: !0
4118
4118
  };
4119
4119
  Object.defineProperties(console, {
4120
- log: T({}, s, {
4120
+ log: S({}, a, {
4121
4121
  value: K
4122
4122
  }),
4123
- info: T({}, s, {
4123
+ info: S({}, a, {
4124
4124
  value: ge
4125
4125
  }),
4126
- warn: T({}, s, {
4126
+ warn: S({}, a, {
4127
4127
  value: me
4128
4128
  }),
4129
- error: T({}, s, {
4129
+ error: S({}, a, {
4130
4130
  value: Te
4131
4131
  }),
4132
- group: T({}, s, {
4132
+ group: S({}, a, {
4133
4133
  value: De
4134
4134
  }),
4135
- groupCollapsed: T({}, s, {
4136
- value: V
4135
+ groupCollapsed: S({}, a, {
4136
+ value: W
4137
4137
  }),
4138
- groupEnd: T({}, s, {
4138
+ groupEnd: S({}, a, {
4139
4139
  value: re
4140
4140
  })
4141
4141
  });
4142
4142
  }
4143
- z < 0 && C("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
4143
+ G < 0 && C("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
4144
4144
  }
4145
4145
  }
4146
- var Ae = O.ReactCurrentDispatcher, be;
4147
- function ie(s, p, g) {
4146
+ var Ae = L.ReactCurrentDispatcher, be;
4147
+ function ie(a, h, A) {
4148
4148
  {
4149
4149
  if (be === void 0)
4150
4150
  try {
4151
4151
  throw Error();
4152
- } catch (j) {
4153
- var E = j.stack.trim().match(/\n( *(at )?)/);
4154
- be = E && E[1] || "";
4152
+ } catch (_) {
4153
+ var v = _.stack.trim().match(/\n( *(at )?)/);
4154
+ be = v && v[1] || "";
4155
4155
  }
4156
4156
  return `
4157
- ` + be + s;
4157
+ ` + be + a;
4158
4158
  }
4159
4159
  }
4160
4160
  var ye = !1, oe;
@@ -4162,420 +4162,420 @@ function gr() {
4162
4162
  var $e = typeof WeakMap == "function" ? WeakMap : Map;
4163
4163
  oe = new $e();
4164
4164
  }
4165
- function Se(s, p) {
4166
- if (!s || ye)
4165
+ function Se(a, h) {
4166
+ if (!a || ye)
4167
4167
  return "";
4168
4168
  {
4169
- var g = oe.get(s);
4170
- if (g !== void 0)
4171
- return g;
4169
+ var A = oe.get(a);
4170
+ if (A !== void 0)
4171
+ return A;
4172
4172
  }
4173
- var E;
4173
+ var v;
4174
4174
  ye = !0;
4175
- var j = Error.prepareStackTrace;
4175
+ var _ = Error.prepareStackTrace;
4176
4176
  Error.prepareStackTrace = void 0;
4177
- var _;
4178
- _ = Ae.current, Ae.current = null, Ue();
4177
+ var R;
4178
+ R = Ae.current, Ae.current = null, Ue();
4179
4179
  try {
4180
- if (p) {
4181
- var S = function() {
4180
+ if (h) {
4181
+ var j = function() {
4182
4182
  throw Error();
4183
4183
  };
4184
- if (Object.defineProperty(S.prototype, "props", {
4184
+ if (Object.defineProperty(j.prototype, "props", {
4185
4185
  set: function() {
4186
4186
  throw Error();
4187
4187
  }
4188
4188
  }), typeof Reflect == "object" && Reflect.construct) {
4189
4189
  try {
4190
- Reflect.construct(S, []);
4191
- } catch (Q) {
4192
- E = Q;
4190
+ Reflect.construct(j, []);
4191
+ } catch (Y) {
4192
+ v = Y;
4193
4193
  }
4194
- Reflect.construct(s, [], S);
4194
+ Reflect.construct(a, [], j);
4195
4195
  } else {
4196
4196
  try {
4197
- S.call();
4198
- } catch (Q) {
4199
- E = Q;
4197
+ j.call();
4198
+ } catch (Y) {
4199
+ v = Y;
4200
4200
  }
4201
- s.call(S.prototype);
4201
+ a.call(j.prototype);
4202
4202
  }
4203
4203
  } else {
4204
4204
  try {
4205
4205
  throw Error();
4206
- } catch (Q) {
4207
- E = Q;
4206
+ } catch (Y) {
4207
+ v = Y;
4208
4208
  }
4209
- s();
4209
+ a();
4210
4210
  }
4211
- } catch (Q) {
4212
- if (Q && E && typeof Q.stack == "string") {
4213
- for (var F = Q.stack.split(`
4214
- `), W = E.stack.split(`
4215
- `), P = F.length - 1, $ = W.length - 1; P >= 1 && $ >= 0 && F[P] !== W[$]; )
4211
+ } catch (Y) {
4212
+ if (Y && v && typeof Y.stack == "string") {
4213
+ for (var T = Y.stack.split(`
4214
+ `), Q = v.stack.split(`
4215
+ `), I = T.length - 1, $ = Q.length - 1; I >= 1 && $ >= 0 && T[I] !== Q[$]; )
4216
4216
  $--;
4217
- for (; P >= 1 && $ >= 0; P--, $--)
4218
- if (F[P] !== W[$]) {
4219
- if (P !== 1 || $ !== 1)
4217
+ for (; I >= 1 && $ >= 0; I--, $--)
4218
+ if (T[I] !== Q[$]) {
4219
+ if (I !== 1 || $ !== 1)
4220
4220
  do
4221
- if (P--, $--, $ < 0 || F[P] !== W[$]) {
4221
+ if (I--, $--, $ < 0 || T[I] !== Q[$]) {
4222
4222
  var Z = `
4223
- ` + F[P].replace(" at new ", " at ");
4224
- return s.displayName && Z.includes("<anonymous>") && (Z = Z.replace("<anonymous>", s.displayName)), typeof s == "function" && oe.set(s, Z), Z;
4223
+ ` + T[I].replace(" at new ", " at ");
4224
+ return a.displayName && Z.includes("<anonymous>") && (Z = Z.replace("<anonymous>", a.displayName)), typeof a == "function" && oe.set(a, Z), Z;
4225
4225
  }
4226
- while (P >= 1 && $ >= 0);
4226
+ while (I >= 1 && $ >= 0);
4227
4227
  break;
4228
4228
  }
4229
4229
  }
4230
4230
  } finally {
4231
- ye = !1, Ae.current = _, Ie(), Error.prepareStackTrace = j;
4231
+ ye = !1, Ae.current = R, Ie(), Error.prepareStackTrace = _;
4232
4232
  }
4233
- var fe = s ? s.displayName || s.name : "", ae = fe ? ie(fe) : "";
4234
- return typeof s == "function" && oe.set(s, ae), ae;
4233
+ var fe = a ? a.displayName || a.name : "", se = fe ? ie(fe) : "";
4234
+ return typeof a == "function" && oe.set(a, se), se;
4235
4235
  }
4236
- function Me(s, p, g) {
4237
- return Se(s, !1);
4236
+ function Me(a, h, A) {
4237
+ return Se(a, !1);
4238
4238
  }
4239
- function ze(s) {
4240
- var p = s.prototype;
4241
- return !!(p && p.isReactComponent);
4239
+ function ze(a) {
4240
+ var h = a.prototype;
4241
+ return !!(h && h.isReactComponent);
4242
4242
  }
4243
- function le(s, p, g) {
4244
- if (s == null)
4243
+ function le(a, h, A) {
4244
+ if (a == null)
4245
4245
  return "";
4246
- if (typeof s == "function")
4247
- return Se(s, ze(s));
4248
- if (typeof s == "string")
4249
- return ie(s);
4250
- switch (s) {
4251
- case d:
4252
- return ie("Suspense");
4246
+ if (typeof a == "function")
4247
+ return Se(a, ze(a));
4248
+ if (typeof a == "string")
4249
+ return ie(a);
4250
+ switch (a) {
4253
4251
  case c:
4252
+ return ie("Suspense");
4253
+ case d:
4254
4254
  return ie("SuspenseList");
4255
4255
  }
4256
- if (typeof s == "object")
4257
- switch (s.$$typeof) {
4256
+ if (typeof a == "object")
4257
+ switch (a.$$typeof) {
4258
4258
  case l:
4259
- return Me(s.render);
4260
- case h:
4261
- return le(s.type, p, g);
4259
+ return Me(a.render);
4260
+ case p:
4261
+ return le(a.type, h, A);
4262
4262
  case m: {
4263
- var E = s, j = E._payload, _ = E._init;
4263
+ var v = a, _ = v._payload, R = v._init;
4264
4264
  try {
4265
- return le(_(j), p, g);
4265
+ return le(R(_), h, A);
4266
4266
  } catch {
4267
4267
  }
4268
4268
  }
4269
4269
  }
4270
4270
  return "";
4271
4271
  }
4272
- var ue = Object.prototype.hasOwnProperty, qe = {}, Re = O.ReactDebugCurrentFrame;
4273
- function ce(s) {
4274
- if (s) {
4275
- var p = s._owner, g = le(s.type, s._source, p ? p.type : null);
4276
- Re.setExtraStackFrame(g);
4272
+ var ue = Object.prototype.hasOwnProperty, je = {}, qe = L.ReactDebugCurrentFrame;
4273
+ function ce(a) {
4274
+ if (a) {
4275
+ var h = a._owner, A = le(a.type, a._source, h ? h.type : null);
4276
+ qe.setExtraStackFrame(A);
4277
4277
  } else
4278
- Re.setExtraStackFrame(null);
4278
+ qe.setExtraStackFrame(null);
4279
4279
  }
4280
- function Ge(s, p, g, E, j) {
4280
+ function Ge(a, h, A, v, _) {
4281
4281
  {
4282
- var _ = Function.call.bind(ue);
4283
- for (var S in s)
4284
- if (_(s, S)) {
4285
- var F = void 0;
4282
+ var R = Function.call.bind(ue);
4283
+ for (var j in a)
4284
+ if (R(a, j)) {
4285
+ var T = void 0;
4286
4286
  try {
4287
- if (typeof s[S] != "function") {
4288
- var W = Error((E || "React class") + ": " + g + " type `" + S + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof s[S] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
4289
- throw W.name = "Invariant Violation", W;
4287
+ if (typeof a[j] != "function") {
4288
+ var Q = Error((v || "React class") + ": " + A + " type `" + j + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[j] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
4289
+ throw Q.name = "Invariant Violation", Q;
4290
4290
  }
4291
- F = s[S](p, S, E, g, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
4292
- } catch (P) {
4293
- F = P;
4291
+ T = a[j](h, j, v, A, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
4292
+ } catch (I) {
4293
+ T = I;
4294
4294
  }
4295
- F && !(F instanceof Error) && (ce(j), C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", E || "React class", g, S, typeof F), ce(null)), F instanceof Error && !(F.message in qe) && (qe[F.message] = !0, ce(j), C("Failed %s type: %s", g, F.message), ce(null));
4295
+ T && !(T instanceof Error) && (ce(_), C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", v || "React class", A, j, typeof T), ce(null)), T instanceof Error && !(T.message in je) && (je[T.message] = !0, ce(_), C("Failed %s type: %s", A, T.message), ce(null));
4296
4296
  }
4297
4297
  }
4298
4298
  }
4299
4299
  var He = Array.isArray;
4300
- function D(s) {
4301
- return He(s);
4300
+ function b(a) {
4301
+ return He(a);
4302
4302
  }
4303
- function x(s) {
4303
+ function w(a) {
4304
4304
  {
4305
- var p = typeof Symbol == "function" && Symbol.toStringTag, g = p && s[Symbol.toStringTag] || s.constructor.name || "Object";
4306
- return g;
4305
+ var h = typeof Symbol == "function" && Symbol.toStringTag, A = h && a[Symbol.toStringTag] || a.constructor.name || "Object";
4306
+ return A;
4307
4307
  }
4308
4308
  }
4309
- function J(s) {
4309
+ function J(a) {
4310
4310
  try {
4311
- return X(s), !1;
4311
+ return X(a), !1;
4312
4312
  } catch {
4313
4313
  return !0;
4314
4314
  }
4315
4315
  }
4316
- function X(s) {
4317
- return "" + s;
4316
+ function X(a) {
4317
+ return "" + a;
4318
4318
  }
4319
- function te(s) {
4320
- if (J(s))
4321
- return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", x(s)), X(s);
4319
+ function te(a) {
4320
+ if (J(a))
4321
+ return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", w(a)), X(a);
4322
4322
  }
4323
- var ee = O.ReactCurrentOwner, Ve = {
4323
+ var ee = L.ReactCurrentOwner, Ve = {
4324
4324
  key: !0,
4325
4325
  ref: !0,
4326
4326
  __self: !0,
4327
4327
  __source: !0
4328
- }, ve, je;
4329
- function Bt(s) {
4330
- if (ue.call(s, "ref")) {
4331
- var p = Object.getOwnPropertyDescriptor(s, "ref").get;
4332
- if (p && p.isReactWarning)
4328
+ }, xe, Ne;
4329
+ function Bt(a) {
4330
+ if (ue.call(a, "ref")) {
4331
+ var h = Object.getOwnPropertyDescriptor(a, "ref").get;
4332
+ if (h && h.isReactWarning)
4333
4333
  return !1;
4334
4334
  }
4335
- return s.ref !== void 0;
4335
+ return a.ref !== void 0;
4336
4336
  }
4337
- function kt(s) {
4338
- if (ue.call(s, "key")) {
4339
- var p = Object.getOwnPropertyDescriptor(s, "key").get;
4340
- if (p && p.isReactWarning)
4337
+ function kt(a) {
4338
+ if (ue.call(a, "key")) {
4339
+ var h = Object.getOwnPropertyDescriptor(a, "key").get;
4340
+ if (h && h.isReactWarning)
4341
4341
  return !1;
4342
4342
  }
4343
- return s.key !== void 0;
4343
+ return a.key !== void 0;
4344
4344
  }
4345
- function Ft(s, p) {
4346
- typeof s.ref == "string" && ee.current;
4345
+ function Ft(a, h) {
4346
+ typeof a.ref == "string" && ee.current;
4347
4347
  }
4348
- function Tt(s, p) {
4348
+ function Tt(a, h) {
4349
4349
  {
4350
- var g = function() {
4351
- ve || (ve = !0, C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
4350
+ var A = function() {
4351
+ xe || (xe = !0, C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
4352
4352
  };
4353
- g.isReactWarning = !0, Object.defineProperty(s, "key", {
4354
- get: g,
4353
+ A.isReactWarning = !0, Object.defineProperty(a, "key", {
4354
+ get: A,
4355
4355
  configurable: !0
4356
4356
  });
4357
4357
  }
4358
4358
  }
4359
- function St(s, p) {
4359
+ function St(a, h) {
4360
4360
  {
4361
- var g = function() {
4362
- je || (je = !0, C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
4361
+ var A = function() {
4362
+ Ne || (Ne = !0, C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
4363
4363
  };
4364
- g.isReactWarning = !0, Object.defineProperty(s, "ref", {
4365
- get: g,
4364
+ A.isReactWarning = !0, Object.defineProperty(a, "ref", {
4365
+ get: A,
4366
4366
  configurable: !0
4367
4367
  });
4368
4368
  }
4369
4369
  }
4370
- var qt = function(s, p, g, E, j, _, S) {
4371
- var F = {
4370
+ var jt = function(a, h, A, v, _, R, j) {
4371
+ var T = {
4372
4372
  // This tag allows us to uniquely identify this as a React Element
4373
4373
  $$typeof: e,
4374
4374
  // Built-in properties that belong on the element
4375
- type: s,
4376
- key: p,
4377
- ref: g,
4378
- props: S,
4375
+ type: a,
4376
+ key: h,
4377
+ ref: A,
4378
+ props: j,
4379
4379
  // Record the component responsible for creating this element.
4380
- _owner: _
4380
+ _owner: R
4381
4381
  };
4382
- return F._store = {}, Object.defineProperty(F._store, "validated", {
4382
+ return T._store = {}, Object.defineProperty(T._store, "validated", {
4383
4383
  configurable: !1,
4384
4384
  enumerable: !1,
4385
4385
  writable: !0,
4386
4386
  value: !1
4387
- }), Object.defineProperty(F, "_self", {
4387
+ }), Object.defineProperty(T, "_self", {
4388
4388
  configurable: !1,
4389
4389
  enumerable: !1,
4390
4390
  writable: !1,
4391
- value: E
4392
- }), Object.defineProperty(F, "_source", {
4391
+ value: v
4392
+ }), Object.defineProperty(T, "_source", {
4393
4393
  configurable: !1,
4394
4394
  enumerable: !1,
4395
4395
  writable: !1,
4396
- value: j
4397
- }), Object.freeze && (Object.freeze(F.props), Object.freeze(F)), F;
4396
+ value: _
4397
+ }), Object.freeze && (Object.freeze(T.props), Object.freeze(T)), T;
4398
4398
  };
4399
- function Rt(s, p, g, E, j) {
4399
+ function qt(a, h, A, v, _) {
4400
4400
  {
4401
- var _, S = {}, F = null, W = null;
4402
- g !== void 0 && (te(g), F = "" + g), kt(p) && (te(p.key), F = "" + p.key), Bt(p) && (W = p.ref, Ft(p, j));
4403
- for (_ in p)
4404
- ue.call(p, _) && !Ve.hasOwnProperty(_) && (S[_] = p[_]);
4405
- if (s && s.defaultProps) {
4406
- var P = s.defaultProps;
4407
- for (_ in P)
4408
- S[_] === void 0 && (S[_] = P[_]);
4401
+ var R, j = {}, T = null, Q = null;
4402
+ A !== void 0 && (te(A), T = "" + A), kt(h) && (te(h.key), T = "" + h.key), Bt(h) && (Q = h.ref, Ft(h, _));
4403
+ for (R in h)
4404
+ ue.call(h, R) && !Ve.hasOwnProperty(R) && (j[R] = h[R]);
4405
+ if (a && a.defaultProps) {
4406
+ var I = a.defaultProps;
4407
+ for (R in I)
4408
+ j[R] === void 0 && (j[R] = I[R]);
4409
4409
  }
4410
- if (F || W) {
4411
- var $ = typeof s == "function" ? s.displayName || s.name || "Unknown" : s;
4412
- F && Tt(S, $), W && St(S, $);
4410
+ if (T || Q) {
4411
+ var $ = typeof a == "function" ? a.displayName || a.name || "Unknown" : a;
4412
+ T && Tt(j, $), Q && St(j, $);
4413
4413
  }
4414
- return qt(s, F, W, j, E, ee.current, S);
4414
+ return jt(a, T, Q, _, v, ee.current, j);
4415
4415
  }
4416
4416
  }
4417
- var We = O.ReactCurrentOwner, at = O.ReactDebugCurrentFrame;
4418
- function de(s) {
4419
- if (s) {
4420
- var p = s._owner, g = le(s.type, s._source, p ? p.type : null);
4421
- at.setExtraStackFrame(g);
4417
+ var We = L.ReactCurrentOwner, at = L.ReactDebugCurrentFrame;
4418
+ function de(a) {
4419
+ if (a) {
4420
+ var h = a._owner, A = le(a.type, a._source, h ? h.type : null);
4421
+ at.setExtraStackFrame(A);
4422
4422
  } else
4423
4423
  at.setExtraStackFrame(null);
4424
4424
  }
4425
4425
  var Qe;
4426
4426
  Qe = !1;
4427
- function Ye(s) {
4428
- return typeof s == "object" && s !== null && s.$$typeof === e;
4427
+ function Ye(a) {
4428
+ return typeof a == "object" && a !== null && a.$$typeof === e;
4429
4429
  }
4430
- function st() {
4430
+ function nt() {
4431
4431
  {
4432
4432
  if (We.current) {
4433
- var s = M(We.current.type);
4434
- if (s)
4433
+ var a = z(We.current.type);
4434
+ if (a)
4435
4435
  return `
4436
4436
 
4437
- Check the render method of \`` + s + "`.";
4437
+ Check the render method of \`` + a + "`.";
4438
4438
  }
4439
4439
  return "";
4440
4440
  }
4441
4441
  }
4442
- function jt(s) {
4442
+ function Nt(a) {
4443
4443
  return "";
4444
4444
  }
4445
- var nt = {};
4446
- function _t(s) {
4445
+ var it = {};
4446
+ function _t(a) {
4447
4447
  {
4448
- var p = st();
4449
- if (!p) {
4450
- var g = typeof s == "string" ? s : s.displayName || s.name;
4451
- g && (p = `
4448
+ var h = nt();
4449
+ if (!h) {
4450
+ var A = typeof a == "string" ? a : a.displayName || a.name;
4451
+ A && (h = `
4452
4452
 
4453
- Check the top-level render call using <` + g + ">.");
4453
+ Check the top-level render call using <` + A + ">.");
4454
4454
  }
4455
- return p;
4455
+ return h;
4456
4456
  }
4457
4457
  }
4458
- function it(s, p) {
4458
+ function ot(a, h) {
4459
4459
  {
4460
- if (!s._store || s._store.validated || s.key != null)
4460
+ if (!a._store || a._store.validated || a.key != null)
4461
4461
  return;
4462
- s._store.validated = !0;
4463
- var g = _t(p);
4464
- if (nt[g])
4462
+ a._store.validated = !0;
4463
+ var A = _t(h);
4464
+ if (it[A])
4465
4465
  return;
4466
- nt[g] = !0;
4467
- var E = "";
4468
- s && s._owner && s._owner !== We.current && (E = " It was passed a child from " + M(s._owner.type) + "."), de(s), C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', g, E), de(null);
4466
+ it[A] = !0;
4467
+ var v = "";
4468
+ a && a._owner && a._owner !== We.current && (v = " It was passed a child from " + z(a._owner.type) + "."), de(a), C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', A, v), de(null);
4469
4469
  }
4470
4470
  }
4471
- function ot(s, p) {
4471
+ function lt(a, h) {
4472
4472
  {
4473
- if (typeof s != "object")
4473
+ if (typeof a != "object")
4474
4474
  return;
4475
- if (D(s))
4476
- for (var g = 0; g < s.length; g++) {
4477
- var E = s[g];
4478
- Ye(E) && it(E, p);
4475
+ if (b(a))
4476
+ for (var A = 0; A < a.length; A++) {
4477
+ var v = a[A];
4478
+ Ye(v) && ot(v, h);
4479
4479
  }
4480
- else if (Ye(s))
4481
- s._store && (s._store.validated = !0);
4482
- else if (s) {
4483
- var j = G(s);
4484
- if (typeof j == "function" && j !== s.entries)
4485
- for (var _ = j.call(s), S; !(S = _.next()).done; )
4486
- Ye(S.value) && it(S.value, p);
4480
+ else if (Ye(a))
4481
+ a._store && (a._store.validated = !0);
4482
+ else if (a) {
4483
+ var _ = M(a);
4484
+ if (typeof _ == "function" && _ !== a.entries)
4485
+ for (var R = _.call(a), j; !(j = R.next()).done; )
4486
+ Ye(j.value) && ot(j.value, h);
4487
4487
  }
4488
4488
  }
4489
4489
  }
4490
- function Nt(s) {
4490
+ function Rt(a) {
4491
4491
  {
4492
- var p = s.type;
4493
- if (p == null || typeof p == "string")
4492
+ var h = a.type;
4493
+ if (h == null || typeof h == "string")
4494
4494
  return;
4495
- var g;
4496
- if (typeof p == "function")
4497
- g = p.propTypes;
4498
- else if (typeof p == "object" && (p.$$typeof === l || // Note: Memo only checks outer props here.
4495
+ var A;
4496
+ if (typeof h == "function")
4497
+ A = h.propTypes;
4498
+ else if (typeof h == "object" && (h.$$typeof === l || // Note: Memo only checks outer props here.
4499
4499
  // Inner props are checked in the reconciler.
4500
- p.$$typeof === h))
4501
- g = p.propTypes;
4500
+ h.$$typeof === p))
4501
+ A = h.propTypes;
4502
4502
  else
4503
4503
  return;
4504
- if (g) {
4505
- var E = M(p);
4506
- Ge(g, s.props, "prop", E, s);
4507
- } else if (p.PropTypes !== void 0 && !Qe) {
4504
+ if (A) {
4505
+ var v = z(h);
4506
+ Ge(A, a.props, "prop", v, a);
4507
+ } else if (h.PropTypes !== void 0 && !Qe) {
4508
4508
  Qe = !0;
4509
- var j = M(p);
4510
- C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", j || "Unknown");
4509
+ var _ = z(h);
4510
+ C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _ || "Unknown");
4511
4511
  }
4512
- typeof p.getDefaultProps == "function" && !p.getDefaultProps.isReactClassApproved && C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
4512
+ typeof h.getDefaultProps == "function" && !h.getDefaultProps.isReactClassApproved && C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
4513
4513
  }
4514
4514
  }
4515
- function Lt(s) {
4515
+ function Lt(a) {
4516
4516
  {
4517
- for (var p = Object.keys(s.props), g = 0; g < p.length; g++) {
4518
- var E = p[g];
4519
- if (E !== "children" && E !== "key") {
4520
- de(s), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", E), de(null);
4517
+ for (var h = Object.keys(a.props), A = 0; A < h.length; A++) {
4518
+ var v = h[A];
4519
+ if (v !== "children" && v !== "key") {
4520
+ de(a), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", v), de(null);
4521
4521
  break;
4522
4522
  }
4523
4523
  }
4524
- s.ref !== null && (de(s), C("Invalid attribute `ref` supplied to `React.Fragment`."), de(null));
4524
+ a.ref !== null && (de(a), C("Invalid attribute `ref` supplied to `React.Fragment`."), de(null));
4525
4525
  }
4526
4526
  }
4527
- var lt = {};
4528
- function ct(s, p, g, E, j, _) {
4527
+ var ct = {};
4528
+ function dt(a, h, A, v, _, R) {
4529
4529
  {
4530
- var S = R(s);
4531
- if (!S) {
4532
- var F = "";
4533
- (s === void 0 || typeof s == "object" && s !== null && Object.keys(s).length === 0) && (F += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
4534
- var W = jt();
4535
- W ? F += W : F += st();
4536
- var P;
4537
- s === null ? P = "null" : D(s) ? P = "array" : s !== void 0 && s.$$typeof === e ? (P = "<" + (M(s.type) || "Unknown") + " />", F = " Did you accidentally export a JSX literal instead of a component?") : P = typeof s, C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", P, F);
4530
+ var j = N(a);
4531
+ if (!j) {
4532
+ var T = "";
4533
+ (a === void 0 || typeof a == "object" && a !== null && Object.keys(a).length === 0) && (T += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
4534
+ var Q = Nt();
4535
+ Q ? T += Q : T += nt();
4536
+ var I;
4537
+ a === null ? I = "null" : b(a) ? I = "array" : a !== void 0 && a.$$typeof === e ? (I = "<" + (z(a.type) || "Unknown") + " />", T = " Did you accidentally export a JSX literal instead of a component?") : I = typeof a, C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", I, T);
4538
4538
  }
4539
- var $ = Rt(s, p, g, j, _);
4539
+ var $ = qt(a, h, A, _, R);
4540
4540
  if ($ == null)
4541
4541
  return $;
4542
- if (S) {
4543
- var Z = p.children;
4542
+ if (j) {
4543
+ var Z = h.children;
4544
4544
  if (Z !== void 0)
4545
- if (E)
4546
- if (D(Z)) {
4545
+ if (v)
4546
+ if (b(Z)) {
4547
4547
  for (var fe = 0; fe < Z.length; fe++)
4548
- ot(Z[fe], s);
4548
+ lt(Z[fe], a);
4549
4549
  Object.freeze && Object.freeze(Z);
4550
4550
  } else
4551
4551
  C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
4552
4552
  else
4553
- ot(Z, s);
4553
+ lt(Z, a);
4554
4554
  }
4555
- if (ue.call(p, "key")) {
4556
- var ae = M(s), Q = Object.keys(p).filter(function(Mt) {
4555
+ if (ue.call(h, "key")) {
4556
+ var se = z(a), Y = Object.keys(h).filter(function(Mt) {
4557
4557
  return Mt !== "key";
4558
- }), Je = Q.length > 0 ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}";
4559
- if (!lt[ae + Je]) {
4560
- var $t = Q.length > 0 ? "{" + Q.join(": ..., ") + ": ...}" : "{}";
4558
+ }), Je = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
4559
+ if (!ct[se + Je]) {
4560
+ var $t = Y.length > 0 ? "{" + Y.join(": ..., ") + ": ...}" : "{}";
4561
4561
  C(`A props object containing a "key" prop is being spread into JSX:
4562
4562
  let props = %s;
4563
4563
  <%s {...props} />
4564
4564
  React keys must be passed directly to JSX without using spread:
4565
4565
  let props = %s;
4566
- <%s key={someKey} {...props} />`, Je, ae, $t, ae), lt[ae + Je] = !0;
4566
+ <%s key={someKey} {...props} />`, Je, se, $t, se), ct[se + Je] = !0;
4567
4567
  }
4568
4568
  }
4569
- return s === u ? Lt($) : Nt($), $;
4569
+ return a === u ? Lt($) : Rt($), $;
4570
4570
  }
4571
4571
  }
4572
- function Ot(s, p, g) {
4573
- return ct(s, p, g, !0);
4572
+ function Pt(a, h, A) {
4573
+ return dt(a, h, A, !0);
4574
4574
  }
4575
- function Pt(s, p, g) {
4576
- return ct(s, p, g, !1);
4575
+ function Ot(a, h, A) {
4576
+ return dt(a, h, A, !1);
4577
4577
  }
4578
- var Ut = Pt, It = Ot;
4578
+ var Ut = Ot, It = Pt;
4579
4579
  we.Fragment = u, we.jsx = Ut, we.jsxs = It;
4580
4580
  }()), we;
4581
4581
  }
@@ -4592,20 +4592,20 @@ class tt {
4592
4592
  * Filter by field value
4593
4593
  */
4594
4594
  static filterBy(e, r, u) {
4595
- return e.filter((a) => a[r] === u);
4595
+ return e.filter((s) => s[r] === u);
4596
4596
  }
4597
4597
  /**
4598
4598
  * Filter by multiple fields
4599
4599
  */
4600
4600
  static filterByFields(e, r) {
4601
- return e.filter((u) => Object.entries(r).every(([a, n]) => u[a] === n));
4601
+ return e.filter((u) => Object.entries(r).every(([s, n]) => u[s] === n));
4602
4602
  }
4603
4603
  /**
4604
4604
  * Sort array by field
4605
4605
  */
4606
4606
  static sort(e, r, u = "asc") {
4607
- return [...e].sort((a, n) => {
4608
- const t = a[r], i = n[r];
4607
+ return [...e].sort((s, n) => {
4608
+ const t = s[r], i = n[r];
4609
4609
  if (t === i) return 0;
4610
4610
  let l = 0;
4611
4611
  return t > i && (l = 1), t < i && (l = -1), u === "asc" ? l : -l;
@@ -4616,19 +4616,19 @@ class tt {
4616
4616
  */
4617
4617
  static search(e, r, u) {
4618
4618
  if (!r.trim()) return e;
4619
- const a = r.toLowerCase();
4619
+ const s = r.toLowerCase();
4620
4620
  return e.filter((n) => u.some((t) => {
4621
4621
  const i = n[t];
4622
- return i == null ? !1 : String(i).toLowerCase().includes(a);
4622
+ return i == null ? !1 : String(i).toLowerCase().includes(s);
4623
4623
  }));
4624
4624
  }
4625
4625
  /**
4626
4626
  * Paginate array
4627
4627
  */
4628
4628
  static paginate(e, r, u) {
4629
- const a = (r - 1) * u, n = a + u;
4629
+ const s = (r - 1) * u, n = s + u;
4630
4630
  return {
4631
- data: e.slice(a, n),
4631
+ data: e.slice(s, n),
4632
4632
  total: e.length,
4633
4633
  page: r,
4634
4634
  totalPages: Math.ceil(e.length / u)
@@ -4638,24 +4638,24 @@ class tt {
4638
4638
  * Group items by field value
4639
4639
  */
4640
4640
  static groupBy(e, r) {
4641
- return e.reduce((u, a) => {
4642
- const n = String(a[r]);
4643
- return u[n] || (u[n] = []), u[n].push(a), u;
4641
+ return e.reduce((u, s) => {
4642
+ const n = String(s[r]);
4643
+ return u[n] || (u[n] = []), u[n].push(s), u;
4644
4644
  }, {});
4645
4645
  }
4646
4646
  /**
4647
4647
  * Get unique values for a field
4648
4648
  */
4649
4649
  static unique(e, r) {
4650
- const u = e.map((a) => a[r]);
4650
+ const u = e.map((s) => s[r]);
4651
4651
  return [...new Set(u)];
4652
4652
  }
4653
4653
  /**
4654
4654
  * Count items by field value
4655
4655
  */
4656
4656
  static countBy(e, r) {
4657
- return e.reduce((u, a) => {
4658
- const n = String(a[r]);
4657
+ return e.reduce((u, s) => {
4658
+ const n = String(s[r]);
4659
4659
  return u[n] = (u[n] || 0) + 1, u;
4660
4660
  }, {});
4661
4661
  }
@@ -4663,71 +4663,71 @@ class tt {
4663
4663
  * Apply multiple operations in sequence
4664
4664
  */
4665
4665
  static pipe(e, r) {
4666
- return r.reduce((u, a) => a(u), e);
4666
+ return r.reduce((u, s) => s(u), e);
4667
4667
  }
4668
4668
  }
4669
- function xr({
4669
+ function Er({
4670
4670
  endpoint: o,
4671
4671
  params: e,
4672
4672
  layout: r = "list",
4673
4673
  title: u,
4674
- emptyMessage: a = "No items found",
4674
+ emptyMessage: s = "No items found",
4675
4675
  renderItem: n,
4676
- keyExtractor: t = (B, G) => B.id || B._id || String(G),
4676
+ keyExtractor: t = (B, M) => B.id || B._id || String(M),
4677
4677
  searchable: i = !1,
4678
4678
  searchFields: l = [],
4679
- searchPlaceholder: d = "Search...",
4680
- filters: c = [],
4681
- pageSize: h = 20,
4679
+ searchPlaceholder: c = "Search...",
4680
+ filters: d = [],
4681
+ pageSize: p = 20,
4682
4682
  onItemClick: m,
4683
- onRefresh: A,
4684
- theme: w = {}
4683
+ onRefresh: D,
4684
+ theme: E = {}
4685
4685
  }) {
4686
- const { data: B, loading: G, error: O, refetch: C } = pr(o, e), [I, b] = U(""), [N, y] = U({}), [q, L] = U(1), k = Et(() => {
4686
+ const { data: B, loading: M, error: L, refetch: C } = pr(o, e), [U, g] = O(""), [k, y] = O({}), [q, P] = O(1), F = vt(() => {
4687
4687
  if (!B) return { data: [], total: 0, totalPages: 0 };
4688
- let T = B;
4689
- return i && I && l.length > 0 && (T = tt.search(T, I, l)), Object.keys(N).length > 0 && (T = tt.filterByFields(T, N)), tt.paginate(T, q, h);
4690
- }, [B, I, N, q, h, i, l]);
4688
+ let S = B;
4689
+ return i && U && l.length > 0 && (S = tt.search(S, U, l)), Object.keys(k).length > 0 && (S = tt.filterByFields(S, k)), tt.paginate(S, q, p);
4690
+ }, [B, U, k, q, p, i, l]);
4691
4691
  pe(() => {
4692
- L(1);
4693
- }, [I, N]);
4694
- const R = () => {
4695
- b(""), y({}), L(1), C(), A == null || A();
4696
- }, v = {
4697
- background: w.background || "#ffffff",
4698
- cardBackground: w.cardBackground || "#f9fafb",
4699
- text: w.text || "#111827",
4700
- textSecondary: w.textSecondary || "#6b7280",
4701
- border: w.border || "#e5e7eb",
4702
- primary: w.primary || "#3b82f6"
4703
- }, M = n || ((T) => /* @__PURE__ */ f.jsxs("div", { style: {
4692
+ P(1);
4693
+ }, [U, k]);
4694
+ const N = () => {
4695
+ g(""), y({}), P(1), C(), D == null || D();
4696
+ }, x = {
4697
+ background: E.background || "#ffffff",
4698
+ cardBackground: E.cardBackground || "#f9fafb",
4699
+ text: E.text || "#111827",
4700
+ textSecondary: E.textSecondary || "#6b7280",
4701
+ border: E.border || "#e5e7eb",
4702
+ primary: E.primary || "#3b82f6"
4703
+ }, z = n || ((S) => /* @__PURE__ */ f.jsxs("div", { style: {
4704
4704
  padding: "16px",
4705
4705
  cursor: m ? "pointer" : "default"
4706
4706
  }, children: [
4707
- /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", fontWeight: 500, color: v.text }, children: T.title || T.name || T.label || "Untitled" }),
4708
- T.description && /* @__PURE__ */ f.jsx("div", { style: { fontSize: "13px", color: v.textSecondary, marginTop: "4px" }, children: T.description })
4707
+ /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", fontWeight: 500, color: x.text }, children: S.title || S.name || S.label || "Untitled" }),
4708
+ S.description && /* @__PURE__ */ f.jsx("div", { style: { fontSize: "13px", color: x.textSecondary, marginTop: "4px" }, children: S.description })
4709
4709
  ] }));
4710
- return G && !B ? /* @__PURE__ */ f.jsx("div", { style: {
4710
+ return M && !B ? /* @__PURE__ */ f.jsx("div", { style: {
4711
4711
  display: "flex",
4712
4712
  alignItems: "center",
4713
4713
  justifyContent: "center",
4714
4714
  padding: "48px",
4715
- color: v.textSecondary
4716
- }, children: "Loading..." }) : O ? /* @__PURE__ */ f.jsxs("div", { style: {
4715
+ color: x.textSecondary
4716
+ }, children: "Loading..." }) : L ? /* @__PURE__ */ f.jsxs("div", { style: {
4717
4717
  padding: "24px",
4718
4718
  textAlign: "center",
4719
4719
  color: "#ef4444"
4720
4720
  }, children: [
4721
4721
  /* @__PURE__ */ f.jsx("div", { style: { fontWeight: 500, marginBottom: "8px" }, children: "Error" }),
4722
- /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px" }, children: O.message }),
4722
+ /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px" }, children: L.message }),
4723
4723
  /* @__PURE__ */ f.jsx(
4724
4724
  "button",
4725
4725
  {
4726
- onClick: R,
4726
+ onClick: N,
4727
4727
  style: {
4728
4728
  marginTop: "16px",
4729
4729
  padding: "8px 16px",
4730
- background: v.primary,
4730
+ background: x.primary,
4731
4731
  color: "white",
4732
4732
  border: "none",
4733
4733
  borderRadius: "6px",
@@ -4737,36 +4737,36 @@ function xr({
4737
4737
  }
4738
4738
  )
4739
4739
  ] }) : /* @__PURE__ */ f.jsxs("div", { style: {
4740
- background: v.background,
4740
+ background: x.background,
4741
4741
  borderRadius: "12px",
4742
4742
  overflow: "hidden"
4743
4743
  }, children: [
4744
- (u || i || c.length > 0) && /* @__PURE__ */ f.jsxs("div", { style: {
4744
+ (u || i || d.length > 0) && /* @__PURE__ */ f.jsxs("div", { style: {
4745
4745
  padding: "16px",
4746
- borderBottom: `1px solid ${v.border}`
4746
+ borderBottom: `1px solid ${x.border}`
4747
4747
  }, children: [
4748
4748
  /* @__PURE__ */ f.jsxs("div", { style: {
4749
4749
  display: "flex",
4750
4750
  alignItems: "center",
4751
4751
  justifyContent: "space-between",
4752
- marginBottom: i || c.length > 0 ? "12px" : "0"
4752
+ marginBottom: i || d.length > 0 ? "12px" : "0"
4753
4753
  }, children: [
4754
4754
  u && /* @__PURE__ */ f.jsx("h2", { style: {
4755
4755
  margin: 0,
4756
4756
  fontSize: "18px",
4757
4757
  fontWeight: 600,
4758
- color: v.text
4758
+ color: x.text
4759
4759
  }, children: u }),
4760
4760
  /* @__PURE__ */ f.jsx(
4761
4761
  "button",
4762
4762
  {
4763
- onClick: R,
4763
+ onClick: N,
4764
4764
  style: {
4765
4765
  padding: "6px 12px",
4766
4766
  background: "transparent",
4767
- border: `1px solid ${v.border}`,
4767
+ border: `1px solid ${x.border}`,
4768
4768
  borderRadius: "6px",
4769
- color: v.textSecondary,
4769
+ color: x.textSecondary,
4770
4770
  cursor: "pointer",
4771
4771
  fontSize: "13px"
4772
4772
  },
@@ -4778,13 +4778,13 @@ function xr({
4778
4778
  "input",
4779
4779
  {
4780
4780
  type: "text",
4781
- placeholder: d,
4782
- value: I,
4783
- onChange: (T) => b(T.target.value),
4781
+ placeholder: c,
4782
+ value: U,
4783
+ onChange: (S) => g(S.target.value),
4784
4784
  style: {
4785
4785
  width: "100%",
4786
4786
  padding: "8px 12px",
4787
- border: `1px solid ${v.border}`,
4787
+ border: `1px solid ${x.border}`,
4788
4788
  borderRadius: "8px",
4789
4789
  fontSize: "14px",
4790
4790
  outline: "none"
@@ -4798,52 +4798,52 @@ function xr({
4798
4798
  gridTemplateColumns: r === "grid" ? "repeat(auto-fill, minmax(250px, 1fr))" : void 0,
4799
4799
  gap: r === "list" ? "0" : "16px",
4800
4800
  padding: r === "list" ? "0" : "16px"
4801
- }, children: k.data.length === 0 ? /* @__PURE__ */ f.jsx("div", { style: {
4801
+ }, children: F.data.length === 0 ? /* @__PURE__ */ f.jsx("div", { style: {
4802
4802
  padding: "48px",
4803
4803
  textAlign: "center",
4804
- color: v.textSecondary
4805
- }, children: a }) : k.data.map((T, z) => /* @__PURE__ */ f.jsx(
4804
+ color: x.textSecondary
4805
+ }, children: s }) : F.data.map((S, G) => /* @__PURE__ */ f.jsx(
4806
4806
  "div",
4807
4807
  {
4808
- onClick: () => m == null ? void 0 : m(T),
4808
+ onClick: () => m == null ? void 0 : m(S),
4809
4809
  style: {
4810
- background: v.cardBackground,
4810
+ background: x.cardBackground,
4811
4811
  borderRadius: r === "list" ? "0" : "8px",
4812
- borderBottom: r === "list" ? `1px solid ${v.border}` : "none",
4812
+ borderBottom: r === "list" ? `1px solid ${x.border}` : "none",
4813
4813
  transition: "all 0.15s ease"
4814
4814
  },
4815
4815
  onMouseEnter: (K) => {
4816
- m && (K.currentTarget.style.background = v.border);
4816
+ m && (K.currentTarget.style.background = x.border);
4817
4817
  },
4818
4818
  onMouseLeave: (K) => {
4819
- K.currentTarget.style.background = v.cardBackground;
4819
+ K.currentTarget.style.background = x.cardBackground;
4820
4820
  },
4821
- children: M(T, z)
4821
+ children: z(S, G)
4822
4822
  },
4823
- t(T, z)
4823
+ t(S, G)
4824
4824
  )) }),
4825
- k.totalPages > 1 && /* @__PURE__ */ f.jsxs("div", { style: {
4825
+ F.totalPages > 1 && /* @__PURE__ */ f.jsxs("div", { style: {
4826
4826
  padding: "16px",
4827
- borderTop: `1px solid ${v.border}`,
4827
+ borderTop: `1px solid ${x.border}`,
4828
4828
  display: "flex",
4829
4829
  alignItems: "center",
4830
4830
  justifyContent: "space-between"
4831
4831
  }, children: [
4832
- /* @__PURE__ */ f.jsxs("div", { style: { fontSize: "13px", color: v.textSecondary }, children: [
4832
+ /* @__PURE__ */ f.jsxs("div", { style: { fontSize: "13px", color: x.textSecondary }, children: [
4833
4833
  "Page ",
4834
4834
  q,
4835
4835
  " of ",
4836
- k.totalPages
4836
+ F.totalPages
4837
4837
  ] }),
4838
4838
  /* @__PURE__ */ f.jsxs("div", { style: { display: "flex", gap: "8px" }, children: [
4839
4839
  /* @__PURE__ */ f.jsx(
4840
4840
  "button",
4841
4841
  {
4842
- onClick: () => L((T) => Math.max(1, T - 1)),
4842
+ onClick: () => P((S) => Math.max(1, S - 1)),
4843
4843
  disabled: q === 1,
4844
4844
  style: {
4845
4845
  padding: "6px 12px",
4846
- border: `1px solid ${v.border}`,
4846
+ border: `1px solid ${x.border}`,
4847
4847
  borderRadius: "6px",
4848
4848
  background: "white",
4849
4849
  cursor: q === 1 ? "not-allowed" : "pointer",
@@ -4855,15 +4855,15 @@ function xr({
4855
4855
  /* @__PURE__ */ f.jsx(
4856
4856
  "button",
4857
4857
  {
4858
- onClick: () => L((T) => Math.min(k.totalPages, T + 1)),
4859
- disabled: q === k.totalPages,
4858
+ onClick: () => P((S) => Math.min(F.totalPages, S + 1)),
4859
+ disabled: q === F.totalPages,
4860
4860
  style: {
4861
4861
  padding: "6px 12px",
4862
- border: `1px solid ${v.border}`,
4862
+ border: `1px solid ${x.border}`,
4863
4863
  borderRadius: "6px",
4864
4864
  background: "white",
4865
- cursor: q === k.totalPages ? "not-allowed" : "pointer",
4866
- opacity: q === k.totalPages ? 0.5 : 1
4865
+ cursor: q === F.totalPages ? "not-allowed" : "pointer",
4866
+ opacity: q === F.totalPages ? 0.5 : 1
4867
4867
  },
4868
4868
  children: "Next"
4869
4869
  }
@@ -4877,10 +4877,10 @@ function wr({
4877
4877
  onClick: e,
4878
4878
  title: r = (t) => t.title || t.name || t.label || "Untitled",
4879
4879
  subtitle: u = (t) => t.description || t.subtitle || "",
4880
- image: a = (t) => t.image || t.thumbnail || t.photo,
4880
+ image: s = (t) => t.image || t.thumbnail || t.photo,
4881
4881
  badge: n = (t) => t.badge || t.tag || t.type
4882
4882
  }) {
4883
- const t = r(o), i = u(o), l = a(o), d = n(o);
4883
+ const t = r(o), i = u(o), l = s(o), c = n(o);
4884
4884
  return /* @__PURE__ */ f.jsxs(
4885
4885
  "div",
4886
4886
  {
@@ -4902,7 +4902,7 @@ function wr({
4902
4902
  /* @__PURE__ */ f.jsxs("div", { className: "flex-1 min-w-0", children: [
4903
4903
  /* @__PURE__ */ f.jsxs("div", { className: "flex items-center gap-2", children: [
4904
4904
  /* @__PURE__ */ f.jsx("h3", { className: "font-medium text-gray-900 truncate", children: t }),
4905
- d && /* @__PURE__ */ f.jsx("span", { className: "px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full", children: d })
4905
+ c && /* @__PURE__ */ f.jsx("span", { className: "px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full", children: c })
4906
4906
  ] }),
4907
4907
  i && /* @__PURE__ */ f.jsx("p", { className: "text-sm text-gray-600 truncate mt-0.5", children: i })
4908
4908
  ] }),
@@ -4916,7 +4916,7 @@ function Cr({
4916
4916
  onClose: e,
4917
4917
  title: r = (n) => n.title || n.name || n.label || "Detail",
4918
4918
  image: u = (n) => n.image || n.thumbnail || n.photo,
4919
- fields: a = []
4919
+ fields: s = []
4920
4920
  }) {
4921
4921
  if (!o) return null;
4922
4922
  const n = r(o), t = u(o);
@@ -4941,14 +4941,14 @@ function Cr({
4941
4941
  className: "w-full h-64 object-cover rounded-lg"
4942
4942
  }
4943
4943
  ) }),
4944
- a.length > 0 && /* @__PURE__ */ f.jsx("div", { className: "space-y-4", children: a.map((i, l) => {
4945
- const d = i.value(o);
4946
- return d == null || d === "" ? null : /* @__PURE__ */ f.jsxs("div", { children: [
4944
+ s.length > 0 && /* @__PURE__ */ f.jsx("div", { className: "space-y-4", children: s.map((i, l) => {
4945
+ const c = i.value(o);
4946
+ return c == null || c === "" ? null : /* @__PURE__ */ f.jsxs("div", { children: [
4947
4947
  /* @__PURE__ */ f.jsx("div", { className: "text-sm font-medium text-gray-500 mb-1", children: i.label }),
4948
- /* @__PURE__ */ f.jsx("div", { className: "text-base text-gray-900", children: typeof d == "object" ? JSON.stringify(d, null, 2) : String(d) })
4948
+ /* @__PURE__ */ f.jsx("div", { className: "text-base text-gray-900", children: typeof c == "object" ? JSON.stringify(c, null, 2) : String(c) })
4949
4949
  ] }, l);
4950
4950
  }) }),
4951
- a.length === 0 && /* @__PURE__ */ f.jsx("pre", { className: "bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto", children: JSON.stringify(o, null, 2) })
4951
+ s.length === 0 && /* @__PURE__ */ f.jsx("pre", { className: "bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto", children: JSON.stringify(o, null, 2) })
4952
4952
  ] }),
4953
4953
  e && /* @__PURE__ */ f.jsx("div", { className: "sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4", children: /* @__PURE__ */ f.jsx(
4954
4954
  "button",
@@ -4970,85 +4970,85 @@ function Br({
4970
4970
  cardCount: e = 2,
4971
4971
  minInterval: r = 1e3,
4972
4972
  maxInterval: u = 3e3,
4973
- onCardClick: a,
4973
+ onCardClick: s,
4974
4974
  cardSize: n = "medium",
4975
4975
  className: t = ""
4976
4976
  }) {
4977
- const i = Math.min(Math.max(e, 1), 5), [l, d] = U([]), [c, h] = U([]), [m, A] = U(Array(i).fill(!1)), [w, B] = U(Array(i).fill(!1)), G = dt([]), O = Y((y) => {
4978
- const q = o.filter((k) => !y.includes(k._id));
4977
+ const i = Math.min(Math.max(e, 1), 5), [l, c] = O([]), [d, p] = O([]), [m, D] = O(Array(i).fill(!1)), [E, B] = O(Array(i).fill(!1)), M = ft([]), L = H((y) => {
4978
+ const q = o.filter((F) => !y.includes(F._id));
4979
4979
  if (q.length === 0) return null;
4980
- const L = Math.floor(Math.random() * q.length);
4981
- return q[L];
4982
- }, [o]), C = Y(() => Math.random() * (u - r) + r, [r, u]);
4980
+ const P = Math.floor(Math.random() * q.length);
4981
+ return q[P];
4982
+ }, [o]), C = H(() => Math.random() * (u - r) + r, [r, u]);
4983
4983
  pe(() => {
4984
4984
  if (o.length === 0) {
4985
- d([]), h([]);
4985
+ c([]), p([]);
4986
4986
  return;
4987
4987
  }
4988
- const y = [], q = [], L = [];
4989
- for (let k = 0; k < i && k < o.length; k++) {
4990
- const R = O(L);
4991
- R && (y.push(R), L.push(R._id));
4988
+ const y = [], q = [], P = [];
4989
+ for (let F = 0; F < i && F < o.length; F++) {
4990
+ const N = L(P);
4991
+ N && (y.push(N), P.push(N._id));
4992
4992
  }
4993
- for (let k = 0; k < y.length; k++) {
4994
- const R = [
4995
- y[k]._id,
4996
- ...y.filter((H, M) => M !== k).map((H) => H._id)
4997
- ], v = O(R);
4998
- v ? q.push(v) : q.push(y[k]);
4993
+ for (let F = 0; F < y.length; F++) {
4994
+ const N = [
4995
+ y[F]._id,
4996
+ ...y.filter((V, z) => z !== F).map((V) => V._id)
4997
+ ], x = L(N);
4998
+ x ? q.push(x) : q.push(y[F]);
4999
4999
  }
5000
- d(y), h(q);
5001
- }, [o, i, O]);
5002
- const I = Y((y) => {
5003
- const q = C(), L = setTimeout(() => {
5004
- A((k) => {
5005
- const R = [...k];
5006
- return R[y] = !R[y], R;
5000
+ c(y), p(q);
5001
+ }, [o, i, L]);
5002
+ const U = H((y) => {
5003
+ const q = C(), P = setTimeout(() => {
5004
+ D((F) => {
5005
+ const N = [...F];
5006
+ return N[y] = !N[y], N;
5007
5007
  }), setTimeout(() => {
5008
- B((k) => {
5009
- const R = [...k];
5010
- return R[y] = !R[y], R;
5008
+ B((F) => {
5009
+ const N = [...F];
5010
+ return N[y] = !N[y], N;
5011
5011
  }), setTimeout(() => {
5012
- const k = !w[y];
5013
- k && d((R) => {
5014
- const v = [...R];
5015
- return v[y] = c[y], v;
5016
- }), h((R) => {
5017
- const v = [...R], M = [
5018
- (k ? c[y] : l[y])._id,
5019
- ...l.filter((z, K) => K !== y).map((z) => z._id),
5020
- ...R.filter((z, K) => K !== y).map((z) => z._id)
5021
- ], T = O(M);
5022
- return T && (v[y] = T), v;
5012
+ const F = !E[y];
5013
+ F && c((N) => {
5014
+ const x = [...N];
5015
+ return x[y] = d[y], x;
5016
+ }), p((N) => {
5017
+ const x = [...N], z = [
5018
+ (F ? d[y] : l[y])._id,
5019
+ ...l.filter((G, K) => K !== y).map((G) => G._id),
5020
+ ...N.filter((G, K) => K !== y).map((G) => G._id)
5021
+ ], S = L(z);
5022
+ return S && (x[y] = S), x;
5023
5023
  }), setTimeout(() => {
5024
- I(y);
5024
+ U(y);
5025
5025
  }, 150);
5026
5026
  }, 200);
5027
5027
  }, 150);
5028
5028
  }, q);
5029
- G.current[y] = L;
5030
- }, [C, O, l, c, w]), b = dt(!1);
5029
+ M.current[y] = P;
5030
+ }, [C, L, l, d, E]), g = ft(!1);
5031
5031
  pe(() => {
5032
- if (!(l.length === 0 || o.length <= 1) && !b.current) {
5033
- b.current = !0;
5032
+ if (!(l.length === 0 || o.length <= 1) && !g.current) {
5033
+ g.current = !0;
5034
5034
  for (let y = 0; y < l.length; y++)
5035
- I(y);
5035
+ U(y);
5036
5036
  return () => {
5037
- G.current.forEach((y) => clearTimeout(y)), G.current = [], b.current = !1;
5037
+ M.current.forEach((y) => clearTimeout(y)), M.current = [], g.current = !1;
5038
5038
  };
5039
5039
  }
5040
5040
  }, [l.length, o.length]);
5041
- const N = (y) => {
5042
- a && a(y);
5041
+ const k = (y) => {
5042
+ s && s(y);
5043
5043
  };
5044
5044
  return o.length === 0 ? /* @__PURE__ */ f.jsx("div", { className: `flex items-center justify-center p-8 ${t}`, children: /* @__PURE__ */ f.jsx("p", { className: "text-gray-500", children: "No nodes available" }) }) : l.length === 0 ? /* @__PURE__ */ f.jsx("div", { className: `flex items-center justify-center p-8 ${t}`, children: /* @__PURE__ */ f.jsx("p", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ f.jsx("div", { className: `flex gap-4 justify-center items-center flex-wrap ${t}`, children: l.map((y, q) => {
5045
- const L = c[q], k = w[q];
5045
+ const P = d[q], F = E[q];
5046
5046
  return /* @__PURE__ */ f.jsx(
5047
5047
  "div",
5048
5048
  {
5049
5049
  className: `relative ${mr[n]}`,
5050
5050
  style: { perspective: "1000px" },
5051
- onClick: () => N(k ? L : y),
5051
+ onClick: () => k(F ? P : y),
5052
5052
  children: /* @__PURE__ */ f.jsxs(
5053
5053
  "div",
5054
5054
  {
@@ -5064,7 +5064,7 @@ function Br({
5064
5064
  {
5065
5065
  className: "absolute inset-0 transition-opacity duration-200",
5066
5066
  style: {
5067
- opacity: k ? 0 : 1
5067
+ opacity: F ? 0 : 1
5068
5068
  },
5069
5069
  children: /* @__PURE__ */ f.jsxs(
5070
5070
  "div",
@@ -5089,12 +5089,12 @@ function Br({
5089
5089
  )
5090
5090
  }
5091
5091
  ),
5092
- L && /* @__PURE__ */ f.jsx(
5092
+ P && /* @__PURE__ */ f.jsx(
5093
5093
  "div",
5094
5094
  {
5095
5095
  className: "absolute inset-0 transition-opacity duration-200",
5096
5096
  style: {
5097
- opacity: k ? 1 : 0
5097
+ opacity: F ? 1 : 0
5098
5098
  },
5099
5099
  children: /* @__PURE__ */ f.jsxs(
5100
5100
  "div",
@@ -5108,12 +5108,12 @@ function Br({
5108
5108
  /* @__PURE__ */ f.jsx(
5109
5109
  "img",
5110
5110
  {
5111
- src: L.data.image,
5112
- alt: L.title,
5111
+ src: P.data.image,
5112
+ alt: P.title,
5113
5113
  className: "w-full h-full object-cover"
5114
5114
  }
5115
5115
  ),
5116
- /* @__PURE__ */ f.jsx("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2", children: /* @__PURE__ */ f.jsx("p", { className: "text-white text-sm font-medium truncate", children: L.title }) })
5116
+ /* @__PURE__ */ f.jsx("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2", children: /* @__PURE__ */ f.jsx("p", { className: "text-white text-sm font-medium truncate", children: P.title }) })
5117
5117
  ]
5118
5118
  }
5119
5119
  )
@@ -5127,15 +5127,15 @@ function Br({
5127
5127
  );
5128
5128
  }) });
5129
5129
  }
5130
- function Ne(o) {
5130
+ function Re(o) {
5131
5131
  if (!o) return "";
5132
5132
  const e = /=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;
5133
- return o.replace(e, (r, u, a, n) => {
5133
+ return o.replace(e, (r, u, s, n) => {
5134
5134
  try {
5135
- if (a.toUpperCase() === "B") {
5135
+ if (s.toUpperCase() === "B") {
5136
5136
  const t = atob(n);
5137
5137
  return decodeURIComponent(escape(t));
5138
- } else if (a.toUpperCase() === "Q") {
5138
+ } else if (s.toUpperCase() === "Q") {
5139
5139
  const t = n.replace(/_/g, " ").replace(
5140
5140
  /=([0-9A-Fa-f]{2})/g,
5141
5141
  (i, l) => String.fromCharCode(parseInt(l, 16))
@@ -5164,198 +5164,198 @@ function kr({
5164
5164
  systemId: e,
5165
5165
  accountId: r,
5166
5166
  limit: u = 30,
5167
- folder: a,
5167
+ folder: s,
5168
5168
  selectable: n = !0,
5169
5169
  showDetail: t = !1,
5170
5170
  emptyMessage: i = "No emails",
5171
5171
  autoLoad: l = !0,
5172
- onSelect: d,
5173
- onSelectionChange: c,
5174
- onDelete: h,
5172
+ onSelect: c,
5173
+ onSelectionChange: d,
5174
+ onDelete: p,
5175
5175
  onError: m,
5176
- onLoad: A,
5177
- renderItem: w,
5176
+ onLoad: D,
5177
+ renderItem: E,
5178
5178
  renderDetail: B,
5179
- renderActions: G,
5180
- renderEmpty: O,
5179
+ renderActions: M,
5180
+ renderEmpty: L,
5181
5181
  renderLoading: C,
5182
- theme: I = {}
5182
+ theme: U = {}
5183
5183
  }) {
5184
- const b = { ...Dr, ...I }, [N, y] = U([]), [q, L] = U(!1), [k, R] = U(null), [v, H] = U(/* @__PURE__ */ new Set()), [M, T] = U(null), [z, K] = U(null), [ge, me] = U(null), [Te, De] = U(!1), V = Et(() => e ? new cr({ baseUrl: o, system_id: e }) : null, [o, e]), re = Y(async () => {
5185
- if (V) {
5186
- L(!0), R(null);
5184
+ const g = { ...Dr, ...U }, [k, y] = O([]), [q, P] = O(!1), [F, N] = O(null), [x, V] = O(/* @__PURE__ */ new Set()), [z, S] = O(null), [G, K] = O(null), [ge, me] = O(null), [Te, De] = O(!1), W = vt(() => e ? new cr({ baseUrl: o, system_id: e }) : null, [o, e]), re = H(async () => {
5185
+ if (W) {
5186
+ P(!0), N(null);
5187
5187
  try {
5188
- const D = await V.listEmails(r, u, a);
5189
- D != null && D.messages && (y(D.messages), A == null || A(D.messages));
5190
- } catch (D) {
5191
- const x = D instanceof Error ? D : new Error("Failed to fetch emails");
5192
- R(x.message), m == null || m(x);
5188
+ const b = await W.listEmails(r, u, s);
5189
+ b != null && b.messages && (y(b.messages), D == null || D(b.messages));
5190
+ } catch (b) {
5191
+ const w = b instanceof Error ? b : new Error("Failed to fetch emails");
5192
+ N(w.message), m == null || m(w);
5193
5193
  }
5194
- L(!1);
5194
+ P(!1);
5195
5195
  }
5196
- }, [V, r, u, a, m, A]);
5196
+ }, [W, r, u, s, m, D]);
5197
5197
  pe(() => {
5198
5198
  l && re();
5199
5199
  }, [l, re]), pe(() => {
5200
5200
  re();
5201
- }, [a]);
5202
- const ne = Y(async (D) => {
5203
- if (V) {
5204
- K(D), me(null), De(!0);
5201
+ }, [s]);
5202
+ const ne = H(async (b) => {
5203
+ if (W) {
5204
+ K(b), me(null), De(!0);
5205
5205
  try {
5206
- const x = await V.getEmailParsed(r, D.uid, a || "INBOX");
5207
- x != null && x.body && me(x.body);
5208
- } catch (x) {
5209
- console.error("Failed to fetch email body:", x);
5206
+ const w = await W.getEmailParsed(r, b.uid, s || "INBOX");
5207
+ w != null && w.body && me(w.body);
5208
+ } catch (w) {
5209
+ console.error("Failed to fetch email body:", w);
5210
5210
  }
5211
5211
  De(!1);
5212
5212
  }
5213
- }, [V, r, a]), Ue = Y((D) => {
5214
- d == null || d(D), t && ne(D);
5215
- }, [d, t, ne]), Ie = Y((D, x, J) => {
5213
+ }, [W, r, s]), Ue = H((b) => {
5214
+ c == null || c(b), t && ne(b);
5215
+ }, [c, t, ne]), Ie = H((b, w, J) => {
5216
5216
  if (!n) {
5217
- d == null || d(D), t && ne(D);
5217
+ c == null || c(b), t && ne(b);
5218
5218
  return;
5219
5219
  }
5220
- const X = D.uid;
5221
- if (J.shiftKey && M !== null) {
5222
- const te = Math.min(M, x), ee = Math.max(M, x), Ve = N.slice(te, ee + 1).map((je) => je.uid), ve = new Set(Ve);
5223
- H(ve), c == null || c(Array.from(ve));
5220
+ const X = b.uid;
5221
+ if (J.shiftKey && z !== null) {
5222
+ const te = Math.min(z, w), ee = Math.max(z, w), Ve = k.slice(te, ee + 1).map((Ne) => Ne.uid), xe = new Set(Ve);
5223
+ V(xe), d == null || d(Array.from(xe));
5224
5224
  } else if (J.ctrlKey || J.metaKey)
5225
- H((te) => {
5225
+ V((te) => {
5226
5226
  const ee = new Set(te);
5227
- return ee.has(X) ? ee.delete(X) : ee.add(X), c == null || c(Array.from(ee)), ee;
5228
- }), T(x);
5227
+ return ee.has(X) ? ee.delete(X) : ee.add(X), d == null || d(Array.from(ee)), ee;
5228
+ }), S(w);
5229
5229
  else {
5230
5230
  const te = /* @__PURE__ */ new Set([X]);
5231
- H(te), T(x), c == null || c(Array.from(te));
5231
+ V(te), S(w), d == null || d(Array.from(te));
5232
5232
  }
5233
- }, [n, M, N, v, d, c, t]), Ae = Y(async () => {
5234
- if (!(!V || v.size === 0))
5233
+ }, [n, z, k, x, c, d, t]), Ae = H(async () => {
5234
+ if (!(!W || x.size === 0))
5235
5235
  try {
5236
- const D = await V.trashEmails(r, Array.from(v));
5237
- if (console.log("Trash result:", D), D.success && D.moved > 0) {
5238
- y((J) => J.filter((X) => !v.has(X.uid)));
5239
- const x = Array.from(v);
5240
- H(/* @__PURE__ */ new Set()), h == null || h(x);
5236
+ const b = await W.trashEmails(r, Array.from(x));
5237
+ if (console.log("Trash result:", b), b.success && b.moved > 0) {
5238
+ y((J) => J.filter((X) => !x.has(X.uid)));
5239
+ const w = Array.from(x);
5240
+ V(/* @__PURE__ */ new Set()), p == null || p(w);
5241
5241
  } else
5242
- R("Failed to move emails to trash");
5243
- } catch (D) {
5244
- const x = D instanceof Error ? D : new Error("Trash failed");
5245
- console.error("Trash error:", x), R(x.message), m == null || m(x);
5242
+ N("Failed to move emails to trash");
5243
+ } catch (b) {
5244
+ const w = b instanceof Error ? b : new Error("Trash failed");
5245
+ console.error("Trash error:", w), N(w.message), m == null || m(w);
5246
5246
  }
5247
- }, [V, r, v, h, m]), be = Y(async () => {
5248
- if (!(!V || v.size === 0))
5247
+ }, [W, r, x, p, m]), be = H(async () => {
5248
+ if (!(!W || x.size === 0))
5249
5249
  try {
5250
- const D = await V.archiveEmails(r, Array.from(v));
5251
- if (console.log("Archive result:", D), D.success && D.archived > 0) {
5252
- y((J) => J.filter((X) => !v.has(X.uid)));
5253
- const x = Array.from(v);
5254
- H(/* @__PURE__ */ new Set()), h == null || h(x);
5250
+ const b = await W.archiveEmails(r, Array.from(x));
5251
+ if (console.log("Archive result:", b), b.success && b.archived > 0) {
5252
+ y((J) => J.filter((X) => !x.has(X.uid)));
5253
+ const w = Array.from(x);
5254
+ V(/* @__PURE__ */ new Set()), p == null || p(w);
5255
5255
  } else
5256
- R("Failed to archive emails");
5257
- } catch (D) {
5258
- const x = D instanceof Error ? D : new Error("Archive failed");
5259
- console.error("Archive error:", x), R(x.message), m == null || m(x);
5256
+ N("Failed to archive emails");
5257
+ } catch (b) {
5258
+ const w = b instanceof Error ? b : new Error("Archive failed");
5259
+ console.error("Archive error:", w), N(w.message), m == null || m(w);
5260
5260
  }
5261
- }, [V, r, v, h, m]), ie = Y(() => {
5262
- if (v.size === N.length)
5263
- H(/* @__PURE__ */ new Set()), c == null || c([]);
5261
+ }, [W, r, x, p, m]), ie = H(() => {
5262
+ if (x.size === k.length)
5263
+ V(/* @__PURE__ */ new Set()), d == null || d([]);
5264
5264
  else {
5265
- const D = new Set(N.map((x) => x.uid));
5266
- H(D), c == null || c(Array.from(D));
5265
+ const b = new Set(k.map((w) => w.uid));
5266
+ V(b), d == null || d(Array.from(b));
5267
5267
  }
5268
- }, [N, v.size, c]), ye = Y(() => {
5269
- H(/* @__PURE__ */ new Set()), c == null || c([]);
5270
- }, [c]), oe = {
5268
+ }, [k, x.size, d]), ye = H(() => {
5269
+ V(/* @__PURE__ */ new Set()), d == null || d([]);
5270
+ }, [d]), oe = {
5271
5271
  delete: Ae,
5272
5272
  archive: be,
5273
5273
  refresh: re,
5274
5274
  selectAll: ie,
5275
5275
  clearSelection: ye
5276
- }, $e = (D) => {
5277
- if (!D) return "";
5278
- const x = new Date(D), J = /* @__PURE__ */ new Date();
5279
- return x.toDateString() === J.toDateString() ? x.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : x.toLocaleDateString([], { month: "short", day: "numeric" });
5280
- }, Se = (D, x) => /* @__PURE__ */ f.jsx("div", { style: {
5276
+ }, $e = (b) => {
5277
+ if (!b) return "";
5278
+ const w = new Date(b), J = /* @__PURE__ */ new Date();
5279
+ return w.toDateString() === J.toDateString() ? w.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : w.toLocaleDateString([], { month: "short", day: "numeric" });
5280
+ }, Se = (b, w) => /* @__PURE__ */ f.jsx("div", { style: {
5281
5281
  padding: "12px 16px",
5282
- background: x ? b.selectedBackground : D.seen ? b.cardBackground : b.unreadBackground,
5283
- borderBottom: `1px solid ${b.border}`,
5282
+ background: w ? g.selectedBackground : b.seen ? g.cardBackground : g.unreadBackground,
5283
+ borderBottom: `1px solid ${g.border}`,
5284
5284
  cursor: "pointer",
5285
5285
  transition: "background 0.15s ease"
5286
5286
  }, children: /* @__PURE__ */ f.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start", gap: "12px" }, children: [
5287
5287
  /* @__PURE__ */ f.jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
5288
5288
  /* @__PURE__ */ f.jsx("div", { style: {
5289
5289
  fontSize: "14px",
5290
- fontWeight: D.seen ? 400 : 600,
5291
- color: b.text,
5290
+ fontWeight: b.seen ? 400 : 600,
5291
+ color: g.text,
5292
5292
  whiteSpace: "nowrap",
5293
5293
  overflow: "hidden",
5294
5294
  textOverflow: "ellipsis"
5295
- }, children: Ne(D.from).split("@")[0] }),
5295
+ }, children: Re(b.from).split("@")[0] }),
5296
5296
  /* @__PURE__ */ f.jsx("div", { style: {
5297
5297
  fontSize: "14px",
5298
- fontWeight: D.seen ? 400 : 500,
5299
- color: D.seen ? b.textSecondary : b.text,
5298
+ fontWeight: b.seen ? 400 : 500,
5299
+ color: b.seen ? g.textSecondary : g.text,
5300
5300
  marginTop: "2px",
5301
5301
  whiteSpace: "nowrap",
5302
5302
  overflow: "hidden",
5303
5303
  textOverflow: "ellipsis"
5304
- }, children: Ne(D.subject) || "(No subject)" })
5304
+ }, children: Re(b.subject) || "(No subject)" })
5305
5305
  ] }),
5306
5306
  /* @__PURE__ */ f.jsx("div", { style: {
5307
5307
  fontSize: "12px",
5308
- color: b.textSecondary,
5308
+ color: g.textSecondary,
5309
5309
  flexShrink: 0
5310
- }, children: $e(D.date) })
5311
- ] }) }), Me = (D) => /* @__PURE__ */ f.jsxs("div", { style: { padding: "24px" }, children: [
5312
- /* @__PURE__ */ f.jsx("h2", { style: { margin: "0 0 8px", fontSize: "20px", color: b.text }, children: Ne(D.subject) || "(No subject)" }),
5313
- /* @__PURE__ */ f.jsxs("div", { style: { fontSize: "14px", color: b.textSecondary, marginBottom: "16px" }, children: [
5310
+ }, children: $e(b.date) })
5311
+ ] }) }), Me = (b) => /* @__PURE__ */ f.jsxs("div", { style: { padding: "24px" }, children: [
5312
+ /* @__PURE__ */ f.jsx("h2", { style: { margin: "0 0 8px", fontSize: "20px", color: g.text }, children: Re(b.subject) || "(No subject)" }),
5313
+ /* @__PURE__ */ f.jsxs("div", { style: { fontSize: "14px", color: g.textSecondary, marginBottom: "16px" }, children: [
5314
5314
  "From: ",
5315
- Ne(D.from),
5315
+ Re(b.from),
5316
5316
  " • ",
5317
- new Date(D.date).toLocaleString()
5317
+ new Date(b.date).toLocaleString()
5318
5318
  ] }),
5319
- Te ? /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", color: b.textSecondary }, children: "Loading..." }) : ge ? /* @__PURE__ */ f.jsx(
5319
+ Te ? /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", color: g.textSecondary }, children: "Loading..." }) : ge ? /* @__PURE__ */ f.jsx(
5320
5320
  "div",
5321
5321
  {
5322
- style: { fontSize: "14px", color: b.text },
5322
+ style: { fontSize: "14px", color: g.text },
5323
5323
  dangerouslySetInnerHTML: { __html: ge }
5324
5324
  }
5325
- ) : /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", color: b.textSecondary }, children: "No content available" })
5326
- ] }), ze = (D, x) => /* @__PURE__ */ f.jsxs("div", { style: {
5325
+ ) : /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", color: g.textSecondary }, children: "No content available" })
5326
+ ] }), ze = (b, w) => /* @__PURE__ */ f.jsxs("div", { style: {
5327
5327
  display: "flex",
5328
5328
  alignItems: "center",
5329
5329
  gap: "8px",
5330
5330
  padding: "8px 16px",
5331
- background: b.cardBackground,
5332
- borderBottom: `1px solid ${b.border}`
5331
+ background: g.cardBackground,
5332
+ borderBottom: `1px solid ${g.border}`
5333
5333
  }, children: [
5334
5334
  /* @__PURE__ */ f.jsx(
5335
5335
  "button",
5336
5336
  {
5337
- onClick: x.selectAll,
5337
+ onClick: w.selectAll,
5338
5338
  style: {
5339
5339
  padding: "6px 12px",
5340
5340
  background: "transparent",
5341
- border: `1px solid ${b.border}`,
5341
+ border: `1px solid ${g.border}`,
5342
5342
  borderRadius: "6px",
5343
5343
  fontSize: "13px",
5344
5344
  cursor: "pointer",
5345
- color: b.text
5345
+ color: g.text
5346
5346
  },
5347
- children: D.length === N.length ? "Deselect All" : "Select All"
5347
+ children: b.length === k.length ? "Deselect All" : "Select All"
5348
5348
  }
5349
5349
  ),
5350
- D.length > 0 && /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
5351
- /* @__PURE__ */ f.jsxs("span", { style: { fontSize: "13px", color: b.textSecondary }, children: [
5352
- D.length,
5350
+ b.length > 0 && /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
5351
+ /* @__PURE__ */ f.jsxs("span", { style: { fontSize: "13px", color: g.textSecondary }, children: [
5352
+ b.length,
5353
5353
  " selected"
5354
5354
  ] }),
5355
5355
  /* @__PURE__ */ f.jsx(
5356
5356
  "button",
5357
5357
  {
5358
- onClick: x.archive,
5358
+ onClick: w.archive,
5359
5359
  title: "Archive",
5360
5360
  style: {
5361
5361
  display: "flex",
@@ -5364,10 +5364,10 @@ function kr({
5364
5364
  width: "32px",
5365
5365
  height: "32px",
5366
5366
  background: "transparent",
5367
- border: `1px solid ${b.border}`,
5367
+ border: `1px solid ${g.border}`,
5368
5368
  borderRadius: "6px",
5369
5369
  cursor: "pointer",
5370
- color: b.textSecondary
5370
+ color: g.textSecondary
5371
5371
  },
5372
5372
  children: /* @__PURE__ */ f.jsx("span", { className: "material-icons", style: { fontSize: "18px" }, children: "archive" })
5373
5373
  }
@@ -5375,7 +5375,7 @@ function kr({
5375
5375
  /* @__PURE__ */ f.jsx(
5376
5376
  "button",
5377
5377
  {
5378
- onClick: x.delete,
5378
+ onClick: w.delete,
5379
5379
  title: "Delete",
5380
5380
  style: {
5381
5381
  display: "flex",
@@ -5384,10 +5384,10 @@ function kr({
5384
5384
  width: "32px",
5385
5385
  height: "32px",
5386
5386
  background: "transparent",
5387
- border: `1px solid ${b.border}`,
5387
+ border: `1px solid ${g.border}`,
5388
5388
  borderRadius: "6px",
5389
5389
  cursor: "pointer",
5390
- color: b.textSecondary
5390
+ color: g.textSecondary
5391
5391
  },
5392
5392
  children: /* @__PURE__ */ f.jsx("span", { className: "material-icons", style: { fontSize: "18px" }, children: "delete" })
5393
5393
  }
@@ -5397,7 +5397,7 @@ function kr({
5397
5397
  /* @__PURE__ */ f.jsx(
5398
5398
  "button",
5399
5399
  {
5400
- onClick: x.refresh,
5400
+ onClick: w.refresh,
5401
5401
  title: "Refresh",
5402
5402
  style: {
5403
5403
  display: "flex",
@@ -5406,10 +5406,10 @@ function kr({
5406
5406
  width: "32px",
5407
5407
  height: "32px",
5408
5408
  background: "transparent",
5409
- border: `1px solid ${b.border}`,
5409
+ border: `1px solid ${g.border}`,
5410
5410
  borderRadius: "6px",
5411
5411
  cursor: "pointer",
5412
- color: b.textSecondary
5412
+ color: g.textSecondary
5413
5413
  },
5414
5414
  children: /* @__PURE__ */ f.jsx("span", { className: "material-icons", style: { fontSize: "18px" }, children: "refresh" })
5415
5415
  }
@@ -5417,39 +5417,155 @@ function kr({
5417
5417
  ] }), le = () => /* @__PURE__ */ f.jsx("div", { style: {
5418
5418
  padding: "48px",
5419
5419
  textAlign: "center",
5420
- color: b.textSecondary
5420
+ color: g.textSecondary
5421
5421
  }, children: i }), ue = () => /* @__PURE__ */ f.jsx("div", { style: {
5422
5422
  padding: "48px",
5423
5423
  textAlign: "center",
5424
- color: b.textSecondary
5425
- }, children: "Loading..." }), qe = w || Se, Re = B || Me, ce = G || ze, Ge = O || le, He = C || ue;
5426
- return q && N.length === 0 ? /* @__PURE__ */ f.jsx("div", { style: { background: b.background, width: "100%", height: "100%" }, children: He() }) : /* @__PURE__ */ f.jsxs("div", { style: { display: "flex", background: b.background, width: "100%", height: "100%" }, children: [
5424
+ color: g.textSecondary
5425
+ }, children: "Loading..." }), je = E || Se, qe = B || Me, ce = M || ze, Ge = L || le, He = C || ue;
5426
+ return q && k.length === 0 ? /* @__PURE__ */ f.jsx("div", { style: { background: g.background, width: "100%", height: "100%" }, children: He() }) : /* @__PURE__ */ f.jsxs("div", { style: { display: "flex", background: g.background, width: "100%", height: "100%" }, children: [
5427
5427
  /* @__PURE__ */ f.jsxs("div", { style: {
5428
- flex: t && z ? "0 0 50%" : "1",
5428
+ flex: t && G ? "0 0 50%" : "1",
5429
5429
  display: "flex",
5430
5430
  flexDirection: "column",
5431
- borderRight: t && z ? `1px solid ${b.border}` : "none",
5431
+ borderRight: t && G ? `1px solid ${g.border}` : "none",
5432
5432
  overflow: "hidden"
5433
5433
  }, children: [
5434
- n && ce(Array.from(v), oe),
5435
- k && /* @__PURE__ */ f.jsx("div", { style: {
5434
+ n && ce(Array.from(x), oe),
5435
+ F && /* @__PURE__ */ f.jsx("div", { style: {
5436
5436
  padding: "12px 16px",
5437
5437
  background: "#fef2f2",
5438
- color: b.danger,
5438
+ color: g.danger,
5439
5439
  fontSize: "14px",
5440
- borderBottom: `1px solid ${b.border}`
5441
- }, children: k }),
5442
- /* @__PURE__ */ f.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: N.length === 0 ? Ge() : N.map((D, x) => /* @__PURE__ */ f.jsx(
5440
+ borderBottom: `1px solid ${g.border}`
5441
+ }, children: F }),
5442
+ /* @__PURE__ */ f.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: k.length === 0 ? Ge() : k.map((b, w) => /* @__PURE__ */ f.jsx(
5443
5443
  "div",
5444
5444
  {
5445
- onClick: (J) => Ie(D, x, J),
5446
- onDoubleClick: () => Ue(D),
5447
- children: qe(D, v.has(D.uid))
5445
+ onClick: (J) => Ie(b, w, J),
5446
+ onDoubleClick: () => Ue(b),
5447
+ children: je(b, x.has(b.uid))
5448
5448
  },
5449
- D.uid
5449
+ b.uid
5450
5450
  )) })
5451
5451
  ] }),
5452
- t && z && /* @__PURE__ */ f.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: Re(z) })
5452
+ t && G && /* @__PURE__ */ f.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: qe(G) })
5453
+ ] });
5454
+ }
5455
+ function Fr({
5456
+ items: o,
5457
+ renderItem: e,
5458
+ onSelectionChange: r,
5459
+ onCurrentChange: u,
5460
+ onAction: s,
5461
+ actions: n = [],
5462
+ emptyMessage: t = "No items",
5463
+ showSelectAll: i = !0,
5464
+ className: l = ""
5465
+ }) {
5466
+ const [c, d] = O(/* @__PURE__ */ new Set()), [p, m] = O(-1), D = o.filter((g) => c.has(g.id)), E = p >= 0 && p < D.length ? D[p] : null, B = H((g) => {
5467
+ d((k) => {
5468
+ const y = new Set(k);
5469
+ return y.has(g) ? y.delete(g) : y.add(g), r == null || r(Array.from(y)), y;
5470
+ });
5471
+ }, [r]), M = H(() => {
5472
+ if (c.size === o.length)
5473
+ d(/* @__PURE__ */ new Set()), m(-1), r == null || r([]);
5474
+ else {
5475
+ const g = new Set(o.map((k) => k.id));
5476
+ d(g), o.length > 0 && (m(0), u == null || u(o[0], 0)), r == null || r(o.map((k) => k.id));
5477
+ }
5478
+ }, [o, c.size, r, u]), L = H(() => {
5479
+ if (D.length === 0) return;
5480
+ const g = p <= 0 ? D.length - 1 : p - 1;
5481
+ m(g), u == null || u(D[g], g);
5482
+ }, [D, p, u]), C = H(() => {
5483
+ if (D.length === 0) return;
5484
+ const g = p >= D.length - 1 ? 0 : p + 1;
5485
+ m(g), u == null || u(D[g], g);
5486
+ }, [D, p, u]), U = H((g) => {
5487
+ s == null || s(g, D, E);
5488
+ }, [s, D, E]);
5489
+ return st.useEffect(() => {
5490
+ D.length === 0 ? m(-1) : p >= D.length ? m(D.length - 1) : p < 0 && D.length > 0 && (m(0), u == null || u(D[0], 0));
5491
+ }, [D.length, p, u]), o.length === 0 ? /* @__PURE__ */ f.jsx("div", { className: `text-sm text-neutral-400 text-center py-4 ${l}`, children: t }) : /* @__PURE__ */ f.jsxs("div", { className: `space-y-2 ${l}`, children: [
5492
+ /* @__PURE__ */ f.jsxs("div", { className: "flex items-center justify-between text-xs text-neutral-500", children: [
5493
+ /* @__PURE__ */ f.jsxs("div", { className: "flex items-center gap-2", children: [
5494
+ i && /* @__PURE__ */ f.jsxs(
5495
+ "button",
5496
+ {
5497
+ onClick: M,
5498
+ className: "flex items-center gap-1 hover:text-neutral-700 transition-colors",
5499
+ children: [
5500
+ /* @__PURE__ */ f.jsx("span", { className: "material-icons text-sm", children: c.size === o.length ? "check_box" : c.size > 0 ? "indeterminate_check_box" : "check_box_outline_blank" }),
5501
+ /* @__PURE__ */ f.jsx("span", { children: c.size === o.length ? "Deselect all" : "Select all" })
5502
+ ]
5503
+ }
5504
+ ),
5505
+ c.size > 0 && /* @__PURE__ */ f.jsxs("span", { className: "text-neutral-400", children: [
5506
+ "(",
5507
+ c.size,
5508
+ " selected)"
5509
+ ] })
5510
+ ] }),
5511
+ D.length > 1 && /* @__PURE__ */ f.jsxs("div", { className: "flex items-center gap-1", children: [
5512
+ /* @__PURE__ */ f.jsx(
5513
+ "button",
5514
+ {
5515
+ onClick: L,
5516
+ className: "p-1 hover:bg-neutral-100 rounded transition-colors",
5517
+ title: "Previous",
5518
+ children: /* @__PURE__ */ f.jsx("span", { className: "material-icons text-sm", children: "chevron_left" })
5519
+ }
5520
+ ),
5521
+ /* @__PURE__ */ f.jsxs("span", { className: "text-xs min-w-[3rem] text-center", children: [
5522
+ p + 1,
5523
+ " / ",
5524
+ D.length
5525
+ ] }),
5526
+ /* @__PURE__ */ f.jsx(
5527
+ "button",
5528
+ {
5529
+ onClick: C,
5530
+ className: "p-1 hover:bg-neutral-100 rounded transition-colors",
5531
+ title: "Next",
5532
+ children: /* @__PURE__ */ f.jsx("span", { className: "material-icons text-sm", children: "chevron_right" })
5533
+ }
5534
+ )
5535
+ ] })
5536
+ ] }),
5537
+ /* @__PURE__ */ f.jsx("div", { className: "space-y-1", children: o.map((g) => {
5538
+ const k = c.has(g.id), y = (E == null ? void 0 : E.id) === g.id;
5539
+ return /* @__PURE__ */ f.jsxs(
5540
+ "div",
5541
+ {
5542
+ className: `flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${y ? "bg-blue-50 ring-1 ring-blue-200" : k ? "bg-neutral-100" : "hover:bg-neutral-50"}`,
5543
+ onClick: () => B(g.id),
5544
+ children: [
5545
+ /* @__PURE__ */ f.jsx("span", { className: `material-icons text-lg ${k ? "text-blue-500" : "text-neutral-300"}`, children: k ? "check_box" : "check_box_outline_blank" }),
5546
+ /* @__PURE__ */ f.jsx("div", { className: "flex-1 min-w-0", children: e(g, k, y) })
5547
+ ]
5548
+ },
5549
+ g.id
5550
+ );
5551
+ }) }),
5552
+ n.length > 0 && c.size > 0 && /* @__PURE__ */ f.jsx("div", { className: "flex items-center gap-2 pt-2 border-t border-neutral-100", children: n.map((g) => {
5553
+ var y;
5554
+ const k = ((y = g.disabled) == null ? void 0 : y.call(g, D)) ?? !1;
5555
+ return /* @__PURE__ */ f.jsxs(
5556
+ "button",
5557
+ {
5558
+ onClick: () => U(g.id),
5559
+ disabled: k,
5560
+ className: `flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${k ? "bg-neutral-100 text-neutral-400 cursor-not-allowed" : "bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,
5561
+ children: [
5562
+ g.icon && /* @__PURE__ */ f.jsx("span", { className: "material-icons text-sm", children: g.icon }),
5563
+ g.label
5564
+ ]
5565
+ },
5566
+ g.id
5567
+ );
5568
+ }) })
5453
5569
  ] });
5454
5570
  }
5455
5571
  export {
@@ -5462,9 +5578,10 @@ export {
5462
5578
  yr as GraphClient,
5463
5579
  kr as Mail,
5464
5580
  cr as MailClient,
5465
- xr as Stack,
5581
+ Fr as SelectableList,
5582
+ Er as Stack,
5466
5583
  Ct as getApiClient,
5467
- vr as initializeApiClient,
5468
- Er as useMutation,
5584
+ xr as initializeApiClient,
5585
+ vr as useMutation,
5469
5586
  pr as useQuery
5470
5587
  };