UNPKG

@soybeanjs/vue-admin-tab

Version:

a layout component of admin template, support vue2 and vue3

818 lines (816 loc) 28.7 kB
import { ref as ge, defineComponent as w, openBlock as m, createElementBlock as y, createElementVNode as _, normalizeStyle as ae, unref as d, createVNode as E, Transition as ve, withCtx as ye, createBlock as U, computed as j, createStaticVNode as xe, normalizeClass as H, renderSlot as se, createCommentVNode as ue } from "vue"; function _e(t) { let e = 0; for (let n = 0; n < t.length; ++n) t[n] === "&" && ++e; return e; } const le = /\s*,(?![^(]*\))\s*/g, Ce = /\s+/g; function we(t, e) { const n = []; return e.split(le).forEach((o) => { let r = _e(o); if (r) { if (r === 1) { t.forEach((i) => { n.push(o.replace("&", i)); }); return; } } else { t.forEach((i) => { n.push( // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions (i && i + " ") + o ); }); return; } let a = [ o ]; for (; r--; ) { const i = []; a.forEach((s) => { t.forEach((u) => { i.push(s.replace("&", u)); }); }), a = i; } a.forEach((i) => n.push(i)); }), n; } function $e(t, e) { const n = []; return e.split(le).forEach((o) => { t.forEach((r) => { n.push((r && r + " ") + o); }); }), n; } function ke(t) { let e = [""]; return t.forEach((n) => { n = n && n.trim(), // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions n && (n.includes("&") ? e = we(e, n) : e = $e(e, n)); }), e.join(", ").replace(Ce, " "); } function Z(t) { if (!t) return; const e = t.parentElement; e && e.removeChild(t); } function F(t) { return document.querySelector(`style[cssr-id="${t}"]`); } function Me(t) { const e = document.createElement("style"); return e.setAttribute("cssr-id", t), e; } function M(t) { return t ? /^\s*@(s|m)/.test(t) : !1; } const Ae = /[A-Z]/g; function fe(t) { return t.replace(Ae, (e) => "-" + e.toLowerCase()); } function Be(t, e = " ") { return typeof t == "object" && t !== null ? ` { ` + Object.entries(t).map((n) => e + ` ${fe(n[0])}: ${n[1]};`).join(` `) + ` ` + e + "}" : `: ${t};`; } function Ee(t, e, n) { return typeof t == "function" ? t({ context: e.context, props: n }) : t; } function G(t, e, n, o) { if (!e) return ""; const r = Ee(e, n, o); if (!r) return ""; if (typeof r == "string") return `${t} { ${r} }`; const a = Object.keys(r); if (a.length === 0) return n.config.keepEmptyBlock ? t + ` { }` : ""; const i = t ? [ t + " {" ] : []; return a.forEach((s) => { const u = r[s]; if (s === "raw") { i.push(` ` + u + ` `); return; } s = fe(s), u != null && i.push(` ${s}${Be(u)}`); }), t && i.push("}"), i.join(` `); } function T(t, e, n) { t && t.forEach((o) => { if (Array.isArray(o)) T(o, e, n); else if (typeof o == "function") { const r = o(e); Array.isArray(r) ? T(r, e, n) : r && n(r); } else o && n(o); }); } function ce(t, e, n, o, r, a) { const i = t.$; let s = ""; if (!i || typeof i == "string") M(i) ? s = i : e.push(i); else if (typeof i == "function") { const f = i({ context: o.context, props: r }); M(f) ? s = f : e.push(f); } else if (i.before && i.before(o.context), !i.$ || typeof i.$ == "string") M(i.$) ? s = i.$ : e.push(i.$); else if (i.$) { const f = i.$({ context: o.context, props: r }); M(f) ? s = f : e.push(f); } const u = ke(e), l = G(u, t.props, o, r); s ? (n.push(`${s} {`), a && l && a.insertRule(`${s} { ${l} } `)) : (a && l && a.insertRule(l), !a && l.length && n.push(l)), t.children && T(t.children, { context: o.context, props: r }, (f) => { if (typeof f == "string") { const c = G(u, { raw: f }, o, r); a ? a.insertRule(c) : n.push(c); } else ce(f, e, n, o, r, a); }), e.pop(), s && n.push("}"), i && i.after && i.after(o.context); } function de(t, e, n, o = !1) { const r = []; return ce(t, [], r, e, n, o ? t.instance.__styleSheet : void 0), o ? "" : r.join(` `); } function ze(t) { for (var e = 0, n, o = 0, r = t.length; r >= 4; ++o, r -= 4) n = t.charCodeAt(o) & 255 | (t.charCodeAt(++o) & 255) << 8 | (t.charCodeAt(++o) & 255) << 16 | (t.charCodeAt(++o) & 255) << 24, n = /* Math.imul(k, m): */ (n & 65535) * 1540483477 + ((n >>> 16) * 59797 << 16), n ^= /* k >>> r: */ n >>> 24, e = /* Math.imul(k, m): */ (n & 65535) * 1540483477 + ((n >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */ (e & 65535) * 1540483477 + ((e >>> 16) * 59797 << 16); switch (r) { case 3: e ^= (t.charCodeAt(o + 2) & 255) << 16; case 2: e ^= (t.charCodeAt(o + 1) & 255) << 8; case 1: e ^= t.charCodeAt(o) & 255, e = /* Math.imul(h, m): */ (e & 65535) * 1540483477 + ((e >>> 16) * 59797 << 16); } return e ^= e >>> 13, e = /* Math.imul(h, m): */ (e & 65535) * 1540483477 + ((e >>> 16) * 59797 << 16), ((e ^ e >>> 15) >>> 0).toString(36); } typeof window < "u" && (window.__cssrContext = {}); function Ne(t, e, n) { const { els: o } = e; if (n === void 0) o.forEach(Z), e.els = []; else { const r = F(n); r && o.includes(r) && (Z(r), e.els = o.filter((a) => a !== r)); } } function J(t, e) { t.push(e); } function Se(t, e, n, o, r, a, i, s, u) { if (a && !u) { if (n === void 0) { console.error("[css-render/mount]: `id` is required in `silent` mode."); return; } const p = window.__cssrContext; p[n] || (p[n] = !0, de(e, t, o, a)); return; } let l; if (n === void 0 && (l = e.render(o), n = ze(l)), u) { u.adapter(n, l ?? e.render(o)); return; } const f = F(n); if (f !== null && !i) return f; const c = f ?? Me(n); if (l === void 0 && (l = e.render(o)), c.textContent = l, f !== null) return f; if (s) { const p = document.head.querySelector(`meta[name="${s}"]`); if (p) return document.head.insertBefore(c, p), J(e.els, c), c; } return r ? document.head.insertBefore(c, document.head.querySelector("style, link")) : document.head.appendChild(c), J(e.els, c), c; } function Re(t) { return de(this, this.instance, t); } function Ie(t = {}) { const { id: e, ssr: n, props: o, head: r = !1, silent: a = !1, force: i = !1, anchorMetaName: s } = t; return Se(this.instance, this, e, o, r, a, i, s, n); } function Le(t = {}) { const { id: e } = t; Ne(this.instance, this, e); } const A = function(t, e, n, o) { return { instance: t, $: e, props: n, children: o, els: [], render: Re, mount: Ie, unmount: Le }; }, je = function(t, e, n, o) { return Array.isArray(e) ? A(t, { $: null }, null, e) : Array.isArray(n) ? A(t, e, null, n) : Array.isArray(o) ? A(t, e, n, o) : A(t, e, n, null); }; function P(t = {}) { let e = null; const n = { c: (...o) => je(n, ...o), use: (o, ...r) => o.install(n, ...r), find: F, context: {}, config: t, get __styleSheet() { if (!e) { const o = document.createElement("style"); return document.head.appendChild(o), e = document.styleSheets[document.styleSheets.length - 1], e; } return e; } }; return n; } function O(t = !1) { const e = ge(t); function n(i) { e.value = i; } function o() { n(!0); } function r() { n(!1); } function a() { n(!e.value); } return { bool: e, setBool: n, setTrue: o, setFalse: r, toggle: a }; } const He = { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", class: "iconify iconify--jam", preserveAspectRatio: "xMidYMid meet", viewBox: "-6 -6 24 24" }, Te = /* @__PURE__ */ _("path", { fill: "currentColor", d: "m7.314 5.9l3.535-3.536A1 1 0 1 0 9.435.95L5.899 4.485L2.364.95A1 1 0 1 0 .95 2.364l3.535 3.535L.95 9.435a1 1 0 1 0 1.414 1.414l3.535-3.535l3.536 3.535a1 1 0 1 0 1.414-1.414L7.314 5.899z" }, null, -1), qe = [ Te ], Ve = /* @__PURE__ */ w({ name: "SvgClose", __name: "SvgClose", setup(t) { return (e, n) => (m(), y("svg", He, qe)); } }), Fe = { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", class: "iconify iconify--jam", preserveAspectRatio: "xMidYMid meet", viewBox: "-2 -2 24 24" }, Pe = /* @__PURE__ */ _("path", { fill: "currentColor", d: "m11.414 10l2.829-2.828a1 1 0 1 0-1.415-1.415L10 8.586L7.172 5.757a1 1 0 0 0-1.415 1.415L8.586 10l-2.829 2.828a1 1 0 0 0 1.415 1.415L10 11.414l2.828 2.829a1 1 0 0 0 1.415-1.415L11.414 10zM10 20C4.477 20 0 15.523 0 10S4.477 0 10 0s10 4.477 10 10s-4.477 10-10 10z" }, null, -1), Oe = [ Pe ], We = /* @__PURE__ */ w({ name: "SvgCloseCircle", __name: "SvgCloseCircle", setup(t) { return (e, n) => (m(), y("svg", Fe, Oe)); } }), he = /* @__PURE__ */ w({ name: "IconClose", __name: "IconClose", props: { isActive: { type: Boolean }, defaultColor: { default: "#9ca3af" }, activeColor: { default: "#1890ff" } }, setup(t) { const { bool: e, setTrue: n, setFalse: o } = O(), { c: r } = P(), a = r( ".admin-tab__icon", { position: "relative", display: "flex", justifyContent: "center", alignItems: "center", width: "18px", height: "18px", fontSize: "14px" }, [ r("&-fade", {}, [ r("&-enter-active, &-leave-active", { transition: "opacity 0.3s ease-in-out" }), r("&-enter-from, &-leave-to", { opacity: 0 }) ]), r("&-svg", { position: "absolute", width: "16px", height: "16px" }) ] ); return a.render(), a.mount(), (i, s) => (m(), y("div", { class: "admin-tab__icon", style: ae({ color: i.isActive ? i.activeColor : i.defaultColor }), onMouseenter: s[0] || (s[0] = //@ts-ignore (...u) => d(n) && d(n)(...u)), onMouseleave: s[1] || (s[1] = //@ts-ignore (...u) => d(o) && d(o)(...u)) }, [ E(ve, { name: "admin-tab__icon-fade" }, { default: ye(() => [ d(e) ? (m(), U(We, { key: "hover", class: "admin-tab__icon-svg" })) : (m(), U(Ve, { key: "unhover", class: "admin-tab__icon-svg" })) ]), _: 1 }) ], 36)); } }); var Ye = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, x = function(t) { return typeof t == "string" ? t.length > 0 : typeof t == "number"; }, h = function(t, e, n) { return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n + 0; }, b = function(t, e, n) { return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e; }, pe = function(t) { return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360; }, K = function(t) { return { r: b(t.r, 0, 255), g: b(t.g, 0, 255), b: b(t.b, 0, 255), a: b(t.a) }; }, N = function(t) { return { r: h(t.r), g: h(t.g), b: h(t.b), a: h(t.a, 3) }; }, De = /^#([0-9a-f]{3,8})$/i, B = function(t) { var e = t.toString(16); return e.length < 2 ? "0" + e : e; }, be = function(t) { var e = t.r, n = t.g, o = t.b, r = t.a, a = Math.max(e, n, o), i = a - Math.min(e, n, o), s = i ? a === e ? (n - o) / i : a === n ? 2 + (o - e) / i : 4 + (e - n) / i : 0; return { h: 60 * (s < 0 ? s + 6 : s), s: a ? i / a * 100 : 0, v: a / 255 * 100, a: r }; }, me = function(t) { var e = t.h, n = t.s, o = t.v, r = t.a; e = e / 360 * 6, n /= 100, o /= 100; var a = Math.floor(e), i = o * (1 - n), s = o * (1 - (e - a) * n), u = o * (1 - (1 - e + a) * n), l = a % 6; return { r: 255 * [o, s, i, i, u, o][l], g: 255 * [u, o, o, s, i, i][l], b: 255 * [i, i, u, o, o, s][l], a: r }; }, Q = function(t) { return { h: pe(t.h), s: b(t.s, 0, 100), l: b(t.l, 0, 100), a: b(t.a) }; }, X = function(t) { return { h: h(t.h), s: h(t.s), l: h(t.l), a: h(t.a, 3) }; }, ee = function(t) { return me((n = (e = t).s, { h: e.h, s: (n *= ((o = e.l) < 50 ? o : 100 - o) / 100) > 0 ? 2 * n / (o + n) * 100 : 0, v: o + n, a: e.a })); var e, n, o; }, $ = function(t) { return { h: (e = be(t)).h, s: (r = (200 - (n = e.s)) * (o = e.v) / 100) > 0 && r < 200 ? n * o / 100 / (r <= 100 ? r : 200 - r) * 100 : 0, l: r / 2, a: e.a }; var e, n, o, r; }, Ue = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Ze = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Ge = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Je = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, q = { string: [[function(t) { var e = De.exec(t); return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ? h(parseInt(t[3] + t[3], 16) / 255, 2) : 1 } : t.length === 6 || t.length === 8 ? { r: parseInt(t.substr(0, 2), 16), g: parseInt(t.substr(2, 2), 16), b: parseInt(t.substr(4, 2), 16), a: t.length === 8 ? h(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null; }, "hex"], [function(t) { var e = Ge.exec(t) || Je.exec(t); return e ? e[2] !== e[4] || e[4] !== e[6] ? null : K({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null; }, "rgb"], [function(t) { var e = Ue.exec(t) || Ze.exec(t); if (!e) return null; var n, o, r = Q({ h: (n = e[1], o = e[2], o === void 0 && (o = "deg"), Number(n) * (Ye[o] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) }); return ee(r); }, "hsl"]], object: [[function(t) { var e = t.r, n = t.g, o = t.b, r = t.a, a = r === void 0 ? 1 : r; return x(e) && x(n) && x(o) ? K({ r: Number(e), g: Number(n), b: Number(o), a: Number(a) }) : null; }, "rgb"], [function(t) { var e = t.h, n = t.s, o = t.l, r = t.a, a = r === void 0 ? 1 : r; if (!x(e) || !x(n) || !x(o)) return null; var i = Q({ h: Number(e), s: Number(n), l: Number(o), a: Number(a) }); return ee(i); }, "hsl"], [function(t) { var e = t.h, n = t.s, o = t.v, r = t.a, a = r === void 0 ? 1 : r; if (!x(e) || !x(n) || !x(o)) return null; var i = function(s) { return { h: pe(s.h), s: b(s.s, 0, 100), v: b(s.v, 0, 100), a: b(s.a) }; }({ h: Number(e), s: Number(n), v: Number(o), a: Number(a) }); return me(i); }, "hsv"]] }, te = function(t, e) { for (var n = 0; n < e.length; n++) { var o = e[n][0](t); if (o) return [o, e[n][1]]; } return [null, void 0]; }, Ke = function(t) { return typeof t == "string" ? te(t.trim(), q.string) : typeof t == "object" && t !== null ? te(t, q.object) : [null, void 0]; }, S = function(t, e) { var n = $(t); return { h: n.h, s: b(n.s + 100 * e, 0, 100), l: n.l, a: n.a }; }, R = function(t) { return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255; }, ne = function(t, e) { var n = $(t); return { h: n.h, s: n.s, l: b(n.l + 100 * e, 0, 100), a: n.a }; }, V = function() { function t(e) { this.parsed = Ke(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 }; } return t.prototype.isValid = function() { return this.parsed !== null; }, t.prototype.brightness = function() { return h(R(this.rgba), 2); }, t.prototype.isDark = function() { return R(this.rgba) < 0.5; }, t.prototype.isLight = function() { return R(this.rgba) >= 0.5; }, t.prototype.toHex = function() { return e = N(this.rgba), n = e.r, o = e.g, r = e.b, i = (a = e.a) < 1 ? B(h(255 * a)) : "", "#" + B(n) + B(o) + B(r) + i; var e, n, o, r, a, i; }, t.prototype.toRgb = function() { return N(this.rgba); }, t.prototype.toRgbString = function() { return e = N(this.rgba), n = e.r, o = e.g, r = e.b, (a = e.a) < 1 ? "rgba(" + n + ", " + o + ", " + r + ", " + a + ")" : "rgb(" + n + ", " + o + ", " + r + ")"; var e, n, o, r, a; }, t.prototype.toHsl = function() { return X($(this.rgba)); }, t.prototype.toHslString = function() { return e = X($(this.rgba)), n = e.h, o = e.s, r = e.l, (a = e.a) < 1 ? "hsla(" + n + ", " + o + "%, " + r + "%, " + a + ")" : "hsl(" + n + ", " + o + "%, " + r + "%)"; var e, n, o, r, a; }, t.prototype.toHsv = function() { return e = be(this.rgba), { h: h(e.h), s: h(e.s), v: h(e.v), a: h(e.a, 3) }; var e; }, t.prototype.invert = function() { return g({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a }); var e; }, t.prototype.saturate = function(e) { return e === void 0 && (e = 0.1), g(S(this.rgba, e)); }, t.prototype.desaturate = function(e) { return e === void 0 && (e = 0.1), g(S(this.rgba, -e)); }, t.prototype.grayscale = function() { return g(S(this.rgba, -1)); }, t.prototype.lighten = function(e) { return e === void 0 && (e = 0.1), g(ne(this.rgba, e)); }, t.prototype.darken = function(e) { return e === void 0 && (e = 0.1), g(ne(this.rgba, -e)); }, t.prototype.rotate = function(e) { return e === void 0 && (e = 15), this.hue(this.hue() + e); }, t.prototype.alpha = function(e) { return typeof e == "number" ? g({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) : h(this.rgba.a, 3); var n; }, t.prototype.hue = function(e) { var n = $(this.rgba); return typeof e == "number" ? g({ h: e, s: n.s, l: n.l, a: n.a }) : h(n.h); }, t.prototype.isEqual = function(e) { return this.toHex() === g(e).toHex(); }, t; }(), g = function(t) { return t instanceof V ? t : new V(t); }, oe = [], Qe = function(t) { t.forEach(function(e) { oe.indexOf(e) < 0 && (e(V, q), oe.push(e)); }); }, v = function(t, e, n) { return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e; }, I = function(t) { var e = t / 255; return e < 0.04045 ? e / 12.92 : Math.pow((e + 0.055) / 1.055, 2.4); }, L = function(t) { return 255 * (t > 31308e-7 ? 1.055 * Math.pow(t, 1 / 2.4) - 0.055 : 12.92 * t); }, W = 96.422, Y = 100, D = 82.521, Xe = function(t) { var e, n, o = { x: 0.9555766 * (e = t).x + -0.0230393 * e.y + 0.0631636 * e.z, y: -0.0282895 * e.x + 1.0099416 * e.y + 0.0210077 * e.z, z: 0.0122982 * e.x + -0.020483 * e.y + 1.3299098 * e.z }; return n = { r: L(0.032404542 * o.x - 0.015371385 * o.y - 4985314e-9 * o.z), g: L(-969266e-8 * o.x + 0.018760108 * o.y + 41556e-8 * o.z), b: L(556434e-9 * o.x - 2040259e-9 * o.y + 0.010572252 * o.z), a: t.a }, { r: v(n.r, 0, 255), g: v(n.g, 0, 255), b: v(n.b, 0, 255), a: v(n.a) }; }, et = function(t) { var e = I(t.r), n = I(t.g), o = I(t.b); return function(r) { return { x: v(r.x, 0, W), y: v(r.y, 0, Y), z: v(r.z, 0, D), a: v(r.a) }; }(function(r) { return { x: 1.0478112 * r.x + 0.0228866 * r.y + -0.050127 * r.z, y: 0.0295424 * r.x + 0.9904844 * r.y + -0.0170491 * r.z, z: -92345e-7 * r.x + 0.0150436 * r.y + 0.7521316 * r.z, a: r.a }; }({ x: 100 * (0.4124564 * e + 0.3575761 * n + 0.1804375 * o), y: 100 * (0.2126729 * e + 0.7151522 * n + 0.072175 * o), z: 100 * (0.0193339 * e + 0.119192 * n + 0.9503041 * o), a: t.a })); }, k = 216 / 24389, C = 24389 / 27, re = function(t) { var e = et(t), n = e.x / W, o = e.y / Y, r = e.z / D; return n = n > k ? Math.cbrt(n) : (C * n + 16) / 116, { l: 116 * (o = o > k ? Math.cbrt(o) : (C * o + 16) / 116) - 16, a: 500 * (n - o), b: 200 * (o - (r = r > k ? Math.cbrt(r) : (C * r + 16) / 116)), alpha: e.a }; }, tt = function(t, e, n) { var o, r = re(t), a = re(e); return function(i) { var s = (i.l + 16) / 116, u = i.a / 500 + s, l = s - i.b / 200; return Xe({ x: (Math.pow(u, 3) > k ? Math.pow(u, 3) : (116 * u - 16) / C) * W, y: (i.l > 8 ? Math.pow((i.l + 16) / 116, 3) : i.l / C) * Y, z: (Math.pow(l, 3) > k ? Math.pow(l, 3) : (116 * l - 16) / C) * D, a: i.alpha }); }({ l: v((o = { l: r.l * (1 - n) + a.l * n, a: r.a * (1 - n) + a.a * n, b: r.b * (1 - n) + a.b * n, alpha: r.alpha * (1 - n) + a.alpha * n }).l, 0, 400), a: o.a, b: o.b, alpha: v(o.alpha) }); }; function nt(t) { function e(n, o, r) { r === void 0 && (r = 5); for (var a = [], i = 1 / (r - 1), s = 0; s <= r - 1; s++) a.push(n.mix(o, i * s)); return a; } t.prototype.mix = function(n, o) { o === void 0 && (o = 0.5); var r = n instanceof t ? n : new t(n), a = tt(this.toRgb(), r.toRgb(), o); return new t(a); }, t.prototype.tints = function(n) { return e(this, "#fff", n); }, t.prototype.shades = function(n) { return e(this, "#000", n); }, t.prototype.tones = function(n) { return e(this, "#808080", n); }; } Qe([nt]); function ie(t, e) { return g(t).alpha(e).toHex(); } function ot(t, e, n) { return g(t).mix(e, n).toHex(); } const rt = { style: { width: "100%", height: "100%" } }, it = /* @__PURE__ */ xe('<defs><symbol id="geometry-left" viewBox="0 0 214 36"><path d="M17 0h197v36H0v-2c4.5 0 9-3.5 9-8V8c0-4.5 3.5-8 8-8z"></path></symbol><symbol id="geometry-right" viewBox="0 0 214 36"><use xlink:href="#geometry-left"></use></symbol><clipPath><rect width="100%" height="100%" x="0"></rect></clipPath></defs>', 1), at = { width: "52%", height: "100%" }, st = ["fill"], ut = { transform: "scale(-1, 1)" }, lt = { width: "52%", height: "100%", x: "-100%", y: "0" }, ft = ["fill"], ct = /* @__PURE__ */ w({ name: "SvgRadiusBg", __name: "SvgRadiusBg", props: { darkMode: { type: Boolean, default: !1 }, isActive: { type: Boolean, default: !1 }, isHover: { type: Boolean, default: !1 }, primaryColor: { default: "#1890ff" }, bgColor: { default: () => ["#ffffff", "#18181c"] }, hoverBgColor: { default: () => ["#dee1e6", "#333333"] }, mixColor: { default: () => ["#ffffff", "#000000"] }, mixRatio: { default: () => [0.2, 0.3] } }, setup(t) { const e = t, n = j(() => { const o = Number(e.darkMode); let r = e.bgColor[o]; if (e.isHover && (r = e.hoverBgColor[o]), e.isActive) { const a = e.mixRatio[o]; r = ot(e.mixColor[o], e.primaryColor, a); } return r; }); return (o, r) => (m(), y("svg", rt, [ it, (m(), y("svg", at, [ _("use", { "xlink:href": "#geometry-left", width: "214", height: "36", fill: n.value }, null, 8, st) ])), _("g", ut, [ (m(), y("svg", lt, [ _("use", { "xlink:href": "#geometry-right", width: "214", height: "36", fill: n.value }, null, 8, ft) ])) ]) ])); } }), dt = { class: "admin-tab__button-tab__preffix" }, ht = { key: 0, class: "admin-tab__button-tab__icon" }, vt = /* @__PURE__ */ w({ name: "ButtonTab", __name: "ButtonTab", props: { darkMode: { type: Boolean, default: !1 }, isActive: { type: Boolean, default: !1 }, primaryColor: { default: "#1890ff" }, borderColor: { default: "#e5e7eb" }, darkBorderColor: { default: "#ffffff3d" }, closable: { type: Boolean, default: !0 } }, emits: ["close"], setup(t, { emit: e }) { const n = t, { bool: o, setTrue: r, setFalse: a } = O(), i = j(() => n.isActive || o.value), s = j(() => { const c = {}; if (c.borderColor = n.darkMode ? n.darkBorderColor : n.borderColor, i.value && (c.color = n.primaryColor, c.borderColor = ie(n.primaryColor, 0.3), n.isActive)) { const p = n.darkMode ? 0.15 : 0.1; c.backgroundColor = ie(n.primaryColor, p); } return c; }); function u(c) { c.stopPropagation(), e("close"); } const { c: l } = P(), f = l( ".admin-tab__button-tab", { position: "relative", display: "inline-flex", justifyContent: "center", alignItems: "center", height: "30px", paddingLeft: "14px", paddingRight: "6px", borderWidth: "1px", borderStyle: "solid", borderRadius: "2px", cursor: "pointer" }, [ l("&--unclosable", { paddingRight: "14px !important" }), l("&__preffix", { whiteSpace: "nowrap" }), l("&__icon", { paddingLeft: "10px" }) ] ); return f.render(), f.mount(), (c, p) => (m(), y("div", { class: H(["admin-tab__button-tab", { "admin-tab__button-tab--unclosable": !c.closable }]), style: ae(s.value), onMouseenter: p[0] || (p[0] = //@ts-ignore (...z) => d(r) && d(r)(...z)), onMouseleave: p[1] || (p[1] = //@ts-ignore (...z) => d(a) && d(a)(...z)) }, [ _("span", dt, [ se(c.$slots, "default") ]), c.closable ? (m(), y("div", ht, [ E(d(he), { "is-active": i.value, "active-color": c.primaryColor, onClick: u }, null, 8, ["is-active", "active-color"]) ])) : ue("", !0) ], 38)); } }), pt = { class: "admin-tab__chrome-tab__bg" }, bt = { class: "admin-tab__chrome-tab__slot" }, mt = { key: 0, class: "admin-tab__chrome-tab__icon" }, yt = /* @__PURE__ */ w({ name: "ChromeTab", __name: "ChromeTab", props: { darkMode: { type: Boolean, default: !1 }, isActive: { type: Boolean, default: !1 }, primaryColor: { default: "#1890ff" }, closable: { type: Boolean, default: !0 }, bgColor: { default: () => ["#ffffff", "#18181c"] }, hoverBgColor: { default: () => ["#dee1e6", "#3f3c37"] }, mixColor: { default: () => ["#ffffff", "#000"] }, mixRatio: { default: () => [0.13, 0.35] } }, emits: ["close"], setup(t, { emit: e }) { const { bool: n, setTrue: o, setFalse: r } = O(); function a(u) { u.stopPropagation(), e("close"); } const { c: i } = P(), s = i( ".admin-tab__chrome-tab", { position: "relative", display: "inline-flex", alignItems: "center", height: "34px", paddingLeft: "24px", paddingRight: "24px", marginRight: "-18px", cursor: "pointer" }, [ i("&--active", { zIndex: 10 }), i("&--hover", { zIndex: 9 }), i("&__bg", { position: "absolute", left: 0, bottom: 0, width: "100%", height: "100%", overflow: "hidden" }), i("&__slot", { position: "relative", zIndex: 2, whiteSpace: "nowrap" }), i("&__icon", { paddingLeft: "18px" }), i( "&__divider", { position: "absolute", right: "7.5px", zIndex: 2, width: "1px", height: "16px", backgroundColor: "#1f2225", opacity: 1, transition: "opacity 0.3s ease-in-out" }, [ i("&--hide", { opacity: 0 }), i("&--dark", { backgroundColor: "rgba(255,255,255,0.9) !important" }) ] ) ] ); return s.render(), s.mount(), (u, l) => (m(), y("div", { class: H(["admin-tab__chrome-tab", { "admin-tab__chrome-tab--active": u.isActive, "admin-tab__chrome-tab--hover": d(n) }]), onMouseenter: l[0] || (l[0] = //@ts-ignore (...f) => d(o) && d(o)(...f)), onMouseleave: l[1] || (l[1] = //@ts-ignore (...f) => d(r) && d(r)(...f)) }, [ _("div", pt, [ E(d(ct), { "dark-mode": u.darkMode, "is-active": u.isActive, "is-hover": d(n), "primary-color": u.primaryColor, "bg-color": u.bgColor, "hover-bg-color": u.hoverBgColor, "mix-color": u.mixColor, "mix-ratio": u.mixRatio }, null, 8, ["dark-mode", "is-active", "is-hover", "primary-color", "bg-color", "hover-bg-color", "mix-color", "mix-ratio"]) ]), _("span", bt, [ se(u.$slots, "default") ]), u.closable ? (m(), y("div", mt, [ E(d(he), { "is-active": u.isActive, "active-color": u.primaryColor, onClick: a }, null, 8, ["is-active", "active-color"]) ])) : ue("", !0), _("div", { class: H(["admin-tab__chrome-tab__divider", { "admin-tab__chrome-tab__divider--hide": d(n) || u.isActive, "admin-tab__chrome-tab__divider--dark": u.darkMode }]) }, null, 2) ], 34)); } }); export { vt as ButtonTab, yt as ChromeTab };