tauri-notice-window 1.0.21 → 1.0.23

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 ve } from "zustand";
2
2
  import { syncTabs as Se } from "zustand-sync";
3
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";
4
+ import { useCallback as H, createContext as ze, useState as E, useRef as te, useEffect as P, useContext as Ae } from "react";
5
+ import { jsx as C } from "react/jsx-runtime";
6
6
  const ce = "tauri-notice-config", ie = {
7
7
  routePrefix: "/notice",
8
8
  databaseName: "tauri-notice-db",
@@ -22,7 +22,7 @@ const ce = "tauri-notice-config", ie = {
22
22
  // Max height when auto-sizing
23
23
  autoSizeTimeout: 3e3
24
24
  // Fallback show timeout if measurement fails
25
- }, we = () => {
25
+ }, de = () => {
26
26
  try {
27
27
  const t = localStorage.getItem(ce);
28
28
  if (t)
@@ -38,10 +38,10 @@ const ce = "tauri-notice-config", ie = {
38
38
  console.warn("Failed to save config to localStorage:", e);
39
39
  }
40
40
  }, at = (t) => {
41
- const i = { ...we(), ...t };
41
+ const i = { ...de(), ...t };
42
42
  Ne(i);
43
- }, B = () => we();
44
- class De extends We {
43
+ }, T = () => de();
44
+ class xe extends We {
45
45
  messages;
46
46
  constructor(e) {
47
47
  super(e), this.version(1).stores({
@@ -50,13 +50,13 @@ class De extends We {
50
50
  }
51
51
  }
52
52
  let k = null;
53
- const de = () => {
53
+ const we = () => {
54
54
  if (!k) {
55
- const t = B();
56
- k = new De(t.databaseName);
55
+ const t = T();
56
+ k = new xe(t.databaseName);
57
57
  }
58
58
  return k;
59
- }, p = () => k || de(), xe = async (t) => {
59
+ }, f = () => k || we(), De = async (t) => {
60
60
  const e = {
61
61
  ...t,
62
62
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -65,28 +65,28 @@ const de = () => {
65
65
  queueStatus: "pending",
66
66
  queuePosition: 0
67
67
  };
68
- await p().messages.put(e);
69
- }, Me = async (t) => !!await p().messages.get(t), Oe = async (t) => {
70
- const e = await p().messages.get(t);
68
+ await f().messages.put(e);
69
+ }, Me = async (t) => !!await f().messages.get(t), Oe = async (t) => {
70
+ const e = await f().messages.get(t);
71
71
  return e?.isShown === !0 || e?.queueStatus === "shown";
72
- }, Pe = async () => await p().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), Ie = async (t, e) => {
73
- await p().messages.update(t, { queueStatus: e });
74
- }, ke = async (t) => {
75
- await p().messages.update(t, {
72
+ }, Ie = async () => await f().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), Pe = async (t, e) => {
73
+ await f().messages.update(t, { queueStatus: e });
74
+ }, Ce = async (t) => {
75
+ await f().messages.update(t, {
76
76
  queueStatus: "shown",
77
77
  isShown: !0
78
78
  });
79
- }, Ce = async (t) => {
80
- await p().messages.update(t, {
79
+ }, ke = async (t) => {
80
+ await f().messages.update(t, {
81
81
  queueStatus: "hidden"
82
82
  });
83
- }, he = async (t) => await p().messages.get(t), Le = async (t) => {
84
- await p().messages.delete(t);
85
- }, Re = async () => {
86
- await p().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
87
- }, Te = async (t) => {
83
+ }, he = async (t) => await f().messages.get(t), Le = async (t) => {
84
+ await f().messages.delete(t);
85
+ }, Te = async () => {
86
+ await f().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
87
+ }, Re = async (t) => {
88
88
  const e = t.map(
89
- (i) => p().messages.update(i.id, { queuePosition: i.position })
89
+ (i) => f().messages.update(i.id, { queuePosition: i.position })
90
90
  );
91
91
  await Promise.all(e);
92
92
  }, Ee = (t, e) => ({
@@ -103,9 +103,9 @@ const de = () => {
103
103
  console.log(`Message ${i.id} was already shown, skipping`);
104
104
  return;
105
105
  }
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();
106
+ if (await Me(i.id) || await De(i), !n.queue.some((g) => g.id === i.id)) {
107
+ const g = [...n.queue, i];
108
+ t({ queue: g }), await e().persistQueue();
109
109
  }
110
110
  !n.isProcessing && !n.currentMessage && await e().showNext();
111
111
  },
@@ -131,7 +131,7 @@ const de = () => {
131
131
  t({
132
132
  currentMessage: n,
133
133
  isProcessing: !0
134
- }), await Ie(n.id, "showing"), await e().persistQueue();
134
+ }), await Pe(n.id, "showing"), await e().persistQueue();
135
135
  },
136
136
  // Clear current message and show next
137
137
  clearCurrent: () => {
@@ -156,16 +156,16 @@ const de = () => {
156
156
  initializeFromDatabase: async () => {
157
157
  if (e().initialized) return;
158
158
  t({ initialized: !0 });
159
- const n = await Pe();
159
+ const n = await Ie();
160
160
  n.length > 0 && (t({ queue: n }), await e().showNext());
161
161
  },
162
162
  // Persist queue to database
163
163
  persistQueue: async () => {
164
- const n = e().queue.map((a, o) => ({
164
+ const n = e().queue.map((a, l) => ({
165
165
  id: a.id,
166
- position: o
166
+ position: l
167
167
  }));
168
- await Te(n);
168
+ await Re(n);
169
169
  },
170
170
  // Clear all messages on logout
171
171
  clearOnLogout: async () => {
@@ -175,11 +175,11 @@ const de = () => {
175
175
  isProcessing: !1,
176
176
  activeWindowIds: [],
177
177
  initialized: !1
178
- }), await Re();
178
+ }), await Te();
179
179
  },
180
180
  // Remove a specific message from the queue by ID (memory only)
181
181
  removeFromQueue: async (i) => {
182
- const n = e(), a = n.queue.filter((o) => o.id !== i);
182
+ const n = e(), a = n.queue.filter((l) => l.id !== i);
183
183
  t({ queue: a }), await e().persistQueue(), n.currentMessage?.id === i && e().clearCurrent();
184
184
  },
185
185
  // Delete message completely (from both memory and database)
@@ -188,11 +188,11 @@ const de = () => {
188
188
  },
189
189
  // Hide a message (mark as hidden and remove from queue)
190
190
  hideMessage: async (i) => {
191
- await Ce(i), await e().removeFromQueue(i);
191
+ await ke(i), await e().removeFromQueue(i);
192
192
  },
193
193
  // Mark message as shown in database
194
194
  markMessageAsShown: async (i) => {
195
- await ke(i);
195
+ await Ce(i);
196
196
  },
197
197
  // Add active window ID
198
198
  addActiveWindow: (i) => {
@@ -203,7 +203,7 @@ const de = () => {
203
203
  removeActiveWindow: (i) => {
204
204
  const n = e(), a = String(i);
205
205
  t({
206
- activeWindowIds: n.activeWindowIds.filter((o) => o !== a)
206
+ activeWindowIds: n.activeWindowIds.filter((l) => l !== a)
207
207
  });
208
208
  },
209
209
  // Check if window is active
@@ -211,18 +211,18 @@ const de = () => {
211
211
  const n = e(), a = String(i);
212
212
  return n.activeWindowIds.includes(a);
213
213
  }
214
- }), w = ve()(
214
+ }), d = ve()(
215
215
  Se(Ee, {
216
216
  name: "tauri-notice-queue"
217
217
  })
218
- ), T = {
218
+ ), F = {
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
223
  }, rt = () => {
224
- const t = w((i) => i.enqueue);
225
- return { showNotice: q(
224
+ const t = d((i) => i.enqueue);
225
+ return { showNotice: H(
226
226
  async (i) => {
227
227
  await t(i);
228
228
  },
@@ -237,8 +237,8 @@ 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 E;
241
- const g = "__TAURI_TO_IPC_KEY__";
240
+ var q;
241
+ const p = "__TAURI_TO_IPC_KEY__";
242
242
  function Be(t, e = !1) {
243
243
  return window.__TAURI_INTERNALS__.transformCallback(t, e);
244
244
  }
@@ -247,10 +247,10 @@ async function s(t, e = {}, i) {
247
247
  }
248
248
  class He {
249
249
  get rid() {
250
- return Fe(this, E, "f");
250
+ return Fe(this, q, "f");
251
251
  }
252
252
  constructor(e) {
253
- E.set(this, void 0), qe(this, E, e);
253
+ q.set(this, void 0), qe(this, q, e);
254
254
  }
255
255
  /**
256
256
  * Destroys and cleans up this resource from memory.
@@ -262,8 +262,8 @@ class He {
262
262
  });
263
263
  }
264
264
  }
265
- E = /* @__PURE__ */ new WeakMap();
266
- class j {
265
+ q = /* @__PURE__ */ new WeakMap();
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]);
269
269
  }
@@ -283,19 +283,19 @@ class j {
283
283
  * @since 2.0.0
284
284
  */
285
285
  toPhysical(e) {
286
- return new z(this.width * e, this.height * e);
286
+ return new W(this.width * e, this.height * e);
287
287
  }
288
- [g]() {
288
+ [p]() {
289
289
  return {
290
290
  width: this.width,
291
291
  height: this.height
292
292
  };
293
293
  }
294
294
  toJSON() {
295
- return this[g]();
295
+ return this[p]();
296
296
  }
297
297
  }
298
- class z {
298
+ class W {
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
  }
@@ -311,29 +311,29 @@ class z {
311
311
  * ```
312
312
  */
313
313
  toLogical(e) {
314
- return new j(this.width / e, this.height / e);
314
+ return new J(this.width / e, this.height / e);
315
315
  }
316
- [g]() {
316
+ [p]() {
317
317
  return {
318
318
  width: this.width,
319
319
  height: this.height
320
320
  };
321
321
  }
322
322
  toJSON() {
323
- return this[g]();
323
+ return this[p]();
324
324
  }
325
325
  }
326
- class W {
326
+ class S {
327
327
  constructor(e) {
328
328
  this.size = e;
329
329
  }
330
330
  toLogical(e) {
331
- return this.size instanceof j ? this.size : this.size.toLogical(e);
331
+ return this.size instanceof J ? this.size : this.size.toLogical(e);
332
332
  }
333
333
  toPhysical(e) {
334
- return this.size instanceof z ? this.size : this.size.toPhysical(e);
334
+ return this.size instanceof W ? this.size : this.size.toPhysical(e);
335
335
  }
336
- [g]() {
336
+ [p]() {
337
337
  return {
338
338
  [`${this.size.type}`]: {
339
339
  width: this.size.width,
@@ -342,10 +342,10 @@ class W {
342
342
  };
343
343
  }
344
344
  toJSON() {
345
- return this[g]();
345
+ return this[p]();
346
346
  }
347
347
  }
348
- class J {
348
+ class Z {
349
349
  constructor(...e) {
350
350
  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]);
351
351
  }
@@ -367,14 +367,14 @@ class J {
367
367
  toPhysical(e) {
368
368
  return new h(this.x * e, this.y * e);
369
369
  }
370
- [g]() {
370
+ [p]() {
371
371
  return {
372
372
  x: this.x,
373
373
  y: this.y
374
374
  };
375
375
  }
376
376
  toJSON() {
377
- return this[g]();
377
+ return this[p]();
378
378
  }
379
379
  }
380
380
  class h {
@@ -397,29 +397,29 @@ class h {
397
397
  * @since 2.0.0
398
398
  */
399
399
  toLogical(e) {
400
- return new J(this.x / e, this.y / e);
400
+ return new Z(this.x / e, this.y / e);
401
401
  }
402
- [g]() {
402
+ [p]() {
403
403
  return {
404
404
  x: this.x,
405
405
  y: this.y
406
406
  };
407
407
  }
408
408
  toJSON() {
409
- return this[g]();
409
+ return this[p]();
410
410
  }
411
411
  }
412
- class D {
412
+ class x {
413
413
  constructor(e) {
414
414
  this.position = e;
415
415
  }
416
416
  toLogical(e) {
417
- return this.position instanceof J ? this.position : this.position.toLogical(e);
417
+ return this.position instanceof Z ? this.position : this.position.toLogical(e);
418
418
  }
419
419
  toPhysical(e) {
420
420
  return this.position instanceof h ? this.position : this.position.toPhysical(e);
421
421
  }
422
- [g]() {
422
+ [p]() {
423
423
  return {
424
424
  [`${this.position.type}`]: {
425
425
  x: this.position.x,
@@ -428,30 +428,30 @@ class D {
428
428
  };
429
429
  }
430
430
  toJSON() {
431
- return this[g]();
431
+ return this[p]();
432
432
  }
433
433
  }
434
- var u;
434
+ var c;
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
- })(u || (u = {}));
437
+ })(c || (c = {}));
438
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 H(t, e, i) {
444
+ async function $(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
450
  handler: Be(e)
451
- }).then((o) => async () => ge(t, o));
451
+ }).then((l) => async () => ge(t, l));
452
452
  }
453
- async function Z(t, e, i) {
454
- return H(t, (n) => {
453
+ async function Y(t, e, i) {
454
+ return $(t, (n) => {
455
455
  ge(t, n.id), e(n);
456
456
  }, i);
457
457
  }
@@ -468,7 +468,7 @@ async function be(t, e, i) {
468
468
  payload: i
469
469
  });
470
470
  }
471
- class C extends He {
471
+ class L extends He {
472
472
  /**
473
473
  * Creates an Image from a resource ID. For internal use only.
474
474
  *
@@ -480,10 +480,10 @@ class C extends He {
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: F(e),
483
+ rgba: B(e),
484
484
  width: i,
485
485
  height: n
486
- }).then((a) => new C(a));
486
+ }).then((a) => new L(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 C extends He {
500
500
  */
501
501
  static async fromBytes(e) {
502
502
  return s("plugin:image|from_bytes", {
503
- bytes: F(e)
504
- }).then((i) => new C(i));
503
+ bytes: B(e)
504
+ }).then((i) => new L(i));
505
505
  }
506
506
  /**
507
507
  * Creates a new image using the provided path.
@@ -516,7 +516,7 @@ class C extends He {
516
516
  * ```
517
517
  */
518
518
  static async fromPath(e) {
519
- return s("plugin:image|from_path", { path: e }).then((i) => new C(i));
519
+ return s("plugin:image|from_path", { path: e }).then((i) => new L(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 C extends He {
529
529
  return s("plugin:image|size", { rid: this.rid });
530
530
  }
531
531
  }
532
- function F(t) {
533
- return t == null ? null : typeof t == "string" ? t : t instanceof C ? t.rid : t;
532
+ function B(t) {
533
+ return t == null ? null : typeof t == "string" ? t : t instanceof L ? t.rid : t;
534
534
  }
535
- var V;
535
+ var j;
536
536
  (function(t) {
537
537
  t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
538
- })(V || (V = {}));
539
- class Ue {
538
+ })(j || (j = {}));
539
+ class $e {
540
540
  constructor(e) {
541
541
  this._preventDefault = !1, this.event = e.event, this.id = e.id;
542
542
  }
@@ -557,13 +557,13 @@ function pe() {
557
557
  skip: !0
558
558
  });
559
559
  }
560
- async function $() {
560
+ async function G() {
561
561
  return s("plugin:window|get_all_windows").then((t) => t.map((e) => new U(e, {
562
562
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
563
563
  skip: !0
564
564
  })));
565
565
  }
566
- const G = ["tauri://created", "tauri://error"];
566
+ const Q = ["tauri://created", "tauri://error"];
567
567
  class U {
568
568
  /**
569
569
  * Creates a new Window.
@@ -605,7 +605,7 @@ class U {
605
605
  */
606
606
  static async getByLabel(e) {
607
607
  var i;
608
- return (i = (await $()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
608
+ return (i = (await G()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
609
609
  }
610
610
  /**
611
611
  * Get an instance of `Window` for the current window.
@@ -617,7 +617,7 @@ class U {
617
617
  * Gets a list of instances of `Window` for all available windows.
618
618
  */
619
619
  static async getAll() {
620
- return $();
620
+ return G();
621
621
  }
622
622
  /**
623
623
  * Gets the focused window.
@@ -630,7 +630,7 @@ class U {
630
630
  * @returns The Window instance or `undefined` if there is not any focused window.
631
631
  */
632
632
  static async getFocusedWindow() {
633
- for (const e of await $())
633
+ for (const e of await G())
634
634
  if (await e.isFocused())
635
635
  return e;
636
636
  return null;
@@ -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
- } : H(e, i, {
661
+ } : $(e, i, {
662
662
  target: { kind: "Window", label: this.label }
663
663
  });
664
664
  }
@@ -685,7 +685,7 @@ class U {
685
685
  return this._handleTauriEvent(e, i) ? () => {
686
686
  const n = this.listeners[e];
687
687
  n.splice(n.indexOf(i), 1);
688
- } : Z(e, i, {
688
+ } : Y(e, i, {
689
689
  target: { kind: "Window", label: this.label }
690
690
  });
691
691
  }
@@ -701,7 +701,7 @@ class U {
701
701
  * @param payload Event payload.
702
702
  */
703
703
  async emit(e, i) {
704
- if (G.includes(e)) {
704
+ if (Q.includes(e)) {
705
705
  for (const n of this.listeners[e] || [])
706
706
  n({
707
707
  event: e,
@@ -725,7 +725,7 @@ class U {
725
725
  * @param payload Event payload.
726
726
  */
727
727
  async emitTo(e, i, n) {
728
- if (G.includes(i)) {
728
+ if (Q.includes(i)) {
729
729
  for (const a of this.listeners[i] || [])
730
730
  a({
731
731
  event: i,
@@ -738,7 +738,7 @@ class U {
738
738
  }
739
739
  /** @ignore */
740
740
  _handleTauriEvent(e, i) {
741
- return G.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
741
+ return Q.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
742
742
  }
743
743
  // Getters
744
744
  /**
@@ -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 z(e));
803
+ }).then((e) => new W(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 z(e));
819
+ }).then((e) => new W(e));
820
820
  }
821
821
  /**
822
822
  * Gets the window's current fullscreen state.
@@ -1067,7 +1067,7 @@ class U {
1067
1067
  */
1068
1068
  async requestUserAttention(e) {
1069
1069
  let i = null;
1070
- return e && (e === V.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
1070
+ return e && (e === j.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
1071
1071
  label: this.label,
1072
1072
  value: i
1073
1073
  });
@@ -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 W ? e : new W(e)
1470
+ value: e instanceof S ? e : new S(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 W ? e : e ? new W(e) : null
1487
+ value: e instanceof S ? e : e ? new S(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 W ? e : e ? new W(e) : null
1504
+ value: e instanceof S ? e : e ? new S(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 D ? e : new D(e)
1546
+ value: e instanceof x ? e : new x(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: F(e)
1640
+ value: B(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 D ? e : new D(e)
1758
+ value: e instanceof x ? e : new x(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 ? F(e) : void 0
1875
+ value: e ? B(e) : void 0
1876
1876
  });
1877
1877
  }
1878
1878
  /**
@@ -1961,8 +1961,8 @@ class U {
1961
1961
  * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
1962
1962
  */
1963
1963
  async onResized(e) {
1964
- return this.listen(u.WINDOW_RESIZED, (i) => {
1965
- i.payload = new z(i.payload), e(i);
1964
+ return this.listen(c.WINDOW_RESIZED, (i) => {
1965
+ i.payload = new W(i.payload), e(i);
1966
1966
  });
1967
1967
  }
1968
1968
  /**
@@ -1983,7 +1983,7 @@ class U {
1983
1983
  * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
1984
1984
  */
1985
1985
  async onMoved(e) {
1986
- return this.listen(u.WINDOW_MOVED, (i) => {
1986
+ return this.listen(c.WINDOW_MOVED, (i) => {
1987
1987
  i.payload = new h(i.payload), e(i);
1988
1988
  });
1989
1989
  }
@@ -2010,8 +2010,8 @@ class U {
2010
2010
  * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
2011
2011
  */
2012
2012
  async onCloseRequested(e) {
2013
- return this.listen(u.WINDOW_CLOSE_REQUESTED, async (i) => {
2014
- const n = new Ue(i);
2013
+ return this.listen(c.WINDOW_CLOSE_REQUESTED, async (i) => {
2014
+ const n = new $e(i);
2015
2015
  await e(n), n.isPreventDefault() || await this.destroy();
2016
2016
  });
2017
2017
  }
@@ -2041,7 +2041,7 @@ class U {
2041
2041
  * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
2042
2042
  */
2043
2043
  async onDragDropEvent(e) {
2044
- const i = await this.listen(u.DRAG_ENTER, (r) => {
2044
+ const i = await this.listen(c.DRAG_ENTER, (r) => {
2045
2045
  e({
2046
2046
  ...r,
2047
2047
  payload: {
@@ -2050,7 +2050,7 @@ class U {
2050
2050
  position: new h(r.payload.position)
2051
2051
  }
2052
2052
  });
2053
- }), n = await this.listen(u.DRAG_OVER, (r) => {
2053
+ }), n = await this.listen(c.DRAG_OVER, (r) => {
2054
2054
  e({
2055
2055
  ...r,
2056
2056
  payload: {
@@ -2058,7 +2058,7 @@ class U {
2058
2058
  position: new h(r.payload.position)
2059
2059
  }
2060
2060
  });
2061
- }), a = await this.listen(u.DRAG_DROP, (r) => {
2061
+ }), a = await this.listen(c.DRAG_DROP, (r) => {
2062
2062
  e({
2063
2063
  ...r,
2064
2064
  payload: {
@@ -2067,11 +2067,11 @@ class U {
2067
2067
  position: new h(r.payload.position)
2068
2068
  }
2069
2069
  });
2070
- }), o = await this.listen(u.DRAG_LEAVE, (r) => {
2070
+ }), l = await this.listen(c.DRAG_LEAVE, (r) => {
2071
2071
  e({ ...r, payload: { type: "leave" } });
2072
2072
  });
2073
2073
  return () => {
2074
- i(), a(), n(), o();
2074
+ i(), a(), n(), l();
2075
2075
  };
2076
2076
  }
2077
2077
  /**
@@ -2092,9 +2092,9 @@ class U {
2092
2092
  * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
2093
2093
  */
2094
2094
  async onFocusChanged(e) {
2095
- const i = await this.listen(u.WINDOW_FOCUS, (a) => {
2095
+ const i = await this.listen(c.WINDOW_FOCUS, (a) => {
2096
2096
  e({ ...a, payload: !0 });
2097
- }), n = await this.listen(u.WINDOW_BLUR, (a) => {
2097
+ }), n = await this.listen(c.WINDOW_BLUR, (a) => {
2098
2098
  e({ ...a, payload: !1 });
2099
2099
  });
2100
2100
  return () => {
@@ -2123,7 +2123,7 @@ class U {
2123
2123
  * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
2124
2124
  */
2125
2125
  async onScaleChanged(e) {
2126
- return this.listen(u.WINDOW_SCALE_FACTOR_CHANGED, e);
2126
+ return this.listen(c.WINDOW_SCALE_FACTOR_CHANGED, e);
2127
2127
  }
2128
2128
  /**
2129
2129
  * Listen to the system theme change.
@@ -2143,7 +2143,7 @@ class U {
2143
2143
  * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
2144
2144
  */
2145
2145
  async onThemeChanged(e) {
2146
- return this.listen(u.WINDOW_THEME_CHANGED, e);
2146
+ return this.listen(c.WINDOW_THEME_CHANGED, e);
2147
2147
  }
2148
2148
  }
2149
2149
  var se;
@@ -2162,29 +2162,29 @@ var oe;
2162
2162
  (function(t) {
2163
2163
  t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
2164
2164
  })(oe || (oe = {}));
2165
- function $e(t) {
2165
+ function Ue(t) {
2166
2166
  return t === null ? null : {
2167
2167
  name: t.name,
2168
2168
  scaleFactor: t.scaleFactor,
2169
2169
  position: new h(t.position),
2170
- size: new z(t.size),
2170
+ size: new W(t.size),
2171
2171
  workArea: {
2172
2172
  position: new h(t.workArea.position),
2173
- size: new z(t.workArea.size)
2173
+ size: new W(t.workArea.size)
2174
2174
  }
2175
2175
  };
2176
2176
  }
2177
2177
  async function Ge() {
2178
- return s("plugin:window|primary_monitor").then($e);
2178
+ return s("plugin:window|primary_monitor").then(Ue);
2179
2179
  }
2180
2180
  function fe() {
2181
- return new Y(pe(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
2181
+ return new K(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
2186
  async function le() {
2187
- return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new Y(new U(e.windowLabel, {
2187
+ return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new K(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
2190
2190
  }), e.label, {
@@ -2192,8 +2192,8 @@ async function le() {
2192
2192
  skip: !0
2193
2193
  })));
2194
2194
  }
2195
- const Q = ["tauri://created", "tauri://error"];
2196
- class Y {
2195
+ const V = ["tauri://created", "tauri://error"];
2196
+ class K {
2197
2197
  /**
2198
2198
  * Creates a new Webview.
2199
2199
  * @example
@@ -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
- } : H(e, i, {
2288
+ } : $(e, i, {
2289
2289
  target: { kind: "Webview", label: this.label }
2290
2290
  });
2291
2291
  }
@@ -2312,7 +2312,7 @@ class Y {
2312
2312
  return this._handleTauriEvent(e, i) ? () => {
2313
2313
  const n = this.listeners[e];
2314
2314
  n.splice(n.indexOf(i), 1);
2315
- } : Z(e, i, {
2315
+ } : Y(e, i, {
2316
2316
  target: { kind: "Webview", label: this.label }
2317
2317
  });
2318
2318
  }
@@ -2329,7 +2329,7 @@ class Y {
2329
2329
  * @param payload Event payload.
2330
2330
  */
2331
2331
  async emit(e, i) {
2332
- if (Q.includes(e)) {
2332
+ if (V.includes(e)) {
2333
2333
  for (const n of this.listeners[e] || [])
2334
2334
  n({
2335
2335
  event: e,
@@ -2354,7 +2354,7 @@ class Y {
2354
2354
  * @param payload Event payload.
2355
2355
  */
2356
2356
  async emitTo(e, i, n) {
2357
- if (Q.includes(i)) {
2357
+ if (V.includes(i)) {
2358
2358
  for (const a of this.listeners[i] || [])
2359
2359
  a({
2360
2360
  event: i,
@@ -2367,7 +2367,7 @@ class Y {
2367
2367
  }
2368
2368
  /** @ignore */
2369
2369
  _handleTauriEvent(e, i) {
2370
- return Q.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
2370
+ return V.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
2371
2371
  }
2372
2372
  // Getters
2373
2373
  /**
@@ -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 z(e));
2402
+ }).then((e) => new W(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 W ? e : new W(e)
2434
+ value: e instanceof S ? e : new S(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 D ? e : new D(e)
2451
+ value: e instanceof x ? e : new x(e)
2452
2452
  });
2453
2453
  }
2454
2454
  /**
@@ -2604,7 +2604,7 @@ class Y {
2604
2604
  * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
2605
2605
  */
2606
2606
  async onDragDropEvent(e) {
2607
- const i = await this.listen(u.DRAG_ENTER, (r) => {
2607
+ const i = await this.listen(c.DRAG_ENTER, (r) => {
2608
2608
  e({
2609
2609
  ...r,
2610
2610
  payload: {
@@ -2613,7 +2613,7 @@ class Y {
2613
2613
  position: new h(r.payload.position)
2614
2614
  }
2615
2615
  });
2616
- }), n = await this.listen(u.DRAG_OVER, (r) => {
2616
+ }), n = await this.listen(c.DRAG_OVER, (r) => {
2617
2617
  e({
2618
2618
  ...r,
2619
2619
  payload: {
@@ -2621,7 +2621,7 @@ class Y {
2621
2621
  position: new h(r.payload.position)
2622
2622
  }
2623
2623
  });
2624
- }), a = await this.listen(u.DRAG_DROP, (r) => {
2624
+ }), a = await this.listen(c.DRAG_DROP, (r) => {
2625
2625
  e({
2626
2626
  ...r,
2627
2627
  payload: {
@@ -2630,25 +2630,25 @@ class Y {
2630
2630
  position: new h(r.payload.position)
2631
2631
  }
2632
2632
  });
2633
- }), o = await this.listen(u.DRAG_LEAVE, (r) => {
2633
+ }), l = await this.listen(c.DRAG_LEAVE, (r) => {
2634
2634
  e({ ...r, payload: { type: "leave" } });
2635
2635
  });
2636
2636
  return () => {
2637
- i(), a(), n(), o();
2637
+ i(), a(), n(), l();
2638
2638
  };
2639
2639
  }
2640
2640
  }
2641
- function N() {
2641
+ function A() {
2642
2642
  const t = fe();
2643
- return new x(t.label, { skip: !0 });
2643
+ return new D(t.label, { skip: !0 });
2644
2644
  }
2645
2645
  async function ue() {
2646
- return s("plugin:window|get_all_windows").then((t) => t.map((e) => new x(e, {
2646
+ return s("plugin:window|get_all_windows").then((t) => t.map((e) => new D(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 x {
2651
+ class D {
2652
2652
  /**
2653
2653
  * Creates a new {@link Window} hosting a {@link Webview}.
2654
2654
  * @example
@@ -2692,13 +2692,13 @@ class x {
2692
2692
  static async getByLabel(e) {
2693
2693
  var i;
2694
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;
2695
+ return n ? new D(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 N();
2701
+ return A();
2702
2702
  }
2703
2703
  /**
2704
2704
  * Gets a list of instances of `Webview` for all available webviews.
@@ -2729,7 +2729,7 @@ class x {
2729
2729
  return this._handleTauriEvent(e, i) ? () => {
2730
2730
  const n = this.listeners[e];
2731
2731
  n.splice(n.indexOf(i), 1);
2732
- } : H(e, i, {
2732
+ } : $(e, i, {
2733
2733
  target: { kind: "WebviewWindow", label: this.label }
2734
2734
  });
2735
2735
  }
@@ -2756,7 +2756,7 @@ class x {
2756
2756
  return this._handleTauriEvent(e, i) ? () => {
2757
2757
  const n = this.listeners[e];
2758
2758
  n.splice(n.indexOf(i), 1);
2759
- } : Z(e, i, {
2759
+ } : Y(e, i, {
2760
2760
  target: { kind: "WebviewWindow", label: this.label }
2761
2761
  });
2762
2762
  }
@@ -2780,7 +2780,7 @@ class x {
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
- Qe(x, [U, Y]);
2783
+ Qe(D, [U, K]);
2784
2784
  function Qe(t, e) {
2785
2785
  (Array.isArray(e) ? e : [e]).forEach((i) => {
2786
2786
  Object.getOwnPropertyNames(i.prototype).forEach((n) => {
@@ -2794,7 +2794,7 @@ function Qe(t, e) {
2794
2794
  });
2795
2795
  });
2796
2796
  }
2797
- const L = /* @__PURE__ */ new Map(), Ve = () => navigator.platform.toLowerCase().includes("mac") || navigator.userAgent.toLowerCase().includes("mac"), je = (t) => {
2797
+ const R = /* @__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://"));
@@ -2817,12 +2817,12 @@ const L = /* @__PURE__ */ new Map(), Ve = () => navigator.platform.toLowerCase()
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 Je();
2820
+ const { screenWidth: a, screenHeight: l } = await Je();
2821
2821
  switch (i?.position ?? "right-bottom") {
2822
2822
  case "right-bottom":
2823
2823
  return {
2824
2824
  x: a - t - n,
2825
- y: o - e - n
2825
+ y: l - e - n
2826
2826
  };
2827
2827
  case "right-top":
2828
2828
  return {
@@ -2832,7 +2832,7 @@ const L = /* @__PURE__ */ new Map(), Ve = () => navigator.platform.toLowerCase()
2832
2832
  case "left-bottom":
2833
2833
  return {
2834
2834
  x: n,
2835
- y: o - e - n
2835
+ y: l - e - n
2836
2836
  };
2837
2837
  case "left-top":
2838
2838
  return {
@@ -2842,215 +2842,224 @@ const L = /* @__PURE__ */ new Map(), Ve = () => navigator.platform.toLowerCase()
2842
2842
  case "center":
2843
2843
  return {
2844
2844
  x: (a - t) / 2,
2845
- y: (o - e) / 2
2845
+ y: (l - e) / 2
2846
2846
  };
2847
2847
  default:
2848
2848
  return {
2849
2849
  x: a - t - n,
2850
- y: o - e - n
2850
+ y: l - e - n
2851
2851
  };
2852
2852
  }
2853
2853
  }, Ze = async (t) => {
2854
- const e = String(t.id), i = w.getState();
2854
+ const e = String(t.id), i = d.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 = B(), a = `notice-${e}`;
2860
- let o = `${n.routePrefix}/${t.type}?id=${t.id}`;
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);
2859
+ const n = T(), a = `notice-${e}`;
2860
+ let l = `${n.routePrefix}/${t.type}?id=${t.id}`;
2861
+ je(l) || (console.warn(`Invalid window URL: ${l}. Using fallback 404 page.`), l = n.notFoundUrl || "/404");
2862
+ const r = n.autoSize ?? !0, g = t.min_width || n.defaultWidth, m = r ? n.maxHeight ?? 800 : t.min_height || n.defaultHeight, y = t.decorations ?? n.defaultDecorations ?? !0, z = t.min_height || n.defaultHeight, { x: M, y: O } = await me(g, z, t.windowPosition);
2863
2863
  try {
2864
- const d = {
2865
- url: o,
2864
+ const w = {
2865
+ url: l,
2866
2866
  title: t.title,
2867
- width: r,
2868
- height: y,
2867
+ width: g,
2868
+ height: m,
2869
2869
  x: M,
2870
- y: S,
2870
+ y: O,
2871
2871
  resizable: !0,
2872
2872
  skipTaskbar: !1,
2873
2873
  alwaysOnTop: !0
2874
2874
  };
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
- let l = null;
2879
- const m = n.loadTimeout ?? 1e4;
2880
- !_ && m > 0 && (l = setTimeout(async () => {
2875
+ r && (w.visible = !1), y ? w.decorations = !0 : Ve() ? (w.decorations = !0, w.titleBarStyle = "overlay", w.hiddenTitle = !0) : (w.decorations = !1, w.transparent = !0);
2876
+ const b = new D(a, w);
2877
+ R.set(e, b), i.addActiveWindow(e);
2878
+ let u = null;
2879
+ const _ = n.loadTimeout ?? 1e4;
2880
+ !y && _ > 0 && (u = setTimeout(async () => {
2881
2881
  console.warn(`Notice window ${a} load timeout - auto closing`);
2882
2882
  try {
2883
- await f.close();
2883
+ await b.close();
2884
2884
  } catch {
2885
2885
  }
2886
- }, m)), f.once("tauri://created", () => {
2887
- l && (clearTimeout(l), l = null), console.log(`Notice window created successfully: ${a}`);
2888
- }), f.once("tauri://error", async (v) => {
2889
- if (console.error(`Notice window error: ${a}`, v), l && (clearTimeout(l), l = null), !_)
2886
+ }, _)), b.once("tauri://created", () => {
2887
+ u && (clearTimeout(u), u = null), console.log(`Notice window created successfully: ${a}`);
2888
+ }), b.once("tauri://error", async (o) => {
2889
+ if (console.error(`Notice window error: ${a}`, o), u && (clearTimeout(u), u = null), !y)
2890
2890
  try {
2891
- await f.close();
2891
+ await b.close();
2892
2892
  } catch {
2893
2893
  }
2894
- }), f.once("tauri://destroyed", async () => {
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
- }
2900
- }, K = async (t) => {
2901
- const e = String(t), i = L.get(e), n = w.getState();
2894
+ }), b.once("tauri://destroyed", async () => {
2895
+ u && (clearTimeout(u), u = null), R.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
2896
+ }), console.log(`Created notice window: ${a} (autoSize: ${r}, visible: ${!r})`);
2897
+ } catch (w) {
2898
+ console.error("Failed to create notice window:", w), i.removeActiveWindow(e), i.clearCurrent();
2899
+ }
2900
+ }, X = async (t) => {
2901
+ const e = String(t), i = R.get(e), n = d.getState();
2902
2902
  if (i)
2903
2903
  try {
2904
- await i.close(), L.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
2904
+ await i.close(), R.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
2908
  }, Ye = async () => {
2909
- const t = Array.from(L.keys()).map(
2910
- (e) => K(e)
2909
+ const t = Array.from(R.keys()).map(
2910
+ (e) => X(e)
2911
2911
  );
2912
2912
  await Promise.all(t);
2913
2913
  }, Ke = () => {
2914
2914
  let t = null;
2915
- w.subscribe((e) => {
2915
+ d.subscribe((e) => {
2916
2916
  const i = e.currentMessage;
2917
2917
  i && i !== t ? (t = i, Ze(i)) : i || (t = null);
2918
2918
  }), console.log("Notice window system initialized");
2919
2919
  }, ot = () => {
2920
- const t = w((i) => i.currentMessage);
2921
- return { closeNotice: q(async () => {
2922
- t && await K(t.id);
2920
+ const t = d((i) => i.currentMessage);
2921
+ return { closeNotice: H(async () => {
2922
+ t && await X(t.id);
2923
2923
  }, [t]) };
2924
2924
  }, lt = () => {
2925
- const t = w((i) => i.hideMessage);
2926
- return { hideNotice: q(
2925
+ const t = d((i) => i.hideMessage);
2926
+ return { hideNotice: H(
2927
2927
  async (i) => {
2928
- await t(i), await K(i);
2928
+ await t(i), await X(i);
2929
2929
  },
2930
2930
  [t]
2931
2931
  ) };
2932
2932
  }, ut = () => {
2933
- const t = w((i) => i.clearOnLogout);
2934
- return { hideAllNotices: q(async () => {
2933
+ const t = d((i) => i.clearOnLogout);
2934
+ return { hideAllNotices: H(async () => {
2935
2935
  await Ye(), await t();
2936
2936
  }, [t]) };
2937
2937
  }, ct = () => {
2938
- const t = w(T.queueLength), e = w(T.currentMessage), i = w(T.isProcessing), n = w(T.queue);
2938
+ const t = d(F.queueLength), e = d(F.currentMessage), i = d(F.isProcessing), n = d(F.queue);
2939
2939
  return {
2940
2940
  queueLength: t,
2941
2941
  currentMessage: e,
2942
2942
  isProcessing: i,
2943
2943
  queue: n
2944
2944
  };
2945
- }, _e = ze({ windowReady: !0 }), wt = () => Ae(_e), Xe = async (t) => {
2945
+ }, _e = ze({ windowReady: !0 }), dt = () => Ae(_e), Xe = async (t) => {
2946
2946
  try {
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
- await r.setSize(new j(i, 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}`);
2947
+ const e = T(), i = e.defaultWidth || 400, n = e.maxHeight ?? 800, a = e.defaultHeight || 300, l = 32, r = Math.ceil(t) + l, g = Math.max(a, Math.min(r, n)), m = A();
2948
+ await m.setSize(new J(i, g));
2949
+ const { x: y, y: z } = await me(i, g);
2950
+ await m.setPosition(new Z(y, z)), await m.show(), console.log(`[NoticeLayout] Auto-sized window to ${i}x${g} (content=${Math.ceil(t)}, chrome=${l})`);
2951
2951
  } catch (e) {
2952
2952
  console.error("[NoticeLayout] Failed to auto-size, showing window as-is:", e);
2953
2953
  try {
2954
- await N().show();
2954
+ await A().show();
2955
2955
  } catch {
2956
2956
  }
2957
2957
  }
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;
2958
+ }, wt = ({ children: t, onLoad: e, onClose: i }) => {
2959
+ const [n, a] = E(null), [l, r] = E(!0), [g, m] = E(null), [y, z] = E(!1), M = te(null), O = te(!1), w = T(), b = w.autoSize ?? !0;
2960
2960
  return P(() => {
2961
- l || M(!0);
2962
- }, [l]), P(() => {
2961
+ b || z(!0);
2962
+ }, [b]), P(() => {
2963
2963
  (async () => {
2964
2964
  try {
2965
- const c = new URLSearchParams(window.location.search).get("id");
2966
- if (!c) {
2967
- _("No message ID provided"), r(!1), setTimeout(async () => {
2965
+ const o = new URLSearchParams(window.location.search).get("id");
2966
+ if (!o) {
2967
+ m("No message ID provided"), r(!1), setTimeout(async () => {
2968
2968
  try {
2969
- await N().close();
2970
- } catch (A) {
2971
- console.error("Failed to close window:", A);
2969
+ await A().close();
2970
+ } catch (v) {
2971
+ console.error("Failed to close window:", v);
2972
2972
  }
2973
2973
  }, 1e3);
2974
2974
  return;
2975
2975
  }
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 () => {
2976
+ const I = await he(o);
2977
+ if (!I) {
2978
+ console.log(`Message ${o} not found in database, closing window`), m("Message not found"), r(!1), setTimeout(async () => {
2979
2979
  try {
2980
- await N().close();
2981
- } catch (A) {
2982
- console.error("Failed to close window:", A);
2980
+ await A().close();
2981
+ } catch (v) {
2982
+ console.error("Failed to close window:", v);
2983
2983
  }
2984
2984
  }, 500);
2985
2985
  return;
2986
2986
  }
2987
- a(O), r(!1), e && e(O);
2988
- } catch (v) {
2989
- console.error("Failed to load message:", v), _("Failed to load message"), r(!1), setTimeout(async () => {
2987
+ a(I), r(!1), e && e(I);
2988
+ } catch (_) {
2989
+ console.error("Failed to load message:", _), m("Failed to load message"), r(!1), setTimeout(async () => {
2990
2990
  try {
2991
- await N().close();
2992
- } catch (c) {
2993
- console.error("Failed to close window:", c);
2991
+ await A().close();
2992
+ } catch (o) {
2993
+ console.error("Failed to close window:", o);
2994
2994
  }
2995
2995
  }, 1e3);
2996
2996
  }
2997
2997
  })();
2998
2998
  }, [e]), P(() => {
2999
- if (!l || !n || b || d.current) return;
3000
- const m = requestAnimationFrame(() => {
3001
- const v = requestAnimationFrame(() => {
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);
2999
+ if (!b || !n || y || O.current) return;
3000
+ let u;
3001
+ const _ = requestAnimationFrame(() => {
3002
+ u = requestAnimationFrame(() => {
3003
+ if (!M.current || O.current) return;
3004
+ O.current = !0;
3005
+ const o = M.current, v = T().defaultWidth || 400, N = {
3006
+ position: o.style.position,
3007
+ top: o.style.top,
3008
+ left: o.style.left,
3009
+ width: o.style.width,
3010
+ height: o.style.height,
3011
+ overflow: o.style.overflow
3012
+ };
3013
+ o.style.position = "fixed", o.style.top = "0", o.style.left = "0", o.style.width = `${v}px`, o.style.height = "auto", o.style.overflow = "visible", o.offsetHeight;
3014
+ const ee = o.scrollHeight;
3015
+ console.log(`[NoticeLayout] Measured content height: ${ee}px (container detached at ${v}px width)`), o.style.position = N.position, o.style.top = N.top, o.style.left = N.left, o.style.width = N.width, o.style.height = N.height, o.style.overflow = N.overflow, Xe(ee).then(() => {
3016
+ z(!0);
3009
3017
  });
3010
3018
  });
3011
- return () => cancelAnimationFrame(v);
3012
3019
  });
3013
- return () => cancelAnimationFrame(m);
3014
- }, [l, n, b]), P(() => {
3015
- if (!l || b) return;
3016
- const m = f.autoSizeTimeout ?? 3e3, v = setTimeout(async () => {
3017
- if (!b) {
3020
+ return () => {
3021
+ cancelAnimationFrame(_), u !== void 0 && cancelAnimationFrame(u);
3022
+ };
3023
+ }, [b, n, y]), P(() => {
3024
+ if (!b || y) return;
3025
+ const u = w.autoSizeTimeout ?? 3e3, _ = setTimeout(async () => {
3026
+ if (!y) {
3018
3027
  console.warn("[NoticeLayout] Auto-size timeout reached, showing window as-is");
3019
3028
  try {
3020
- await N().show();
3029
+ await A().show();
3021
3030
  } catch {
3022
3031
  }
3023
- M(!0);
3032
+ z(!0);
3024
3033
  }
3025
- }, m);
3026
- return () => clearTimeout(v);
3027
- }, [l, b, f.autoSizeTimeout]), P(() => {
3034
+ }, u);
3035
+ return () => clearTimeout(_);
3036
+ }, [b, y, w.autoSizeTimeout]), P(() => {
3028
3037
  if (!n || !i) return;
3029
- const m = () => {
3038
+ const u = () => {
3030
3039
  i(n);
3031
3040
  };
3032
- return window.addEventListener("beforeunload", m), () => window.removeEventListener("beforeunload", m);
3033
- }, [n, i]), o ? /* @__PURE__ */ I("div", { style: {
3041
+ return window.addEventListener("beforeunload", u), () => window.removeEventListener("beforeunload", u);
3042
+ }, [n, i]), l ? /* @__PURE__ */ C("div", { style: {
3034
3043
  display: "flex",
3035
3044
  justifyContent: "center",
3036
3045
  alignItems: "center",
3037
3046
  height: "100vh",
3038
3047
  fontFamily: "system-ui, -apple-system, sans-serif"
3039
- }, children: "Loading..." }) : y ? /* @__PURE__ */ I("div", { style: {
3048
+ }, children: "Loading..." }) : g ? /* @__PURE__ */ C("div", { style: {
3040
3049
  display: "flex",
3041
3050
  justifyContent: "center",
3042
3051
  alignItems: "center",
3043
3052
  height: "100vh",
3044
3053
  fontFamily: "system-ui, -apple-system, sans-serif",
3045
3054
  color: "#ef4444"
3046
- }, children: y }) : n ? /* @__PURE__ */ I(_e.Provider, { value: { windowReady: b }, children: /* @__PURE__ */ I(
3055
+ }, children: g }) : n ? /* @__PURE__ */ C(_e.Provider, { value: { windowReady: y }, children: /* @__PURE__ */ C(
3047
3056
  "div",
3048
3057
  {
3049
- ref: S,
3050
- style: b ? { height: "100vh" } : void 0,
3058
+ ref: M,
3059
+ style: y ? { height: "100vh" } : void 0,
3051
3060
  children: t(n)
3052
3061
  }
3053
- ) }) : /* @__PURE__ */ I("div", { style: {
3062
+ ) }) : /* @__PURE__ */ C("div", { style: {
3054
3063
  display: "flex",
3055
3064
  justifyContent: "center",
3056
3065
  alignItems: "center",
@@ -3059,40 +3068,40 @@ const L = /* @__PURE__ */ new Map(), Ve = () => navigator.platform.toLowerCase()
3059
3068
  color: "#ef4444"
3060
3069
  }, children: "Closing window..." });
3061
3070
  }, ht = async () => {
3062
- de(), Ke();
3063
- const { initializeFromDatabase: t } = w.getState();
3071
+ we(), Ke();
3072
+ const { initializeFromDatabase: t } = d.getState();
3064
3073
  await t(), console.log("Tauri Notice System initialized");
3065
3074
  }, gt = async (t) => {
3066
- await w.getState().deleteMessage(t);
3075
+ await d.getState().deleteMessage(t);
3067
3076
  }, yt = async (t) => {
3068
- await w.getState().hideMessage(t);
3077
+ await d.getState().hideMessage(t);
3069
3078
  }, bt = async (t) => {
3070
- await w.getState().markMessageAsShown(t);
3079
+ await d.getState().markMessageAsShown(t);
3071
3080
  };
3072
3081
  export {
3073
- dt as NoticeLayout,
3082
+ wt as NoticeLayout,
3074
3083
  me as calculateWindowPosition,
3075
3084
  Ye as closeAllNoticeWindows,
3076
- K as closeNoticeWindow,
3085
+ X as closeNoticeWindow,
3077
3086
  Ze as createNoticeWindow,
3078
3087
  gt as deleteMessageById,
3079
3088
  Je as getLogicalScreenSize,
3080
3089
  he as getMessage,
3081
- B as getNoticeConfig,
3082
- Pe as getPendingMessages,
3090
+ T as getNoticeConfig,
3091
+ Ie as getPendingMessages,
3083
3092
  yt as hideMessageById,
3084
- de as initializeDatabase,
3093
+ we as initializeDatabase,
3085
3094
  ht as initializeNoticeSystem,
3086
3095
  Ke as initializeNoticeWindowSystem,
3087
3096
  bt as markMessageAsShown,
3088
- T as messageQueueSelectors,
3097
+ F as messageQueueSelectors,
3089
3098
  at as setNoticeConfig,
3090
3099
  ot as useCloseNotice,
3091
3100
  ut as useHideAllNotices,
3092
3101
  lt as useHideNotice,
3093
3102
  ct as useMessageQueue,
3094
- w as useMessageQueueStore,
3103
+ d as useMessageQueueStore,
3095
3104
  rt as useNoticeWindow,
3096
- wt as useNoticeWindowContext
3105
+ dt as useNoticeWindowContext
3097
3106
  };
3098
3107
  //# sourceMappingURL=index.js.map