tauri-notice-window 1.0.20 → 1.0.21

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,9 +1,9 @@
1
- import { create as me } from "zustand";
2
- import { syncTabs as _e } from "zustand-sync";
3
- import ve from "dexie";
4
- import { useCallback as F, createContext as Se, useState as L, useRef as X, useEffect as O, useContext as We } from "react";
5
- import { jsx as P } from "react/jsx-runtime";
6
- const le = "tauri-notice-config", ee = {
1
+ import { create as ve } from "zustand";
2
+ import { syncTabs as Se } from "zustand-sync";
3
+ import We from "dexie";
4
+ import { useCallback as q, createContext as ze, useState as R, useRef as te, useEffect as P, useContext as Ae } from "react";
5
+ import { jsx as I } from "react/jsx-runtime";
6
+ const ce = "tauri-notice-config", ie = {
7
7
  routePrefix: "/notice",
8
8
  databaseName: "tauri-notice-db",
9
9
  defaultWidth: 400,
@@ -22,26 +22,26 @@ const le = "tauri-notice-config", ee = {
22
22
  // Max height when auto-sizing
23
23
  autoSizeTimeout: 3e3
24
24
  // Fallback show timeout if measurement fails
25
- }, ue = () => {
25
+ }, we = () => {
26
26
  try {
27
- const t = localStorage.getItem(le);
27
+ const t = localStorage.getItem(ce);
28
28
  if (t)
29
- return { ...ee, ...JSON.parse(t) };
29
+ return { ...ie, ...JSON.parse(t) };
30
30
  } catch (t) {
31
31
  console.warn("Failed to load config from localStorage:", t);
32
32
  }
33
- return ee;
34
- }, ze = (t) => {
33
+ return ie;
34
+ }, Ne = (t) => {
35
35
  try {
36
- localStorage.setItem(le, JSON.stringify(t));
36
+ localStorage.setItem(ce, JSON.stringify(t));
37
37
  } catch (e) {
38
38
  console.warn("Failed to save config to localStorage:", e);
39
39
  }
40
- }, nt = (t) => {
41
- const i = { ...ue(), ...t };
42
- ze(i);
43
- }, q = () => ue();
44
- class Ae extends ve {
40
+ }, at = (t) => {
41
+ const i = { ...we(), ...t };
42
+ Ne(i);
43
+ }, B = () => we();
44
+ class De extends We {
45
45
  messages;
46
46
  constructor(e) {
47
47
  super(e), this.version(1).stores({
@@ -49,14 +49,14 @@ class Ae extends ve {
49
49
  });
50
50
  }
51
51
  }
52
- let I = null;
53
- const ce = () => {
54
- if (!I) {
55
- const t = q();
56
- I = new Ae(t.databaseName);
57
- }
58
- return I;
59
- }, p = () => I || ce(), Ne = async (t) => {
52
+ let k = null;
53
+ const de = () => {
54
+ if (!k) {
55
+ const t = B();
56
+ k = new De(t.databaseName);
57
+ }
58
+ return k;
59
+ }, p = () => k || de(), xe = async (t) => {
60
60
  const e = {
61
61
  ...t,
62
62
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -66,30 +66,30 @@ const ce = () => {
66
66
  queuePosition: 0
67
67
  };
68
68
  await p().messages.put(e);
69
- }, De = async (t) => !!await p().messages.get(t), xe = async (t) => {
69
+ }, Me = async (t) => !!await p().messages.get(t), Oe = async (t) => {
70
70
  const e = await p().messages.get(t);
71
71
  return e?.isShown === !0 || e?.queueStatus === "shown";
72
- }, Me = async () => await p().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), Oe = async (t, e) => {
72
+ }, Pe = async () => await p().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), Ie = async (t, e) => {
73
73
  await p().messages.update(t, { queueStatus: e });
74
- }, Pe = async (t) => {
74
+ }, ke = async (t) => {
75
75
  await p().messages.update(t, {
76
76
  queueStatus: "shown",
77
77
  isShown: !0
78
78
  });
79
- }, Ie = async (t) => {
79
+ }, Ce = async (t) => {
80
80
  await p().messages.update(t, {
81
81
  queueStatus: "hidden"
82
82
  });
83
- }, we = async (t) => await p().messages.get(t), ke = async (t) => {
83
+ }, he = async (t) => await p().messages.get(t), Le = async (t) => {
84
84
  await p().messages.delete(t);
85
- }, Ce = async () => {
85
+ }, Re = async () => {
86
86
  await p().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
87
- }, Le = async (t) => {
87
+ }, Te = async (t) => {
88
88
  const e = t.map(
89
89
  (i) => p().messages.update(i.id, { queuePosition: i.position })
90
90
  );
91
91
  await Promise.all(e);
92
- }, Re = (t, e) => ({
92
+ }, Ee = (t, e) => ({
93
93
  // Initial state
94
94
  queue: [],
95
95
  currentMessage: null,
@@ -99,13 +99,13 @@ const ce = () => {
99
99
  // Enqueue a new message
100
100
  enqueue: async (i) => {
101
101
  const n = e();
102
- if (await xe(i.id)) {
102
+ if (await Oe(i.id)) {
103
103
  console.log(`Message ${i.id} was already shown, skipping`);
104
104
  return;
105
105
  }
106
- if (await De(i.id) || await Ne(i), !n.queue.some((g) => g.id === i.id)) {
107
- const g = [...n.queue, i];
108
- t({ queue: g }), await e().persistQueue();
106
+ if (await Me(i.id) || await xe(i), !n.queue.some((y) => y.id === i.id)) {
107
+ const y = [...n.queue, i];
108
+ t({ queue: y }), await e().persistQueue();
109
109
  }
110
110
  !n.isProcessing && !n.currentMessage && await e().showNext();
111
111
  },
@@ -124,14 +124,14 @@ const ce = () => {
124
124
  t({ isProcessing: !1, currentMessage: null });
125
125
  return;
126
126
  }
127
- if (!await we(n.id)) {
127
+ if (!await he(n.id)) {
128
128
  console.log(`Message ${n.id} was deleted, skipping to next`), await e().showNext();
129
129
  return;
130
130
  }
131
131
  t({
132
132
  currentMessage: n,
133
133
  isProcessing: !0
134
- }), await Oe(n.id, "showing"), await e().persistQueue();
134
+ }), await Ie(n.id, "showing"), await e().persistQueue();
135
135
  },
136
136
  // Clear current message and show next
137
137
  clearCurrent: () => {
@@ -156,7 +156,7 @@ const ce = () => {
156
156
  initializeFromDatabase: async () => {
157
157
  if (e().initialized) return;
158
158
  t({ initialized: !0 });
159
- const n = await Me();
159
+ const n = await Pe();
160
160
  n.length > 0 && (t({ queue: n }), await e().showNext());
161
161
  },
162
162
  // Persist queue to database
@@ -165,7 +165,7 @@ const ce = () => {
165
165
  id: a.id,
166
166
  position: o
167
167
  }));
168
- await Le(n);
168
+ await Te(n);
169
169
  },
170
170
  // Clear all messages on logout
171
171
  clearOnLogout: async () => {
@@ -175,7 +175,7 @@ const ce = () => {
175
175
  isProcessing: !1,
176
176
  activeWindowIds: [],
177
177
  initialized: !1
178
- }), await Ce();
178
+ }), await Re();
179
179
  },
180
180
  // Remove a specific message from the queue by ID (memory only)
181
181
  removeFromQueue: async (i) => {
@@ -184,15 +184,15 @@ const ce = () => {
184
184
  },
185
185
  // Delete message completely (from both memory and database)
186
186
  deleteMessage: async (i) => {
187
- await ke(i), await e().removeFromQueue(i);
187
+ await Le(i), await e().removeFromQueue(i);
188
188
  },
189
189
  // Hide a message (mark as hidden and remove from queue)
190
190
  hideMessage: async (i) => {
191
- await Ie(i), await e().removeFromQueue(i);
191
+ await Ce(i), await e().removeFromQueue(i);
192
192
  },
193
193
  // Mark message as shown in database
194
194
  markMessageAsShown: async (i) => {
195
- await Pe(i);
195
+ await ke(i);
196
196
  },
197
197
  // Add active window ID
198
198
  addActiveWindow: (i) => {
@@ -211,46 +211,46 @@ const ce = () => {
211
211
  const n = e(), a = String(i);
212
212
  return n.activeWindowIds.includes(a);
213
213
  }
214
- }), c = me()(
215
- _e(Re, {
214
+ }), w = ve()(
215
+ Se(Ee, {
216
216
  name: "tauri-notice-queue"
217
217
  })
218
- ), R = {
218
+ ), T = {
219
219
  queueLength: (t) => t.queue.length,
220
220
  currentMessage: (t) => t.currentMessage,
221
221
  isProcessing: (t) => t.isProcessing,
222
222
  queue: (t) => t.queue
223
- }, st = () => {
224
- const t = c((i) => i.enqueue);
225
- return { showNotice: F(
223
+ }, rt = () => {
224
+ const t = w((i) => i.enqueue);
225
+ return { showNotice: q(
226
226
  async (i) => {
227
227
  await t(i);
228
228
  },
229
229
  [t]
230
230
  ) };
231
231
  };
232
- function Te(t, e, i, n) {
232
+ function Fe(t, e, i, n) {
233
233
  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");
234
234
  return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
235
235
  }
236
- function Ee(t, e, i, n, a) {
236
+ function qe(t, e, i, n, a) {
237
237
  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");
238
238
  return e.set(t, i), i;
239
239
  }
240
- var T;
241
- const h = "__TAURI_TO_IPC_KEY__";
242
- function Fe(t, e = !1) {
240
+ var E;
241
+ const g = "__TAURI_TO_IPC_KEY__";
242
+ function Be(t, e = !1) {
243
243
  return window.__TAURI_INTERNALS__.transformCallback(t, e);
244
244
  }
245
245
  async function s(t, e = {}, i) {
246
246
  return window.__TAURI_INTERNALS__.invoke(t, e, i);
247
247
  }
248
- class qe {
248
+ class He {
249
249
  get rid() {
250
- return Te(this, T, "f");
250
+ return Fe(this, E, "f");
251
251
  }
252
252
  constructor(e) {
253
- T.set(this, void 0), Ee(this, T, e);
253
+ E.set(this, void 0), qe(this, E, e);
254
254
  }
255
255
  /**
256
256
  * Destroys and cleans up this resource from memory.
@@ -262,7 +262,7 @@ class qe {
262
262
  });
263
263
  }
264
264
  }
265
- T = /* @__PURE__ */ new WeakMap();
265
+ E = /* @__PURE__ */ new WeakMap();
266
266
  class j {
267
267
  constructor(...e) {
268
268
  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]);
@@ -283,19 +283,19 @@ class j {
283
283
  * @since 2.0.0
284
284
  */
285
285
  toPhysical(e) {
286
- return new W(this.width * e, this.height * e);
286
+ return new z(this.width * e, this.height * e);
287
287
  }
288
- [h]() {
288
+ [g]() {
289
289
  return {
290
290
  width: this.width,
291
291
  height: this.height
292
292
  };
293
293
  }
294
294
  toJSON() {
295
- return this[h]();
295
+ return this[g]();
296
296
  }
297
297
  }
298
- class W {
298
+ class z {
299
299
  constructor(...e) {
300
300
  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]);
301
301
  }
@@ -313,17 +313,17 @@ class W {
313
313
  toLogical(e) {
314
314
  return new j(this.width / e, this.height / e);
315
315
  }
316
- [h]() {
316
+ [g]() {
317
317
  return {
318
318
  width: this.width,
319
319
  height: this.height
320
320
  };
321
321
  }
322
322
  toJSON() {
323
- return this[h]();
323
+ return this[g]();
324
324
  }
325
325
  }
326
- class S {
326
+ class W {
327
327
  constructor(e) {
328
328
  this.size = e;
329
329
  }
@@ -331,9 +331,9 @@ class S {
331
331
  return this.size instanceof j ? this.size : this.size.toLogical(e);
332
332
  }
333
333
  toPhysical(e) {
334
- return this.size instanceof W ? this.size : this.size.toPhysical(e);
334
+ return this.size instanceof z ? this.size : this.size.toPhysical(e);
335
335
  }
336
- [h]() {
336
+ [g]() {
337
337
  return {
338
338
  [`${this.size.type}`]: {
339
339
  width: this.size.width,
@@ -342,7 +342,7 @@ class S {
342
342
  };
343
343
  }
344
344
  toJSON() {
345
- return this[h]();
345
+ return this[g]();
346
346
  }
347
347
  }
348
348
  class J {
@@ -365,19 +365,19 @@ class J {
365
365
  * @since 2.0.0
366
366
  */
367
367
  toPhysical(e) {
368
- return new d(this.x * e, this.y * e);
368
+ return new h(this.x * e, this.y * e);
369
369
  }
370
- [h]() {
370
+ [g]() {
371
371
  return {
372
372
  x: this.x,
373
373
  y: this.y
374
374
  };
375
375
  }
376
376
  toJSON() {
377
- return this[h]();
377
+ return this[g]();
378
378
  }
379
379
  }
380
- class d {
380
+ class h {
381
381
  constructor(...e) {
382
382
  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]);
383
383
  }
@@ -399,17 +399,17 @@ class d {
399
399
  toLogical(e) {
400
400
  return new J(this.x / e, this.y / e);
401
401
  }
402
- [h]() {
402
+ [g]() {
403
403
  return {
404
404
  x: this.x,
405
405
  y: this.y
406
406
  };
407
407
  }
408
408
  toJSON() {
409
- return this[h]();
409
+ return this[g]();
410
410
  }
411
411
  }
412
- class A {
412
+ class D {
413
413
  constructor(e) {
414
414
  this.position = e;
415
415
  }
@@ -417,9 +417,9 @@ class A {
417
417
  return this.position instanceof J ? this.position : this.position.toLogical(e);
418
418
  }
419
419
  toPhysical(e) {
420
- return this.position instanceof d ? this.position : this.position.toPhysical(e);
420
+ return this.position instanceof h ? this.position : this.position.toPhysical(e);
421
421
  }
422
- [h]() {
422
+ [g]() {
423
423
  return {
424
424
  [`${this.position.type}`]: {
425
425
  x: this.position.x,
@@ -428,47 +428,47 @@ class A {
428
428
  };
429
429
  }
430
430
  toJSON() {
431
- return this[h]();
431
+ return this[g]();
432
432
  }
433
433
  }
434
434
  var u;
435
435
  (function(t) {
436
436
  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";
437
437
  })(u || (u = {}));
438
- async function de(t, e) {
438
+ async function ge(t, e) {
439
439
  window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await s("plugin:event|unlisten", {
440
440
  event: t,
441
441
  eventId: e
442
442
  });
443
443
  }
444
- async function B(t, e, i) {
444
+ async function H(t, e, i) {
445
445
  var n;
446
446
  const a = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
447
447
  return s("plugin:event|listen", {
448
448
  event: t,
449
449
  target: a,
450
- handler: Fe(e)
451
- }).then((o) => async () => de(t, o));
450
+ handler: Be(e)
451
+ }).then((o) => async () => ge(t, o));
452
452
  }
453
453
  async function Z(t, e, i) {
454
- return B(t, (n) => {
455
- de(t, n.id), e(n);
454
+ return H(t, (n) => {
455
+ ge(t, n.id), e(n);
456
456
  }, i);
457
457
  }
458
- async function he(t, e) {
458
+ async function ye(t, e) {
459
459
  await s("plugin:event|emit", {
460
460
  event: t,
461
461
  payload: e
462
462
  });
463
463
  }
464
- async function ge(t, e, i) {
464
+ async function be(t, e, i) {
465
465
  await s("plugin:event|emit_to", {
466
466
  target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
467
467
  event: e,
468
468
  payload: i
469
469
  });
470
470
  }
471
- class k extends qe {
471
+ class C extends He {
472
472
  /**
473
473
  * Creates an Image from a resource ID. For internal use only.
474
474
  *
@@ -480,10 +480,10 @@ class k extends qe {
480
480
  /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
481
481
  static async new(e, i, n) {
482
482
  return s("plugin:image|new", {
483
- rgba: E(e),
483
+ rgba: F(e),
484
484
  width: i,
485
485
  height: n
486
- }).then((a) => new k(a));
486
+ }).then((a) => new C(a));
487
487
  }
488
488
  /**
489
489
  * Creates a new image using the provided bytes by inferring the file format.
@@ -500,8 +500,8 @@ class k extends qe {
500
500
  */
501
501
  static async fromBytes(e) {
502
502
  return s("plugin:image|from_bytes", {
503
- bytes: E(e)
504
- }).then((i) => new k(i));
503
+ bytes: F(e)
504
+ }).then((i) => new C(i));
505
505
  }
506
506
  /**
507
507
  * Creates a new image using the provided path.
@@ -516,7 +516,7 @@ class k extends qe {
516
516
  * ```
517
517
  */
518
518
  static async fromPath(e) {
519
- return s("plugin:image|from_path", { path: e }).then((i) => new k(i));
519
+ return s("plugin:image|from_path", { path: e }).then((i) => new C(i));
520
520
  }
521
521
  /** Returns the RGBA data for this image, in row-major order from top to bottom. */
522
522
  async rgba() {
@@ -529,14 +529,14 @@ class k extends qe {
529
529
  return s("plugin:image|size", { rid: this.rid });
530
530
  }
531
531
  }
532
- function E(t) {
533
- return t == null ? null : typeof t == "string" ? t : t instanceof k ? t.rid : t;
532
+ function F(t) {
533
+ return t == null ? null : typeof t == "string" ? t : t instanceof C ? t.rid : t;
534
534
  }
535
535
  var V;
536
536
  (function(t) {
537
537
  t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
538
538
  })(V || (V = {}));
539
- class Be {
539
+ class Ue {
540
540
  constructor(e) {
541
541
  this._preventDefault = !1, this.event = e.event, this.id = e.id;
542
542
  }
@@ -547,11 +547,11 @@ class Be {
547
547
  return this._preventDefault;
548
548
  }
549
549
  }
550
- var te;
550
+ var ne;
551
551
  (function(t) {
552
552
  t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
553
- })(te || (te = {}));
554
- function ye() {
553
+ })(ne || (ne = {}));
554
+ function pe() {
555
555
  return new U(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
556
556
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
557
557
  skip: !0
@@ -611,7 +611,7 @@ class U {
611
611
  * Get an instance of `Window` for the current window.
612
612
  */
613
613
  static getCurrent() {
614
- return ye();
614
+ return pe();
615
615
  }
616
616
  /**
617
617
  * Gets a list of instances of `Window` for all available windows.
@@ -658,7 +658,7 @@ class U {
658
658
  return this._handleTauriEvent(e, i) ? () => {
659
659
  const n = this.listeners[e];
660
660
  n.splice(n.indexOf(i), 1);
661
- } : B(e, i, {
661
+ } : H(e, i, {
662
662
  target: { kind: "Window", label: this.label }
663
663
  });
664
664
  }
@@ -710,7 +710,7 @@ class U {
710
710
  });
711
711
  return;
712
712
  }
713
- return he(e, i);
713
+ return ye(e, i);
714
714
  }
715
715
  /**
716
716
  * Emits an event to all {@link EventTarget|targets} matching the given target.
@@ -734,7 +734,7 @@ class U {
734
734
  });
735
735
  return;
736
736
  }
737
- return ge(e, i, n);
737
+ return be(e, i, n);
738
738
  }
739
739
  /** @ignore */
740
740
  _handleTauriEvent(e, i) {
@@ -769,7 +769,7 @@ class U {
769
769
  async innerPosition() {
770
770
  return s("plugin:window|inner_position", {
771
771
  label: this.label
772
- }).then((e) => new d(e));
772
+ }).then((e) => new h(e));
773
773
  }
774
774
  /**
775
775
  * The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
@@ -784,7 +784,7 @@ class U {
784
784
  async outerPosition() {
785
785
  return s("plugin:window|outer_position", {
786
786
  label: this.label
787
- }).then((e) => new d(e));
787
+ }).then((e) => new h(e));
788
788
  }
789
789
  /**
790
790
  * The physical size of the window's client area.
@@ -800,7 +800,7 @@ class U {
800
800
  async innerSize() {
801
801
  return s("plugin:window|inner_size", {
802
802
  label: this.label
803
- }).then((e) => new W(e));
803
+ }).then((e) => new z(e));
804
804
  }
805
805
  /**
806
806
  * The physical size of the entire window.
@@ -816,7 +816,7 @@ class U {
816
816
  async outerSize() {
817
817
  return s("plugin:window|outer_size", {
818
818
  label: this.label
819
- }).then((e) => new W(e));
819
+ }).then((e) => new z(e));
820
820
  }
821
821
  /**
822
822
  * Gets the window's current fullscreen state.
@@ -1467,7 +1467,7 @@ class U {
1467
1467
  async setSize(e) {
1468
1468
  return s("plugin:window|set_size", {
1469
1469
  label: this.label,
1470
- value: e instanceof S ? e : new S(e)
1470
+ value: e instanceof W ? e : new W(e)
1471
1471
  });
1472
1472
  }
1473
1473
  /**
@@ -1484,7 +1484,7 @@ class U {
1484
1484
  async setMinSize(e) {
1485
1485
  return s("plugin:window|set_min_size", {
1486
1486
  label: this.label,
1487
- value: e instanceof S ? e : e ? new S(e) : null
1487
+ value: e instanceof W ? e : e ? new W(e) : null
1488
1488
  });
1489
1489
  }
1490
1490
  /**
@@ -1501,7 +1501,7 @@ class U {
1501
1501
  async setMaxSize(e) {
1502
1502
  return s("plugin:window|set_max_size", {
1503
1503
  label: this.label,
1504
- value: e instanceof S ? e : e ? new S(e) : null
1504
+ value: e instanceof W ? e : e ? new W(e) : null
1505
1505
  });
1506
1506
  }
1507
1507
  /**
@@ -1543,7 +1543,7 @@ class U {
1543
1543
  async setPosition(e) {
1544
1544
  return s("plugin:window|set_position", {
1545
1545
  label: this.label,
1546
- value: e instanceof A ? e : new A(e)
1546
+ value: e instanceof D ? e : new D(e)
1547
1547
  });
1548
1548
  }
1549
1549
  /**
@@ -1637,7 +1637,7 @@ class U {
1637
1637
  async setIcon(e) {
1638
1638
  return s("plugin:window|set_icon", {
1639
1639
  label: this.label,
1640
- value: E(e)
1640
+ value: F(e)
1641
1641
  });
1642
1642
  }
1643
1643
  /**
@@ -1755,7 +1755,7 @@ class U {
1755
1755
  async setCursorPosition(e) {
1756
1756
  return s("plugin:window|set_cursor_position", {
1757
1757
  label: this.label,
1758
- value: e instanceof A ? e : new A(e)
1758
+ value: e instanceof D ? e : new D(e)
1759
1759
  });
1760
1760
  }
1761
1761
  /**
@@ -1872,7 +1872,7 @@ class U {
1872
1872
  async setOverlayIcon(e) {
1873
1873
  return s("plugin:window|set_overlay_icon", {
1874
1874
  label: this.label,
1875
- value: e ? E(e) : void 0
1875
+ value: e ? F(e) : void 0
1876
1876
  });
1877
1877
  }
1878
1878
  /**
@@ -1962,7 +1962,7 @@ class U {
1962
1962
  */
1963
1963
  async onResized(e) {
1964
1964
  return this.listen(u.WINDOW_RESIZED, (i) => {
1965
- i.payload = new W(i.payload), e(i);
1965
+ i.payload = new z(i.payload), e(i);
1966
1966
  });
1967
1967
  }
1968
1968
  /**
@@ -1984,7 +1984,7 @@ class U {
1984
1984
  */
1985
1985
  async onMoved(e) {
1986
1986
  return this.listen(u.WINDOW_MOVED, (i) => {
1987
- i.payload = new d(i.payload), e(i);
1987
+ i.payload = new h(i.payload), e(i);
1988
1988
  });
1989
1989
  }
1990
1990
  /**
@@ -2011,7 +2011,7 @@ class U {
2011
2011
  */
2012
2012
  async onCloseRequested(e) {
2013
2013
  return this.listen(u.WINDOW_CLOSE_REQUESTED, async (i) => {
2014
- const n = new Be(i);
2014
+ const n = new Ue(i);
2015
2015
  await e(n), n.isPreventDefault() || await this.destroy();
2016
2016
  });
2017
2017
  }
@@ -2047,7 +2047,7 @@ class U {
2047
2047
  payload: {
2048
2048
  type: "enter",
2049
2049
  paths: r.payload.paths,
2050
- position: new d(r.payload.position)
2050
+ position: new h(r.payload.position)
2051
2051
  }
2052
2052
  });
2053
2053
  }), n = await this.listen(u.DRAG_OVER, (r) => {
@@ -2055,7 +2055,7 @@ class U {
2055
2055
  ...r,
2056
2056
  payload: {
2057
2057
  type: "over",
2058
- position: new d(r.payload.position)
2058
+ position: new h(r.payload.position)
2059
2059
  }
2060
2060
  });
2061
2061
  }), a = await this.listen(u.DRAG_DROP, (r) => {
@@ -2064,7 +2064,7 @@ class U {
2064
2064
  payload: {
2065
2065
  type: "drop",
2066
2066
  paths: r.payload.paths,
2067
- position: new d(r.payload.position)
2067
+ position: new h(r.payload.position)
2068
2068
  }
2069
2069
  });
2070
2070
  }), o = await this.listen(u.DRAG_LEAVE, (r) => {
@@ -2146,44 +2146,44 @@ class U {
2146
2146
  return this.listen(u.WINDOW_THEME_CHANGED, e);
2147
2147
  }
2148
2148
  }
2149
- var ie;
2149
+ var se;
2150
2150
  (function(t) {
2151
2151
  t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
2152
- })(ie || (ie = {}));
2153
- var ne;
2152
+ })(se || (se = {}));
2153
+ var ae;
2154
2154
  (function(t) {
2155
2155
  t.Default = "default", t.FluentOverlay = "fluentOverlay";
2156
- })(ne || (ne = {}));
2157
- var se;
2156
+ })(ae || (ae = {}));
2157
+ var re;
2158
2158
  (function(t) {
2159
2159
  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";
2160
- })(se || (se = {}));
2161
- var ae;
2160
+ })(re || (re = {}));
2161
+ var oe;
2162
2162
  (function(t) {
2163
2163
  t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
2164
- })(ae || (ae = {}));
2165
- function Ue(t) {
2164
+ })(oe || (oe = {}));
2165
+ function $e(t) {
2166
2166
  return t === null ? null : {
2167
2167
  name: t.name,
2168
2168
  scaleFactor: t.scaleFactor,
2169
- position: new d(t.position),
2170
- size: new W(t.size),
2169
+ position: new h(t.position),
2170
+ size: new z(t.size),
2171
2171
  workArea: {
2172
- position: new d(t.workArea.position),
2173
- size: new W(t.workArea.size)
2172
+ position: new h(t.workArea.position),
2173
+ size: new z(t.workArea.size)
2174
2174
  }
2175
2175
  };
2176
2176
  }
2177
- async function He() {
2178
- return s("plugin:window|primary_monitor").then(Ue);
2177
+ async function Ge() {
2178
+ return s("plugin:window|primary_monitor").then($e);
2179
2179
  }
2180
- function be() {
2181
- return new Y(ye(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
2180
+ function fe() {
2181
+ return new Y(pe(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
2182
2182
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2183
2183
  skip: !0
2184
2184
  });
2185
2185
  }
2186
- async function re() {
2186
+ async function le() {
2187
2187
  return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new Y(new U(e.windowLabel, {
2188
2188
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2189
2189
  skip: !0
@@ -2248,19 +2248,19 @@ class Y {
2248
2248
  */
2249
2249
  static async getByLabel(e) {
2250
2250
  var i;
2251
- return (i = (await re()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
2251
+ return (i = (await le()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
2252
2252
  }
2253
2253
  /**
2254
2254
  * Get an instance of `Webview` for the current webview.
2255
2255
  */
2256
2256
  static getCurrent() {
2257
- return be();
2257
+ return fe();
2258
2258
  }
2259
2259
  /**
2260
2260
  * Gets a list of instances of `Webview` for all available webviews.
2261
2261
  */
2262
2262
  static async getAll() {
2263
- return re();
2263
+ return le();
2264
2264
  }
2265
2265
  /**
2266
2266
  * Listen to an emitted event on this webview.
@@ -2285,7 +2285,7 @@ class Y {
2285
2285
  return this._handleTauriEvent(e, i) ? () => {
2286
2286
  const n = this.listeners[e];
2287
2287
  n.splice(n.indexOf(i), 1);
2288
- } : B(e, i, {
2288
+ } : H(e, i, {
2289
2289
  target: { kind: "Webview", label: this.label }
2290
2290
  });
2291
2291
  }
@@ -2338,7 +2338,7 @@ class Y {
2338
2338
  });
2339
2339
  return;
2340
2340
  }
2341
- return he(e, i);
2341
+ return ye(e, i);
2342
2342
  }
2343
2343
  /**
2344
2344
  * Emits an event to all {@link EventTarget|targets} matching the given target.
@@ -2363,7 +2363,7 @@ class Y {
2363
2363
  });
2364
2364
  return;
2365
2365
  }
2366
- return ge(e, i, n);
2366
+ return be(e, i, n);
2367
2367
  }
2368
2368
  /** @ignore */
2369
2369
  _handleTauriEvent(e, i) {
@@ -2383,7 +2383,7 @@ class Y {
2383
2383
  async position() {
2384
2384
  return s("plugin:webview|webview_position", {
2385
2385
  label: this.label
2386
- }).then((e) => new d(e));
2386
+ }).then((e) => new h(e));
2387
2387
  }
2388
2388
  /**
2389
2389
  * The physical size of the webview's client area.
@@ -2399,7 +2399,7 @@ class Y {
2399
2399
  async size() {
2400
2400
  return s("plugin:webview|webview_size", {
2401
2401
  label: this.label
2402
- }).then((e) => new W(e));
2402
+ }).then((e) => new z(e));
2403
2403
  }
2404
2404
  // Setters
2405
2405
  /**
@@ -2431,7 +2431,7 @@ class Y {
2431
2431
  async setSize(e) {
2432
2432
  return s("plugin:webview|set_webview_size", {
2433
2433
  label: this.label,
2434
- value: e instanceof S ? e : new S(e)
2434
+ value: e instanceof W ? e : new W(e)
2435
2435
  });
2436
2436
  }
2437
2437
  /**
@@ -2448,7 +2448,7 @@ class Y {
2448
2448
  async setPosition(e) {
2449
2449
  return s("plugin:webview|set_webview_position", {
2450
2450
  label: this.label,
2451
- value: e instanceof A ? e : new A(e)
2451
+ value: e instanceof D ? e : new D(e)
2452
2452
  });
2453
2453
  }
2454
2454
  /**
@@ -2610,7 +2610,7 @@ class Y {
2610
2610
  payload: {
2611
2611
  type: "enter",
2612
2612
  paths: r.payload.paths,
2613
- position: new d(r.payload.position)
2613
+ position: new h(r.payload.position)
2614
2614
  }
2615
2615
  });
2616
2616
  }), n = await this.listen(u.DRAG_OVER, (r) => {
@@ -2618,7 +2618,7 @@ class Y {
2618
2618
  ...r,
2619
2619
  payload: {
2620
2620
  type: "over",
2621
- position: new d(r.payload.position)
2621
+ position: new h(r.payload.position)
2622
2622
  }
2623
2623
  });
2624
2624
  }), a = await this.listen(u.DRAG_DROP, (r) => {
@@ -2627,7 +2627,7 @@ class Y {
2627
2627
  payload: {
2628
2628
  type: "drop",
2629
2629
  paths: r.payload.paths,
2630
- position: new d(r.payload.position)
2630
+ position: new h(r.payload.position)
2631
2631
  }
2632
2632
  });
2633
2633
  }), o = await this.listen(u.DRAG_LEAVE, (r) => {
@@ -2638,17 +2638,17 @@ class Y {
2638
2638
  };
2639
2639
  }
2640
2640
  }
2641
- function z() {
2642
- const t = be();
2643
- return new N(t.label, { skip: !0 });
2641
+ function N() {
2642
+ const t = fe();
2643
+ return new x(t.label, { skip: !0 });
2644
2644
  }
2645
- async function oe() {
2646
- return s("plugin:window|get_all_windows").then((t) => t.map((e) => new N(e, {
2645
+ async function ue() {
2646
+ return s("plugin:window|get_all_windows").then((t) => t.map((e) => new x(e, {
2647
2647
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2648
2648
  skip: !0
2649
2649
  })));
2650
2650
  }
2651
- class N {
2651
+ class x {
2652
2652
  /**
2653
2653
  * Creates a new {@link Window} hosting a {@link Webview}.
2654
2654
  * @example
@@ -2691,20 +2691,20 @@ class N {
2691
2691
  */
2692
2692
  static async getByLabel(e) {
2693
2693
  var i;
2694
- const n = (i = (await oe()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
2695
- return n ? new N(n.label, { skip: !0 }) : null;
2694
+ const n = (i = (await ue()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
2695
+ return n ? new x(n.label, { skip: !0 }) : null;
2696
2696
  }
2697
2697
  /**
2698
2698
  * Get an instance of `Webview` for the current webview.
2699
2699
  */
2700
2700
  static getCurrent() {
2701
- return z();
2701
+ return N();
2702
2702
  }
2703
2703
  /**
2704
2704
  * Gets a list of instances of `Webview` for all available webviews.
2705
2705
  */
2706
2706
  static async getAll() {
2707
- return oe();
2707
+ return ue();
2708
2708
  }
2709
2709
  /**
2710
2710
  * Listen to an emitted event on this webview window.
@@ -2729,7 +2729,7 @@ class N {
2729
2729
  return this._handleTauriEvent(e, i) ? () => {
2730
2730
  const n = this.listeners[e];
2731
2731
  n.splice(n.indexOf(i), 1);
2732
- } : B(e, i, {
2732
+ } : H(e, i, {
2733
2733
  target: { kind: "WebviewWindow", label: this.label }
2734
2734
  });
2735
2735
  }
@@ -2780,8 +2780,8 @@ class N {
2780
2780
  return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
2781
2781
  }
2782
2782
  }
2783
- $e(N, [U, Y]);
2784
- function $e(t, e) {
2783
+ Qe(x, [U, Y]);
2784
+ function Qe(t, e) {
2785
2785
  (Array.isArray(e) ? e : [e]).forEach((i) => {
2786
2786
  Object.getOwnPropertyNames(i.prototype).forEach((n) => {
2787
2787
  var a;
@@ -2794,17 +2794,17 @@ function $e(t, e) {
2794
2794
  });
2795
2795
  });
2796
2796
  }
2797
- const C = /* @__PURE__ */ new Map(), Ge = () => navigator.platform.toLowerCase().includes("mac") || navigator.userAgent.toLowerCase().includes("mac"), Qe = (t) => {
2797
+ const L = /* @__PURE__ */ new Map(), Ve = () => navigator.platform.toLowerCase().includes("mac") || navigator.userAgent.toLowerCase().includes("mac"), je = (t) => {
2798
2798
  if (!t || t.trim() === "") return !1;
2799
2799
  try {
2800
2800
  return !!(t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("tauri://"));
2801
2801
  } catch {
2802
2802
  return !1;
2803
2803
  }
2804
- }, Ve = async () => {
2804
+ }, Je = async () => {
2805
2805
  let t = 1920, e = 1080;
2806
2806
  try {
2807
- const i = await He();
2807
+ const i = await Ge();
2808
2808
  if (i?.size) {
2809
2809
  const n = i.scaleFactor || 1;
2810
2810
  t = i.size.width / n, e = i.size.height / n;
@@ -2813,11 +2813,11 @@ const C = /* @__PURE__ */ new Map(), Ge = () => navigator.platform.toLowerCase()
2813
2813
  console.warn("Failed to get monitor info, using defaults:", i);
2814
2814
  }
2815
2815
  return { screenWidth: t, screenHeight: e };
2816
- }, pe = async (t, e, i) => {
2816
+ }, me = async (t, e, i) => {
2817
2817
  const n = i?.padding ?? 20;
2818
2818
  if (i?.x !== void 0 && i?.y !== void 0)
2819
2819
  return { x: i.x, y: i.y };
2820
- const { screenWidth: a, screenHeight: o } = await Ve();
2820
+ const { screenWidth: a, screenHeight: o } = await Je();
2821
2821
  switch (i?.position ?? "right-bottom") {
2822
2822
  case "right-bottom":
2823
2823
  return {
@@ -2850,31 +2850,31 @@ const C = /* @__PURE__ */ new Map(), Ge = () => navigator.platform.toLowerCase()
2850
2850
  y: o - e - n
2851
2851
  };
2852
2852
  }
2853
- }, je = async (t) => {
2854
- const e = String(t.id), i = c.getState();
2853
+ }, Ze = async (t) => {
2854
+ const e = String(t.id), i = w.getState();
2855
2855
  if (i.isWindowActive(e)) {
2856
2856
  console.log(`Notice window already open for message: ${e}`);
2857
2857
  return;
2858
2858
  }
2859
- const n = q(), a = `notice-${e}`;
2859
+ const n = B(), a = `notice-${e}`;
2860
2860
  let o = `${n.routePrefix}/${t.type}?id=${t.id}`;
2861
- Qe(o) || (console.warn(`Invalid window URL: ${o}. Using fallback 404 page.`), o = n.notFoundUrl || "/404");
2862
- const r = t.min_width || n.defaultWidth, g = t.min_height || n.defaultHeight, _ = t.decorations ?? n.defaultDecorations ?? !0, y = n.autoSize ?? !0, { x: D, y: x } = await pe(r, g, t.windowPosition);
2861
+ je(o) || (console.warn(`Invalid window URL: ${o}. Using fallback 404 page.`), o = n.notFoundUrl || "/404");
2862
+ const r = t.min_width || n.defaultWidth, y = t.min_height || n.defaultHeight, _ = t.decorations ?? n.defaultDecorations ?? !0, b = n.autoSize ?? !0, { x: M, y: S } = await me(r, y, t.windowPosition);
2863
2863
  try {
2864
- const w = {
2864
+ const d = {
2865
2865
  url: o,
2866
2866
  title: t.title,
2867
2867
  width: r,
2868
- height: g,
2869
- x: D,
2870
- y: x,
2868
+ height: y,
2869
+ x: M,
2870
+ y: S,
2871
2871
  resizable: !0,
2872
2872
  skipTaskbar: !1,
2873
2873
  alwaysOnTop: !0
2874
2874
  };
2875
- y && (w.visible = !1), _ ? w.decorations = !0 : Ge() ? (w.decorations = !0, w.titleBarStyle = "overlay", w.hiddenTitle = !0) : (w.decorations = !1, w.transparent = !0);
2876
- const f = new N(a, w);
2877
- C.set(e, f), i.addActiveWindow(e);
2875
+ b && (d.visible = !1), _ ? d.decorations = !0 : Ve() ? (d.decorations = !0, d.titleBarStyle = "overlay", d.hiddenTitle = !0) : (d.decorations = !1, d.transparent = !0);
2876
+ const f = new x(a, d);
2877
+ L.set(e, f), i.addActiveWindow(e);
2878
2878
  let l = null;
2879
2879
  const m = n.loadTimeout ?? 1e4;
2880
2880
  !_ && m > 0 && (l = setTimeout(async () => {
@@ -2892,163 +2892,165 @@ const C = /* @__PURE__ */ new Map(), Ge = () => navigator.platform.toLowerCase()
2892
2892
  } catch {
2893
2893
  }
2894
2894
  }), f.once("tauri://destroyed", async () => {
2895
- l && (clearTimeout(l), l = null), C.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
2896
- }), console.log(`Created notice window: ${a} (autoSize: ${y}, visible: ${!y})`);
2897
- } catch (w) {
2898
- console.error("Failed to create notice window:", w), i.removeActiveWindow(e), i.clearCurrent();
2895
+ l && (clearTimeout(l), l = null), L.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
2896
+ }), console.log(`Created notice window: ${a} (autoSize: ${b}, visible: ${!b})`);
2897
+ } catch (d) {
2898
+ console.error("Failed to create notice window:", d), i.removeActiveWindow(e), i.clearCurrent();
2899
2899
  }
2900
2900
  }, K = async (t) => {
2901
- const e = String(t), i = C.get(e), n = c.getState();
2901
+ const e = String(t), i = L.get(e), n = w.getState();
2902
2902
  if (i)
2903
2903
  try {
2904
- await i.close(), C.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
2904
+ await i.close(), L.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
2905
2905
  } catch (a) {
2906
2906
  console.error("Failed to close notice window:", a);
2907
2907
  }
2908
- }, Je = async () => {
2909
- const t = Array.from(C.keys()).map(
2908
+ }, Ye = async () => {
2909
+ const t = Array.from(L.keys()).map(
2910
2910
  (e) => K(e)
2911
2911
  );
2912
2912
  await Promise.all(t);
2913
- }, Ze = () => {
2913
+ }, Ke = () => {
2914
2914
  let t = null;
2915
- c.subscribe((e) => {
2915
+ w.subscribe((e) => {
2916
2916
  const i = e.currentMessage;
2917
- i && i !== t ? (t = i, je(i)) : i || (t = null);
2917
+ i && i !== t ? (t = i, Ze(i)) : i || (t = null);
2918
2918
  }), console.log("Notice window system initialized");
2919
- }, at = () => {
2920
- const t = c((i) => i.currentMessage);
2921
- return { closeNotice: F(async () => {
2919
+ }, ot = () => {
2920
+ const t = w((i) => i.currentMessage);
2921
+ return { closeNotice: q(async () => {
2922
2922
  t && await K(t.id);
2923
2923
  }, [t]) };
2924
- }, rt = () => {
2925
- const t = c((i) => i.hideMessage);
2926
- return { hideNotice: F(
2924
+ }, lt = () => {
2925
+ const t = w((i) => i.hideMessage);
2926
+ return { hideNotice: q(
2927
2927
  async (i) => {
2928
2928
  await t(i), await K(i);
2929
2929
  },
2930
2930
  [t]
2931
2931
  ) };
2932
- }, ot = () => {
2933
- const t = c((i) => i.clearOnLogout);
2934
- return { hideAllNotices: F(async () => {
2935
- await Je(), await t();
2932
+ }, ut = () => {
2933
+ const t = w((i) => i.clearOnLogout);
2934
+ return { hideAllNotices: q(async () => {
2935
+ await Ye(), await t();
2936
2936
  }, [t]) };
2937
- }, lt = () => {
2938
- const t = c(R.queueLength), e = c(R.currentMessage), i = c(R.isProcessing), n = c(R.queue);
2937
+ }, ct = () => {
2938
+ const t = w(T.queueLength), e = w(T.currentMessage), i = w(T.isProcessing), n = w(T.queue);
2939
2939
  return {
2940
2940
  queueLength: t,
2941
2941
  currentMessage: e,
2942
2942
  isProcessing: i,
2943
2943
  queue: n
2944
2944
  };
2945
- }, fe = Se({ windowReady: !0 }), ut = () => We(fe), Ye = async (t) => {
2945
+ }, _e = ze({ windowReady: !0 }), wt = () => Ae(_e), Xe = async (t) => {
2946
2946
  try {
2947
- const e = q(), i = e.defaultWidth || 400, n = e.maxHeight ?? 800, a = e.defaultHeight || 300, o = Math.max(a, Math.min(Math.ceil(t), n)), r = z();
2947
+ const e = B(), i = e.defaultWidth || 400, n = e.maxHeight ?? 800, a = e.defaultHeight || 300, o = Math.max(a, Math.min(Math.ceil(t), n)), r = N();
2948
2948
  await r.setSize(new j(i, o));
2949
- const { x: g, y: _ } = await pe(i, o);
2950
- await r.setPosition(new J(g, _)), await r.show(), console.log(`[NoticeLayout] Auto-sized window to ${i}x${o}`);
2949
+ const { x: y, y: _ } = await me(i, o);
2950
+ await r.setPosition(new J(y, _)), await r.show(), console.log(`[NoticeLayout] Auto-sized window to ${i}x${o}`);
2951
2951
  } catch (e) {
2952
2952
  console.error("[NoticeLayout] Failed to auto-size, showing window as-is:", e);
2953
2953
  try {
2954
- await z().show();
2954
+ await N().show();
2955
2955
  } catch {
2956
2956
  }
2957
2957
  }
2958
- }, ct = ({ children: t, onLoad: e, onClose: i }) => {
2959
- const [n, a] = L(null), [o, r] = L(!0), [g, _] = L(null), [y, D] = L(!1), x = X(null), w = X(!1), f = q(), l = f.autoSize ?? !0;
2960
- return O(() => {
2961
- l || D(!0);
2962
- }, [l]), O(() => {
2958
+ }, dt = ({ children: t, onLoad: e, onClose: i }) => {
2959
+ const [n, a] = R(null), [o, r] = R(!0), [y, _] = R(null), [b, M] = R(!1), S = te(null), d = te(!1), f = B(), l = f.autoSize ?? !0;
2960
+ return P(() => {
2961
+ l || M(!0);
2962
+ }, [l]), P(() => {
2963
2963
  (async () => {
2964
2964
  try {
2965
- const b = new URLSearchParams(window.location.search).get("id");
2966
- if (!b) {
2965
+ const c = new URLSearchParams(window.location.search).get("id");
2966
+ if (!c) {
2967
2967
  _("No message ID provided"), r(!1), setTimeout(async () => {
2968
2968
  try {
2969
- await z().close();
2970
- } catch (M) {
2971
- console.error("Failed to close window:", M);
2969
+ await N().close();
2970
+ } catch (A) {
2971
+ console.error("Failed to close window:", A);
2972
2972
  }
2973
2973
  }, 1e3);
2974
2974
  return;
2975
2975
  }
2976
- const H = await we(b);
2977
- if (!H) {
2978
- console.log(`Message ${b} not found in database, closing window`), _("Message not found"), r(!1), setTimeout(async () => {
2976
+ const O = await he(c);
2977
+ if (!O) {
2978
+ console.log(`Message ${c} not found in database, closing window`), _("Message not found"), r(!1), setTimeout(async () => {
2979
2979
  try {
2980
- await z().close();
2981
- } catch (M) {
2982
- console.error("Failed to close window:", M);
2980
+ await N().close();
2981
+ } catch (A) {
2982
+ console.error("Failed to close window:", A);
2983
2983
  }
2984
2984
  }, 500);
2985
2985
  return;
2986
2986
  }
2987
- a(H), r(!1), e && e(H);
2987
+ a(O), r(!1), e && e(O);
2988
2988
  } catch (v) {
2989
2989
  console.error("Failed to load message:", v), _("Failed to load message"), r(!1), setTimeout(async () => {
2990
2990
  try {
2991
- await z().close();
2992
- } catch (b) {
2993
- console.error("Failed to close window:", b);
2991
+ await N().close();
2992
+ } catch (c) {
2993
+ console.error("Failed to close window:", c);
2994
2994
  }
2995
2995
  }, 1e3);
2996
2996
  }
2997
2997
  })();
2998
- }, [e]), O(() => {
2999
- if (!l || !n || y || w.current) return;
2998
+ }, [e]), P(() => {
2999
+ if (!l || !n || b || d.current) return;
3000
3000
  const m = requestAnimationFrame(() => {
3001
3001
  const v = requestAnimationFrame(() => {
3002
- if (!x.current || w.current) return;
3003
- w.current = !0;
3004
- const b = x.current.getBoundingClientRect();
3005
- console.log(`[NoticeLayout] Measured natural content height: ${b.height}px`), Ye(b.height).then(() => {
3006
- D(!0);
3002
+ if (!S.current || d.current) return;
3003
+ d.current = !0;
3004
+ const c = document.body, O = c.style.height, A = c.style.overflow;
3005
+ c.style.height = "auto", c.style.overflow = "visible", S.current.offsetHeight;
3006
+ const X = S.current.getBoundingClientRect(), ee = Math.max(X.height, S.current.scrollHeight);
3007
+ console.log(`[NoticeLayout] Measured natural content height: ${ee}px (rect=${X.height}, scroll=${S.current.scrollHeight})`), c.style.height = O, c.style.overflow = A, Xe(ee).then(() => {
3008
+ M(!0);
3007
3009
  });
3008
3010
  });
3009
3011
  return () => cancelAnimationFrame(v);
3010
3012
  });
3011
3013
  return () => cancelAnimationFrame(m);
3012
- }, [l, n, y]), O(() => {
3013
- if (!l || y) return;
3014
+ }, [l, n, b]), P(() => {
3015
+ if (!l || b) return;
3014
3016
  const m = f.autoSizeTimeout ?? 3e3, v = setTimeout(async () => {
3015
- if (!y) {
3017
+ if (!b) {
3016
3018
  console.warn("[NoticeLayout] Auto-size timeout reached, showing window as-is");
3017
3019
  try {
3018
- await z().show();
3020
+ await N().show();
3019
3021
  } catch {
3020
3022
  }
3021
- D(!0);
3023
+ M(!0);
3022
3024
  }
3023
3025
  }, m);
3024
3026
  return () => clearTimeout(v);
3025
- }, [l, y, f.autoSizeTimeout]), O(() => {
3027
+ }, [l, b, f.autoSizeTimeout]), P(() => {
3026
3028
  if (!n || !i) return;
3027
3029
  const m = () => {
3028
3030
  i(n);
3029
3031
  };
3030
3032
  return window.addEventListener("beforeunload", m), () => window.removeEventListener("beforeunload", m);
3031
- }, [n, i]), o ? /* @__PURE__ */ P("div", { style: {
3033
+ }, [n, i]), o ? /* @__PURE__ */ I("div", { style: {
3032
3034
  display: "flex",
3033
3035
  justifyContent: "center",
3034
3036
  alignItems: "center",
3035
3037
  height: "100vh",
3036
3038
  fontFamily: "system-ui, -apple-system, sans-serif"
3037
- }, children: "Loading..." }) : g ? /* @__PURE__ */ P("div", { style: {
3039
+ }, children: "Loading..." }) : y ? /* @__PURE__ */ I("div", { style: {
3038
3040
  display: "flex",
3039
3041
  justifyContent: "center",
3040
3042
  alignItems: "center",
3041
3043
  height: "100vh",
3042
3044
  fontFamily: "system-ui, -apple-system, sans-serif",
3043
3045
  color: "#ef4444"
3044
- }, children: g }) : n ? /* @__PURE__ */ P(fe.Provider, { value: { windowReady: y }, children: /* @__PURE__ */ P(
3046
+ }, children: y }) : n ? /* @__PURE__ */ I(_e.Provider, { value: { windowReady: b }, children: /* @__PURE__ */ I(
3045
3047
  "div",
3046
3048
  {
3047
- ref: x,
3048
- style: y ? { height: "100vh" } : void 0,
3049
+ ref: S,
3050
+ style: b ? { height: "100vh" } : void 0,
3049
3051
  children: t(n)
3050
3052
  }
3051
- ) }) : /* @__PURE__ */ P("div", { style: {
3053
+ ) }) : /* @__PURE__ */ I("div", { style: {
3052
3054
  display: "flex",
3053
3055
  justifyContent: "center",
3054
3056
  alignItems: "center",
@@ -3056,41 +3058,41 @@ const C = /* @__PURE__ */ new Map(), Ge = () => navigator.platform.toLowerCase()
3056
3058
  fontFamily: "system-ui, -apple-system, sans-serif",
3057
3059
  color: "#ef4444"
3058
3060
  }, children: "Closing window..." });
3059
- }, wt = async () => {
3060
- ce(), Ze();
3061
- const { initializeFromDatabase: t } = c.getState();
3061
+ }, ht = async () => {
3062
+ de(), Ke();
3063
+ const { initializeFromDatabase: t } = w.getState();
3062
3064
  await t(), console.log("Tauri Notice System initialized");
3063
- }, dt = async (t) => {
3064
- await c.getState().deleteMessage(t);
3065
- }, ht = async (t) => {
3066
- await c.getState().hideMessage(t);
3067
3065
  }, gt = async (t) => {
3068
- await c.getState().markMessageAsShown(t);
3066
+ await w.getState().deleteMessage(t);
3067
+ }, yt = async (t) => {
3068
+ await w.getState().hideMessage(t);
3069
+ }, bt = async (t) => {
3070
+ await w.getState().markMessageAsShown(t);
3069
3071
  };
3070
3072
  export {
3071
- ct as NoticeLayout,
3072
- pe as calculateWindowPosition,
3073
- Je as closeAllNoticeWindows,
3073
+ dt as NoticeLayout,
3074
+ me as calculateWindowPosition,
3075
+ Ye as closeAllNoticeWindows,
3074
3076
  K as closeNoticeWindow,
3075
- je as createNoticeWindow,
3076
- dt as deleteMessageById,
3077
- Ve as getLogicalScreenSize,
3078
- we as getMessage,
3079
- q as getNoticeConfig,
3080
- Me as getPendingMessages,
3081
- ht as hideMessageById,
3082
- ce as initializeDatabase,
3083
- wt as initializeNoticeSystem,
3084
- Ze as initializeNoticeWindowSystem,
3085
- gt as markMessageAsShown,
3086
- R as messageQueueSelectors,
3087
- nt as setNoticeConfig,
3088
- at as useCloseNotice,
3089
- ot as useHideAllNotices,
3090
- rt as useHideNotice,
3091
- lt as useMessageQueue,
3092
- c as useMessageQueueStore,
3093
- st as useNoticeWindow,
3094
- ut as useNoticeWindowContext
3077
+ Ze as createNoticeWindow,
3078
+ gt as deleteMessageById,
3079
+ Je as getLogicalScreenSize,
3080
+ he as getMessage,
3081
+ B as getNoticeConfig,
3082
+ Pe as getPendingMessages,
3083
+ yt as hideMessageById,
3084
+ de as initializeDatabase,
3085
+ ht as initializeNoticeSystem,
3086
+ Ke as initializeNoticeWindowSystem,
3087
+ bt as markMessageAsShown,
3088
+ T as messageQueueSelectors,
3089
+ at as setNoticeConfig,
3090
+ ot as useCloseNotice,
3091
+ ut as useHideAllNotices,
3092
+ lt as useHideNotice,
3093
+ ct as useMessageQueue,
3094
+ w as useMessageQueueStore,
3095
+ rt as useNoticeWindow,
3096
+ wt as useNoticeWindowContext
3095
3097
  };
3096
3098
  //# sourceMappingURL=index.js.map