tauri-notice-window 1.0.12 → 1.0.14

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,8 +1,8 @@
1
1
  import { create as ce } from "zustand";
2
2
  import { syncTabs as we } from "zustand-sync";
3
3
  import de from "dexie";
4
- import { useCallback as P, useState as L, useEffect as G } from "react";
5
- import { jsx as N, Fragment as he } from "react/jsx-runtime";
4
+ import { useCallback as I, useState as L, useEffect as G } from "react";
5
+ import { jsx as z, Fragment as he } from "react/jsx-runtime";
6
6
  const K = "tauri-notice-config", Q = {
7
7
  routePrefix: "/notice",
8
8
  databaseName: "tauri-notice-db",
@@ -27,7 +27,7 @@ const K = "tauri-notice-config", Q = {
27
27
  } catch (e) {
28
28
  console.warn("Failed to save config to localStorage:", e);
29
29
  }
30
- }, He = (t) => {
30
+ }, Ve = (t) => {
31
31
  const i = { ...X(), ...t };
32
32
  ge(i);
33
33
  }, ee = () => X();
@@ -39,14 +39,14 @@ class ye extends de {
39
39
  });
40
40
  }
41
41
  }
42
- let W = null;
42
+ let S = null;
43
43
  const te = () => {
44
- if (!W) {
44
+ if (!S) {
45
45
  const t = ee();
46
- W = new ye(t.databaseName);
46
+ S = new ye(t.databaseName);
47
47
  }
48
- return W;
49
- }, g = () => W || te(), be = async (t) => {
48
+ return S;
49
+ }, g = () => S || te(), be = async (t) => {
50
50
  const e = {
51
51
  ...t,
52
52
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -93,9 +93,9 @@ const te = () => {
93
93
  console.log(`Message ${i.id} was already shown, skipping`);
94
94
  return;
95
95
  }
96
- if (await pe(i.id) || await be(i), !n.queue.some((u) => u.id === i.id)) {
97
- const u = [...n.queue, i];
98
- t({ queue: u }), await e().persistQueue();
96
+ if (await pe(i.id) || await be(i), !n.queue.some((c) => c.id === i.id)) {
97
+ const c = [...n.queue, i];
98
+ t({ queue: c }), await e().persistQueue();
99
99
  }
100
100
  !n.isProcessing && !n.currentMessage && await e().showNext();
101
101
  },
@@ -201,18 +201,18 @@ const te = () => {
201
201
  const n = e(), a = String(i);
202
202
  return n.activeWindowIds.includes(a);
203
203
  }
204
- }), c = ce()(
204
+ }), w = ce()(
205
205
  we(Ne, {
206
206
  name: "tauri-notice-queue"
207
207
  })
208
- ), z = {
208
+ ), M = {
209
209
  queueLength: (t) => t.queue.length,
210
210
  currentMessage: (t) => t.currentMessage,
211
211
  isProcessing: (t) => t.isProcessing,
212
212
  queue: (t) => t.queue
213
- }, Ve = () => {
214
- const t = c((i) => i.enqueue);
215
- return { showNotice: P(
213
+ }, $e = () => {
214
+ const t = w((i) => i.enqueue);
215
+ return { showNotice: I(
216
216
  async (i) => {
217
217
  await t(i);
218
218
  },
@@ -227,8 +227,8 @@ function Me(t, e, i, n, a) {
227
227
  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");
228
228
  return e.set(t, i), i;
229
229
  }
230
- var M;
231
- const d = "__TAURI_TO_IPC_KEY__";
230
+ var O;
231
+ const h = "__TAURI_TO_IPC_KEY__";
232
232
  function Oe(t, e = !1) {
233
233
  return window.__TAURI_INTERNALS__.transformCallback(t, e);
234
234
  }
@@ -237,10 +237,10 @@ async function s(t, e = {}, i) {
237
237
  }
238
238
  class xe {
239
239
  get rid() {
240
- return ze(this, M, "f");
240
+ return ze(this, O, "f");
241
241
  }
242
242
  constructor(e) {
243
- M.set(this, void 0), Me(this, M, e);
243
+ O.set(this, void 0), Me(this, O, e);
244
244
  }
245
245
  /**
246
246
  * Destroys and cleans up this resource from memory.
@@ -252,7 +252,7 @@ class xe {
252
252
  });
253
253
  }
254
254
  }
255
- M = /* @__PURE__ */ new WeakMap();
255
+ O = /* @__PURE__ */ new WeakMap();
256
256
  class ne {
257
257
  constructor(...e) {
258
258
  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]);
@@ -275,14 +275,14 @@ class ne {
275
275
  toPhysical(e) {
276
276
  return new b(this.width * e, this.height * e);
277
277
  }
278
- [d]() {
278
+ [h]() {
279
279
  return {
280
280
  width: this.width,
281
281
  height: this.height
282
282
  };
283
283
  }
284
284
  toJSON() {
285
- return this[d]();
285
+ return this[h]();
286
286
  }
287
287
  }
288
288
  class b {
@@ -303,14 +303,14 @@ class b {
303
303
  toLogical(e) {
304
304
  return new ne(this.width / e, this.height / e);
305
305
  }
306
- [d]() {
306
+ [h]() {
307
307
  return {
308
308
  width: this.width,
309
309
  height: this.height
310
310
  };
311
311
  }
312
312
  toJSON() {
313
- return this[d]();
313
+ return this[h]();
314
314
  }
315
315
  }
316
316
  class y {
@@ -323,7 +323,7 @@ class y {
323
323
  toPhysical(e) {
324
324
  return this.size instanceof b ? this.size : this.size.toPhysical(e);
325
325
  }
326
- [d]() {
326
+ [h]() {
327
327
  return {
328
328
  [`${this.size.type}`]: {
329
329
  width: this.size.width,
@@ -332,7 +332,7 @@ class y {
332
332
  };
333
333
  }
334
334
  toJSON() {
335
- return this[d]();
335
+ return this[h]();
336
336
  }
337
337
  }
338
338
  class se {
@@ -355,19 +355,19 @@ class se {
355
355
  * @since 2.0.0
356
356
  */
357
357
  toPhysical(e) {
358
- return new w(this.x * e, this.y * e);
358
+ return new d(this.x * e, this.y * e);
359
359
  }
360
- [d]() {
360
+ [h]() {
361
361
  return {
362
362
  x: this.x,
363
363
  y: this.y
364
364
  };
365
365
  }
366
366
  toJSON() {
367
- return this[d]();
367
+ return this[h]();
368
368
  }
369
369
  }
370
- class w {
370
+ class d {
371
371
  constructor(...e) {
372
372
  this.type = "Physical", e.length === 1 ? "Physical" in e[0] ? (this.x = e[0].Physical.x, this.y = e[0].Physical.y) : (this.x = e[0].x, this.y = e[0].y) : (this.x = e[0], this.y = e[1]);
373
373
  }
@@ -389,17 +389,17 @@ class w {
389
389
  toLogical(e) {
390
390
  return new se(this.x / e, this.y / e);
391
391
  }
392
- [d]() {
392
+ [h]() {
393
393
  return {
394
394
  x: this.x,
395
395
  y: this.y
396
396
  };
397
397
  }
398
398
  toJSON() {
399
- return this[d]();
399
+ return this[h]();
400
400
  }
401
401
  }
402
- class p {
402
+ class _ {
403
403
  constructor(e) {
404
404
  this.position = e;
405
405
  }
@@ -407,9 +407,9 @@ class p {
407
407
  return this.position instanceof se ? this.position : this.position.toLogical(e);
408
408
  }
409
409
  toPhysical(e) {
410
- return this.position instanceof w ? this.position : this.position.toPhysical(e);
410
+ return this.position instanceof d ? this.position : this.position.toPhysical(e);
411
411
  }
412
- [d]() {
412
+ [h]() {
413
413
  return {
414
414
  [`${this.position.type}`]: {
415
415
  x: this.position.x,
@@ -418,7 +418,7 @@ class p {
418
418
  };
419
419
  }
420
420
  toJSON() {
421
- return this[d]();
421
+ return this[h]();
422
422
  }
423
423
  }
424
424
  var o;
@@ -431,7 +431,7 @@ async function ae(t, e) {
431
431
  eventId: e
432
432
  });
433
433
  }
434
- async function I(t, e, i) {
434
+ async function k(t, e, i) {
435
435
  var n;
436
436
  const a = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
437
437
  return s("plugin:event|listen", {
@@ -441,7 +441,7 @@ async function I(t, e, i) {
441
441
  }).then((l) => async () => ae(t, l));
442
442
  }
443
443
  async function F(t, e, i) {
444
- return I(t, (n) => {
444
+ return k(t, (n) => {
445
445
  ae(t, n.id), e(n);
446
446
  }, i);
447
447
  }
@@ -458,7 +458,7 @@ async function le(t, e, i) {
458
458
  payload: i
459
459
  });
460
460
  }
461
- class S extends xe {
461
+ class D extends xe {
462
462
  /**
463
463
  * Creates an Image from a resource ID. For internal use only.
464
464
  *
@@ -470,10 +470,10 @@ class S extends xe {
470
470
  /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
471
471
  static async new(e, i, n) {
472
472
  return s("plugin:image|new", {
473
- rgba: x(e),
473
+ rgba: P(e),
474
474
  width: i,
475
475
  height: n
476
- }).then((a) => new S(a));
476
+ }).then((a) => new D(a));
477
477
  }
478
478
  /**
479
479
  * Creates a new image using the provided bytes by inferring the file format.
@@ -490,8 +490,8 @@ class S extends xe {
490
490
  */
491
491
  static async fromBytes(e) {
492
492
  return s("plugin:image|from_bytes", {
493
- bytes: x(e)
494
- }).then((i) => new S(i));
493
+ bytes: P(e)
494
+ }).then((i) => new D(i));
495
495
  }
496
496
  /**
497
497
  * Creates a new image using the provided path.
@@ -506,7 +506,7 @@ class S extends xe {
506
506
  * ```
507
507
  */
508
508
  static async fromPath(e) {
509
- return s("plugin:image|from_path", { path: e }).then((i) => new S(i));
509
+ return s("plugin:image|from_path", { path: e }).then((i) => new D(i));
510
510
  }
511
511
  /** Returns the RGBA data for this image, in row-major order from top to bottom. */
512
512
  async rgba() {
@@ -519,8 +519,8 @@ class S extends xe {
519
519
  return s("plugin:image|size", { rid: this.rid });
520
520
  }
521
521
  }
522
- function x(t) {
523
- return t == null ? null : typeof t == "string" ? t : t instanceof S ? t.rid : t;
522
+ function P(t) {
523
+ return t == null ? null : typeof t == "string" ? t : t instanceof D ? t.rid : t;
524
524
  }
525
525
  var q;
526
526
  (function(t) {
@@ -542,19 +542,19 @@ var H;
542
542
  t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
543
543
  })(H || (H = {}));
544
544
  function oe() {
545
- return new k(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
545
+ return new C(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
546
546
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
547
547
  skip: !0
548
548
  });
549
549
  }
550
550
  async function E() {
551
- return s("plugin:window|get_all_windows").then((t) => t.map((e) => new k(e, {
551
+ return s("plugin:window|get_all_windows").then((t) => t.map((e) => new C(e, {
552
552
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
553
553
  skip: !0
554
554
  })));
555
555
  }
556
556
  const R = ["tauri://created", "tauri://error"];
557
- class k {
557
+ class C {
558
558
  /**
559
559
  * Creates a new Window.
560
560
  * @example
@@ -648,7 +648,7 @@ class k {
648
648
  return this._handleTauriEvent(e, i) ? () => {
649
649
  const n = this.listeners[e];
650
650
  n.splice(n.indexOf(i), 1);
651
- } : I(e, i, {
651
+ } : k(e, i, {
652
652
  target: { kind: "Window", label: this.label }
653
653
  });
654
654
  }
@@ -759,7 +759,7 @@ class k {
759
759
  async innerPosition() {
760
760
  return s("plugin:window|inner_position", {
761
761
  label: this.label
762
- }).then((e) => new w(e));
762
+ }).then((e) => new d(e));
763
763
  }
764
764
  /**
765
765
  * The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
@@ -774,7 +774,7 @@ class k {
774
774
  async outerPosition() {
775
775
  return s("plugin:window|outer_position", {
776
776
  label: this.label
777
- }).then((e) => new w(e));
777
+ }).then((e) => new d(e));
778
778
  }
779
779
  /**
780
780
  * The physical size of the window's client area.
@@ -1533,7 +1533,7 @@ class k {
1533
1533
  async setPosition(e) {
1534
1534
  return s("plugin:window|set_position", {
1535
1535
  label: this.label,
1536
- value: e instanceof p ? e : new p(e)
1536
+ value: e instanceof _ ? e : new _(e)
1537
1537
  });
1538
1538
  }
1539
1539
  /**
@@ -1627,7 +1627,7 @@ class k {
1627
1627
  async setIcon(e) {
1628
1628
  return s("plugin:window|set_icon", {
1629
1629
  label: this.label,
1630
- value: x(e)
1630
+ value: P(e)
1631
1631
  });
1632
1632
  }
1633
1633
  /**
@@ -1745,7 +1745,7 @@ class k {
1745
1745
  async setCursorPosition(e) {
1746
1746
  return s("plugin:window|set_cursor_position", {
1747
1747
  label: this.label,
1748
- value: e instanceof p ? e : new p(e)
1748
+ value: e instanceof _ ? e : new _(e)
1749
1749
  });
1750
1750
  }
1751
1751
  /**
@@ -1862,7 +1862,7 @@ class k {
1862
1862
  async setOverlayIcon(e) {
1863
1863
  return s("plugin:window|set_overlay_icon", {
1864
1864
  label: this.label,
1865
- value: e ? x(e) : void 0
1865
+ value: e ? P(e) : void 0
1866
1866
  });
1867
1867
  }
1868
1868
  /**
@@ -1974,7 +1974,7 @@ class k {
1974
1974
  */
1975
1975
  async onMoved(e) {
1976
1976
  return this.listen(o.WINDOW_MOVED, (i) => {
1977
- i.payload = new w(i.payload), e(i);
1977
+ i.payload = new d(i.payload), e(i);
1978
1978
  });
1979
1979
  }
1980
1980
  /**
@@ -2037,7 +2037,7 @@ class k {
2037
2037
  payload: {
2038
2038
  type: "enter",
2039
2039
  paths: r.payload.paths,
2040
- position: new w(r.payload.position)
2040
+ position: new d(r.payload.position)
2041
2041
  }
2042
2042
  });
2043
2043
  }), n = await this.listen(o.DRAG_OVER, (r) => {
@@ -2045,7 +2045,7 @@ class k {
2045
2045
  ...r,
2046
2046
  payload: {
2047
2047
  type: "over",
2048
- position: new w(r.payload.position)
2048
+ position: new d(r.payload.position)
2049
2049
  }
2050
2050
  });
2051
2051
  }), a = await this.listen(o.DRAG_DROP, (r) => {
@@ -2054,7 +2054,7 @@ class k {
2054
2054
  payload: {
2055
2055
  type: "drop",
2056
2056
  paths: r.payload.paths,
2057
- position: new w(r.payload.position)
2057
+ position: new d(r.payload.position)
2058
2058
  }
2059
2059
  });
2060
2060
  }), l = await this.listen(o.DRAG_LEAVE, (r) => {
@@ -2156,10 +2156,10 @@ function Ie(t) {
2156
2156
  return t === null ? null : {
2157
2157
  name: t.name,
2158
2158
  scaleFactor: t.scaleFactor,
2159
- position: new w(t.position),
2159
+ position: new d(t.position),
2160
2160
  size: new b(t.size),
2161
2161
  workArea: {
2162
- position: new w(t.workArea.position),
2162
+ position: new d(t.workArea.position),
2163
2163
  size: new b(t.workArea.size)
2164
2164
  }
2165
2165
  };
@@ -2174,7 +2174,7 @@ function ue() {
2174
2174
  });
2175
2175
  }
2176
2176
  async function Z() {
2177
- return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new B(new k(e.windowLabel, {
2177
+ return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new B(new C(e.windowLabel, {
2178
2178
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2179
2179
  skip: !0
2180
2180
  }), e.label, {
@@ -2275,7 +2275,7 @@ class B {
2275
2275
  return this._handleTauriEvent(e, i) ? () => {
2276
2276
  const n = this.listeners[e];
2277
2277
  n.splice(n.indexOf(i), 1);
2278
- } : I(e, i, {
2278
+ } : k(e, i, {
2279
2279
  target: { kind: "Webview", label: this.label }
2280
2280
  });
2281
2281
  }
@@ -2373,7 +2373,7 @@ class B {
2373
2373
  async position() {
2374
2374
  return s("plugin:webview|webview_position", {
2375
2375
  label: this.label
2376
- }).then((e) => new w(e));
2376
+ }).then((e) => new d(e));
2377
2377
  }
2378
2378
  /**
2379
2379
  * The physical size of the webview's client area.
@@ -2438,7 +2438,7 @@ class B {
2438
2438
  async setPosition(e) {
2439
2439
  return s("plugin:webview|set_webview_position", {
2440
2440
  label: this.label,
2441
- value: e instanceof p ? e : new p(e)
2441
+ value: e instanceof _ ? e : new _(e)
2442
2442
  });
2443
2443
  }
2444
2444
  /**
@@ -2600,7 +2600,7 @@ class B {
2600
2600
  payload: {
2601
2601
  type: "enter",
2602
2602
  paths: r.payload.paths,
2603
- position: new w(r.payload.position)
2603
+ position: new d(r.payload.position)
2604
2604
  }
2605
2605
  });
2606
2606
  }), n = await this.listen(o.DRAG_OVER, (r) => {
@@ -2608,7 +2608,7 @@ class B {
2608
2608
  ...r,
2609
2609
  payload: {
2610
2610
  type: "over",
2611
- position: new w(r.payload.position)
2611
+ position: new d(r.payload.position)
2612
2612
  }
2613
2613
  });
2614
2614
  }), a = await this.listen(o.DRAG_DROP, (r) => {
@@ -2617,7 +2617,7 @@ class B {
2617
2617
  payload: {
2618
2618
  type: "drop",
2619
2619
  paths: r.payload.paths,
2620
- position: new w(r.payload.position)
2620
+ position: new d(r.payload.position)
2621
2621
  }
2622
2622
  });
2623
2623
  }), l = await this.listen(o.DRAG_LEAVE, (r) => {
@@ -2628,17 +2628,17 @@ class B {
2628
2628
  };
2629
2629
  }
2630
2630
  }
2631
- function O() {
2631
+ function x() {
2632
2632
  const t = ue();
2633
- return new _(t.label, { skip: !0 });
2633
+ return new f(t.label, { skip: !0 });
2634
2634
  }
2635
2635
  async function Y() {
2636
- return s("plugin:window|get_all_windows").then((t) => t.map((e) => new _(e, {
2636
+ return s("plugin:window|get_all_windows").then((t) => t.map((e) => new f(e, {
2637
2637
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2638
2638
  skip: !0
2639
2639
  })));
2640
2640
  }
2641
- class _ {
2641
+ class f {
2642
2642
  /**
2643
2643
  * Creates a new {@link Window} hosting a {@link Webview}.
2644
2644
  * @example
@@ -2682,13 +2682,13 @@ class _ {
2682
2682
  static async getByLabel(e) {
2683
2683
  var i;
2684
2684
  const n = (i = (await Y()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
2685
- return n ? new _(n.label, { skip: !0 }) : null;
2685
+ return n ? new f(n.label, { skip: !0 }) : null;
2686
2686
  }
2687
2687
  /**
2688
2688
  * Get an instance of `Webview` for the current webview.
2689
2689
  */
2690
2690
  static getCurrent() {
2691
- return O();
2691
+ return x();
2692
2692
  }
2693
2693
  /**
2694
2694
  * Gets a list of instances of `Webview` for all available webviews.
@@ -2719,7 +2719,7 @@ class _ {
2719
2719
  return this._handleTauriEvent(e, i) ? () => {
2720
2720
  const n = this.listeners[e];
2721
2721
  n.splice(n.indexOf(i), 1);
2722
- } : I(e, i, {
2722
+ } : k(e, i, {
2723
2723
  target: { kind: "WebviewWindow", label: this.label }
2724
2724
  });
2725
2725
  }
@@ -2770,7 +2770,7 @@ class _ {
2770
2770
  return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
2771
2771
  }
2772
2772
  }
2773
- Ce(_, [k, B]);
2773
+ Ce(f, [C, B]);
2774
2774
  function Ce(t, e) {
2775
2775
  (Array.isArray(e) ? e : [e]).forEach((i) => {
2776
2776
  Object.getOwnPropertyNames(i.prototype).forEach((n) => {
@@ -2784,23 +2784,23 @@ function Ce(t, e) {
2784
2784
  });
2785
2785
  });
2786
2786
  }
2787
- const D = /* @__PURE__ */ new Map(), Le = (t) => {
2787
+ const A = /* @__PURE__ */ new Map(), Le = () => navigator.platform.toLowerCase().includes("mac") || navigator.userAgent.toLowerCase().includes("mac"), Ee = (t) => {
2788
2788
  if (!t || t.trim() === "") return !1;
2789
2789
  try {
2790
2790
  return !!(t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("tauri://"));
2791
2791
  } catch {
2792
2792
  return !1;
2793
2793
  }
2794
- }, Ee = async (t, e, i) => {
2794
+ }, Re = async (t, e, i) => {
2795
2795
  const n = i?.padding ?? 20;
2796
2796
  if (i?.x !== void 0 && i?.y !== void 0)
2797
2797
  return { x: i.x, y: i.y };
2798
2798
  let a = 1920, l = 1080;
2799
2799
  try {
2800
- const u = await ke();
2801
- u?.size && (a = u.size.width, l = u.size.height);
2802
- } catch (u) {
2803
- console.warn("Failed to get monitor info, using defaults:", u);
2800
+ const c = await ke();
2801
+ c?.size && (a = c.size.width, l = c.size.height);
2802
+ } catch (c) {
2803
+ console.warn("Failed to get monitor info, using defaults:", c);
2804
2804
  }
2805
2805
  switch (i?.position ?? "right-bottom") {
2806
2806
  case "right-bottom":
@@ -2834,140 +2834,141 @@ const D = /* @__PURE__ */ new Map(), Le = (t) => {
2834
2834
  y: l - e - n
2835
2835
  };
2836
2836
  }
2837
- }, Re = async (t) => {
2838
- const e = String(t.id), i = c.getState();
2837
+ }, Te = async (t) => {
2838
+ const e = String(t.id), i = w.getState();
2839
2839
  if (i.isWindowActive(e)) {
2840
2840
  console.log(`Notice window already open for message: ${e}`);
2841
2841
  return;
2842
2842
  }
2843
2843
  const n = ee(), a = `notice-${e}`;
2844
2844
  let l = `${n.routePrefix}/${t.type}?id=${t.id}`;
2845
- Le(l) || (console.warn(`Invalid window URL: ${l}. Using fallback 404 page.`), l = n.notFoundUrl || "/404");
2846
- const r = t.min_width || n.defaultWidth, u = t.min_height || n.defaultHeight, f = t.decorations ?? n.defaultDecorations ?? !0, { x: m, y: A } = await Ee(r, u, t.windowPosition);
2845
+ Ee(l) || (console.warn(`Invalid window URL: ${l}. Using fallback 404 page.`), l = n.notFoundUrl || "/404");
2846
+ const r = t.min_width || n.defaultWidth, c = t.min_height || n.defaultHeight, m = t.decorations ?? n.defaultDecorations ?? !0, { x: v, y: N } = await Re(r, c, t.windowPosition);
2847
2847
  try {
2848
- const h = new _(a, {
2848
+ const u = {
2849
2849
  url: l,
2850
2850
  title: t.title,
2851
2851
  width: r,
2852
- height: u,
2853
- x: m,
2854
- y: A,
2852
+ height: c,
2853
+ x: v,
2854
+ y: N,
2855
2855
  resizable: !0,
2856
- decorations: f,
2857
2856
  skipTaskbar: !1,
2858
2857
  alwaysOnTop: !0
2859
- });
2860
- D.set(e, h), i.addActiveWindow(e), h.once("tauri://destroyed", async () => {
2861
- D.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
2858
+ };
2859
+ m ? u.decorations = !0 : Le() ? (u.decorations = !0, u.titleBarStyle = "overlay", u.hiddenTitle = !0) : (u.decorations = !1, u.transparent = !0);
2860
+ const p = new f(a, u);
2861
+ A.set(e, p), i.addActiveWindow(e), p.once("tauri://destroyed", async () => {
2862
+ A.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
2862
2863
  }), console.log(`Created notice window: ${a}`);
2863
- } catch (h) {
2864
- console.error("Failed to create notice window:", h), i.removeActiveWindow(e), i.clearCurrent();
2864
+ } catch (u) {
2865
+ console.error("Failed to create notice window:", u), i.removeActiveWindow(e), i.clearCurrent();
2865
2866
  }
2866
2867
  }, U = async (t) => {
2867
- const e = String(t), i = D.get(e), n = c.getState();
2868
+ const e = String(t), i = A.get(e), n = w.getState();
2868
2869
  if (i)
2869
2870
  try {
2870
- await i.close(), D.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
2871
+ await i.close(), A.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
2871
2872
  } catch (a) {
2872
2873
  console.error("Failed to close notice window:", a);
2873
2874
  }
2874
- }, Te = async () => {
2875
- const t = Array.from(D.keys()).map(
2875
+ }, qe = async () => {
2876
+ const t = Array.from(A.keys()).map(
2876
2877
  (e) => U(e)
2877
2878
  );
2878
2879
  await Promise.all(t);
2879
- }, qe = () => {
2880
+ }, Fe = () => {
2880
2881
  let t = null;
2881
- c.subscribe((e) => {
2882
+ w.subscribe((e) => {
2882
2883
  const i = e.currentMessage;
2883
- i && i !== t ? (t = i, Re(i)) : i || (t = null);
2884
+ i && i !== t ? (t = i, Te(i)) : i || (t = null);
2884
2885
  }), console.log("Notice window system initialized");
2885
- }, $e = () => {
2886
- const t = c((i) => i.currentMessage);
2887
- return { closeNotice: P(async () => {
2886
+ }, je = () => {
2887
+ const t = w((i) => i.currentMessage);
2888
+ return { closeNotice: I(async () => {
2888
2889
  t && await U(t.id);
2889
2890
  }, [t]) };
2890
- }, je = () => {
2891
- const t = c((i) => i.hideMessage);
2892
- return { hideNotice: P(
2891
+ }, Je = () => {
2892
+ const t = w((i) => i.hideMessage);
2893
+ return { hideNotice: I(
2893
2894
  async (i) => {
2894
2895
  await t(i), await U(i);
2895
2896
  },
2896
2897
  [t]
2897
2898
  ) };
2898
- }, Je = () => {
2899
- const t = c((i) => i.clearOnLogout);
2900
- return { hideAllNotices: P(async () => {
2901
- await Te(), await t();
2902
- }, [t]) };
2903
2899
  }, Ze = () => {
2904
- const t = c(z.queueLength), e = c(z.currentMessage), i = c(z.isProcessing), n = c(z.queue);
2900
+ const t = w((i) => i.clearOnLogout);
2901
+ return { hideAllNotices: I(async () => {
2902
+ await qe(), await t();
2903
+ }, [t]) };
2904
+ }, Ye = () => {
2905
+ const t = w(M.queueLength), e = w(M.currentMessage), i = w(M.isProcessing), n = w(M.queue);
2905
2906
  return {
2906
2907
  queueLength: t,
2907
2908
  currentMessage: e,
2908
2909
  isProcessing: i,
2909
2910
  queue: n
2910
2911
  };
2911
- }, Ye = ({ children: t, onLoad: e, onClose: i }) => {
2912
- const [n, a] = L(null), [l, r] = L(!0), [u, f] = L(null);
2912
+ }, Ke = ({ children: t, onLoad: e, onClose: i }) => {
2913
+ const [n, a] = L(null), [l, r] = L(!0), [c, m] = L(null);
2913
2914
  return G(() => {
2914
2915
  (async () => {
2915
2916
  try {
2916
- const h = new URLSearchParams(window.location.search).get("id");
2917
- if (!h) {
2918
- f("No message ID provided"), r(!1), setTimeout(async () => {
2917
+ const u = new URLSearchParams(window.location.search).get("id");
2918
+ if (!u) {
2919
+ m("No message ID provided"), r(!1), setTimeout(async () => {
2919
2920
  try {
2920
- await O().close();
2921
- } catch (v) {
2922
- console.error("Failed to close window:", v);
2921
+ await x().close();
2922
+ } catch (W) {
2923
+ console.error("Failed to close window:", W);
2923
2924
  }
2924
2925
  }, 1e3);
2925
2926
  return;
2926
2927
  }
2927
- const C = await ie(h);
2928
- if (!C) {
2929
- console.log(`Message ${h} not found in database, closing window`), f("Message not found"), r(!1), setTimeout(async () => {
2928
+ const p = await ie(u);
2929
+ if (!p) {
2930
+ console.log(`Message ${u} not found in database, closing window`), m("Message not found"), r(!1), setTimeout(async () => {
2930
2931
  try {
2931
- await O().close();
2932
- } catch (v) {
2933
- console.error("Failed to close window:", v);
2932
+ await x().close();
2933
+ } catch (W) {
2934
+ console.error("Failed to close window:", W);
2934
2935
  }
2935
2936
  }, 500);
2936
2937
  return;
2937
2938
  }
2938
- a(C), r(!1), e && e(C);
2939
- } catch (A) {
2940
- console.error("Failed to load message:", A), f("Failed to load message"), r(!1), setTimeout(async () => {
2939
+ a(p), r(!1), e && e(p);
2940
+ } catch (N) {
2941
+ console.error("Failed to load message:", N), m("Failed to load message"), r(!1), setTimeout(async () => {
2941
2942
  try {
2942
- await O().close();
2943
- } catch (h) {
2944
- console.error("Failed to close window:", h);
2943
+ await x().close();
2944
+ } catch (u) {
2945
+ console.error("Failed to close window:", u);
2945
2946
  }
2946
2947
  }, 1e3);
2947
2948
  }
2948
2949
  })();
2949
2950
  }, [e]), G(() => {
2950
2951
  if (!n || !i) return;
2951
- const m = () => {
2952
+ const v = () => {
2952
2953
  i(n);
2953
2954
  };
2954
- return window.addEventListener("beforeunload", m), () => {
2955
- window.removeEventListener("beforeunload", m);
2955
+ return window.addEventListener("beforeunload", v), () => {
2956
+ window.removeEventListener("beforeunload", v);
2956
2957
  };
2957
- }, [n, i]), l ? /* @__PURE__ */ N("div", { style: {
2958
+ }, [n, i]), l ? /* @__PURE__ */ z("div", { style: {
2958
2959
  display: "flex",
2959
2960
  justifyContent: "center",
2960
2961
  alignItems: "center",
2961
2962
  height: "100vh",
2962
2963
  fontFamily: "system-ui, -apple-system, sans-serif"
2963
- }, children: "Loading..." }) : u ? /* @__PURE__ */ N("div", { style: {
2964
+ }, children: "Loading..." }) : c ? /* @__PURE__ */ z("div", { style: {
2964
2965
  display: "flex",
2965
2966
  justifyContent: "center",
2966
2967
  alignItems: "center",
2967
2968
  height: "100vh",
2968
2969
  fontFamily: "system-ui, -apple-system, sans-serif",
2969
2970
  color: "#ef4444"
2970
- }, children: u }) : n ? /* @__PURE__ */ N(he, { children: t(n) }) : /* @__PURE__ */ N("div", { style: {
2971
+ }, children: c }) : n ? /* @__PURE__ */ z(he, { children: t(n) }) : /* @__PURE__ */ z("div", { style: {
2971
2972
  display: "flex",
2972
2973
  justifyContent: "center",
2973
2974
  alignItems: "center",
@@ -2975,38 +2976,38 @@ const D = /* @__PURE__ */ new Map(), Le = (t) => {
2975
2976
  fontFamily: "system-ui, -apple-system, sans-serif",
2976
2977
  color: "#ef4444"
2977
2978
  }, children: "Closing window..." });
2978
- }, Ke = async () => {
2979
- te(), qe();
2980
- const { initializeFromDatabase: t } = c.getState();
2979
+ }, Xe = async () => {
2980
+ te(), Fe();
2981
+ const { initializeFromDatabase: t } = w.getState();
2981
2982
  await t(), console.log("Tauri Notice System initialized");
2982
- }, Xe = async (t) => {
2983
- await c.getState().deleteMessage(t);
2984
2983
  }, et = async (t) => {
2985
- await c.getState().hideMessage(t);
2984
+ await w.getState().deleteMessage(t);
2986
2985
  }, tt = async (t) => {
2987
- await c.getState().markMessageAsShown(t);
2986
+ await w.getState().hideMessage(t);
2987
+ }, it = async (t) => {
2988
+ await w.getState().markMessageAsShown(t);
2988
2989
  };
2989
2990
  export {
2990
- Ye as NoticeLayout,
2991
- Te as closeAllNoticeWindows,
2991
+ Ke as NoticeLayout,
2992
+ qe as closeAllNoticeWindows,
2992
2993
  U as closeNoticeWindow,
2993
- Re as createNoticeWindow,
2994
- Xe as deleteMessageById,
2994
+ Te as createNoticeWindow,
2995
+ et as deleteMessageById,
2995
2996
  ie as getMessage,
2996
2997
  ee as getNoticeConfig,
2997
2998
  fe as getPendingMessages,
2998
- et as hideMessageById,
2999
+ tt as hideMessageById,
2999
3000
  te as initializeDatabase,
3000
- Ke as initializeNoticeSystem,
3001
- qe as initializeNoticeWindowSystem,
3002
- tt as markMessageAsShown,
3003
- z as messageQueueSelectors,
3004
- He as setNoticeConfig,
3005
- $e as useCloseNotice,
3006
- Je as useHideAllNotices,
3007
- je as useHideNotice,
3008
- Ze as useMessageQueue,
3009
- c as useMessageQueueStore,
3010
- Ve as useNoticeWindow
3001
+ Xe as initializeNoticeSystem,
3002
+ Fe as initializeNoticeWindowSystem,
3003
+ it as markMessageAsShown,
3004
+ M as messageQueueSelectors,
3005
+ Ve as setNoticeConfig,
3006
+ je as useCloseNotice,
3007
+ Ze as useHideAllNotices,
3008
+ Je as useHideNotice,
3009
+ Ye as useMessageQueue,
3010
+ w as useMessageQueueStore,
3011
+ $e as useNoticeWindow
3011
3012
  };
3012
3013
  //# sourceMappingURL=index.js.map