vue-stack-tabs 1.1.0 → 1.3.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.
Files changed (115) hide show
  1. package/README.en.md +526 -0
  2. package/README.md +141 -39
  3. package/README.ru.md +526 -0
  4. package/dist/iframe-bridge.d.ts +8 -0
  5. package/dist/iframe-bridge.html +77 -0
  6. package/dist/iframe-bridge.mjs +20 -0
  7. package/dist/iframe-child.html +19 -6
  8. package/dist/nuxt/favicon.svg +10 -0
  9. package/dist/nuxt/iframe-bridge.html +77 -0
  10. package/dist/nuxt/iframe-child.html +88 -0
  11. package/dist/nuxt/module.d.ts +6 -0
  12. package/dist/nuxt/module.mjs +28 -0
  13. package/dist/nuxt/plugin.mjs +9 -0
  14. package/dist/nuxt/runtime/plugin.d.ts +2 -0
  15. package/dist/nuxt/runtime/plugin.mjs +9 -0
  16. package/dist/src/lib/StackTabs.vue.d.ts +30 -16
  17. package/dist/src/lib/components/ContextMenu/ContextMenuItem.vue.d.ts +7 -1
  18. package/dist/src/lib/components/ContextMenu/index.vue.d.ts +5 -4
  19. package/dist/src/lib/components/PageLoading.vue.d.ts +2 -1
  20. package/dist/src/lib/components/StackKeepAlive/StackCacheRenderer.vue.d.ts +25 -0
  21. package/dist/src/lib/components/StackKeepAlive/StackKeepAlive.vue.d.ts +12 -0
  22. package/dist/src/lib/components/TabHeader/TabHeaderButton.vue.d.ts +11 -12
  23. package/dist/src/lib/components/TabHeader/TabHeaderItem.vue.d.ts +5 -4
  24. package/dist/src/lib/components/TabHeader/TabHeaderScroll.vue.d.ts +8 -22
  25. package/dist/src/lib/components/TabHeader/index.vue.d.ts +11 -164
  26. package/dist/src/lib/hooks/stackTabsContext.d.ts +49 -0
  27. package/dist/src/lib/hooks/tabPanel/evict.d.ts +21 -61
  28. package/dist/src/lib/hooks/tabPanel/navigationTransaction.d.ts +35 -0
  29. package/dist/src/lib/hooks/tabPanel/refresh.d.ts +17 -0
  30. package/dist/src/lib/hooks/tabPanel/scroll.d.ts +8 -8
  31. package/dist/src/lib/hooks/tabPanel/session.d.ts +9 -8
  32. package/dist/src/lib/hooks/tabPanel/state.d.ts +20 -72
  33. package/dist/src/lib/hooks/useIframeManager.d.ts +35 -0
  34. package/dist/src/lib/hooks/useTabActions.d.ts +5 -46
  35. package/dist/src/lib/hooks/useTabEventBus.d.ts +22 -9
  36. package/dist/src/lib/hooks/useTabPanel.d.ts +14 -73
  37. package/dist/src/lib/i18n/index.d.ts +6 -4
  38. package/dist/src/lib/i18n/lang/en.d.ts +5 -0
  39. package/dist/src/lib/i18n/lang/zh-CN.d.ts +5 -0
  40. package/dist/src/lib/i18n/stackTabsLocale.d.ts +2 -0
  41. package/dist/src/lib/iframe-bridge.d.ts +8 -0
  42. package/dist/src/lib/iframe.vue.d.ts +2 -1
  43. package/dist/src/lib/index.d.ts +4 -5
  44. package/dist/src/lib/model/TabModel.d.ts +11 -40
  45. package/dist/src/lib/nuxt/module.d.ts +6 -0
  46. package/dist/src/lib/nuxt/runtime/plugin.client.d.ts +2 -0
  47. package/dist/src/lib/nuxt/runtime/plugin.d.ts +2 -0
  48. package/dist/src/lib/utils/iframeBridge.d.ts +11 -3
  49. package/dist/src/lib/utils/stackTabsA11y.d.ts +8 -0
  50. package/dist/src/lib/utils/stackTabsMessage.d.ts +7 -0
  51. package/dist/src/lib/utils/tabInfoEncoder.d.ts +0 -15
  52. package/dist/src/lib/utils/typeGuards.d.ts +2 -0
  53. package/dist/src/lib/utils/urlParser.d.ts +24 -3
  54. package/dist/src/lib/versionLogger.d.ts +1 -0
  55. package/dist/style.css +2 -1
  56. package/dist/utils/iframeBridge.d.ts +39 -0
  57. package/dist/vue-stack-tabs.css +2 -1
  58. package/dist/vue-stack-tabs.es.js +1 -2220
  59. package/package.json +71 -50
  60. package/src/lib/StackTabs.vue +223 -196
  61. package/src/lib/assets/style/stackTab.scss +110 -13
  62. package/src/lib/components/ContextMenu/ContextMenuItem.vue +23 -11
  63. package/src/lib/components/ContextMenu/index.vue +94 -10
  64. package/src/lib/components/PageLoading.vue +9 -7
  65. package/src/lib/components/StackKeepAlive/StackCacheRenderer.vue +70 -0
  66. package/src/lib/components/StackKeepAlive/StackKeepAlive.vue +57 -0
  67. package/src/lib/components/TabHeader/TabHeaderButton.vue +19 -8
  68. package/src/lib/components/TabHeader/TabHeaderItem.vue +74 -17
  69. package/src/lib/components/TabHeader/TabHeaderScroll.vue +47 -25
  70. package/src/lib/components/TabHeader/index.vue +181 -13
  71. package/src/lib/hooks/stackTabsContext.ts +135 -0
  72. package/src/lib/hooks/tabPanel/evict.ts +122 -87
  73. package/src/lib/hooks/tabPanel/navigationTransaction.ts +61 -0
  74. package/src/lib/hooks/tabPanel/refresh.ts +109 -0
  75. package/src/lib/hooks/tabPanel/scroll.ts +57 -40
  76. package/src/lib/hooks/tabPanel/session.ts +84 -22
  77. package/src/lib/hooks/tabPanel/state.ts +41 -44
  78. package/src/lib/hooks/useIframeManager.ts +253 -0
  79. package/src/lib/hooks/useTabActions.ts +64 -30
  80. package/src/lib/hooks/useTabEventBus.ts +29 -19
  81. package/src/lib/hooks/useTabLoading.ts +3 -2
  82. package/src/lib/hooks/useTabPanel.tsx +290 -313
  83. package/src/lib/hooks/useTabRouter.ts +111 -97
  84. package/src/lib/i18n/index.ts +53 -45
  85. package/src/lib/i18n/lang/en.ts +6 -1
  86. package/src/lib/i18n/lang/zh-CN.ts +6 -1
  87. package/src/lib/i18n/stackTabsLocale.ts +8 -0
  88. package/src/lib/iframe-bridge.ts +12 -0
  89. package/src/lib/index.ts +14 -19
  90. package/src/lib/model/TabModel.ts +27 -82
  91. package/src/lib/nuxt/module.d.ts +4 -0
  92. package/src/lib/nuxt/module.ts +8 -3
  93. package/src/lib/nuxt/runtime/plugin.client.ts +1 -0
  94. package/src/lib/nuxt/runtime/plugin.ts +11 -0
  95. package/src/lib/utils/iframeBridge.ts +29 -5
  96. package/src/lib/utils/scrollUtils.ts +9 -4
  97. package/src/lib/utils/stackTabsA11y.ts +12 -0
  98. package/src/lib/utils/stackTabsMessage.ts +99 -0
  99. package/src/lib/utils/tabInfoEncoder.ts +70 -21
  100. package/src/lib/utils/typeGuards.ts +3 -0
  101. package/src/lib/utils/urlParser.ts +144 -14
  102. package/src/lib/versionLogger.ts +7 -19
  103. package/dist/src/lib/hooks/tabPanel/evict.spec.d.ts +0 -1
  104. package/dist/src/lib/hooks/useTabPanel.spec.d.ts +0 -1
  105. package/dist/src/lib/model/TabModel.spec.d.ts +0 -1
  106. package/dist/src/lib/utils/iframeBridge.spec.d.ts +0 -1
  107. package/dist/src/lib/utils/tabInfoEncoder.spec.d.ts +0 -1
  108. package/dist/src/lib/utils/urlParser.spec.d.ts +0 -1
  109. package/dist/vue-stack-tabs.umd.js +0 -1
  110. package/src/lib/hooks/tabPanel/evict.spec.ts +0 -85
  111. package/src/lib/hooks/useTabPanel.spec.ts +0 -34
  112. package/src/lib/model/TabModel.spec.ts +0 -40
  113. package/src/lib/utils/iframeBridge.spec.ts +0 -37
  114. package/src/lib/utils/tabInfoEncoder.spec.ts +0 -32
  115. package/src/lib/utils/urlParser.spec.ts +0 -45
