vue3-router-tab 1.3.9 → 1.4.1

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.
@@ -1,7 +1,7 @@
1
1
  import './vue3-router-tab.css';
2
- import { reactive as ae, ref as S, shallowRef as Ct, computed as C, watch as A, nextTick as B, inject as Me, getCurrentInstance as We, onMounted as ke, defineComponent as Ce, provide as Kt, onErrorCaptured as Et, onBeforeUnmount as $t, h as At, resolveComponent as Pt, createElementBlock as x, openBlock as $, createElementVNode as j, withDirectives as St, normalizeClass as J, renderSlot as pe, createVNode as Le, TransitionGroup as It, mergeProps as ve, withCtx as he, Fragment as me, renderList as Oe, withModifiers as ye, createCommentVNode as ee, toDisplayString as je, normalizeProps as xt, createBlock as te, KeepAlive as Dt, resolveDynamicComponent as ze, Transition as Bt, normalizeStyle as Mt, vShow as Lt, isRef as Ot, isReadonly as jt } from "vue";
3
- import { RouterView as zt } from "vue-router";
4
- function Nt(e = {}) {
2
+ import { reactive as ie, ref as x, shallowRef as Kt, computed as K, watch as S, nextTick as M, inject as Me, getCurrentInstance as Fe, onMounted as He, onBeforeMount as Et, defineComponent as Ce, provide as $t, onErrorCaptured as Pt, onBeforeUnmount as At, h as St, resolveComponent as It, createElementBlock as B, openBlock as $, createElementVNode as V, withDirectives as xt, normalizeClass as q, renderSlot as he, createVNode as Bt, TransitionGroup as Dt, mergeProps as me, withCtx as ye, Fragment as Te, renderList as Le, withModifiers as Re, createCommentVNode as te, toDisplayString as Oe, createBlock as X, normalizeProps as Mt, KeepAlive as Lt, resolveDynamicComponent as je, Transition as Ot, normalizeStyle as jt, vShow as Ut, isRef as Vt, isReadonly as Nt } from "vue";
3
+ import { RouterView as _t } from "vue-router";
4
+ function zt(e = {}) {
5
5
  return {
6
6
  initialTabs: e.initialTabs ?? [],
7
7
  keepAlive: e.keepAlive ?? !0,
@@ -11,26 +11,26 @@ function Nt(e = {}) {
11
11
  defaultRoute: e.defaultRoute ?? "/"
12
12
  };
13
13
  }
14
- function V(e, r) {
14
+ function N(e, r) {
15
15
  const o = e.resolve(r);
16
16
  if (!o || !o.matched.length)
17
17
  throw new Error(`[RouterTabs] Unable to resolve route: ${String(r)}`);
18
18
  return o;
19
19
  }
20
- const Ut = {
20
+ const Yt = {
21
21
  path: (e) => e.path,
22
22
  fullpath: (e) => e.fullPath,
23
23
  fullname: (e) => e.fullPath,
24
24
  full: (e) => e.fullPath,
25
25
  name: (e) => e.name ? String(e.name) : e.fullPath
26
26
  };
27
- function _(e) {
27
+ function z(e) {
28
28
  const r = e.meta?.key;
29
29
  if (typeof r == "function") {
30
30
  const o = r(e);
31
31
  if (typeof o == "string" && o.length) return o;
32
32
  } else if (typeof r == "string" && r.length) {
33
- const o = Ut[r.toLowerCase()];
33
+ const o = Yt[r.toLowerCase()];
34
34
  return o ? o(e) : r;
35
35
  }
36
36
  return e.fullPath;
@@ -43,14 +43,14 @@ function Ee(e, r) {
43
43
  const o = e.meta?.reuse;
44
44
  return typeof o == "boolean" ? o : r;
45
45
  }
46
- function qe(e) {
46
+ function We(e) {
47
47
  const r = e.meta ?? {}, o = {};
48
48
  return "title" in r && (o.title = r.title), "tips" in r && (o.tips = r.tips), "icon" in r && (o.icon = r.icon), "closable" in r && (o.closable = r.closable), "tabClass" in r && (o.tabClass = r.tabClass), "target" in r && (o.target = r.target), "href" in r && (o.href = r.href), o;
49
49
  }
50
50
  function ne(e, r, o) {
51
- const s = qe(e);
51
+ const s = We(e);
52
52
  return {
53
- id: _(e),
53
+ id: z(e),
54
54
  to: e.fullPath,
55
55
  fullPath: e.fullPath,
56
56
  matched: e,
@@ -62,32 +62,32 @@ function ne(e, r, o) {
62
62
  ...r
63
63
  };
64
64
  }
65
- function Te(e, r, o, s) {
66
- if (!e.find((p) => p.id === r.id)) {
65
+ function we(e, r, o, s) {
66
+ if (!e.find((v) => v.id === r.id)) {
67
67
  if (o === "next" && s) {
68
- const p = e.findIndex((T) => T.id === s);
69
- if (p !== -1) {
70
- e.splice(p + 1, 0, r);
68
+ const v = e.findIndex((R) => R.id === s);
69
+ if (v !== -1) {
70
+ e.splice(v + 1, 0, r);
71
71
  return;
72
72
  }
73
73
  }
74
74
  e.push(r);
75
75
  }
76
76
  }
77
- function Re(e, r, o, s) {
77
+ function oe(e, r, o, s) {
78
78
  if (!r || r <= 0) return;
79
- const a = e.filter((p) => p.alive);
79
+ const a = e.filter((v) => v.alive);
80
80
  for (; a.length > r; ) {
81
- const p = a.shift();
82
- if (!p || p.id === o) continue;
83
- const T = e.findIndex((i) => i.id === p.id);
84
- if (T > -1) {
85
- const i = e[T], b = `${i.id}::${i.renderKey ?? 0}`;
86
- s.delete(b), i.alive = !1;
81
+ const v = a.shift();
82
+ if (!v || v.id === o) continue;
83
+ const R = e.findIndex((i) => i.id === v.id);
84
+ if (R > -1) {
85
+ const i = e[R], p = `${i.id}::${i.renderKey ?? 0}`;
86
+ s.delete(p), i.alive = !1;
87
87
  }
88
88
  }
89
89
  }
90
- function Vt(e) {
90
+ function Ft(e) {
91
91
  return {
92
92
  to: e.to,
93
93
  title: e.title,
@@ -98,194 +98,194 @@ function Vt(e) {
98
98
  renderKey: e.renderKey
99
99
  };
100
100
  }
101
- function _t(e) {
101
+ function Ht(e) {
102
102
  const r = {};
103
103
  return "title" in e && (r.title = e.title), "tips" in e && (r.tips = e.tips), "icon" in e && (r.icon = e.icon), "tabClass" in e && (r.tabClass = e.tabClass), "closable" in e && (r.closable = e.closable), "renderKey" in e && typeof e.renderKey == "number" && (r.renderKey = e.renderKey), r;
104
104
  }
105
- function Yt(e, r = {}) {
106
- const o = Nt(r), s = ae([]), a = S(null), p = Ct(), T = S(null), i = ae(/* @__PURE__ */ new Set()), b = C(() => Array.from(i));
105
+ function Wt(e, r = {}) {
106
+ const o = zt(r), s = ie([]), a = x(null), v = Kt(), R = x(null), i = ie(/* @__PURE__ */ new Set()), p = K(() => Array.from(i));
107
107
  let h = !1;
108
- function E(u) {
109
- const c = typeof u.matched == "object" ? u : V(e, u);
108
+ function T(u) {
109
+ const d = typeof u.matched == "object" ? u : N(e, u);
110
110
  return {
111
- key: _(c),
112
- fullPath: c.fullPath,
113
- alive: Ke(c, o.keepAlive),
114
- reusable: Ee(c, !1),
115
- matched: c
111
+ key: z(d),
112
+ fullPath: d.fullPath,
113
+ alive: Ke(d, o.keepAlive),
114
+ reusable: Ee(d, !1),
115
+ matched: d
116
116
  };
117
117
  }
118
- function P(u) {
119
- const c = _(u);
120
- let f = s.find((y) => y.id === c);
118
+ function I(u) {
119
+ const d = z(u);
120
+ let c = s.find((y) => y.id === d);
121
121
  const m = Ke(u, o.keepAlive);
122
- if (f) {
123
- f.fullPath = u.fullPath, f.to = u.fullPath, f.matched = u, f.reusable = Ee(u, f.reusable), typeof f.renderKey != "number" && (f.renderKey = 0);
124
- const y = `${c}::${f.renderKey}`;
125
- return (c.includes("students") || c.includes("classroom") || c.includes("quiz")) && console.log(`[ensureTab] EXISTING tab: ${u.fullPath}`, {
126
- key: c,
127
- shouldBeAlive: m,
128
- currentRenderKey: f.renderKey,
129
- currentCacheKey: y,
130
- isInCache: i.has(y),
131
- aliveCacheSize: i.size,
132
- cacheContents: Array.from(i)
133
- }), m && (i.has(y) ? f.alive || (f.alive = !0, (c.includes("students") || c.includes("classroom") || c.includes("quiz")) && console.log(`[ensureTab] ✅ Reactivated: ${y}`)) : (i.add(y), f.alive = !0, (c.includes("students") || c.includes("classroom") || c.includes("quiz")) && console.log(`[ensureTab] ✅ Added to cache: ${y}`))), Object.assign(f, qe(u)), f;
122
+ if (c) {
123
+ c.fullPath = u.fullPath, c.to = u.fullPath, c.matched = u, c.reusable = Ee(u, c.reusable), typeof c.renderKey != "number" && (c.renderKey = 0);
124
+ const y = `${d}::${c.renderKey}`;
125
+ return m ? i.has(y) ? c.alive || (c.alive = !0) : (i.add(y), c.alive = !0) : c.alive && (i.delete(y), c.alive = !1), Object.assign(c, We(u)), c;
134
126
  }
135
- if (f = ne(u, {}, o.keepAlive), f.alive) {
136
- const y = `${c}::${f.renderKey ?? 0}`;
137
- i.add(y), (c.includes("students") || c.includes("classroom") || c.includes("quiz")) && console.log(`[ensureTab] NEW tab created and cached: ${y}`);
127
+ if (c = ne(u, {}, o.keepAlive), c.alive) {
128
+ const y = `${d}::${c.renderKey ?? 0}`;
129
+ i.add(y);
138
130
  }
139
- return Te(s, f, o.appendPosition, a.value), Re(s, o.maxAlive, a.value, i), f;
131
+ return we(s, c, o.appendPosition, a.value), oe(s, o.maxAlive, a.value, i), c;
140
132
  }
141
- async function M(u, c = !1, f = "sameTab") {
142
- const m = V(e, u), y = _(m), k = a.value === y;
143
- f === "sameTab" && (f = k), f && await z(y, !0), await e[c ? "replace" : "push"](m), k && await N();
133
+ async function A(u, d = !1, c = "sameTab") {
134
+ const m = N(e, u), y = z(m), E = a.value === y;
135
+ c === "sameTab" && (c = E), c && await j(y, !0), await e[d ? "replace" : "push"](m), E && await F();
144
136
  }
145
- function Y(u) {
146
- const c = s.findIndex((I) => I.id === u);
147
- if (c === -1) return o.defaultRoute;
148
- const f = s[c + 1], m = s[c - 1], y = s.find((I) => I.id !== u), k = f || m || y;
149
- return k ? k.to : o.defaultRoute;
137
+ function L(u) {
138
+ const d = s.findIndex((C) => C.id === u);
139
+ if (d === -1) return o.defaultRoute;
140
+ const c = s[d + 1], m = s[d - 1], y = s.find((C) => C.id !== u), E = c || m || y;
141
+ return E ? E.to : o.defaultRoute;
150
142
  }
151
- async function L(u = a.value, c = {}) {
143
+ async function O(u = a.value, d = {}) {
152
144
  if (!u) return;
153
- if (!c.force && o.keepLastTab && s.length === 1)
145
+ if (!d.force && o.keepLastTab && s.length === 1)
154
146
  throw new Error("[RouterTabs] Unable to close the final tab when keepLastTab is true.");
155
- const m = a.value === u && c.redirect !== null, y = m ? c.redirect ?? Y(u) : null;
156
- await F(u, { force: c.force }), c.redirect !== null && m && y && await e.replace(y);
147
+ const m = a.value === u && d.redirect !== null, y = m ? d.redirect ?? L(u) : null;
148
+ await Y(u, { force: d.force }), d.redirect !== null && m && y && await e.replace(y);
157
149
  }
158
- async function F(u, c = {}) {
159
- const f = s.findIndex((m) => m.id === u);
160
- f !== -1 && (s.splice(f, 1), T.value === u && (T.value = null), a.value === u && (a.value = null, p.value = void 0));
150
+ async function Y(u, d = {}) {
151
+ const c = s.findIndex((E) => E.id === u);
152
+ if (c === -1) return;
153
+ const m = s[c], y = `${u}::${m.renderKey ?? 0}`;
154
+ i.delete(y), m.alive = !1, s.splice(c, 1), R.value === u && (R.value = null), a.value === u && (a.value = null, v.value = void 0);
161
155
  }
162
- async function z(u = a.value ?? void 0, c = !1) {
156
+ async function j(u = a.value ?? void 0, d = !1) {
163
157
  if (!u) return;
164
- const f = s.find((I) => I.id === u);
165
- if (!f) return;
166
- const m = o.keepAlive && f.alive, y = `${u}::${f.renderKey ?? 0}`;
167
- m && (i.delete(y), f.alive = !1, await B()), f.renderKey = (f.renderKey ?? 0) + 1;
168
- const k = `${u}::${f.renderKey}`;
169
- m && (i.add(k), f.alive = !0), T.value = u, await B(), c || await B(), T.value = null;
170
- }
171
- async function le(u = !1) {
172
- for (const c of s)
173
- await z(c.id, u);
158
+ const c = s.find((C) => C.id === u);
159
+ if (!c) return;
160
+ const m = o.keepAlive && c.alive, y = `${u}::${c.renderKey ?? 0}`;
161
+ m && (i.delete(y), c.alive = !1, await M()), c.renderKey = (c.renderKey ?? 0) + 1;
162
+ const E = `${u}::${c.renderKey}`;
163
+ m && (i.add(E), c.alive = !0), R.value = u, await M(), d || await M(), R.value = null;
174
164
  }
175
- function R(u, c) {
176
- const f = s.find((y) => y.id === u);
177
- if (!f) return;
178
- const m = `${u}::${f.renderKey ?? 0}`;
179
- c ? (i.add(m), f.alive = !0, Re(s, o.maxAlive, a.value, i)) : (i.delete(m), f.alive = !1);
165
+ async function se(u = !1) {
166
+ for (const d of s)
167
+ await j(d.id, u);
180
168
  }
181
- function X(u) {
182
- const c = s.find((m) => m.id === u);
169
+ function ue(u, d) {
170
+ const c = s.find((y) => y.id === u);
183
171
  if (!c) return;
184
- const f = `${u}::${c.renderKey ?? 0}`;
185
- i.delete(f), c.alive = !1, c.renderKey = (c.renderKey ?? 0) + 1;
172
+ const m = `${u}::${c.renderKey ?? 0}`;
173
+ d ? (i.add(m), c.alive = !0, oe(s, o.maxAlive, a.value, i)) : (i.delete(m), c.alive = !1);
186
174
  }
187
- function O() {
175
+ function w(u) {
176
+ const d = s.find((m) => m.id === u);
177
+ if (!d) return;
178
+ const c = `${u}::${d.renderKey ?? 0}`;
179
+ i.delete(c), d.alive = !1, d.renderKey = (d.renderKey ?? 0) + 1;
180
+ }
181
+ function Z() {
188
182
  i.clear(), s.forEach((u) => {
189
183
  u.alive = !1;
190
184
  });
191
185
  }
192
- function D() {
193
- return b.value.slice();
186
+ function U() {
187
+ return p.value.slice();
194
188
  }
195
- async function Q(u = o.defaultRoute) {
196
- s.splice(0, s.length), a.value = null, p.value = void 0;
197
- for (const c of o.initialTabs) {
198
- const f = V(e, c.to), m = ne(f, c, o.keepAlive);
189
+ async function D(u = o.defaultRoute) {
190
+ s.splice(0, s.length), a.value = null, v.value = void 0;
191
+ for (const d of o.initialTabs) {
192
+ const c = N(e, d.to), m = ne(c, d, o.keepAlive);
199
193
  s.push(m);
200
194
  }
201
195
  await e.replace(u);
202
196
  }
203
- async function N() {
197
+ async function F() {
204
198
  const u = a.value;
205
- u && await z(u, !0);
199
+ u && await j(u, !0);
206
200
  }
207
- function w(u) {
208
- return typeof u.matched == "object" ? _(u) : _(V(e, u));
201
+ function H(u) {
202
+ return typeof u.matched == "object" ? z(u) : z(N(e, u));
209
203
  }
210
- function se() {
211
- const u = s.find((c) => c.id === a.value);
204
+ function k() {
205
+ const u = s.find((d) => d.id === a.value);
212
206
  return {
213
- tabs: s.map(Vt),
207
+ tabs: s.map(Ft),
214
208
  active: u ? u.to : null
215
209
  };
216
210
  }
217
- async function W(u) {
218
- h = !0, s.splice(0, s.length), a.value = null, p.value = void 0;
219
- const c = u?.tabs ?? [];
220
- for (const m of c)
211
+ async function ce(u) {
212
+ h = !0, s.splice(0, s.length), a.value = null, v.value = void 0;
213
+ const d = u?.tabs ?? [];
214
+ for (const m of d)
221
215
  try {
222
- const y = V(e, m.to), k = _t(m), I = ne(y, k, o.keepAlive);
223
- Te(s, I, "last", null);
216
+ const y = N(e, m.to), E = Ht(m), C = ne(y, E, o.keepAlive);
217
+ we(s, C, "last", null);
224
218
  } catch (y) {
225
219
  console.warn("[RouterTabs] Failed to restore tab", m, y);
226
220
  }
227
221
  h = !1;
228
- const f = u?.active ?? c[c.length - 1]?.to ?? o.defaultRoute;
229
- if (f)
222
+ const c = u?.active ?? d[d.length - 1]?.to ?? o.defaultRoute;
223
+ if (c)
230
224
  try {
231
- await e.replace(f);
225
+ const m = N(e, c), y = e.currentRoute.value;
226
+ if (m.fullPath === y.fullPath) {
227
+ const E = I(y);
228
+ a.value = E.id, v.value = E, oe(s, o.maxAlive, a.value, i);
229
+ return;
230
+ }
231
+ await e.replace(m);
232
232
  } catch (m) {
233
- console.warn("[RouterTabs] Failed to navigate to restored route", f, m);
233
+ console.warn("[RouterTabs] Failed to navigate to restored route", c, m);
234
234
  }
235
235
  }
236
- return A(
236
+ return S(
237
237
  () => e.currentRoute.value,
238
238
  (u) => {
239
239
  if (h) return;
240
- const c = P(u);
241
- a.value = c.id, p.value = c, Re(s, o.maxAlive, a.value, i);
240
+ const d = I(u);
241
+ a.value = d.id, v.value = d, oe(s, o.maxAlive, a.value, i);
242
242
  },
243
243
  { immediate: !0 }
244
244
  ), o.initialTabs.length && o.initialTabs.forEach((u) => {
245
- const c = V(e, u.to), f = ne(c, u, o.keepAlive);
246
- Te(s, f, "last", null);
245
+ const d = N(e, u.to), c = ne(d, u, o.keepAlive);
246
+ we(s, c, "last", null);
247
247
  }), {
248
248
  options: o,
249
249
  tabs: s,
250
250
  activeId: a,
251
- current: p,
252
- includeKeys: b,
253
- refreshingKey: T,
254
- openTab: M,
255
- closeTab: L,
256
- removeTab: F,
257
- refreshTab: z,
258
- refreshAll: le,
259
- setTabAlive: R,
260
- evictCache: X,
261
- clearCache: O,
262
- getCacheKeys: D,
263
- reset: Q,
264
- reload: N,
265
- getRouteKey: w,
266
- matchRoute: E,
267
- snapshot: se,
268
- hydrate: W,
269
- ensureTab: P
251
+ current: v,
252
+ includeKeys: p,
253
+ refreshingKey: R,
254
+ openTab: A,
255
+ closeTab: O,
256
+ removeTab: Y,
257
+ refreshTab: j,
258
+ refreshAll: se,
259
+ setTabAlive: ue,
260
+ evictCache: w,
261
+ clearCache: Z,
262
+ getCacheKeys: U,
263
+ reset: D,
264
+ reload: F,
265
+ getRouteKey: H,
266
+ matchRoute: T,
267
+ snapshot: k,
268
+ hydrate: ce,
269
+ ensureTab: I
270
270
  };
271
271
  }
272
- function Ne(e) {
272
+ function Ue(e) {
273
273
  return e ? typeof e == "string" ? { name: e } : e : {};
274
274
  }
275
- const ie = Symbol("RouterTabsContext"), re = "router-tabs:snapshot";
276
- function Ue(e = {}) {
277
- const { optional: r = !1 } = e, o = Me(ie, null);
275
+ const le = Symbol("RouterTabsContext"), ae = "router-tabs:snapshot";
276
+ function Ve(e = {}) {
277
+ const { optional: r = !1 } = e, o = Me(le, null);
278
278
  if (o) return o;
279
279
  const s = Me("$tabs", null);
280
280
  if (s) return s;
281
- const p = We()?.appContext.config.globalProperties.$tabs;
282
- if (p) return p;
281
+ const v = Fe()?.appContext.config.globalProperties.$tabs;
282
+ if (v) return v;
283
283
  if (!r)
284
284
  throw new Error("[RouterTabs] useRouterTabs must be used within <router-tab>.");
285
285
  return null;
286
286
  }
287
- const Ft = 864e5;
288
- function Wt(e) {
287
+ const Jt = 864e5;
288
+ function Gt(e) {
289
289
  if (typeof document > "u") return null;
290
290
  const r = `${encodeURIComponent(e)}=`, o = document.cookie ? document.cookie.split("; ") : [];
291
291
  for (const s of o)
@@ -293,27 +293,27 @@ function Wt(e) {
293
293
  return decodeURIComponent(s.slice(r.length));
294
294
  return null;
295
295
  }
296
- function Ve(e, r, o) {
296
+ function Ne(e, r, o) {
297
297
  if (typeof document > "u") return;
298
298
  const {
299
299
  expiresInDays: s = 7,
300
300
  path: a = "/",
301
- domain: p,
302
- secure: T,
301
+ domain: v,
302
+ secure: R,
303
303
  sameSite: i = "lax"
304
- } = o, b = [`${encodeURIComponent(e)}=${encodeURIComponent(r)}`];
304
+ } = o, p = [`${encodeURIComponent(e)}=${encodeURIComponent(r)}`];
305
305
  if (s !== 1 / 0) {
306
- const h = new Date(Date.now() + s * Ft).toUTCString();
307
- b.push(`Expires=${h}`);
306
+ const h = new Date(Date.now() + s * Jt).toUTCString();
307
+ p.push(`Expires=${h}`);
308
308
  }
309
- a && b.push(`Path=${a}`), p && b.push(`Domain=${p}`), T && b.push("Secure"), i && b.push(`SameSite=${i.charAt(0).toUpperCase()}${i.slice(1)}`), document.cookie = b.join("; ");
309
+ a && p.push(`Path=${a}`), v && p.push(`Domain=${v}`), R && p.push("Secure"), i && p.push(`SameSite=${i.charAt(0).toUpperCase()}${i.slice(1)}`), document.cookie = p.join("; ");
310
310
  }
311
311
  function _e(e, r) {
312
312
  if (typeof document > "u") return;
313
313
  const { path: o = "/", domain: s } = r, a = [`${encodeURIComponent(e)}=`];
314
314
  a.push("Expires=Thu, 01 Jan 1970 00:00:01 GMT"), o && a.push(`Path=${o}`), s && a.push(`Domain=${s}`), document.cookie = a.join("; ");
315
315
  }
316
- const qt = (e) => JSON.stringify(e ?? null), Ht = (e) => {
316
+ const qt = (e) => JSON.stringify(e ?? null), Xt = (e) => {
317
317
  if (!e) return null;
318
318
  try {
319
319
  return JSON.parse(e);
@@ -321,65 +321,63 @@ const qt = (e) => JSON.stringify(e ?? null), Ht = (e) => {
321
321
  return null;
322
322
  }
323
323
  };
324
- function He(e = {}) {
324
+ function Je(e = {}) {
325
325
  const {
326
- cookieKey: r = re,
326
+ cookieKey: r = ae,
327
327
  serialize: o = qt,
328
- deserialize: s = Ht
329
- } = e, a = Ue({ optional: !0 }), p = S(!0), T = (i) => {
330
- ke(async () => {
331
- const b = s(Wt(r));
332
- if (b && b.tabs?.length)
333
- try {
334
- if (p.value = !0, await i.hydrate(b), b.active) {
335
- await B();
336
- const E = i.tabs.find((P) => P.to === b.active);
337
- E && (i.activeId.value = E.id, i.current.value = E);
328
+ deserialize: s = Xt
329
+ } = e, a = Ve({ optional: !0 }), v = x(!1), R = (i, p = "hook") => {
330
+ const h = async () => {
331
+ v.value = !0;
332
+ try {
333
+ const T = s(Gt(r));
334
+ if (T && T.tabs?.length) {
335
+ if (await i.hydrate(T), T.active) {
336
+ await M();
337
+ const A = i.tabs.find((L) => L.to === T.active);
338
+ A && (i.activeId.value = A.id, i.current.value = A);
338
339
  }
339
- } finally {
340
- p.value = !1;
341
- }
342
- else if (Object.prototype.hasOwnProperty.call(e, "fallbackRoute"))
343
- try {
344
- p.value = !0;
345
- const E = e.fallbackRoute ?? i.options.defaultRoute;
346
- await i.reset(E);
347
- } finally {
348
- p.value = !1;
340
+ } else if (Object.prototype.hasOwnProperty.call(e, "fallbackRoute")) {
341
+ const A = e.fallbackRoute ?? i.options.defaultRoute;
342
+ await i.reset(A);
349
343
  }
350
- else
351
- p.value = !1;
352
- const h = i.snapshot();
353
- h.tabs.length ? Ve(r, o(h), e) : _e(r, e), p.value = !1;
354
- }), A(
344
+ const I = i.snapshot();
345
+ I.tabs.length ? Ne(r, o(I), e) : _e(r, e);
346
+ } finally {
347
+ v.value = !1;
348
+ }
349
+ };
350
+ p === "immediate" ? h() : Et(() => {
351
+ h();
352
+ }), S(
355
353
  () => ({
356
- tabs: i.tabs.map((b) => ({
357
- to: b.to,
358
- title: b.title,
359
- tips: b.tips,
360
- icon: b.icon,
361
- tabClass: b.tabClass,
362
- closable: b.closable,
363
- renderKey: b.renderKey
354
+ tabs: i.tabs.map((T) => ({
355
+ to: T.to,
356
+ title: T.title,
357
+ tips: T.tips,
358
+ icon: T.icon,
359
+ tabClass: T.tabClass,
360
+ closable: T.closable,
361
+ renderKey: T.renderKey
364
362
  })),
365
363
  active: i.activeId.value
366
364
  }),
367
365
  () => {
368
- if (p.value) return;
369
- const b = i.snapshot();
370
- b.tabs.length ? Ve(r, o(b), e) : _e(r, e);
366
+ if (v.value) return;
367
+ const T = i.snapshot();
368
+ T.tabs.length ? Ne(r, o(T), e) : _e(r, e);
371
369
  },
372
370
  { deep: !0 }
373
371
  );
374
372
  };
375
- a ? T(a) : ke(() => {
376
- const i = Ue({ optional: !0 });
377
- i && T(i);
378
- });
373
+ return a ? R(a) : He(() => {
374
+ const i = Ve({ optional: !0 });
375
+ i && R(i, "immediate");
376
+ }), { hydrating: v };
379
377
  }
380
- const Jt = Ce({
378
+ const Qt = Ce({
381
379
  name: "RouterTab",
382
- components: { RouterView: zt },
380
+ components: { RouterView: _t },
383
381
  props: {
384
382
  tabs: {
385
383
  type: Array,
@@ -419,7 +417,7 @@ const Jt = Ce({
419
417
  },
420
418
  cookieKey: {
421
419
  type: String,
422
- default: re
420
+ default: ae
423
421
  },
424
422
  persistence: {
425
423
  type: Object,
@@ -432,13 +430,13 @@ const Jt = Ce({
432
430
  },
433
431
  emits: ["tab-sort", "tab-sorted"],
434
432
  setup(e, { emit: r }) {
435
- const o = We();
433
+ const o = Fe();
436
434
  if (!o)
437
435
  throw new Error("[RouterTab] component must be used within a Vue application context.");
438
436
  const s = o.appContext.app.config.globalProperties.$router;
439
437
  if (!s)
440
438
  throw new Error("[RouterTab] Vue Router is required. Make sure to call app.use(router) before RouterTab.");
441
- const a = Yt(s, {
439
+ const a = Wt(s, {
442
440
  initialTabs: e.tabs,
443
441
  keepAlive: e.keepAlive,
444
442
  maxAlive: e.maxAlive,
@@ -446,138 +444,140 @@ const Jt = Ce({
446
444
  appendPosition: e.append,
447
445
  defaultRoute: e.defaultPage
448
446
  });
449
- Kt(ie, a), o.appContext.config.globalProperties.$tabs = a;
450
- const p = C(() => !!o?.slots?.default), T = C(() => !!o?.slots?.start), i = C(() => !!o?.slots?.end), b = S(0), h = C(() => {
451
- b.value;
447
+ $t(le, a), o.appContext.config.globalProperties.$tabs = a;
448
+ const v = K(() => !!o?.slots?.default), R = K(() => !!o?.slots?.start), i = K(() => !!o?.slots?.end), p = x(0), h = K(() => {
449
+ p.value;
452
450
  const t = {};
453
451
  return a.tabs.forEach((n) => {
454
- const l = typeof n.title == "string" ? n.title : String(n.title || ue(n));
452
+ const l = typeof n.title == "string" ? n.title : String(n.title || fe(n));
455
453
  t[n.id] = l;
456
454
  }), t;
457
455
  });
458
- function E() {
459
- b.value++;
456
+ function T() {
457
+ p.value++;
460
458
  }
461
- const P = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map();
462
- function Y(t, n) {
463
- if (!(!n || P.has(t)))
459
+ const I = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
460
+ function L(t, n) {
461
+ if (!(!n || I.has(t)))
464
462
  try {
465
- P.set(t, n);
463
+ I.set(t, n);
466
464
  const l = a.tabs.find((g) => a.getRouteKey(g.to) === t);
467
465
  if (!l) {
468
466
  console.warn(`[RouterTab] Cannot setup watching: tab not found for ${t}`);
469
467
  return;
470
468
  }
471
- const v = [];
469
+ const b = [];
472
470
  if (n.routeTabTitle !== void 0)
473
471
  try {
474
- const g = A(
472
+ const g = S(
475
473
  () => {
476
- const d = n.routeTabTitle;
477
- return d && typeof d == "object" && "value" in d ? d.value : d;
474
+ const f = n.routeTabTitle;
475
+ return f && typeof f == "object" && "value" in f ? f.value : f;
478
476
  },
479
- (d) => {
480
- if (d != null) {
481
- const U = String(d);
482
- l.title = U, E();
477
+ (f) => {
478
+ if (f != null) {
479
+ const _ = String(f);
480
+ l.title = _, T();
483
481
  }
484
482
  },
485
483
  { immediate: !0 }
486
484
  );
487
- v.push(g);
485
+ b.push(g);
488
486
  } catch (g) {
489
487
  console.error(`[RouterTab] Error watching routeTabTitle for ${t}:`, g);
490
488
  }
491
489
  if (n.routeTabIcon !== void 0)
492
490
  try {
493
- const g = A(
491
+ const g = S(
494
492
  () => {
495
- const d = n.routeTabIcon;
496
- return d && typeof d == "object" && "value" in d ? d.value : d;
493
+ const f = n.routeTabIcon;
494
+ return f && typeof f == "object" && "value" in f ? f.value : f;
497
495
  },
498
- (d) => {
499
- d != null && (l.icon = String(d), E());
496
+ (f) => {
497
+ f != null && (l.icon = String(f), T());
500
498
  },
501
499
  { immediate: !0 }
502
500
  );
503
- v.push(g);
501
+ b.push(g);
504
502
  } catch (g) {
505
503
  console.error(`[RouterTab] Error watching routeTabIcon for ${t}:`, g);
506
504
  }
507
505
  if (n.routeTabClosable !== void 0)
508
506
  try {
509
- const g = A(
507
+ const g = S(
510
508
  () => {
511
- const d = n.routeTabClosable;
512
- return d && typeof d == "object" && "value" in d ? d.value : d;
509
+ const f = n.routeTabClosable;
510
+ return f && typeof f == "object" && "value" in f ? f.value : f;
513
511
  },
514
- (d) => {
515
- d != null && (l.closable = !!d, E());
512
+ (f) => {
513
+ f != null && (l.closable = !!f, T());
516
514
  },
517
515
  { immediate: !0 }
518
516
  );
519
- v.push(g);
517
+ b.push(g);
520
518
  } catch (g) {
521
519
  console.error(`[RouterTab] Error watching routeTabClosable for ${t}:`, g);
522
520
  }
523
521
  if (n.routeTabMeta !== void 0)
524
522
  try {
525
- const g = A(
523
+ const g = S(
526
524
  () => {
527
- const d = n.routeTabMeta;
528
- return d && typeof d == "object" && "value" in d ? d.value : d;
525
+ const f = n.routeTabMeta;
526
+ return f && typeof f == "object" && "value" in f ? f.value : f;
529
527
  },
530
- (d) => {
531
- d && typeof d == "object" && (Object.assign(l, d), E());
528
+ (f) => {
529
+ f && typeof f == "object" && (Object.assign(l, f), T());
532
530
  },
533
531
  { immediate: !0, deep: !0 }
534
532
  );
535
- v.push(g);
533
+ b.push(g);
536
534
  } catch (g) {
537
535
  console.error(`[RouterTab] Error watching routeTabMeta for ${t}:`, g);
538
536
  }
539
- M.set(t, v);
537
+ A.set(t, b);
540
538
  } catch (l) {
541
- console.error(`[RouterTab] Error in setupComponentWatching for ${t}:`, l), L(t);
539
+ console.error(`[RouterTab] Error in setupComponentWatching for ${t}:`, l), O(t);
542
540
  }
543
541
  }
544
- function L(t) {
542
+ function O(t) {
545
543
  try {
546
- const n = M.get(t);
544
+ const n = A.get(t);
547
545
  n && (n.forEach((l) => {
548
546
  try {
549
547
  l();
550
- } catch (v) {
551
- console.error(`[RouterTab] Error cleaning up watcher for ${t}:`, v);
548
+ } catch (b) {
549
+ console.error(`[RouterTab] Error cleaning up watcher for ${t}:`, b);
552
550
  }
553
- }), M.delete(t)), P.delete(t);
551
+ }), A.delete(t)), I.delete(t);
554
552
  } catch (n) {
555
553
  console.error(`[RouterTab] Error in cleanupComponentWatching for ${t}:`, n);
556
554
  }
557
555
  }
558
- function F(t, n) {
556
+ function Y(t, n) {
559
557
  try {
560
- t ? t.routeTabTitle !== void 0 || t.routeTabIcon !== void 0 || t.routeTabClosable !== void 0 ? Y(n, t) : t.$ && (t.$.routeTabTitle !== void 0 || t.$.routeTabIcon !== void 0 || t.$.routeTabClosable !== void 0) && Y(n, t.$) : t === null && L(n);
558
+ t ? t.routeTabTitle !== void 0 || t.routeTabIcon !== void 0 || t.routeTabClosable !== void 0 ? L(n, t) : t.$ && (t.$.routeTabTitle !== void 0 || t.$.routeTabIcon !== void 0 || t.$.routeTabClosable !== void 0) && L(n, t.$) : t === null && O(n);
561
559
  } catch (l) {
562
- console.error(`[RouterTab] Error handling component ref for ${n}:`, l), L(n);
560
+ console.error(`[RouterTab] Error handling component ref for ${n}:`, l), O(n);
563
561
  }
564
562
  }
565
- if (Et((t, n, l) => (console.error("[RouterTab] Error captured from component:", t, l), !1)), e.cookieKey !== null || e.persistence) {
563
+ Pt((t, n, l) => (console.error("[RouterTab] Error captured from component:", t, l), !1));
564
+ let j = x(!1);
565
+ if (e.cookieKey !== null || e.persistence) {
566
566
  const t = {
567
567
  ...e.persistence ?? {}
568
568
  };
569
- e.cookieKey !== null ? t.cookieKey = e.cookieKey || re : t.cookieKey || (t.cookieKey = re), He(t);
569
+ e.cookieKey !== null ? t.cookieKey = e.cookieKey || ae : t.cookieKey || (t.cookieKey = ae), j = Je(t).hydrating;
570
570
  }
571
- const z = C(() => Ne(e.tabTransition)), le = C(() => Ne(e.pageTransition)), R = ae({
571
+ const se = K(() => Ue(e.tabTransition)), ue = K(() => Ue(e.pageTransition)), w = ie({
572
572
  visible: !1,
573
573
  target: null,
574
574
  position: { x: 0, y: 0 }
575
- }), X = S(null), O = S([]), D = S(-1), Q = S(null), N = /* @__PURE__ */ new Map(), w = ae({
575
+ }), Z = x(null), U = x([]), D = x(-1), F = x(null), H = /* @__PURE__ */ new Map(), k = ie({
576
576
  dragging: !1,
577
577
  dragIndex: -1,
578
578
  dropIndex: -1,
579
579
  dragTab: null
580
- }), se = [
580
+ }), ce = [
581
581
  "refresh",
582
582
  "refreshAll",
583
583
  "close",
@@ -585,29 +585,29 @@ const Jt = Ce({
585
585
  "closeRights",
586
586
  "closeOthers"
587
587
  ];
588
- function W(t) {
588
+ function u(t) {
589
589
  return a.tabs.findIndex((n) => n.id === t);
590
590
  }
591
- function u(t) {
592
- const n = W(t.id);
591
+ function d(t) {
592
+ const n = u(t.id);
593
593
  return n > 0 ? a.tabs.slice(0, n) : [];
594
594
  }
595
595
  function c(t) {
596
- const n = W(t.id);
596
+ const n = u(t.id);
597
597
  return n > -1 ? a.tabs.slice(n + 1) : [];
598
598
  }
599
- function f(t) {
599
+ function m(t) {
600
600
  return a.tabs.filter((n) => n.id !== t.id);
601
601
  }
602
- async function m(t, n) {
603
- const l = t.filter((v) => v.closable !== !1);
602
+ async function y(t, n) {
603
+ const l = t.filter((b) => b.closable !== !1);
604
604
  if (l.length) {
605
- for (const v of l)
606
- a.activeId.value === v.id ? await a.closeTab(v.id, { redirect: n.to, force: !0 }) : await a.removeTab(v.id, { force: !0 });
605
+ for (const b of l)
606
+ a.activeId.value === b.id ? await a.closeTab(b.id, { redirect: n.to, force: !0 }) : await a.removeTab(b.id, { force: !0 });
607
607
  a.activeId.value !== n.id && await a.openTab(n.to, !0, !1);
608
608
  }
609
609
  }
610
- const y = {
610
+ const E = {
611
611
  refresh: {
612
612
  label: "Refresh",
613
613
  handler: async ({ target: t }) => {
@@ -625,95 +625,95 @@ const Jt = Ce({
625
625
  handler: async ({ target: t }) => {
626
626
  await a.closeTab(t.id);
627
627
  },
628
- enable: ({ target: t }) => fe(t)
628
+ enable: ({ target: t }) => be(t)
629
629
  },
630
630
  closeLefts: {
631
631
  label: "Close to the Left",
632
632
  handler: async ({ target: t }) => {
633
- await m(u(t), t);
633
+ await y(d(t), t);
634
634
  },
635
- enable: ({ target: t }) => u(t).some((n) => n.closable !== !1)
635
+ enable: ({ target: t }) => d(t).some((n) => n.closable !== !1)
636
636
  },
637
637
  closeRights: {
638
638
  label: "Close to the Right",
639
639
  handler: async ({ target: t }) => {
640
- await m(c(t), t);
640
+ await y(c(t), t);
641
641
  },
642
642
  enable: ({ target: t }) => c(t).some((n) => n.closable !== !1)
643
643
  },
644
644
  closeOthers: {
645
645
  label: "Close Others",
646
646
  handler: async ({ target: t }) => {
647
- await m(f(t), t);
647
+ await y(m(t), t);
648
648
  },
649
- enable: ({ target: t }) => f(t).some((n) => n.closable !== !1)
649
+ enable: ({ target: t }) => m(t).some((n) => n.closable !== !1)
650
650
  }
651
651
  };
652
- function k() {
653
- R.visible = !1, R.target = null, D.value = -1, O.value = [];
652
+ function C() {
653
+ w.visible = !1, w.target = null, D.value = -1, U.value = [];
654
654
  }
655
- function I(t, n) {
656
- e.contextmenu && (R.target = t, R.position.x = n.clientX, R.position.y = n.clientY, B(() => {
657
- R.visible = !0, document.addEventListener("click", k, { once: !0 }), B(() => {
658
- et();
655
+ function Ze(t, n) {
656
+ e.contextmenu && (w.target = t, w.position.x = n.clientX, w.position.y = n.clientY, M(() => {
657
+ w.visible = !0, document.addEventListener("click", C, { once: !0 }), M(() => {
658
+ tt();
659
659
  });
660
660
  }));
661
661
  }
662
- function Ze(t, n) {
663
- const l = typeof t == "string" ? { id: t } : t, v = y[l.id], g = l.label ?? v?.label ?? String(l.id), d = l.visible ?? v?.visible ?? !0;
664
- if (!(typeof d == "function" ? d(n) : d !== !1)) return null;
665
- const ge = l.enable ?? v?.enable ?? !0, wt = typeof ge == "function" ? ge(n) : ge !== !1, Be = l.handler ?? v?.handler;
666
- if (!Be) return null;
667
- const kt = async () => {
668
- await Promise.resolve(Be(n));
662
+ function et(t, n) {
663
+ const l = typeof t == "string" ? { id: t } : t, b = E[l.id], g = l.label ?? b?.label ?? String(l.id), f = l.visible ?? b?.visible ?? !0;
664
+ if (!(typeof f == "function" ? f(n) : f !== !1)) return null;
665
+ const ve = l.enable ?? b?.enable ?? !0, kt = typeof ve == "function" ? ve(n) : ve !== !1, De = l.handler ?? b?.handler;
666
+ if (!De) return null;
667
+ const Ct = async () => {
668
+ await Promise.resolve(De(n));
669
669
  };
670
670
  return {
671
671
  id: String(l.id),
672
672
  label: g,
673
- disabled: !wt,
674
- action: kt
673
+ disabled: !kt,
674
+ action: Ct
675
675
  };
676
676
  }
677
- const q = C(() => {
678
- if (!R.visible || !R.target || e.contextmenu === !1) return [];
679
- const t = Array.isArray(e.contextmenu) ? e.contextmenu : se, n = { target: R.target, controller: a };
680
- return t.map((l) => Ze(l, n)).filter((l) => !!l);
677
+ const W = K(() => {
678
+ if (!w.visible || !w.target || e.contextmenu === !1) return [];
679
+ const t = Array.isArray(e.contextmenu) ? e.contextmenu : ce, n = { target: w.target, controller: a };
680
+ return t.map((l) => et(l, n)).filter((l) => !!l);
681
681
  });
682
- function et() {
683
- const t = X.value;
682
+ function tt() {
683
+ const t = Z.value;
684
684
  if (!t) return;
685
- const n = 8, { innerWidth: l, innerHeight: v } = window, g = t.getBoundingClientRect();
686
- let d = R.position.x, U = R.position.y;
687
- g.right > l - n && (d = Math.max(n, l - g.width - n)), g.bottom > v - n && (U = Math.max(n, v - g.height - n)), (d !== R.position.x || U !== R.position.y) && (R.position.x = d, R.position.y = U);
685
+ const n = 8, { innerWidth: l, innerHeight: b } = window, g = t.getBoundingClientRect();
686
+ let f = w.position.x, _ = w.position.y;
687
+ g.right > l - n && (f = Math.max(n, l - g.width - n)), g.bottom > b - n && (_ = Math.max(n, b - g.height - n)), (f !== w.position.x || _ !== w.position.y) && (w.position.x = f, w.position.y = _);
688
688
  }
689
- function tt(t, n) {
690
- O.value[n] = t ?? null;
689
+ function nt(t, n) {
690
+ U.value[n] = t ?? null;
691
691
  }
692
- function nt(t) {
692
+ function ot(t) {
693
693
  if (t < 0) return;
694
- O.value[t]?.focus({ preventScroll: !0 });
694
+ U.value[t]?.focus({ preventScroll: !0 });
695
695
  }
696
- function Z(t, n, l = q.value) {
696
+ function ee(t, n, l = W.value) {
697
697
  if (!l.length) return -1;
698
- const v = l.length;
698
+ const b = l.length;
699
699
  let g = t;
700
- for (let d = 0; d < v; d++)
701
- if (g = (g + n + v) % v, !l[g].disabled) return g;
700
+ for (let f = 0; f < b; f++)
701
+ if (g = (g + n + b) % b, !l[g].disabled) return g;
702
702
  return -1;
703
703
  }
704
- function H(t) {
705
- D.value = t, !(t < 0) && B(() => nt(t));
704
+ function J(t) {
705
+ D.value = t, !(t < 0) && M(() => ot(t));
706
706
  }
707
- function Pe(t) {
708
- const n = Z(D.value, t);
709
- n !== -1 && H(n);
707
+ function Ae(t) {
708
+ const n = ee(D.value, t);
709
+ n !== -1 && J(n);
710
710
  }
711
- function ot(t) {
712
- if (!R.visible) return;
713
- const n = t.key, l = q.value;
711
+ function rt(t) {
712
+ if (!w.visible) return;
713
+ const n = t.key, l = W.value;
714
714
  if (!l.length) return;
715
715
  if (n === "Tab") {
716
- k();
716
+ C();
717
717
  return;
718
718
  }
719
719
  if ([
@@ -731,93 +731,100 @@ const Jt = Ce({
731
731
  switch (t.preventDefault(), n) {
732
732
  case "ArrowDown":
733
733
  case "ArrowRight":
734
- Pe(1);
734
+ Ae(1);
735
735
  break;
736
736
  case "ArrowUp":
737
737
  case "ArrowLeft":
738
- Pe(-1);
738
+ Ae(-1);
739
739
  break;
740
740
  case "Home":
741
- H(Z(-1, 1));
741
+ J(ee(-1, 1));
742
742
  break;
743
743
  case "End":
744
- H(Z(l.length, -1));
744
+ J(ee(l.length, -1));
745
745
  break;
746
746
  case "Enter":
747
747
  case " ":
748
748
  case "Spacebar": {
749
749
  const g = D.value;
750
750
  if (g > -1) {
751
- const d = l[g];
752
- d.disabled || Se(d);
751
+ const f = l[g];
752
+ f.disabled || Se(f);
753
753
  }
754
754
  break;
755
755
  }
756
756
  case "Escape":
757
- k();
757
+ C();
758
758
  break;
759
759
  }
760
760
  }
761
761
  async function Se(t) {
762
- t.disabled || (k(), await t.action());
762
+ t.disabled || (C(), await t.action());
763
763
  }
764
- function ue(t) {
764
+ function fe(t) {
765
765
  return typeof t.title == "string" && t.title.trim() ? t.title : Array.isArray(t.title) && t.title.length && String(t.title[0]).trim() ? String(t.title[0]) : "Untitled";
766
766
  }
767
- function rt(t) {
768
- return h.value[t.id] || ue(t);
767
+ function at(t) {
768
+ return h.value[t.id] || fe(t);
769
769
  }
770
- function at(t, n) {
770
+ function Ie(t, n) {
771
771
  return Ce({
772
772
  name: n,
773
- setup(l, { attrs: v, slots: g }) {
774
- return () => At(t, v, g);
773
+ setup(l, { attrs: b, slots: g }) {
774
+ return () => St(t, b, g);
775
775
  }
776
776
  });
777
777
  }
778
- const ce = /* @__PURE__ */ new Map(), Ie = S(0);
778
+ const G = /* @__PURE__ */ new Map(), de = x(0);
779
779
  function it(t, n, l) {
780
- ce.has(l) || (ce.set(l, n), Ie.value++), t && F(t, l);
780
+ G.has(l) || (G.set(l, n), de.value++), t && Y(t, l);
781
781
  }
782
782
  function lt(t, n) {
783
783
  return t && ((!t.name || t.name !== n) && (t.name = n), t);
784
784
  }
785
- function st(t) {
786
- const n = a.getRouteKey(t), l = s.currentRoute.value, v = a.getRouteKey(l);
787
- return n === v;
785
+ function st(t, n) {
786
+ if (!t) return t;
787
+ const l = G.get(n);
788
+ if (l) return l;
789
+ const b = Ie(t, n);
790
+ return G.set(n, b), de.value++, b;
791
+ }
792
+ function ut(t) {
793
+ const n = a.getRouteKey(t), l = s.currentRoute.value, b = a.getRouteKey(l);
794
+ return n === b;
788
795
  }
789
796
  function xe(t) {
790
- const n = a.getRouteKey(t), l = a.tabs.find((d) => d.id === n);
797
+ const n = a.getRouteKey(t), l = a.tabs.find((f) => f.id === n);
791
798
  if (!l)
792
799
  return console.warn("[RouterTab] Tab not found for route:", n), `${n}::0`;
793
- const v = l.renderKey ?? 0, g = `${n}::${v}`;
800
+ const b = l.renderKey ?? 0, g = `${n}::${b}`;
794
801
  return (n.includes("students") || n.includes("classroom") || n.includes("quiz")) && console.log(`[getComponentCacheKey] Route: ${t.fullPath}`, {
795
802
  routeKey: n,
796
- renderKey: v,
803
+ renderKey: b,
797
804
  cacheKey: g,
798
805
  tabAlive: l.alive,
799
- includeKeys: be.value,
800
- isIncluded: be.value.includes(g)
806
+ includeKeys: pe.value,
807
+ isIncluded: pe.value.includes(g)
801
808
  }), g;
802
809
  }
803
- function ut(t) {
810
+ function ct(t) {
804
811
  return `${xe(t)}::refresh`;
805
812
  }
806
- function fe(t) {
813
+ function be(t) {
807
814
  return !(t.closable === !1 || a.options.keepLastTab && a.tabs.length <= 1);
808
815
  }
809
- async function ct(t) {
816
+ async function ft(t) {
810
817
  await a.closeTab(t.id);
811
818
  }
812
- function ft(t, n) {
813
- n ? N.set(t, n) : N.delete(t);
819
+ function dt(t, n) {
820
+ n ? H.set(t, n) : H.delete(t);
814
821
  }
815
- function de(t) {
816
- B(() => {
817
- const n = N.get(t), l = Q.value;
822
+ function ge(t) {
823
+ M(() => {
824
+ const n = H.get(t), l = F.value;
818
825
  if (n && l) {
819
- const v = n.getBoundingClientRect(), g = l.getBoundingClientRect();
820
- (v.left < g.left || v.right > g.right) && n.scrollIntoView({
826
+ const b = n.getBoundingClientRect(), g = l.getBoundingClientRect();
827
+ (b.left < g.left || b.right > g.right) && n.scrollIntoView({
821
828
  behavior: "smooth",
822
829
  block: "nearest",
823
830
  inline: "nearest"
@@ -825,68 +832,68 @@ const Jt = Ce({
825
832
  }
826
833
  });
827
834
  }
828
- function dt(t) {
835
+ function bt(t) {
829
836
  if (t.href && typeof window < "u") {
830
837
  t.target && t.target !== "_self" ? window.open(t.href, t.target) : window.location.assign(t.href);
831
838
  return;
832
839
  }
833
- a.activeId.value !== t.id && (a.openTab(t.to, !1), de(t.id));
840
+ a.activeId.value !== t.id && (a.openTab(t.to, !1), ge(t.id));
834
841
  }
835
- function bt(t) {
842
+ function gt(t) {
836
843
  return [
837
844
  "router-tab__item",
838
845
  {
839
846
  "is-active": a.activeId.value === t.id,
840
- "is-closable": fe(t),
841
- "is-dragging": w.dragging && w.dragTab?.id === t.id,
842
- "is-drag-over": w.dropIndex === W(t.id)
847
+ "is-closable": be(t),
848
+ "is-dragging": k.dragging && k.dragTab?.id === t.id,
849
+ "is-drag-over": k.dropIndex === u(t.id)
843
850
  },
844
851
  t.tabClass
845
852
  ];
846
853
  }
847
- function gt(t) {
854
+ function pt(t) {
848
855
  return a.refreshingKey.value === a.getRouteKey(t);
849
856
  }
850
- function pt(t) {
851
- const n = a.getRouteKey(t), l = a.tabs.find((v) => v.id === n);
857
+ function vt(t) {
858
+ const n = a.getRouteKey(t), l = a.tabs.find((b) => b.id === n);
852
859
  return l ? l.alive : !1;
853
860
  }
854
- function vt(t) {
861
+ function ht(t) {
855
862
  const n = a.getRouteKey(t);
856
- return !!a.tabs.find((v) => v.id === n);
863
+ return !!a.tabs.find((b) => b.id === n);
857
864
  }
858
- function ht(t, n, l) {
859
- e.sortable && (w.dragging = !0, w.dragIndex = n, w.dragTab = t, l.dataTransfer && (l.dataTransfer.effectAllowed = "move", l.dataTransfer.setData("text/plain", t.id)), r("tab-sort", { tab: t, index: n }));
865
+ function mt(t, n, l) {
866
+ e.sortable && (k.dragging = !0, k.dragIndex = n, k.dragTab = t, l.dataTransfer && (l.dataTransfer.effectAllowed = "move", l.dataTransfer.setData("text/plain", t.id)), r("tab-sort", { tab: t, index: n }));
860
867
  }
861
- function mt(t, n) {
862
- !e.sortable || !w.dragging || (n.preventDefault(), n.dataTransfer && (n.dataTransfer.dropEffect = "move"));
868
+ function yt(t, n) {
869
+ !e.sortable || !k.dragging || (n.preventDefault(), n.dataTransfer && (n.dataTransfer.dropEffect = "move"));
863
870
  }
864
- function yt(t) {
865
- !e.sortable || !w.dragging || (w.dropIndex = t);
871
+ function Tt(t) {
872
+ !e.sortable || !k.dragging || (k.dropIndex = t);
866
873
  }
867
- function Tt() {
868
- !e.sortable || w.dragging;
874
+ function Rt() {
875
+ !e.sortable || k.dragging;
869
876
  }
870
- function Rt(t, n) {
871
- if (!(!e.sortable || !w.dragging)) {
872
- if (n.preventDefault(), w.dragIndex !== -1 && w.dragIndex !== t) {
873
- const l = a.tabs.splice(w.dragIndex, 1)[0];
877
+ function wt(t, n) {
878
+ if (!(!e.sortable || !k.dragging)) {
879
+ if (n.preventDefault(), k.dragIndex !== -1 && k.dragIndex !== t) {
880
+ const l = a.tabs.splice(k.dragIndex, 1)[0];
874
881
  a.tabs.splice(t, 0, l), r("tab-sorted", {
875
882
  tab: l,
876
- fromIndex: w.dragIndex,
883
+ fromIndex: k.dragIndex,
877
884
  toIndex: t
878
885
  });
879
886
  }
880
- De();
887
+ Be();
881
888
  }
882
889
  }
883
- function De() {
884
- w.dragging = !1, w.dragIndex = -1, w.dropIndex = -1, w.dragTab = null;
890
+ function Be() {
891
+ k.dragging = !1, k.dragIndex = -1, k.dropIndex = -1, k.dragTab = null;
885
892
  }
886
- ke(() => {
887
- document.addEventListener("keydown", k);
888
- }), $t(() => {
889
- document.removeEventListener("keydown", k), o.appContext.config.globalProperties.$tabs = null, M.forEach((t) => {
893
+ He(() => {
894
+ document.addEventListener("keydown", C);
895
+ }), At(() => {
896
+ document.removeEventListener("keydown", C), o.appContext.config.globalProperties.$tabs = null, A.forEach((t) => {
890
897
  t.forEach((n) => {
891
898
  try {
892
899
  n();
@@ -894,226 +901,232 @@ const Jt = Ce({
894
901
  console.error("[RouterTab] Error during cleanup:", l);
895
902
  }
896
903
  });
897
- }), M.clear(), P.clear();
898
- }), A(
904
+ }), A.clear(), I.clear();
905
+ }), S(
899
906
  () => e.keepAlive,
900
907
  (t) => {
901
908
  a.options.keepAlive = t;
902
909
  }
903
- ), A(
910
+ ), S(
904
911
  () => a.activeId.value,
905
912
  (t) => {
906
- t && de(t), k();
913
+ t && ge(t), C();
907
914
  }
908
- ), A(
915
+ ), S(
909
916
  () => a.tabs.length,
910
917
  () => {
911
918
  const t = new Set(a.tabs.map((l) => l.id));
912
- Array.from(P.keys()).forEach((l) => {
913
- t.has(l) || (console.log(`[RouterTab] Cleaning up stale component instance: ${l}`), L(l));
919
+ Array.from(I.keys()).forEach((l) => {
920
+ t.has(l) || (console.log(`[RouterTab] Cleaning up stale component instance: ${l}`), O(l));
914
921
  });
915
922
  }
916
- ), A(
923
+ ), S(
917
924
  () => e.contextmenu,
918
925
  (t) => {
919
- t || k();
926
+ t || C();
920
927
  }
921
- ), A(
922
- () => q.value.length,
928
+ ), S(
929
+ () => W.value.length,
923
930
  (t) => {
924
- R.visible && t === 0 && k();
931
+ w.visible && t === 0 && C();
925
932
  },
926
933
  { flush: "post" }
927
934
  // Run after component updates to prevent blocking render
928
- ), A(q, (t) => {
929
- if (!R.visible) return;
930
- O.value = new Array(t.length).fill(null);
931
- const n = Z(-1, 1, t);
932
- H(n);
933
- }, { flush: "post" }), A(
934
- () => R.visible,
935
+ ), S(W, (t) => {
936
+ if (!w.visible) return;
937
+ U.value = new Array(t.length).fill(null);
938
+ const n = ee(-1, 1, t);
939
+ J(n);
940
+ }, { flush: "post" }), S(
941
+ () => w.visible,
935
942
  (t) => {
936
- t || (D.value = -1, O.value = []);
943
+ t || (D.value = -1, U.value = []);
937
944
  }
938
945
  );
939
- const be = a.includeKeys;
946
+ const pe = a.includeKeys;
940
947
  return {
941
948
  controller: a,
942
949
  tabs: a.tabs,
943
- includeKeys: be,
944
- componentCache: ce,
945
- componentCacheTrigger: Ie,
950
+ includeKeys: pe,
951
+ persistenceHydrating: j,
952
+ componentCache: G,
953
+ componentCacheTrigger: de,
946
954
  cacheCurrentComponent: it,
947
- tabTransitionProps: z,
948
- pageTransitionProps: le,
949
- buildTabClass: bt,
950
- activate: dt,
951
- close: ct,
952
- context: R,
953
- menuItems: q,
955
+ tabTransitionProps: se,
956
+ pageTransitionProps: ue,
957
+ buildTabClass: gt,
958
+ activate: bt,
959
+ close: ft,
960
+ context: w,
961
+ menuItems: W,
954
962
  handleMenuAction: Se,
955
- showContextMenu: I,
956
- hideContextMenu: k,
957
- getTabTitle: ue,
958
- isClosable: fe,
959
- isRefreshing: gt,
960
- isTabCached: pt,
961
- isTabReady: vt,
962
- hasCustomSlot: p,
963
- hasStartSlot: T,
963
+ showContextMenu: Ze,
964
+ hideContextMenu: C,
965
+ getTabTitle: fe,
966
+ isClosable: be,
967
+ isRefreshing: pt,
968
+ isTabCached: vt,
969
+ isTabReady: ht,
970
+ hasCustomSlot: v,
971
+ hasStartSlot: R,
964
972
  hasEndSlot: i,
965
- onDragStart: ht,
966
- onDragOver: mt,
967
- onDragEnter: yt,
968
- onDragLeave: Tt,
969
- onDrop: Rt,
970
- onDragEnd: De,
971
- setupComponentWatching: Y,
972
- cleanupComponentWatching: L,
973
- handleComponentRef: F,
974
- getReactiveTabTitle: rt,
973
+ onDragStart: mt,
974
+ onDragOver: yt,
975
+ onDragEnter: Tt,
976
+ onDragLeave: Rt,
977
+ onDrop: wt,
978
+ onDragEnd: Be,
979
+ setupComponentWatching: L,
980
+ cleanupComponentWatching: O,
981
+ handleComponentRef: Y,
982
+ getReactiveTabTitle: at,
975
983
  getComponentCacheKey: xe,
976
- getRefreshComponentKey: ut,
977
- createNamedComponent: at,
984
+ getRefreshComponentKey: ct,
985
+ createNamedComponent: Ie,
978
986
  ensureNamedComponent: lt,
979
- shouldRenderRoute: st,
980
- triggerTabUpdate: E,
981
- menuRef: X,
987
+ getNamedComponent: st,
988
+ shouldRenderRoute: ut,
989
+ triggerTabUpdate: T,
990
+ menuRef: Z,
982
991
  highlightedIndex: D,
983
- setMenuItemRef: tt,
984
- onMenuKeydown: ot,
985
- highlightMenuIndex: H,
986
- scrollContainer: Q,
987
- setTabRef: ft,
988
- scrollTabIntoView: de
992
+ setMenuItemRef: nt,
993
+ onMenuKeydown: rt,
994
+ highlightMenuIndex: J,
995
+ scrollContainer: F,
996
+ setTabRef: dt,
997
+ scrollTabIntoView: ge
989
998
  };
990
999
  }
991
- }), Gt = (e, r) => {
1000
+ }), Zt = (e, r) => {
992
1001
  const o = e.__vccOpts || e;
993
1002
  for (const [s, a] of r)
994
1003
  o[s] = a;
995
1004
  return o;
996
- }, Xt = { class: "router-tab" }, Qt = { class: "router-tab__header" }, Zt = {
1005
+ }, en = { class: "router-tab" }, tn = { class: "router-tab__header" }, nn = {
997
1006
  class: "router-tab__scroll",
998
1007
  ref: "scrollContainer"
999
- }, en = ["data-title", "draggable", "onClick", "onAuxclick", "onContextmenu", "onDragstart", "onDragover", "onDragenter", "onDrop"], tn = ["title"], nn = ["onClick"], on = { class: "router-tab__container" }, rn = ["aria-disabled", "disabled", "tabindex", "onMouseenter", "onClick"];
1000
- function an(e, r, o, s, a, p) {
1001
- const T = Pt("RouterView");
1002
- return $(), x("div", Xt, [
1003
- j("header", Qt, [
1004
- j("div", {
1005
- class: J(["router-tab__slot-start", { "has-content": e.hasStartSlot }])
1008
+ }, on = ["data-title", "draggable", "onClick", "onAuxclick", "onContextmenu", "onDragstart", "onDragover", "onDragenter", "onDrop"], rn = ["title"], an = ["onClick"], ln = { class: "router-tab__container" }, sn = {
1009
+ key: 1,
1010
+ class: "router-tab__hydrating",
1011
+ "aria-hidden": "true"
1012
+ }, un = ["aria-disabled", "disabled", "tabindex", "onMouseenter", "onClick"];
1013
+ function cn(e, r, o, s, a, v) {
1014
+ const R = It("RouterView");
1015
+ return $(), B("div", en, [
1016
+ V("header", tn, [
1017
+ V("div", {
1018
+ class: q(["router-tab__slot-start", { "has-content": e.hasStartSlot }])
1006
1019
  }, [
1007
- pe(e.$slots, "start")
1020
+ he(e.$slots, "start")
1008
1021
  ], 2),
1009
- j("div", Zt, [
1010
- Le(It, ve({
1022
+ V("div", nn, [
1023
+ Bt(Dt, me({
1011
1024
  tag: "ul",
1012
1025
  class: "router-tab__nav"
1013
1026
  }, e.tabTransitionProps), {
1014
- default: he(() => [
1015
- ($(!0), x(me, null, Oe(e.tabs, (i, b) => ($(), x("li", {
1027
+ default: ye(() => [
1028
+ ($(!0), B(Te, null, Le(e.tabs, (i, p) => ($(), B("li", {
1016
1029
  key: i.id,
1017
- class: J(e.buildTabClass(i)),
1030
+ class: q(e.buildTabClass(i)),
1018
1031
  "data-title": e.getTabTitle(i),
1019
1032
  draggable: e.sortable,
1020
1033
  ref_for: !0,
1021
1034
  ref: (h) => e.setTabRef(i.id, h),
1022
1035
  onClick: (h) => e.activate(i),
1023
- onAuxclick: ye((h) => e.close(i), ["middle", "prevent"]),
1024
- onContextmenu: ye((h) => e.showContextMenu(i, h), ["prevent"]),
1025
- onDragstart: (h) => e.onDragStart(i, b, h),
1026
- onDragover: (h) => e.onDragOver(b, h),
1027
- onDragenter: (h) => e.onDragEnter(b),
1036
+ onAuxclick: Re((h) => e.close(i), ["middle", "prevent"]),
1037
+ onContextmenu: Re((h) => e.showContextMenu(i, h), ["prevent"]),
1038
+ onDragstart: (h) => e.onDragStart(i, p, h),
1039
+ onDragover: (h) => e.onDragOver(p, h),
1040
+ onDragenter: (h) => e.onDragEnter(p),
1028
1041
  onDragleave: r[0] || (r[0] = (...h) => e.onDragLeave && e.onDragLeave(...h)),
1029
- onDrop: (h) => e.onDrop(b, h),
1042
+ onDrop: (h) => e.onDrop(p, h),
1030
1043
  onDragend: r[1] || (r[1] = (...h) => e.onDragEnd && e.onDragEnd(...h))
1031
1044
  }, [
1032
- i.icon ? ($(), x("i", {
1045
+ i.icon ? ($(), B("i", {
1033
1046
  key: 0,
1034
- class: J(["router-tab__item-icon", i.icon])
1035
- }, null, 2)) : ee("", !0),
1036
- j("span", {
1047
+ class: q(["router-tab__item-icon", i.icon])
1048
+ }, null, 2)) : te("", !0),
1049
+ V("span", {
1037
1050
  class: "router-tab__item-title",
1038
1051
  title: e.getReactiveTabTitle(i)
1039
- }, je(e.getReactiveTabTitle(i)), 9, tn),
1040
- e.isClosable(i) ? ($(), x("a", {
1052
+ }, Oe(e.getReactiveTabTitle(i)), 9, rn),
1053
+ e.isClosable(i) ? ($(), B("a", {
1041
1054
  key: 1,
1042
1055
  class: "router-tab__item-close",
1043
- onClick: ye((h) => e.close(i), ["stop"])
1044
- }, null, 8, nn)) : ee("", !0)
1045
- ], 42, en))), 128))
1056
+ onClick: Re((h) => e.close(i), ["stop"])
1057
+ }, null, 8, an)) : te("", !0)
1058
+ ], 42, on))), 128))
1046
1059
  ]),
1047
1060
  _: 1
1048
1061
  }, 16)
1049
1062
  ], 512),
1050
- j("div", {
1051
- class: J(["router-tab__slot-end", { "has-content": e.hasEndSlot }])
1063
+ V("div", {
1064
+ class: q(["router-tab__slot-end", { "has-content": e.hasEndSlot }])
1052
1065
  }, [
1053
- pe(e.$slots, "end")
1066
+ he(e.$slots, "end")
1054
1067
  ], 2)
1055
1068
  ]),
1056
- j("div", on, [
1057
- Le(T, null, {
1058
- default: he(({ Component: i, route: b }) => [
1059
- e.hasCustomSlot ? pe(e.$slots, "default", xt(ve({ key: 0 }, {
1069
+ V("div", ln, [
1070
+ e.persistenceHydrating ? ($(), B("div", sn)) : ($(), X(R, { key: 0 }, {
1071
+ default: ye(({ Component: i, route: p }) => [
1072
+ e.hasCustomSlot ? he(e.$slots, "default", Mt(me({ key: 0 }, {
1060
1073
  Component: i,
1061
- route: b,
1074
+ route: p,
1062
1075
  controller: e.controller,
1063
- pageRef: (h) => e.handleComponentRef(h, e.controller.getRouteKey(b))
1064
- }))) : ($(), x(me, { key: 1 }, [
1065
- e.controller.options.keepAlive ? ($(), te(Dt, {
1076
+ pageRef: (h) => e.handleComponentRef(h, e.controller.getRouteKey(p))
1077
+ }))) : ($(), B(Te, { key: 1 }, [
1078
+ e.controller.options.keepAlive ? ($(), X(Lt, {
1066
1079
  key: 0,
1067
1080
  include: e.includeKeys
1068
1081
  }, [
1069
- i ? ($(), te(ze(e.ensureNamedComponent(i, e.controller.getRouteKey(b))), {
1070
- key: e.controller.getRouteKey(b),
1071
- ref: (h) => e.handleComponentRef(h, e.controller.getRouteKey(b)),
1082
+ i ? ($(), X(je(e.getNamedComponent(i, e.getComponentCacheKey(p))), {
1083
+ key: e.isRefreshing(p) ? e.getRefreshComponentKey(p) : e.getComponentCacheKey(p),
1084
+ ref: (h) => e.handleComponentRef(h, e.controller.getRouteKey(p)),
1072
1085
  class: "router-tab-page"
1073
- })) : ee("", !0)
1074
- ], 1032, ["include"])) : ($(), te(Bt, ve({ key: 1 }, e.pageTransitionProps, { appear: "" }), {
1075
- default: he(() => [
1076
- i ? ($(), te(ze(i), {
1077
- key: e.controller.getRouteKey(b),
1078
- ref: (h) => e.handleComponentRef(h, e.controller.getRouteKey(b)),
1086
+ })) : te("", !0)
1087
+ ], 1032, ["include"])) : ($(), X(Ot, me({ key: 1 }, e.pageTransitionProps, { appear: "" }), {
1088
+ default: ye(() => [
1089
+ i ? ($(), X(je(i), {
1090
+ key: e.controller.getRouteKey(p),
1091
+ ref: (h) => e.handleComponentRef(h, e.controller.getRouteKey(p)),
1079
1092
  class: "router-tab-page"
1080
- })) : ee("", !0)
1093
+ })) : te("", !0)
1081
1094
  ]),
1082
1095
  _: 2
1083
1096
  }, 1040))
1084
1097
  ], 64))
1085
1098
  ]),
1086
1099
  _: 3
1087
- })
1100
+ }))
1088
1101
  ]),
1089
- St(j("div", {
1102
+ xt(V("div", {
1090
1103
  ref: "menuRef",
1091
1104
  class: "router-tab__contextmenu",
1092
1105
  role: "menu",
1093
1106
  onKeydown: r[2] || (r[2] = (...i) => e.onMenuKeydown && e.onMenuKeydown(...i)),
1094
- style: Mt({ left: e.context.position.x + "px", top: e.context.position.y + "px" })
1107
+ style: jt({ left: e.context.position.x + "px", top: e.context.position.y + "px" })
1095
1108
  }, [
1096
- ($(!0), x(me, null, Oe(e.menuItems, (i, b) => ($(), x("a", {
1109
+ ($(!0), B(Te, null, Le(e.menuItems, (i, p) => ($(), B("a", {
1097
1110
  key: i.id,
1098
1111
  role: "menuitem",
1099
- class: J(["router-tab__contextmenu-item", { "is-focused": b === e.highlightedIndex }]),
1112
+ class: q(["router-tab__contextmenu-item", { "is-focused": p === e.highlightedIndex }]),
1100
1113
  "aria-disabled": i.disabled,
1101
1114
  disabled: i.disabled,
1102
- tabindex: i.disabled ? -1 : b === e.highlightedIndex ? 0 : -1,
1115
+ tabindex: i.disabled ? -1 : p === e.highlightedIndex ? 0 : -1,
1103
1116
  ref_for: !0,
1104
- ref: (h) => e.setMenuItemRef(h, b),
1105
- onMouseenter: (h) => !i.disabled && e.highlightMenuIndex(b),
1117
+ ref: (h) => e.setMenuItemRef(h, p),
1118
+ onMouseenter: (h) => !i.disabled && e.highlightMenuIndex(p),
1106
1119
  onClick: (h) => e.handleMenuAction(i)
1107
- }, je(i.label), 43, rn))), 128))
1120
+ }, Oe(i.label), 43, un))), 128))
1108
1121
  ], 36), [
1109
- [Lt, e.context.visible && e.context.target]
1122
+ [Ut, e.context.visible && e.context.target]
1110
1123
  ])
1111
1124
  ]);
1112
1125
  }
1113
- const Ye = /* @__PURE__ */ Gt(Jt, [["render", an]]), ln = {
1126
+ const ze = /* @__PURE__ */ Zt(Qt, [["render", cn]]), fn = {
1114
1127
  class: "router-tabs",
1115
1128
  "aria-hidden": "true"
1116
- }, we = /* @__PURE__ */ Ce({
1129
+ }, ke = /* @__PURE__ */ Ce({
1117
1130
  name: "RouterTabs",
1118
1131
  __name: "RouterTabs",
1119
1132
  props: {
@@ -1128,11 +1141,11 @@ const Ye = /* @__PURE__ */ Gt(Jt, [["render", an]]), ln = {
1128
1141
  fallbackRoute: {}
1129
1142
  },
1130
1143
  setup(e) {
1131
- return He(e), (o, s) => ($(), x("span", ln));
1144
+ return Je(e), (o, s) => ($(), B("span", fn));
1132
1145
  }
1133
- }), Je = "tab-theme-style", Ge = "tab-theme-primary-color", sn = "system", Xe = "(prefers-color-scheme: dark)";
1134
- let G = null;
1135
- const K = {
1146
+ }), Ge = "tab-theme-style", qe = "tab-theme-primary-color", dn = "system", Xe = "(prefers-color-scheme: dark)";
1147
+ let Q = null;
1148
+ const P = {
1136
1149
  primary: "#034960",
1137
1150
  background: "#ffffff",
1138
1151
  text: "#1e293b",
@@ -1146,7 +1159,7 @@ const K = {
1146
1159
  activeButtonBackground: "#034960",
1147
1160
  activeButtonColor: "#ffffff",
1148
1161
  iconColor: "#475569"
1149
- }, un = {
1162
+ }, bn = {
1150
1163
  primary: "#38bdf8",
1151
1164
  background: "#0f172a",
1152
1165
  text: "#f1f5f9",
@@ -1162,7 +1175,7 @@ const K = {
1162
1175
  activeButtonColor: "#0f172a",
1163
1176
  iconColor: "#cbd5e1"
1164
1177
  };
1165
- function cn(e) {
1178
+ function gn(e) {
1166
1179
  if (typeof window > "u") return null;
1167
1180
  const r = window.localStorage.getItem(e);
1168
1181
  if (!r) return null;
@@ -1174,45 +1187,45 @@ function cn(e) {
1174
1187
  }
1175
1188
  }
1176
1189
  function $e(e) {
1177
- typeof document > "u" || (document.documentElement.style.setProperty("--router-tab-primary", e.primary ?? K.primary), document.documentElement.style.setProperty("--router-tab-header-bg", e.headerBackground ?? K.headerBackground), document.documentElement.style.setProperty("--router-tab-background", e.background ?? K.background), document.documentElement.style.setProperty("--router-tab-active-background", e.activeBackground ?? K.activeBackground), document.documentElement.style.setProperty("--router-tab-text", e.text ?? K.text), document.documentElement.style.setProperty("--router-tab-active-text", e.activeText ?? K.activeText), document.documentElement.style.setProperty("--router-tab-border", e.border ?? K.border), document.documentElement.style.setProperty("--router-tab-active-border", e.activeBorder ?? K.activeBorder), document.documentElement.style.setProperty("--router-tab-button-color", e.buttonColor ?? K.buttonColor), document.documentElement.style.setProperty("--router-tab-active-button-color", e.activeButtonColor ?? K.activeButtonColor), document.documentElement.style.setProperty("--router-tab-button-background", e.buttonBackground ?? K.buttonBackground), document.documentElement.style.setProperty("--router-tab-active-button-background", e.activeButtonBackground ?? K.activeButtonBackground), document.documentElement.style.setProperty("--router-tab-icon-color", e.iconColor ?? K.iconColor));
1190
+ typeof document > "u" || (document.documentElement.style.setProperty("--router-tab-primary", e.primary ?? P.primary), document.documentElement.style.setProperty("--router-tab-header-bg", e.headerBackground ?? P.headerBackground), document.documentElement.style.setProperty("--router-tab-background", e.background ?? P.background), document.documentElement.style.setProperty("--router-tab-active-background", e.activeBackground ?? P.activeBackground), document.documentElement.style.setProperty("--router-tab-text", e.text ?? P.text), document.documentElement.style.setProperty("--router-tab-active-text", e.activeText ?? P.activeText), document.documentElement.style.setProperty("--router-tab-border", e.border ?? P.border), document.documentElement.style.setProperty("--router-tab-active-border", e.activeBorder ?? P.activeBorder), document.documentElement.style.setProperty("--router-tab-button-color", e.buttonColor ?? P.buttonColor), document.documentElement.style.setProperty("--router-tab-active-button-color", e.activeButtonColor ?? P.activeButtonColor), document.documentElement.style.setProperty("--router-tab-button-background", e.buttonBackground ?? P.buttonBackground), document.documentElement.style.setProperty("--router-tab-active-button-background", e.activeButtonBackground ?? P.activeButtonBackground), document.documentElement.style.setProperty("--router-tab-icon-color", e.iconColor ?? P.iconColor));
1178
1191
  }
1179
1192
  function Qe(e) {
1180
1193
  if (typeof document > "u") return;
1181
1194
  const r = document.documentElement, o = window.matchMedia(Xe), s = () => {
1182
1195
  r.dataset.theme = o.matches ? "dark" : "light";
1183
1196
  };
1184
- G && (o.removeEventListener("change", G), G = null), e === "system" ? (s(), G = () => s(), o.addEventListener("change", G)) : r.dataset.theme = e;
1197
+ Q && (o.removeEventListener("change", Q), Q = null), e === "system" ? (s(), Q = () => s(), o.addEventListener("change", Q)) : r.dataset.theme = e;
1185
1198
  }
1186
- function fn(e = {}) {
1199
+ function pn(e = {}) {
1187
1200
  if (typeof window > "u") return;
1188
1201
  const {
1189
- styleKey: r = Je,
1190
- primaryKey: o = Ge,
1191
- defaultStyle: s = sn,
1202
+ styleKey: r = Ge,
1203
+ primaryKey: o = qe,
1204
+ defaultStyle: s = dn,
1192
1205
  defaultPrimary: a
1193
- } = e, p = window.localStorage.getItem(r) ?? s;
1194
- Qe(p);
1195
- const i = p === "dark" || p === "system" && window.matchMedia(Xe).matches ? { ...un } : { ...K };
1206
+ } = e, v = window.localStorage.getItem(r) ?? s;
1207
+ Qe(v);
1208
+ const i = v === "dark" || v === "system" && window.matchMedia(Xe).matches ? { ...bn } : { ...P };
1196
1209
  a && (i.primary = a);
1197
- const b = cn(o);
1198
- $e(b ? {
1210
+ const p = gn(o);
1211
+ $e(p ? {
1199
1212
  ...i,
1200
- ...b
1213
+ ...p
1201
1214
  } : i);
1202
1215
  }
1203
- function gn(e, r) {
1216
+ function mn(e, r) {
1204
1217
  if (typeof window > "u") return;
1205
- const o = r?.styleKey ?? Je;
1218
+ const o = r?.styleKey ?? Ge;
1206
1219
  window.localStorage.setItem(o, e), Qe(e);
1207
1220
  }
1208
- function pn(e, r) {
1221
+ function yn(e, r) {
1209
1222
  if (typeof window > "u") return;
1210
- const o = r?.primaryKey ?? Ge;
1223
+ const o = r?.primaryKey ?? qe;
1211
1224
  window.localStorage.setItem(o, JSON.stringify(e)), $e(e);
1212
1225
  }
1213
- function oe(e, r) {
1214
- if (Ot(e)) {
1215
- const s = !jt(e);
1226
+ function re(e, r) {
1227
+ if (Vt(e)) {
1228
+ const s = !Nt(e);
1216
1229
  return {
1217
1230
  value: e,
1218
1231
  update: s ? (a) => {
@@ -1223,11 +1236,11 @@ function oe(e, r) {
1223
1236
  }
1224
1237
  if (typeof e == "function")
1225
1238
  return {
1226
- value: C(e),
1239
+ value: K(e),
1227
1240
  update: () => {
1228
1241
  }
1229
1242
  };
1230
- const o = S(
1243
+ const o = x(
1231
1244
  e === void 0 ? r : e
1232
1245
  );
1233
1246
  return {
@@ -1237,8 +1250,8 @@ function oe(e, r) {
1237
1250
  }
1238
1251
  };
1239
1252
  }
1240
- function Ae(e = {}) {
1241
- const r = oe(e.title, "Untitled"), o = oe(e.icon, ""), s = oe(e.closable, !0), a = oe(e.meta, {});
1253
+ function Pe(e = {}) {
1254
+ const r = re(e.title, "Untitled"), o = re(e.icon, ""), s = re(e.closable, !0), a = re(e.meta, {});
1242
1255
  return {
1243
1256
  routeTabTitle: r.value,
1244
1257
  routeTabIcon: o.value,
@@ -1250,67 +1263,67 @@ function Ae(e = {}) {
1250
1263
  updateMeta: a.update
1251
1264
  };
1252
1265
  }
1253
- function vn(e, r = "Page") {
1254
- return Ae({
1255
- title: C(() => e.value ? "Loading..." : r),
1256
- icon: C(() => e.value ? "mdi-loading mdi-spin" : "mdi-page"),
1257
- closable: C(() => !e.value)
1266
+ function Tn(e, r = "Page") {
1267
+ return Pe({
1268
+ title: K(() => e.value ? "Loading..." : r),
1269
+ icon: K(() => e.value ? "mdi-loading mdi-spin" : "mdi-page"),
1270
+ closable: K(() => !e.value)
1258
1271
  });
1259
1272
  }
1260
- function hn(e, r = "Page", o = "mdi-page") {
1261
- return Ae({
1262
- title: C(() => e.value > 0 ? `${r} (${e.value})` : r),
1263
- icon: C(() => e.value > 0 ? "mdi-bell-badge" : o)
1273
+ function Rn(e, r = "Page", o = "mdi-page") {
1274
+ return Pe({
1275
+ title: K(() => e.value > 0 ? `${r} (${e.value})` : r),
1276
+ icon: K(() => e.value > 0 ? "mdi-bell-badge" : o)
1264
1277
  });
1265
1278
  }
1266
- function mn(e, r = "Page") {
1279
+ function wn(e, r = "Page") {
1267
1280
  const o = {
1268
1281
  normal: { suffix: "", icon: "mdi-page" },
1269
1282
  loading: { suffix: " - Loading", icon: "mdi-loading mdi-spin" },
1270
1283
  error: { suffix: " - Error", icon: "mdi-alert" },
1271
1284
  success: { suffix: " - Success", icon: "mdi-check-circle" }
1272
1285
  };
1273
- return Ae({
1274
- title: C(() => r + o[e.value].suffix),
1275
- icon: C(() => o[e.value].icon),
1276
- closable: C(() => e.value !== "loading")
1286
+ return Pe({
1287
+ title: K(() => r + o[e.value].suffix),
1288
+ icon: K(() => o[e.value].icon),
1289
+ closable: K(() => e.value !== "loading")
1277
1290
  });
1278
1291
  }
1279
- let Fe = !1;
1280
- const yn = {
1292
+ let Ye = !1;
1293
+ const kn = {
1281
1294
  install(e, r) {
1282
- if (Fe) return;
1283
- Fe = !0;
1295
+ if (Ye) return;
1296
+ Ye = !0;
1284
1297
  const {
1285
1298
  initTheme: o = !0,
1286
1299
  themeOptions: s,
1287
- componentName: a = Ye.name || "RouterTab",
1288
- tabsComponentName: p = we.name || "RouterTabs"
1300
+ componentName: a = ze.name || "RouterTab",
1301
+ tabsComponentName: v = ke.name || "RouterTabs"
1289
1302
  } = r ?? {};
1290
- o && fn(s ?? {}), e.component(a, Ye), e.component(p, we), p.toLowerCase() !== "router-tabs" && e.component("router-tabs", we), Object.defineProperty(e.config.globalProperties, "$tabs", {
1303
+ o && pn(s ?? {}), e.component(a, ze), e.component(v, ke), v.toLowerCase() !== "router-tabs" && e.component("router-tabs", ke), Object.defineProperty(e.config.globalProperties, "$tabs", {
1291
1304
  configurable: !0,
1292
1305
  enumerable: !1,
1293
1306
  get() {
1294
- return e._context.provides[ie];
1307
+ return e._context.provides[le];
1295
1308
  },
1296
- set(T) {
1297
- T && e.provide(ie, T);
1309
+ set(R) {
1310
+ R && e.provide(le, R);
1298
1311
  }
1299
1312
  });
1300
1313
  }
1301
1314
  };
1302
1315
  export {
1303
- Ye as RouterTab,
1304
- we as RouterTabs,
1305
- yn as default,
1306
- fn as initRouterTabsTheme,
1307
- ie as routerTabsKey,
1308
- pn as setRouterTabsPrimary,
1309
- gn as setRouterTabsTheme,
1310
- vn as useLoadingTab,
1311
- hn as useNotificationTab,
1312
- Ae as useReactiveTab,
1313
- Ue as useRouterTabs,
1314
- He as useRouterTabsPersistence,
1315
- mn as useStatusTab
1316
+ ze as RouterTab,
1317
+ ke as RouterTabs,
1318
+ kn as default,
1319
+ pn as initRouterTabsTheme,
1320
+ le as routerTabsKey,
1321
+ yn as setRouterTabsPrimary,
1322
+ mn as setRouterTabsTheme,
1323
+ Tn as useLoadingTab,
1324
+ Rn as useNotificationTab,
1325
+ Pe as useReactiveTab,
1326
+ Ve as useRouterTabs,
1327
+ Je as useRouterTabsPersistence,
1328
+ wn as useStatusTab
1316
1329
  };