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