@@ -1,2220 +1 @@
1
- import { inject as at, ref as P, reactive as se, toRaw as cn, readonly as yt, defineComponent as X, onUnmounted as Se, openBlock as L, createElementBlock as V, normalizeStyle as Ue, unref as I, createElementVNode as U, createCommentVNode as ce, onMounted as ct, onDeactivated as ln, onActivated as un, createVNode as $, cloneVNode as fn, normalizeClass as he, withModifiers as Be, toDisplayString as lt, createBlock as ie, Fragment as Ge, renderList as ut, nextTick as Je, computed as ae, renderSlot as _e, watch as Qe, withDirectives as et, vShow as tt, withCtx as oe, TransitionGroup as qt, mergeProps as dn, Transition as nt, provide as hn, onBeforeMount as vn, onBeforeUnmount as pn, resolveComponent as bn, KeepAlive as mn, resolveDynamicComponent as gn, getCurrentInstance as Ft } from "vue";
2
- import { useRouter as ft, useRoute as yn } from "vue-router";
3
- const Tn = {
4
- VueStackTab: {
5
- close: "close",
6
- closeLeft: "close left",
7
- closeRight: "close right",
8
- closeOthers: "close others",
9
- closeAll: "close all",
10
- reload: "reload",
11
- reloadAll: "reload all",
12
- maximum: "maximum",
13
- restore: "restore",
14
- undefined: "undefined",
15
- loading: "loading",
16
- openInNewWindow: "Open in new window"
17
- }
18
- }, wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
19
- __proto__: null,
20
- default: Tn
21
- }, Symbol.toStringTag, { value: "Module" })), xn = {
22
- VueStackTab: {
23
- close: "关闭",
24
- closeLeft: "关闭左侧",
25
- closeRight: "关闭右侧",
26
- closeOthers: "关闭其他",
27
- closeAll: "关闭所有",
28
- reload: "刷新",
29
- reloadAll: "刷新所有",
30
- maximum: "最大化",
31
- restore: "还原",
32
- undefined: "未命名",
33
- loading: "加载中",
34
- openInNewWindow: "在新窗口打开"
35
- }
36
- }, _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
37
- __proto__: null,
38
- default: xn
39
- }, Symbol.toStringTag, { value: "Module" }));
40
- const kn = ["__proto__", "prototype", "constructor"];
41
- function Sn(e) {
42
- const t = typeof e;
43
- return e !== null && (t === "object" || t === "function");
44
- }
45
- function En(e) {
46
- return !(Array.isArray(e) ? e.length : Object.keys(e).length);
47
- }
48
- function An(e) {
49
- return !e.some((t) => kn.indexOf(t) !== -1);
50
- }
51
- function Mn(e) {
52
- const t = e.split("."), n = [];
53
- for (let o = 0; o < t.length; o++) {
54
- let s = t[o];
55
- for (; s[s.length - 1] === "\\" && t[o + 1] !== void 0; )
56
- s = s.slice(0, -1) + ".", s += t[++o];
57
- n.push(s);
58
- }
59
- return An(n) ? n : [];
60
- }
61
- function Tt(e, t) {
62
- if (!Sn(e))
63
- return "";
64
- const n = Mn(t);
65
- if (n.length === 0)
66
- return "";
67
- let o = Object.assign({}, e);
68
- for (let s = 0; s < n.length; s++) {
69
- if (typeof o[n[s]] == "string")
70
- return o[n[s]];
71
- if (o = o[n[s]], o == null) {
72
- if (s !== n.length - 1)
73
- return "";
74
- break;
75
- }
76
- }
77
- return "";
78
- }
79
- function Rn(e, t) {
80
- if (Array.isArray(t)) {
81
- const n = {}, o = [...e.matchAll(/{(.+?)}/g)];
82
- return o && o.forEach((s, a) => {
83
- t[a] && (n[s[1]] = t[a]);
84
- }), n;
85
- }
86
- return t;
87
- }
88
- function On(e, t) {
89
- for (const n in t)
90
- e = e.replace(`{${n}}`, String(t[n]));
91
- return e;
92
- }
93
- function Ut(e, t) {
94
- return Object.keys(t).forEach((n) => {
95
- t[n] instanceof Object && n in e && (t[n] = { ...t[n], ...Ut(e[n], t[n]) });
96
- }), { ...e || {}, ...t };
97
- }
98
- const In = typeof Symbol == "function" && typeof Symbol.toStringTag == "symbol", Cn = (e) => In ? Symbol(e) : "_vt_" + e, Gt = /* @__PURE__ */ Cn("i18n");
99
- function ze() {
100
- return at(Gt);
101
- }
102
- function Bn(e) {
103
- const t = Object.assign({ locale: "en", fallbackLocale: "en", messages: {} }, e), n = P(t.locale), o = se({});
104
- return Object.entries(t.messages).forEach(([s, a]) => {
105
- o[s] = a;
106
- }), {
107
- t(s, a) {
108
- if (!s)
109
- return "";
110
- const u = typeof a == "string" && a ? a : n.value;
111
- let y = Tt(o[u], s) || Tt(o[t.fallbackLocale], s);
112
- if (a && typeof a != "string") {
113
- const i = Rn(y, a);
114
- En(i) || (y = On(y, i));
115
- }
116
- return y || s;
117
- },
118
- current: yt(n),
119
- options: yt(e || {}),
120
- install(s) {
121
- const a = this;
122
- s.config.globalProperties.$t = a.t, s.provide(Gt, a);
123
- },
124
- changeLocale(s) {
125
- n.value = s;
126
- },
127
- setLocaleMessage(s, a) {
128
- o[s] = Ut(cn(o[s] || {}), a);
129
- },
130
- getLocaleMessage(s) {
131
- return o[s] || {};
132
- }
133
- };
134
- }
135
- const Ln = () => {
136
- const e = /* @__PURE__ */ Object.assign({ "./lang/en.ts": wn, "./lang/zh-CN.ts": _n });
137
- function t(s, a) {
138
- for (const u in s) {
139
- const y = s[u];
140
- if (y?.default) {
141
- const i = u.substring(u.lastIndexOf("/") + 1, u.lastIndexOf(".")), f = a[i];
142
- a[i] = f ? { ...f, ...y.default } : y.default;
143
- }
144
- }
145
- }
146
- const n = () => {
147
- const s = {};
148
- return t(e, s), s;
149
- };
150
- return {
151
- getI18n: (s) => {
152
- const a = { ...n() };
153
- if (s)
154
- for (const u of s)
155
- a[u.locale] = u.messages;
156
- return Bn({
157
- locale: "zh-CN",
158
- fallbackLocale: "en",
159
- messages: a
160
- });
161
- }
162
- };
163
- }, Ht = ({
164
- wrap: e,
165
- left: t = 0,
166
- top: n = 0,
167
- smooth: o = !0
168
- }) => {
169
- e && (e.scrollTo ? e.scrollTo({
170
- left: t,
171
- top: n,
172
- behavior: o ? "smooth" : "auto"
173
- }) : (e.scrollLeft = t, e.scrollTop = n));
174
- };
175
- function zn({
176
- el: e,
177
- wrap: t,
178
- block: n = "start",
179
- inline: o = "nearest"
180
- }) {
181
- const s = t && typeof t == "object" && "value" in t ? t.value : t;
182
- if (!(!e || !s))
183
- if (e.scrollIntoView)
184
- e.scrollIntoView({ behavior: "smooth", block: n, inline: o });
185
- else {
186
- const { offsetLeft: a, offsetTop: u } = e;
187
- let y, i;
188
- n === "center" ? i = u + (e.clientHeight - s.clientHeight) / 2 : i = u, o === "center" ? y = a + (e.clientWidth - s.clientWidth) / 2 : y = a, Ht({ wrap: s, left: y, top: i });
189
- }
190
- }
191
- const dt = (e = ".stack-tab__container *") => {
192
- const t = Array.from(document.querySelectorAll(e)).map(
193
- (n) => +window.getComputedStyle(n).zIndex || 0
194
- );
195
- return t.length ? Math.max(...t.filter((n) => n < 9e4)) + 1 : 1;
196
- };
197
- function wt(e) {
198
- return !!(e && /^(javascript|data):/i.test(e));
199
- }
200
- function jt(e) {
201
- if (!e || !/^https?:\/\//i.test(e)) return !1;
202
- try {
203
- const t = typeof window < "u" ? window.location : { origin: "http://localhost" };
204
- return new URL(e, t.origin).origin !== t.origin;
205
- } catch {
206
- return !0;
207
- }
208
- }
209
- function ht(e) {
210
- const [t, n] = e.split("?");
211
- if (!n)
212
- return { path: t ?? "", query: {} };
213
- const o = {};
214
- for (const s of n.split("&")) {
215
- const [a, u] = s.split("=");
216
- a != null && u != null && u !== "" && (o[a] = u);
217
- }
218
- return { path: t ?? "", query: o };
219
- }
220
- var pe = /* @__PURE__ */ ((e) => (e.WHEEL = "wheel", e.BUTTON = "button", e.BOTH = "both", e))(pe || {});
221
- class ot {
222
- items;
223
- constructor(t) {
224
- if (this.items = /* @__PURE__ */ new Map(), t)
225
- for (const n of t)
226
- this.push(n);
227
- }
228
- /**
229
- * @description: 入栈
230
- * @param {T} element 要入栈的元素
231
- */
232
- push(t) {
233
- this.items.set(this.items.size, t);
234
- }
235
- /**
236
- * @description: 出栈
237
- * @return {T} 返回出栈的元素
238
- */
239
- pop() {
240
- if (this.isEmpty())
241
- return;
242
- const t = this.items.get(this.items.size - 1);
243
- return this.items.delete(this.items.size - 1), t;
244
- }
245
- /**
246
- * @description: 返回栈顶的元素
247
- * @return {T}
248
- */
249
- peek() {
250
- if (!this.isEmpty())
251
- return this.items.get(this.items.size - 1);
252
- }
253
- /**
254
- * @description: 返回栈是否为空
255
- * @return {Boolean}
256
- */
257
- isEmpty() {
258
- return this.items.size === 0;
259
- }
260
- /**
261
- * @description: 返回栈里的元素个数
262
- * @return {Number}
263
- */
264
- size() {
265
- return this.items.size;
266
- }
267
- /**
268
- * @description: 清空栈内存
269
- */
270
- clear() {
271
- this.items.clear();
272
- }
273
- /**
274
- * @description: 将栈中的元素转换为数组
275
- * @return {T[]}
276
- */
277
- list() {
278
- return Array.from(this.items.values());
279
- }
280
- /**
281
- * @description: 用于控制 JSON.stringify 时的序列化输出
282
- * @return {T[]}
283
- */
284
- toJSON() {
285
- return this.list();
286
- }
287
- /**
288
- * @description: 覆盖Object默认的toString
289
- * @return {String}
290
- */
291
- toString() {
292
- return this.list().toString();
293
- }
294
- }
295
- function Pn(e, t, n) {
296
- var o = {}, s = o.noTrailing, a = s === void 0 ? !1 : s, u = o.noLeading, y = u === void 0 ? !1 : u, i = o.debounceMode, f = i === void 0 ? void 0 : i, w, v = !1, m = 0;
297
- function A() {
298
- w && clearTimeout(w);
299
- }
300
- function C(R) {
301
- var _ = R || {}, k = _.upcomingOnly, S = k === void 0 ? !1 : k;
302
- A(), v = !S;
303
- }
304
- function E() {
305
- for (var R = arguments.length, _ = new Array(R), k = 0; k < R; k++)
306
- _[k] = arguments[k];
307
- var S = this, T = Date.now() - m;
308
- if (v)
309
- return;
310
- function x() {
311
- m = Date.now(), t.apply(S, _);
312
- }
313
- function c() {
314
- w = void 0;
315
- }
316
- !y && f && !w && x(), A(), f === void 0 && T > e ? y ? (m = Date.now(), a || (w = setTimeout(f ? c : x, e))) : x() : a !== !0 && (w = setTimeout(f ? c : x, f === void 0 ? e - T : e));
317
- }
318
- return E.cancel = C, E;
319
- }
320
- function je(e) {
321
- if (e === null || typeof e != "object")
322
- return !1;
323
- const t = Object.getPrototypeOf(e);
324
- return t !== null && t !== Object.prototype && Object.getPrototypeOf(t) !== null || Symbol.iterator in e ? !1 : Symbol.toStringTag in e ? Object.prototype.toString.call(e) === "[object Module]" : !0;
325
- }
326
- function st(e, t, n = ".", o) {
327
- if (!je(t))
328
- return st(e, {}, n, o);
329
- const s = Object.assign({}, t);
330
- for (const a in e) {
331
- if (a === "__proto__" || a === "constructor")
332
- continue;
333
- const u = e[a];
334
- u != null && (o && o(s, a, u, n) || (Array.isArray(u) && Array.isArray(s[a]) ? s[a] = [...u, ...s[a]] : je(u) && je(s[a]) ? s[a] = st(
335
- u,
336
- s[a],
337
- (n ? `${n}.` : "") + a.toString(),
338
- o
339
- ) : s[a] = u));
340
- }
341
- return s;
342
- }
343
- function Nn(e) {
344
- return (...t) => (
345
- // eslint-disable-next-line unicorn/no-array-reduce
346
- t.reduce((n, o) => st(n, o, "", e), {})
347
- );
348
- }
349
- const re = Nn(), Zt = "0123456789ABCDEFGHJKMNPQRSTVWXYZ", Fe = 32, Dn = 16, Xt = 10, xt = 281474976710655;
350
- var be;
351
- (function(e) {
352
- e.Base32IncorrectEncoding = "B32_ENC_INVALID", e.DecodeTimeInvalidCharacter = "DEC_TIME_CHAR", e.DecodeTimeValueMalformed = "DEC_TIME_MALFORMED", e.EncodeTimeNegative = "ENC_TIME_NEG", e.EncodeTimeSizeExceeded = "ENC_TIME_SIZE_EXCEED", e.EncodeTimeValueMalformed = "ENC_TIME_MALFORMED", e.PRNGDetectFailure = "PRNG_DETECT", e.ULIDInvalid = "ULID_INVALID", e.Unexpected = "UNEXPECTED", e.UUIDInvalid = "UUID_INVALID";
353
- })(be || (be = {}));
354
- class Me extends Error {
355
- constructor(t, n) {
356
- super(`${n} (${t})`), this.name = "ULIDError", this.code = t;
357
- }
358
- }
359
- function Wn(e) {
360
- const t = Math.floor(e() * Fe) % Fe;
361
- return Zt.charAt(t);
362
- }
363
- function $n(e) {
364
- const t = Vn(), n = t && (t.crypto || t.msCrypto) || null;
365
- if (typeof n?.getRandomValues == "function")
366
- return () => {
367
- const o = new Uint8Array(1);
368
- return n.getRandomValues(o), o[0] / 256;
369
- };
370
- if (typeof n?.randomBytes == "function")
371
- return () => n.randomBytes(1).readUInt8() / 256;
372
- throw new Me(be.PRNGDetectFailure, "Failed to find a reliable PRNG");
373
- }
374
- function Vn() {
375
- return Un() ? self : typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : null;
376
- }
377
- function qn(e, t) {
378
- let n = "";
379
- for (; e > 0; e--)
380
- n = Wn(t) + n;
381
- return n;
382
- }
383
- function Fn(e, t = Xt) {
384
- if (isNaN(e))
385
- throw new Me(be.EncodeTimeValueMalformed, `Time must be a number: ${e}`);
386
- if (e > xt)
387
- throw new Me(be.EncodeTimeSizeExceeded, `Cannot encode a time larger than ${xt}: ${e}`);
388
- if (e < 0)
389
- throw new Me(be.EncodeTimeNegative, `Time must be positive: ${e}`);
390
- if (Number.isInteger(e) === !1)
391
- throw new Me(be.EncodeTimeValueMalformed, `Time must be an integer: ${e}`);
392
- let n, o = "";
393
- for (let s = t; s > 0; s--)
394
- n = e % Fe, o = Zt.charAt(n) + o, e = (e - n) / Fe;
395
- return o;
396
- }
397
- function Un() {
398
- return typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope;
399
- }
400
- function Ie(e, t) {
401
- const n = $n(), o = Date.now();
402
- return Fn(o, Xt) + qn(Dn, n);
403
- }
404
- var Ze = { exports: {} }, _t;
405
- function Gn() {
406
- return _t || (_t = 1, (function(e) {
407
- var t = (function() {
408
- var n = String.fromCharCode, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$", a = {};
409
- function u(i, f) {
410
- if (!a[i]) {
411
- a[i] = {};
412
- for (var w = 0; w < i.length; w++)
413
- a[i][i.charAt(w)] = w;
414
- }
415
- return a[i][f];
416
- }
417
- var y = {
418
- compressToBase64: function(i) {
419
- if (i == null) return "";
420
- var f = y._compress(i, 6, function(w) {
421
- return o.charAt(w);
422
- });
423
- switch (f.length % 4) {
424
- // To produce valid Base64
425
- default:
426
- // When could this happen ?
427
- case 0:
428
- return f;
429
- case 1:
430
- return f + "===";
431
- case 2:
432
- return f + "==";
433
- case 3:
434
- return f + "=";
435
- }
436
- },
437
- decompressFromBase64: function(i) {
438
- return i == null ? "" : i == "" ? null : y._decompress(i.length, 32, function(f) {
439
- return u(o, i.charAt(f));
440
- });
441
- },
442
- compressToUTF16: function(i) {
443
- return i == null ? "" : y._compress(i, 15, function(f) {
444
- return n(f + 32);
445
- }) + " ";
446
- },
447
- decompressFromUTF16: function(i) {
448
- return i == null ? "" : i == "" ? null : y._decompress(i.length, 16384, function(f) {
449
- return i.charCodeAt(f) - 32;
450
- });
451
- },
452
- //compress into uint8array (UCS-2 big endian format)
453
- compressToUint8Array: function(i) {
454
- for (var f = y.compress(i), w = new Uint8Array(f.length * 2), v = 0, m = f.length; v < m; v++) {
455
- var A = f.charCodeAt(v);
456
- w[v * 2] = A >>> 8, w[v * 2 + 1] = A % 256;
457
- }
458
- return w;
459
- },
460
- //decompress from uint8array (UCS-2 big endian format)
461
- decompressFromUint8Array: function(i) {
462
- if (i == null)
463
- return y.decompress(i);
464
- for (var f = new Array(i.length / 2), w = 0, v = f.length; w < v; w++)
465
- f[w] = i[w * 2] * 256 + i[w * 2 + 1];
466
- var m = [];
467
- return f.forEach(function(A) {
468
- m.push(n(A));
469
- }), y.decompress(m.join(""));
470
- },
471
- //compress into a string that is already URI encoded
472
- compressToEncodedURIComponent: function(i) {
473
- return i == null ? "" : y._compress(i, 6, function(f) {
474
- return s.charAt(f);
475
- });
476
- },
477
- //decompress from an output of compressToEncodedURIComponent
478
- decompressFromEncodedURIComponent: function(i) {
479
- return i == null ? "" : i == "" ? null : (i = i.replace(/ /g, "+"), y._decompress(i.length, 32, function(f) {
480
- return u(s, i.charAt(f));
481
- }));
482
- },
483
- compress: function(i) {
484
- return y._compress(i, 16, function(f) {
485
- return n(f);
486
- });
487
- },
488
- _compress: function(i, f, w) {
489
- if (i == null) return "";
490
- var v, m, A = {}, C = {}, E = "", R = "", _ = "", k = 2, S = 3, T = 2, x = [], c = 0, b = 0, g;
491
- for (g = 0; g < i.length; g += 1)
492
- if (E = i.charAt(g), Object.prototype.hasOwnProperty.call(A, E) || (A[E] = S++, C[E] = !0), R = _ + E, Object.prototype.hasOwnProperty.call(A, R))
493
- _ = R;
494
- else {
495
- if (Object.prototype.hasOwnProperty.call(C, _)) {
496
- if (_.charCodeAt(0) < 256) {
497
- for (v = 0; v < T; v++)
498
- c = c << 1, b == f - 1 ? (b = 0, x.push(w(c)), c = 0) : b++;
499
- for (m = _.charCodeAt(0), v = 0; v < 8; v++)
500
- c = c << 1 | m & 1, b == f - 1 ? (b = 0, x.push(w(c)), c = 0) : b++, m = m >> 1;
501
- } else {
502
- for (m = 1, v = 0; v < T; v++)
503
- c = c << 1 | m, b == f - 1 ? (b = 0, x.push(w(c)), c = 0) : b++, m = 0;
504
- for (m = _.charCodeAt(0), v = 0; v < 16; v++)
505
- c = c << 1 | m & 1, b == f - 1 ? (b = 0, x.push(w(c)), c = 0) : b++, m = m >> 1;
506
- }
507
- k--, k == 0 && (k = Math.pow(2, T), T++), delete C[_];
508
- } else
509
- for (m = A[_], v = 0; v < T; v++)
510
- c = c << 1 | m & 1, b == f - 1 ? (b = 0, x.push(w(c)), c = 0) : b++, m = m >> 1;
511
- k--, k == 0 && (k = Math.pow(2, T), T++), A[R] = S++, _ = String(E);
512
- }
513
- if (_ !== "") {
514
- if (Object.prototype.hasOwnProperty.call(C, _)) {
515
- if (_.charCodeAt(0) < 256) {
516
- for (v = 0; v < T; v++)
517
- c = c << 1, b == f - 1 ? (b = 0, x.push(w(c)), c = 0) : b++;
518
- for (m = _.charCodeAt(0), v = 0; v < 8; v++)
519
- c = c << 1 | m & 1, b == f - 1 ? (b = 0, x.push(w(c)), c = 0) : b++, m = m >> 1;
520
- } else {
521
- for (m = 1, v = 0; v < T; v++)
522
- c = c << 1 | m, b == f - 1 ? (b = 0, x.push(w(c)), c = 0) : b++, m = 0;
523
- for (m = _.charCodeAt(0), v = 0; v < 16; v++)
524
- c = c << 1 | m & 1, b == f - 1 ? (b = 0, x.push(w(c)), c = 0) : b++, m = m >> 1;
525
- }
526
- k--, k == 0 && (k = Math.pow(2, T), T++), delete C[_];
527
- } else
528
- for (m = A[_], v = 0; v < T; v++)
529
- c = c << 1 | m & 1, b == f - 1 ? (b = 0, x.push(w(c)), c = 0) : b++, m = m >> 1;
530
- k--, k == 0 && (k = Math.pow(2, T), T++);
531
- }
532
- for (m = 2, v = 0; v < T; v++)
533
- c = c << 1 | m & 1, b == f - 1 ? (b = 0, x.push(w(c)), c = 0) : b++, m = m >> 1;
534
- for (; ; )
535
- if (c = c << 1, b == f - 1) {
536
- x.push(w(c));
537
- break;
538
- } else b++;
539
- return x.join("");
540
- },
541
- decompress: function(i) {
542
- return i == null ? "" : i == "" ? null : y._decompress(i.length, 32768, function(f) {
543
- return i.charCodeAt(f);
544
- });
545
- },
546
- _decompress: function(i, f, w) {
547
- var v = [], m = 4, A = 4, C = 3, E = "", R = [], _, k, S, T, x, c, b, g = { val: w(0), position: f, index: 1 };
548
- for (_ = 0; _ < 3; _ += 1)
549
- v[_] = _;
550
- for (S = 0, x = Math.pow(2, 2), c = 1; c != x; )
551
- T = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = f, g.val = w(g.index++)), S |= (T > 0 ? 1 : 0) * c, c <<= 1;
552
- switch (S) {
553
- case 0:
554
- for (S = 0, x = Math.pow(2, 8), c = 1; c != x; )
555
- T = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = f, g.val = w(g.index++)), S |= (T > 0 ? 1 : 0) * c, c <<= 1;
556
- b = n(S);
557
- break;
558
- case 1:
559
- for (S = 0, x = Math.pow(2, 16), c = 1; c != x; )
560
- T = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = f, g.val = w(g.index++)), S |= (T > 0 ? 1 : 0) * c, c <<= 1;
561
- b = n(S);
562
- break;
563
- case 2:
564
- return "";
565
- }
566
- for (v[3] = b, k = b, R.push(b); ; ) {
567
- if (g.index > i)
568
- return "";
569
- for (S = 0, x = Math.pow(2, C), c = 1; c != x; )
570
- T = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = f, g.val = w(g.index++)), S |= (T > 0 ? 1 : 0) * c, c <<= 1;
571
- switch (b = S) {
572
- case 0:
573
- for (S = 0, x = Math.pow(2, 8), c = 1; c != x; )
574
- T = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = f, g.val = w(g.index++)), S |= (T > 0 ? 1 : 0) * c, c <<= 1;
575
- v[A++] = n(S), b = A - 1, m--;
576
- break;
577
- case 1:
578
- for (S = 0, x = Math.pow(2, 16), c = 1; c != x; )
579
- T = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = f, g.val = w(g.index++)), S |= (T > 0 ? 1 : 0) * c, c <<= 1;
580
- v[A++] = n(S), b = A - 1, m--;
581
- break;
582
- case 2:
583
- return R.join("");
584
- }
585
- if (m == 0 && (m = Math.pow(2, C), C++), v[b])
586
- E = v[b];
587
- else if (b === A)
588
- E = k + k.charAt(0);
589
- else
590
- return null;
591
- R.push(E), v[A++] = k + E.charAt(0), m--, k = E, m == 0 && (m = Math.pow(2, C), C++);
592
- }
593
- }
594
- };
595
- return y;
596
- })();
597
- e != null ? e.exports = t : typeof angular < "u" && angular != null && angular.module("LZString", []).factory("LZString", function() {
598
- return t;
599
- });
600
- })(Ze)), Ze.exports;
601
- }
602
- var Kt = Gn();
603
- const $e = (e) => {
604
- const t = e.iframeRefreshMode === "reload" ? "R" : "P", n = `${e.id}|${e.title}|${e.iframe ? "Y" : "N"}|${e.closable ? "Y" : "N"}|${e.refreshable ? "Y" : "N"}|${t}`;
605
- return Kt.compressToEncodedURIComponent(n);
606
- }, Hn = (e) => {
607
- const n = Kt.decompressFromEncodedURIComponent(e).split("|"), o = n[5] === "R" ? "reload" : "postMessage";
608
- return {
609
- id: n[0] ?? "",
610
- title: n[1] ?? "",
611
- iframe: n[2] === "Y",
612
- closable: n[3] === "Y",
613
- refreshable: n[4] === "Y",
614
- iframeRefreshMode: o
615
- };
616
- }, de = () => Ie();
617
- function jn(e) {
618
- return { all: e = e || /* @__PURE__ */ new Map(), on: function(t, n) {
619
- var o = e.get(t);
620
- o ? o.push(n) : e.set(t, [n]);
621
- }, off: function(t, n) {
622
- var o = e.get(t);
623
- o && (n ? o.splice(o.indexOf(n) >>> 0, 1) : e.set(t, []));
624
- }, emit: function(t, n) {
625
- var o = e.get(t);
626
- o && o.slice().map(function(s) {
627
- s(n);
628
- }), (o = e.get("*")) && o.slice().map(function(s) {
629
- s(t, n);
630
- });
631
- } };
632
- }
633
- const Zn = jn(), Xn = {
634
- install(e) {
635
- e.provide("tabEmitter", Zn);
636
- }
637
- }, Te = () => at("tabEmitter");
638
- var H = /* @__PURE__ */ ((e) => (e.PAGE_LOADING = "PAGE_LOADING", e.TAB_ACTIVE = "TAB_ACTIVE", e))(H || {});
639
- const Kn = /* @__PURE__ */ X({
640
- __name: "PageLoading",
641
- props: {
642
- tabId: {}
643
- },
644
- setup(e) {
645
- const t = e, n = Te(), o = P(!1), s = (u) => {
646
- u.tId === t.tabId && (o.value = u.value);
647
- }, a = H.PAGE_LOADING;
648
- return n.on(a, s), Se(() => {
649
- n.off(a, s);
650
- }), (u, y) => o.value ? (L(), V("div", {
651
- key: 0,
652
- class: "stack-tab-loading-mask",
653
- style: Ue({ zIndex: I(dt)(".cache-page-wrapper *") })
654
- }, [...y[0] || (y[0] = [
655
- U("div", { class: "stack-tab-loading--spin turn" }, null, -1)
656
- ])], 4)) : ce("", !0);
657
- }
658
- }), N = P([]), ke = P([]), te = /* @__PURE__ */ new Map(), ve = /* @__PURE__ */ new Set(), ne = /* @__PURE__ */ new Set(), Xe = P(0), me = /* @__PURE__ */ new Map(), kt = P(!1), Yn = "stacktab-active-tab", le = P({});
659
- let Ve = 0, Yt = !1, Jt = "";
660
- const Jn = (e) => {
661
- Ve = e;
662
- }, Qn = (e) => {
663
- Yt = e;
664
- }, eo = (e) => {
665
- Jt = e;
666
- }, vt = (e) => {
667
- ve.add(e);
668
- }, Ae = (e) => {
669
- for (const t of e.pages.list()) vt(t.id);
670
- ne.add(e.id);
671
- }, to = (e) => {
672
- for (const t of e.pages.list()) vt(t.id);
673
- }, ue = (e) => {
674
- ke.value.includes(e) || ke.value.push(e);
675
- }, Qt = (e) => {
676
- const t = ke.value.indexOf(e);
677
- t >= 0 && ke.value.splice(t, 1);
678
- }, Re = (e) => {
679
- e && (ve.delete(e), Qt(e), te.delete(e));
680
- }, fe = () => {
681
- if (ve.size > 0) {
682
- for (const e of [...ve])
683
- Re(e);
684
- ve.clear();
685
- }
686
- }, no = (e) => {
687
- const t = me.get(e);
688
- if (t)
689
- for (const [n, o] of t) {
690
- const s = n.startsWith("#") ? document.getElementById(n.slice(1)) : document.querySelector(n);
691
- s && (s.scrollTop = o.top, s.scrollLeft = o.left);
692
- }
693
- }, oo = (e) => {
694
- const t = me.get(e);
695
- if (t)
696
- for (const n of t.keys()) {
697
- const o = n.startsWith("#") ? document.getElementById(n.slice(1)) : document.querySelector(n);
698
- t.set(n, {
699
- top: o?.scrollTop ?? 0,
700
- left: o?.scrollLeft ?? 0
701
- });
702
- }
703
- }, so = (e) => {
704
- const t = me.get(e);
705
- t && (t.clear(), me.delete(e));
706
- }, St = (e, ...t) => {
707
- me.has(e) || me.set(e, /* @__PURE__ */ new Map());
708
- const n = me.get(e);
709
- for (const o of t)
710
- n.set(o, { top: 0, left: 0 });
711
- }, pt = () => Jt + Yn, Et = (e) => {
712
- e.id && window.sessionStorage.setItem(pt(), JSON.stringify(e));
713
- }, At = () => {
714
- window.sessionStorage.removeItem(pt());
715
- }, ro = (e) => e == null ? null : JSON.parse(
716
- e,
717
- (t, n) => t === "pages" ? new ot(n) : n
718
- ), Mt = /* @__PURE__ */ X({
719
- name: "StackTabEmptyPlaceholder",
720
- setup() {
721
- return () => null;
722
- }
723
- }), io = (e) => {
724
- const n = e.matched[e.matched.length - 1]?.path ?? e.path, o = e.path.endsWith("/") ? e.path.slice(0, -1) : e.path;
725
- return n === o ? o : e.path;
726
- }, He = () => {
727
- const e = ft(), t = Te(), {
728
- t: n
729
- } = ze(), o = () => N.value.length, s = (h) => {
730
- for (const p of h) {
731
- const d = re(p, {
732
- id: Ie(),
733
- refreshable: !0,
734
- closable: !0,
735
- iframe: !1
736
- }), O = d.id ?? Ie();
737
- d.id = O;
738
- const z = ht(d.path), q = re(d, {
739
- closable: !0,
740
- refreshable: !0,
741
- iframe: !1
742
- }), F = de(), D = {
743
- id: F,
744
- tabId: O,
745
- path: z.path,
746
- query: re(z.query, {
747
- __tab: $e(d)
748
- })
749
- }, G = new ot();
750
- G.push(D);
751
- const we = {
752
- id: O,
753
- title: q.title ?? "",
754
- closable: q.closable,
755
- refreshable: q.refreshable,
756
- iframe: q.iframe,
757
- iframeRefreshMode: q.iframeRefreshMode === "reload" ? "reload" : "postMessage",
758
- active: !1,
759
- pages: G
760
- };
761
- ue(F), N.value.push({
762
- ...we
763
- });
764
- }
765
- const r = sessionStorage.getItem(pt()), l = ro(r);
766
- l && !N.value.some((p) => p.id === l.id) && (l.iframe && l.url && l.iframeRefreshMode === void 0 && (l.iframeRefreshMode = jt(l.url) ? "reload" : "postMessage"), l.pages && typeof l.pages.list == "function" && l.pages.list().forEach((d) => {
767
- d && d.id && ue(d.id);
768
- }), N.value.push(l)), kt.value = !0;
769
- }, a = (h) => N.value.some((r) => r.id === h), u = () => Ve <= 0 || Ve > 0 && Ve > N.value.length, y = (h) => (N.value.push(h), Promise.resolve(!0)), i = (h) => N.value.find((r) => r.id === h) ?? null, f = (h) => {
770
- if (h.query.__tab) return Hn(h.query.__tab);
771
- const r = {
772
- id: Ie(),
773
- title: n("VueStackTab.undefined"),
774
- closable: !0,
775
- refreshable: !0,
776
- iframe: !1
777
- };
778
- return h.query.__tab = $e(r), r;
779
- }, w = (h, r, l, p) => {
780
- let d = null;
781
- for (const O of N.value)
782
- O.active = !1, O.id === h.id && (d = O);
783
- if (d === null) {
784
- const O = new ot();
785
- O.push(p);
786
- const z = r.query.__src;
787
- d = {
788
- id: h.id,
789
- title: h.title,
790
- closable: h.closable,
791
- refreshable: h.refreshable,
792
- iframe: h.iframe,
793
- iframeRefreshMode: h.iframeRefreshMode ?? "postMessage",
794
- url: decodeURIComponent(z),
795
- active: !0,
796
- pages: O
797
- }, y(d).then(() => {
798
- t.emit(H.TAB_ACTIVE, {
799
- id: h.id,
800
- isRoute: !1
801
- });
802
- });
803
- } else
804
- d.active = !0, (d.pages.isEmpty() || d.pages.peek().id !== p.id) && d.pages.push(p);
805
- return d;
806
- }, v = () => de(), m = (h) => {
807
- const r = f(h);
808
- if (ne.has(r.id)) return {
809
- empty: !0
810
- };
811
- const l = io(h);
812
- let p = r.id ? i(r.id) : null, d, O = null;
813
- if (p && !p.pages.isEmpty()) {
814
- const z = p.pages.peek();
815
- if (!z) throw new Error("[vue-stack-tabs] Stack is not empty but peek() returned undefined");
816
- if (z.path === l)
817
- d = z.id;
818
- else {
819
- const q = p.pages.list();
820
- let F = -1;
821
- for (let D = q.length - 2; D >= 0; D--) {
822
- const G = q[D];
823
- if (G && G.path === l) {
824
- F = D;
825
- break;
826
- }
827
- }
828
- if (F !== -1) {
829
- const D = q.length - 1 - F;
830
- for (let we = 0; we < D; we++) {
831
- const Ee = p.pages.pop();
832
- Ee && Re(Ee.id);
833
- }
834
- const G = p.pages.peek();
835
- d = G ? G.id : de(), G || (O = {
836
- id: d,
837
- tabId: r.id,
838
- path: h.path,
839
- // 保持原 query 等参数
840
- query: h.query
841
- });
842
- } else
843
- d = de(), O = {
844
- id: d,
845
- tabId: r.id,
846
- path: h.path,
847
- // 保持原 query 等参数
848
- query: h.query
849
- };
850
- }
851
- } else
852
- d = de(), O = {
853
- id: d,
854
- tabId: r.id,
855
- path: h.path,
856
- query: h.query
857
- };
858
- if (ve.has(d)) {
859
- ve.delete(d);
860
- const z = te.get(d);
861
- if (z) return {
862
- recovered: z,
863
- cacheName: d
864
- };
865
- }
866
- if (O)
867
- p = w(r, h, d, O);
868
- else {
869
- for (const z of N.value) z.active = !1;
870
- p.active = !0, !d && p && !p.pages.isEmpty() && (d = p.pages.peek().id);
871
- }
872
- return Et(p), {
873
- cacheName: d,
874
- tabInfo: r,
875
- targetTab: p
876
- };
877
- }, A = (h) => {
878
- const {
879
- cacheName: r,
880
- tabInfo: l
881
- } = h;
882
- if (te.has(r))
883
- return ue(r), te.get(r);
884
- const p = /* @__PURE__ */ X({
885
- // name 与 cacheName 保持一致,作为 keep-alive include 的匹配键
886
- name: r,
887
- // vnode 由 StackTabs.vue 的 :vnode="Component" 动态传入(解耦闭包)
888
- props: {
889
- vnode: {
890
- type: Object,
891
- required: !1,
892
- default: void 0
893
- }
894
- },
895
- emits: ["onLoaded"],
896
- setup(d, O) {
897
- const z = P(null), q = () => {
898
- try {
899
- const D = i(l.id)?.pages.peek();
900
- D && D.id === r && D._backParams ? (z.value = {
901
- ...D._backParams
902
- }, delete D._backParams) : z.value = null;
903
- } catch {
904
- z.value = null;
905
- }
906
- };
907
- return ct(() => {
908
- O.emit("onLoaded"), St(r, `#W-${r}`), q();
909
- }), ln(() => oo(r)), un(() => {
910
- O.emit("onLoaded"), no(r), fe(), ne.clear(), q();
911
- }), Se(() => so(r)), () => {
912
- const F = d.vnode, D = z.value ? {
913
- _back: z.value
914
- } : {};
915
- return $("div", {
916
- class: "cache-page-wrapper",
917
- id: `W-${r}`,
918
- style: [Yt ? "overflow:auto" : "overflow:hidden", "height: 100%"]
919
- }, [F ? fn(F, {
920
- tId: l.id,
921
- pId: r,
922
- ...D || {}
923
- }) : null, $(Kn, {
924
- tabId: l.id
925
- }, null)]);
926
- };
927
- }
928
- });
929
- return te.set(r, p), ue(r), p;
930
- }, C = P(""), E = (h, r) => {
931
- if (!r) return Mt;
932
- const l = m(h);
933
- return "empty" in l ? Mt : "recovered" in l ? (ue(l.cacheName), C.value = l.cacheName, l.recovered) : (C.value = l.cacheName, A(l));
934
- }, R = (h) => {
935
- const r = i(h.id);
936
- r && (to(r), fe(), r.pages.clear());
937
- }, _ = (h) => {
938
- let r = "";
939
- const l = i(h), p = N.value, d = p.findIndex((z) => z?.id === h);
940
- if (d < 0) return "";
941
- const O = p[d];
942
- return O.closable ? (Ae(O), O.pages.clear(), p.length > 1 && O.active && (r = (d === 0 ? p[1] : p[d - 1])?.id ?? ""), p.splice(d, 1), r && t.emit(H.TAB_ACTIVE, {
943
- id: r
944
- }), l?.active || (fe(), ne.clear()), r) : h;
945
- }, k = () => {
946
- const h = N.value;
947
- for (let p = h.length - 1; p >= 0; p--) {
948
- const d = h[p];
949
- d?.closable && (Ae(d), d.pages.clear(), h.splice(p, 1));
950
- }
951
- if (h.some((p) => p.active)) {
952
- fe(), ne.clear();
953
- return;
954
- }
955
- const l = h[h.length - 1];
956
- l && t.emit(H.TAB_ACTIVE, {
957
- id: l.id
958
- });
959
- };
960
- return {
961
- tabs: N,
962
- caches: ke,
963
- refreshKey: Xe,
964
- activeCacheKey: C,
965
- isInitialized: kt,
966
- setMaxSize: Jn,
967
- canAddTab: u,
968
- initialize: s,
969
- size: o,
970
- active: (h, r = !0) => {
971
- t.emit("FORWARD");
972
- const l = i(h);
973
- if (l && !l.active) {
974
- for (const p of N.value)
975
- p.active = p.id === h;
976
- if (Et(l), N.value = N.value.slice(), r) {
977
- const p = l.pages.peek();
978
- if (p) {
979
- const d = $e({
980
- id: l.id,
981
- title: l.title,
982
- closable: l.closable,
983
- refreshable: l.refreshable,
984
- iframe: l.iframe
985
- }), O = re({
986
- __tab: d
987
- }, p.query || {});
988
- e.push({
989
- path: p.path,
990
- query: O
991
- });
992
- }
993
- }
994
- }
995
- },
996
- getCacheName: v,
997
- destroy: () => {
998
- N.value.length = 0, ve.clear(), ne.clear(), le.value = {}, ke.value.length = 0, te.clear(), At();
999
- },
1000
- reset: () => k(),
1001
- addCache: ue,
1002
- removeCache: Qt,
1003
- getTab: i,
1004
- addTab: y,
1005
- removeTab: _,
1006
- removeAllTabs: k,
1007
- removeLeftTabs: (h) => {
1008
- const r = N.value, l = r.findIndex((d) => d?.id === h);
1009
- if (l <= 0) return;
1010
- for (let d = l - 1; d >= 0; d--) {
1011
- const O = r[d];
1012
- O?.closable && (Ae(O), O.pages.clear(), r.splice(d, 1));
1013
- }
1014
- if (r.some((d) => d.active)) {
1015
- fe(), ne.clear();
1016
- return;
1017
- }
1018
- const p = r[0];
1019
- p && t.emit(H.TAB_ACTIVE, {
1020
- id: p.id
1021
- });
1022
- },
1023
- removeRightTabs: (h) => {
1024
- const r = N.value, l = r.findIndex((d) => d?.id === h);
1025
- if (l < 0 || l >= r.length - 1) return;
1026
- for (let d = r.length - 1; d > l; d--) {
1027
- const O = r[d];
1028
- O?.closable && (Ae(O), O.pages.clear(), r.splice(d, 1));
1029
- }
1030
- if (r.some((d) => d.active)) {
1031
- fe(), ne.clear();
1032
- return;
1033
- }
1034
- const p = r[r.length - 1];
1035
- p && t.emit(H.TAB_ACTIVE, {
1036
- id: p.id
1037
- });
1038
- },
1039
- removeOtherTabs: (h) => {
1040
- const r = N.value;
1041
- let l;
1042
- for (let p = r.length - 1; p >= 0; p--) {
1043
- const d = r[p];
1044
- d && (d.id === h ? l = d : d.closable && (Ae(d), d.pages.clear(), r.splice(p, 1)));
1045
- }
1046
- l && !l.active ? t.emit(H.TAB_ACTIVE, {
1047
- id: h
1048
- }) : (fe(), ne.clear());
1049
- },
1050
- hasTab: a,
1051
- renewTab: R,
1052
- addPage: E,
1053
- addComponent: (h, r) => te.set(h, r),
1054
- getComponent: (h) => te.get(h),
1055
- removeComponent: (h) => te.delete(h),
1056
- markCacheForEviction: vt,
1057
- evictMarkedCaches: fe,
1058
- evictPageCache: Re,
1059
- refreshTab: (h) => {
1060
- const r = i(h);
1061
- if (!r?.refreshable) return;
1062
- if (r.iframe) {
1063
- r.iframeRefreshMode === "reload" ? le.value = {
1064
- ...le.value,
1065
- [h]: (le.value[h] ?? 0) + 1
1066
- } : t.emit("REFRESH_IFRAME_POSTMESSAGE", h);
1067
- return;
1068
- }
1069
- const l = r.pages.peek();
1070
- if (!l) return;
1071
- const p = l.id;
1072
- Re(p), l.id = de(), ue(l.id), r.active && Xe.value++;
1073
- },
1074
- refreshAllTabs: () => {
1075
- let h = !1;
1076
- for (const r of N.value)
1077
- if (r?.refreshable)
1078
- if (r.iframe)
1079
- r.iframeRefreshMode === "reload" ? le.value = {
1080
- ...le.value,
1081
- [r.id]: (le.value[r.id] ?? 0) + 1
1082
- } : t.emit("REFRESH_IFRAME_POSTMESSAGE", r.id);
1083
- else {
1084
- const l = r.pages.peek();
1085
- if (l) {
1086
- const p = l.id;
1087
- Re(p), l.id = de(), ue(l.id), r.active && (h = !0);
1088
- }
1089
- }
1090
- h && Xe.value++;
1091
- },
1092
- iframeRefreshKeys: le,
1093
- addPageScroller: St,
1094
- setGlobalScroll: Qn,
1095
- clearSession: At,
1096
- setSessionPrefix: eo
1097
- };
1098
- };
1099
- let Rt;
1100
- function bt() {
1101
- const e = ft(), t = Te(), {
1102
- active: n,
1103
- hasTab: o,
1104
- refreshKey: s,
1105
- reset: a,
1106
- canAddTab: u,
1107
- renewTab: y,
1108
- getTab: i,
1109
- tabs: f,
1110
- removeTab: w,
1111
- removeAllTabs: v,
1112
- refreshTab: m,
1113
- refreshAllTabs: A
1114
- } = He(), C = (T) => {
1115
- const x = {
1116
- refreshable: !0,
1117
- closable: !0,
1118
- iframe: !1
1119
- };
1120
- T.iframe && T.iframeRefreshMode === void 0 ? x.iframeRefreshMode = jt(T.path ?? "") ? "reload" : "postMessage" : T.iframe && (x.iframeRefreshMode = T.iframeRefreshMode ?? "postMessage");
1121
- const c = re(T, x);
1122
- return c.id || (c.id = Ie()), c;
1123
- }, E = Pn(500, (T, x = !1) => new Promise((c, b) => {
1124
- const g = C(T);
1125
- if (o(g.id) && !x) {
1126
- t.emit(H.TAB_ACTIVE, { id: g.id }), c(g.id);
1127
- return;
1128
- }
1129
- if (g.id && x && o(g.id) && (y(T), i(T.id)?.active && s.value++), !u()) {
1130
- b(new Error("Max Size"));
1131
- return;
1132
- }
1133
- R(T, g), c(g.id);
1134
- })), R = (T, x) => {
1135
- const c = $e(x);
1136
- let b = re({ __tab: c }, T.query), g;
1137
- if (T.iframe)
1138
- b.__src = encodeURIComponent(T.path), g = Rt;
1139
- else {
1140
- const W = ht(T.path);
1141
- g = W.path, b = re(W.query, b);
1142
- }
1143
- e.push({ path: g, query: b });
1144
- };
1145
- return {
1146
- // 打开
1147
- openTab: E,
1148
- // 关闭
1149
- closeTab: w,
1150
- closeAllTabs: v,
1151
- // 刷新
1152
- refreshTab: m,
1153
- refreshAllTabs: A,
1154
- // 激活与重置
1155
- activeTab: n,
1156
- reset: a,
1157
- // 数据与配置
1158
- tabs: f,
1159
- setIFramePath: (T) => {
1160
- Rt = T;
1161
- },
1162
- getWrapper: () => document.getElementsByClassName("cache-page-wrapper")[0],
1163
- openInNewWindow: (T) => {
1164
- const x = i(T);
1165
- x?.iframe && x.url && window.open(x.url, "_blank", "noopener,noreferrer");
1166
- }
1167
- };
1168
- }
1169
- const ao = { class: "stack-tab__contextmenu-item" }, ee = /* @__PURE__ */ X({
1170
- __name: "ContextMenuItem",
1171
- props: {
1172
- icon: {},
1173
- title: {}
1174
- },
1175
- setup(e) {
1176
- return (t, n) => (L(), V("div", ao, [
1177
- U("div", {
1178
- class: he(["stack-tab__contextmenu-icon", e.icon])
1179
- }, null, 2),
1180
- U("div", {
1181
- style: { "margin-left": "8px" },
1182
- onContextmenu: n[0] || (n[0] = Be(() => {
1183
- }, ["prevent"]))
1184
- }, lt(e.title), 33)
1185
- ]));
1186
- }
1187
- }), co = {
1188
- key: 1,
1189
- class: "divider div-transparent"
1190
- }, lo = /* @__PURE__ */ X({
1191
- __name: "index",
1192
- props: {
1193
- index: {},
1194
- left: { default: 0 },
1195
- top: { default: 0 },
1196
- contextMenu: { default: () => [] },
1197
- tabItem: {},
1198
- max: {}
1199
- },
1200
- emits: ["close"],
1201
- setup(e, { emit: t }) {
1202
- const n = e, o = t, { t: s } = ze(), a = P(), u = se({ left: n.left, top: n.top }), { closeTab: y, closeAllTabs: i, refreshTab: f, refreshAllTabs: w, openInNewWindow: v } = bt(), { removeLeftTabs: m, removeRightTabs: A, removeOtherTabs: C } = He(), E = (R) => {
1203
- R?.(), o("close");
1204
- };
1205
- return ct(() => {
1206
- const R = a.value?.clientWidth ?? 0;
1207
- u.left + R > window.innerWidth && (u.left = window.innerWidth - R - 5);
1208
- }), (R, _) => (L(), V("div", {
1209
- ref_key: "menuElementRef",
1210
- ref: a,
1211
- class: "stack-tab__contextmenu",
1212
- style: Ue({
1213
- left: `${u.left}px`,
1214
- top: `${u.top}px`,
1215
- "z-index": I(dt)(".stack-tab,.stack-tab *")
1216
- })
1217
- }, [
1218
- $(ee, {
1219
- icon: "stack-tab__icon-reload svg-mask",
1220
- title: I(s)("VueStackTab.reload"),
1221
- disabled: e.tabItem.refreshable ? null : "disabled",
1222
- onClick: _[0] || (_[0] = (k) => E(() => I(f)(e.tabItem.id)))
1223
- }, null, 8, ["title", "disabled"]),
1224
- $(ee, {
1225
- icon: "stack-tab__icon-reload-all svg-mask",
1226
- title: I(s)("VueStackTab.reloadAll"),
1227
- onClick: _[1] || (_[1] = (k) => E(I(w)))
1228
- }, null, 8, ["title"]),
1229
- $(ee, {
1230
- icon: "stack-tab__icon-close svg-mask",
1231
- title: I(s)("VueStackTab.close"),
1232
- disabled: e.tabItem.closable ? null : "disabled",
1233
- onClick: _[2] || (_[2] = (k) => E(() => I(y)(e.tabItem.id)))
1234
- }, null, 8, ["title", "disabled"]),
1235
- $(ee, {
1236
- icon: "stack-tab__icon-close-lefts svg-mask",
1237
- title: I(s)("VueStackTab.closeLeft"),
1238
- disabled: e.index <= 0 ? "disabled" : null,
1239
- onClick: _[3] || (_[3] = (k) => E(() => I(m)(e.tabItem.id)))
1240
- }, null, 8, ["title", "disabled"]),
1241
- $(ee, {
1242
- icon: "stack-tab__icon-close-rights svg-mask",
1243
- title: I(s)("VueStackTab.closeRight"),
1244
- disabled: e.index >= e.max - 1 ? "disabled" : null,
1245
- onClick: _[4] || (_[4] = (k) => E(() => I(A)(e.tabItem.id)))
1246
- }, null, 8, ["title", "disabled"]),
1247
- $(ee, {
1248
- icon: "stack-tab__icon-close-others svg-mask",
1249
- title: I(s)("VueStackTab.closeOthers"),
1250
- onClick: _[5] || (_[5] = (k) => E(() => I(C)(e.tabItem.id)))
1251
- }, null, 8, ["title"]),
1252
- $(ee, {
1253
- icon: "stack-tab__icon-close-all svg-mask",
1254
- title: I(s)("VueStackTab.closeAll"),
1255
- onClick: _[6] || (_[6] = (k) => E(I(i)))
1256
- }, null, 8, ["title"]),
1257
- e.tabItem.iframe && e.tabItem.url ? (L(), ie(ee, {
1258
- key: 0,
1259
- icon: "stack-tab__icon-open svg-mask",
1260
- title: I(s)("VueStackTab.openInNewWindow"),
1261
- onClick: _[7] || (_[7] = (k) => E(() => I(v)(e.tabItem.id)))
1262
- }, null, 8, ["title"])) : ce("", !0),
1263
- e.contextMenu !== void 0 && e.contextMenu.length > 0 ? (L(), V("div", co)) : ce("", !0),
1264
- (L(!0), V(Ge, null, ut(e.contextMenu, (k, S) => (L(), ie(ee, {
1265
- key: S,
1266
- icon: k.icon,
1267
- title: k.title,
1268
- disabled: k.disabled(e.tabItem) ? "disabled" : null,
1269
- onClick: (T) => E(() => !k.disabled(e.tabItem) && k.callback(e.tabItem.id))
1270
- }, null, 8, ["icon", "title", "disabled", "onClick"]))), 128))
1271
- ], 4));
1272
- }
1273
- }), uo = (e, t) => {
1274
- const n = e.__vccOpts || e;
1275
- for (const [o, s] of t)
1276
- n[o] = s;
1277
- return n;
1278
- }, fo = /* @__PURE__ */ uo(lo, [["__scopeId", "data-v-6f704637"]]), ho = () => {
1279
- const e = se({
1280
- item: {},
1281
- index: -1,
1282
- left: 0,
1283
- top: 0,
1284
- max: 0
1285
- }), t = P(!1), n = (s) => {
1286
- s.target.closest?.(".stack-tab__contextmenu") || (t.value = !1, document.removeEventListener("click", n));
1287
- };
1288
- return Se(() => {
1289
- document.removeEventListener("click", n);
1290
- }), {
1291
- shown: t,
1292
- contextMenuData: e,
1293
- showContextMenu: async (s, a, u, y) => {
1294
- t.value = !1, document.removeEventListener("click", n), await Je(() => {
1295
- const { clientY: i, clientX: f } = s;
1296
- t.value = !0, Object.assign(e, { item: a, index: u, top: i, left: f, max: y }), Je(() => document.addEventListener("click", n));
1297
- });
1298
- }
1299
- };
1300
- }, vo = { class: "stack-tab__item-title" }, po = ["title"], bo = ["title"], mo = /* @__PURE__ */ X({
1301
- __name: "TabHeaderItem",
1302
- props: {
1303
- item: {}
1304
- },
1305
- emits: ["close", "active"],
1306
- setup(e, { emit: t }) {
1307
- const n = t, o = Te(), { t: s } = ze(), a = P(), u = e, y = (m) => {
1308
- u.item.id === m.id && v(m.isRoute ?? !0);
1309
- }, i = H.TAB_ACTIVE;
1310
- o.on(i, y), Se(() => {
1311
- o.off(i, y);
1312
- });
1313
- const f = ae(() => u.item.title || s("undefined")), w = () => {
1314
- n("close", u.item);
1315
- }, v = (m = !0) => {
1316
- n("active", u.item, a.value, m);
1317
- };
1318
- return (m, A) => (L(), V("li", {
1319
- ref_key: "tabElementRef",
1320
- ref: a,
1321
- class: he(["stack-tab__item", {
1322
- "is-active": e.item.active,
1323
- "is-icon": e.item.closable
1324
- }]),
1325
- onClick: A[0] || (A[0] = (C) => v(!0))
1326
- }, [
1327
- U("div", vo, [
1328
- U("div", {
1329
- class: "stack-tab__item-title-content",
1330
- title: f.value
1331
- }, lt(f.value), 9, po)
1332
- ]),
1333
- e.item.closable ? (L(), V("div", {
1334
- key: 0,
1335
- class: "stack-tab__icon-close-fill stack-tab__item-button",
1336
- title: I(s)("VueStackTab.close"),
1337
- onClick: Be(w, ["stop"])
1338
- }, null, 8, bo)) : ce("", !0)
1339
- ], 2));
1340
- }
1341
- });
1342
- var ge = [], go = function() {
1343
- return ge.some(function(e) {
1344
- return e.activeTargets.length > 0;
1345
- });
1346
- }, yo = function() {
1347
- return ge.some(function(e) {
1348
- return e.skippedTargets.length > 0;
1349
- });
1350
- }, Ot = "ResizeObserver loop completed with undelivered notifications.", To = function() {
1351
- var e;
1352
- typeof ErrorEvent == "function" ? e = new ErrorEvent("error", {
1353
- message: Ot
1354
- }) : (e = document.createEvent("Event"), e.initEvent("error", !1, !1), e.message = Ot), window.dispatchEvent(e);
1355
- }, Le;
1356
- (function(e) {
1357
- e.BORDER_BOX = "border-box", e.CONTENT_BOX = "content-box", e.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
1358
- })(Le || (Le = {}));
1359
- var ye = function(e) {
1360
- return Object.freeze(e);
1361
- }, wo = /* @__PURE__ */ (function() {
1362
- function e(t, n) {
1363
- this.inlineSize = t, this.blockSize = n, ye(this);
1364
- }
1365
- return e;
1366
- })(), en = (function() {
1367
- function e(t, n, o, s) {
1368
- return this.x = t, this.y = n, this.width = o, this.height = s, this.top = this.y, this.left = this.x, this.bottom = this.top + this.height, this.right = this.left + this.width, ye(this);
1369
- }
1370
- return e.prototype.toJSON = function() {
1371
- var t = this, n = t.x, o = t.y, s = t.top, a = t.right, u = t.bottom, y = t.left, i = t.width, f = t.height;
1372
- return { x: n, y: o, top: s, right: a, bottom: u, left: y, width: i, height: f };
1373
- }, e.fromRect = function(t) {
1374
- return new e(t.x, t.y, t.width, t.height);
1375
- }, e;
1376
- })(), mt = function(e) {
1377
- return e instanceof SVGElement && "getBBox" in e;
1378
- }, tn = function(e) {
1379
- if (mt(e)) {
1380
- var t = e.getBBox(), n = t.width, o = t.height;
1381
- return !n && !o;
1382
- }
1383
- var s = e, a = s.offsetWidth, u = s.offsetHeight;
1384
- return !(a || u || e.getClientRects().length);
1385
- }, It = function(e) {
1386
- var t;
1387
- if (e instanceof Element)
1388
- return !0;
1389
- var n = (t = e?.ownerDocument) === null || t === void 0 ? void 0 : t.defaultView;
1390
- return !!(n && e instanceof n.Element);
1391
- }, xo = function(e) {
1392
- switch (e.tagName) {
1393
- case "INPUT":
1394
- if (e.type !== "image")
1395
- break;
1396
- case "VIDEO":
1397
- case "AUDIO":
1398
- case "EMBED":
1399
- case "OBJECT":
1400
- case "CANVAS":
1401
- case "IFRAME":
1402
- case "IMG":
1403
- return !0;
1404
- }
1405
- return !1;
1406
- }, Ce = typeof window < "u" ? window : {}, Ne = /* @__PURE__ */ new WeakMap(), Ct = /auto|scroll/, _o = /^tb|vertical/, ko = /msie|trident/i.test(Ce.navigator && Ce.navigator.userAgent), J = function(e) {
1407
- return parseFloat(e || "0");
1408
- }, xe = function(e, t, n) {
1409
- return e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = !1), new wo((n ? t : e) || 0, (n ? e : t) || 0);
1410
- }, Bt = ye({
1411
- devicePixelContentBoxSize: xe(),
1412
- borderBoxSize: xe(),
1413
- contentBoxSize: xe(),
1414
- contentRect: new en(0, 0, 0, 0)
1415
- }), nn = function(e, t) {
1416
- if (t === void 0 && (t = !1), Ne.has(e) && !t)
1417
- return Ne.get(e);
1418
- if (tn(e))
1419
- return Ne.set(e, Bt), Bt;
1420
- var n = getComputedStyle(e), o = mt(e) && e.ownerSVGElement && e.getBBox(), s = !ko && n.boxSizing === "border-box", a = _o.test(n.writingMode || ""), u = !o && Ct.test(n.overflowY || ""), y = !o && Ct.test(n.overflowX || ""), i = o ? 0 : J(n.paddingTop), f = o ? 0 : J(n.paddingRight), w = o ? 0 : J(n.paddingBottom), v = o ? 0 : J(n.paddingLeft), m = o ? 0 : J(n.borderTopWidth), A = o ? 0 : J(n.borderRightWidth), C = o ? 0 : J(n.borderBottomWidth), E = o ? 0 : J(n.borderLeftWidth), R = v + f, _ = i + w, k = E + A, S = m + C, T = y ? e.offsetHeight - S - e.clientHeight : 0, x = u ? e.offsetWidth - k - e.clientWidth : 0, c = s ? R + k : 0, b = s ? _ + S : 0, g = o ? o.width : J(n.width) - c - x, W = o ? o.height : J(n.height) - b - T, j = g + R + x + k, K = W + _ + T + S, h = ye({
1421
- devicePixelContentBoxSize: xe(Math.round(g * devicePixelRatio), Math.round(W * devicePixelRatio), a),
1422
- borderBoxSize: xe(j, K, a),
1423
- contentBoxSize: xe(g, W, a),
1424
- contentRect: new en(v, i, g, W)
1425
- });
1426
- return Ne.set(e, h), h;
1427
- }, on = function(e, t, n) {
1428
- var o = nn(e, n), s = o.borderBoxSize, a = o.contentBoxSize, u = o.devicePixelContentBoxSize;
1429
- switch (t) {
1430
- case Le.DEVICE_PIXEL_CONTENT_BOX:
1431
- return u;
1432
- case Le.BORDER_BOX:
1433
- return s;
1434
- default:
1435
- return a;
1436
- }
1437
- }, So = /* @__PURE__ */ (function() {
1438
- function e(t) {
1439
- var n = nn(t);
1440
- this.target = t, this.contentRect = n.contentRect, this.borderBoxSize = ye([n.borderBoxSize]), this.contentBoxSize = ye([n.contentBoxSize]), this.devicePixelContentBoxSize = ye([n.devicePixelContentBoxSize]);
1441
- }
1442
- return e;
1443
- })(), sn = function(e) {
1444
- if (tn(e))
1445
- return 1 / 0;
1446
- for (var t = 0, n = e.parentNode; n; )
1447
- t += 1, n = n.parentNode;
1448
- return t;
1449
- }, Eo = function() {
1450
- var e = 1 / 0, t = [];
1451
- ge.forEach(function(u) {
1452
- if (u.activeTargets.length !== 0) {
1453
- var y = [];
1454
- u.activeTargets.forEach(function(f) {
1455
- var w = new So(f.target), v = sn(f.target);
1456
- y.push(w), f.lastReportedSize = on(f.target, f.observedBox), v < e && (e = v);
1457
- }), t.push(function() {
1458
- u.callback.call(u.observer, y, u.observer);
1459
- }), u.activeTargets.splice(0, u.activeTargets.length);
1460
- }
1461
- });
1462
- for (var n = 0, o = t; n < o.length; n++) {
1463
- var s = o[n];
1464
- s();
1465
- }
1466
- return e;
1467
- }, Lt = function(e) {
1468
- ge.forEach(function(n) {
1469
- n.activeTargets.splice(0, n.activeTargets.length), n.skippedTargets.splice(0, n.skippedTargets.length), n.observationTargets.forEach(function(s) {
1470
- s.isActive() && (sn(s.target) > e ? n.activeTargets.push(s) : n.skippedTargets.push(s));
1471
- });
1472
- });
1473
- }, Ao = function() {
1474
- var e = 0;
1475
- for (Lt(e); go(); )
1476
- e = Eo(), Lt(e);
1477
- return yo() && To(), e > 0;
1478
- }, Ke, rn = [], Mo = function() {
1479
- return rn.splice(0).forEach(function(e) {
1480
- return e();
1481
- });
1482
- }, Ro = function(e) {
1483
- if (!Ke) {
1484
- var t = 0, n = document.createTextNode(""), o = { characterData: !0 };
1485
- new MutationObserver(function() {
1486
- return Mo();
1487
- }).observe(n, o), Ke = function() {
1488
- n.textContent = "".concat(t ? t-- : t++);
1489
- };
1490
- }
1491
- rn.push(e), Ke();
1492
- }, Oo = function(e) {
1493
- Ro(function() {
1494
- requestAnimationFrame(e);
1495
- });
1496
- }, qe = 0, Io = function() {
1497
- return !!qe;
1498
- }, Co = 250, Bo = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, zt = [
1499
- "resize",
1500
- "load",
1501
- "transitionend",
1502
- "animationend",
1503
- "animationstart",
1504
- "animationiteration",
1505
- "keyup",
1506
- "keydown",
1507
- "mouseup",
1508
- "mousedown",
1509
- "mouseover",
1510
- "mouseout",
1511
- "blur",
1512
- "focus"
1513
- ], Pt = function(e) {
1514
- return e === void 0 && (e = 0), Date.now() + e;
1515
- }, Ye = !1, Lo = (function() {
1516
- function e() {
1517
- var t = this;
1518
- this.stopped = !0, this.listener = function() {
1519
- return t.schedule();
1520
- };
1521
- }
1522
- return e.prototype.run = function(t) {
1523
- var n = this;
1524
- if (t === void 0 && (t = Co), !Ye) {
1525
- Ye = !0;
1526
- var o = Pt(t);
1527
- Oo(function() {
1528
- var s = !1;
1529
- try {
1530
- s = Ao();
1531
- } finally {
1532
- if (Ye = !1, t = o - Pt(), !Io())
1533
- return;
1534
- s ? n.run(1e3) : t > 0 ? n.run(t) : n.start();
1535
- }
1536
- });
1537
- }
1538
- }, e.prototype.schedule = function() {
1539
- this.stop(), this.run();
1540
- }, e.prototype.observe = function() {
1541
- var t = this, n = function() {
1542
- return t.observer && t.observer.observe(document.body, Bo);
1543
- };
1544
- document.body ? n() : Ce.addEventListener("DOMContentLoaded", n);
1545
- }, e.prototype.start = function() {
1546
- var t = this;
1547
- this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), zt.forEach(function(n) {
1548
- return Ce.addEventListener(n, t.listener, !0);
1549
- }));
1550
- }, e.prototype.stop = function() {
1551
- var t = this;
1552
- this.stopped || (this.observer && this.observer.disconnect(), zt.forEach(function(n) {
1553
- return Ce.removeEventListener(n, t.listener, !0);
1554
- }), this.stopped = !0);
1555
- }, e;
1556
- })(), rt = new Lo(), Nt = function(e) {
1557
- !qe && e > 0 && rt.start(), qe += e, !qe && rt.stop();
1558
- }, zo = function(e) {
1559
- return !mt(e) && !xo(e) && getComputedStyle(e).display === "inline";
1560
- }, Po = (function() {
1561
- function e(t, n) {
1562
- this.target = t, this.observedBox = n || Le.CONTENT_BOX, this.lastReportedSize = {
1563
- inlineSize: 0,
1564
- blockSize: 0
1565
- };
1566
- }
1567
- return e.prototype.isActive = function() {
1568
- var t = on(this.target, this.observedBox, !0);
1569
- return zo(this.target) && (this.lastReportedSize = t), this.lastReportedSize.inlineSize !== t.inlineSize || this.lastReportedSize.blockSize !== t.blockSize;
1570
- }, e;
1571
- })(), No = /* @__PURE__ */ (function() {
1572
- function e(t, n) {
1573
- this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = t, this.callback = n;
1574
- }
1575
- return e;
1576
- })(), De = /* @__PURE__ */ new WeakMap(), Dt = function(e, t) {
1577
- for (var n = 0; n < e.length; n += 1)
1578
- if (e[n].target === t)
1579
- return n;
1580
- return -1;
1581
- }, We = (function() {
1582
- function e() {
1583
- }
1584
- return e.connect = function(t, n) {
1585
- var o = new No(t, n);
1586
- De.set(t, o);
1587
- }, e.observe = function(t, n, o) {
1588
- var s = De.get(t), a = s.observationTargets.length === 0;
1589
- Dt(s.observationTargets, n) < 0 && (a && ge.push(s), s.observationTargets.push(new Po(n, o && o.box)), Nt(1), rt.schedule());
1590
- }, e.unobserve = function(t, n) {
1591
- var o = De.get(t), s = Dt(o.observationTargets, n), a = o.observationTargets.length === 1;
1592
- s >= 0 && (a && ge.splice(ge.indexOf(o), 1), o.observationTargets.splice(s, 1), Nt(-1));
1593
- }, e.disconnect = function(t) {
1594
- var n = this, o = De.get(t);
1595
- o.observationTargets.slice().forEach(function(s) {
1596
- return n.unobserve(t, s.target);
1597
- }), o.activeTargets.splice(0, o.activeTargets.length);
1598
- }, e;
1599
- })(), Wt = (function() {
1600
- function e(t) {
1601
- if (arguments.length === 0)
1602
- throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
1603
- if (typeof t != "function")
1604
- throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
1605
- We.connect(this, t);
1606
- }
1607
- return e.prototype.observe = function(t, n) {
1608
- if (arguments.length === 0)
1609
- throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
1610
- if (!It(t))
1611
- throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
1612
- We.observe(this, t, n);
1613
- }, e.prototype.unobserve = function(t) {
1614
- if (arguments.length === 0)
1615
- throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
1616
- if (!It(t))
1617
- throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
1618
- We.unobserve(this, t);
1619
- }, e.prototype.disconnect = function() {
1620
- We.disconnect(this);
1621
- }, e.toString = function() {
1622
- return "function ResizeObserver () { [polyfill code] }";
1623
- }, e;
1624
- })();
1625
- const Do = ["disabled", "title"], Wo = {
1626
- key: 1,
1627
- class: "stack-tab__button"
1628
- }, it = /* @__PURE__ */ X({
1629
- __name: "TabHeaderButton",
1630
- props: {
1631
- disabled: { type: Boolean, default: !1 },
1632
- shadow: { default: null },
1633
- iconClass: { default: "" },
1634
- title: { default: "" }
1635
- },
1636
- setup(e) {
1637
- return (t, n) => (L(), V("div", {
1638
- class: he(["stack-tab__header-button", {
1639
- "stack-tab__shadow-right": e.shadow === "right",
1640
- "stack-tab__shadow-left": e.shadow === "left"
1641
- }]),
1642
- disabled: e.disabled ? "disabled" : null,
1643
- title: e.title
1644
- }, [
1645
- "icon" in t.$slots ? ce("", !0) : (L(), V("div", {
1646
- key: 0,
1647
- class: he(["stack-tab__mask-button", e.iconClass])
1648
- }, null, 2)),
1649
- "icon" in t.$slots ? (L(), V("div", Wo, [
1650
- _e(t.$slots, "icon")
1651
- ])) : ce("", !0)
1652
- ], 10, Do));
1653
- }
1654
- }), $o = /* @__PURE__ */ X({
1655
- __name: "TabHeaderScroll",
1656
- props: {
1657
- space: { default: 300 },
1658
- isScrollWheel: { type: Boolean, default: !0 },
1659
- isScrollButton: { type: Boolean, default: !0 }
1660
- },
1661
- setup(e, { expose: t }) {
1662
- const n = P(null), o = P(null), s = P(null), a = P(!1), u = P(!1), y = P(!1), i = P(!0), f = P(), w = e, v = se({
1663
- clientWidth: 0,
1664
- scrollWidth: 0,
1665
- scrollLeft: 0
1666
- }), m = se({
1667
- thumbLeft: 0,
1668
- startScrollLeft: 0,
1669
- startThumbLeft: 0,
1670
- startPageX: 0
1671
- });
1672
- Qe(v, (r) => {
1673
- A(r);
1674
- });
1675
- const A = (r) => {
1676
- u.value = r.scrollLeft <= 10, y.value = r.clientWidth + r.scrollLeft - r.scrollWidth >= -10, i.value = r.scrollWidth !== r.clientWidth;
1677
- }, C = ae(() => v.scrollWidth > v.clientWidth), E = ae(() => {
1678
- if (!C.value) return 0;
1679
- const { clientWidth: r, scrollWidth: l } = v;
1680
- return r / l * r;
1681
- }), R = ae(() => {
1682
- if (!C.value) return 0;
1683
- const { clientWidth: r, scrollWidth: l, scrollLeft: p } = v;
1684
- return (r - E.value) * (p / (l - r));
1685
- }), _ = () => {
1686
- if (!n.value) return;
1687
- const { clientWidth: r, scrollWidth: l, scrollLeft: p } = n.value;
1688
- Object.assign(v, { clientWidth: r, scrollWidth: l, scrollLeft: p });
1689
- }, k = () => {
1690
- const r = n.value?.querySelector(".stack-tab__item.is-active");
1691
- r && !h(r) && K(r);
1692
- }, S = new Wt(() => {
1693
- _(), k();
1694
- }), T = new Wt(() => {
1695
- C.value || k(), _();
1696
- }), x = (r, l = !0) => {
1697
- Ht({ wrap: n.value, left: r, top: 0, smooth: l });
1698
- }, c = (r) => {
1699
- x(n.value.scrollLeft + r);
1700
- }, b = (r) => {
1701
- const l = r.deltaY < 0;
1702
- x(n.value.scrollLeft + (l ? -w.space : w.space));
1703
- }, g = (r) => {
1704
- Object.assign(m, {
1705
- startPageX: r.pageX,
1706
- startScrollLeft: n.value?.scrollLeft,
1707
- startThumbLeft: R.value,
1708
- thumbLeft: R.value
1709
- }), a.value = !0, document.addEventListener("mousemove", W), document.addEventListener("mouseup", j);
1710
- }, W = (r) => {
1711
- const { clientWidth: l, scrollWidth: p } = v;
1712
- let d = m.startThumbLeft + r.pageX - m.startPageX;
1713
- const O = l - E.value;
1714
- d < 0 ? d = 0 : d > O && (d = O), m.thumbLeft = d, x(d * (p - l) / (l - E.value), !1), r.preventDefault();
1715
- }, j = () => {
1716
- a.value = !1, document.removeEventListener("mousemove", W), document.removeEventListener("mouseup", j);
1717
- };
1718
- ct(() => {
1719
- S.observe(f.value);
1720
- const r = n.value?.querySelector(".stack-tab__nav");
1721
- T.observe(r);
1722
- }), Se(() => {
1723
- S.disconnect(), T.disconnect();
1724
- });
1725
- const K = (r) => {
1726
- zn({ el: r, wrap: n.value, block: "end", inline: "center" });
1727
- }, h = (r) => {
1728
- if (!C.value)
1729
- return !0;
1730
- const l = r.offsetLeft, p = n.value.scrollLeft;
1731
- return !(l < p || l + r.clientWidth > p + n.value.clientWidth);
1732
- };
1733
- return t({ scrollIntoView: K, isInView: h }), (r, l) => (L(), V(Ge, null, [
1734
- i.value ? (L(), ie(it, {
1735
- key: 0,
1736
- "icon-class": "stack-tab__icon-left-arrow",
1737
- disabled: u.value,
1738
- onClick: l[0] || (l[0] = (p) => !u.value && c(-1 * e.space))
1739
- }, null, 8, ["disabled"])) : ce("", !0),
1740
- U("div", {
1741
- ref_key: "headerScroll",
1742
- ref: f,
1743
- class: "stack-tab__scroll",
1744
- onWheelPassive: b
1745
- }, [
1746
- U("div", {
1747
- ref_key: "container",
1748
- ref: n,
1749
- class: he(["stack-tab__scroll-container", {
1750
- "stack-tab__shadow-inset-left": !u.value && y.value,
1751
- "stack-tab__shadow-inset-right": !y.value && u.value,
1752
- "stack-tab__shadow-inset-all": !u.value && !y.value
1753
- }]),
1754
- onScrollPassive: _
1755
- }, [
1756
- _e(r.$slots, "default")
1757
- ], 34),
1758
- et(U("div", {
1759
- ref_key: "bar",
1760
- ref: o,
1761
- class: he(["stack-tab__scrollbar", { "is-dragging": a.value }])
1762
- }, [
1763
- U("div", {
1764
- ref_key: "thumb",
1765
- ref: s,
1766
- class: he(["stack-tab__scrollbar-thumb", { "is-dragging": a.value }]),
1767
- style: Ue({
1768
- width: `${E.value}px`,
1769
- transform: `translateX(${R.value}px)`
1770
- }),
1771
- onMousedown: Be(g, ["prevent"])
1772
- }, null, 38)
1773
- ], 2), [
1774
- [tt, C.value]
1775
- ])
1776
- ], 544),
1777
- i.value ? (L(), ie(it, {
1778
- key: 1,
1779
- "icon-class": "stack-tab__icon-right-arrow",
1780
- disabled: y.value,
1781
- onClick: l[1] || (l[1] = (p) => !y.value && c(e.space))
1782
- }, null, 8, ["disabled"])) : ce("", !0)
1783
- ], 64));
1784
- }
1785
- }), Vo = { class: "stack-tab__header" }, qo = /* @__PURE__ */ X({
1786
- __name: "index",
1787
- props: {
1788
- space: {},
1789
- tabScrollMode: { default: pe.BOTH },
1790
- tabTransition: { default: () => ({
1791
- name: "stack-tab-zoom"
1792
- }) },
1793
- contextmenu: { type: [Boolean, Object], default: !0 },
1794
- max: { default: 20 }
1795
- },
1796
- emits: ["active"],
1797
- setup(e, { emit: t }) {
1798
- const { t: n } = ze(), o = at("maximum"), s = t, a = P(), { shown: u, contextMenuData: y, showContextMenu: i } = ho(), f = () => {
1799
- u.value = !1;
1800
- }, w = e, { closeTab: v, activeTab: m, tabs: A } = bt(), C = ae(
1801
- () => typeof w.tabTransition == "string" ? { name: w.tabTransition } : w.tabTransition
1802
- ), E = ae(() => w.tabScrollMode === pe.BOTH || w.tabScrollMode === pe.BUTTON), R = w.tabScrollMode === pe.BOTH || w.tabScrollMode === pe.WHEEL, _ = (S) => {
1803
- S.closable && v(S.id), u.value = !1;
1804
- }, k = (S, T, x) => {
1805
- a.value && T && Je(() => {
1806
- a.value.isInView(T) || a.value.scrollIntoView(T);
1807
- }), m(S.id, x), s("active", S.id);
1808
- };
1809
- return (S, T) => (L(), V("div", Vo, [
1810
- _e(S.$slots, "leftButton"),
1811
- $($o, {
1812
- ref_key: "scrollContainerRef",
1813
- ref: a,
1814
- space: e.space,
1815
- "is-scroll-wheel": I(R),
1816
- "is-scroll-button": E.value
1817
- }, {
1818
- default: oe(() => [
1819
- $(qt, dn({
1820
- key: "tab-list-transition",
1821
- tag: "ul",
1822
- class: "stack-tab__nav"
1823
- }, C.value, { appear: "" }), {
1824
- default: oe(() => [
1825
- (L(!0), V(Ge, null, ut(I(A), (x, c) => (L(), ie(mo, {
1826
- key: x.id,
1827
- contextmenu: e.contextmenu,
1828
- item: x,
1829
- onContextmenu: Be(
1830
- (b) => I(i)(b, x, c, I(A).length),
1831
- ["prevent"]
1832
- ),
1833
- onMouseup: Be((b) => _(x), ["middle", "prevent"]),
1834
- onClose: _,
1835
- onActive: k
1836
- }, null, 8, ["contextmenu", "item", "onContextmenu", "onMouseup"]))), 128))
1837
- ]),
1838
- _: 1
1839
- }, 16)
1840
- ]),
1841
- _: 1
1842
- }, 8, ["space", "is-scroll-wheel", "is-scroll-button"]),
1843
- _e(S.$slots, "rightButton"),
1844
- $(it, {
1845
- "icon-class": I(o) ? "stack-tab__icon-restore" : "stack-tab__icon-fullscreen",
1846
- title: I(n)("VueStackTab.maximum"),
1847
- onClick: T[0] || (T[0] = (x) => o.value = !I(o))
1848
- }, null, 8, ["icon-class", "title"]),
1849
- $(nt, {
1850
- name: "stack-tab-zoom",
1851
- appear: ""
1852
- }, {
1853
- default: oe(() => [
1854
- I(u) ? (L(), ie(fo, {
1855
- key: "context-menu-transition",
1856
- left: I(y).left,
1857
- top: I(y).top,
1858
- "tab-item": I(y).item,
1859
- max: I(y).max,
1860
- index: I(y).index,
1861
- onClose: f
1862
- }, null, 8, ["left", "top", "tab-item", "max", "index"])) : ce("", !0)
1863
- ]),
1864
- _: 1
1865
- })
1866
- ]));
1867
- }
1868
- }), Fo = { class: "stack-tab__container" }, Uo = { class: "stack-tab__iframe-wrapper" }, Go = { class: "stack-tab__iframe-loading" }, Ho = { class: "stack-tab__iframe-loading-text" }, jo = ["src", "onLoad"], Zo = 5e3, Xo = /* @__PURE__ */ X({
1869
- __name: "StackTabs",
1870
- props: {
1871
- defaultTabs: { default: () => [] },
1872
- max: { default: 20 },
1873
- contextmenu: { type: [Boolean, Object], default: !0 },
1874
- pageTransition: { default: "stack-tab-swap" },
1875
- pageTransitionBack: { default: "stack-tab-swap-back" },
1876
- tabTransition: { default: "stack-tab-zoom" },
1877
- tabScrollMode: { default: pe.BOTH },
1878
- width: { default: "100%" },
1879
- height: { default: "100%" },
1880
- i18n: { default: "zh-CN" },
1881
- space: { default: 300 },
1882
- globalScroll: { type: Boolean, default: !1 },
1883
- iframePath: {},
1884
- sessionPrefix: { default: "" },
1885
- iframeAllowedOrigins: { default: () => [] }
1886
- },
1887
- emits: ["onActive", "onPageLoaded"],
1888
- setup(e, { emit: t }) {
1889
- const {
1890
- tabs: n,
1891
- caches: o,
1892
- iframeRefreshKeys: s,
1893
- activeCacheKey: a,
1894
- destroy: u,
1895
- addPage: y,
1896
- initialize: i,
1897
- setMaxSize: f,
1898
- setGlobalScroll: w,
1899
- setSessionPrefix: v
1900
- } = He(), m = t, A = e, { changeLocale: C, t: E } = ze(), R = P(!1);
1901
- hn("maximum", R);
1902
- const { setIFramePath: _, openTab: k } = bt();
1903
- _(A.iframePath), w(A.globalScroll), C(A.i18n);
1904
- const S = (M, B) => y(M, B), T = (M) => {
1905
- m("onActive", M);
1906
- };
1907
- f(A.max);
1908
- const x = () => {
1909
- m("onPageLoaded");
1910
- }, c = P(A.pageTransition), b = Te(), g = () => {
1911
- c.value = A.pageTransition;
1912
- }, W = () => {
1913
- c.value = A.pageTransitionBack;
1914
- };
1915
- b.on("FORWARD", g), b.on("BACKWARD", W);
1916
- const j = ae(() => n.value.filter((M) => M.iframe)), K = se({}), h = ae(
1917
- () => j.value.filter((M) => M.active && (M.url ?? "") && !wt(M.url ?? ""))
1918
- );
1919
- Qe(
1920
- h,
1921
- (M) => {
1922
- for (const B of M) K[B.id] = !0;
1923
- },
1924
- { immediate: !0, deep: !0 }
1925
- );
1926
- const r = (M) => {
1927
- const B = M.url ?? "";
1928
- return wt(B) ? "about:blank" : K[M.id] ? B : "about:blank";
1929
- }, l = (M) => M.iframeRefreshMode === "reload" ? `${M.id}-${s.value[M.id] ?? 0}` : M.id, p = se({}), d = se({}), O = /* @__PURE__ */ new Map(), z = (M) => {
1930
- const B = O.get(M);
1931
- B && (clearTimeout(B), O.delete(M)), p[M] = !0, d[M] = !1;
1932
- }, q = (M) => {
1933
- if (p[M]) return;
1934
- d[M] = !0;
1935
- const B = O.get(M);
1936
- B && clearTimeout(B), O.set(
1937
- M,
1938
- setTimeout(() => {
1939
- O.delete(M), d[M] = !1;
1940
- }, Zo)
1941
- );
1942
- };
1943
- Qe(
1944
- h,
1945
- (M) => {
1946
- for (const B of M) q(B.id);
1947
- },
1948
- { immediate: !0, deep: !0 }
1949
- );
1950
- const F = se({}), D = (M, B) => {
1951
- B ? F[M] = B : delete F[M];
1952
- }, G = (M) => {
1953
- const Y = F[M];
1954
- if (Y?.contentWindow)
1955
- try {
1956
- Y.contentWindow.postMessage({ type: "vue-stack-tabs:refresh" }, "*");
1957
- } catch {
1958
- }
1959
- }, we = ae(() => {
1960
- const M = typeof window < "u" ? window.location.origin : "", B = A.iframeAllowedOrigins ?? [];
1961
- return [M, ...B].filter(Boolean);
1962
- }), Ee = (M) => {
1963
- if (!we.value.includes(M.origin)) return;
1964
- const B = M.data;
1965
- if (!B || typeof B != "object" || B.type !== "vue-stack-tabs:openTab") return;
1966
- const Y = B.payload;
1967
- Y && typeof Y == "object" && Y.title && Y.path && k(Y);
1968
- };
1969
- return b.on(
1970
- "REFRESH_IFRAME_POSTMESSAGE",
1971
- G
1972
- ), vn(() => {
1973
- v(A.sessionPrefix), i(A.defaultTabs), window.addEventListener("message", Ee);
1974
- }), pn(() => {
1975
- window.removeEventListener("message", Ee), b.off(
1976
- "REFRESH_IFRAME_POSTMESSAGE",
1977
- G
1978
- ), b.off("FORWARD", g), b.off("BACKWARD", W), u();
1979
- }), (M, B) => {
1980
- const Y = bn("router-view");
1981
- return L(), V("div", {
1982
- class: he(["stack-tab", { "stack-tab__maximum": R.value }]),
1983
- style: Ue({
1984
- width: e.width,
1985
- height: e.height,
1986
- "z-index": R.value ? I(dt)("body *:not(.stack-tab,.stack-tab *)") : void 0
1987
- })
1988
- }, [
1989
- $(qo, {
1990
- space: e.space,
1991
- "tab-transition": e.tabTransition,
1992
- max: e.max,
1993
- onActive: T
1994
- }, {
1995
- leftButton: oe(() => [
1996
- _e(M.$slots, "leftButton")
1997
- ]),
1998
- rightButton: oe(() => [
1999
- _e(M.$slots, "rightButton")
2000
- ]),
2001
- _: 3
2002
- }, 8, ["space", "tab-transition", "max"]),
2003
- U("div", Fo, [
2004
- $(Y, null, {
2005
- default: oe(({ Component: Z, route: Pe }) => [
2006
- $(nt, {
2007
- name: c.value,
2008
- appear: "",
2009
- mode: "out-in"
2010
- }, {
2011
- default: oe(() => [
2012
- (L(), ie(mn, { include: I(o) }, [
2013
- (L(), ie(gn(S(Pe, Z)), {
2014
- key: I(a),
2015
- vnode: Z,
2016
- onOnLoaded: x
2017
- }, null, 40, ["vnode"]))
2018
- ], 1032, ["include"]))
2019
- ]),
2020
- _: 2
2021
- }, 1032, ["name"])
2022
- ]),
2023
- _: 1
2024
- }),
2025
- $(qt, {
2026
- name: e.pageTransition,
2027
- tag: "div",
2028
- class: "stack-tab__iframes",
2029
- appear: ""
2030
- }, {
2031
- default: oe(() => [
2032
- (L(!0), V(Ge, null, ut(j.value, (Z) => (L(), ie(nt, {
2033
- key: l(Z),
2034
- name: e.pageTransition,
2035
- appear: ""
2036
- }, {
2037
- default: oe(() => [
2038
- et(U("div", Uo, [
2039
- et(U("div", Go, [
2040
- U("span", Ho, lt(I(E)("VueStackTab.loading")), 1)
2041
- ], 512), [
2042
- [tt, d[Z.id] !== !1]
2043
- ]),
2044
- (L(), V("iframe", {
2045
- key: I(s)[Z.id] || 0,
2046
- ref_for: !0,
2047
- ref: (Pe) => D(Z.id, Pe),
2048
- class: "stack-tab__iframe",
2049
- src: r(Z),
2050
- frameborder: "0",
2051
- onLoad: (Pe) => z(Z.id)
2052
- }, null, 40, jo))
2053
- ], 512), [
2054
- [tt, Z.active]
2055
- ])
2056
- ]),
2057
- _: 2
2058
- }, 1032, ["name"]))), 128))
2059
- ]),
2060
- _: 1
2061
- }, 8, ["name"])
2062
- ])
2063
- ], 6);
2064
- };
2065
- }
2066
- }), gt = typeof Buffer == "function";
2067
- typeof TextDecoder == "function" && new TextDecoder();
2068
- const $t = typeof TextEncoder == "function" ? new TextEncoder() : void 0, Ko = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", Oe = Array.prototype.slice.call(Ko);
2069
- ((e) => {
2070
- let t = {};
2071
- return e.forEach((n, o) => t[n] = o), t;
2072
- })(Oe);
2073
- const Q = String.fromCharCode.bind(String);
2074
- typeof Uint8Array.from == "function" && Uint8Array.from.bind(Uint8Array);
2075
- const Yo = (e) => e.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), Jo = (e) => {
2076
- let t, n, o, s, a = "";
2077
- const u = e.length % 3;
2078
- for (let y = 0; y < e.length; ) {
2079
- if ((n = e.charCodeAt(y++)) > 255 || (o = e.charCodeAt(y++)) > 255 || (s = e.charCodeAt(y++)) > 255)
2080
- throw new TypeError("invalid character found");
2081
- t = n << 16 | o << 8 | s, a += Oe[t >> 18 & 63] + Oe[t >> 12 & 63] + Oe[t >> 6 & 63] + Oe[t & 63];
2082
- }
2083
- return u ? a.slice(0, u - 3) + "===".substring(u) : a;
2084
- }, an = typeof btoa == "function" ? (e) => btoa(e) : gt ? (e) => Buffer.from(e, "binary").toString("base64") : Jo, Qo = gt ? (e) => Buffer.from(e).toString("base64") : (e) => {
2085
- let n = [];
2086
- for (let o = 0, s = e.length; o < s; o += 4096)
2087
- n.push(Q.apply(null, e.subarray(o, o + 4096)));
2088
- return an(n.join(""));
2089
- }, es = (e) => {
2090
- if (e.length < 2) {
2091
- var t = e.charCodeAt(0);
2092
- return t < 128 ? e : t < 2048 ? Q(192 | t >>> 6) + Q(128 | t & 63) : Q(224 | t >>> 12 & 15) + Q(128 | t >>> 6 & 63) + Q(128 | t & 63);
2093
- } else {
2094
- var t = 65536 + (e.charCodeAt(0) - 55296) * 1024 + (e.charCodeAt(1) - 56320);
2095
- return Q(240 | t >>> 18 & 7) + Q(128 | t >>> 12 & 63) + Q(128 | t >>> 6 & 63) + Q(128 | t & 63);
2096
- }
2097
- }, ts = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, ns = (e) => e.replace(ts, es), Vt = gt ? (e) => Buffer.from(e, "utf8").toString("base64") : $t ? (e) => Qo($t.encode(e)) : (e) => an(ns(e)), os = (e, t = !1) => t ? Yo(Vt(e)) : Vt(e), ss = (e) => {
2098
- const o = `<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1167.06 237.75"><path d="M79.24,19.73h108.91v29.7h-108.91v-29.7Z" style="fill:#79a7ff; stroke-width:0px;"/><path d="M179.24,199.67H20.26c-11.21-.07-20.26-9.17-20.26-20.38V20.39C0,9.18,9.05.07,20.26,0h59.49c3.51.07,6.34,2.9,6.41,6.42v44.36c0,3.54-2.87,6.41-6.41,6.41s-6.41-2.86-6.42-6.4V12.36H20.25c-4.13.07-7.44,3.44-7.44,7.56v159.41c0,4.13,3.31,7.49,7.44,7.56h158.98c4.13-.07,7.44-3.44,7.44-7.56V51.84c0-3.54,2.87-6.41,6.41-6.42,3.55,0,6.42,2.87,6.42,6.42v127.45c0,11.21-9.05,20.32-20.26,20.39h0Z" style="fill:#377dff; stroke-width:0px;"/><path d="M192.8,60.77c-3.66-.07-6.61-3.02-6.68-6.68v-18.23c.09-4.29-3.32-7.83-7.6-7.92h-96.43c-3.69,0-6.69-2.99-6.69-6.69s2.99-6.69,6.69-6.69h96.27c11.69.08,21.13,9.58,21.13,21.27v18.25c0,3.69-2.99,6.68-6.68,6.68h0Z" style="fill:#377dff; stroke-width:0px;"/><path d="M193.08,58.67H10.15c-3.61-.08-6.48-3.07-6.41-6.68-.08-3.62,2.79-6.61,6.4-6.69,0,0,0,0,0,0h182.93c3.62.08,6.48,3.08,6.41,6.69.07,3.61-2.79,6.6-6.41,6.68h0Z" style="fill:#377dff; stroke-width:0px;"/><path d="M137.2,58.67c-3.42.24-6.4-2.32-6.68-5.74v-28.15c.55-3.69,4-6.24,7.69-5.69,2.94.44,5.24,2.75,5.69,5.69v28.15c-.28,3.42-3.26,5.98-6.68,5.74h-.02Z" style="fill:#377dff; stroke-width:0px;"/><path d="M99.78,100.48l-12.83-22.22h-18.39l31.22,54.05,31.22-54.05h-18.39l-12.83,22.22Z" style="fill:#00d797; stroke-width:0px;"/><path d="M135.28,78.26l-35.49,61.43-35.44-61.43h-20.11l55.55,96.2,55.55-96.2s-20.06,0-20.06,0ZM313.33,59.95c0,.52-.67,1.84-2,3.95s-3.3,5.2-5.9,9.28-5.75,9.28-9.46,15.61c-3.7,6.33-7.52,13.34-11.45,21.04-4.51,8.85-7.76,15.8-9.76,20.86s-2.99,9.41-2.99,13.05c0,2.89,1.53,5.44,4.6,7.63,3.7-2.89,7.34-6.33,10.93-10.32,3.58-3.99,7.13-8.44,10.63-13.36s7.55-11.13,12.14-18.65c4.6-7.52,8.69-14.43,12.27-20.73-.17-.52-.36-1.04-.56-1.56s-.3-.95-.3-1.3c0-2.72.55-5.26,1.65-7.63,1.1-2.37,2.47-4.68,4.12-6.94s4.12-5.44,7.42-9.54c.87-1.1,1.94-1.65,3.21-1.65,2.08,0,3.12,1.33,3.12,3.99s-1.08,6.84-3.25,12.53c-2.17,5.7-5.37,12.39-9.59,20.08s-9.47,16.29-15.74,25.81c-6.28,9.51-13.37,19.45-21.3,29.8-8.04,10.47-13.79,15.7-17.26,15.7-1.97,0-4.19-1.08-6.68-3.25s-4.63-5.13-6.42-8.89-2.69-7.78-2.69-12.06c0-2.54.53-5.81,1.6-9.8s2.75-8.78,5.03-14.36,4.87-11.09,7.76-16.53c3.01-5.72,5.65-10.47,7.94-14.23,2.28-3.76,4.87-7.94,7.76-12.53,2.89-4.6,4.34-7.1,4.34-7.5,0-.87-.58-1.3-1.73-1.3-3.35,0-7.82,1.71-13.4,5.12s-12.85,8.59-21.82,15.53c-3.41,2.66-5.57,4.38-6.46,5.16s-1.34,1.43-1.34,1.95c0,.69.55,1.04,1.65,1.04.46,0,2.02-.17,4.68-.52s4.77-.52,6.33-.52c2.6,0,3.9.46,3.9,1.39,0,.81-.54,1.45-1.61,1.91-1.07.46-2.54.93-4.42,1.39s-4.44,1.1-7.68,1.91c-3.47.93-7.16,2.25-11.06,3.99-3.9,1.73-6.14,2.6-6.72,2.6-1.1,0-1.78-.4-2.04-1.21s-.39-2.14-.39-3.99c0-8.21,1.36-14.56,4.08-19.04s7.58-9.15,14.57-14.01c7.98-5.55,15.61-10.16,22.9-13.84,7.29-3.67,13.58-6.36,18.87-8.07s9.18-2.56,11.67-2.56,4.84,1.56,7.24,4.68,3.6,6.42,3.6,9.89h0ZM366.34,124.75c-8.39,11.1-14.76,19-19.13,23.68s-7.94,7.03-10.71,7.03c-2.2,0-4.22-.91-6.07-2.73-1.85-1.82-3.28-4.28-4.29-7.37s-1.52-6.4-1.52-9.93c0-2.31.22-4.39.65-6.25.43-1.85,1.26-3.89,2.47-6.12s2.82-4.64,4.81-7.24c2-2.6,4.44-5.55,7.33-8.85,1.73-2.02,3.19-3.73,4.38-5.12,1.18-1.39,2.34-2.33,3.47-2.82s2.96-.74,5.51-.74c1.85,0,3.61.25,5.29.74,1.68.49,2.52,1,2.52,1.52,0,1.04-.85,2.92-2.56,5.64s-4.45,6.03-8.24,9.93c-3.79,3.9-8.17,7.74-13.14,11.49-1.1,3.41-1.65,6.01-1.65,7.81,0,2.49.95,3.73,2.86,3.73.69,0,1.85-.59,3.47-1.78,1.62-1.18,4.35-3.47,8.2-6.85,3.84-3.38,7.3-6.38,10.37-8.98,2.25-1.97,4.87-4.9,7.85-8.8s5.39-6.84,7.24-8.8c4.28-4.51,7.2-7.44,8.76-8.8s3.06-2.04,4.51-2.04,2.33.43,2.82,1.3c.49.87.74,2.63.74,5.29,0,1.21-.12,2.2-.35,2.95s-.71,1.72-1.43,2.91-2.18,3.37-4.38,6.55-4.8,6.94-7.81,11.28c-1.66,2.38-3.09,4.93-4.25,7.59-1.21,2.75-1.82,4.81-1.82,6.2,0,3.01,1.18,4.51,3.56,4.51,1.96,0,4.25-.81,6.85-2.43s6.59-4.54,11.97-8.76v5.81c-6.77,6.25-11.77,10.79-15.01,13.62s-6.04,4.97-8.41,6.42-4.63,2.17-6.77,2.17c-4.86,0-7.29-2.89-7.29-8.67,0-2.2.72-5.16,2.17-8.89,1.44-3.73,3.79-9.12,7.03-16.18v-.02Z" style="fill:#306fff; stroke-width:0px;"/><path d="M407.71,133.77v2.17c0,3.41.84,6.07,2.52,7.98,1.68,1.91,3.87,2.86,6.59,2.86s5.77-.66,8.8-2c3.04-1.33,6.06-3.09,9.07-5.29s6.68-5.15,11.02-8.85v5.29c-6.54,7.87-12.67,13.89-18.39,18.09-5.72,4.19-11.54,6.29-17.44,6.29-5.15,0-9.22-2-12.23-5.99s-4.51-9.46-4.51-16.39c0-6.07,1.42-11.58,4.25-16.52s7.46-10.16,13.88-15.66c4.39-3.76,8.76-6.59,13.1-8.5s8.21-2.86,11.62-2.86c2.72,0,4.87.62,6.46,1.86s2.39,3.11,2.39,5.59c0,3.64-1.36,7.27-4.08,10.89s-6.87,7.2-12.45,10.76c-5.58,3.56-12.45,6.98-20.6,10.28h0ZM408.58,128.13c5.2-2.02,9.66-4.54,13.36-7.55,3.7-3.01,6.43-5.88,8.2-8.63,1.76-2.75,2.65-4.76,2.65-6.03s-.61-2-1.82-2c-1.04,0-2.73.67-5.07,2s-4.71,3.07-7.11,5.21-4.55,4.66-6.46,7.55c-1.9,2.86-3.17,6.08-3.73,9.46h-.02ZM585.37,132.9c-1.45-2.66-3.61-5.06-6.51-7.2-2.89-2.14-6.15-3.86-9.76-5.16s-7.39-2.27-11.32-2.91c-11.68-1.74-22.58-5.52-32.7-11.36-.87-.46-1.79-1.44-2.78-2.95-.98-1.5-1.47-2.95-1.47-4.34,0-5.09.85-10.19,2.56-15.31,1.71-5.12,3.89-9.12,6.55-12.01,4.28-4.8,11.98-8.99,23.12-12.58,11.13-3.58,23.67-5.38,37.6-5.38,8.33,0,14.76.64,19.3,1.91s6.81,3.24,6.81,5.9c0,4.34-.59,7.69-1.78,10.06s-2.46,3.95-3.82,4.73c-1.36.78-3.75,1.84-7.16,3.17-3.64,1.27-6.81,2.6-9.5,3.99s-4.99,2.72-6.9,3.99c-1.91,1.27-3.09,1.91-3.56,1.91-.58,0-.87-.23-.87-.69,0-.98,1.03-2.47,3.08-4.47s4.58-3.74,7.59-5.25c3.18-1.68,4.77-2.75,4.77-3.21,0-.75-1.76-1.13-5.29-1.13-10.7,0-20.59.95-29.67,2.86s-16.24,4.42-21.47,7.55c-5.23,3.12-7.85,6.3-7.85,9.54,0,2.02,1.08,3.46,3.25,4.29,2.17.84,6.95,2.24,14.36,4.21,7.4,1.97,14.02,4.22,19.86,6.77,8.38,3.59,14.6,7.32,18.65,11.19,4.05,3.88,6.07,8.21,6.07,13.01,0,3.3-.8,6.61-2.39,9.93-1.59,3.33-3.92,6.38-6.98,9.15-3.07,2.78-6.59,5.06-10.58,6.85-3.41,1.45-7.71,2.8-12.88,4.08-5.18,1.27-10.79,2.27-16.83,2.99-6.04.72-11.81,1.08-17.31,1.08-10.12,0-18.26-.95-24.42-2.86s-9.24-4.8-9.24-8.67c0-1.74,1.04-4.44,3.12-8.11s4.54-6.14,7.37-7.42c2.49-.98,4.89-1.55,7.2-1.69,2.31-.14,3.47.13,3.47.82,0,.17-.09.35-.26.52s-.38.32-.61.43c-.23.12-.46.23-.69.35-1.16.46-2.1.82-2.82,1.08-.72.26-1.3.52-1.74.78-.43.26-.65.62-.65,1.08,0,1.21,5.99,1.82,17.96,1.82,10.41,0,18.94-.38,25.59-1.13s12.52-2.11,17.61-4.08c5.09-1.97,9.71-4.68,13.88-8.15l.04.02ZM640.8,85.63h3.73c3.06-5.49,5.84-9.38,8.33-11.67,2.49-2.28,5.32-3.43,8.5-3.43s4.77.72,4.77,2.17c0,.69-1.24,2.57-3.73,5.64s-4.37,5.64-5.64,7.72c1.96.23,3.71.43,5.25.61,1.53.17,2.73.32,3.6.43-3.3,6.13-7.43,12.4-12.4,18.82l-4.08-.3c-1.1-.09-2.21-.17-3.34-.26s-2.5-.19-4.12-.3c-3.12,5.03-5.74,9.53-7.85,13.49s-3.73,7.59-4.86,10.89-1.69,6.42-1.69,9.37c0,3.99,1.59,5.99,4.77,5.99,2.2,0,5.07-1.17,8.63-3.51s8.31-5.94,14.27-10.8v5.81c-15.61,16.95-27.15,25.42-34.61,25.42-2.6,0-4.7-1.01-6.29-3.04-1.59-2.02-2.38-4.63-2.38-7.81,0-2.14.45-4.68,1.34-7.63.9-2.95,2.5-7.4,4.81-13.36-.81.69-1.58,1.37-2.3,2.04s-1.39,1.27-2,1.82-1.26,1.13-1.95,1.73c-.69.61-1.39,1.23-2.08,1.87v-5.99c6.07-5.09,13.42-14.02,22.03-26.8-.87-.06-1.68-.1-2.43-.13s-1.65-.04-2.69-.04c-3.41,0-5.96.23-7.63.69-.69.17-1.34.36-1.95.56s-1.03.3-1.26.3-.35-.17-.35-.52c0-1.91,1.18-4.77,3.56-8.59,1.91-3.24,3.72-5.64,5.42-7.2,1.71-1.56,3.79-2.62,6.25-3.17,2.46-.55,5.91-.82,10.37-.82h0Z" style="fill:#306fff; stroke-width:0px;"/><path d="M664.91,115.12c8.79-7.98,17.32-13.91,25.59-17.78s14.66-5.81,19.17-5.81c1.21,0,2.34.51,3.38,1.52,1.04,1,1.88,2.19,2.47,3.51.61,1.33.91,2.31.91,2.95,0,1.04-.41,1.81-1.21,2.3-.81.49-2.23,1.08-4.25,1.78.4.93.92,2.11,1.56,3.56s1.13,2.62,1.47,3.51c.35.9.52,1.69.52,2.39,0,1.39-1.4,3.98-4.21,7.76-2.81,3.79-4.77,6.58-5.9,8.37-1.13,1.79-1.69,3.99-1.69,6.59,0,4.28,1.96,6.42,5.9,6.42s10.38-3.79,19-11.36v5.29c-14.63,16.25-25.1,24.38-31.4,24.38-2.26,0-3.86-.74-4.81-2.21s-1.43-3.66-1.43-6.55c0-4.57,1.65-11.19,4.94-19.86-8.44,9.37-14.72,16.03-18.82,20-4.11,3.96-7.49,5.94-10.15,5.94-1.27,0-2.86-1.1-4.77-3.3-1.91-2.2-3.6-5.04-5.07-8.54-1.47-3.5-2.21-7.13-2.21-10.89,0-2.72.26-4.99.78-6.81s1.53-3.69,3.04-5.59c1.5-1.91,3.9-4.42,7.2-7.55v-.02ZM706.46,105.58c-15.04,6.88-25.75,12.72-32.14,17.52s-9.59,9.75-9.59,14.83c0,1.85.32,3.37.95,4.55.64,1.19,1.5,1.78,2.6,1.78.64,0,1.76-.4,3.38-1.21,6.07-3.58,11.62-8.25,16.66-14.01,5.03-5.75,11.07-13.58,18.13-23.46h.01Z" style="fill:#306fff; stroke-width:0px;"/><path d="M779.07,130.82v5.81c-6.19,6.07-11.23,10.79-15.14,14.14-3.9,3.35-7.55,5.96-10.93,7.81-3.38,1.85-6.69,2.78-9.93,2.78s-6.1-1.26-8.76-3.77c-2.66-2.52-4.74-5.81-6.25-9.89-1.5-4.08-2.26-8.4-2.26-12.97,0-3.93.87-7.43,2.6-10.5,1.74-3.07,5.09-7.03,10.06-11.88,5.9-5.78,11.38-10.25,16.44-13.4s9.04-4.73,11.93-4.73c2.08,0,3.85.72,5.29,2.17s2.17,3.27,2.17,5.46c0,1.85-.95,4.48-2.86,7.89-1.91,3.41-4.05,6.38-6.42,8.89-2.37,2.52-4.25,3.77-5.64,3.77-1.5,0-2.25-.81-2.25-2.43.06-.46.1-.9.13-1.3s.04-.81.04-1.21c0-.69-.25-1.08-.74-1.17s-1.08.13-1.78.65c-5.78,4.05-9.75,6.9-11.88,8.54-2.14,1.65-3.83,3.31-5.07,4.99s-1.87,3.44-1.87,5.29c0,3.41,1.1,6.19,3.3,8.33s5.06,3.21,8.59,3.21,8.02-1.4,13.14-4.21c5.12-2.8,11.15-6.9,18.09-12.27h0Z" style="fill:#306fff; stroke-width:0px;"/><path d="M844.13,130.65v5.81c-6.48,7.58-11.91,13.32-16.31,17.22s-8.07,5.86-11.02,5.86-5.39-.84-7.68-2.52c-2.29-1.68-4.34-3.99-6.16-6.94-1.82-2.95-3.98-7.05-6.46-12.32-2.95,3.64-5.61,7.04-7.98,10.19-2.37,3.15-4.02,5.25-4.94,6.29-.93,1.04-1.77,1.56-2.52,1.56-1.56,0-2.69-1-3.38-2.99-.69-2-1.04-4.9-1.04-8.72,0-5.21.62-10.22,1.87-15.05,1.24-4.83,3.04-9.53,5.38-14.1s5.35-9.5,9.02-14.79c3.67-5.29,7.79-10.83,12.36-16.61,6.3-7.98,11.74-14.5,16.31-19.56,4.57-5.06,8.54-8.88,11.93-11.45,3.38-2.57,6.2-3.86,8.46-3.86,2.78,0,4.16,1.24,4.16,3.73,0,2.14-5.12,9.85-15.35,23.12-10.24,13.27-25.16,31.39-44.76,54.35v7.46c13.13-14.05,23.69-24.49,31.71-31.31,8.01-6.82,14.21-10.24,18.61-10.24,1.79,0,3.18,1.06,4.16,3.17s1.47,4.55,1.47,7.33c0,5.67-2.43,10.92-7.29,15.74-4.86,4.83-12.32,10.37-22.38,16.61,1.74,2.6,3.27,4.5,4.6,5.68,1.33,1.19,3.01,1.78,5.03,1.78,1.79,0,3.73-.61,5.81-1.82s4.21-2.75,6.38-4.6,5.51-4.86,10.02-9.02h-.01ZM809.86,135.07c2.2-1.45,4.93-3.69,8.2-6.72,3.27-3.04,6.06-6.19,8.37-9.46s3.47-6,3.47-8.2c0-.92-.41-1.39-1.21-1.39-2.2,0-5.97,2.11-11.32,6.33-5.35,4.22-10.57,9.63-15.66,16.22,2.2,0,4.92,1.07,8.15,3.21h0ZM951.78,140.71l2.86,2.17c-.75,1.62-1.47,3.04-2.17,4.25-.69,1.21-1.53,2.69-2.52,4.42-.98,1.73-1.73,3.04-2.25,3.9-4.34,7.58-8.41,11.36-12.23,11.36-1.62,0-3.01-.64-4.16-1.91-1.16-1.27-1.73-3.01-1.73-5.2,0-3.12,1.11-7.4,3.34-12.84,2.23-5.43,5.67-12.13,10.32-20.08s10.51-16.96,17.57-27.02c7.05-10.06,15.01-20.67,23.85-31.84-5.09-.75-11.13-1.13-18.13-1.13-8.04,0-16.99.9-26.85,2.69s-18.45,3.86-25.76,6.2c-7.32,2.34-10.97,4.06-10.97,5.16,0,.41.14.68.43.82.29.15.77.26,1.43.35s1.52.19,2.56.3c6.77.93,10.15,1.97,10.15,3.12,0,.58-1.47.85-4.42.82s-6.51-.04-10.67-.04c-3.3,0-5.68-.13-7.16-.39s-2.46-.75-2.95-1.47-.74-1.84-.74-3.34c0-.98.29-3.12.87-6.42,1.1-6.13,2.79-11.04,5.07-14.75,2.28-3.7,5.78-6.72,10.5-9.06,4.71-2.34,11.2-4.21,19.47-5.59,13.88-2.37,25.36-3.56,34.44-3.56,6.71,0,12,.27,15.88.82,3.87.55,6.72,1.34,8.54,2.39,1.82,1.04,2.98,2.07,3.47,3.08s1.14,2.76,1.95,5.25l2.69,7.98c.17.52.32.94.43,1.26.12.32.22.65.3,1,.09.35.13.67.13.95,0,2.26-.51,4.28-1.52,6.07s-2.86,4.48-5.55,8.07-4.67,6.39-5.94,8.41c-14.92,24.23-25.1,42.16-30.53,53.78v.02ZM991.94,115.12c8.79-7.98,17.32-13.91,25.59-17.78s14.66-5.81,19.17-5.81c1.21,0,2.34.51,3.38,1.52,1.04,1,1.88,2.19,2.47,3.51.61,1.33.91,2.31.91,2.95,0,1.04-.41,1.81-1.21,2.3-.81.49-2.23,1.08-4.25,1.78.4.93.92,2.11,1.56,3.56s1.13,2.62,1.47,3.51c.35.9.52,1.69.52,2.39,0,1.39-1.4,3.98-4.21,7.76-2.81,3.79-4.77,6.58-5.9,8.37-1.13,1.79-1.69,3.99-1.69,6.59,0,4.28,1.96,6.42,5.9,6.42s10.38-3.79,19-11.36v5.29c-14.63,16.25-25.1,24.38-31.4,24.38-2.26,0-3.86-.74-4.81-2.21s-1.43-3.66-1.43-6.55c0-4.57,1.65-11.19,4.94-19.86-8.44,9.37-14.72,16.03-18.82,20-4.11,3.96-7.49,5.94-10.15,5.94-1.27,0-2.86-1.1-4.77-3.3-1.91-2.2-3.6-5.04-5.07-8.54-1.47-3.5-2.21-7.13-2.21-10.89,0-2.72.26-4.99.78-6.81s1.53-3.69,3.04-5.59c1.5-1.91,3.9-4.42,7.2-7.55v-.02ZM1033.49,105.58c-15.04,6.88-25.75,12.72-32.14,17.52s-9.59,9.75-9.59,14.83c0,1.85.32,3.37.95,4.55.64,1.19,1.5,1.78,2.6,1.78.64,0,1.76-.4,3.38-1.21,6.07-3.58,11.62-8.25,16.66-14.01,5.03-5.75,11.07-13.58,18.13-23.46h.01Z" style="fill:#306fff; stroke-width:0px;"/><path d="M1111.3,130.82v5.64c-6.02,3.82-10.76,5.72-14.23,5.72-1.91,0-3.93-.32-6.07-.95-5.2,6.59-9.67,11.42-13.4,14.49s-7.47,4.6-11.23,4.6c-4.34,0-7.68-2.29-10.02-6.85-2.34-4.57-3.51-10.24-3.51-17,0-9.2,2.78-19.21,8.33-30.06,5.56-10.85,12.29-21.07,20.08-30.45,7.84-9.46,15.43-17.28,22.77-23.46,7.34-6.19,12.32-9.28,14.92-9.28s3.73,1.71,3.73,5.12c0,15.15-19.43,41.58-58.29,79.29-.12,1.04-.17,3.09-.17,6.16,0,7.98,2.14,11.97,6.42,11.97,1.68,0,3.37-.68,5.07-2.04,1.71-1.36,4.32-3.95,7.85-7.76-1.39-3.12-2.08-5.44-2.08-6.94,0-3.18,1.3-6.62,3.9-10.32s5.57-6.9,8.89-9.59c3.33-2.69,5.74-4.03,7.24-4.03,2.37,0,3.56,1.71,3.56,5.12,0,2.6-.68,5.72-2.04,9.37-1.36,3.64-3.34,7.81-5.94,12.49.98.81,1.76,1.4,2.34,1.78s1.45.56,2.6.56c2.66,0,5.75-1.18,9.28-3.56v-.02ZM1067.24,117.81c3.01-2.6,6.03-5.68,9.06-9.24s7.47-9.01,13.32-16.35c5.61-7.05,10.02-12.94,13.23-17.65s5.62-8.63,7.24-11.75c1.62-3.12,2.43-5.26,2.43-6.42,0-.87-.23-1.3-.69-1.3-1.27,0-3.92,2.1-7.94,6.29-4.02,4.19-8.6,9.93-13.75,17.22-7.11,10.06-12.26,17.64-15.44,22.73-3.18,5.09-5.67,10.58-7.46,16.48h0Z" style="fill:#306fff; stroke-width:0px;"/><path d="M1110.96,133.08v-2.08c14.92-15.73,25.18-26.75,30.79-33.05,1.27-7.11,4.34-10.67,9.19-10.67,1.21,0,2.52.35,3.9,1.04l.52,1.65c-.23.69-.35,1.68-.35,2.95,0,1.1.42,3.14,1.26,6.12s1.49,5.48,1.95,7.5.69,4.31.69,6.85c0,3.82-.87,7.48-2.6,10.97-1.73,3.5-4.25,6.85-7.55,10.06-3.3,3.21-7.55,6.49-12.75,9.85,2.08.35,3.73.52,4.94.52,2.37,0,4.93-.59,7.68-1.78,2.75-1.18,5.55-2.78,8.41-4.77,2.86-2,6.2-4.58,10.02-7.76v5.81c-7.4,7.23-14.02,12.71-19.86,16.44s-10.87,5.59-15.09,5.59c-5.44,0-10.47-2.31-15.09-6.94-2.72-2.78-4.41-5.43-5.08-7.98-.67-2.54-1-5.99-1-10.32h.02ZM1143.31,119.8l-1.56-12.66c-3.59,4.05-11.25,11.83-22.99,23.33,3.47.75,5.84,1.76,7.11,3.04,1.27,1.27,3.06,3.73,5.38,7.37,3.93-1.62,6.95-3.83,9.07-6.64,2.11-2.8,3.17-6.64,3.17-11.49,0-.58-.01-1.1-.04-1.56s-.07-.92-.13-1.39h0Z" style="fill:#306fff; stroke-width:0px;"/><g style="isolation:isolate;"><text transform="translate(943.45 229.96)" style="fill:#00d797; font-family:ArialMT, Arial; font-size:24px; isolation:isolate;"><tspan x="0" y="0">version: ${e}</tspan></text></g></svg>`, u = "data:image/svg+xml;base64," + os(o), y = "font-size: 1px; padding: " + Math.floor(100 / 4) + "px " + Math.floor(580 / 2) + "px; line-height: " + Math.floor(100 / 2) + "px;";
2099
- window.console.log(
2100
- "%c+",
2101
- y + `background-image: url(${u});background-size: 580px 100px;background-repeat: norepeat; color: transparent;`
2102
- );
2103
- }, rs = "FORWARD", is = "BACKWARD";
2104
- function as() {
2105
- const e = Ft(), { attrs: t, props: n } = e, o = t.tId ?? n.tId, s = t.pId ?? n.pId, a = yn(), u = ft(), y = Te(), { getTab: i, evictPageCache: f, addPageScroller: w } = He(), v = a.query.__tab;
2106
- return {
2107
- forward: (E) => {
2108
- const R = i(o), _ = E.query || {};
2109
- if (R) {
2110
- const S = de();
2111
- R.pages.push({
2112
- id: S,
2113
- tabId: R.id,
2114
- path: E.path,
2115
- query: _
2116
- });
2117
- }
2118
- const k = re({ __tab: v }, E.query);
2119
- y.emit(rs), u.push({ path: E.path, query: k });
2120
- },
2121
- backward: (E, R) => {
2122
- const _ = i(o);
2123
- if (!_) return !1;
2124
- const k = _.pages;
2125
- let S = 0;
2126
- if (typeof E == "number")
2127
- S = Math.abs(E);
2128
- else {
2129
- const b = ht(E), g = b.query || {}, W = k.list();
2130
- let j = !1;
2131
- const K = (h) => {
2132
- const r = { ...h || {} }, l = { ...g };
2133
- delete r.__tab, delete r._back, delete l.__tab, delete l._back;
2134
- const p = Object.keys(l);
2135
- return p.length === 0 ? !0 : p.every((d) => String(l[d] ?? "") === String(r[d] ?? ""));
2136
- };
2137
- for (let h = k.size() - 2; h >= 0; h--) {
2138
- S++;
2139
- const r = W[h], l = r?.path === b.path, p = K(r?.query);
2140
- if (l && p) {
2141
- j = !0;
2142
- break;
2143
- }
2144
- }
2145
- if (!j)
2146
- return !1;
2147
- }
2148
- if (S <= 0 || (k.size() <= S && (S = k.size() - 1), S <= 0)) return !1;
2149
- const T = [];
2150
- for (let b = 0; b < S; b++) {
2151
- const g = k.pop();
2152
- g && T.push(g.id);
2153
- }
2154
- const x = k.peek();
2155
- if (!x) return !1;
2156
- R && (x._backParams = R), y.emit(is);
2157
- const c = re({ __tab: v }, x.query || {});
2158
- return u.push({ path: x.path, query: c }).then(() => {
2159
- for (const b of T)
2160
- f(b);
2161
- }), !0;
2162
- },
2163
- addScrollTarget: (...E) => {
2164
- w(s, ...E);
2165
- }
2166
- };
2167
- }
2168
- const ds = /* @__PURE__ */ X({
2169
- __name: "iframe",
2170
- setup(e) {
2171
- return as(), () => {
2172
- };
2173
- }
2174
- }), hs = () => {
2175
- const e = Te(), { attrs: t } = Ft();
2176
- Se(() => {
2177
- o();
2178
- });
2179
- const n = () => {
2180
- e.emit(H.PAGE_LOADING, { tId: t.tId, value: !0 });
2181
- }, o = () => {
2182
- e.emit(H.PAGE_LOADING, { tId: t.tId, value: !1 });
2183
- };
2184
- return { openTabLoading: n, closeTabLoading: o };
2185
- }, cs = "vue-stack-tabs:refresh", ls = "vue-stack-tabs:openTab";
2186
- function vs(e) {
2187
- typeof window > "u" || !window.parent || window.parent.postMessage(
2188
- { type: ls, payload: e },
2189
- "*"
2190
- // 父窗口可校验 origin,此处用 * 便于跨子域
2191
- );
2192
- }
2193
- function ps(e = () => window.location.reload()) {
2194
- if (typeof window > "u") return () => {
2195
- };
2196
- const t = (n) => {
2197
- n.data?.type === cs && e();
2198
- };
2199
- return window.addEventListener("message", t), () => window.removeEventListener("message", t);
2200
- }
2201
- const bs = {
2202
- install(e, t) {
2203
- ss("1.1.0"), e.component("VueStackTabs", Xo).use(Xn).use(Ln().getI18n(t));
2204
- }
2205
- };
2206
- export {
2207
- ds as IFrame,
2208
- ls as MSG_OPEN_TAB,
2209
- cs as MSG_REFRESH,
2210
- ot as Stack,
2211
- Xo as StackTab,
2212
- it as TabHeaderButton,
2213
- pe as TabScrollMode,
2214
- bs as default,
2215
- ps as onRefreshRequest,
2216
- vs as postOpenTab,
2217
- bt as useTabActions,
2218
- hs as useTabLoading,
2219
- as as useTabRouter
2220
- };
1
+ import{Fragment as e,KeepAlive as t,Transition as a,TransitionGroup as r,cloneVNode as o,computed as n,createBlock as l,createCommentVNode as s,createElementBlock as i,createElementVNode as c,createVNode as u,defineComponent as d,getCurrentInstance as f,hasInjectionContext as b,inject as m,mergeProps as p,nextTick as v,normalizeClass as h,normalizeStyle as g,onActivated as y,onBeforeMount as k,onBeforeUnmount as _,onDeactivated as T,onMounted as w,onUnmounted as S,openBlock as I,provide as A,reactive as x,readonly as R,ref as C,renderList as P,renderSlot as E,resolveComponent as L,resolveDynamicComponent as M,shallowRef as O,toDisplayString as V,toRaw as W,triggerRef as B,unref as q,vShow as F,watch as j,withCtx as D,withDirectives as N,withModifiers as K}from"vue";import{isNavigationFailure as $,useRoute as z,useRouter as G}from"vue-router";var U=Object.defineProperty,H=(e,t)=>{let a={};for(var r in e)U(a,r,{get:e[r],enumerable:!0});return t||U(a,Symbol.toStringTag,{value:"Module"}),a},X=/* @__PURE__ */H({default:()=>J}),J={VueStackTab:{close:"close",closeLeft:"close left",closeRight:"close right",closeOthers:"close others",closeAll:"close all",reload:"reload",reloadAll:"reload all",maximum:"maximum",restore:"restore",undefined:"undefined",loading:"loading",iframeTitle:"Embedded tab page",iframeLoadTimeout:"IFrame loading timed out",retry:"Retry",openInNewWindow:"Open in new window",scrollLeft:"Scroll left",scrollRight:"Scroll right"}},Y=/* @__PURE__ */H({default:()=>Q}),Q={VueStackTab:{close:"关闭",closeLeft:"关闭左侧",closeRight:"关闭右侧",closeOthers:"关闭其他",closeAll:"关闭所有",reload:"刷新",reloadAll:"刷新所有",maximum:"最大化",restore:"还原",undefined:"未命名",loading:"加载中",iframeTitle:"标签页内嵌页面",iframeLoadTimeout:"iframe 加载超时",retry:"重试",openInNewWindow:"在新窗口打开",scrollLeft:"向左滚动",scrollRight:"向右滚动"}},Z=["__proto__","prototype","constructor"];function ee(e){const t=e.split("."),a=[];for(let r=0;r<t.length;r++){let e=t[r];for(;"\\"===e[e.length-1]&&void 0!==t[r+1];)e=e.slice(0,-1)+".",e+=t[++r];a.push(e)}return a.some(e=>-1!==Z.indexOf(e))?[]:a}function te(e,t){if(!function(e){const t=typeof e;return null!==e&&("object"===t||"function"===t)}(e))return"";const a=ee(t);if(0===a.length)return"";let r=Object.assign({},e);for(let o=0;o<a.length;o++){if("string"==typeof r[a[o]])return r[a[o]];if(r=r[a[o]],null==r){if(o!==a.length-1)return"";break}}return""}function ae(e,t){return Object.keys(t).forEach(a=>{t[a]instanceof Object&&a in e&&(t[a]={...t[a],...ae(e[a],t[a])})}),{...e||{},...t}}var re="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,oe=/* @__PURE__ */(e=>re?Symbol(e):"_vt_"+e)("i18n");function ne(){return m(oe)}function le(e){const t=Object.assign({locale:"en",fallbackLocale:"en",messages:{}},e),a=C(t.locale),r=x({});return Object.entries(t.messages).forEach(([e,t])=>{r[e]=t}),{t(e,o){if(!e)return"";let n=te(r["string"==typeof o&&o?o:a.value],e)||te(r[t.fallbackLocale],e);if(o&&"string"!=typeof o){const e=function(e,t){if(Array.isArray(t)){const a={},r=[...e.matchAll(/{(.+?)}/g)];return r&&r.forEach((e,r)=>{t[r]&&(a[e[1]]=t[r])}),a}return t}(n,o);l=e,(Array.isArray(l)?l.length:Object.keys(l).length)&&(n=function(e,t){for(const a in t)e=e.replace(`{${a}}`,String(t[a]));return e}(n,e))}var l;return n||e},current:R(a),options:R(e||{}),install(e){e.config.globalProperties.$t=this.t,e.provide(oe,this)},changeLocale(e){a.value=e},setLocaleMessage(e,t){r[e]=ae(W(r[e]||{}),t)},getLocaleMessage:e=>r[e]||{}}}var se=new Set(["__proto__","constructor","prototype"]),ie=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),ce=(e,t)=>{const a={...e};for(const[r,o]of Object.entries(t)){if(se.has(r))continue;const e=a[r];a[r]=ie(e)&&ie(o)?ce(e,o):o}return a},ue=()=>{const e=/* @__PURE__ */Object.assign({"./lang/en.ts":X,"./lang/zh-CN.ts":Y});return{getI18n:t=>{const a=((e,t)=>{const a={...e};if(!t)return a;for(const r of t)r.messages&&!se.has(r.locale)&&(a[r.locale]=ce(a[r.locale]??{},r.messages));return a})((()=>{const t={};return function(e,t){for(const a in e){const r=e[a];if(r?.default){const e=a.substring(a.lastIndexOf("/")+1,a.lastIndexOf(".")),o=t[e];t[e]=o?{...o,...r.default}:r.default}}}(e,t),t})(),t);return le({locale:t?.[0]?.locale??"zh-CN",fallbackLocale:"en",messages:a})}}},de=({wrap:e,left:t=0,top:a=0,smooth:r=!0})=>{e&&(e.scrollTo?e.scrollTo({left:t,top:a,behavior:r?"smooth":"auto"}):(e.scrollLeft=t,e.scrollTop=a))};!function(){let e=null}();var fe=(e=".stack-tab__container *")=>{const t=document.querySelectorAll(e);let a=0;for(let r=0;r<t.length;r++){const e=+window.getComputedStyle(t[r]).zIndex||0;e<89999&&e>a&&(a=e)}return a+1},be=new Set(["about:blank"]),me=new Set(["__tab","__src"]);function pe(e){const t=e.trim();if(!t)return!0;if((e=>{for(const t of e){const e=t.charCodeAt(0);if(e<=31||127===e||e>=128&&e<=159||8203===e||8204===e||8205===e||8288===e||65279===e||e>=8234&&e<=8238||e>=8294&&e<=8297)return!0}return!1})(t))return!1;if(be.has(t.toLowerCase()))return!0;if(t.toLowerCase().startsWith("about:"))return!1;try{const e=new URL(t,"undefined"!=typeof window?window.location.origin:"http://localhost");return"http:"===e.protocol||"https:"===e.protocol}catch{return!1}}function ve(e){return pe(e)?e:"about:blank"}function he(e){if("string"!=typeof e)return"about:blank";try{return ve(decodeURIComponent(e))}catch{return"about:blank"}}function ge(e){if(!e||!/^https?:\/\//i.test(e))return!1;try{const t="undefined"!=typeof window?window.location:{origin:"http://localhost"};return new URL(e,t.origin).origin!==t.origin}catch{return!0}}function ye(e){const[t="",a]=e.split("?");if(void 0===a)return{path:t,query:{}};const r=new URLSearchParams(a),o={};for(const[n,l]of r.entries()){const e=o[n];void 0!==e?o[n]=Array.isArray(e)?[...e,l]:[e,l]:o[n]=l}return{path:t,query:o}}function ke(e={}){const t={};for(const[a,r]of Object.entries(e))t[a]=Array.isArray(r)?[...r]:r;return t}function _e(e){return{...e,query:e.query?ke(e.query):void 0,_backParams:e._backParams?{...e._backParams}:void 0}}function Te(e={},t={}){const a=e=>{const t={};for(const[a,r]of Object.entries(e))me.has(a)||"_back"===a||(t[a]=Array.isArray(r)?r.map(e=>String(e??"")):String(r??""));return t},r=a(e),o=a(t),n=Object.keys(r),l=Object.keys(o);return n.length===l.length&&n.every(e=>{const t=r[e],a=o[e];return Array.isArray(t)||Array.isArray(a)?Array.isArray(t)&&Array.isArray(a)&&t.length===a.length&&t.every((e,t)=>e===a[t]):t===a})}function we(e={}){const t={};for(const[a,r]of Object.entries(e))me.has(a)||(t[a]=Array.isArray(r)?[...r]:r);return t}var Se=/* @__PURE__ */function(e){return e.WHEEL="wheel",e.BUTTON="button",e.BOTH="both",e}({}),Ie=class{items;constructor(e){this.items=e?[...e]:[]}push(e){this.items.push(e)}pop(){return this.items.pop()}peek(){return this.items.length>0?this.items[this.items.length-1]:void 0}at(e){return this.items[e]}isEmpty(){return 0===this.items.length}size(){return this.items.length}clear(){this.items.length=0}list(){return[...this.items]}readonlyList(){return this.items}toJSON(){return this.list()}toString(){return this.items.toString()}};function Ae(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&(!(Symbol.iterator in e)&&(!(Symbol.toStringTag in e)||"[object Module]"===Object.prototype.toString.call(e)))}function xe(e,t,a=".",r){if(!Ae(t))return xe(e,{},a,r);const o={...t};for(const n of Object.keys(e)){if("__proto__"===n||"constructor"===n)continue;const t=e[n];null!=t&&(r&&r(o,n,t,a)||(Array.isArray(t)&&Array.isArray(o[n])?o[n]=[...t,...o[n]]:Ae(t)&&Ae(o[n])?o[n]=xe(t,o[n],(a?`${a}.`:"")+n.toString(),r):o[n]=t))}return o}function Re(e){return(...t)=>t.reduce((t,a)=>xe(t,a,"",e),{})}var Ce=Re(),Pe=(Re((e,t,a)=>{if(void 0!==e[t]&&"function"==typeof a)return e[t]=a(e[t]),!0}),Re((e,t,a)=>{if(Array.isArray(e[t])&&"function"==typeof a)return e[t]=a(e[t]),!0}),e=>"object"==typeof e&&null!==e&&!Array.isArray(e)),Ee={id:"",title:"",iframe:!1,closable:!0,refreshable:!0,iframeRefreshMode:"postMessage"},Le=e=>{const t={version:1,id:e.id,title:e.title,iframe:e.iframe,closable:e.closable,refreshable:e.refreshable,iframeRefreshMode:"reload"===e.iframeRefreshMode?"reload":"postMessage"};return a=JSON.stringify(t),encodeURIComponent(btoa(encodeURIComponent(a)));var a},Me=e=>{if(e.length>4096)return{...Ee};try{const a=(e=>decodeURIComponent(atob(decodeURIComponent(e))))(e);return a.length>2048?{...Ee}:a.trim().startsWith("{")?(t=JSON.parse(a),Pe(t)?{id:"string"==typeof t.id?t.id:Ee.id,title:"string"==typeof t.title?t.title:Ee.title,iframe:"boolean"==typeof t.iframe?t.iframe:Ee.iframe,closable:"boolean"==typeof t.closable?t.closable:Ee.closable,refreshable:"boolean"==typeof t.refreshable?t.refreshable:Ee.refreshable,iframeRefreshMode:"reload"===t.iframeRefreshMode?"reload":"postMessage"}:{...Ee}):(e=>{const t=e.split("|"),a="R"===t[5]?"reload":"postMessage";return{id:t[0]??"",title:t[1]??"",iframe:"Y"===t[2],closable:"Y"===t[3],refreshable:"Y"===t[4],iframeRefreshMode:a}})(a)}catch{return{...Ee}}var t},Oe=()=>crypto.randomUUID();var Ve=Symbol("stackTabsContext"),We=Symbol("stackTabsMaximum"),Be=null,qe=!1,Fe=/* @__PURE__ */new WeakSet,je=(e={})=>{const t={tabs:C([]),defaultTabs:C([]),caches:O([]),components:/* @__PURE__ */new Map,cacheIdsToEvict:/* @__PURE__ */new Set,tabIdsToEvict:/* @__PURE__ */new Set,refreshKey:C(0),scrollPositionsByPageId:/* @__PURE__ */new Map,isInitialized:C(!1),iframeRefreshKeys:C({}),maxTabCount:C(0),useGlobalScroll:C(!1),sessionPrefix:C("")};return{...t,maxTabCount:C(e.maxTabCount??t.maxTabCount.value),useGlobalScroll:C(e.useGlobalScroll??t.useGlobalScroll.value),sessionPrefix:C(e.sessionPrefix??t.sessionPrefix.value),iframePath:C(e.iframePath??""),eventBus:{all:a=a||/* @__PURE__ */new Map,on:function(e,t){var r=a.get(e);r?r.push(t):a.set(e,[t])},off:function(e,t){var r=a.get(e);r&&(t?r.splice(r.indexOf(t)>>>0,1):a.set(e,[]))},emit:function(e,t){var r=a.get(e);r&&r.slice().map(function(e){e(t)}),(r=a.get("*"))&&r.slice().map(function(a){a(e,t)})}}};var a},De=()=>{const e=(b()?m(Ve,null):null)??Be;if(!e)throw new Error("VueStackTabs runtime context is not available. Render <VueStackTabs> before using vue-stack-tabs composables.");return e},Ne=/* @__PURE__ */function(e){return e.PAGE_LOADING="PAGE_LOADING",e.TAB_ACTIVE="TAB_ACTIVE",e.FORWARD="FORWARD",e.BACKWARD="BACKWARD",e.REFRESH_IFRAME_POSTMESSAGE="REFRESH_IFRAME_POSTMESSAGE",e}({}),Ke=Symbol("tabEmitter"),$e=()=>(b()?m(Ke,null):null)??De().eventBus,ze=["aria-label"],Ge=/* @__PURE__ */d({__name:"PageLoading",props:{tabId:{}},setup(e){const t=e,{t:a}=ne(),r=$e(),o=C(!1),n=e=>{e.tId===t.tabId&&(o.value=e.value)};return r.on(Ne.PAGE_LOADING,n),S(()=>{r.off(Ne.PAGE_LOADING,n)}),(e,t)=>o.value?(I(),i("div",{key:0,class:"stack-tab-loading-mask",role:"status","aria-live":"polite","aria-label":q(a)("VueStackTab.loading"),style:g({zIndex:q(fe)(".cache-page-wrapper *")})},[...t[0]||(t[0]=[c("div",{class:"stack-tab-loading--spin turn","aria-hidden":"true"},null,-1)])],12,ze)):s("",!0)}}),Ue=async e=>{const t=e.apply();try{const a=await e.navigate();if(e.isFailureResult?.(a)){if(e.isCurrent?.()??1?e.rollback(t):e.cleanupStale?.(),e.rejectFailureResult)throw a;return a}return(e.isCurrent?.()??1)&&e.commit?.(),a}catch(a){throw e.isCurrent?.()??1?e.rollback(t):e.cleanupStale?.(),a}},He=e=>e.startsWith("#")?document.getElementById(e.slice(1)):document.querySelector(e),Xe=e=>{const t=()=>e.sessionPrefix.value+"stacktab-active-tab";let a=null,r=0,o=!1;const n=()=>{o=!1;const e=a;a=null,e&&e.version===r&&window.sessionStorage.setItem(t(),JSON.stringify(e.tab))},l=()=>{r++,a=null},s=()=>{l(),window.sessionStorage.removeItem(t())};return{getSessionKey:t,saveActiveTabToSession:e=>{e.id&&(a={tab:e,version:++r},o||(o=!0,queueMicrotask(n)))},clearSession:s,restoreActiveTabSession:e=>{null!==e?(l(),window.sessionStorage.setItem(t(),e)):s()},restoreTabFromSession:e=>{if(null==e)return null;try{const a=JSON.parse(e,(e,t)=>"pages"===e&&Array.isArray(t)?new Ie(t):t);return Pe(t=a)&&"string"==typeof t.id&&"string"==typeof t.title&&"boolean"==typeof t.closable&&"boolean"==typeof t.refreshable&&"boolean"==typeof t.iframe&&"boolean"==typeof t.active&&t.pages instanceof Ie?a:(s(),null)}catch{return s(),null}var t}}},Je=e=>{const{tabs:t,iframeRefreshKeys:a,getTab:r,createPageId:o,addCache:n,evictPageCache:l,replacePageCaches:s,refreshIframeByPostMessage:i}=e,c=(e,t,a)=>{const r=e.pages.peek();if(!r)return;if(e.active)return void(r.refreshVersion=(r.refreshVersion??0)+1);const s=r.id;if(r.id=o(),r.refreshVersion=0,t&&a)return t.push(s),void a.push(r.id);l(s),n(r.id)};return{refreshTab:e=>{const t=r(e);t?.refreshable&&(t.iframe?(e=>{"reload"!==e.iframeRefreshMode?i(e.id):a.value={...a.value,[e.id]:(a.value[e.id]??0)+1}})(t):c(t))},refreshAllTabs:()=>{const e=[],r=[],o={...a.value};let n=!1;for(const a of t.value)a.refreshable&&(a.iframe?"reload"===a.iframeRefreshMode?(o[a.id]=(o[a.id]??0)+1,n=!0):i(a.id):c(a,e,r));n&&(a.value=o),s(e,r)}}},Ye=/* @__PURE__ */d({name:"StackTabEmptyPlaceholder",setup:()=>()=>null}),Qe=(e,t)=>({...ke(e.query),__tab:e.query.__tab??Le(t)}),Ze=e=>{const t=e.matched[e.matched.length-1]?.path??e.path,a=e.path.endsWith("/")?e.path.slice(0,-1):e.path;return t===a?a:e.path},et=()=>{const e=G(),t=$e(),{t:a}=ne(),r=De(),{tabs:l,defaultTabs:s,caches:i,components:c,tabIdsToEvict:f,refreshKey:b,iframeRefreshKeys:m,isInitialized:p,cacheIdsToEvict:v}=r,{markCacheForEviction:h,markTabPagesForEviction:g,markTabPagesForEvictionOnly:k,addCache:_,removeCache:I,evictMarkedCaches:A,evictPageCache:x,replacePageCaches:R}=(e=>{const{caches:t,components:a,cacheIdsToEvict:r,tabIdsToEvict:o}=e,n=new Set(t.value);let l=t.value;const s=()=>{if(l!==t.value){l=t.value,n.clear();for(const e of l)n.add(e)}},i=e=>{r.add(e)},c=e=>{if(s(),n.has(e)){n.delete(e);const a=l.indexOf(e);a>=0&&l.splice(a,1),B(t)}};return{markCacheForEviction:i,markTabPagesForEviction:e=>{for(const t of e.pages.list())i(t.id);o.add(e.id)},markTabPagesForEvictionOnly:e=>{for(const t of e.pages.list())i(t.id)},addCache:e=>{s(),n.has(e)||(n.add(e),l.push(e),B(t))},removeCache:c,evictPageCache:e=>{e&&(r.delete(e),c(e),a.delete(e))},replacePageCaches:(e,o)=>{s();const i=new Set(e);let c=!1;if(i.size>0){for(let e=l.length-1;e>=0;e--){const t=l[e];t&&i.has(t)&&(l.splice(e,1),c=!0)}for(const e of i)n.delete(e),r.delete(e),a.delete(e)}for(const t of o)n.has(t)||(n.add(t),l.push(t),c=!0);c&&B(t)},evictMarkedCaches:()=>{if(r.size<=0)return;s();const e=new Set(r);for(let t=l.length-1;t>=0;t--){const a=l[t];a&&e.has(a)&&l.splice(t,1)}for(const t of e)n.delete(t),a.delete(t);B(t),r.clear()}}})(r),{restoreScroller:P,saveScroller:E,removeScroller:L,addPageScroller:M}=(e=>{const{scrollPositionsByPageId:t}=e;return{restoreScroller:e=>{const a=t.get(e);if(a)for(const[t,r]of a){const e=He(t);e&&(e.scrollTop=r.top,e.scrollLeft=r.left)}},saveScroller:e=>{const a=t.get(e);if(a)for(const t of a.keys()){const e=He(t);a.set(t,{top:e?.scrollTop??0,left:e?.scrollLeft??0})}},removeScroller:e=>{const a=t.get(e);a&&(a.clear(),t.delete(e))},addPageScroller:(e,...a)=>{t.has(e)||t.set(e,/* @__PURE__ */new Map);const r=t.get(e);for(const t of a)r.set(t,{top:0,left:0})}}})(r),{saveActiveTabToSession:V,clearSession:W,restoreTabFromSession:q,restoreActiveTabSession:F,getSessionKey:j}=Xe(r),D=e=>{l.value=[...l.value,e]},N=e=>l.value.find(t=>t.id===e)??null,K=e=>{const r=(e=>{if("string"==typeof e.query.__tab){const t=Me(e.query.__tab);if(t.id)return t}const t=Ze(e),r=l.value.find(e=>e.active),o=r?.pages.peek();return r&&o?.path===t?{id:r.id,title:r.title,closable:r.closable,refreshable:r.refreshable,iframe:r.iframe,iframeRefreshMode:r.iframeRefreshMode}:{id:crypto.randomUUID(),title:a("VueStackTab.undefined"),closable:!0,refreshable:!0,iframe:!1}})(e);if(f.has(r.id))return{empty:!0};const o=Ze(e);let n,s=r.id?N(r.id):null,i=null;if(s&&!s.pages.isEmpty()){const t=s.pages.peek();if(!t)throw new Error("[vue-stack-tabs] Stack is not empty but peek() returned undefined");if(t.path===o)n=t.id;else{const t=s.pages.readonlyList();let a=-1;for(let e=t.length-2;e>=0;e--){const r=t[e];if(r&&r.path===o){a=e;break}}if(-1!==a){const o=t.length-1-a;for(let e=0;e<o;e++){const e=s.pages.pop();e&&x(e.id)}const l=s.pages.peek();n=l?l.id:Oe(),l||(i={id:n,tabId:r.id,path:e.path,query:Qe(e,r)})}else n=Oe(),i={id:n,tabId:r.id,path:e.path,query:Qe(e,r)}}}else n=Oe(),i={id:n,tabId:r.id,path:e.path,query:Qe(e,r)};if(v.has(n)){v.delete(n);const e=c.get(n);if(e)return{recovered:e,cacheName:n}}if(i)s=((e,a,r,o)=>{let n=null;for(const t of l.value)t.active=!1,t.id===e.id&&(n=t);if(null===n){const r=new Ie;r.push(o);const l=a.query.__src;n={id:e.id,title:e.title,closable:e.closable,refreshable:e.refreshable,iframe:e.iframe,iframeRefreshMode:e.iframeRefreshMode??"postMessage",url:he(l),active:!0,pages:r},D(n),t.emit(Ne.TAB_ACTIVE,{id:e.id,isRoute:!1})}else n.active=!0,(n.pages.isEmpty()||n.pages.peek().id!==o.id)&&n.pages.push(o);return n})(r,e,0,i);else{for(const e of l.value)e.active=!1;s.active=!0}return V(s),{cacheName:n,tabInfo:r,targetTab:s}},z=C(""),U=n(()=>l.value.find(e=>e.active)?.pages.peek()?.refreshVersion??0);let H="",X=null;const J=e=>{const t=l.value;for(let a=t.length-1;a>=0;a--){const r=t[a];r&&r.closable&&e(r,a)&&(g(r),r.pages.clear(),t.splice(a,1))}},Y=()=>{const e=l.value;if(J(()=>!0),e.some(e=>e.active))return A(),void f.clear();const a=e[e.length-1];a&&t.emit(Ne.TAB_ACTIVE,{id:a.id})},{refreshTab:Q,refreshAllTabs:Z}=Je({tabs:l,iframeRefreshKeys:m,getTab:N,createPageId:Oe,addCache:_,evictPageCache:x,replacePageCaches:R,refreshIframeByPostMessage:e=>t.emit(Ne.REFRESH_IFRAME_POSTMESSAGE,e)});return{tabs:l,caches:i,refreshKey:b,activeCacheKey:z,activePageRefreshVersion:U,isInitialized:p,setMaxSize:e=>{r.maxTabCount.value=e},canAddTab:()=>r.maxTabCount.value<=0||r.maxTabCount.value>0&&r.maxTabCount.value>l.value.length,initialize:e=>{const t=[],a=[];for(const o of e){const e=Ce(o,{id:crypto.randomUUID(),refreshable:!0,closable:!0,iframe:!1}),r=e.id??crypto.randomUUID();e.id=r;const n=ye(e.path),l=Oe(),s={id:l,tabId:r,path:n.path,query:Ce(we(n.query),{__tab:Le(e)})},i=new Ie;i.push(s);const c={id:r,title:e.title??"",closable:e.closable,refreshable:e.refreshable,iframe:e.iframe,iframeRefreshMode:"reload"===e.iframeRefreshMode?"reload":"postMessage",active:!1,pages:i};_(l),t.push(c),a.push({...c})}s.value=[...s.value,...t],l.value=[...l.value,...a];const r=q(sessionStorage.getItem(j()));r&&!l.value.some(e=>e.id===r.id)&&(r.url&&(r.url=ve(r.url)),r.iframe&&r.url&&void 0===r.iframeRefreshMode&&(r.iframeRefreshMode=ge(r.url)?"reload":"postMessage"),r.pages&&"function"==typeof r.pages.list&&r.pages.list().forEach(e=>{e&&e.id&&_(e.id)}),l.value=[...l.value,r]),p.value=!0},size:()=>l.value.length,active:(a,r=!0)=>{t.emit(Ne.FORWARD);const o=N(a);if(!o)return Promise.resolve();if(o.active)return Promise.resolve();const n=o.pages.peek(),s=()=>{for(const e of l.value)e.active=e.id===a;V(o),l.value=l.value.slice()};if(!r)return s(),Promise.resolve();if(!n)return s(),Promise.resolve();const i=Ce({__tab:Le({id:o.id,title:o.title,closable:o.closable,refreshable:o.refreshable,iframe:o.iframe})},n.query||{});return Ue({apply:()=>{const e=l.value.find(e=>e.active)?.id,t=window.sessionStorage.getItem(j());return s(),{prevActiveId:e,sessionSnapshot:t}},navigate:()=>e.push({path:n.path,query:i}),rollback:e=>{for(const t of l.value)t.active=t.id===e.prevActiveId;l.value=l.value.slice(),F(e.sessionSnapshot)},isFailureResult:$,rejectFailureResult:!0})},getCacheName:()=>Oe(),destroy:()=>{l.value=[],s.value=[],v.clear(),f.clear(),m.value={},i.value=[],c.clear(),r.scrollPositionsByPageId.clear(),r.isInitialized.value=!1,r.refreshKey.value=0,W()},reset:()=>Y(),addCache:_,removeCache:I,getTab:N,addTab:D,removeTab:e=>{let a="";const r=N(e),o=l.value,n=o.findIndex(t=>t?.id===e);if(n<0)return"";const s=o[n];return s.closable?(g(s),s.pages.clear(),o.length>1&&s.active&&(a=(0===n?o[1]:o[n-1])?.id??""),o.splice(n,1),a&&t.emit(Ne.TAB_ACTIVE,{id:a}),r?.active||(A(),f.clear()),a):e},removeAllTabs:Y,removeLeftTabs:e=>{const a=l.value,r=a.findIndex(t=>t?.id===e);if(r<=0)return;if(J((e,t)=>t<r),a.some(e=>e.active))return A(),void f.clear();const o=a[0];o&&t.emit(Ne.TAB_ACTIVE,{id:o.id})},removeRightTabs:e=>{const a=l.value,r=a.findIndex(t=>t?.id===e);if(r<0||r>=a.length-1)return;if(J((e,t)=>t>r),a.some(e=>e.active))return A(),void f.clear();const o=a[a.length-1];o&&t.emit(Ne.TAB_ACTIVE,{id:o.id})},removeOtherTabs:e=>{const a=l.value.find(t=>t.id===e);J(t=>t.id!==e),a&&!a.active?t.emit(Ne.TAB_ACTIVE,{id:e}):(A(),f.clear())},hasTab:e=>l.value.some(t=>t.id===e),renewTab:e=>{const t=N(e.id);if(!t)return;const a=t.pages.list().map(e=>_e(e)),r=[...i.value],o=new Map(c);return k(t),A(),t.pages.clear(),()=>{t.pages.clear();for(const e of a)t.pages.push(_e(e));i.value=[...r],c.clear();for(const[e,t]of o)c.set(e,t)}},addPage:(e,t)=>{if(!t)return Ye;const a=e.fullPath+(e.query.__tab||"");if(a===H&&X)return X;const n=K(e);if("empty"in n)return Ye;if("recovered"in n)return _(n.cacheName),z.value=n.cacheName,H=a,X=n.recovered,n.recovered;z.value=n.cacheName;const l=(e=>{const{cacheName:t,tabInfo:a}=e;if(c.has(t))return _(t),c.get(t);const n=/* @__PURE__ */d({name:t,props:{vnode:{type:Object,required:!1,default:void 0}},emits:["onLoaded"],setup(e,n){const l=C(null),s=O(null),i=O(null),c=O(null),d=()=>{try{const e=N(a.id)?.pages.peek();e&&e.id===t&&e._backParams?(l.value={...e._backParams},delete e._backParams):l.value=null}catch{l.value=null}};return w(()=>{n.emit("onLoaded"),M(t,`#W-${t}`),d()}),T(()=>E(t)),y(()=>{n.emit("onLoaded"),P(t),A(),f.clear(),d()}),S(()=>L(t)),()=>{const n=e.vnode,d=l.value;if(n!==s.value||d!==c.value){const e=d?{_back:d}:{};i.value=n?o(n,{tId:a.id,pId:t,...e}):null,s.value=n,c.value=d}return u("div",{class:"cache-page-wrapper",id:`W-${t}`,style:[r.useGlobalScroll.value?"overflow:auto":"overflow:hidden","height: 100%"]},[i.value,u(Ge,{tabId:a.id},null)])}}});return c.set(t,n),_(t),n})(n);return H=a,X=l,l},addComponent:(e,t)=>c.set(e,t),getComponent:e=>c.get(e),removeComponent:e=>c.delete(e),markCacheForEviction:h,evictMarkedCaches:A,evictPageCache:x,refreshTab:Q,refreshAllTabs:Z,iframeRefreshKeys:m,addPageScroller:M,setGlobalScroll:e=>{r.useGlobalScroll.value=e},clearSession:W,setSessionPrefix:e=>{r.sessionPrefix.value=e}}};function tt(){const e=G(),t=De(),{active:a,hasTab:r,refreshKey:o,reset:n,canAddTab:l,renewTab:s,getTab:i,tabs:c,removeTab:u,removeAllTabs:d,refreshTab:f,refreshAllTabs:b}=et(),m=(a,r)=>{const o=Le(r);let n,l=Ce(we(a.query),{__tab:o});if(a.iframe)l={...l,__src:encodeURIComponent(a.path),__tab:o},n=t.iframePath.value;else{const e=ye(a.path);n=e.path,l=Ce(we(e.query),l,{__tab:o}),l={...l,__tab:o}}return pe(a.path)?Ue({apply:()=>{},navigate:()=>e.push({path:n,query:l}),rollback:()=>{},isFailureResult:$,rejectFailureResult:!0}):Promise.reject(/* @__PURE__ */new Error("Invalid tab URL"))};return{openTab:(e,t=!1)=>new Promise((n,c)=>{const u=(e=>{const t={refreshable:!0,closable:!0,iframe:!1};e.iframe&&void 0===e.iframeRefreshMode?t.iframeRefreshMode=ge(e.path??"")?"reload":"postMessage":e.iframe&&(t.iframeRefreshMode=e.iframeRefreshMode??"postMessage");const a=Ce(e,t);return a.id||(a.id=crypto.randomUUID()),a})(e),d=Boolean(u.id&&r(u.id));if(d&&!t)return void Promise.resolve(a(u.id)).then(()=>n(u.id),c);let f,b;if(u.id&&t&&d){const t=i(e.id);f=s(e),t?.active&&(b=o.value,o.value++)}d||l()?m(e,u).then(()=>n(u.id),e=>{f?.(),void 0!==b&&(o.value=b),c(e)}):c(/* @__PURE__ */new Error("Max Size"))}),closeTab:u,closeAllTabs:d,refreshTab:f,refreshAllTabs:b,activeTab:a,reset:n,tabs:c,setIFramePath:e=>{t.iframePath.value=e},getWrapper:()=>document.getElementsByClassName("cache-page-wrapper")[0],openInNewWindow:e=>{const t=i(e);t?.iframe&&t.url&&pe(t.url)&&window.open(t.url,"_blank","noopener,noreferrer")}}}var at=["disabled"],rt=(e,t)=>{const a=e.__vccOpts||e;for(const[r,o]of t)a[r]=o;return a},ot=/* @__PURE__ */rt(/* @__PURE__ */d({__name:"ContextMenuItem",props:{icon:{default:""},title:{},disabled:{type:Boolean,default:!1}},setup:e=>(t,a)=>(I(),i("button",{type:"button",role:"menuitem",class:"stack-tab__contextmenu-item",disabled:e.disabled},[c("span",{class:h(["stack-tab__contextmenu-icon",e.icon]),"aria-hidden":"true"},null,2),c("span",{class:"stack-tab__contextmenu-title",onContextmenu:a[0]||(a[0]=K(()=>{},["prevent"]))},V(e.title),33)],8,at))}),[["__scopeId","data-v-3d616fa0"]]),nt={key:1,class:"divider div-transparent",role:"separator","aria-orientation":"horizontal"},lt=/* @__PURE__ */rt(/* @__PURE__ */d({__name:"index",props:{index:{},left:{default:0},top:{default:0},contextMenu:{default:()=>[]},restoreFocusElement:{default:null},tabItem:{},max:{}},emits:["close"],setup(t,{emit:a}){const r=t,o=a,{t:n}=ne(),c=C(),d=x({left:r.left,top:r.top}),{closeTab:f,closeAllTabs:b,refreshTab:m,refreshAllTabs:p,openInNewWindow:h}=tt(),{removeLeftTabs:y,removeRightTabs:k,removeOtherTabs:_}=et(),T=()=>{r.restoreFocusElement&&document.contains(r.restoreFocusElement)?r.restoreFocusElement.focus():document.querySelector('[role="tab"][aria-selected="true"]')?.focus()},S=()=>{o("close"),v(T)},A=e=>{e?.(),S()},R=()=>{const e=c.value;return e?Array.from(e.querySelectorAll('[role="menuitem"]')).filter(e=>!e.disabled):[]},E=e=>{const t=R();t.length<=0||t[(e+t.length)%t.length]?.focus()},L=()=>R().findIndex(e=>e===document.activeElement),M=e=>{if("Escape"===e.key)return e.preventDefault(),void S();if("ArrowDown"===e.key){e.preventDefault();const t=L();return void E(-1===t?0:t+1)}if("ArrowUp"===e.key){e.preventDefault();const t=L();return void E(-1===t?-1:t-1)}if("Home"===e.key)return e.preventDefault(),void E(0);"End"===e.key&&(e.preventDefault(),E(R().length-1))},O=e=>e.key??`${e.title}-${e.icon??""}`;return w(()=>{const e=c.value?.clientWidth??0;d.left+e>window.innerWidth&&(d.left=window.innerWidth-e-5),E(0)}),(a,r)=>(I(),i("div",{ref_key:"menuElementRef",ref:c,class:"stack-tab__contextmenu",role:"menu",tabindex:"-1",style:g({left:`${d.left}px`,top:`${d.top}px`,"z-index":q(fe)(".stack-tab,.stack-tab *")}),onKeydown:M},[u(ot,{icon:"stack-tab__icon-reload svg-mask",title:q(n)("VueStackTab.reload"),disabled:!t.tabItem.refreshable,onClick:r[0]||(r[0]=e=>A(()=>q(m)(t.tabItem.id)))},null,8,["title","disabled"]),u(ot,{icon:"stack-tab__icon-reload-all svg-mask",title:q(n)("VueStackTab.reloadAll"),onClick:r[1]||(r[1]=e=>A(q(p)))},null,8,["title"]),u(ot,{icon:"stack-tab__icon-close svg-mask",title:q(n)("VueStackTab.close"),disabled:!t.tabItem.closable,onClick:r[2]||(r[2]=e=>A(()=>q(f)(t.tabItem.id)))},null,8,["title","disabled"]),u(ot,{icon:"stack-tab__icon-close-lefts svg-mask",title:q(n)("VueStackTab.closeLeft"),disabled:t.index<=0,onClick:r[3]||(r[3]=e=>A(()=>q(y)(t.tabItem.id)))},null,8,["title","disabled"]),u(ot,{icon:"stack-tab__icon-close-rights svg-mask",title:q(n)("VueStackTab.closeRight"),disabled:t.index>=t.max-1,onClick:r[4]||(r[4]=e=>A(()=>q(k)(t.tabItem.id)))},null,8,["title","disabled"]),u(ot,{icon:"stack-tab__icon-close-others svg-mask",title:q(n)("VueStackTab.closeOthers"),onClick:r[5]||(r[5]=e=>A(()=>q(_)(t.tabItem.id)))},null,8,["title"]),u(ot,{icon:"stack-tab__icon-close-all svg-mask",title:q(n)("VueStackTab.closeAll"),onClick:r[6]||(r[6]=e=>A(q(b)))},null,8,["title"]),t.tabItem.iframe&&t.tabItem.url?(I(),l(ot,{key:0,icon:"stack-tab__icon-open svg-mask",title:q(n)("VueStackTab.openInNewWindow"),onClick:r[7]||(r[7]=e=>A(()=>q(h)(t.tabItem.id)))},null,8,["title"])):s("",!0),void 0!==t.contextMenu&&t.contextMenu.length>0?(I(),i("div",nt)):s("",!0),(I(!0),i(e,null,P(t.contextMenu,e=>(I(),l(ot,{key:O(e),"data-menu-key":O(e),icon:e.icon,title:e.title,disabled:e.disabled(t.tabItem),onClick:a=>A(()=>!e.disabled(t.tabItem)&&e.callback(t.tabItem.id))},null,8,["data-menu-key","icon","title","disabled","onClick"]))),128))],36))}}),[["__scopeId","data-v-f6a9b3bf"]]),st=e=>`stack-tab-tab-${encodeURIComponent(e)}`,it=e=>`stack-tab-panel-${encodeURIComponent(e)}`,ct=["id","data-tab-id","aria-controls","aria-selected","tabindex","title"],ut={class:"stack-tab__item-title"},dt={class:"stack-tab__item-title-content"},ft=["title","aria-label","tabindex"],bt=/* @__PURE__ */d({__name:"TabHeaderItem",props:{item:{}},emits:["close","active","contextmenu"],setup(e,{emit:t}){const a=t,r=$e(),{t:o}=ne(),l=C(),u=e,d=e=>{u.item.id===e.id&&m(e.isRoute??!0)};r.on(Ne.TAB_ACTIVE,d),S(()=>{r.off(Ne.TAB_ACTIVE,d)});const f=n(()=>u.item.title||o("VueStackTab.undefined")),b=()=>{a("close",u.item)},m=(e=!0)=>{a("active",u.item,l.value,e)},p=e=>{if("Enter"===e.key||" "===e.key)return e.preventDefault(),void m(!0);"Delete"!==e.key&&"Backspace"!==e.key||!u.item.closable||(e.preventDefault(),b())};return(t,a)=>(I(),i("li",{ref_key:"tabElementRef",ref:l,role:"presentation",class:h(["stack-tab__item",{"is-active":e.item.active,"is-icon":e.item.closable}]),onClick:a[1]||(a[1]=K(e=>m(!0),["self"])),onContextmenu:a[2]||(a[2]=e=>t.$emit("contextmenu",e))},[c("button",{id:q(st)(e.item.id),type:"button",role:"tab",class:"stack-tab__item-tab","data-tab-id":e.item.id,"aria-controls":q(it)(e.item.id),"aria-selected":e.item.active?"true":"false",tabindex:e.item.active?0:-1,title:f.value,onClick:a[0]||(a[0]=e=>m(!0)),onKeydown:p},[c("span",ut,[c("span",dt,V(f.value),1)])],40,ct),e.item.closable?(I(),i("button",{key:0,type:"button",class:"stack-tab__icon-close-fill stack-tab__item-button",title:q(o)("VueStackTab.close"),"aria-label":`${q(o)("VueStackTab.close")} ${f.value}`,tabindex:e.item.active?0:-1,onClick:K(b,["stop"])},null,8,ft)):s("",!0)],34))}}),mt=["disabled","title","aria-label"],pt={key:1,class:"stack-tab__button"},vt=/* @__PURE__ */d({__name:"TabHeaderButton",props:{disabled:{type:Boolean,default:!1},shadow:{default:null},iconClass:{default:""},title:{default:""},ariaLabel:{default:""}},setup(e){const t=e,a=n(()=>t.ariaLabel||t.title);return(t,r)=>(I(),i("button",{type:"button",class:h(["stack-tab__header-button",{"stack-tab__shadow-right":"right"===e.shadow,"stack-tab__shadow-left":"left"===e.shadow}]),disabled:e.disabled,title:e.title,"aria-label":a.value},["icon"in t.$slots?s("",!0):(I(),i("span",{key:0,class:h(["stack-tab__mask-button",e.iconClass])},null,2)),"icon"in t.$slots?(I(),i("span",pt,[E(t.$slots,"icon")])):s("",!0)],10,mt))}}),ht=/* @__PURE__ */d({__name:"TabHeaderScroll",props:{space:{default:300},isScrollWheel:{type:Boolean,default:!0},isScrollButton:{type:Boolean,default:!0}},setup(t,{expose:a}){const{t:r}=ne(),o=C(null),u=C(null),d=C(null),f=C(!1),b=C(!1),m=C(!1),p=C(!1),v=C(),y=t,k=x({clientWidth:0,scrollWidth:0,scrollLeft:0}),_=x({thumbLeft:0,startScrollLeft:0,startThumbLeft:0,startPageX:0});j(k,e=>{T(e)}),j(()=>y.isScrollButton,()=>T(k));const T=e=>{const t=e.scrollWidth>e.clientWidth;b.value=e.scrollLeft<=10,m.value=e.clientWidth+e.scrollLeft-e.scrollWidth>=-10,p.value=y.isScrollButton&&t},A=n(()=>k.scrollWidth>k.clientWidth),R=n(()=>{if(!A.value)return 0;const{clientWidth:e,scrollWidth:t}=k;return e/t*e}),P=n(()=>{if(!A.value)return 0;const{clientWidth:e,scrollWidth:t,scrollLeft:a}=k;return(e-R.value)*(a/(t-e))}),L=()=>{if(!o.value)return;const{clientWidth:e,scrollWidth:t,scrollLeft:a}=o.value;Object.assign(k,{clientWidth:e,scrollWidth:t,scrollLeft:a})},M=()=>{const e=o.value?.querySelector(".stack-tab__item.is-active");e&&!H(e)&&U(e)};let O=null,V=null;const W=(e,t=!0)=>{de({wrap:o.value,left:e,top:0,smooth:t})},B=e=>{W(o.value.scrollLeft+e)},D=e=>{if(!y.isScrollWheel||!o.value)return;const t=e.deltaY<0;W(o.value.scrollLeft+(t?-y.space:y.space))},$=e=>{Object.assign(_,{startPageX:e.pageX,startScrollLeft:o.value?.scrollLeft,startThumbLeft:P.value,thumbLeft:P.value}),f.value=!0,document.addEventListener("mousemove",z),document.addEventListener("mouseup",G)},z=e=>{const{clientWidth:t,scrollWidth:a}=k;let r=_.startThumbLeft+e.pageX-_.startPageX;const o=t-R.value;r<0?r=0:r>o&&(r=o),_.thumbLeft=r,W(r*(a-t)/(t-R.value),!1),e.preventDefault()},G=()=>{f.value=!1,document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",G)};w(()=>{if("undefined"==typeof ResizeObserver)return;O=new ResizeObserver(()=>{L(),M()}),V=new ResizeObserver(()=>{A.value||M(),L()}),v.value&&O.observe(v.value);const e=o.value?.querySelector(".stack-tab__nav");e&&V.observe(e)}),S(()=>{O?.disconnect(),V?.disconnect(),O=null,V=null});const U=e=>{!function({el:e,wrap:t,block:a="start",inline:r="nearest"}){const o=t&&"object"==typeof t&&"value"in t?t.value:t;if(e&&o)if(e.scrollIntoView)e.scrollIntoView({behavior:"smooth",block:a,inline:r});else{const{offsetLeft:t,offsetTop:n}=e;let l,s;s="center"===a?n+(e.clientHeight-o.clientHeight)/2:n,l="center"===r?t+(e.clientWidth-o.clientWidth)/2:t,de({wrap:o,left:l,top:s})}}({el:e,wrap:o.value,block:"end",inline:"center"})},H=e=>{if(!A.value)return!0;const t=e.offsetLeft,a=o.value.scrollLeft;return!(t<a||t+e.clientWidth>a+o.value.clientWidth)};return a({scrollIntoView:U,isInView:H}),(a,n)=>(I(),i(e,null,[p.value?(I(),l(vt,{key:0,"icon-class":"stack-tab__icon-left-arrow",disabled:b.value,title:q(r)("VueStackTab.scrollLeft"),"aria-label":q(r)("VueStackTab.scrollLeft"),onClick:n[0]||(n[0]=e=>!b.value&&B(-1*t.space))},null,8,["disabled","title","aria-label"])):s("",!0),c("div",{ref_key:"headerScroll",ref:v,class:"stack-tab__scroll",onWheelPassive:D},[c("div",{ref_key:"container",ref:o,class:h(["stack-tab__scroll-container",{"stack-tab__shadow-inset-left":!b.value&&m.value,"stack-tab__shadow-inset-right":!m.value&&b.value,"stack-tab__shadow-inset-all":!b.value&&!m.value}]),onScrollPassive:L},[E(a.$slots,"default")],34),N(c("div",{ref_key:"bar",ref:u,class:h(["stack-tab__scrollbar",{"is-dragging":f.value}])},[c("div",{ref_key:"thumb",ref:d,class:h(["stack-tab__scrollbar-thumb",{"is-dragging":f.value}]),style:g({width:`${R.value}px`,transform:`translateX(${P.value}px)`}),onMousedown:K($,["prevent"])},null,38)],2),[[F,A.value]])],544),p.value?(I(),l(vt,{key:1,"icon-class":"stack-tab__icon-right-arrow",disabled:m.value,title:q(r)("VueStackTab.scrollRight"),"aria-label":q(r)("VueStackTab.scrollRight"),onClick:n[1]||(n[1]=e=>!m.value&&B(t.space))},null,8,["disabled","title","aria-label"])):s("",!0)],64))}}),gt=/* @__PURE__ */d({__name:"index",props:{space:{},tabScrollMode:{default:Se.BOTH},tabTransition:{default:()=>({name:"stack-tab-zoom"})},contextmenu:{type:[Boolean,Object],default:!0},max:{default:20}},emits:["active"],setup(t,{emit:o}){const{t:c}=ne(),d=m(We,C(!1)),f=o,b=C(),h=C(),{shown:g,contextMenuData:y,showContextMenu:k}=(()=>{const e=x({item:{},index:-1,left:0,top:0,max:0}),t=C(!1),a=e=>{e.target.closest?.(".stack-tab__contextmenu")||(t.value=!1,document.removeEventListener("click",a))};return S(()=>{document.removeEventListener("click",a)}),{shown:t,contextMenuData:e,showContextMenu:async(r,o,n,l)=>{t.value=!1,document.removeEventListener("click",a),await v(()=>{const{clientY:s,clientX:i}=r;t.value=!0,Object.assign(e,{item:o,index:n,top:s,left:i,max:l}),v(()=>document.addEventListener("click",a))})}}})(),_=C(null),T=()=>{g.value=!1},w=t,{closeTab:A,activeTab:R,tabs:L}=tt(),M=n(()=>!1!==w.contextmenu),O=n(()=>Array.isArray(w.contextmenu)?w.contextmenu:[]),V=(e,t,a,r)=>{M.value&&(e.preventDefault(),_.value=(e=>{const t=(e.target instanceof Element?e.target:null)?.closest('[role="tab"]');return t||((e.currentTarget instanceof HTMLElement?e.currentTarget:null)?.querySelector('[role="tab"]')??null)})(e),k(e,t,a,r))},W=n(()=>"string"==typeof w.tabTransition?{name:w.tabTransition}:w.tabTransition),B=e=>{const t=L.value[e];var a;t&&(z(t,void 0,!0),a=String(t.id),v(()=>{const e=h.value?.querySelector(`.stack-tab__nav [role="tab"][data-tab-id="${CSS.escape(a)}"]`);e&&(e.focus(),b.value&&!b.value.isInView(e)&&b.value.scrollIntoView(e))}))},F=e=>{const t=L.value.length;if(t<=0)return;const a=L.value.findIndex(e=>e.active),r=a>=0?a:0;return"ArrowRight"===e.key?(e.preventDefault(),void B((r+1)%t)):"ArrowLeft"===e.key?(e.preventDefault(),void B((r-1+t)%t)):"Home"===e.key?(e.preventDefault(),void B(0)):void("End"===e.key&&(e.preventDefault(),B(t-1)))},j=n(()=>w.tabScrollMode===Se.BOTH||w.tabScrollMode===Se.BUTTON),N=n(()=>w.tabScrollMode===Se.BOTH||w.tabScrollMode===Se.WHEEL),$=e=>{e.closable&&A(e.id),g.value=!1},z=(e,t,a)=>{b.value&&t&&v(()=>{b.value.isInView(t)||b.value.scrollIntoView(t)}),Promise.resolve(R(e.id,a)).then(()=>f("active",e.id)).catch(e=>{})};return(o,n)=>(I(),i("div",{ref_key:"headerRef",ref:h,class:"stack-tab__header"},[E(o.$slots,"leftButton"),u(ht,{ref_key:"scrollContainerRef",ref:b,space:t.space,"is-scroll-wheel":N.value,"is-scroll-button":j.value},{default:D(()=>[u(r,p({key:"tab-list-transition",tag:"ul",class:"stack-tab__nav",role:"tablist","aria-orientation":"horizontal"},W.value,{appear:"",onKeydown:F}),{default:D(()=>[(I(!0),i(e,null,P(q(L),(e,t)=>(I(),l(bt,{key:e.id,item:e,onContextmenu:a=>V(a,e,t,q(L).length),onMouseup:K(t=>$(e),["middle","prevent"]),onClose:$,onActive:z},null,8,["item","onContextmenu","onMouseup"]))),128))]),_:1},16)]),_:1},8,["space","is-scroll-wheel","is-scroll-button"]),E(o.$slots,"rightButton"),u(vt,{"icon-class":q(d)?"stack-tab__icon-restore":"stack-tab__icon-fullscreen",title:q(d)?q(c)("VueStackTab.restore"):q(c)("VueStackTab.maximum"),"aria-label":q(d)?q(c)("VueStackTab.restore"):q(c)("VueStackTab.maximum"),onClick:n[0]||(n[0]=e=>d.value=!q(d))},null,8,["icon-class","title","aria-label"]),u(a,{name:"stack-tab-zoom",appear:""},{default:D(()=>[q(g)?(I(),l(lt,{key:"context-menu-transition",left:q(y).left,top:q(y).top,"tab-item":q(y).item,max:q(y).max,index:q(y).index,"context-menu":O.value,"restore-focus-element":_.value,onClose:T},null,8,["left","top","tab-item","max","index","context-menu","restore-focus-element"])):s("",!0)]),_:1})],512))}}),yt=/* @__PURE__ */d({__name:"StackCacheRenderer",props:{route:{},component:{}},setup(e){const t=e,{refreshKey:a,activeCacheKey:r,activePageRefreshVersion:o,addPage:n}=et(),l=O(d({name:"StackCacheRendererEmpty",setup:()=>()=>null}));return j([()=>t.route.fullPath,()=>{return e=t.component,e?.type??e;var e},()=>a.value],()=>{l.value=n(t.route,t.component)},{immediate:!0}),(t,n)=>E(t.$slots,"default",{wrappedComponent:l.value,activeCacheKey:q(r),refreshKey:q(a),activePageRefreshVersion:q(o),component:e.component})}}),kt=/* @__PURE__ */d({__name:"StackKeepAlive",props:{transitionName:{default:"stack-tab-swap"}},emits:["loaded"],setup(e,{emit:r}){const o=r,{caches:n}=et(),s=()=>{o("loaded")};return(r,o)=>{const i=L("router-view");return I(),l(i,null,{default:D(({Component:r,route:o})=>[u(yt,{route:o,component:r},{default:D(({wrappedComponent:r,activeCacheKey:o,activePageRefreshVersion:i,component:c})=>[u(a,{name:e.transitionName,appear:"",mode:"out-in"},{default:D(()=>[(I(),l(t,{include:q(n)},[(I(),l(M(r),{key:`${o}-${i}`,vnode:c,onOnLoaded:s},null,40,["vnode"]))],1032,["include"]))]),_:2},1032,["name"])]),_:1},8,["route","component"])]),_:1})}}}),_t=new Set(["vue-stack-tabs:openTab","openTab"]),Tt=e=>"string"==typeof e||"number"==typeof e||null==e,wt=e=>"boolean"==typeof e?e:void 0,St=e=>{if(!Pe(e))return null;const{id:t,title:a,path:r,query:o,iframe:n,closable:l,refreshable:s,iframeRefreshMode:i}=e;if("string"!=typeof a||""===a.trim())return null;if("string"!=typeof r||""===r.trim()||!pe(r))return null;const c=(e=>{if(!Pe(e))return;const t={};for(const[a,r]of Object.entries(e))(Tt(r)||Array.isArray(r)&&r.every(Tt))&&(t[a]=r);return Object.keys(t).length>0?t:void 0})(o),u=wt(n),d=wt(l),f=wt(s),b=(e=>{if("reload"===e||"postMessage"===e)return e})(i);return{..."string"==typeof t&&t?{id:t}:{},title:a,path:r,...c?{query:c}:{},...void 0!==u?{iframe:u}:{},...void 0!==d?{closable:d}:{},...void 0!==f?{refreshable:f}:{},...b?{iframeRefreshMode:b}:{}}};function It(e){const{tabs:t,iframeRefreshKeys:a,iframeLoadTimeout:r,t:o}=e,l=n(()=>t.value.filter(e=>e.iframe)),s=n(()=>t.value.find(e=>e.active&&!e.iframe)),i=n(()=>Boolean(s.value)),c=x({}),u=e=>a.value[e]??0,d=(e,t=u(e.id))=>{const a=ve(e.url??"");return((e,t)=>{if(t<=0||"about:blank"===e)return e;const a=e.indexOf("#"),r=a>=0?e.slice(0,a):e,o=a>=0?e.slice(a):"",n=r.indexOf("?"),l=n>=0?r.slice(0,n):r,s=n>=0?r.slice(n+1):"",i=new URLSearchParams(s);return i.set("__stack_tabs_refresh",String(t)),`${l}?${i.toString()}${o}`})(c[e.id]?a:"about:blank",t)},f=n(()=>{const e={};for(const t of l.value){const a=u(t.id);e[t.id]=d(t,a)}return e}),b=x({}),m=e=>b[e]??{status:"idle"},p=/* @__PURE__ */new Map,v=e=>{const t=p.get(e);t&&(clearTimeout(t),p.delete(e))},h=(e,t={})=>{("loaded"!==m(e).status||t.force)&&(v(e),b[e]={status:"loading"},p.set(e,setTimeout(()=>{p.delete(e),"loading"===m(e).status&&(b[e]={status:"timeout",message:o("VueStackTab.iframeLoadTimeout")})},r)))},g=x({});j(()=>l.value.map(e=>({id:e.id,active:e.active})),e=>{for(const a of e)a.active&&(c[a.id]=!0,h(a.id));const t=new Set(e.map(e=>e.id));for(const a of Object.keys(b))t.has(a)||(v(a),delete b[a],delete c[a],delete g[a])},{immediate:!0}),j(a,(e,t={})=>{for(const a of l.value)a.active&&(e[a.id]??0)!==(t[a.id]??0)&&h(a.id,{force:!0})},{deep:!0});return _(()=>{for(const e of p.values())clearTimeout(e);p.clear()}),{iframeTabs:l,activeNonIframeTab:s,hasActiveNonIframeTab:i,iframeSrcMap:f,getIframeRefreshKey:u,getIframeKey:e=>`${e.id}-${u(e.id)}`,getIframeLoadState:m,shouldShowIframeLoading:e=>"loading"===m(e).status,shouldShowIframeError:e=>"timeout"===m(e).status,retryIframe:e=>{b[e]={status:"idle"},a.value={...a.value,[e]:(a.value[e]??0)+1},h(e,{force:!0})},setIframeRef:(e,t)=>{t?g[e]=t:delete g[e]},handleIframeLoad:(e,t)=>{const a=t.currentTarget,r=Number(a?.dataset.refreshKey??0);var o;c[e.id]&&("about:blank"!==d(e,r)&&r===u(e.id)&&a===g[e.id]&&(o=e.id,v(o),b[o]={status:"loaded"}))},handleRefreshIframePostMessage:e=>{const a=g[e],r=t.value.find(t=>t.id===e);if(a?.contentWindow)try{const e=((e,t)=>{if(!e||!pe(e))return null;try{const a=t??("undefined"!=typeof window?window.location.origin:void 0);if(!a&&!/^https?:\/\//i.test(e))return null;const r=new URL(e,a);if("http:"===r.protocol||"https:"===r.protocol)return r.origin}catch{return null}return null})(r?.url??"");if(!e)return;a.contentWindow.postMessage({type:"vue-stack-tabs:refresh"},e)}catch(o){}},createMessageHandler:(e,t)=>{const a=e=>Object.values(g).some(t=>t?.contentWindow===e);return r=>{if(!e.value.includes(r.origin))return;const o=((e,t)=>{if(!t(e.source))return null;if(!Pe(e.data))return null;const a=e.data;return"string"==typeof a.type&&_t.has(a.type)?St(a.payload):null})(r,a);o&&t(o).catch(e=>{})}}}}var At={class:"stack-tab__container"},xt=["id","role","aria-labelledby","aria-hidden","hidden"],Rt={class:"stack-tab__iframes"},Ct=["id","aria-labelledby"],Pt=["aria-label"],Et={class:"stack-tab__iframe-loading-text"},Lt={key:1,class:"stack-tab__iframe-error",role:"alert"},Mt={class:"stack-tab__iframe-error-text"},Ot=["onClick"],Vt=["onClick"],Wt=["src","data-refresh-key","title","sandbox","referrerpolicy","allow","onLoad"],Bt=/* @__PURE__ */d({__name:"StackTabs",props:{defaultTabs:{default:()=>[]},max:{default:20},contextmenu:{type:[Boolean,Object],default:!0},pageTransition:{default:"stack-tab-swap"},pageTransitionBack:{default:"stack-tab-swap-back"},tabTransition:{default:"stack-tab-zoom"},tabScrollMode:{default:Se.BOTH},width:{default:"100%"},height:{default:"100%"},i18n:{default:void 0},space:{default:300},globalScroll:{type:Boolean,default:!1},iframePath:{},sessionPrefix:{default:""},iframeAllowedOrigins:{default:()=>[]},iframeSandbox:{default:"allow-scripts allow-forms allow-popups allow-downloads allow-same-origin"},iframeReferrerPolicy:{default:"strict-origin-when-cross-origin"},iframeAllow:{default:""},iframeLoadTimeout:{default:15e3}},emits:["onActive","onPageLoaded"],setup(t,{emit:r}){const o=r,d=t,{changeLocale:b,t:p}=ne(),v=m(Ve,null)??je({iframePath:d.iframePath,maxTabCount:d.max,useGlobalScroll:d.globalScroll,sessionPrefix:d.sessionPrefix}),y=f()?.appContext.app,T=((e,t={})=>{if(Be||(Be=e),t.app&&!Fe.has(t.app))return Fe.add(t.app),!0;if(!t.app&&Be===e&&!qe)return qe=!0,!0;if(t.isProduction??1)return!1;throw new Error("VueStackTabs only supports one <VueStackTabs> instance per Vue app.")})(v,y?{app:y}:void 0);T&&(A(Ve,v),A(Ke,v.eventBus));const w=C(!1),S=C();T&&A(We,w),j(w,e=>{S.value=e?fe("body *:not(.stack-tab,.stack-tab *)"):void 0});const{tabs:x,iframeRefreshKeys:R,destroy:L,initialize:M,setMaxSize:O,setGlobalScroll:W,setSessionPrefix:B}=T?et():{tabs:v.tabs,iframeRefreshKeys:v.iframeRefreshKeys,destroy:()=>{},initialize:()=>{},setMaxSize:()=>{},setGlobalScroll:()=>{},setSessionPrefix:()=>{}},{setIFramePath:K,openTab:$,openInNewWindow:z}=T?tt():{setIFramePath:()=>{},openTab:()=>Promise.resolve(void 0),openInNewWindow:()=>{}};T&&(K(d.iframePath),W(d.globalScroll),O(d.max),((e,t)=>{t&&e(t)})(b,d.i18n));const G=e=>{o("onActive",e)},U=()=>{o("onPageLoaded")},H=C(d.pageTransition),X=v.eventBus,J=()=>{H.value=d.pageTransition},Y=()=>{H.value=d.pageTransitionBack};T&&(X.on(Ne.FORWARD,J),X.on(Ne.BACKWARD,Y));const{iframeTabs:Q,activeNonIframeTab:Z,hasActiveNonIframeTab:ee,iframeSrcMap:te,getIframeRefreshKey:ae,getIframeKey:re,getIframeLoadState:oe,shouldShowIframeLoading:le,shouldShowIframeError:se,retryIframe:ie,setIframeRef:ce,handleIframeLoad:ue,handleRefreshIframePostMessage:de,createMessageHandler:be}=It({tabs:x,iframeRefreshKeys:R,iframeLoadTimeout:d.iframeLoadTimeout,t:p}),me=be(n(()=>["undefined"!=typeof window?window.location.origin:"",...d.iframeAllowedOrigins??[]].filter(Boolean)),$);return T&&X.on(Ne.REFRESH_IFRAME_POSTMESSAGE,de),k(()=>{T&&(B(d.sessionPrefix),M(d.defaultTabs),window.addEventListener("message",me))}),_(()=>{T&&(window.removeEventListener("message",me),X.off(Ne.REFRESH_IFRAME_POSTMESSAGE,de),X.off(Ne.FORWARD,J),X.off(Ne.BACKWARD,Y),L(),((e,t={})=>{t.app&&Fe.delete(t.app),t.app||Be!==e||(qe=!1),Be===e&&(Be=null)})(v,y?{app:y}:void 0))}),(r,o)=>q(T)?(I(),i("div",{key:0,class:h(["stack-tab",{"stack-tab__maximum":w.value}]),style:g({width:t.width,height:t.height,"z-index":S.value})},[u(gt,{space:t.space,"tab-transition":t.tabTransition,"tab-scroll-mode":t.tabScrollMode,contextmenu:t.contextmenu,max:t.max,onActive:G},{leftButton:D(()=>[E(r.$slots,"leftButton")]),rightButton:D(()=>[E(r.$slots,"rightButton")]),_:3},8,["space","tab-transition","tab-scroll-mode","contextmenu","max"]),c("div",At,[u(a,{name:H.value,appear:""},{default:D(()=>[N((I(),i("div",{id:q(Z)?q(it)(q(Z).id):void 0,key:"keep-alive",class:"stack-tab__keep-alive-panel",role:q(Z)?"tabpanel":void 0,"aria-labelledby":q(Z)?q(st)(q(Z).id):void 0,"aria-hidden":q(Z)?void 0:"true",hidden:!q(ee)},[u(kt,{"transition-name":H.value,onLoaded:U},null,8,["transition-name"])],8,xt)),[[F,q(ee)]])]),_:1},8,["name"]),c("div",Rt,[(I(!0),i(e,null,P(q(Q),e=>(I(),l(a,{key:q(re)(e),name:H.value,appear:""},{default:D(()=>[N((I(),i("div",{id:q(it)(e.id),key:q(re)(e),class:"stack-tab__iframe-wrapper",role:"tabpanel","aria-labelledby":q(st)(e.id)},[q(le)(e.id)?(I(),i("div",{key:0,class:"stack-tab__iframe-loading",role:"status","aria-live":"polite","aria-label":q(p)("VueStackTab.loading")},[E(r.$slots,"iframeLoading",{tab:e},()=>[c("span",Et,V(q(p)("VueStackTab.loading")),1)])],8,Pt)):s("",!0),q(se)(e.id)?(I(),i("div",Lt,[E(r.$slots,"iframeError",{tab:e,retry:q(ie)},()=>[c("span",Mt,V(q(oe)(e.id).message??q(p)("VueStackTab.iframeLoadTimeout")),1),c("button",{type:"button",class:"stack-tab__iframe-error-retry",onClick:t=>q(ie)(e.id)},V(q(p)("VueStackTab.retry")),9,Ot),e.url&&q(pe)(e.url)?(I(),i("button",{key:0,type:"button",class:"stack-tab__iframe-error-open",onClick:t=>q(z)(e.id)},V(q(p)("VueStackTab.openInNewWindow")),9,Vt)):s("",!0)])])):s("",!0),c("iframe",{ref_for:!0,ref:t=>q(ce)(e.id,t),class:"stack-tab__iframe",src:q(te)[e.id]||"about:blank","data-refresh-key":q(ae)(e.id),title:e.title||q(p)("VueStackTab.iframeTitle")||"Stack tab iframe",sandbox:t.iframeSandbox||void 0,referrerpolicy:t.iframeReferrerPolicy,allow:t.iframeAllow||void 0,frameborder:"0",onLoad:t=>q(ue)(e,t)},null,40,Wt)],8,Ct)),[[F,e.active]])]),_:2},1032,["name"]))),128))])])],6)):s("",!0)}}),qt=(e,t)=>{e.clear();for(const a of t)e.push(_e(a))};function Ft(){const{attrs:e,props:t}=f(),a=e.tId??t.tId,r=e.pId??t.pId,o=z(),n=G(),l=$e(),{getTab:s,evictPageCache:i,addPageScroller:c,active:u}=et(),d=o.query.__tab;let b=0;return{forward:e=>{const t=s(a),r=e.query||{};if(t){const a=t.pages.peek();if(a&&a.path===e.path&&Te(r,a.query||{}))return void(t.active||u(t.id))}const o=Ce({__tab:d},e.query),i=++b;l.emit(Ne.FORWARD);let c="";Ue({apply:()=>{const a=t?t.pages.readonlyList().map(e=>_e(e)):[];return t&&(c=Oe(),t.pages.push({id:c,tabId:t.id,path:e.path,query:ke(r)})),a},navigate:()=>n.push({path:e.path,query:o}),rollback:e=>{t&&qt(t.pages,e)},isFailureResult:$,isCurrent:()=>b===i,cleanupStale:()=>{if(!t||!c)return;const e=t.pages.list().filter(e=>e.id!==c);qt(t.pages,e)}}).catch(e=>{})},backward:(e,t)=>{const r=s(a);if(!r)return!1;const o=r.pages;let c=0;if("number"==typeof e)c=Math.abs(e);else{const t=ye(e),a=t.query||{},r=o.readonlyList();let n=!1;for(let e=o.size()-2;e>=0;e--){c++;const o=r[e];if(o?.path===t.path&&Te(a,o?.query||{})){n=!0;break}}if(!n)return!1}if(c<=0)return!1;if(o.size()<=c&&(c=o.size()-1),c<=0)return!1;const u=o.readonlyList().map(e=>_e(e)),f=[];for(let a=0;a<c;a++){const e=o.pop();e&&f.push(e.id)}const m=o.peek();if(!m)return qt(o,u),!1;t&&(m._backParams=t),l.emit(Ne.BACKWARD);const p=Ce({__tab:d},m.query||{}),v=++b;return Ue({apply:()=>u,navigate:()=>n.push({path:m.path,query:p}),rollback:e=>qt(o,e),isFailureResult:$,isCurrent:()=>b===v,commit:()=>{for(const e of f)i(e)},cleanupStale:()=>{const e=new Set(o.list().map(e=>e.id));for(const t of f)e.has(t)||i(t)}}).catch(e=>{}),!0},addScrollTarget:(...e)=>{c(r,...e)}}}var jt=/* @__PURE__ */d({__name:"iframe",setup:e=>(Ft(),()=>{})}),Dt=()=>{const e=$e(),{attrs:t}=f(),a=()=>String(t.tId??"");S(()=>{r()});const r=()=>{e.emit(Ne.PAGE_LOADING,{tId:a(),value:!1})};return{openTabLoading:()=>{e.emit(Ne.PAGE_LOADING,{tId:a(),value:!0})},closeTabLoading:r}},Nt="vue-stack-tabs:refresh",Kt="vue-stack-tabs:openTab";function $t(e,t={}){"undefined"!=typeof window&&window.parent&&window.parent.postMessage({type:Kt,payload:e},t.targetOrigin??window.location.origin)}function zt(e=()=>window.location.reload(),t={}){if("undefined"==typeof window)return()=>{};const a=t.allowedOrigins??[],r=t=>{t.source===window.parent&&(a.length>0&&!a.includes(t.origin)||"vue-stack-tabs:refresh"===t.data?.type&&e())};return window.addEventListener("message",r),()=>window.removeEventListener("message",r)}var Gt={install(e,t){var a;a="1.3.0","undefined"!=typeof window&&window.console.log("%c vue-stack-tabs %c v"+a+" %c","background:#306fff; padding:2px 8px; border-radius:3px 0 0 3px; color:#fff;","background:#00d797; padding:2px 8px; border-radius:0 3px 3px 0; color:#fff;","background:transparent");const r=je();e.provide(Ve,r),e.provide(Ke,r.eventBus),e.component("VueStackTabs",Bt).use(ue().getI18n(t))}};export{jt as IFrame,Kt as MSG_OPEN_TAB,Nt as MSG_REFRESH,Ie as Stack,Bt as StackTab,Bt as VueStackTabs,vt as TabHeaderButton,Se as TabScrollMode,Gt as default,zt as onRefreshRequest,$t as postOpenTab,tt as useTabActions,Dt as useTabLoading,Ft as useTabRouter};