@oiij/chrome-tabs 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,554 +1,14 @@
1
- (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@oiij/chrome-tabs"] = {}, global.Vue));
3
- })(this, function(exports2, vue) {
4
- "use strict";
5
- function tryOnScopeDispose(fn) {
6
- if (vue.getCurrentScope()) {
7
- vue.onScopeDispose(fn);
8
- return true;
9
- }
10
- return false;
11
- }
12
- const isClient = typeof window !== "undefined" && typeof document !== "undefined";
13
- typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
14
- const noop = () => {
15
- };
16
- function createFilterWrapper(filter, fn) {
17
- function wrapper(...args) {
18
- return new Promise((resolve, reject) => {
19
- Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);
20
- });
21
- }
22
- return wrapper;
23
- }
24
- function debounceFilter(ms, options = {}) {
25
- let timer;
26
- let maxTimer;
27
- let lastRejector = noop;
28
- const _clearTimeout = (timer2) => {
29
- clearTimeout(timer2);
30
- lastRejector();
31
- lastRejector = noop;
32
- };
33
- let lastInvoker;
34
- const filter = (invoke) => {
35
- const duration = vue.toValue(ms);
36
- const maxDuration = vue.toValue(options.maxWait);
37
- if (timer)
38
- _clearTimeout(timer);
39
- if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
40
- if (maxTimer) {
41
- _clearTimeout(maxTimer);
42
- maxTimer = null;
43
- }
44
- return Promise.resolve(invoke());
45
- }
46
- return new Promise((resolve, reject) => {
47
- lastRejector = options.rejectOnCancel ? reject : resolve;
48
- lastInvoker = invoke;
49
- if (maxDuration && !maxTimer) {
50
- maxTimer = setTimeout(() => {
51
- if (timer)
52
- _clearTimeout(timer);
53
- maxTimer = null;
54
- resolve(lastInvoker());
55
- }, maxDuration);
56
- }
57
- timer = setTimeout(() => {
58
- if (maxTimer)
59
- _clearTimeout(maxTimer);
60
- maxTimer = null;
61
- resolve(invoke());
62
- }, duration);
63
- });
64
- };
65
- return filter;
66
- }
67
- function getLifeCycleTarget(target) {
68
- return vue.getCurrentInstance();
69
- }
70
- function toArray(value) {
71
- return Array.isArray(value) ? value : [value];
72
- }
73
- function useDebounceFn(fn, ms = 200, options = {}) {
74
- return createFilterWrapper(
75
- debounceFilter(ms, options),
76
- fn
77
- );
78
- }
79
- function tryOnMounted(fn, sync = true, target) {
80
- const instance = getLifeCycleTarget();
81
- if (instance)
82
- vue.onMounted(fn, target);
83
- else if (sync)
84
- fn();
85
- else
86
- vue.nextTick(fn);
87
- }
88
- const defaultWindow = isClient ? window : void 0;
89
- function unrefElement(elRef) {
90
- var _a;
91
- const plain = vue.toValue(elRef);
92
- return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
93
- }
94
- function useMounted() {
95
- const isMounted = vue.ref(false);
96
- const instance = vue.getCurrentInstance();
97
- if (instance) {
98
- vue.onMounted(() => {
99
- isMounted.value = true;
100
- }, instance);
101
- }
102
- return isMounted;
103
- }
104
- function useSupported(callback) {
105
- const isMounted = useMounted();
106
- return vue.computed(() => {
107
- isMounted.value;
108
- return Boolean(callback());
109
- });
110
- }
111
- function useResizeObserver(target, callback, options = {}) {
112
- const { window: window2 = defaultWindow, ...observerOptions } = options;
113
- let observer;
114
- const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
115
- const cleanup = () => {
116
- if (observer) {
117
- observer.disconnect();
118
- observer = void 0;
119
- }
120
- };
121
- const targets = vue.computed(() => {
122
- const _targets = vue.toValue(target);
123
- return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
124
- });
125
- const stopWatch = vue.watch(
126
- targets,
127
- (els) => {
128
- cleanup();
129
- if (isSupported.value && window2) {
130
- observer = new ResizeObserver(callback);
131
- for (const _el of els) {
132
- if (_el)
133
- observer.observe(_el, observerOptions);
134
- }
135
- }
136
- },
137
- { immediate: true, flush: "post" }
138
- );
139
- const stop = () => {
140
- cleanup();
141
- stopWatch();
142
- };
143
- tryOnScopeDispose(stop);
144
- return {
145
- isSupported,
146
- stop
147
- };
148
- }
149
- function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
150
- const { window: window2 = defaultWindow, box = "content-box" } = options;
151
- const isSVG = vue.computed(() => {
152
- var _a, _b;
153
- return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
154
- });
155
- const width = vue.ref(initialSize.width);
156
- const height = vue.ref(initialSize.height);
157
- const { stop: stop1 } = useResizeObserver(
158
- target,
159
- ([entry]) => {
160
- const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
161
- if (window2 && isSVG.value) {
162
- const $elem = unrefElement(target);
163
- if ($elem) {
164
- const rect = $elem.getBoundingClientRect();
165
- width.value = rect.width;
166
- height.value = rect.height;
167
- }
168
- } else {
169
- if (boxSize) {
170
- const formatBoxSize = toArray(boxSize);
171
- width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
172
- height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
173
- } else {
174
- width.value = entry.contentRect.width;
175
- height.value = entry.contentRect.height;
176
- }
177
- }
178
- },
179
- options
180
- );
181
- tryOnMounted(() => {
182
- const ele = unrefElement(target);
183
- if (ele) {
184
- width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
185
- height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
186
- }
187
- });
188
- const stop2 = vue.watch(
189
- () => unrefElement(target),
190
- (ele) => {
191
- width.value = ele ? initialSize.width : 0;
192
- height.value = ele ? initialSize.height : 0;
193
- }
194
- );
195
- function stop() {
196
- stop1();
197
- stop2();
198
- }
199
- return {
200
- width,
201
- height,
202
- stop
203
- };
204
- }
205
- function useInjectionKey(key) {
206
- return Symbol(key);
207
- }
208
- function useScrollView(options) {
209
- const { activeClassName = ".active", enableWheel = true } = options || {};
210
- const scrollRef = vue.ref();
211
- const { width } = useElementSize(scrollRef);
212
- async function scrollToView() {
213
- var _a;
214
- if (!scrollRef.value)
215
- return;
216
- await vue.nextTick();
217
- const activeEl = (_a = scrollRef.value) == null ? void 0 : _a.children[0].querySelector(activeClassName);
218
- if (!activeEl)
219
- return;
220
- activeEl.scrollIntoView({
221
- behavior: "smooth",
222
- block: "nearest",
223
- inline: "nearest"
224
- });
225
- }
226
- function wheelEvent(e2) {
227
- var _a, _b;
228
- const { deltaY } = e2;
229
- if (deltaY > 0) {
230
- (_a = scrollRef.value) == null ? void 0 : _a.scrollBy({
231
- top: 0,
232
- left: width.value,
233
- behavior: "smooth"
234
- });
235
- } else {
236
- (_b = scrollRef.value) == null ? void 0 : _b.scrollBy({
237
- top: 0,
238
- left: -width.value,
239
- behavior: "smooth"
240
- });
241
- }
242
- }
243
- function init() {
244
- if (!scrollRef.value || !enableWheel)
245
- return;
246
- scrollRef.value.addEventListener("wheel", wheelEvent);
247
- }
248
- function destroy() {
249
- var _a;
250
- (_a = scrollRef.value) == null ? void 0 : _a.removeEventListener("wheel", wheelEvent);
251
- }
252
- const debouncedScrollToView = useDebounceFn(scrollToView, 500);
253
- vue.watch(width, () => {
254
- debouncedScrollToView();
255
- });
256
- vue.onBeforeUnmount(() => {
257
- destroy();
258
- });
259
- vue.onMounted(() => {
260
- scrollToView();
261
- init();
262
- });
263
- return {
264
- scrollRef,
265
- scrollToView
266
- };
267
- }
268
- const _hoisted_1$1 = { class: "uno-iyw1ix" };
269
- const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
270
- __name: "TabItem",
271
- props: {
272
- name: {},
273
- disabled: { type: Boolean },
274
- closeable: { type: Boolean },
275
- showLine: { type: Boolean },
276
- icon: { type: [Function, String] },
277
- loading: { type: Boolean },
278
- loadingRender: { type: Function, default: () => vue.h("i", { class: "i-line-md-loading-twotone-loop", style: { width: `16px`, height: `16px` } }) }
279
- },
280
- emits: ["close", "click", "contextmenu"],
281
- setup(__props, { emit: __emit }) {
282
- const emit = __emit;
283
- const { activeName, list, pushItem, removeItem, itemClick } = vue.inject(tabsBarInjectionKey) || {};
284
- const active = vue.computed(() => (activeName == null ? void 0 : activeName.value) === __props.name);
285
- const activeIndex = vue.computed(() => list == null ? void 0 : list.value.findIndex((f2) => f2 === (activeName == null ? void 0 : activeName.value)));
286
- const currentIndex = vue.computed(() => list == null ? void 0 : list.value.findIndex((f2) => f2 === __props.name));
287
- const showLine = vue.computed(() => (activeIndex == null ? void 0 : activeIndex.value) !== (currentIndex == null ? void 0 : currentIndex.value) && ((activeIndex == null ? void 0 : activeIndex.value) ?? 0) - 1 !== (currentIndex == null ? void 0 : currentIndex.value));
288
- function onClose() {
289
- removeItem == null ? void 0 : removeItem(__props.name);
290
- emit("close");
291
- }
292
- function onClick(ev) {
293
- itemClick == null ? void 0 : itemClick(__props.name);
294
- emit("click", ev);
295
- }
296
- function onContextMenu(ev) {
297
- emit("contextmenu", ev);
298
- }
299
- vue.onMounted(() => {
300
- pushItem == null ? void 0 : pushItem(__props.name);
301
- });
302
- return (_ctx, _cache) => {
303
- return vue.openBlock(), vue.createElementBlock("div", {
304
- class: vue.normalizeClass(["uno-ubq14l group", [active.value ? "tab-active" : "", _ctx.disabled ? "uno-4y9yog" : ""]]),
305
- onClick,
306
- onContextmenu: onContextMenu
307
- }, [
308
- vue.createElementVNode("div", {
309
- class: vue.normalizeClass(["uno-qjxywp", active.value ? "" : "uno-epu25o"])
310
- }, [
311
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loading ? _ctx.loadingRender : _ctx.icon))),
312
- vue.createElementVNode("div", _hoisted_1$1, [
313
- vue.renderSlot(_ctx.$slots, "default")
314
- ]),
315
- _ctx.closeable ? (vue.openBlock(), vue.createElementBlock("div", {
316
- key: 0,
317
- class: "uno-r1pbch",
318
- onClick: vue.withModifiers(onClose, ["stop"])
319
- }, _cache[0] || (_cache[0] = [
320
- vue.createElementVNode("i", { class: "uno-sjjwmq" }, null, -1)
321
- ]))) : vue.createCommentVNode("", true)
322
- ], 2),
323
- vue.createElementVNode("div", {
324
- class: vue.normalizeClass(["uno-mzsdgg", active.value ? "uno-h6cmdc" : "uno-m6t4oj"])
325
- }, _cache[1] || (_cache[1] = [
326
- vue.createStaticVNode('<svg width="10" height="10" class="uno-3sky1m"><path d="M 0 10 A 10 10 0 0 0 10 0 L 10 10 Z"></path></svg><div class="uno-nylnxp"></div><svg width="10" height="10" class="uno-3sky1m"><path d="M 0 0 A 10 10 0 0 0 10 10 L 0 10 Z"></path></svg>', 3)
327
- ]), 2),
328
- vue.createElementVNode("div", {
329
- class: vue.normalizeClass([showLine.value ? "uno-h6cmdc" : "uno-m6t4oj", "uno-wqscdb"])
330
- }, null, 2)
331
- ], 34);
332
- };
333
- }
334
- });
335
- var r = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, t = function(r2) {
336
- return "string" == typeof r2 ? r2.length > 0 : "number" == typeof r2;
337
- }, n = function(r2, t2, n2) {
338
- return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r2) / n2 + 0;
339
- }, e = function(r2, t2, n2) {
340
- return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r2 > n2 ? n2 : r2 > t2 ? r2 : t2;
341
- }, u = function(r2) {
342
- return (r2 = isFinite(r2) ? r2 % 360 : 0) > 0 ? r2 : r2 + 360;
343
- }, a = function(r2) {
344
- return { r: e(r2.r, 0, 255), g: e(r2.g, 0, 255), b: e(r2.b, 0, 255), a: e(r2.a) };
345
- }, o = function(r2) {
346
- return { r: n(r2.r), g: n(r2.g), b: n(r2.b), a: n(r2.a, 3) };
347
- }, i = /^#([0-9a-f]{3,8})$/i, s = function(r2) {
348
- var t2 = r2.toString(16);
349
- return t2.length < 2 ? "0" + t2 : t2;
350
- }, h = function(r2) {
351
- var t2 = r2.r, n2 = r2.g, e2 = r2.b, u2 = r2.a, a2 = Math.max(t2, n2, e2), o2 = a2 - Math.min(t2, n2, e2), i2 = o2 ? a2 === t2 ? (n2 - e2) / o2 : a2 === n2 ? 2 + (e2 - t2) / o2 : 4 + (t2 - n2) / o2 : 0;
352
- return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o2 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 };
353
- }, b = function(r2) {
354
- var t2 = r2.h, n2 = r2.s, e2 = r2.v, u2 = r2.a;
355
- t2 = t2 / 360 * 6, n2 /= 100, e2 /= 100;
356
- var a2 = Math.floor(t2), o2 = e2 * (1 - n2), i2 = e2 * (1 - (t2 - a2) * n2), s2 = e2 * (1 - (1 - t2 + a2) * n2), h2 = a2 % 6;
357
- return { r: 255 * [e2, i2, o2, o2, s2, e2][h2], g: 255 * [s2, e2, e2, i2, o2, o2][h2], b: 255 * [o2, o2, s2, e2, e2, i2][h2], a: u2 };
358
- }, g = function(r2) {
359
- return { h: u(r2.h), s: e(r2.s, 0, 100), l: e(r2.l, 0, 100), a: e(r2.a) };
360
- }, d = function(r2) {
361
- return { h: n(r2.h), s: n(r2.s), l: n(r2.l), a: n(r2.a, 3) };
362
- }, f = function(r2) {
363
- return b((n2 = (t2 = r2).s, { h: t2.h, s: (n2 *= ((e2 = t2.l) < 50 ? e2 : 100 - e2) / 100) > 0 ? 2 * n2 / (e2 + n2) * 100 : 0, v: e2 + n2, a: t2.a }));
364
- var t2, n2, e2;
365
- }, c = function(r2) {
366
- return { h: (t2 = h(r2)).h, s: (u2 = (200 - (n2 = t2.s)) * (e2 = t2.v) / 100) > 0 && u2 < 200 ? n2 * e2 / 100 / (u2 <= 100 ? u2 : 200 - u2) * 100 : 0, l: u2 / 2, a: t2.a };
367
- var t2, n2, e2, u2;
368
- }, l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, p = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, y = { string: [[function(r2) {
369
- var t2 = i.exec(r2);
370
- return t2 ? (r2 = t2[1]).length <= 4 ? { r: parseInt(r2[0] + r2[0], 16), g: parseInt(r2[1] + r2[1], 16), b: parseInt(r2[2] + r2[2], 16), a: 4 === r2.length ? n(parseInt(r2[3] + r2[3], 16) / 255, 2) : 1 } : 6 === r2.length || 8 === r2.length ? { r: parseInt(r2.substr(0, 2), 16), g: parseInt(r2.substr(2, 2), 16), b: parseInt(r2.substr(4, 2), 16), a: 8 === r2.length ? n(parseInt(r2.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
371
- }, "hex"], [function(r2) {
372
- var t2 = v.exec(r2) || m.exec(r2);
373
- return t2 ? t2[2] !== t2[4] || t2[4] !== t2[6] ? null : a({ r: Number(t2[1]) / (t2[2] ? 100 / 255 : 1), g: Number(t2[3]) / (t2[4] ? 100 / 255 : 1), b: Number(t2[5]) / (t2[6] ? 100 / 255 : 1), a: void 0 === t2[7] ? 1 : Number(t2[7]) / (t2[8] ? 100 : 1) }) : null;
374
- }, "rgb"], [function(t2) {
375
- var n2 = l.exec(t2) || p.exec(t2);
376
- if (!n2) return null;
377
- var e2, u2, a2 = g({ h: (e2 = n2[1], u2 = n2[2], void 0 === u2 && (u2 = "deg"), Number(e2) * (r[u2] || 1)), s: Number(n2[3]), l: Number(n2[4]), a: void 0 === n2[5] ? 1 : Number(n2[5]) / (n2[6] ? 100 : 1) });
378
- return f(a2);
379
- }, "hsl"]], object: [[function(r2) {
380
- var n2 = r2.r, e2 = r2.g, u2 = r2.b, o2 = r2.a, i2 = void 0 === o2 ? 1 : o2;
381
- return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null;
382
- }, "rgb"], [function(r2) {
383
- var n2 = r2.h, e2 = r2.s, u2 = r2.l, a2 = r2.a, o2 = void 0 === a2 ? 1 : a2;
384
- if (!t(n2) || !t(e2) || !t(u2)) return null;
385
- var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o2) });
386
- return f(i2);
387
- }, "hsl"], [function(r2) {
388
- var n2 = r2.h, a2 = r2.s, o2 = r2.v, i2 = r2.a, s2 = void 0 === i2 ? 1 : i2;
389
- if (!t(n2) || !t(a2) || !t(o2)) return null;
390
- var h2 = function(r3) {
391
- return { h: u(r3.h), s: e(r3.s, 0, 100), v: e(r3.v, 0, 100), a: e(r3.a) };
392
- }({ h: Number(n2), s: Number(a2), v: Number(o2), a: Number(s2) });
393
- return b(h2);
394
- }, "hsv"]] }, N = function(r2, t2) {
395
- for (var n2 = 0; n2 < t2.length; n2++) {
396
- var e2 = t2[n2][0](r2);
397
- if (e2) return [e2, t2[n2][1]];
398
- }
399
- return [null, void 0];
400
- }, x = function(r2) {
401
- return "string" == typeof r2 ? N(r2.trim(), y.string) : "object" == typeof r2 && null !== r2 ? N(r2, y.object) : [null, void 0];
402
- }, M = function(r2, t2) {
403
- var n2 = c(r2);
404
- return { h: n2.h, s: e(n2.s + 100 * t2, 0, 100), l: n2.l, a: n2.a };
405
- }, H = function(r2) {
406
- return (299 * r2.r + 587 * r2.g + 114 * r2.b) / 1e3 / 255;
407
- }, $ = function(r2, t2) {
408
- var n2 = c(r2);
409
- return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t2, 0, 100), a: n2.a };
410
- }, j = function() {
411
- function r2(r3) {
412
- this.parsed = x(r3)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
413
- }
414
- return r2.prototype.isValid = function() {
415
- return null !== this.parsed;
416
- }, r2.prototype.brightness = function() {
417
- return n(H(this.rgba), 2);
418
- }, r2.prototype.isDark = function() {
419
- return H(this.rgba) < 0.5;
420
- }, r2.prototype.isLight = function() {
421
- return H(this.rgba) >= 0.5;
422
- }, r2.prototype.toHex = function() {
423
- return r3 = o(this.rgba), t2 = r3.r, e2 = r3.g, u2 = r3.b, i2 = (a2 = r3.a) < 1 ? s(n(255 * a2)) : "", "#" + s(t2) + s(e2) + s(u2) + i2;
424
- var r3, t2, e2, u2, a2, i2;
425
- }, r2.prototype.toRgb = function() {
426
- return o(this.rgba);
427
- }, r2.prototype.toRgbString = function() {
428
- return r3 = o(this.rgba), t2 = r3.r, n2 = r3.g, e2 = r3.b, (u2 = r3.a) < 1 ? "rgba(" + t2 + ", " + n2 + ", " + e2 + ", " + u2 + ")" : "rgb(" + t2 + ", " + n2 + ", " + e2 + ")";
429
- var r3, t2, n2, e2, u2;
430
- }, r2.prototype.toHsl = function() {
431
- return d(c(this.rgba));
432
- }, r2.prototype.toHslString = function() {
433
- return r3 = d(c(this.rgba)), t2 = r3.h, n2 = r3.s, e2 = r3.l, (u2 = r3.a) < 1 ? "hsla(" + t2 + ", " + n2 + "%, " + e2 + "%, " + u2 + ")" : "hsl(" + t2 + ", " + n2 + "%, " + e2 + "%)";
434
- var r3, t2, n2, e2, u2;
435
- }, r2.prototype.toHsv = function() {
436
- return r3 = h(this.rgba), { h: n(r3.h), s: n(r3.s), v: n(r3.v), a: n(r3.a, 3) };
437
- var r3;
438
- }, r2.prototype.invert = function() {
439
- return w({ r: 255 - (r3 = this.rgba).r, g: 255 - r3.g, b: 255 - r3.b, a: r3.a });
440
- var r3;
441
- }, r2.prototype.saturate = function(r3) {
442
- return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, r3));
443
- }, r2.prototype.desaturate = function(r3) {
444
- return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, -r3));
445
- }, r2.prototype.grayscale = function() {
446
- return w(M(this.rgba, -1));
447
- }, r2.prototype.lighten = function(r3) {
448
- return void 0 === r3 && (r3 = 0.1), w($(this.rgba, r3));
449
- }, r2.prototype.darken = function(r3) {
450
- return void 0 === r3 && (r3 = 0.1), w($(this.rgba, -r3));
451
- }, r2.prototype.rotate = function(r3) {
452
- return void 0 === r3 && (r3 = 15), this.hue(this.hue() + r3);
453
- }, r2.prototype.alpha = function(r3) {
454
- return "number" == typeof r3 ? w({ r: (t2 = this.rgba).r, g: t2.g, b: t2.b, a: r3 }) : n(this.rgba.a, 3);
455
- var t2;
456
- }, r2.prototype.hue = function(r3) {
457
- var t2 = c(this.rgba);
458
- return "number" == typeof r3 ? w({ h: r3, s: t2.s, l: t2.l, a: t2.a }) : n(t2.h);
459
- }, r2.prototype.isEqual = function(r3) {
460
- return this.toHex() === w(r3).toHex();
461
- }, r2;
462
- }(), w = function(r2) {
463
- return r2 instanceof j ? r2 : new j(r2);
464
- };
465
- const _hoisted_1 = { class: "uno-5zyl8j" };
466
- const _hoisted_2 = { class: "uno-ov60i3" };
467
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
468
- __name: "Tabs",
469
- props: /* @__PURE__ */ vue.mergeModels({
470
- backgroundColor: { default: "#E5E7EB" },
471
- activeBackgroundColor: { default: "#fff" },
472
- primaryColor: { default: "rgba(251,191,36,1)" }
473
- }, {
474
- "value": {},
475
- "valueModifiers": {}
476
- }),
477
- emits: /* @__PURE__ */ vue.mergeModels(["close"], ["update:value"]),
478
- setup(__props, { emit: __emit }) {
479
- const emit = __emit;
480
- const value = vue.useModel(__props, "value");
481
- const { scrollRef, scrollToView } = useScrollView({ activeClassName: ".tab-active" });
482
- vue.watch(value, () => {
483
- scrollToView();
484
- });
485
- const list = vue.ref([]);
486
- const activeName = vue.computed(() => list.value.find((f2) => f2 === value.value));
487
- vue.provide(tabsBarInjectionKey, {
488
- list,
489
- activeName,
490
- pushItem(name) {
491
- list.value.push(name);
492
- },
493
- removeItem(name) {
494
- emit("close", name);
495
- vue.nextTick(() => {
496
- scrollToView();
497
- });
498
- },
499
- itemClick(name) {
500
- value.value = name;
501
- }
502
- });
503
- const backgroundColorDark = vue.computed(() => w(__props.backgroundColor).darken(0.8).toHex());
504
- const activeBackgroundColorDark = vue.computed(() => w(__props.activeBackgroundColor).darken(0.8).toHex());
505
- const primaryColorDark = vue.computed(() => w(__props.primaryColor).darken(0.3).toHex());
506
- return (_ctx, _cache) => {
507
- return vue.openBlock(), vue.createElementBlock("div", {
508
- class: "uno-f9asjx",
509
- style: vue.normalizeStyle({
510
- "--tabs-bar-background-color": `${_ctx.backgroundColor}`,
511
- "--tabs-bar-background-color-dark": `${backgroundColorDark.value}`,
512
- "--tabs-bar-active-background-color": `${_ctx.activeBackgroundColor}`,
513
- "--tabs-bar-active-background-color-dark": `${activeBackgroundColorDark.value}`,
514
- "--tabs-bar-primary-color": `${_ctx.primaryColor}`,
515
- "--tabs-bar-primary-color-dark": `${primaryColorDark.value}`
516
- })
517
- }, [
518
- vue.createElementVNode("div", _hoisted_1, [
519
- vue.createElementVNode("div", _hoisted_2, [
520
- vue.renderSlot(_ctx.$slots, "prefix", {}, () => [
521
- _cache[0] || (_cache[0] = vue.createElementVNode("div", { class: "uno-kq7run" }, [
522
- vue.createElementVNode("i", { class: "i-ri-arrow-down-s-line" })
523
- ], -1))
524
- ])
525
- ]),
526
- vue.createElementVNode("div", {
527
- ref_key: "scrollRef",
528
- ref: scrollRef,
529
- class: "uno-23n4xq"
530
- }, [
531
- vue.createVNode(vue.TransitionGroup, {
532
- name: "group",
533
- tag: "div",
534
- class: "uno-r0jwks"
535
- }, {
536
- default: vue.withCtx(() => [
537
- vue.renderSlot(_ctx.$slots, "default")
538
- ]),
539
- _: 3
540
- })
541
- ], 512),
542
- vue.renderSlot(_ctx.$slots, "suffix")
543
- ]),
544
- _cache[1] || (_cache[1] = vue.createElementVNode("div", { class: "uno-kfa0e9" }, null, -1))
545
- ], 4);
546
- };
547
- }
548
- });
549
- const tabsBarInjectionKey = useInjectionKey("tabs-bar-injection-key");
550
- exports2.CTabItem = _sfc_main$1;
551
- exports2.CTabs = _sfc_main;
552
- exports2.tabsBarInjectionKey = tabsBarInjectionKey;
553
- Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
554
- });
1
+ (function(B,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(B=typeof globalThis<"u"?globalThis:B||self,r(B["@oiij/chrome-tabs"]={},B.Vue))})(this,function(B,r){"use strict";function be(e){let t=".",n="__",o="--",i;if(e){let c=e.blockPrefix;c&&(t=c),c=e.elementPrefix,c&&(n=c),c=e.modifierPrefix,c&&(o=c)}const l={install(c){i=c.c;const g=c.context;g.bem={},g.bem.b=null,g.bem.els=null}};function s(c){let g,h;return{before(p){g=p.bem.b,h=p.bem.els,p.bem.els=null},after(p){p.bem.b=g,p.bem.els=h},$({context:p,props:v}){return c=typeof c=="string"?c:c({context:p,props:v}),p.bem.b=c,`${(v==null?void 0:v.bPrefix)||t}${p.bem.b}`}}}function a(c){let g;return{before(h){g=h.bem.els},after(h){h.bem.els=g},$({context:h,props:p}){return c=typeof c=="string"?c:c({context:h,props:p}),h.bem.els=c.split(",").map(v=>v.trim()),h.bem.els.map(v=>`${(p==null?void 0:p.bPrefix)||t}${h.bem.b}${n}${v}`).join(", ")}}}function d(c){return{$({context:g,props:h}){c=typeof c=="string"?c:c({context:g,props:h});const p=c.split(",").map(S=>S.trim());function v(S){return p.map(D=>`&${(h==null?void 0:h.bPrefix)||t}${g.bem.b}${S!==void 0?`${n}${S}`:""}${o}${D}`).join(", ")}const R=g.bem.els;if(R!==null){if(process.env.NODE_ENV!=="production"&&R.length>=2)throw Error(`[css-render/plugin-bem]: m(${c}) is invalid, using modifier inside multiple elements is not allowed`);return v(R[0])}else return v()}}}function f(c){return{$({context:g,props:h}){c=typeof c=="string"?c:c({context:g,props:h});const p=g.bem.els;if(process.env.NODE_ENV!=="production"&&p!==null&&p.length>=2)throw Error(`[css-render/plugin-bem]: notM(${c}) is invalid, using modifier inside multiple elements is not allowed`);return`&:not(${(h==null?void 0:h.bPrefix)||t}${g.bem.b}${p!==null&&p.length>0?`${n}${p[0]}`:""}${o}${c})`}}}return Object.assign(l,{cB:(...c)=>i(s(c[0]),c[1],c[2]),cE:(...c)=>i(a(c[0]),c[1],c[2]),cM:(...c)=>i(d(c[0]),c[1],c[2]),cNotM:(...c)=>i(f(c[0]),c[1],c[2])}),l}function ge(e){let t=0;for(let n=0;n<e.length;++n)e[n]==="&"&&++t;return t}const U=/\s*,(?![^(]*\))\s*/g,xe=/\s+/g;function ye(e,t){const n=[];return t.split(U).forEach(o=>{let i=ge(o);if(i){if(i===1){e.forEach(s=>{n.push(o.replace("&",s))});return}}else{e.forEach(s=>{n.push((s&&s+" ")+o)});return}let l=[o];for(;i--;){const s=[];l.forEach(a=>{e.forEach(d=>{s.push(a.replace("&",d))})}),l=s}l.forEach(s=>n.push(s))}),n}function ke(e,t){const n=[];return t.split(U).forEach(o=>{e.forEach(i=>{n.push((i&&i+" ")+o)})}),n}function ve(e){let t=[""];return e.forEach(n=>{n=n&&n.trim(),n&&(n.includes("&")?t=ye(t,n):t=ke(t,n))}),t.join(", ").replace(xe," ")}function K(e){if(!e)return;const t=e.parentElement;t&&t.removeChild(e)}function W(e,t){return(t??document.head).querySelector(`style[cssr-id="${e}"]`)}function $e(e){const t=document.createElement("style");return t.setAttribute("cssr-id",e),t}function z(e){return e?/^\s*@(s|m)/.test(e):!1}const Ce=/[A-Z]/g;function Y(e){return e.replace(Ce,t=>"-"+t.toLowerCase())}function we(e,t=" "){return typeof e=="object"&&e!==null?` {
2
+ `+Object.entries(e).map(n=>t+` ${Y(n[0])}: ${n[1]};`).join(`
3
+ `)+`
4
+ `+t+"}":`: ${e};`}function Ee(e,t,n){return typeof e=="function"?e({context:t.context,props:n}):e}function J(e,t,n,o){if(!t)return"";const i=Ee(t,n,o);if(!i)return"";if(typeof i=="string")return`${e} {
5
+ ${i}
6
+ }`;const l=Object.keys(i);if(l.length===0)return n.config.keepEmptyBlock?e+` {
7
+ }`:"";const s=e?[e+" {"]:[];return l.forEach(a=>{const d=i[a];if(a==="raw"){s.push(`
8
+ `+d+`
9
+ `);return}a=Y(a),d!=null&&s.push(` ${a}${we(d)}`)}),e&&s.push("}"),s.join(`
10
+ `)}function _(e,t,n){e&&e.forEach(o=>{if(Array.isArray(o))_(o,t,n);else if(typeof o=="function"){const i=o(t);Array.isArray(i)?_(i,t,n):i&&n(i)}else o&&n(o)})}function Q(e,t,n,o,i){const l=e.$;let s="";if(!l||typeof l=="string")z(l)?s=l:t.push(l);else if(typeof l=="function"){const f=l({context:o.context,props:i});z(f)?s=f:t.push(f)}else if(l.before&&l.before(o.context),!l.$||typeof l.$=="string")z(l.$)?s=l.$:t.push(l.$);else if(l.$){const f=l.$({context:o.context,props:i});z(f)?s=f:t.push(f)}const a=ve(t),d=J(a,e.props,o,i);s?n.push(`${s} {`):d.length&&n.push(d),e.children&&_(e.children,{context:o.context,props:i},f=>{if(typeof f=="string"){const m=J(a,{raw:f},o,i);n.push(m)}else Q(f,t,n,o,i)}),t.pop(),s&&n.push("}"),l&&l.after&&l.after(o.context)}function Ne(e,t,n){const o=[];return Q(e,[],o,t,n),o.join(`
11
+
12
+ `)}function Be(e){for(var t=0,n,o=0,i=e.length;i>=4;++o,i-=4)n=e.charCodeAt(o)&255|(e.charCodeAt(++o)&255)<<8|(e.charCodeAt(++o)&255)<<16|(e.charCodeAt(++o)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(o+2)&255)<<16;case 2:t^=(e.charCodeAt(o+1)&255)<<8;case 1:t^=e.charCodeAt(o)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}typeof window<"u"&&(window.__cssrContext={});function Ie(e,t,n,o){const{els:i}=t;if(n===void 0)i.forEach(K),t.els=[];else{const l=W(n,o);l&&i.includes(l)&&(K(l),t.els=i.filter(s=>s!==l))}}function X(e,t){e.push(t)}function Me(e,t,n,o,i,l,s,a,d){let f;if(n===void 0&&(f=t.render(o),n=Be(f)),d){d.adapter(n,f??t.render(o));return}a===void 0&&(a=document.head);const m=W(n,a);if(m!==null&&!l)return m;const u=m??$e(n);if(f===void 0&&(f=t.render(o)),u.textContent=f,m!==null)return m;if(s){const b=a.querySelector(`meta[name="${s}"]`);if(b)return a.insertBefore(u,b),X(t.els,u),u}return i?a.insertBefore(u,a.querySelector("style, link")):a.appendChild(u),X(t.els,u),u}function Se(e){return Ne(this,this.instance,e)}function Ve(e={}){const{id:t,ssr:n,props:o,head:i=!1,force:l=!1,anchorMetaName:s,parent:a}=e;return Me(this.instance,this,t,o,i,l,s,a,n)}function Ae(e={}){const{id:t,parent:n}=e;Ie(this.instance,this,t,n)}const L=function(e,t,n,o){return{instance:e,$:t,props:n,children:o,els:[],render:Se,mount:Ve,unmount:Ae}},Re=function(e,t,n,o){return Array.isArray(t)?L(e,{$:null},null,t):Array.isArray(n)?L(e,t,null,n):Array.isArray(o)?L(e,t,n,o):L(e,t,n,null)};function ze(e={}){const t={c:(...n)=>Re(t,...n),use:(n,...o)=>n.install(t,...o),find:W,context:{},config:e};return t}function Le(e){const{namespace:t="n",blockPrefix:n=`.${t}-`,elementPrefix:o="__",modifierPrefix:i="--"}=e??{},l=ze(),s=be({blockPrefix:n,elementPrefix:o,modifierPrefix:i});return l.use(s),{namespace:t,blockPrefix:n,elementPrefix:o,modifierPrefix:i,cssr:l,plugin:s}}const Te="@css-render/vue3-ssr";function je(e,t){return`<style cssr-id="${e}">
13
+ ${t}
14
+ </style>`}function Pe(e,t,n){const{styles:o,ids:i}=n;i.has(e)||o!==null&&(i.add(e),o.push(je(e,t)))}const Oe=typeof document<"u";function De(){if(Oe)return;const e=r.inject(Te,null);if(e!==null)return{adapter:(t,n)=>Pe(t,n,e),context:e}}function We(e,t){const n=De();function o(){t.mount({id:e,head:!0,ssr:n})}n?o():r.onBeforeMount(()=>{o()})}const{cssr:_e,plugin:He,namespace:ee}=Le(),{c:y,cB:T,cE:x,cM:H,cNotM:te}={..._e,...He},V=`${ee}-chrome-tabs`,$=`${ee}-chrome-tabs-item`,M="all .2s cubic-bezier(.4, 0, .2, 1)";function Fe(){return y([T("chrome-tabs",{display:"flex",width:"100%",height:"40px",padding:"0 10px",alignItems:"center",backgroundColor:"var(--background-color)",color:"var(--background-color-dark)"},[y(".group-move, .group-enter-active, .group-leave-active",{transition:M}),y(".group-enter-from, .group-leave-to",{opacity:0}),y(".group-leave-active",{}),x("prefix",{}),x("icon",{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",padding:"5px",borderRadius:"10px",backgroundColor:"var(--active-background-color)",transition:M},[y("svg",{width:"100%",height:"100%",fill:"currentColor"}),y("&:hover",{backgroundColor:"var(--primary-color)"})]),x("content",{flex:"1",height:"100%",minWidth:0,overflow:"hidden",marginLeft:"-6px",padding:"0 10px"}),x("scroll",{position:"relative",display:"flex",alignItems:"center",height:"100%"},[x("icon",{marginLeft:"5px",borderRadius:"50%",backgroundColor:"transparent",flexShrink:0},[y("&:hover",{backgroundColor:"var(--primary-color)"})])]),x("suffix",{})]),T("chrome-tabs-item",{position:"relative",margin:"0 -5px",height:"100%",flexShrink:0,cursor:"default",userSelect:"none",padding:"6px 10px 0px 10px"},[H("disabled",{cursor:"not-allowed",pointerEvents:"none",opacity:.5,filter:"grayscale(0.5)"}),H("active",[x("background",{opacity:1})]),te("active",[y("&:hover",{},[x("content",{backgroundColor:"var(--primary-color)"})])]),y("&::first-child",{marginLeft:"0 !important"}),y("&::last-child",{marginRight:"0 !important"}),x("content",{position:"relative",zIndex:1,height:"28px",display:"flex",alignItems:"center",gap:"5px",borderRadius:"10px",padding:"0 10px",transition:M}),x("slot",{}),x("icon",{},[y("svg",{width:"1.2em",height:"1.2em",fill:"currentColor"})]),x("close",{width:"16px",height:"16px",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",transition:M},[y("&:hover",{backgroundColor:"rgba(0,0,0,0.1)"}),y("svg",{width:"100%",height:"100%",fill:"currentColor"})]),x("background",{position:"absolute",opacity:0,left:0,bottom:0,zIndex:0,height:"34px",width:"100%",display:"flex",alignItems:"flex-end",transition:M},[x("block",{height:"100%",flex:1,minWidth:0,borderRadius:"10px 10px 0 0",backgroundColor:"var(--active-background-color)"}),y("svg",{fill:"var(--active-background-color)"})]),x("line",{position:"absolute",bottom:"12px",right:"4px",height:"16px",width:"2px",borderRadius:"1px",transition:M,backgroundColor:"var(--primary-color)",opacity:0},[H("show",{opacity:1})])]),y(".dark",[T("chrome-tabs",{backgroundColor:"var(--background-color-dark)",color:"var(--background-color)"},[x("icon",{backgroundColor:"var(--active-background-color-dark)"},[y("&:hover",{backgroundColor:"var(--primary-color-dark)"})])]),T("chrome-tabs-item",{},[te("active",[y("&:hover",{},[x("content",{backgroundColor:"var(--primary-color-dark)"})])]),x("background",{},[x("block",{backgroundColor:"var(--active-background-color-dark)"}),y("svg",{fill:"var(--active-background-color-dark)"})])])])])}const j=(e,t)=>{const n=e.__vccOpts||e;for(const[o,i]of t)n[o]=i;return n},qe={name:"LineMdLoadingTwotoneLoop"},Ge={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Ze(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",Ge,t[0]||(t[0]=[r.createStaticVNode('<g fill="none" stroke="#757575" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path stroke-dasharray="16" stroke-dashoffset="16" d="M12 3c4.97 0 9 4.03 9 9"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="16;0"></animate><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"></animateTransform></path><path stroke-dasharray="64" stroke-dashoffset="64" stroke-opacity=".3" d="M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.2s" values="64;0"></animate></path></g>',1)]))}const Ue=j(qe,[["render",Ze]]),Ke={name:"RiCloseLine"},Ye={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Je(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",Ye,t[0]||(t[0]=[r.createElementVNode("path",{fill:"#757575",d:"m12 10.587l4.95-4.95l1.414 1.414l-4.95 4.95l4.95 4.95l-1.415 1.414l-4.95-4.95l-4.949 4.95l-1.414-1.415l4.95-4.95l-4.95-4.95L7.05 5.638z"},null,-1)]))}const Qe=j(Ke,[["render",Je]]),ne=r.defineComponent({__name:"TabItem",props:{label:{type:[String,Function]},icon:{type:Function},closable:{type:Boolean},disabled:{type:Boolean},loading:{type:Boolean},loadingIcon:{type:Function},onClick:{type:Function},onContextMenu:{type:Function},onClose:{type:Function},activeIndex:{default:0},index:{}},emits:["itemClick","itemContextmenu","itemClose"],setup(e,{emit:t}){const n=t,o=r.computed(()=>e.activeIndex!==e.index&&e.activeIndex!==e.index-1),i=r.computed(()=>e.activeIndex===e.index),l=r.computed(()=>typeof e.label=="string"?r.h("span",{class:`${$}__label`},e.label):e.label),s=r.computed(()=>e.loadingIcon??r.h(Ue));function a(m){var u;m.stopPropagation(),n("itemClick",m),(u=e.onClick)==null||u.call(e,m)}function d(m){var u;n("itemContextmenu",m),(u=e.onContextMenu)==null||u.call(e,m)}function f(){var m;n("itemClose"),(m=e.onClose)==null||m.call(e)}return(m,u)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([r.unref($),{[`${r.unref($)}--active`]:i.value,[`${r.unref($)}--disabled`]:m.disabled}]),onClick:a,onContextmenu:d},[r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__content`])},[r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__icon`])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(m.loading?s.value:m.icon)))],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__slot`])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(l.value)))],2),m.closable?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([`${r.unref($)}__close`]),onClick:r.withModifiers(f,["stop"])},[r.createVNode(Qe)],2)):r.createCommentVNode("",!0)],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__background`])},[u[0]||(u[0]=r.createElementVNode("svg",{width:"10",height:"10"},[r.createElementVNode("path",{d:"M 0 10 A 10 10 0 0 0 10 0 L 10 10 Z"})],-1)),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__block`])},null,2),u[1]||(u[1]=r.createElementVNode("svg",{width:"10",height:"10"},[r.createElementVNode("path",{d:"M 0 0 A 10 10 0 0 0 10 10 L 0 10 Z"})],-1))],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__line`,o.value?`${r.unref($)}__line--show`:""])},null,2)],34))}});function oe(e){return r.getCurrentScope()?(r.onScopeDispose(e),!0):!1}const Xe=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const et=Object.prototype.toString,tt=e=>et.call(e)==="[object Object]",re=()=>{};function nt(e,t){function n(...o){return new Promise((i,l)=>{Promise.resolve(e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})).then(i).catch(l)})}return n}function ot(e,t={}){let n,o,i=re;const l=d=>{clearTimeout(d),i(),i=re};let s;return d=>{const f=r.toValue(e),m=r.toValue(t.maxWait);return n&&l(n),f<=0||m!==void 0&&m<=0?(o&&(l(o),o=null),Promise.resolve(d())):new Promise((u,b)=>{i=t.rejectOnCancel?b:u,s=d,m&&!o&&(o=setTimeout(()=>{n&&l(n),o=null,u(s())},m)),n=setTimeout(()=>{o&&l(o),o=null,u(d())},f)})}}function P(e){return Array.isArray(e)?e:[e]}function rt(e){return r.getCurrentInstance()}function it(e,t=200,n={}){return nt(ot(t,n),e)}function lt(e,t=!0,n){rt()?r.onMounted(e,n):t?e():r.nextTick(e)}function st(e,t,n){return r.watch(e,t,{...n,immediate:!0})}const F=Xe?window:void 0;function I(e){var t;const n=r.toValue(e);return(t=n==null?void 0:n.$el)!=null?t:n}function at(...e){const t=[],n=()=>{t.forEach(a=>a()),t.length=0},o=(a,d,f,m)=>(a.addEventListener(d,f,m),()=>a.removeEventListener(d,f,m)),i=r.computed(()=>{const a=P(r.toValue(e[0])).filter(d=>d!=null);return a.every(d=>typeof d!="string")?a:void 0}),l=st(()=>{var a,d;return[(d=(a=i.value)==null?void 0:a.map(f=>I(f)))!=null?d:[F].filter(f=>f!=null),P(r.toValue(i.value?e[1]:e[0])),P(r.unref(i.value?e[2]:e[1])),r.toValue(i.value?e[3]:e[2])]},([a,d,f,m])=>{if(n(),!(a!=null&&a.length)||!(d!=null&&d.length)||!(f!=null&&f.length))return;const u=tt(m)?{...m}:m;t.push(...a.flatMap(b=>d.flatMap(C=>f.map(c=>o(b,C,c,u)))))},{flush:"post"}),s=()=>{l(),n()};return oe(n),s}function ct(){const e=r.shallowRef(!1),t=r.getCurrentInstance();return t&&r.onMounted(()=>{e.value=!0},t),e}function ut(e){const t=ct();return r.computed(()=>(t.value,!!e()))}function ft(e,t,n={}){const{window:o=F,...i}=n;let l;const s=ut(()=>o&&"ResizeObserver"in o),a=()=>{l&&(l.disconnect(),l=void 0)},d=r.computed(()=>{const u=r.toValue(e);return Array.isArray(u)?u.map(b=>I(b)):[I(u)]}),f=r.watch(d,u=>{if(a(),s.value&&o){l=new ResizeObserver(t);for(const b of u)b&&l.observe(b,i)}},{immediate:!0,flush:"post"}),m=()=>{a(),f()};return oe(m),{isSupported:s,stop:m}}function dt(e,t={width:0,height:0},n={}){const{window:o=F,box:i="content-box"}=n,l=r.computed(()=>{var u,b;return(b=(u=I(e))==null?void 0:u.namespaceURI)==null?void 0:b.includes("svg")}),s=r.shallowRef(t.width),a=r.shallowRef(t.height),{stop:d}=ft(e,([u])=>{const b=i==="border-box"?u.borderBoxSize:i==="content-box"?u.contentBoxSize:u.devicePixelContentBoxSize;if(o&&l.value){const C=I(e);if(C){const c=C.getBoundingClientRect();s.value=c.width,a.value=c.height}}else if(b){const C=P(b);s.value=C.reduce((c,{inlineSize:g})=>c+g,0),a.value=C.reduce((c,{blockSize:g})=>c+g,0)}else s.value=u.contentRect.width,a.value=u.contentRect.height},n);lt(()=>{const u=I(e);u&&(s.value="offsetWidth"in u?u.offsetWidth:t.width,a.value="offsetHeight"in u?u.offsetHeight:t.height)});const f=r.watch(()=>I(e),u=>{s.value=u?t.width:0,a.value=u?t.height:0});function m(){d(),f()}return{width:s,height:a,stop:m}}function mt(e){const{activeClassName:t=".active",enableWheel:n=!0,direction:o="vertical"}=e??{},i=r.ref(),{width:l,height:s}=dt(i);async function a(m){var b;await r.nextTick();const u=(b=i.value)==null?void 0:b.querySelector(t);u&&u.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest",...m})}function d(m){var b,C;if(!n)return;m.preventDefault();const{deltaY:u}=m;switch(o){case"vertical":(b=i.value)==null||b.scrollBy({top:u>0?s.value:-s.value,behavior:"smooth"});break;case"horizontal":(C=i.value)==null||C.scrollBy({left:u>0?l.value:-l.value,behavior:"smooth"});break}}at(i,"wheel",d);const f=it(a,500);return r.watch([l,s],()=>{f()}),{scrollRef:i,scrollToView:a}}var ht={grad:.9,turn:360,rad:360/(2*Math.PI)},N=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},k=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},w=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},ie=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},le=function(e){return{r:w(e.r,0,255),g:w(e.g,0,255),b:w(e.b,0,255),a:w(e.a)}},q=function(e){return{r:k(e.r),g:k(e.g),b:k(e.b),a:k(e.a,3)}},pt=/^#([0-9a-f]{3,8})$/i,O=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},se=function(e){var t=e.r,n=e.g,o=e.b,i=e.a,l=Math.max(t,n,o),s=l-Math.min(t,n,o),a=s?l===t?(n-o)/s:l===n?2+(o-t)/s:4+(t-n)/s:0;return{h:60*(a<0?a+6:a),s:l?s/l*100:0,v:l/255*100,a:i}},ae=function(e){var t=e.h,n=e.s,o=e.v,i=e.a;t=t/360*6,n/=100,o/=100;var l=Math.floor(t),s=o*(1-n),a=o*(1-(t-l)*n),d=o*(1-(1-t+l)*n),f=l%6;return{r:255*[o,a,s,s,d,o][f],g:255*[d,o,o,a,s,s][f],b:255*[s,s,d,o,o,a][f],a:i}},ce=function(e){return{h:ie(e.h),s:w(e.s,0,100),l:w(e.l,0,100),a:w(e.a)}},ue=function(e){return{h:k(e.h),s:k(e.s),l:k(e.l),a:k(e.a,3)}},fe=function(e){return ae((n=(t=e).s,{h:t.h,s:(n*=((o=t.l)<50?o:100-o)/100)>0?2*n/(o+n)*100:0,v:o+n,a:t.a}));var t,n,o},A=function(e){return{h:(t=se(e)).h,s:(i=(200-(n=t.s))*(o=t.v)/100)>0&&i<200?n*o/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,o,i},bt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,de={string:[[function(e){var t=pt.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?k(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?k(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=xt.exec(e)||yt.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:le({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=bt.exec(e)||gt.exec(e);if(!t)return null;var n,o,i=ce({h:(n=t[1],o=t[2],o===void 0&&(o="deg"),Number(n)*(ht[o]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return fe(i)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,o=e.b,i=e.a,l=i===void 0?1:i;return N(t)&&N(n)&&N(o)?le({r:Number(t),g:Number(n),b:Number(o),a:Number(l)}):null},"rgb"],[function(e){var t=e.h,n=e.s,o=e.l,i=e.a,l=i===void 0?1:i;if(!N(t)||!N(n)||!N(o))return null;var s=ce({h:Number(t),s:Number(n),l:Number(o),a:Number(l)});return fe(s)},"hsl"],[function(e){var t=e.h,n=e.s,o=e.v,i=e.a,l=i===void 0?1:i;if(!N(t)||!N(n)||!N(o))return null;var s=function(a){return{h:ie(a.h),s:w(a.s,0,100),v:w(a.v,0,100),a:w(a.a)}}({h:Number(t),s:Number(n),v:Number(o),a:Number(l)});return ae(s)},"hsv"]]},me=function(e,t){for(var n=0;n<t.length;n++){var o=t[n][0](e);if(o)return[o,t[n][1]]}return[null,void 0]},kt=function(e){return typeof e=="string"?me(e.trim(),de.string):typeof e=="object"&&e!==null?me(e,de.object):[null,void 0]},G=function(e,t){var n=A(e);return{h:n.h,s:w(n.s+100*t,0,100),l:n.l,a:n.a}},Z=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},he=function(e,t){var n=A(e);return{h:n.h,s:n.s,l:w(n.l+100*t,0,100),a:n.a}},pe=function(){function e(t){this.parsed=kt(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return k(Z(this.rgba),2)},e.prototype.isDark=function(){return Z(this.rgba)<.5},e.prototype.isLight=function(){return Z(this.rgba)>=.5},e.prototype.toHex=function(){return t=q(this.rgba),n=t.r,o=t.g,i=t.b,s=(l=t.a)<1?O(k(255*l)):"","#"+O(n)+O(o)+O(i)+s;var t,n,o,i,l,s},e.prototype.toRgb=function(){return q(this.rgba)},e.prototype.toRgbString=function(){return t=q(this.rgba),n=t.r,o=t.g,i=t.b,(l=t.a)<1?"rgba("+n+", "+o+", "+i+", "+l+")":"rgb("+n+", "+o+", "+i+")";var t,n,o,i,l},e.prototype.toHsl=function(){return ue(A(this.rgba))},e.prototype.toHslString=function(){return t=ue(A(this.rgba)),n=t.h,o=t.s,i=t.l,(l=t.a)<1?"hsla("+n+", "+o+"%, "+i+"%, "+l+")":"hsl("+n+", "+o+"%, "+i+"%)";var t,n,o,i,l},e.prototype.toHsv=function(){return t=se(this.rgba),{h:k(t.h),s:k(t.s),v:k(t.v),a:k(t.a,3)};var t},e.prototype.invert=function(){return E({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),E(G(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),E(G(this.rgba,-t))},e.prototype.grayscale=function(){return E(G(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),E(he(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),E(he(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?E({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):k(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=A(this.rgba);return typeof t=="number"?E({h:t,s:n.s,l:n.l,a:n.a}):k(n.h)},e.prototype.isEqual=function(t){return this.toHex()===E(t).toHex()},e}(),E=function(e){return e instanceof pe?e:new pe(e)};const vt={name:"RiAddLine"},$t={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Ct(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",$t,t[0]||(t[0]=[r.createElementVNode("path",{fill:"#757575",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"},null,-1)]))}const wt=j(vt,[["render",Ct]]),Et={name:"RiArrowDropDownLine"},Nt={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Bt(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",Nt,t[0]||(t[0]=[r.createElementVNode("path",{fill:"#757575",d:"m12 15l-4.243-4.242l1.415-1.414L12 12.172l2.828-2.828l1.415 1.414z"},null,-1)]))}const It=j(Et,[["render",Bt]]),Mt=r.defineComponent({__name:"Tabs",props:r.mergeModels({colors:{},dropdown:{type:Boolean},addable:{type:Boolean},options:{}},{value:{},valueModifiers:{}}),emits:r.mergeModels(["click","contextmenu","close","add"],["update:value"]),setup(e,{emit:t}){const n=t;We("n-chrome-tabs",Fe());const{background:o="#E5E7EB",active:i="#fff",primary:l="rgba(251,191,36,1)"}=e.colors??{},s=r.useModel(e,"value"),a=r.computed(()=>{var h;return(h=e.options)==null?void 0:h.findIndex(p=>p.key===s.value)}),{scrollRef:d,scrollToView:f}=mt({activeClassName:`.${$}--active`,direction:"horizontal"});r.watch(s,()=>{f()},{immediate:!0});const m=r.computed(()=>E(o).darken(.9).toHex()),u=r.computed(()=>E(i).darken(.8).toHex()),b=r.computed(()=>E(l).darken(.3).toHex());function C(h){n("click",h)}function c(h){n("contextmenu",h)}function g(h){n("close",h)}return(h,p)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([r.unref(V)]),style:r.normalizeStyle({"--background-color":`${r.unref(o)}`,"--background-color-dark":`${m.value}`,"--active-background-color":`${r.unref(i)}`,"--active-background-color-dark":`${u.value}`,"--primary-color":`${r.unref(l)}`,"--primary-color-dark":`${b.value}`})},[h.dropdown?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([`${r.unref(V)}__icon`])},[r.createVNode(It)],2)):r.createCommentVNode("",!0),r.renderSlot(h.$slots,"prefix"),r.createElementVNode("div",{ref_key:"scrollRef",ref:d,class:r.normalizeClass([`${r.unref(V)}__content`])},[r.createVNode(r.TransitionGroup,{name:"group",tag:"div",class:r.normalizeClass([`${r.unref(V)}__scroll`])},{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(h.options,({key:v,...R},S)=>(r.openBlock(),r.createBlock(ne,r.mergeProps({key:v},{ref_for:!0},R,{index:S,"active-index":a.value,onItemClick:D=>C(v),onItemContextmenu:D=>c(v),onItemClose:D=>g(v)}),null,16,["index","active-index","onItemClick","onItemContextmenu","onItemClose"]))),128))]),_:1},8,["class"])],2),r.renderSlot(h.$slots,"suffix"),h.addable?(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass([`${r.unref(V)}__icon`]),onClick:p[0]||(p[0]=v=>n("add"))},[r.createVNode(wt)],2)):r.createCommentVNode("",!0)],6))}});B.CTabItem=ne,B.CTabs=Mt,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});