tauri-notice-window 1.0.8 → 1.0.9

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.js CHANGED
@@ -1,35 +1,35 @@
1
- import { create as oe } from "zustand";
2
- import { syncTabs as ue } from "zustand-sync";
3
- import ce from "dexie";
4
- import { useCallback as A, useState as x, useEffect as B } from "react";
5
- import { jsx as k, Fragment as de } from "react/jsx-runtime";
6
- const Z = "tauri-notice-config", U = {
1
+ import { create as ge } from "zustand";
2
+ import { syncTabs as ye } from "zustand-sync";
3
+ import be from "dexie";
4
+ import { useCallback as I, useState as E, useEffect as G } from "react";
5
+ import { jsx as A, Fragment as pe } from "react/jsx-runtime";
6
+ const K = "tauri-notice-config", Q = {
7
7
  routePrefix: "/notice",
8
8
  databaseName: "tauri-notice-db",
9
9
  defaultWidth: 400,
10
10
  defaultHeight: 300,
11
11
  notFoundUrl: "/404"
12
12
  // Default 404 page
13
- }, Y = () => {
13
+ }, X = () => {
14
14
  try {
15
- const t = localStorage.getItem(Z);
15
+ const t = localStorage.getItem(K);
16
16
  if (t)
17
- return { ...U, ...JSON.parse(t) };
17
+ return { ...Q, ...JSON.parse(t) };
18
18
  } catch (t) {
19
19
  console.warn("Failed to load config from localStorage:", t);
20
20
  }
21
- return U;
22
- }, we = (t) => {
21
+ return Q;
22
+ }, _e = (t) => {
23
23
  try {
24
- localStorage.setItem(Z, JSON.stringify(t));
24
+ localStorage.setItem(K, JSON.stringify(t));
25
25
  } catch (e) {
26
26
  console.warn("Failed to save config to localStorage:", e);
27
27
  }
28
- }, Ge = (t) => {
29
- const i = { ...Y(), ...t };
30
- we(i);
31
- }, K = () => Y();
32
- class he extends ce {
28
+ }, He = (t) => {
29
+ const i = { ...X(), ...t };
30
+ _e(i);
31
+ }, ee = () => X();
32
+ class fe extends be {
33
33
  messages;
34
34
  constructor(e) {
35
35
  super(e), this.version(1).stores({
@@ -37,14 +37,14 @@ class he extends ce {
37
37
  });
38
38
  }
39
39
  }
40
- let v = null;
41
- const X = () => {
42
- if (!v) {
43
- const t = K();
44
- v = new he(t.databaseName);
45
- }
46
- return v;
47
- }, h = () => v || X(), ge = async (t) => {
40
+ let D = null;
41
+ const te = () => {
42
+ if (!D) {
43
+ const t = ee();
44
+ D = new fe(t.databaseName);
45
+ }
46
+ return D;
47
+ }, h = () => D || te(), me = async (t) => {
48
48
  const e = {
49
49
  ...t,
50
50
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -54,30 +54,36 @@ const X = () => {
54
54
  queuePosition: 0
55
55
  };
56
56
  await h().messages.put(e);
57
- }, be = async (t) => !!await h().messages.get(t), ye = async (t) => {
57
+ }, ve = async (t) => !!await h().messages.get(t), We = async (t) => {
58
58
  const e = await h().messages.get(t);
59
59
  return e?.isShown === !0 || e?.queueStatus === "shown";
60
- }, pe = async () => await h().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), _e = async (t, e) => {
60
+ }, Se = async () => await h().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), De = async (t, e) => {
61
61
  await h().messages.update(t, { queueStatus: e });
62
- }, ee = async (t) => {
62
+ }, ie = async (t) => {
63
63
  await h().messages.update(t, {
64
64
  queueStatus: "shown",
65
65
  isShown: !0
66
66
  });
67
- }, fe = async (t) => {
67
+ }, Ne = async (t) => {
68
68
  await h().messages.update(t, {
69
69
  queueStatus: "hidden"
70
70
  });
71
- }, me = async (t) => await h().messages.get(t), He = async (t) => {
71
+ }, ne = async (t) => await h().messages.get(t), Ve = async (t) => {
72
72
  await h().messages.delete(t);
73
- }, ve = async () => {
73
+ try {
74
+ const { useMessageQueueStore: e } = await Promise.resolve().then(() => Pe), { removeFromQueue: i } = e.getState();
75
+ i(t);
76
+ } catch (e) {
77
+ console.warn("Failed to remove message from queue store:", e);
78
+ }
79
+ }, ze = async () => {
74
80
  await h().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
75
- }, We = async (t) => {
81
+ }, Ae = async (t) => {
76
82
  const e = t.map(
77
83
  (i) => h().messages.update(i.id, { queuePosition: i.position })
78
84
  );
79
85
  await Promise.all(e);
80
- }, Se = (t, e) => ({
86
+ }, Oe = (t, e) => ({
81
87
  // Initial state
82
88
  queue: [],
83
89
  currentMessage: null,
@@ -87,11 +93,11 @@ const X = () => {
87
93
  // Enqueue a new message
88
94
  enqueue: async (i) => {
89
95
  const n = e();
90
- if (await ye(i.id)) {
96
+ if (await We(i.id)) {
91
97
  console.log(`Message ${i.id} was already shown, skipping`);
92
98
  return;
93
99
  }
94
- if (await be(i.id) || await ge(i), !n.queue.some((u) => u.id === i.id)) {
100
+ if (await ve(i.id) || await me(i), !n.queue.some((u) => u.id === i.id)) {
95
101
  const u = [...n.queue, i];
96
102
  t({ queue: u }), await e().persistQueue();
97
103
  }
@@ -112,10 +118,14 @@ const X = () => {
112
118
  t({ isProcessing: !1, currentMessage: null });
113
119
  return;
114
120
  }
121
+ if (!await ne(n.id)) {
122
+ console.log(`Message ${n.id} was deleted, skipping to next`), await e().showNext();
123
+ return;
124
+ }
115
125
  t({
116
126
  currentMessage: n,
117
127
  isProcessing: !0
118
- }), await _e(n.id, "showing"), await e().persistQueue();
128
+ }), await De(n.id, "showing"), await e().persistQueue();
119
129
  },
120
130
  // Clear current message and show next
121
131
  clearCurrent: () => {
@@ -140,16 +150,16 @@ const X = () => {
140
150
  initializeFromDatabase: async () => {
141
151
  if (e().initialized) return;
142
152
  t({ initialized: !0 });
143
- const n = await pe();
153
+ const n = await Se();
144
154
  n.length > 0 && (t({ queue: n }), await e().showNext());
145
155
  },
146
156
  // Persist queue to database
147
157
  persistQueue: async () => {
148
- const n = e().queue.map((a, r) => ({
158
+ const n = e().queue.map((a, l) => ({
149
159
  id: a.id,
150
- position: r
160
+ position: l
151
161
  }));
152
- await We(n);
162
+ await Ae(n);
153
163
  },
154
164
  // Clear all messages on logout
155
165
  clearOnLogout: async () => {
@@ -159,7 +169,19 @@ const X = () => {
159
169
  isProcessing: !1,
160
170
  activeWindowIds: [],
161
171
  initialized: !1
162
- }), await ve();
172
+ }), await ze();
173
+ },
174
+ // Remove a specific message from the queue by ID
175
+ removeFromQueue: (i) => {
176
+ const n = e(), a = n.queue.filter((l) => l.id !== i);
177
+ t({ queue: a }), n.currentMessage?.id === i && (async () => {
178
+ try {
179
+ const { closeNoticeWindow: r } = await Promise.resolve().then(() => Fe);
180
+ await r(i);
181
+ } catch (r) {
182
+ console.warn("Failed to close notice window:", r), e().clearCurrent();
183
+ }
184
+ })();
163
185
  },
164
186
  // Add active window ID
165
187
  addActiveWindow: (i) => {
@@ -170,7 +192,7 @@ const X = () => {
170
192
  removeActiveWindow: (i) => {
171
193
  const n = e(), a = String(i);
172
194
  t({
173
- activeWindowIds: n.activeWindowIds.filter((r) => r !== a)
195
+ activeWindowIds: n.activeWindowIds.filter((l) => l !== a)
174
196
  });
175
197
  },
176
198
  // Check if window is active
@@ -178,46 +200,50 @@ const X = () => {
178
200
  const n = e(), a = String(i);
179
201
  return n.activeWindowIds.includes(a);
180
202
  }
181
- }), d = oe()(
182
- ue(Se, {
203
+ }), w = ge()(
204
+ ye(Oe, {
183
205
  name: "tauri-notice-queue"
184
206
  })
185
- ), D = {
207
+ ), S = {
186
208
  queueLength: (t) => t.queue.length,
187
209
  currentMessage: (t) => t.currentMessage,
188
210
  isProcessing: (t) => t.isProcessing,
189
211
  queue: (t) => t.queue
190
- }, Ve = () => {
191
- const t = d((i) => i.enqueue);
192
- return { showNotice: A(
212
+ }, Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
213
+ __proto__: null,
214
+ messageQueueSelectors: S,
215
+ useMessageQueueStore: w
216
+ }, Symbol.toStringTag, { value: "Module" })), $e = () => {
217
+ const t = w((i) => i.enqueue);
218
+ return { showNotice: I(
193
219
  async (i) => {
194
220
  await t(i);
195
221
  },
196
222
  [t]
197
223
  ) };
198
224
  };
199
- function De(t, e, i, n) {
225
+ function xe(t, e, i, n) {
200
226
  if (typeof e == "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
201
227
  return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
202
228
  }
203
- function Ne(t, e, i, n, a) {
229
+ function Ie(t, e, i, n, a) {
204
230
  if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
205
231
  return e.set(t, i), i;
206
232
  }
207
- var N;
208
- const w = "__TAURI_TO_IPC_KEY__";
209
- function ze(t, e = !1) {
233
+ var O;
234
+ const d = "__TAURI_TO_IPC_KEY__";
235
+ function Me(t, e = !1) {
210
236
  return window.__TAURI_INTERNALS__.transformCallback(t, e);
211
237
  }
212
238
  async function s(t, e = {}, i) {
213
239
  return window.__TAURI_INTERNALS__.invoke(t, e, i);
214
240
  }
215
- class Ae {
241
+ class ke {
216
242
  get rid() {
217
- return De(this, N, "f");
243
+ return xe(this, O, "f");
218
244
  }
219
245
  constructor(e) {
220
- N.set(this, void 0), Ne(this, N, e);
246
+ O.set(this, void 0), Ie(this, O, e);
221
247
  }
222
248
  /**
223
249
  * Destroys and cleans up this resource from memory.
@@ -229,8 +255,8 @@ class Ae {
229
255
  });
230
256
  }
231
257
  }
232
- N = /* @__PURE__ */ new WeakMap();
233
- class te {
258
+ O = /* @__PURE__ */ new WeakMap();
259
+ class se {
234
260
  constructor(...e) {
235
261
  this.type = "Logical", e.length === 1 ? "Logical" in e[0] ? (this.width = e[0].Logical.width, this.height = e[0].Logical.height) : (this.width = e[0].width, this.height = e[0].height) : (this.width = e[0], this.height = e[1]);
236
262
  }
@@ -250,19 +276,19 @@ class te {
250
276
  * @since 2.0.0
251
277
  */
252
278
  toPhysical(e) {
253
- return new b(this.width * e, this.height * e);
279
+ return new y(this.width * e, this.height * e);
254
280
  }
255
- [w]() {
281
+ [d]() {
256
282
  return {
257
283
  width: this.width,
258
284
  height: this.height
259
285
  };
260
286
  }
261
287
  toJSON() {
262
- return this[w]();
288
+ return this[d]();
263
289
  }
264
290
  }
265
- class b {
291
+ class y {
266
292
  constructor(...e) {
267
293
  this.type = "Physical", e.length === 1 ? "Physical" in e[0] ? (this.width = e[0].Physical.width, this.height = e[0].Physical.height) : (this.width = e[0].width, this.height = e[0].height) : (this.width = e[0], this.height = e[1]);
268
294
  }
@@ -278,16 +304,16 @@ class b {
278
304
  * ```
279
305
  */
280
306
  toLogical(e) {
281
- return new te(this.width / e, this.height / e);
307
+ return new se(this.width / e, this.height / e);
282
308
  }
283
- [w]() {
309
+ [d]() {
284
310
  return {
285
311
  width: this.width,
286
312
  height: this.height
287
313
  };
288
314
  }
289
315
  toJSON() {
290
- return this[w]();
316
+ return this[d]();
291
317
  }
292
318
  }
293
319
  class g {
@@ -295,12 +321,12 @@ class g {
295
321
  this.size = e;
296
322
  }
297
323
  toLogical(e) {
298
- return this.size instanceof te ? this.size : this.size.toLogical(e);
324
+ return this.size instanceof se ? this.size : this.size.toLogical(e);
299
325
  }
300
326
  toPhysical(e) {
301
- return this.size instanceof b ? this.size : this.size.toPhysical(e);
327
+ return this.size instanceof y ? this.size : this.size.toPhysical(e);
302
328
  }
303
- [w]() {
329
+ [d]() {
304
330
  return {
305
331
  [`${this.size.type}`]: {
306
332
  width: this.size.width,
@@ -309,10 +335,10 @@ class g {
309
335
  };
310
336
  }
311
337
  toJSON() {
312
- return this[w]();
338
+ return this[d]();
313
339
  }
314
340
  }
315
- class ie {
341
+ class ae {
316
342
  constructor(...e) {
317
343
  this.type = "Logical", e.length === 1 ? "Logical" in e[0] ? (this.x = e[0].Logical.x, this.y = e[0].Logical.y) : (this.x = e[0].x, this.y = e[0].y) : (this.x = e[0], this.y = e[1]);
318
344
  }
@@ -334,14 +360,14 @@ class ie {
334
360
  toPhysical(e) {
335
361
  return new c(this.x * e, this.y * e);
336
362
  }
337
- [w]() {
363
+ [d]() {
338
364
  return {
339
365
  x: this.x,
340
366
  y: this.y
341
367
  };
342
368
  }
343
369
  toJSON() {
344
- return this[w]();
370
+ return this[d]();
345
371
  }
346
372
  }
347
373
  class c {
@@ -364,29 +390,29 @@ class c {
364
390
  * @since 2.0.0
365
391
  */
366
392
  toLogical(e) {
367
- return new ie(this.x / e, this.y / e);
393
+ return new ae(this.x / e, this.y / e);
368
394
  }
369
- [w]() {
395
+ [d]() {
370
396
  return {
371
397
  x: this.x,
372
398
  y: this.y
373
399
  };
374
400
  }
375
401
  toJSON() {
376
- return this[w]();
402
+ return this[d]();
377
403
  }
378
404
  }
379
- class p {
405
+ class _ {
380
406
  constructor(e) {
381
407
  this.position = e;
382
408
  }
383
409
  toLogical(e) {
384
- return this.position instanceof ie ? this.position : this.position.toLogical(e);
410
+ return this.position instanceof ae ? this.position : this.position.toLogical(e);
385
411
  }
386
412
  toPhysical(e) {
387
413
  return this.position instanceof c ? this.position : this.position.toPhysical(e);
388
414
  }
389
- [w]() {
415
+ [d]() {
390
416
  return {
391
417
  [`${this.position.type}`]: {
392
418
  x: this.position.x,
@@ -395,47 +421,47 @@ class p {
395
421
  };
396
422
  }
397
423
  toJSON() {
398
- return this[w]();
424
+ return this[d]();
399
425
  }
400
426
  }
401
427
  var o;
402
428
  (function(t) {
403
429
  t.WINDOW_RESIZED = "tauri://resize", t.WINDOW_MOVED = "tauri://move", t.WINDOW_CLOSE_REQUESTED = "tauri://close-requested", t.WINDOW_DESTROYED = "tauri://destroyed", t.WINDOW_FOCUS = "tauri://focus", t.WINDOW_BLUR = "tauri://blur", t.WINDOW_SCALE_FACTOR_CHANGED = "tauri://scale-change", t.WINDOW_THEME_CHANGED = "tauri://theme-changed", t.WINDOW_CREATED = "tauri://window-created", t.WEBVIEW_CREATED = "tauri://webview-created", t.DRAG_ENTER = "tauri://drag-enter", t.DRAG_OVER = "tauri://drag-over", t.DRAG_DROP = "tauri://drag-drop", t.DRAG_LEAVE = "tauri://drag-leave";
404
430
  })(o || (o = {}));
405
- async function ne(t, e) {
431
+ async function re(t, e) {
406
432
  window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await s("plugin:event|unlisten", {
407
433
  event: t,
408
434
  eventId: e
409
435
  });
410
436
  }
411
- async function O(t, e, i) {
437
+ async function M(t, e, i) {
412
438
  var n;
413
439
  const a = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
414
440
  return s("plugin:event|listen", {
415
441
  event: t,
416
442
  target: a,
417
- handler: ze(e)
418
- }).then((r) => async () => ne(t, r));
443
+ handler: Me(e)
444
+ }).then((l) => async () => re(t, l));
419
445
  }
420
- async function E(t, e, i) {
421
- return O(t, (n) => {
422
- ne(t, n.id), e(n);
446
+ async function B(t, e, i) {
447
+ return M(t, (n) => {
448
+ re(t, n.id), e(n);
423
449
  }, i);
424
450
  }
425
- async function se(t, e) {
451
+ async function le(t, e) {
426
452
  await s("plugin:event|emit", {
427
453
  event: t,
428
454
  payload: e
429
455
  });
430
456
  }
431
- async function ae(t, e, i) {
457
+ async function oe(t, e, i) {
432
458
  await s("plugin:event|emit_to", {
433
459
  target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
434
460
  event: e,
435
461
  payload: i
436
462
  });
437
463
  }
438
- class W extends Ae {
464
+ class N extends ke {
439
465
  /**
440
466
  * Creates an Image from a resource ID. For internal use only.
441
467
  *
@@ -447,10 +473,10 @@ class W extends Ae {
447
473
  /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
448
474
  static async new(e, i, n) {
449
475
  return s("plugin:image|new", {
450
- rgba: z(e),
476
+ rgba: x(e),
451
477
  width: i,
452
478
  height: n
453
- }).then((a) => new W(a));
479
+ }).then((a) => new N(a));
454
480
  }
455
481
  /**
456
482
  * Creates a new image using the provided bytes by inferring the file format.
@@ -467,8 +493,8 @@ class W extends Ae {
467
493
  */
468
494
  static async fromBytes(e) {
469
495
  return s("plugin:image|from_bytes", {
470
- bytes: z(e)
471
- }).then((i) => new W(i));
496
+ bytes: x(e)
497
+ }).then((i) => new N(i));
472
498
  }
473
499
  /**
474
500
  * Creates a new image using the provided path.
@@ -483,7 +509,7 @@ class W extends Ae {
483
509
  * ```
484
510
  */
485
511
  static async fromPath(e) {
486
- return s("plugin:image|from_path", { path: e }).then((i) => new W(i));
512
+ return s("plugin:image|from_path", { path: e }).then((i) => new N(i));
487
513
  }
488
514
  /** Returns the RGBA data for this image, in row-major order from top to bottom. */
489
515
  async rgba() {
@@ -496,14 +522,14 @@ class W extends Ae {
496
522
  return s("plugin:image|size", { rid: this.rid });
497
523
  }
498
524
  }
499
- function z(t) {
500
- return t == null ? null : typeof t == "string" ? t : t instanceof W ? t.rid : t;
525
+ function x(t) {
526
+ return t == null ? null : typeof t == "string" ? t : t instanceof N ? t.rid : t;
501
527
  }
502
- var R;
528
+ var F;
503
529
  (function(t) {
504
530
  t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
505
- })(R || (R = {}));
506
- class Oe {
531
+ })(F || (F = {}));
532
+ class Ce {
507
533
  constructor(e) {
508
534
  this._preventDefault = !1, this.event = e.event, this.id = e.id;
509
535
  }
@@ -514,24 +540,24 @@ class Oe {
514
540
  return this._preventDefault;
515
541
  }
516
542
  }
517
- var G;
543
+ var j;
518
544
  (function(t) {
519
545
  t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
520
- })(G || (G = {}));
521
- function le() {
522
- return new P(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
546
+ })(j || (j = {}));
547
+ function ue() {
548
+ return new k(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
523
549
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
524
550
  skip: !0
525
551
  });
526
552
  }
527
- async function L() {
528
- return s("plugin:window|get_all_windows").then((t) => t.map((e) => new P(e, {
553
+ async function R() {
554
+ return s("plugin:window|get_all_windows").then((t) => t.map((e) => new k(e, {
529
555
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
530
556
  skip: !0
531
557
  })));
532
558
  }
533
- const M = ["tauri://created", "tauri://error"];
534
- class P {
559
+ const T = ["tauri://created", "tauri://error"];
560
+ class k {
535
561
  /**
536
562
  * Creates a new Window.
537
563
  * @example
@@ -572,19 +598,19 @@ class P {
572
598
  */
573
599
  static async getByLabel(e) {
574
600
  var i;
575
- return (i = (await L()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
601
+ return (i = (await R()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
576
602
  }
577
603
  /**
578
604
  * Get an instance of `Window` for the current window.
579
605
  */
580
606
  static getCurrent() {
581
- return le();
607
+ return ue();
582
608
  }
583
609
  /**
584
610
  * Gets a list of instances of `Window` for all available windows.
585
611
  */
586
612
  static async getAll() {
587
- return L();
613
+ return R();
588
614
  }
589
615
  /**
590
616
  * Gets the focused window.
@@ -597,7 +623,7 @@ class P {
597
623
  * @returns The Window instance or `undefined` if there is not any focused window.
598
624
  */
599
625
  static async getFocusedWindow() {
600
- for (const e of await L())
626
+ for (const e of await R())
601
627
  if (await e.isFocused())
602
628
  return e;
603
629
  return null;
@@ -625,7 +651,7 @@ class P {
625
651
  return this._handleTauriEvent(e, i) ? () => {
626
652
  const n = this.listeners[e];
627
653
  n.splice(n.indexOf(i), 1);
628
- } : O(e, i, {
654
+ } : M(e, i, {
629
655
  target: { kind: "Window", label: this.label }
630
656
  });
631
657
  }
@@ -652,7 +678,7 @@ class P {
652
678
  return this._handleTauriEvent(e, i) ? () => {
653
679
  const n = this.listeners[e];
654
680
  n.splice(n.indexOf(i), 1);
655
- } : E(e, i, {
681
+ } : B(e, i, {
656
682
  target: { kind: "Window", label: this.label }
657
683
  });
658
684
  }
@@ -668,7 +694,7 @@ class P {
668
694
  * @param payload Event payload.
669
695
  */
670
696
  async emit(e, i) {
671
- if (M.includes(e)) {
697
+ if (T.includes(e)) {
672
698
  for (const n of this.listeners[e] || [])
673
699
  n({
674
700
  event: e,
@@ -677,7 +703,7 @@ class P {
677
703
  });
678
704
  return;
679
705
  }
680
- return se(e, i);
706
+ return le(e, i);
681
707
  }
682
708
  /**
683
709
  * Emits an event to all {@link EventTarget|targets} matching the given target.
@@ -692,7 +718,7 @@ class P {
692
718
  * @param payload Event payload.
693
719
  */
694
720
  async emitTo(e, i, n) {
695
- if (M.includes(i)) {
721
+ if (T.includes(i)) {
696
722
  for (const a of this.listeners[i] || [])
697
723
  a({
698
724
  event: i,
@@ -701,11 +727,11 @@ class P {
701
727
  });
702
728
  return;
703
729
  }
704
- return ae(e, i, n);
730
+ return oe(e, i, n);
705
731
  }
706
732
  /** @ignore */
707
733
  _handleTauriEvent(e, i) {
708
- return M.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
734
+ return T.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
709
735
  }
710
736
  // Getters
711
737
  /**
@@ -767,7 +793,7 @@ class P {
767
793
  async innerSize() {
768
794
  return s("plugin:window|inner_size", {
769
795
  label: this.label
770
- }).then((e) => new b(e));
796
+ }).then((e) => new y(e));
771
797
  }
772
798
  /**
773
799
  * The physical size of the entire window.
@@ -783,7 +809,7 @@ class P {
783
809
  async outerSize() {
784
810
  return s("plugin:window|outer_size", {
785
811
  label: this.label
786
- }).then((e) => new b(e));
812
+ }).then((e) => new y(e));
787
813
  }
788
814
  /**
789
815
  * Gets the window's current fullscreen state.
@@ -1034,7 +1060,7 @@ class P {
1034
1060
  */
1035
1061
  async requestUserAttention(e) {
1036
1062
  let i = null;
1037
- return e && (e === R.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
1063
+ return e && (e === F.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
1038
1064
  label: this.label,
1039
1065
  value: i
1040
1066
  });
@@ -1510,7 +1536,7 @@ class P {
1510
1536
  async setPosition(e) {
1511
1537
  return s("plugin:window|set_position", {
1512
1538
  label: this.label,
1513
- value: e instanceof p ? e : new p(e)
1539
+ value: e instanceof _ ? e : new _(e)
1514
1540
  });
1515
1541
  }
1516
1542
  /**
@@ -1604,7 +1630,7 @@ class P {
1604
1630
  async setIcon(e) {
1605
1631
  return s("plugin:window|set_icon", {
1606
1632
  label: this.label,
1607
- value: z(e)
1633
+ value: x(e)
1608
1634
  });
1609
1635
  }
1610
1636
  /**
@@ -1722,7 +1748,7 @@ class P {
1722
1748
  async setCursorPosition(e) {
1723
1749
  return s("plugin:window|set_cursor_position", {
1724
1750
  label: this.label,
1725
- value: e instanceof p ? e : new p(e)
1751
+ value: e instanceof _ ? e : new _(e)
1726
1752
  });
1727
1753
  }
1728
1754
  /**
@@ -1839,7 +1865,7 @@ class P {
1839
1865
  async setOverlayIcon(e) {
1840
1866
  return s("plugin:window|set_overlay_icon", {
1841
1867
  label: this.label,
1842
- value: e ? z(e) : void 0
1868
+ value: e ? x(e) : void 0
1843
1869
  });
1844
1870
  }
1845
1871
  /**
@@ -1929,7 +1955,7 @@ class P {
1929
1955
  */
1930
1956
  async onResized(e) {
1931
1957
  return this.listen(o.WINDOW_RESIZED, (i) => {
1932
- i.payload = new b(i.payload), e(i);
1958
+ i.payload = new y(i.payload), e(i);
1933
1959
  });
1934
1960
  }
1935
1961
  /**
@@ -1978,7 +2004,7 @@ class P {
1978
2004
  */
1979
2005
  async onCloseRequested(e) {
1980
2006
  return this.listen(o.WINDOW_CLOSE_REQUESTED, async (i) => {
1981
- const n = new Oe(i);
2007
+ const n = new Ce(i);
1982
2008
  await e(n), n.isPreventDefault() || await this.destroy();
1983
2009
  });
1984
2010
  }
@@ -2008,37 +2034,37 @@ class P {
2008
2034
  * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
2009
2035
  */
2010
2036
  async onDragDropEvent(e) {
2011
- const i = await this.listen(o.DRAG_ENTER, (l) => {
2037
+ const i = await this.listen(o.DRAG_ENTER, (r) => {
2012
2038
  e({
2013
- ...l,
2039
+ ...r,
2014
2040
  payload: {
2015
2041
  type: "enter",
2016
- paths: l.payload.paths,
2017
- position: new c(l.payload.position)
2042
+ paths: r.payload.paths,
2043
+ position: new c(r.payload.position)
2018
2044
  }
2019
2045
  });
2020
- }), n = await this.listen(o.DRAG_OVER, (l) => {
2046
+ }), n = await this.listen(o.DRAG_OVER, (r) => {
2021
2047
  e({
2022
- ...l,
2048
+ ...r,
2023
2049
  payload: {
2024
2050
  type: "over",
2025
- position: new c(l.payload.position)
2051
+ position: new c(r.payload.position)
2026
2052
  }
2027
2053
  });
2028
- }), a = await this.listen(o.DRAG_DROP, (l) => {
2054
+ }), a = await this.listen(o.DRAG_DROP, (r) => {
2029
2055
  e({
2030
- ...l,
2056
+ ...r,
2031
2057
  payload: {
2032
2058
  type: "drop",
2033
- paths: l.payload.paths,
2034
- position: new c(l.payload.position)
2059
+ paths: r.payload.paths,
2060
+ position: new c(r.payload.position)
2035
2061
  }
2036
2062
  });
2037
- }), r = await this.listen(o.DRAG_LEAVE, (l) => {
2038
- e({ ...l, payload: { type: "leave" } });
2063
+ }), l = await this.listen(o.DRAG_LEAVE, (r) => {
2064
+ e({ ...r, payload: { type: "leave" } });
2039
2065
  });
2040
2066
  return () => {
2041
- i(), a(), n(), r();
2067
+ i(), a(), n(), l();
2042
2068
  };
2043
2069
  }
2044
2070
  /**
@@ -2121,37 +2147,37 @@ var V;
2121
2147
  (function(t) {
2122
2148
  t.Default = "default", t.FluentOverlay = "fluentOverlay";
2123
2149
  })(V || (V = {}));
2124
- var Q;
2150
+ var $;
2125
2151
  (function(t) {
2126
2152
  t.AppearanceBased = "appearanceBased", t.Light = "light", t.Dark = "dark", t.MediumLight = "mediumLight", t.UltraDark = "ultraDark", t.Titlebar = "titlebar", t.Selection = "selection", t.Menu = "menu", t.Popover = "popover", t.Sidebar = "sidebar", t.HeaderView = "headerView", t.Sheet = "sheet", t.WindowBackground = "windowBackground", t.HudWindow = "hudWindow", t.FullScreenUI = "fullScreenUI", t.Tooltip = "tooltip", t.ContentBackground = "contentBackground", t.UnderWindowBackground = "underWindowBackground", t.UnderPageBackground = "underPageBackground", t.Mica = "mica", t.Blur = "blur", t.Acrylic = "acrylic", t.Tabbed = "tabbed", t.TabbedDark = "tabbedDark", t.TabbedLight = "tabbedLight";
2127
- })(Q || (Q = {}));
2128
- var j;
2153
+ })($ || ($ = {}));
2154
+ var J;
2129
2155
  (function(t) {
2130
2156
  t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
2131
- })(j || (j = {}));
2132
- function Pe(t) {
2157
+ })(J || (J = {}));
2158
+ function Le(t) {
2133
2159
  return t === null ? null : {
2134
2160
  name: t.name,
2135
2161
  scaleFactor: t.scaleFactor,
2136
2162
  position: new c(t.position),
2137
- size: new b(t.size),
2163
+ size: new y(t.size),
2138
2164
  workArea: {
2139
2165
  position: new c(t.workArea.position),
2140
- size: new b(t.workArea.size)
2166
+ size: new y(t.workArea.size)
2141
2167
  }
2142
2168
  };
2143
2169
  }
2144
- async function Ie() {
2145
- return s("plugin:window|primary_monitor").then(Pe);
2170
+ async function Ee() {
2171
+ return s("plugin:window|primary_monitor").then(Le);
2146
2172
  }
2147
- function re() {
2148
- return new T(le(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
2173
+ function ce() {
2174
+ return new U(ue(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
2149
2175
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2150
2176
  skip: !0
2151
2177
  });
2152
2178
  }
2153
- async function $() {
2154
- return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new T(new P(e.windowLabel, {
2179
+ async function Z() {
2180
+ return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new U(new k(e.windowLabel, {
2155
2181
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2156
2182
  skip: !0
2157
2183
  }), e.label, {
@@ -2159,8 +2185,8 @@ async function $() {
2159
2185
  skip: !0
2160
2186
  })));
2161
2187
  }
2162
- const C = ["tauri://created", "tauri://error"];
2163
- class T {
2188
+ const q = ["tauri://created", "tauri://error"];
2189
+ class U {
2164
2190
  /**
2165
2191
  * Creates a new Webview.
2166
2192
  * @example
@@ -2215,19 +2241,19 @@ class T {
2215
2241
  */
2216
2242
  static async getByLabel(e) {
2217
2243
  var i;
2218
- return (i = (await $()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
2244
+ return (i = (await Z()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
2219
2245
  }
2220
2246
  /**
2221
2247
  * Get an instance of `Webview` for the current webview.
2222
2248
  */
2223
2249
  static getCurrent() {
2224
- return re();
2250
+ return ce();
2225
2251
  }
2226
2252
  /**
2227
2253
  * Gets a list of instances of `Webview` for all available webviews.
2228
2254
  */
2229
2255
  static async getAll() {
2230
- return $();
2256
+ return Z();
2231
2257
  }
2232
2258
  /**
2233
2259
  * Listen to an emitted event on this webview.
@@ -2252,7 +2278,7 @@ class T {
2252
2278
  return this._handleTauriEvent(e, i) ? () => {
2253
2279
  const n = this.listeners[e];
2254
2280
  n.splice(n.indexOf(i), 1);
2255
- } : O(e, i, {
2281
+ } : M(e, i, {
2256
2282
  target: { kind: "Webview", label: this.label }
2257
2283
  });
2258
2284
  }
@@ -2279,7 +2305,7 @@ class T {
2279
2305
  return this._handleTauriEvent(e, i) ? () => {
2280
2306
  const n = this.listeners[e];
2281
2307
  n.splice(n.indexOf(i), 1);
2282
- } : E(e, i, {
2308
+ } : B(e, i, {
2283
2309
  target: { kind: "Webview", label: this.label }
2284
2310
  });
2285
2311
  }
@@ -2296,7 +2322,7 @@ class T {
2296
2322
  * @param payload Event payload.
2297
2323
  */
2298
2324
  async emit(e, i) {
2299
- if (C.includes(e)) {
2325
+ if (q.includes(e)) {
2300
2326
  for (const n of this.listeners[e] || [])
2301
2327
  n({
2302
2328
  event: e,
@@ -2305,7 +2331,7 @@ class T {
2305
2331
  });
2306
2332
  return;
2307
2333
  }
2308
- return se(e, i);
2334
+ return le(e, i);
2309
2335
  }
2310
2336
  /**
2311
2337
  * Emits an event to all {@link EventTarget|targets} matching the given target.
@@ -2321,7 +2347,7 @@ class T {
2321
2347
  * @param payload Event payload.
2322
2348
  */
2323
2349
  async emitTo(e, i, n) {
2324
- if (C.includes(i)) {
2350
+ if (q.includes(i)) {
2325
2351
  for (const a of this.listeners[i] || [])
2326
2352
  a({
2327
2353
  event: i,
@@ -2330,11 +2356,11 @@ class T {
2330
2356
  });
2331
2357
  return;
2332
2358
  }
2333
- return ae(e, i, n);
2359
+ return oe(e, i, n);
2334
2360
  }
2335
2361
  /** @ignore */
2336
2362
  _handleTauriEvent(e, i) {
2337
- return C.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
2363
+ return q.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
2338
2364
  }
2339
2365
  // Getters
2340
2366
  /**
@@ -2366,7 +2392,7 @@ class T {
2366
2392
  async size() {
2367
2393
  return s("plugin:webview|webview_size", {
2368
2394
  label: this.label
2369
- }).then((e) => new b(e));
2395
+ }).then((e) => new y(e));
2370
2396
  }
2371
2397
  // Setters
2372
2398
  /**
@@ -2415,7 +2441,7 @@ class T {
2415
2441
  async setPosition(e) {
2416
2442
  return s("plugin:webview|set_webview_position", {
2417
2443
  label: this.label,
2418
- value: e instanceof p ? e : new p(e)
2444
+ value: e instanceof _ ? e : new _(e)
2419
2445
  });
2420
2446
  }
2421
2447
  /**
@@ -2571,51 +2597,51 @@ class T {
2571
2597
  * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
2572
2598
  */
2573
2599
  async onDragDropEvent(e) {
2574
- const i = await this.listen(o.DRAG_ENTER, (l) => {
2600
+ const i = await this.listen(o.DRAG_ENTER, (r) => {
2575
2601
  e({
2576
- ...l,
2602
+ ...r,
2577
2603
  payload: {
2578
2604
  type: "enter",
2579
- paths: l.payload.paths,
2580
- position: new c(l.payload.position)
2605
+ paths: r.payload.paths,
2606
+ position: new c(r.payload.position)
2581
2607
  }
2582
2608
  });
2583
- }), n = await this.listen(o.DRAG_OVER, (l) => {
2609
+ }), n = await this.listen(o.DRAG_OVER, (r) => {
2584
2610
  e({
2585
- ...l,
2611
+ ...r,
2586
2612
  payload: {
2587
2613
  type: "over",
2588
- position: new c(l.payload.position)
2614
+ position: new c(r.payload.position)
2589
2615
  }
2590
2616
  });
2591
- }), a = await this.listen(o.DRAG_DROP, (l) => {
2617
+ }), a = await this.listen(o.DRAG_DROP, (r) => {
2592
2618
  e({
2593
- ...l,
2619
+ ...r,
2594
2620
  payload: {
2595
2621
  type: "drop",
2596
- paths: l.payload.paths,
2597
- position: new c(l.payload.position)
2622
+ paths: r.payload.paths,
2623
+ position: new c(r.payload.position)
2598
2624
  }
2599
2625
  });
2600
- }), r = await this.listen(o.DRAG_LEAVE, (l) => {
2601
- e({ ...l, payload: { type: "leave" } });
2626
+ }), l = await this.listen(o.DRAG_LEAVE, (r) => {
2627
+ e({ ...r, payload: { type: "leave" } });
2602
2628
  });
2603
2629
  return () => {
2604
- i(), a(), n(), r();
2630
+ i(), a(), n(), l();
2605
2631
  };
2606
2632
  }
2607
2633
  }
2608
- function xe() {
2609
- const t = re();
2610
- return new _(t.label, { skip: !0 });
2634
+ function P() {
2635
+ const t = ce();
2636
+ return new f(t.label, { skip: !0 });
2611
2637
  }
2612
- async function J() {
2613
- return s("plugin:window|get_all_windows").then((t) => t.map((e) => new _(e, {
2638
+ async function Y() {
2639
+ return s("plugin:window|get_all_windows").then((t) => t.map((e) => new f(e, {
2614
2640
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2615
2641
  skip: !0
2616
2642
  })));
2617
2643
  }
2618
- class _ {
2644
+ class f {
2619
2645
  /**
2620
2646
  * Creates a new {@link Window} hosting a {@link Webview}.
2621
2647
  * @example
@@ -2658,20 +2684,20 @@ class _ {
2658
2684
  */
2659
2685
  static async getByLabel(e) {
2660
2686
  var i;
2661
- const n = (i = (await J()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
2662
- return n ? new _(n.label, { skip: !0 }) : null;
2687
+ const n = (i = (await Y()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
2688
+ return n ? new f(n.label, { skip: !0 }) : null;
2663
2689
  }
2664
2690
  /**
2665
2691
  * Get an instance of `Webview` for the current webview.
2666
2692
  */
2667
2693
  static getCurrent() {
2668
- return xe();
2694
+ return P();
2669
2695
  }
2670
2696
  /**
2671
2697
  * Gets a list of instances of `Webview` for all available webviews.
2672
2698
  */
2673
2699
  static async getAll() {
2674
- return J();
2700
+ return Y();
2675
2701
  }
2676
2702
  /**
2677
2703
  * Listen to an emitted event on this webivew window.
@@ -2696,7 +2722,7 @@ class _ {
2696
2722
  return this._handleTauriEvent(e, i) ? () => {
2697
2723
  const n = this.listeners[e];
2698
2724
  n.splice(n.indexOf(i), 1);
2699
- } : O(e, i, {
2725
+ } : M(e, i, {
2700
2726
  target: { kind: "WebviewWindow", label: this.label }
2701
2727
  });
2702
2728
  }
@@ -2723,7 +2749,7 @@ class _ {
2723
2749
  return this._handleTauriEvent(e, i) ? () => {
2724
2750
  const n = this.listeners[e];
2725
2751
  n.splice(n.indexOf(i), 1);
2726
- } : E(e, i, {
2752
+ } : B(e, i, {
2727
2753
  target: { kind: "WebviewWindow", label: this.label }
2728
2754
  });
2729
2755
  }
@@ -2747,8 +2773,8 @@ class _ {
2747
2773
  return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
2748
2774
  }
2749
2775
  }
2750
- ke(_, [P, T]);
2751
- function ke(t, e) {
2776
+ Re(f, [k, U]);
2777
+ function Re(t, e) {
2752
2778
  (Array.isArray(e) ? e : [e]).forEach((i) => {
2753
2779
  Object.getOwnPropertyNames(i.prototype).forEach((n) => {
2754
2780
  var a;
@@ -2761,21 +2787,21 @@ function ke(t, e) {
2761
2787
  });
2762
2788
  });
2763
2789
  }
2764
- const S = /* @__PURE__ */ new Map(), Le = (t) => {
2790
+ const z = /* @__PURE__ */ new Map(), Te = (t) => {
2765
2791
  if (!t || t.trim() === "") return !1;
2766
2792
  try {
2767
2793
  return !!(t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("tauri://"));
2768
2794
  } catch {
2769
2795
  return !1;
2770
2796
  }
2771
- }, Me = async (t, e, i) => {
2797
+ }, qe = async (t, e, i) => {
2772
2798
  const n = i?.padding ?? 20;
2773
2799
  if (i?.x !== void 0 && i?.y !== void 0)
2774
2800
  return { x: i.x, y: i.y };
2775
- let a = 1920, r = 1080;
2801
+ let a = 1920, l = 1080;
2776
2802
  try {
2777
- const u = await Ie();
2778
- u?.size && (a = u.size.width, r = u.size.height);
2803
+ const u = await Ee();
2804
+ u?.size && (a = u.size.width, l = u.size.height);
2779
2805
  } catch (u) {
2780
2806
  console.warn("Failed to get monitor info, using defaults:", u);
2781
2807
  }
@@ -2783,7 +2809,7 @@ const S = /* @__PURE__ */ new Map(), Le = (t) => {
2783
2809
  case "right-bottom":
2784
2810
  return {
2785
2811
  x: a - t - n,
2786
- y: r - e - n
2812
+ y: l - e - n
2787
2813
  };
2788
2814
  case "right-top":
2789
2815
  return {
@@ -2793,7 +2819,7 @@ const S = /* @__PURE__ */ new Map(), Le = (t) => {
2793
2819
  case "left-bottom":
2794
2820
  return {
2795
2821
  x: n,
2796
- y: r - e - n
2822
+ y: l - e - n
2797
2823
  };
2798
2824
  case "left-top":
2799
2825
  return {
@@ -2803,160 +2829,192 @@ const S = /* @__PURE__ */ new Map(), Le = (t) => {
2803
2829
  case "center":
2804
2830
  return {
2805
2831
  x: (a - t) / 2,
2806
- y: (r - e) / 2
2832
+ y: (l - e) / 2
2807
2833
  };
2808
2834
  default:
2809
2835
  return {
2810
2836
  x: a - t - n,
2811
- y: r - e - n
2837
+ y: l - e - n
2812
2838
  };
2813
2839
  }
2814
- }, Ce = async (t) => {
2815
- const e = String(t.id), i = d.getState();
2840
+ }, we = async (t) => {
2841
+ const e = String(t.id), i = w.getState();
2816
2842
  if (i.isWindowActive(e)) {
2817
2843
  console.log(`Notice window already open for message: ${e}`);
2818
2844
  return;
2819
2845
  }
2820
- const n = K(), a = `notice-${e}`;
2821
- let r = `${n.routePrefix}/${t.type}?id=${t.id}`;
2822
- Le(r) || (console.warn(`Invalid window URL: ${r}. Using fallback 404 page.`), r = n.notFoundUrl || "/404");
2823
- const l = t.min_width || n.defaultWidth, u = t.min_height || n.defaultHeight, { x: f, y: m } = await Me(l, u, t.windowPosition);
2846
+ const n = ee(), a = `notice-${e}`;
2847
+ let l = `${n.routePrefix}/${t.type}?id=${t.id}`;
2848
+ Te(l) || (console.warn(`Invalid window URL: ${l}. Using fallback 404 page.`), l = n.notFoundUrl || "/404");
2849
+ const r = t.min_width || n.defaultWidth, u = t.min_height || n.defaultHeight, { x: m, y: v } = await qe(r, u, t.windowPosition);
2824
2850
  try {
2825
- const y = new _(a, {
2826
- url: r,
2851
+ const b = new f(a, {
2852
+ url: l,
2827
2853
  title: t.title,
2828
- width: l,
2854
+ width: r,
2829
2855
  height: u,
2830
- x: f,
2831
- y: m,
2856
+ x: m,
2857
+ y: v,
2832
2858
  resizable: !0,
2833
2859
  decorations: !0,
2834
2860
  skipTaskbar: !1,
2835
2861
  alwaysOnTop: !0
2836
2862
  });
2837
- S.set(e, y), i.addActiveWindow(e), y.once("tauri://destroyed", async () => {
2838
- S.delete(e), i.removeActiveWindow(e), await ee(e), i.clearCurrent();
2863
+ z.set(e, b), i.addActiveWindow(e), b.once("tauri://destroyed", async () => {
2864
+ z.delete(e), i.removeActiveWindow(e), await ie(e), i.clearCurrent();
2839
2865
  }), console.log(`Created notice window: ${a}`);
2840
- } catch (y) {
2841
- console.error("Failed to create notice window:", y), i.removeActiveWindow(e), i.clearCurrent();
2866
+ } catch (b) {
2867
+ console.error("Failed to create notice window:", b), i.removeActiveWindow(e), i.clearCurrent();
2842
2868
  }
2843
- }, q = async (t) => {
2844
- const e = String(t), i = S.get(e), n = d.getState();
2869
+ }, C = async (t) => {
2870
+ const e = String(t), i = z.get(e), n = w.getState();
2845
2871
  if (i)
2846
2872
  try {
2847
- await i.close(), S.delete(e), n.removeActiveWindow(e), await ee(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
2873
+ await i.close(), z.delete(e), n.removeActiveWindow(e), await ie(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
2848
2874
  } catch (a) {
2849
2875
  console.error("Failed to close notice window:", a);
2850
2876
  }
2851
- }, Re = async () => {
2852
- const t = Array.from(S.keys()).map(
2853
- (e) => q(e)
2877
+ }, de = async () => {
2878
+ const t = Array.from(z.keys()).map(
2879
+ (e) => C(e)
2854
2880
  );
2855
2881
  await Promise.all(t);
2856
- }, Ee = () => {
2882
+ }, he = () => {
2857
2883
  let t = null;
2858
- d.subscribe((e) => {
2884
+ w.subscribe((e) => {
2859
2885
  const i = e.currentMessage;
2860
- i && i !== t ? (t = i, Ce(i)) : i || (t = null);
2886
+ i && i !== t ? (t = i, we(i)) : i || (t = null);
2861
2887
  }), console.log("Notice window system initialized");
2862
- }, Qe = () => {
2863
- const t = d((i) => i.currentMessage);
2864
- return { closeNotice: A(async () => {
2865
- t && await q(t.id);
2888
+ }, Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2889
+ __proto__: null,
2890
+ closeAllNoticeWindows: de,
2891
+ closeNoticeWindow: C,
2892
+ createNoticeWindow: we,
2893
+ initializeNoticeWindowSystem: he
2894
+ }, Symbol.toStringTag, { value: "Module" })), Je = () => {
2895
+ const t = w((i) => i.currentMessage);
2896
+ return { closeNotice: I(async () => {
2897
+ t && await C(t.id);
2866
2898
  }, [t]) };
2867
- }, je = () => {
2868
- const t = d();
2869
- return { hideNotice: A(
2899
+ }, Ze = () => {
2900
+ const t = w();
2901
+ return { hideNotice: I(
2870
2902
  async (i) => {
2871
- await fe(i), await q(i), t.currentMessage?.id === i && t.clearCurrent();
2903
+ await Ne(i), await C(i), t.currentMessage?.id === i && t.clearCurrent();
2872
2904
  },
2873
2905
  [t]
2874
2906
  ) };
2875
- }, $e = () => {
2876
- const t = d((i) => i.clearOnLogout);
2877
- return { hideAllNotices: A(async () => {
2878
- await Re(), await t();
2907
+ }, Ye = () => {
2908
+ const t = w((i) => i.clearOnLogout);
2909
+ return { hideAllNotices: I(async () => {
2910
+ await de(), await t();
2879
2911
  }, [t]) };
2880
- }, Je = () => {
2881
- const t = d(D.queueLength), e = d(D.currentMessage), i = d(D.isProcessing), n = d(D.queue);
2912
+ }, Ke = () => {
2913
+ const t = w(S.queueLength), e = w(S.currentMessage), i = w(S.isProcessing), n = w(S.queue);
2882
2914
  return {
2883
2915
  queueLength: t,
2884
2916
  currentMessage: e,
2885
2917
  isProcessing: i,
2886
2918
  queue: n
2887
2919
  };
2888
- }, Ze = ({ children: t, onLoad: e, onClose: i }) => {
2889
- const [n, a] = x(null), [r, l] = x(!0), [u, f] = x(null);
2890
- return B(() => {
2920
+ }, Xe = ({ children: t, onLoad: e, onClose: i }) => {
2921
+ const [n, a] = E(null), [l, r] = E(!0), [u, m] = E(null);
2922
+ return G(() => {
2891
2923
  (async () => {
2892
2924
  try {
2893
- const F = new URLSearchParams(window.location.search).get("id");
2894
- if (!F) {
2895
- f("No message ID provided"), l(!1);
2925
+ const p = new URLSearchParams(window.location.search).get("id");
2926
+ if (!p) {
2927
+ m("No message ID provided"), r(!1), setTimeout(async () => {
2928
+ try {
2929
+ await P().close();
2930
+ } catch (W) {
2931
+ console.error("Failed to close window:", W);
2932
+ }
2933
+ }, 1e3);
2896
2934
  return;
2897
2935
  }
2898
- const I = await me(F);
2899
- if (!I) {
2900
- f("Message not found"), l(!1);
2936
+ const L = await ne(p);
2937
+ if (!L) {
2938
+ console.log(`Message ${p} not found in database, closing window`), m("Message not found"), r(!1), setTimeout(async () => {
2939
+ try {
2940
+ await P().close();
2941
+ } catch (W) {
2942
+ console.error("Failed to close window:", W);
2943
+ }
2944
+ }, 500);
2901
2945
  return;
2902
2946
  }
2903
- a(I), l(!1), e && e(I);
2904
- } catch (y) {
2905
- console.error("Failed to load message:", y), f("Failed to load message"), l(!1);
2947
+ a(L), r(!1), e && e(L);
2948
+ } catch (b) {
2949
+ console.error("Failed to load message:", b), m("Failed to load message"), r(!1), setTimeout(async () => {
2950
+ try {
2951
+ await P().close();
2952
+ } catch (p) {
2953
+ console.error("Failed to close window:", p);
2954
+ }
2955
+ }, 1e3);
2906
2956
  }
2907
2957
  })();
2908
- }, [e]), B(() => {
2958
+ }, [e]), G(() => {
2909
2959
  if (!n || !i) return;
2910
- const m = () => {
2960
+ const v = () => {
2911
2961
  i(n);
2912
2962
  };
2913
- return window.addEventListener("beforeunload", m), () => {
2914
- window.removeEventListener("beforeunload", m);
2963
+ return window.addEventListener("beforeunload", v), () => {
2964
+ window.removeEventListener("beforeunload", v);
2915
2965
  };
2916
- }, [n, i]), r ? /* @__PURE__ */ k("div", { style: {
2966
+ }, [n, i]), l ? /* @__PURE__ */ A("div", { style: {
2917
2967
  display: "flex",
2918
2968
  justifyContent: "center",
2919
2969
  alignItems: "center",
2920
2970
  height: "100vh",
2921
2971
  fontFamily: "system-ui, -apple-system, sans-serif"
2922
- }, children: "Loading..." }) : u || !n ? /* @__PURE__ */ k("div", { style: {
2972
+ }, children: "Loading..." }) : u ? /* @__PURE__ */ A("div", { style: {
2973
+ display: "flex",
2974
+ justifyContent: "center",
2975
+ alignItems: "center",
2976
+ height: "100vh",
2977
+ fontFamily: "system-ui, -apple-system, sans-serif",
2978
+ color: "#ef4444"
2979
+ }, children: u }) : n ? /* @__PURE__ */ A(pe, { children: t(n) }) : /* @__PURE__ */ A("div", { style: {
2923
2980
  display: "flex",
2924
2981
  justifyContent: "center",
2925
2982
  alignItems: "center",
2926
2983
  height: "100vh",
2927
2984
  fontFamily: "system-ui, -apple-system, sans-serif",
2928
2985
  color: "#ef4444"
2929
- }, children: u || "Message not found" }) : /* @__PURE__ */ k(de, { children: t(n) });
2930
- }, Ye = async () => {
2931
- X(), Ee();
2932
- const { initializeFromDatabase: t } = d.getState();
2986
+ }, children: "Closing window..." });
2987
+ }, et = async () => {
2988
+ te(), he();
2989
+ const { initializeFromDatabase: t } = w.getState();
2933
2990
  await t(), console.log("Tauri Notice System initialized");
2934
2991
  };
2935
2992
  export {
2936
- Ze as NoticeLayout,
2937
- ve as clearPendingMessages,
2938
- Re as closeAllNoticeWindows,
2939
- q as closeNoticeWindow,
2940
- Ce as createNoticeWindow,
2941
- He as deleteMessageById,
2942
- me as getMessage,
2943
- K as getNoticeConfig,
2944
- pe as getPendingMessages,
2945
- be as hasMessage,
2946
- X as initializeDatabase,
2947
- Ye as initializeNoticeSystem,
2948
- Ee as initializeNoticeWindowSystem,
2949
- ye as isMessageShown,
2950
- fe as markAsHidden,
2951
- ee as markAsShown,
2952
- D as messageQueueSelectors,
2953
- ge as saveMessage,
2954
- Ge as setNoticeConfig,
2955
- Qe as useCloseNotice,
2956
- $e as useHideAllNotices,
2957
- je as useHideNotice,
2958
- Je as useMessageQueue,
2959
- d as useMessageQueueStore,
2960
- Ve as useNoticeWindow
2993
+ Xe as NoticeLayout,
2994
+ ze as clearPendingMessages,
2995
+ de as closeAllNoticeWindows,
2996
+ C as closeNoticeWindow,
2997
+ we as createNoticeWindow,
2998
+ Ve as deleteMessageById,
2999
+ ne as getMessage,
3000
+ ee as getNoticeConfig,
3001
+ Se as getPendingMessages,
3002
+ ve as hasMessage,
3003
+ te as initializeDatabase,
3004
+ et as initializeNoticeSystem,
3005
+ he as initializeNoticeWindowSystem,
3006
+ We as isMessageShown,
3007
+ Ne as markAsHidden,
3008
+ ie as markAsShown,
3009
+ S as messageQueueSelectors,
3010
+ me as saveMessage,
3011
+ He as setNoticeConfig,
3012
+ De as updateQueueStatus,
3013
+ Je as useCloseNotice,
3014
+ Ye as useHideAllNotices,
3015
+ Ze as useHideNotice,
3016
+ Ke as useMessageQueue,
3017
+ w as useMessageQueueStore,
3018
+ $e as useNoticeWindow
2961
3019
  };
2962
3020
  //# sourceMappingURL=index.js.map