Greasy Fork is available in English.
AI 助手体验增强油猴脚本
// ==UserScript==
// @name AI Assistant Enhancer
// @namespace https://github.com/mudssky/ai-assistant-enhancer
// @version 0.1.4
// @author mudssky
// @description AI 助手体验增强油猴脚本
// @license MIT
// @icon https://vitejs.dev/logo.svg
// @homepage https://github.com/mudssky/ai-assistant-enhancer
// @homepageURL https://github.com/mudssky/ai-assistant-enhancer
// @supportURL https://github.com/mudssky/userscripts-monorepo/issues
// @match https://www.doubao.com/chat*
// @grant GM_getValue
// @grant GM_registerMenuCommand
// @grant GM_setValue
// @run-at document-end
// ==/UserScript==
(function() {
"use strict";
var __defProp = Object.defineProperty;
var __exportAll = (all, no_symbols) => {
let target = {};
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
return target;
};
function createShadowContainer(options = {}) {
const { mode = "open", hostTag = "div", attachTo = document.documentElement, containerClass = "tailwind", containerAttrs = {}, styles = [] } = options;
const host = document.createElement(hostTag);
attachTo.append(host);
const shadow = host.attachShadow({ mode });
const sheets = [];
for (const s of styles) if (s instanceof CSSStyleSheet) sheets.push(s);
else if (typeof s === "string") {
const styleEl = document.createElement("style");
styleEl.textContent = s;
shadow.appendChild(styleEl);
} else shadow.appendChild(s);
if ("adoptedStyleSheets" in Document.prototype && "replaceSync" in CSSStyleSheet.prototype && sheets.length) shadow.adoptedStyleSheets = [...shadow.adoptedStyleSheets, ...sheets];
const container = document.createElement("div");
if (containerClass) container.classList.add(containerClass);
for (const k in containerAttrs) container.setAttribute(k, containerAttrs[k]);
shadow.appendChild(container);
const teardown = () => {
host.remove();
};
return {
host,
shadow,
container,
teardown
};
}
var n, l$1, u$2, i$2, r$2, o$2, e$1, f$2, c$1, a$1, s$1, h$1, p$1, v$1, y$1, d$1 = {}, w$2 = [], _$1 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, g$2 = Array.isArray;
function m$1(n, l) {
for (var u in l) n[u] = l[u];
return n;
}
function b$1(n) {
n && n.parentNode && n.parentNode.removeChild(n);
}
function k$2(l, u, t) {
var i, r, o, e = {};
for (o in u) "key" == o ? i = u[o] : "ref" == o ? r = u[o] : e[o] = u[o];
if (arguments.length > 2 && (e.children = arguments.length > 3 ? n.call(arguments, 2) : t), "function" == typeof l && null != l.defaultProps) for (o in l.defaultProps) void 0 === e[o] && (e[o] = l.defaultProps[o]);
return x$2(l, e, i, r, null);
}
function x$2(n, t, i, r, o) {
var e = {
type: n,
props: t,
key: i,
ref: r,
__k: null,
__: null,
__b: 0,
__e: null,
__c: null,
constructor: void 0,
__v: null == o ? ++u$2 : o,
__i: -1,
__u: 0
};
return null == o && null != l$1.vnode && l$1.vnode(e), e;
}
function M$1() {
return { current: null };
}
function S(n) {
return n.children;
}
function C$2(n, l) {
this.props = n, this.context = l;
}
function $$1(n, l) {
if (null == l) return n.__ ? $$1(n.__, n.__i + 1) : null;
for (var u; l < n.__k.length; l++) if (null != (u = n.__k[l]) && null != u.__e) return u.__e;
return "function" == typeof n.type ? $$1(n) : null;
}
function I$1(n) {
if (n.__P && n.__d) {
var u = n.__v, t = u.__e, i = [], r = [], o = m$1({}, u);
o.__v = u.__v + 1, l$1.vnode && l$1.vnode(o), q$2(n.__P, o, u, n.__n, n.__P.namespaceURI, 32 & u.__u ? [t] : null, i, null == t ? $$1(u) : t, !!(32 & u.__u), r), o.__v = u.__v, o.__.__k[o.__i] = o, D$2(i, o, r), u.__e = u.__ = null, o.__e != t && P$2(o);
}
}
function P$2(n) {
if (null != (n = n.__) && null != n.__c) return n.__e = n.__c.base = null, n.__k.some(function(l) {
if (null != l && null != l.__e) return n.__e = n.__c.base = l.__e;
}), P$2(n);
}
function A$2(n) {
(!n.__d && (n.__d = !0) && i$2.push(n) && !H$1.__r++ || r$2 != l$1.debounceRendering) && ((r$2 = l$1.debounceRendering) || o$2)(H$1);
}
function H$1() {
try {
for (var n, l = 1; i$2.length;) i$2.length > l && i$2.sort(e$1), n = i$2.shift(), l = i$2.length, I$1(n);
} finally {
i$2.length = H$1.__r = 0;
}
}
function L$1(n, l, u, t, i, r, o, e, f, c, a) {
var s, h, p, v, y, _, g, m = t && t.__k || w$2, b = l.length;
for (f = T$2(u, l, m, f, b), s = 0; s < b; s++) null != (p = u.__k[s]) && (h = -1 != p.__i && m[p.__i] || d$1, p.__i = s, _ = q$2(n, p, h, i, r, o, e, f, c, a), v = p.__e, p.ref && h.ref != p.ref && (h.ref && J$1(h.ref, null, p), a.push(p.ref, p.__c || v, p)), null == y && null != v && (y = v), (g = !!(4 & p.__u)) || h.__k === p.__k ? (f = j$2(p, f, n, g), g && h.__e && (h.__e = null)) : "function" == typeof p.type && void 0 !== _ ? f = _ : v && (f = v.nextSibling), p.__u &= -7);
return u.__e = y, f;
}
function T$2(n, l, u, t, i) {
var r, o, e, f, c, a = u.length, s = a, h = 0;
for (n.__k = new Array(i), r = 0; r < i; r++) null != (o = l[r]) && "boolean" != typeof o && "function" != typeof o ? ("string" == typeof o || "number" == typeof o || "bigint" == typeof o || o.constructor == String ? o = n.__k[r] = x$2(null, o, null, null, null) : g$2(o) ? o = n.__k[r] = x$2(S, { children: o }, null, null, null) : void 0 === o.constructor && o.__b > 0 ? o = n.__k[r] = x$2(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : n.__k[r] = o, f = r + h, o.__ = n, o.__b = n.__b + 1, e = null, -1 != (c = o.__i = O$1(o, u, f, s)) && (s--, (e = u[c]) && (e.__u |= 2)), null == e || null == e.__v ? (-1 == c && (i > a ? h-- : i < a && h++), "function" != typeof o.type && (o.__u |= 4)) : c != f && (c == f - 1 ? h-- : c == f + 1 ? h++ : (c > f ? h-- : h++, o.__u |= 4))) : n.__k[r] = null;
if (s) for (r = 0; r < a; r++) null != (e = u[r]) && 0 == (2 & e.__u) && (e.__e == t && (t = $$1(e)), K$1(e, e));
return t;
}
function j$2(n, l, u, t) {
var i, r;
if ("function" == typeof n.type) {
for (i = n.__k, r = 0; i && r < i.length; r++) i[r] && (i[r].__ = n, l = j$2(i[r], l, u, t));
return l;
}
n.__e != l && (t && (l && n.type && !l.parentNode && (l = $$1(n)), u.insertBefore(n.__e, l || null)), l = n.__e);
do
l = l && l.nextSibling;
while (null != l && 8 == l.nodeType);
return l;
}
function F$2(n, l) {
return l = l || [], null == n || "boolean" == typeof n || (g$2(n) ? n.some(function(n) {
F$2(n, l);
}) : l.push(n)), l;
}
function O$1(n, l, u, t) {
var i, r, o, e = n.key, f = n.type, c = l[u], a = null != c && 0 == (2 & c.__u);
if (null === c && null == e || a && e == c.key && f == c.type) return u;
if (t > (a ? 1 : 0)) {
for (i = u - 1, r = u + 1; i >= 0 || r < l.length;) if (null != (c = l[o = i >= 0 ? i-- : r++]) && 0 == (2 & c.__u) && e == c.key && f == c.type) return o;
}
return -1;
}
function z$2(n, l, u) {
"-" == l[0] ? n.setProperty(l, null == u ? "" : u) : n[l] = null == u ? "" : "number" != typeof u || _$1.test(l) ? u : u + "px";
}
function N$1(n, l, u, t, i) {
var r, o;
n: if ("style" == l) if ("string" == typeof u) n.style.cssText = u;
else {
if ("string" == typeof t && (n.style.cssText = t = ""), t) for (l in t) u && l in u || z$2(n.style, l, "");
if (u) for (l in u) t && u[l] == t[l] || z$2(n.style, l, u[l]);
}
else if ("o" == l[0] && "n" == l[1]) r = l != (l = l.replace(s$1, "$1")), o = l.toLowerCase(), l = o in n || "onFocusOut" == l || "onFocusIn" == l ? o.slice(2) : l.slice(2), n.l || (n.l = {}), n.l[l + r] = u, u ? t ? u[a$1] = t[a$1] : (u[a$1] = h$1, n.addEventListener(l, r ? v$1 : p$1, r)) : n.removeEventListener(l, r ? v$1 : p$1, r);
else {
if ("http://www.w3.org/2000/svg" == i) l = l.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
else if ("width" != l && "height" != l && "href" != l && "list" != l && "form" != l && "tabIndex" != l && "download" != l && "rowSpan" != l && "colSpan" != l && "role" != l && "popover" != l && l in n) try {
n[l] = null == u ? "" : u;
break n;
} catch (n) {}
"function" == typeof u || (null == u || !1 === u && "-" != l[4] ? n.removeAttribute(l) : n.setAttribute(l, "popover" == l && 1 == u ? "" : u));
}
}
function V$1(n) {
return function(u) {
if (this.l) {
var t = this.l[u.type + n];
if (null == u[c$1]) u[c$1] = h$1++;
else if (u[c$1] < t[a$1]) return;
return t(l$1.event ? l$1.event(u) : u);
}
};
}
function q$2(n, u, t, i, r, o, e, f, c, a) {
var s, h, p, v, y, d, _, k, x, M, $, I, P, A, H, T = u.type;
if (void 0 !== u.constructor) return null;
128 & t.__u && (c = !!(32 & t.__u), o = [f = u.__e = t.__e]), (s = l$1.__b) && s(u);
n: if ("function" == typeof T) try {
if (k = u.props, x = T.prototype && T.prototype.render, M = (s = T.contextType) && i[s.__c], $ = s ? M ? M.props.value : s.__ : i, t.__c ? _ = (h = u.__c = t.__c).__ = h.__E : (x ? u.__c = h = new T(k, $) : (u.__c = h = new C$2(k, $), h.constructor = T, h.render = Q$1), M && M.sub(h), h.state || (h.state = {}), h.__n = i, p = h.__d = !0, h.__h = [], h._sb = []), x && null == h.__s && (h.__s = h.state), x && null != T.getDerivedStateFromProps && (h.__s == h.state && (h.__s = m$1({}, h.__s)), m$1(h.__s, T.getDerivedStateFromProps(k, h.__s))), v = h.props, y = h.state, h.__v = u, p) x && null == T.getDerivedStateFromProps && null != h.componentWillMount && h.componentWillMount(), x && null != h.componentDidMount && h.__h.push(h.componentDidMount);
else {
if (x && null == T.getDerivedStateFromProps && k !== v && null != h.componentWillReceiveProps && h.componentWillReceiveProps(k, $), u.__v == t.__v || !h.__e && null != h.shouldComponentUpdate && !1 === h.shouldComponentUpdate(k, h.__s, $)) {
u.__v != t.__v && (h.props = k, h.state = h.__s, h.__d = !1), u.__e = t.__e, u.__k = t.__k, u.__k.some(function(n) {
n && (n.__ = u);
}), w$2.push.apply(h.__h, h._sb), h._sb = [], h.__h.length && e.push(h);
break n;
}
null != h.componentWillUpdate && h.componentWillUpdate(k, h.__s, $), x && null != h.componentDidUpdate && h.__h.push(function() {
h.componentDidUpdate(v, y, d);
});
}
if (h.context = $, h.props = k, h.__P = n, h.__e = !1, I = l$1.__r, P = 0, x) h.state = h.__s, h.__d = !1, I && I(u), s = h.render(h.props, h.state, h.context), w$2.push.apply(h.__h, h._sb), h._sb = [];
else do
h.__d = !1, I && I(u), s = h.render(h.props, h.state, h.context), h.state = h.__s;
while (h.__d && ++P < 25);
h.state = h.__s, null != h.getChildContext && (i = m$1(m$1({}, i), h.getChildContext())), x && !p && null != h.getSnapshotBeforeUpdate && (d = h.getSnapshotBeforeUpdate(v, y)), A = null != s && s.type === S && null == s.key ? E$1(s.props.children) : s, f = L$1(n, g$2(A) ? A : [A], u, t, i, r, o, e, f, c, a), h.base = u.__e, u.__u &= -161, h.__h.length && e.push(h), _ && (h.__E = h.__ = null);
} catch (n) {
if (u.__v = null, c || null != o) if (n.then) {
for (u.__u |= c ? 160 : 128; f && 8 == f.nodeType && f.nextSibling;) f = f.nextSibling;
o[o.indexOf(f)] = null, u.__e = f;
} else {
for (H = o.length; H--;) b$1(o[H]);
B$2(u);
}
else u.__e = t.__e, u.__k = t.__k, n.then || B$2(u);
l$1.__e(n, u, t);
}
else null == o && u.__v == t.__v ? (u.__k = t.__k, u.__e = t.__e) : f = u.__e = G$1(t.__e, u, t, i, r, o, e, c, a);
return (s = l$1.diffed) && s(u), 128 & u.__u ? void 0 : f;
}
function B$2(n) {
n && (n.__c && (n.__c.__e = !0), n.__k && n.__k.some(B$2));
}
function D$2(n, u, t) {
for (var i = 0; i < t.length; i++) J$1(t[i], t[++i], t[++i]);
l$1.__c && l$1.__c(u, n), n.some(function(u) {
try {
n = u.__h, u.__h = [], n.some(function(n) {
n.call(u);
});
} catch (n) {
l$1.__e(n, u.__v);
}
});
}
function E$1(n) {
return "object" != typeof n || null == n || n.__b > 0 ? n : g$2(n) ? n.map(E$1) : void 0 !== n.constructor ? null : m$1({}, n);
}
function G$1(u, t, i, r, o, e, f, c, a) {
var s, h, p, v, y, w, _, m = i.props || d$1, k = t.props, x = t.type;
if ("svg" == x ? o = "http://www.w3.org/2000/svg" : "math" == x ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), null != e) {
for (s = 0; s < e.length; s++) if ((y = e[s]) && "setAttribute" in y == !!x && (x ? y.localName == x : 3 == y.nodeType)) {
u = y, e[s] = null;
break;
}
}
if (null == u) {
if (null == x) return document.createTextNode(k);
u = document.createElementNS(o, x, k.is && k), c && (l$1.__m && l$1.__m(t, e), c = !1), e = null;
}
if (null == x) m === k || c && u.data == k || (u.data = k);
else {
if (e = "textarea" == x && null != k.defaultValue ? null : e && n.call(u.childNodes), !c && null != e) for (m = {}, s = 0; s < u.attributes.length; s++) m[(y = u.attributes[s]).name] = y.value;
for (s in m) y = m[s], "dangerouslySetInnerHTML" == s ? p = y : "children" == s || s in k || "value" == s && "defaultValue" in k || "checked" == s && "defaultChecked" in k || N$1(u, s, null, y, o);
for (s in k) y = k[s], "children" == s ? v = y : "dangerouslySetInnerHTML" == s ? h = y : "value" == s ? w = y : "checked" == s ? _ = y : c && "function" != typeof y || m[s] === y || N$1(u, s, y, m[s], o);
if (h) c || p && (h.__html == p.__html || h.__html == u.innerHTML) || (u.innerHTML = h.__html), t.__k = [];
else if (p && (u.innerHTML = ""), L$1("template" == t.type ? u.content : u, g$2(v) ? v : [v], t, i, r, "foreignObject" == x ? "http://www.w3.org/1999/xhtml" : o, e, f, e ? e[0] : i.__k && $$1(i, 0), c, a), null != e) for (s = e.length; s--;) b$1(e[s]);
c && "textarea" != x || (s = "value", "progress" == x && null == w ? u.removeAttribute("value") : null != w && (w !== u[s] || "progress" == x && !w || "option" == x && w != m[s]) && N$1(u, s, w, m[s], o), s = "checked", null != _ && _ != u[s] && N$1(u, s, _, m[s], o));
}
return u;
}
function J$1(n, u, t) {
try {
if ("function" == typeof n) {
var i = "function" == typeof n.__u;
i && n.__u(), i && null == u || (n.__u = n(u));
} else n.current = u;
} catch (n) {
l$1.__e(n, t);
}
}
function K$1(n, u, t) {
var i, r;
if (l$1.unmount && l$1.unmount(n), (i = n.ref) && (i.current && i.current != n.__e || J$1(i, null, u)), null != (i = n.__c)) {
if (i.componentWillUnmount) try {
i.componentWillUnmount();
} catch (n) {
l$1.__e(n, u);
}
i.base = i.__P = null;
}
if (i = n.__k) for (r = 0; r < i.length; r++) i[r] && K$1(i[r], u, t || "function" != typeof n.type);
t || b$1(n.__e), n.__c = n.__ = n.__e = void 0;
}
function Q$1(n, l, u) {
return this.constructor(n, u);
}
function R$1(u, t, i) {
var r, o, e, f;
t == document && (t = document.documentElement), l$1.__ && l$1.__(u, t), o = (r = "function" == typeof i) ? null : i && i.__k || t.__k, e = [], f = [], q$2(t, u = (!r && i || t).__k = k$2(S, null, [u]), o || d$1, d$1, t.namespaceURI, !r && i ? [i] : o ? null : t.firstChild ? n.call(t.childNodes) : null, e, !r && i ? i : o ? o.__e : t.firstChild, r, f), D$2(e, u, f);
}
function U$1(n, l) {
R$1(n, l, U$1);
}
function W$1(l, u, t) {
var i, r, o, e, f = m$1({}, l.props);
for (o in l.type && l.type.defaultProps && (e = l.type.defaultProps), u) "key" == o ? i = u[o] : "ref" == o ? r = u[o] : f[o] = void 0 === u[o] && null != e ? e[o] : u[o];
return arguments.length > 2 && (f.children = arguments.length > 3 ? n.call(arguments, 2) : t), x$2(l.type, f, i || l.key, r || l.ref, null);
}
function X$1(n) {
function l(n) {
var u, t;
return this.getChildContext || (u = new Set(), (t = {})[l.__c] = this, this.getChildContext = function() {
return t;
}, this.componentWillUnmount = function() {
u = null;
}, this.shouldComponentUpdate = function(n) {
this.props.value != n.value && u.forEach(function(n) {
n.__e = !0, A$2(n);
});
}, this.sub = function(n) {
u.add(n);
var l = n.componentWillUnmount;
n.componentWillUnmount = function() {
u && u.delete(n), l && l.call(n);
};
}), n.children;
}
return l.__c = "__cC" + y$1++, l.__ = n, l.Provider = l.__l = (l.Consumer = function(n, l) {
return n.children(l);
}).contextType = l, l;
}
n = w$2.slice, l$1 = { __e: function(n, l, u, t) {
for (var i, r, o; l = l.__;) if ((i = l.__c) && !i.__) try {
if ((r = i.constructor) && null != r.getDerivedStateFromError && (i.setState(r.getDerivedStateFromError(n)), o = i.__d), null != i.componentDidCatch && (i.componentDidCatch(n, t || {}), o = i.__d), o) return i.__E = i;
} catch (l) {
n = l;
}
throw n;
} }, u$2 = 0, C$2.prototype.setState = function(n, l) {
var u = null != this.__s && this.__s != this.state ? this.__s : this.__s = m$1({}, this.state);
"function" == typeof n && (n = n(m$1({}, u), this.props)), n && m$1(u, n), null != n && this.__v && (l && this._sb.push(l), A$2(this));
}, C$2.prototype.forceUpdate = function(n) {
this.__v && (this.__e = !0, n && this.__h.push(n), A$2(this));
}, C$2.prototype.render = S, i$2 = [], o$2 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e$1 = function(n, l) {
return n.__v.__b - l.__v.__b;
}, H$1.__r = 0, f$2 = Math.random().toString(8), c$1 = "__d" + f$2, a$1 = "__a" + f$2, s$1 = /(PointerCapture)$|Capture$/i, h$1 = 0, p$1 = V$1(!1), v$1 = V$1(!0), y$1 = 0;
var t, r$1, u$1, i$1, o$1 = 0, f$1 = [], c = l$1, e = c.__b, a = c.__r, v = c.diffed, l = c.__c, m = c.unmount, s = c.__;
function p(n, t) {
c.__h && c.__h(r$1, n, o$1 || t), o$1 = 0;
var u = r$1.__H || (r$1.__H = {
__: [],
__h: []
});
return n >= u.__.length && u.__.push({}), u.__[n];
}
function d(n) {
return o$1 = 1, h(D$1, n);
}
function h(n, u, i) {
var o = p(t++, 2);
if (o.t = n, !o.__c && (o.__ = [i ? i(u) : D$1(void 0, u), function(n) {
var t = o.__N ? o.__N[0] : o.__[0], r = o.t(t, n);
t !== r && (o.__N = [r, o.__[1]], o.__c.setState({}));
}], o.__c = r$1, !r$1.__f)) {
var f = function(n, t, r) {
if (!o.__c.__H) return !0;
var u = o.__c.__H.__.filter(function(n) {
return n.__c;
});
if (u.every(function(n) {
return !n.__N;
})) return !c || c.call(this, n, t, r);
var i = o.__c.props !== n;
return u.some(function(n) {
if (n.__N) {
var t = n.__[0];
n.__ = n.__N, n.__N = void 0, t !== n.__[0] && (i = !0);
}
}), c && c.call(this, n, t, r) || i;
};
r$1.__f = !0;
var c = r$1.shouldComponentUpdate, e = r$1.componentWillUpdate;
r$1.componentWillUpdate = function(n, t, r) {
if (this.__e) {
var u = c;
c = void 0, f(n, t, r), c = u;
}
e && e.call(this, n, t, r);
}, r$1.shouldComponentUpdate = f;
}
return o.__N || o.__;
}
function y(n, u) {
var i = p(t++, 3);
!c.__s && C$1(i.__H, u) && (i.__ = n, i.u = u, r$1.__H.__h.push(i));
}
function _(n, u) {
var i = p(t++, 4);
!c.__s && C$1(i.__H, u) && (i.__ = n, i.u = u, r$1.__h.push(i));
}
function A$1(n) {
return o$1 = 5, T$1(function() {
return { current: n };
}, []);
}
function F$1(n, t, r) {
o$1 = 6, _(function() {
if ("function" == typeof n) {
var r = n(t());
return function() {
n(null), r && "function" == typeof r && r();
};
}
if (n) return n.current = t(), function() {
return n.current = null;
};
}, null == r ? r : r.concat(n));
}
function T$1(n, r) {
var u = p(t++, 7);
return C$1(u.__H, r) && (u.__ = n(), u.__H = r, u.__h = n), u.__;
}
function q$1(n, t) {
return o$1 = 8, T$1(function() {
return n;
}, t);
}
function x$1(n) {
var u = r$1.context[n.__c], i = p(t++, 9);
return i.c = n, u ? (i.__ ?? (i.__ = !0, u.sub(r$1)), u.props.value) : n.__;
}
function P$1(n, t) {
c.useDebugValue && c.useDebugValue(t ? t(n) : n);
}
function b(n) {
var u = p(t++, 10), i = d();
return u.__ = n, r$1.componentDidCatch || (r$1.componentDidCatch = function(n, t) {
u.__ && u.__(n, t), i[1](n);
}), [i[0], function() {
i[1](void 0);
}];
}
function g$1() {
var n = p(t++, 11);
if (!n.__) {
for (var u = r$1.__v; null !== u && !u.__m && null !== u.__;) u = u.__;
var i = u.__m || (u.__m = [0, 0]);
n.__ = "P" + i[0] + "-" + i[1]++;
}
return n.__;
}
function j$1() {
for (var n; n = f$1.shift();) {
var t = n.__H;
if (n.__P && t) try {
t.__h.some(z$1), t.__h.some(B$1), t.__h = [];
} catch (r) {
t.__h = [], c.__e(r, n.__v);
}
}
}
c.__b = function(n) {
r$1 = null, e && e(n);
}, c.__ = function(n, t) {
n && t.__k && t.__k.__m && (n.__m = t.__k.__m), s && s(n, t);
}, c.__r = function(n) {
a && a(n), t = 0;
var i = (r$1 = n.__c).__H;
i && (u$1 === r$1 ? (i.__h = [], r$1.__h = [], i.__.some(function(n) {
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
})) : (i.__h.some(z$1), i.__h.some(B$1), i.__h = [], t = 0)), u$1 = r$1;
}, c.diffed = function(n) {
v && v(n);
var t = n.__c;
t && t.__H && (t.__H.__h.length && (1 !== f$1.push(t) && i$1 === c.requestAnimationFrame || ((i$1 = c.requestAnimationFrame) || w$1)(j$1)), t.__H.__.some(function(n) {
n.u && (n.__H = n.u), n.u = void 0;
})), u$1 = r$1 = null;
}, c.__c = function(n, t) {
t.some(function(n) {
try {
n.__h.some(z$1), n.__h = n.__h.filter(function(n) {
return !n.__ || B$1(n);
});
} catch (r) {
t.some(function(n) {
n.__h && (n.__h = []);
}), t = [], c.__e(r, n.__v);
}
}), l && l(n, t);
}, c.unmount = function(n) {
m && m(n);
var t, r = n.__c;
r && r.__H && (r.__H.__.some(function(n) {
try {
z$1(n);
} catch (n) {
t = n;
}
}), r.__H = void 0, t && c.__e(t, r.__v));
};
var k$1 = "function" == typeof requestAnimationFrame;
function w$1(n) {
var t, r = function() {
clearTimeout(u), k$1 && cancelAnimationFrame(t), setTimeout(n);
}, u = setTimeout(r, 35);
k$1 && (t = requestAnimationFrame(r));
}
function z$1(n) {
var t = r$1, u = n.__c;
"function" == typeof u && (n.__c = void 0, u()), r$1 = t;
}
function B$1(n) {
var t = r$1;
n.__c = n.__(), r$1 = t;
}
function C$1(n, t) {
return !n || n.length !== t.length || t.some(function(t, r) {
return t !== n[r];
});
}
function D$1(n, t) {
return "function" == typeof t ? t(n) : t;
}
var compat_module_exports = __exportAll({
Children: () => L,
Component: () => C$2,
Fragment: () => S,
PureComponent: () => M,
StrictMode: () => S,
Suspense: () => P,
SuspenseList: () => B,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: () => fn,
cloneElement: () => mn,
createContext: () => X$1,
createElement: () => k$2,
createFactory: () => sn,
createPortal: () => $,
createRef: () => M$1,
default: () => gn,
findDOMNode: () => yn,
flushSync: () => bn,
forwardRef: () => D,
hydrate: () => tn,
isElement: () => Sn,
isFragment: () => vn,
isMemo: () => dn,
isValidElement: () => hn,
lazy: () => z,
memo: () => N,
render: () => nn,
startTransition: () => x,
unmountComponentAtNode: () => pn,
unstable_batchedUpdates: () => _n,
useCallback: () => q$1,
useContext: () => x$1,
useDebugValue: () => P$1,
useDeferredValue: () => w,
useEffect: () => y,
useErrorBoundary: () => b,
useId: () => g$1,
useImperativeHandle: () => F$1,
useInsertionEffect: () => I,
useLayoutEffect: () => _,
useMemo: () => T$1,
useReducer: () => h,
useRef: () => A$1,
useState: () => d,
useSyncExternalStore: () => C,
useTransition: () => k,
version: () => an
});
function g(n, t) {
for (var e in t) n[e] = t[e];
return n;
}
function E(n, t) {
for (var e in n) if ("__source" !== e && !(e in t)) return !0;
for (var r in t) if ("__source" !== r && n[r] !== t[r]) return !0;
return !1;
}
function C(n, t) {
var e = t(), r = d({ t: {
__: e,
u: t
} }), u = r[0].t, o = r[1];
return _(function() {
u.__ = e, u.u = t, R(u) && o({ t: u });
}, [
n,
e,
t
]), y(function() {
return R(u) && o({ t: u }), n(function() {
R(u) && o({ t: u });
});
}, [n]), e;
}
function R(n) {
try {
return !((t = n.__) === (e = n.u()) && (0 !== t || 1 / t == 1 / e) || t != t && e != e);
} catch (n) {
return !0;
}
var t, e;
}
function x(n) {
n();
}
function w(n) {
return n;
}
function k() {
return [!1, x];
}
var I = _;
function M(n, t) {
this.props = n, this.context = t;
}
function N(n, e) {
function r(n) {
var t = this.props.ref;
return t != n.ref && t && ("function" == typeof t ? t(null) : t.current = null), e ? !e(this.props, n) || t != n.ref : E(this.props, n);
}
function u(e) {
return this.shouldComponentUpdate = r, k$2(n, e);
}
return u.displayName = "Memo(" + (n.displayName || n.name) + ")", u.__f = u.prototype.isReactComponent = !0, u.type = n, u;
}
(M.prototype = new C$2()).isPureReactComponent = !0, M.prototype.shouldComponentUpdate = function(n, t) {
return E(this.props, n) || E(this.state, t);
};
var T = l$1.__b;
l$1.__b = function(n) {
n.type && n.type.__f && n.ref && (n.props.ref = n.ref, n.ref = null), T && T(n);
};
var A = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.forward_ref") || 3911;
function D(n) {
function t(t) {
var e = g({}, t);
return delete e.ref, n(e, t.ref || null);
}
return t.$$typeof = A, t.render = n, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (n.displayName || n.name) + ")", t;
}
var F = function(n, t) {
return null == n ? null : F$2(F$2(n).map(t));
}, L = {
map: F,
forEach: F,
count: function(n) {
return n ? F$2(n).length : 0;
},
only: function(n) {
var t = F$2(n);
if (1 !== t.length) throw "Children.only";
return t[0];
},
toArray: F$2
}, O = l$1.__e;
l$1.__e = function(n, t, e, r) {
if (n.then) {
for (var u, o = t; o = o.__;) if ((u = o.__c) && u.__c) return t.__e ?? (t.__e = e.__e, t.__k = e.__k), u.__c(n, t);
}
O(n, t, e, r);
};
var U = l$1.unmount;
function V(n, t, e) {
return n && (n.__c && n.__c.__H && (n.__c.__H.__.forEach(function(n) {
"function" == typeof n.__c && n.__c();
}), n.__c.__H = null), null != (n = g({}, n)).__c && (n.__c.__P === e && (n.__c.__P = t), n.__c.__e = !0, n.__c = null), n.__k = n.__k && n.__k.map(function(n) {
return V(n, t, e);
})), n;
}
function W(n, t, e) {
return n && e && (n.__v = null, n.__k = n.__k && n.__k.map(function(n) {
return W(n, t, e);
}), n.__c && n.__c.__P === t && (n.__e && e.appendChild(n.__e), n.__c.__e = !0, n.__c.__P = e)), n;
}
function P() {
this.__u = 0, this.o = null, this.__b = null;
}
function j(n) {
var t = n.__ && n.__.__c;
return t && t.__a && t.__a(n);
}
function z(n) {
var e, r, u, o = null;
function i(i) {
if (e || (e = n()).then(function(n) {
n && (o = n.default || n), u = !0;
}, function(n) {
r = n, u = !0;
}), r) throw r;
if (!u) throw e;
return o ? k$2(o, i) : null;
}
return i.displayName = "Lazy", i.__f = !0, i;
}
function B() {
this.i = null, this.l = null;
}
l$1.unmount = function(n) {
var t = n.__c;
t && (t.__z = !0), t && t.__R && t.__R(), t && 32 & n.__u && (n.type = null), U && U(n);
}, (P.prototype = new C$2()).__c = function(n, t) {
var e = t.__c, r = this;
r.o ??= [], r.o.push(e);
var u = j(r.__v), o = !1, i = function() {
o || r.__z || (o = !0, e.__R = null, u ? u(c) : c());
};
e.__R = i;
var l = e.__P;
e.__P = null;
var c = function() {
if (!--r.__u) {
if (r.state.__a) {
var n = r.state.__a;
r.__v.__k[0] = W(n, n.__c.__P, n.__c.__O);
}
var t;
for (r.setState({ __a: r.__b = null }); t = r.o.pop();) t.__P = l, t.forceUpdate();
}
};
r.__u++ || 32 & t.__u || r.setState({ __a: r.__b = r.__v.__k[0] }), n.then(i, i);
}, P.prototype.componentWillUnmount = function() {
this.o = [];
}, P.prototype.render = function(n, e) {
if (this.__b) {
if (this.__v.__k) {
var r = document.createElement("div"), o = this.__v.__k[0].__c;
this.__v.__k[0] = V(this.__b, r, o.__O = o.__P);
}
this.__b = null;
}
var i = e.__a && k$2(S, null, n.fallback);
return i && (i.__u &= -33), [k$2(S, null, e.__a ? null : n.children), i];
};
var H = function(n, t, e) {
if (++e[1] === e[0] && n.l.delete(t), n.props.revealOrder && ("t" !== n.props.revealOrder[0] || !n.l.size)) for (e = n.i; e;) {
for (; e.length > 3;) e.pop()();
if (e[1] < e[0]) break;
n.i = e = e[2];
}
};
function Z(n) {
return this.getChildContext = function() {
return n.context;
}, n.children;
}
function Y(n) {
var e = this, r = n.h;
if (e.componentWillUnmount = function() {
R$1(null, e.v), e.v = null, e.h = null;
}, e.h && e.h !== r && e.componentWillUnmount(), !e.v) {
for (var u = e.__v; null !== u && !u.__m && null !== u.__;) u = u.__;
e.h = r, e.v = {
nodeType: 1,
parentNode: r,
childNodes: [],
__k: { __m: u.__m },
contains: function() {
return !0;
},
namespaceURI: r.namespaceURI,
insertBefore: function(n, t) {
this.childNodes.push(n), e.h.insertBefore(n, t);
},
removeChild: function(n) {
this.childNodes.splice(this.childNodes.indexOf(n) >>> 1, 1), e.h.removeChild(n);
}
};
}
R$1(k$2(Z, { context: e.context }, n.__v), e.v);
}
function $(n, e) {
var r = k$2(Y, {
__v: n,
h: e
});
return r.containerInfo = e, r;
}
(B.prototype = new C$2()).__a = function(n) {
var t = this, e = j(t.__v), r = t.l.get(n);
return r[0]++, function(u) {
var o = function() {
t.props.revealOrder ? (r.push(u), H(t, n, r)) : u();
};
e ? e(o) : o();
};
}, B.prototype.render = function(n) {
this.i = null, this.l = new Map();
var t = F$2(n.children);
n.revealOrder && "b" === n.revealOrder[0] && t.reverse();
for (var e = t.length; e--;) this.l.set(t[e], this.i = [
1,
0,
this.i
]);
return n.children;
}, B.prototype.componentDidUpdate = B.prototype.componentDidMount = function() {
var n = this;
this.l.forEach(function(t, e) {
H(n, e, t);
});
};
var q = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103, G = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, J = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, K = /[A-Z0-9]/g, Q = "undefined" != typeof document, X = function(n) {
return ("undefined" != typeof Symbol && "symbol" == typeof Symbol() ? /fil|che|rad/ : /fil|che|ra/).test(n);
};
function nn(n, t, e) {
return t.__k ?? (t.textContent = ""), R$1(n, t), "function" == typeof e && e(), n ? n.__c : null;
}
function tn(n, t, e) {
return U$1(n, t), "function" == typeof e && e(), n ? n.__c : null;
}
C$2.prototype.isReactComponent = !0, [
"componentWillMount",
"componentWillReceiveProps",
"componentWillUpdate"
].forEach(function(t) {
Object.defineProperty(C$2.prototype, t, {
configurable: !0,
get: function() {
return this["UNSAFE_" + t];
},
set: function(n) {
Object.defineProperty(this, t, {
configurable: !0,
writable: !0,
value: n
});
}
});
});
var en = l$1.event;
l$1.event = function(n) {
return en && (n = en(n)), n.persist = function() {}, n.isPropagationStopped = function() {
return this.cancelBubble;
}, n.isDefaultPrevented = function() {
return this.defaultPrevented;
}, n.nativeEvent = n;
};
var rn, un = {
configurable: !0,
get: function() {
return this.class;
}
}, on = l$1.vnode;
l$1.vnode = function(n) {
"string" == typeof n.type && function(n) {
var t = n.props, e = n.type, u = {}, o = -1 == e.indexOf("-");
for (var i in t) {
var l = t[i];
if (!("value" === i && "defaultValue" in t && null == l || Q && "children" === i && "noscript" === e || "class" === i || "className" === i)) {
var c = i.toLowerCase();
"defaultValue" === i && "value" in t && null == t.value ? i = "value" : "download" === i && !0 === l ? l = "" : "translate" === c && "no" === l ? l = !1 : "o" === c[0] && "n" === c[1] ? "ondoubleclick" === c ? i = "ondblclick" : "onchange" !== c || "input" !== e && "textarea" !== e || X(t.type) ? "onfocus" === c ? i = "onfocusin" : "onblur" === c ? i = "onfocusout" : J.test(i) && (i = c) : c = i = "oninput" : o && G.test(i) ? i = i.replace(K, "-$&").toLowerCase() : null === l && (l = void 0), "oninput" === c && u[i = c] && (i = "oninputCapture"), u[i] = l;
}
}
"select" == e && (u.multiple && Array.isArray(u.value) && (u.value = F$2(t.children).forEach(function(n) {
n.props.selected = -1 != u.value.indexOf(n.props.value);
})), null != u.defaultValue && (u.value = F$2(t.children).forEach(function(n) {
n.props.selected = u.multiple ? -1 != u.defaultValue.indexOf(n.props.value) : u.defaultValue == n.props.value;
}))), t.class && !t.className ? (u.class = t.class, Object.defineProperty(u, "className", un)) : t.className && (u.class = u.className = t.className), n.props = u;
}(n), n.$$typeof = q, on && on(n);
};
var ln = l$1.__r;
l$1.__r = function(n) {
ln && ln(n), rn = n.__c;
};
var cn$1 = l$1.diffed;
l$1.diffed = function(n) {
cn$1 && cn$1(n);
var t = n.props, e = n.__e;
null != e && "textarea" === n.type && "value" in t && t.value !== e.value && (e.value = null == t.value ? "" : t.value), rn = null;
};
var fn = { ReactCurrentDispatcher: { current: {
readContext: function(n) {
return rn.__n[n.__c].props.value;
},
useCallback: q$1,
useContext: x$1,
useDebugValue: P$1,
useDeferredValue: w,
useEffect: y,
useId: g$1,
useImperativeHandle: F$1,
useInsertionEffect: I,
useLayoutEffect: _,
useMemo: T$1,
useReducer: h,
useRef: A$1,
useState: d,
useSyncExternalStore: C,
useTransition: k
} } }, an = "18.3.1";
function sn(n) {
return k$2.bind(null, n);
}
function hn(n) {
return !!n && n.$$typeof === q;
}
function vn(n) {
return hn(n) && n.type === S;
}
function dn(n) {
return !!n && "string" == typeof n.displayName && 0 == n.displayName.indexOf("Memo(");
}
function mn(n) {
return hn(n) ? W$1.apply(null, arguments) : n;
}
function pn(n) {
return !!n.__k && (R$1(null, n), !0);
}
function yn(n) {
return n && (n.base || 1 === n.nodeType && n) || null;
}
var _n = function(n, t) {
return n(t);
}, bn = function(n, t) {
var r = l$1.debounceRendering;
l$1.debounceRendering = function(n) {
return n();
};
var u = n(t);
return l$1.debounceRendering = r, u;
}, Sn = hn, gn = {
useState: d,
useId: g$1,
useReducer: h,
useEffect: y,
useLayoutEffect: _,
useInsertionEffect: I,
useTransition: k,
useDeferredValue: w,
useSyncExternalStore: C,
startTransition: x,
useRef: A$1,
useImperativeHandle: F$1,
useMemo: T$1,
useCallback: q$1,
useContext: x$1,
useDebugValue: P$1,
version: "18.3.1",
Children: L,
render: nn,
hydrate: tn,
unmountComponentAtNode: pn,
createPortal: $,
createElement: k$2,
createContext: X$1,
createFactory: sn,
cloneElement: mn,
createRef: M$1,
Fragment: S,
isValidElement: hn,
isElement: Sn,
isFragment: vn,
isMemo: dn,
findDOMNode: yn,
Component: C$2,
PureComponent: M,
memo: N,
forwardRef: D,
flushSync: bn,
unstable_batchedUpdates: _n,
StrictMode: S,
Suspense: P,
SuspenseList: B,
lazy: z,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: fn
};
var _GM_getValue = (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)();
var _GM_registerMenuCommand = (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
var _GM_setValue = (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)();
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
}).join(" ").trim();
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
var toCamelCase = (string) => string.replace(/^([A-Z])|[\s-_]+(\w)/g, (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase());
var toPascalCase = (string) => {
const camelCase = toCamelCase(string);
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
};
var defaultAttributes = {
xmlns: "http://www.w3.org/2000/svg",
width: 24,
height: 24,
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
"stroke-width": "2",
"stroke-linecap": "round",
"stroke-linejoin": "round"
};
var LucideContext = X$1({
size: 24,
color: "currentColor",
strokeWidth: 2,
absoluteStrokeWidth: false,
class: ""
});
var useLucideContext = () => x$1(LucideContext);
var hasA11yProp = (props) => {
for (const prop in props) if (prop.startsWith("aria-") || prop === "role" || prop === "title") return true;
return false;
};
var Icon = ({ color, size, strokeWidth, absoluteStrokeWidth, children, iconNode, class: classes = "", ...rest }) => {
const { size: contextSize = 24, strokeWidth: contextStrokeWidth = 2, absoluteStrokeWidth: contextAbsoluteStrokeWidth = false, color: contextColor = "currentColor", class: contextClass = "" } = useLucideContext() ?? {};
const calculatedStrokeWidth = absoluteStrokeWidth ?? contextAbsoluteStrokeWidth ? Number(strokeWidth ?? contextStrokeWidth) * 24 / Number(size ?? contextSize) : strokeWidth ?? contextStrokeWidth;
return k$2("svg", {
...defaultAttributes,
width: size ?? contextSize ?? 24,
height: size ?? contextSize ?? 24,
stroke: color ?? contextColor,
["stroke-width"]: calculatedStrokeWidth,
class: mergeClasses("lucide", contextClass, classes),
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
...rest
}, [...iconNode.map(([tag, attrs]) => k$2(tag, attrs)), ...F$2(children)]);
};
var createLucideIcon = (iconName, iconNode) => {
const Component = ({ class: classes = "", className = "", children, ...props }) => k$2(Icon, {
...props,
iconNode,
class: mergeClasses(`lucide-${toKebabCase(toPascalCase(iconName))}`, `lucide-${toKebabCase(iconName)}`, classes, className)
}, children);
Component.displayName = toPascalCase(iconName);
return Component;
};
var ArrowDown = createLucideIcon("arrow-down", [["path", {
d: "M12 5v14",
key: "s699le"
}], ["path", {
d: "m19 12-7 7-7-7",
key: "1idqje"
}]]);
var ArrowUp = createLucideIcon("arrow-up", [["path", {
d: "m5 12 7-7 7 7",
key: "hav0vg"
}], ["path", {
d: "M12 19V5",
key: "x0mq9r"
}]]);
var Bot = createLucideIcon("bot", [
["path", {
d: "M12 8V4H8",
key: "hb8ula"
}],
["rect", {
width: "16",
height: "12",
x: "4",
y: "8",
rx: "2",
key: "enze0r"
}],
["path", {
d: "M2 14h2",
key: "vft8re"
}],
["path", {
d: "M20 14h2",
key: "4cs60a"
}],
["path", {
d: "M15 13v2",
key: "1xurst"
}],
["path", {
d: "M9 13v2",
key: "rq6x2g"
}]
]);
var ChevronLeft = createLucideIcon("chevron-left", [["path", {
d: "m15 18-6-6 6-6",
key: "1wnfg3"
}]]);
var ChevronRight = createLucideIcon("chevron-right", [["path", {
d: "m9 18 6-6-6-6",
key: "mthhwq"
}]]);
var RefreshCw = createLucideIcon("refresh-cw", [
["path", {
d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",
key: "v9h5vc"
}],
["path", {
d: "M21 3v5h-5",
key: "1q7to0"
}],
["path", {
d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",
key: "3uifl3"
}],
["path", {
d: "M8 16H3v5",
key: "1cv678"
}]
]);
var CONFIG_STORAGE_KEY = "aiAssistantEnhancerConfig";
var MAX_MODE_SWITCH_CONFIRM_MS = 5e3;
var MAX_AUTO_CHECK_DELAY_MS = 1e4;
var DEFAULT_DOUBAO_MODE_ORDER = [
"expert",
"office",
"fast"
];
var DOUBAO_MODE_LABELS = {
fast: "快速",
expert: "专家",
office: "办公任务"
};
var DEFAULT_CONFIG = {
enabled: true,
panelCollapsed: true,
assistants: { doubao: {
enabled: true,
preferredModeStrategy: "expert-first",
preferredModeOrder: [...DEFAULT_DOUBAO_MODE_ORDER],
autoCheckDelayMs: 2500,
modeSwitchConfirmMs: 1600
} }
};
function isRecord(value) {
return typeof value === "object" && value !== null && !Array.isArray(value);
}
function isSelectableAssistantMode(value) {
return value === "fast" || value === "expert" || value === "office";
}
function normalizePreferredModeOrder(value) {
const order = [];
if (Array.isArray(value)) {
for (const mode of value) if (isSelectableAssistantMode(mode) && !order.includes(mode)) order.push(mode);
}
for (const mode of DEFAULT_DOUBAO_MODE_ORDER) if (!order.includes(mode)) order.push(mode);
return order;
}
function normalizeModeSwitchConfirmMs(value) {
if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_CONFIG.assistants.doubao.modeSwitchConfirmMs;
return Math.min(MAX_MODE_SWITCH_CONFIRM_MS, Math.max(500, Math.round(value)));
}
function normalizeAutoCheckDelayMs(value) {
if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_CONFIG.assistants.doubao.autoCheckDelayMs;
return Math.min(MAX_AUTO_CHECK_DELAY_MS, Math.max(0, Math.round(value)));
}
function normalizeConfig(value) {
if (!isRecord(value)) return DEFAULT_CONFIG;
const assistants = isRecord(value.assistants) ? value.assistants : {};
const doubao = isRecord(assistants.doubao) ? assistants.doubao : {};
const preferredModeStrategy = doubao.preferredModeStrategy === "expert-first" ? doubao.preferredModeStrategy : DEFAULT_CONFIG.assistants.doubao.preferredModeStrategy;
return {
enabled: typeof value.enabled === "boolean" ? value.enabled : DEFAULT_CONFIG.enabled,
panelCollapsed: typeof value.panelCollapsed === "boolean" ? value.panelCollapsed : DEFAULT_CONFIG.panelCollapsed,
assistants: { doubao: {
enabled: typeof doubao.enabled === "boolean" ? doubao.enabled : DEFAULT_CONFIG.assistants.doubao.enabled,
preferredModeStrategy,
preferredModeOrder: normalizePreferredModeOrder(doubao.preferredModeOrder),
autoCheckDelayMs: normalizeAutoCheckDelayMs(doubao.autoCheckDelayMs),
modeSwitchConfirmMs: normalizeModeSwitchConfirmMs(doubao.modeSwitchConfirmMs)
} }
};
}
function isDoubaoEnabled(config) {
return config.enabled && config.assistants.doubao.enabled;
}
function r(e) {
var t, f, n = "";
if ("string" == typeof e || "number" == typeof e) n += e;
else if ("object" == typeof e) if (Array.isArray(e)) {
var o = e.length;
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
} else for (f in e) e[f] && (n && (n += " "), n += f);
return n;
}
function clsx() {
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
return n;
}
var concatArrays = (array1, array2) => {
const combinedArray = new Array(array1.length + array2.length);
for (let i = 0; i < array1.length; i++) combinedArray[i] = array1[i];
for (let i = 0; i < array2.length; i++) combinedArray[array1.length + i] = array2[i];
return combinedArray;
};
var createClassValidatorObject = (classGroupId, validator) => ({
classGroupId,
validator
});
var createClassPartObject = (nextPart = new Map(), validators = null, classGroupId) => ({
nextPart,
validators,
classGroupId
});
var CLASS_PART_SEPARATOR = "-";
var EMPTY_CONFLICTS = [];
var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
var createClassGroupUtils = (config) => {
const classMap = createClassMap(config);
const { conflictingClassGroups, conflictingClassGroupModifiers } = config;
const getClassGroupId = (className) => {
if (className.startsWith("[") && className.endsWith("]")) return getGroupIdForArbitraryProperty(className);
const classParts = className.split(CLASS_PART_SEPARATOR);
return getGroupRecursive(classParts, classParts[0] === "" && classParts.length > 1 ? 1 : 0, classMap);
};
const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
if (hasPostfixModifier) {
const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
const baseConflicts = conflictingClassGroups[classGroupId];
if (modifierConflicts) {
if (baseConflicts) return concatArrays(baseConflicts, modifierConflicts);
return modifierConflicts;
}
return baseConflicts || EMPTY_CONFLICTS;
}
return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
};
return {
getClassGroupId,
getConflictingClassGroupIds
};
};
var getGroupRecursive = (classParts, startIndex, classPartObject) => {
if (classParts.length - startIndex === 0) return classPartObject.classGroupId;
const currentClassPart = classParts[startIndex];
const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
if (nextClassPartObject) {
const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
if (result) return result;
}
const validators = classPartObject.validators;
if (validators === null) return;
const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
const validatorsLength = validators.length;
for (let i = 0; i < validatorsLength; i++) {
const validatorObj = validators[i];
if (validatorObj.validator(classRest)) return validatorObj.classGroupId;
}
};
var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
const content = className.slice(1, -1);
const colonIndex = content.indexOf(":");
const property = content.slice(0, colonIndex);
return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
})();
var createClassMap = (config) => {
const { theme, classGroups } = config;
return processClassGroups(classGroups, theme);
};
var processClassGroups = (classGroups, theme) => {
const classMap = createClassPartObject();
for (const classGroupId in classGroups) {
const group = classGroups[classGroupId];
processClassesRecursively(group, classMap, classGroupId, theme);
}
return classMap;
};
var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
const len = classGroup.length;
for (let i = 0; i < len; i++) {
const classDefinition = classGroup[i];
processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
}
};
var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
if (typeof classDefinition === "string") {
processStringDefinition(classDefinition, classPartObject, classGroupId);
return;
}
if (typeof classDefinition === "function") {
processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
return;
}
processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
};
var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
classPartObjectToEdit.classGroupId = classGroupId;
};
var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
if (isThemeGetter(classDefinition)) {
processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
return;
}
if (classPartObject.validators === null) classPartObject.validators = [];
classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
};
var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
const entries = Object.entries(classDefinition);
const len = entries.length;
for (let i = 0; i < len; i++) {
const [key, value] = entries[i];
processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
}
};
var getPart = (classPartObject, path) => {
let current = classPartObject;
const parts = path.split(CLASS_PART_SEPARATOR);
const len = parts.length;
for (let i = 0; i < len; i++) {
const part = parts[i];
let next = current.nextPart.get(part);
if (!next) {
next = createClassPartObject();
current.nextPart.set(part, next);
}
current = next;
}
return current;
};
var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
var createLruCache = (maxCacheSize) => {
if (maxCacheSize < 1) return {
get: () => void 0,
set: () => {}
};
let cacheSize = 0;
let cache = Object.create(null);
let previousCache = Object.create(null);
const update = (key, value) => {
cache[key] = value;
cacheSize++;
if (cacheSize > maxCacheSize) {
cacheSize = 0;
previousCache = cache;
cache = Object.create(null);
}
};
return {
get(key) {
let value = cache[key];
if (value !== void 0) return value;
if ((value = previousCache[key]) !== void 0) {
update(key, value);
return value;
}
},
set(key, value) {
if (key in cache) cache[key] = value;
else update(key, value);
}
};
};
var IMPORTANT_MODIFIER = "!";
var MODIFIER_SEPARATOR = ":";
var EMPTY_MODIFIERS = [];
var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
modifiers,
hasImportantModifier,
baseClassName,
maybePostfixModifierPosition,
isExternal
});
var createParseClassName = (config) => {
const { prefix, experimentalParseClassName } = config;
let parseClassName = (className) => {
const modifiers = [];
let bracketDepth = 0;
let parenDepth = 0;
let modifierStart = 0;
let postfixModifierPosition;
const len = className.length;
for (let index = 0; index < len; index++) {
const currentCharacter = className[index];
if (bracketDepth === 0 && parenDepth === 0) {
if (currentCharacter === MODIFIER_SEPARATOR) {
modifiers.push(className.slice(modifierStart, index));
modifierStart = index + 1;
continue;
}
if (currentCharacter === "/") {
postfixModifierPosition = index;
continue;
}
}
if (currentCharacter === "[") bracketDepth++;
else if (currentCharacter === "]") bracketDepth--;
else if (currentCharacter === "(") parenDepth++;
else if (currentCharacter === ")") parenDepth--;
}
const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
let baseClassName = baseClassNameWithImportantModifier;
let hasImportantModifier = false;
if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
hasImportantModifier = true;
} else if (baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)) {
baseClassName = baseClassNameWithImportantModifier.slice(1);
hasImportantModifier = true;
}
const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
};
if (prefix) {
const fullPrefix = prefix + MODIFIER_SEPARATOR;
const parseClassNameOriginal = parseClassName;
parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, void 0, true);
}
if (experimentalParseClassName) {
const parseClassNameOriginal = parseClassName;
parseClassName = (className) => experimentalParseClassName({
className,
parseClassName: parseClassNameOriginal
});
}
return parseClassName;
};
var createSortModifiers = (config) => {
const modifierWeights = new Map();
config.orderSensitiveModifiers.forEach((mod, index) => {
modifierWeights.set(mod, 1e6 + index);
});
return (modifiers) => {
const result = [];
let currentSegment = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i];
const isArbitrary = modifier[0] === "[";
const isOrderSensitive = modifierWeights.has(modifier);
if (isArbitrary || isOrderSensitive) {
if (currentSegment.length > 0) {
currentSegment.sort();
result.push(...currentSegment);
currentSegment = [];
}
result.push(modifier);
} else currentSegment.push(modifier);
}
if (currentSegment.length > 0) {
currentSegment.sort();
result.push(...currentSegment);
}
return result;
};
};
var createConfigUtils = (config) => ({
cache: createLruCache(config.cacheSize),
parseClassName: createParseClassName(config),
sortModifiers: createSortModifiers(config),
postfixLookupClassGroupIds: createPostfixLookupClassGroupIds(config),
...createClassGroupUtils(config)
});
var createPostfixLookupClassGroupIds = (config) => {
const lookup = Object.create(null);
const classGroupIds = config.postfixLookupClassGroups;
if (classGroupIds) for (let i = 0; i < classGroupIds.length; i++) lookup[classGroupIds[i]] = true;
return lookup;
};
var SPLIT_CLASSES_REGEX = /\s+/;
var mergeClassList = (classList, configUtils) => {
const { parseClassName, getClassGroupId, getConflictingClassGroupIds, sortModifiers, postfixLookupClassGroupIds } = configUtils;
const classGroupsInConflict = [];
const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
let result = "";
for (let index = classNames.length - 1; index >= 0; index -= 1) {
const originalClassName = classNames[index];
const { isExternal, modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition } = parseClassName(originalClassName);
if (isExternal) {
result = originalClassName + (result.length > 0 ? " " + result : result);
continue;
}
let hasPostfixModifier = !!maybePostfixModifierPosition;
let classGroupId;
if (hasPostfixModifier) {
classGroupId = getClassGroupId(baseClassName.substring(0, maybePostfixModifierPosition));
const classGroupIdWithPostfix = classGroupId && postfixLookupClassGroupIds[classGroupId] ? getClassGroupId(baseClassName) : void 0;
if (classGroupIdWithPostfix && classGroupIdWithPostfix !== classGroupId) {
classGroupId = classGroupIdWithPostfix;
hasPostfixModifier = false;
}
} else classGroupId = getClassGroupId(baseClassName);
if (!classGroupId) {
if (!hasPostfixModifier) {
result = originalClassName + (result.length > 0 ? " " + result : result);
continue;
}
classGroupId = getClassGroupId(baseClassName);
if (!classGroupId) {
result = originalClassName + (result.length > 0 ? " " + result : result);
continue;
}
hasPostfixModifier = false;
}
const variantModifier = modifiers.length === 0 ? "" : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(":");
const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
const classId = modifierId + classGroupId;
if (classGroupsInConflict.indexOf(classId) > -1) continue;
classGroupsInConflict.push(classId);
const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
for (let i = 0; i < conflictGroups.length; ++i) {
const group = conflictGroups[i];
classGroupsInConflict.push(modifierId + group);
}
result = originalClassName + (result.length > 0 ? " " + result : result);
}
return result;
};
var twJoin = (...classLists) => {
let index = 0;
let argument;
let resolvedValue;
let string = "";
while (index < classLists.length) if (argument = classLists[index++]) {
if (resolvedValue = toValue(argument)) {
string && (string += " ");
string += resolvedValue;
}
}
return string;
};
var toValue = (mix) => {
if (typeof mix === "string") return mix;
let resolvedValue;
let string = "";
for (let k = 0; k < mix.length; k++) if (mix[k]) {
if (resolvedValue = toValue(mix[k])) {
string && (string += " ");
string += resolvedValue;
}
}
return string;
};
var createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
let configUtils;
let cacheGet;
let cacheSet;
let functionToCall;
const initTailwindMerge = (classList) => {
configUtils = createConfigUtils(createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst()));
cacheGet = configUtils.cache.get;
cacheSet = configUtils.cache.set;
functionToCall = tailwindMerge;
return tailwindMerge(classList);
};
const tailwindMerge = (classList) => {
const cachedResult = cacheGet(classList);
if (cachedResult) return cachedResult;
const result = mergeClassList(classList, configUtils);
cacheSet(classList, result);
return result;
};
functionToCall = initTailwindMerge;
return (...args) => functionToCall(twJoin(...args));
};
var fallbackThemeArr = [];
var fromTheme = (key) => {
const themeGetter = (theme) => theme[key] || fallbackThemeArr;
themeGetter.isThemeGetter = true;
return themeGetter;
};
var arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
var arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
var fractionRegex = /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/;
var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
var isFraction = (value) => fractionRegex.test(value);
var isNumber = (value) => !!value && !Number.isNaN(Number(value));
var isInteger = (value) => !!value && Number.isInteger(Number(value));
var isPercent = (value) => value.endsWith("%") && isNumber(value.slice(0, -1));
var isTshirtSize = (value) => tshirtUnitRegex.test(value);
var isAny = () => true;
var isLengthOnly = (value) => lengthUnitRegex.test(value) && !colorFunctionRegex.test(value);
var isNever = () => false;
var isShadow = (value) => shadowRegex.test(value);
var isImage = (value) => imageRegex.test(value);
var isAnyNonArbitrary = (value) => !isArbitraryValue(value) && !isArbitraryVariable(value);
var isNamedContainerQuery = (value) => value.startsWith("@container") && (value[10] === "/" && value[11] !== void 0 || value[11] === "s" && value[16] !== void 0 && value.startsWith("-size/", 10) || value[11] === "n" && value[18] !== void 0 && value.startsWith("-normal/", 10));
var isArbitrarySize = (value) => getIsArbitraryValue(value, isLabelSize, isNever);
var isArbitraryValue = (value) => arbitraryValueRegex.test(value);
var isArbitraryLength = (value) => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
var isArbitraryNumber = (value) => getIsArbitraryValue(value, isLabelNumber, isNumber);
var isArbitraryWeight = (value) => getIsArbitraryValue(value, isLabelWeight, isAny);
var isArbitraryFamilyName = (value) => getIsArbitraryValue(value, isLabelFamilyName, isNever);
var isArbitraryPosition = (value) => getIsArbitraryValue(value, isLabelPosition, isNever);
var isArbitraryImage = (value) => getIsArbitraryValue(value, isLabelImage, isImage);
var isArbitraryShadow = (value) => getIsArbitraryValue(value, isLabelShadow, isShadow);
var isArbitraryVariable = (value) => arbitraryVariableRegex.test(value);
var isArbitraryVariableLength = (value) => getIsArbitraryVariable(value, isLabelLength);
var isArbitraryVariableFamilyName = (value) => getIsArbitraryVariable(value, isLabelFamilyName);
var isArbitraryVariablePosition = (value) => getIsArbitraryVariable(value, isLabelPosition);
var isArbitraryVariableSize = (value) => getIsArbitraryVariable(value, isLabelSize);
var isArbitraryVariableImage = (value) => getIsArbitraryVariable(value, isLabelImage);
var isArbitraryVariableShadow = (value) => getIsArbitraryVariable(value, isLabelShadow, true);
var isArbitraryVariableWeight = (value) => getIsArbitraryVariable(value, isLabelWeight, true);
var getIsArbitraryValue = (value, testLabel, testValue) => {
const result = arbitraryValueRegex.exec(value);
if (result) {
if (result[1]) return testLabel(result[1]);
return testValue(result[2]);
}
return false;
};
var getIsArbitraryVariable = (value, testLabel, shouldMatchNoLabel = false) => {
const result = arbitraryVariableRegex.exec(value);
if (result) {
if (result[1]) return testLabel(result[1]);
return shouldMatchNoLabel;
}
return false;
};
var isLabelPosition = (label) => label === "position" || label === "percentage";
var isLabelImage = (label) => label === "image" || label === "url";
var isLabelSize = (label) => label === "length" || label === "size" || label === "bg-size";
var isLabelLength = (label) => label === "length";
var isLabelNumber = (label) => label === "number";
var isLabelFamilyName = (label) => label === "family-name";
var isLabelWeight = (label) => label === "number" || label === "weight";
var isLabelShadow = (label) => label === "shadow";
var getDefaultConfig = () => {
const themeColor = fromTheme("color");
const themeFont = fromTheme("font");
const themeText = fromTheme("text");
const themeFontWeight = fromTheme("font-weight");
const themeTracking = fromTheme("tracking");
const themeLeading = fromTheme("leading");
const themeBreakpoint = fromTheme("breakpoint");
const themeContainer = fromTheme("container");
const themeSpacing = fromTheme("spacing");
const themeRadius = fromTheme("radius");
const themeShadow = fromTheme("shadow");
const themeInsetShadow = fromTheme("inset-shadow");
const themeTextShadow = fromTheme("text-shadow");
const themeDropShadow = fromTheme("drop-shadow");
const themeBlur = fromTheme("blur");
const themePerspective = fromTheme("perspective");
const themeAspect = fromTheme("aspect");
const themeEase = fromTheme("ease");
const themeAnimate = fromTheme("animate");
const scaleBreak = () => [
"auto",
"avoid",
"all",
"avoid-page",
"page",
"left",
"right",
"column"
];
const scalePosition = () => [
"center",
"top",
"bottom",
"left",
"right",
"top-left",
"left-top",
"top-right",
"right-top",
"bottom-right",
"right-bottom",
"bottom-left",
"left-bottom"
];
const scalePositionWithArbitrary = () => [
...scalePosition(),
isArbitraryVariable,
isArbitraryValue
];
const scaleOverflow = () => [
"auto",
"hidden",
"clip",
"visible",
"scroll"
];
const scaleOverscroll = () => [
"auto",
"contain",
"none"
];
const scaleUnambiguousSpacing = () => [
isArbitraryVariable,
isArbitraryValue,
themeSpacing
];
const scaleInset = () => [
isFraction,
"full",
"auto",
...scaleUnambiguousSpacing()
];
const scaleGridTemplateColsRows = () => [
isInteger,
"none",
"subgrid",
isArbitraryVariable,
isArbitraryValue
];
const scaleGridColRowStartAndEnd = () => [
"auto",
{ span: [
"full",
isInteger,
isArbitraryVariable,
isArbitraryValue
] },
isInteger,
isArbitraryVariable,
isArbitraryValue
];
const scaleGridColRowStartOrEnd = () => [
isInteger,
"auto",
isArbitraryVariable,
isArbitraryValue
];
const scaleGridAutoColsRows = () => [
"auto",
"min",
"max",
"fr",
isArbitraryVariable,
isArbitraryValue
];
const scaleAlignPrimaryAxis = () => [
"start",
"end",
"center",
"between",
"around",
"evenly",
"stretch",
"baseline",
"center-safe",
"end-safe"
];
const scaleAlignSecondaryAxis = () => [
"start",
"end",
"center",
"stretch",
"center-safe",
"end-safe"
];
const scaleMargin = () => ["auto", ...scaleUnambiguousSpacing()];
const scaleSizing = () => [
isFraction,
"auto",
"full",
"dvw",
"dvh",
"lvw",
"lvh",
"svw",
"svh",
"min",
"max",
"fit",
...scaleUnambiguousSpacing()
];
const scaleSizingInline = () => [
isFraction,
"screen",
"full",
"dvw",
"lvw",
"svw",
"min",
"max",
"fit",
...scaleUnambiguousSpacing()
];
const scaleSizingBlock = () => [
isFraction,
"screen",
"full",
"lh",
"dvh",
"lvh",
"svh",
"min",
"max",
"fit",
...scaleUnambiguousSpacing()
];
const scaleColor = () => [
themeColor,
isArbitraryVariable,
isArbitraryValue
];
const scaleBgPosition = () => [
...scalePosition(),
isArbitraryVariablePosition,
isArbitraryPosition,
{ position: [isArbitraryVariable, isArbitraryValue] }
];
const scaleBgRepeat = () => ["no-repeat", { repeat: [
"",
"x",
"y",
"space",
"round"
] }];
const scaleBgSize = () => [
"auto",
"cover",
"contain",
isArbitraryVariableSize,
isArbitrarySize,
{ size: [isArbitraryVariable, isArbitraryValue] }
];
const scaleGradientStopPosition = () => [
isPercent,
isArbitraryVariableLength,
isArbitraryLength
];
const scaleRadius = () => [
"",
"none",
"full",
themeRadius,
isArbitraryVariable,
isArbitraryValue
];
const scaleBorderWidth = () => [
"",
isNumber,
isArbitraryVariableLength,
isArbitraryLength
];
const scaleLineStyle = () => [
"solid",
"dashed",
"dotted",
"double"
];
const scaleBlendMode = () => [
"normal",
"multiply",
"screen",
"overlay",
"darken",
"lighten",
"color-dodge",
"color-burn",
"hard-light",
"soft-light",
"difference",
"exclusion",
"hue",
"saturation",
"color",
"luminosity"
];
const scaleMaskImagePosition = () => [
isNumber,
isPercent,
isArbitraryVariablePosition,
isArbitraryPosition
];
const scaleBlur = () => [
"",
"none",
themeBlur,
isArbitraryVariable,
isArbitraryValue
];
const scaleRotate = () => [
"none",
isNumber,
isArbitraryVariable,
isArbitraryValue
];
const scaleScale = () => [
"none",
isNumber,
isArbitraryVariable,
isArbitraryValue
];
const scaleSkew = () => [
isNumber,
isArbitraryVariable,
isArbitraryValue
];
const scaleTranslate = () => [
isFraction,
"full",
...scaleUnambiguousSpacing()
];
return {
cacheSize: 500,
theme: {
animate: [
"spin",
"ping",
"pulse",
"bounce"
],
aspect: ["video"],
blur: [isTshirtSize],
breakpoint: [isTshirtSize],
color: [isAny],
container: [isTshirtSize],
"drop-shadow": [isTshirtSize],
ease: [
"in",
"out",
"in-out"
],
font: [isAnyNonArbitrary],
"font-weight": [
"thin",
"extralight",
"light",
"normal",
"medium",
"semibold",
"bold",
"extrabold",
"black"
],
"inset-shadow": [isTshirtSize],
leading: [
"none",
"tight",
"snug",
"normal",
"relaxed",
"loose"
],
perspective: [
"dramatic",
"near",
"normal",
"midrange",
"distant",
"none"
],
radius: [isTshirtSize],
shadow: [isTshirtSize],
spacing: ["px", isNumber],
text: [isTshirtSize],
"text-shadow": [isTshirtSize],
tracking: [
"tighter",
"tight",
"normal",
"wide",
"wider",
"widest"
]
},
classGroups: {
aspect: [{ aspect: [
"auto",
"square",
isFraction,
isArbitraryValue,
isArbitraryVariable,
themeAspect
] }],
container: ["container"],
"container-type": [{ "@container": [
"",
"normal",
"size",
isArbitraryVariable,
isArbitraryValue
] }],
"container-named": [isNamedContainerQuery],
columns: [{ columns: [
isNumber,
isArbitraryValue,
isArbitraryVariable,
themeContainer
] }],
"break-after": [{ "break-after": scaleBreak() }],
"break-before": [{ "break-before": scaleBreak() }],
"break-inside": [{ "break-inside": [
"auto",
"avoid",
"avoid-page",
"avoid-column"
] }],
"box-decoration": [{ "box-decoration": ["slice", "clone"] }],
box: [{ box: ["border", "content"] }],
display: [
"block",
"inline-block",
"inline",
"flex",
"inline-flex",
"table",
"inline-table",
"table-caption",
"table-cell",
"table-column",
"table-column-group",
"table-footer-group",
"table-header-group",
"table-row-group",
"table-row",
"flow-root",
"grid",
"inline-grid",
"contents",
"list-item",
"hidden"
],
sr: ["sr-only", "not-sr-only"],
float: [{ float: [
"right",
"left",
"none",
"start",
"end"
] }],
clear: [{ clear: [
"left",
"right",
"both",
"none",
"start",
"end"
] }],
isolation: ["isolate", "isolation-auto"],
"object-fit": [{ object: [
"contain",
"cover",
"fill",
"none",
"scale-down"
] }],
"object-position": [{ object: scalePositionWithArbitrary() }],
overflow: [{ overflow: scaleOverflow() }],
"overflow-x": [{ "overflow-x": scaleOverflow() }],
"overflow-y": [{ "overflow-y": scaleOverflow() }],
overscroll: [{ overscroll: scaleOverscroll() }],
"overscroll-x": [{ "overscroll-x": scaleOverscroll() }],
"overscroll-y": [{ "overscroll-y": scaleOverscroll() }],
position: [
"static",
"fixed",
"absolute",
"relative",
"sticky"
],
inset: [{ inset: scaleInset() }],
"inset-x": [{ "inset-x": scaleInset() }],
"inset-y": [{ "inset-y": scaleInset() }],
start: [{
"inset-s": scaleInset(),
start: scaleInset()
}],
end: [{
"inset-e": scaleInset(),
end: scaleInset()
}],
"inset-bs": [{ "inset-bs": scaleInset() }],
"inset-be": [{ "inset-be": scaleInset() }],
top: [{ top: scaleInset() }],
right: [{ right: scaleInset() }],
bottom: [{ bottom: scaleInset() }],
left: [{ left: scaleInset() }],
visibility: [
"visible",
"invisible",
"collapse"
],
z: [{ z: [
isInteger,
"auto",
isArbitraryVariable,
isArbitraryValue
] }],
basis: [{ basis: [
isFraction,
"full",
"auto",
themeContainer,
...scaleUnambiguousSpacing()
] }],
"flex-direction": [{ flex: [
"row",
"row-reverse",
"col",
"col-reverse"
] }],
"flex-wrap": [{ flex: [
"nowrap",
"wrap",
"wrap-reverse"
] }],
flex: [{ flex: [
isNumber,
isFraction,
"auto",
"initial",
"none",
isArbitraryValue
] }],
grow: [{ grow: [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
shrink: [{ shrink: [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
order: [{ order: [
isInteger,
"first",
"last",
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"grid-cols": [{ "grid-cols": scaleGridTemplateColsRows() }],
"col-start-end": [{ col: scaleGridColRowStartAndEnd() }],
"col-start": [{ "col-start": scaleGridColRowStartOrEnd() }],
"col-end": [{ "col-end": scaleGridColRowStartOrEnd() }],
"grid-rows": [{ "grid-rows": scaleGridTemplateColsRows() }],
"row-start-end": [{ row: scaleGridColRowStartAndEnd() }],
"row-start": [{ "row-start": scaleGridColRowStartOrEnd() }],
"row-end": [{ "row-end": scaleGridColRowStartOrEnd() }],
"grid-flow": [{ "grid-flow": [
"row",
"col",
"dense",
"row-dense",
"col-dense"
] }],
"auto-cols": [{ "auto-cols": scaleGridAutoColsRows() }],
"auto-rows": [{ "auto-rows": scaleGridAutoColsRows() }],
gap: [{ gap: scaleUnambiguousSpacing() }],
"gap-x": [{ "gap-x": scaleUnambiguousSpacing() }],
"gap-y": [{ "gap-y": scaleUnambiguousSpacing() }],
"justify-content": [{ justify: [...scaleAlignPrimaryAxis(), "normal"] }],
"justify-items": [{ "justify-items": [...scaleAlignSecondaryAxis(), "normal"] }],
"justify-self": [{ "justify-self": ["auto", ...scaleAlignSecondaryAxis()] }],
"align-content": [{ content: ["normal", ...scaleAlignPrimaryAxis()] }],
"align-items": [{ items: [...scaleAlignSecondaryAxis(), { baseline: ["", "last"] }] }],
"align-self": [{ self: [
"auto",
...scaleAlignSecondaryAxis(),
{ baseline: ["", "last"] }
] }],
"place-content": [{ "place-content": scaleAlignPrimaryAxis() }],
"place-items": [{ "place-items": [...scaleAlignSecondaryAxis(), "baseline"] }],
"place-self": [{ "place-self": ["auto", ...scaleAlignSecondaryAxis()] }],
p: [{ p: scaleUnambiguousSpacing() }],
px: [{ px: scaleUnambiguousSpacing() }],
py: [{ py: scaleUnambiguousSpacing() }],
ps: [{ ps: scaleUnambiguousSpacing() }],
pe: [{ pe: scaleUnambiguousSpacing() }],
pbs: [{ pbs: scaleUnambiguousSpacing() }],
pbe: [{ pbe: scaleUnambiguousSpacing() }],
pt: [{ pt: scaleUnambiguousSpacing() }],
pr: [{ pr: scaleUnambiguousSpacing() }],
pb: [{ pb: scaleUnambiguousSpacing() }],
pl: [{ pl: scaleUnambiguousSpacing() }],
m: [{ m: scaleMargin() }],
mx: [{ mx: scaleMargin() }],
my: [{ my: scaleMargin() }],
ms: [{ ms: scaleMargin() }],
me: [{ me: scaleMargin() }],
mbs: [{ mbs: scaleMargin() }],
mbe: [{ mbe: scaleMargin() }],
mt: [{ mt: scaleMargin() }],
mr: [{ mr: scaleMargin() }],
mb: [{ mb: scaleMargin() }],
ml: [{ ml: scaleMargin() }],
"space-x": [{ "space-x": scaleUnambiguousSpacing() }],
"space-x-reverse": ["space-x-reverse"],
"space-y": [{ "space-y": scaleUnambiguousSpacing() }],
"space-y-reverse": ["space-y-reverse"],
size: [{ size: scaleSizing() }],
"inline-size": [{ inline: ["auto", ...scaleSizingInline()] }],
"min-inline-size": [{ "min-inline": ["auto", ...scaleSizingInline()] }],
"max-inline-size": [{ "max-inline": ["none", ...scaleSizingInline()] }],
"block-size": [{ block: ["auto", ...scaleSizingBlock()] }],
"min-block-size": [{ "min-block": ["auto", ...scaleSizingBlock()] }],
"max-block-size": [{ "max-block": ["none", ...scaleSizingBlock()] }],
w: [{ w: [
themeContainer,
"screen",
...scaleSizing()
] }],
"min-w": [{ "min-w": [
themeContainer,
"screen",
"none",
...scaleSizing()
] }],
"max-w": [{ "max-w": [
themeContainer,
"screen",
"none",
"prose",
{ screen: [themeBreakpoint] },
...scaleSizing()
] }],
h: [{ h: [
"screen",
"lh",
...scaleSizing()
] }],
"min-h": [{ "min-h": [
"screen",
"lh",
"none",
...scaleSizing()
] }],
"max-h": [{ "max-h": [
"screen",
"lh",
...scaleSizing()
] }],
"font-size": [{ text: [
"base",
themeText,
isArbitraryVariableLength,
isArbitraryLength
] }],
"font-smoothing": ["antialiased", "subpixel-antialiased"],
"font-style": ["italic", "not-italic"],
"font-weight": [{ font: [
themeFontWeight,
isArbitraryVariableWeight,
isArbitraryWeight
] }],
"font-stretch": [{ "font-stretch": [
"ultra-condensed",
"extra-condensed",
"condensed",
"semi-condensed",
"normal",
"semi-expanded",
"expanded",
"extra-expanded",
"ultra-expanded",
isPercent,
isArbitraryValue
] }],
"font-family": [{ font: [
isArbitraryVariableFamilyName,
isArbitraryFamilyName,
themeFont
] }],
"font-features": [{ "font-features": [isArbitraryValue] }],
"fvn-normal": ["normal-nums"],
"fvn-ordinal": ["ordinal"],
"fvn-slashed-zero": ["slashed-zero"],
"fvn-figure": ["lining-nums", "oldstyle-nums"],
"fvn-spacing": ["proportional-nums", "tabular-nums"],
"fvn-fraction": ["diagonal-fractions", "stacked-fractions"],
tracking: [{ tracking: [
themeTracking,
isArbitraryVariable,
isArbitraryValue
] }],
"line-clamp": [{ "line-clamp": [
isNumber,
"none",
isArbitraryVariable,
isArbitraryNumber
] }],
leading: [{ leading: [themeLeading, ...scaleUnambiguousSpacing()] }],
"list-image": [{ "list-image": [
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"list-style-position": [{ list: ["inside", "outside"] }],
"list-style-type": [{ list: [
"disc",
"decimal",
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"text-alignment": [{ text: [
"left",
"center",
"right",
"justify",
"start",
"end"
] }],
"placeholder-color": [{ placeholder: scaleColor() }],
"text-color": [{ text: scaleColor() }],
"text-decoration": [
"underline",
"overline",
"line-through",
"no-underline"
],
"text-decoration-style": [{ decoration: [...scaleLineStyle(), "wavy"] }],
"text-decoration-thickness": [{ decoration: [
isNumber,
"from-font",
"auto",
isArbitraryVariable,
isArbitraryLength
] }],
"text-decoration-color": [{ decoration: scaleColor() }],
"underline-offset": [{ "underline-offset": [
isNumber,
"auto",
isArbitraryVariable,
isArbitraryValue
] }],
"text-transform": [
"uppercase",
"lowercase",
"capitalize",
"normal-case"
],
"text-overflow": [
"truncate",
"text-ellipsis",
"text-clip"
],
"text-wrap": [{ text: [
"wrap",
"nowrap",
"balance",
"pretty"
] }],
indent: [{ indent: scaleUnambiguousSpacing() }],
"tab-size": [{ tab: [
isInteger,
isArbitraryVariable,
isArbitraryValue
] }],
"vertical-align": [{ align: [
"baseline",
"top",
"middle",
"bottom",
"text-top",
"text-bottom",
"sub",
"super",
isArbitraryVariable,
isArbitraryValue
] }],
whitespace: [{ whitespace: [
"normal",
"nowrap",
"pre",
"pre-line",
"pre-wrap",
"break-spaces"
] }],
break: [{ break: [
"normal",
"words",
"all",
"keep"
] }],
wrap: [{ wrap: [
"break-word",
"anywhere",
"normal"
] }],
hyphens: [{ hyphens: [
"none",
"manual",
"auto"
] }],
content: [{ content: [
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"bg-attachment": [{ bg: [
"fixed",
"local",
"scroll"
] }],
"bg-clip": [{ "bg-clip": [
"border",
"padding",
"content",
"text"
] }],
"bg-origin": [{ "bg-origin": [
"border",
"padding",
"content"
] }],
"bg-position": [{ bg: scaleBgPosition() }],
"bg-repeat": [{ bg: scaleBgRepeat() }],
"bg-size": [{ bg: scaleBgSize() }],
"bg-image": [{ bg: [
"none",
{
linear: [
{ to: [
"t",
"tr",
"r",
"br",
"b",
"bl",
"l",
"tl"
] },
isInteger,
isArbitraryVariable,
isArbitraryValue
],
radial: [
"",
isArbitraryVariable,
isArbitraryValue
],
conic: [
isInteger,
isArbitraryVariable,
isArbitraryValue
]
},
isArbitraryVariableImage,
isArbitraryImage
] }],
"bg-color": [{ bg: scaleColor() }],
"gradient-from-pos": [{ from: scaleGradientStopPosition() }],
"gradient-via-pos": [{ via: scaleGradientStopPosition() }],
"gradient-to-pos": [{ to: scaleGradientStopPosition() }],
"gradient-from": [{ from: scaleColor() }],
"gradient-via": [{ via: scaleColor() }],
"gradient-to": [{ to: scaleColor() }],
rounded: [{ rounded: scaleRadius() }],
"rounded-s": [{ "rounded-s": scaleRadius() }],
"rounded-e": [{ "rounded-e": scaleRadius() }],
"rounded-t": [{ "rounded-t": scaleRadius() }],
"rounded-r": [{ "rounded-r": scaleRadius() }],
"rounded-b": [{ "rounded-b": scaleRadius() }],
"rounded-l": [{ "rounded-l": scaleRadius() }],
"rounded-ss": [{ "rounded-ss": scaleRadius() }],
"rounded-se": [{ "rounded-se": scaleRadius() }],
"rounded-ee": [{ "rounded-ee": scaleRadius() }],
"rounded-es": [{ "rounded-es": scaleRadius() }],
"rounded-tl": [{ "rounded-tl": scaleRadius() }],
"rounded-tr": [{ "rounded-tr": scaleRadius() }],
"rounded-br": [{ "rounded-br": scaleRadius() }],
"rounded-bl": [{ "rounded-bl": scaleRadius() }],
"border-w": [{ border: scaleBorderWidth() }],
"border-w-x": [{ "border-x": scaleBorderWidth() }],
"border-w-y": [{ "border-y": scaleBorderWidth() }],
"border-w-s": [{ "border-s": scaleBorderWidth() }],
"border-w-e": [{ "border-e": scaleBorderWidth() }],
"border-w-bs": [{ "border-bs": scaleBorderWidth() }],
"border-w-be": [{ "border-be": scaleBorderWidth() }],
"border-w-t": [{ "border-t": scaleBorderWidth() }],
"border-w-r": [{ "border-r": scaleBorderWidth() }],
"border-w-b": [{ "border-b": scaleBorderWidth() }],
"border-w-l": [{ "border-l": scaleBorderWidth() }],
"divide-x": [{ "divide-x": scaleBorderWidth() }],
"divide-x-reverse": ["divide-x-reverse"],
"divide-y": [{ "divide-y": scaleBorderWidth() }],
"divide-y-reverse": ["divide-y-reverse"],
"border-style": [{ border: [
...scaleLineStyle(),
"hidden",
"none"
] }],
"divide-style": [{ divide: [
...scaleLineStyle(),
"hidden",
"none"
] }],
"border-color": [{ border: scaleColor() }],
"border-color-x": [{ "border-x": scaleColor() }],
"border-color-y": [{ "border-y": scaleColor() }],
"border-color-s": [{ "border-s": scaleColor() }],
"border-color-e": [{ "border-e": scaleColor() }],
"border-color-bs": [{ "border-bs": scaleColor() }],
"border-color-be": [{ "border-be": scaleColor() }],
"border-color-t": [{ "border-t": scaleColor() }],
"border-color-r": [{ "border-r": scaleColor() }],
"border-color-b": [{ "border-b": scaleColor() }],
"border-color-l": [{ "border-l": scaleColor() }],
"divide-color": [{ divide: scaleColor() }],
"outline-style": [{ outline: [
...scaleLineStyle(),
"none",
"hidden"
] }],
"outline-offset": [{ "outline-offset": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"outline-w": [{ outline: [
"",
isNumber,
isArbitraryVariableLength,
isArbitraryLength
] }],
"outline-color": [{ outline: scaleColor() }],
shadow: [{ shadow: [
"",
"none",
themeShadow,
isArbitraryVariableShadow,
isArbitraryShadow
] }],
"shadow-color": [{ shadow: scaleColor() }],
"inset-shadow": [{ "inset-shadow": [
"none",
themeInsetShadow,
isArbitraryVariableShadow,
isArbitraryShadow
] }],
"inset-shadow-color": [{ "inset-shadow": scaleColor() }],
"ring-w": [{ ring: scaleBorderWidth() }],
"ring-w-inset": ["ring-inset"],
"ring-color": [{ ring: scaleColor() }],
"ring-offset-w": [{ "ring-offset": [isNumber, isArbitraryLength] }],
"ring-offset-color": [{ "ring-offset": scaleColor() }],
"inset-ring-w": [{ "inset-ring": scaleBorderWidth() }],
"inset-ring-color": [{ "inset-ring": scaleColor() }],
"text-shadow": [{ "text-shadow": [
"none",
themeTextShadow,
isArbitraryVariableShadow,
isArbitraryShadow
] }],
"text-shadow-color": [{ "text-shadow": scaleColor() }],
opacity: [{ opacity: [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"mix-blend": [{ "mix-blend": [
...scaleBlendMode(),
"plus-darker",
"plus-lighter"
] }],
"bg-blend": [{ "bg-blend": scaleBlendMode() }],
"mask-clip": [{ "mask-clip": [
"border",
"padding",
"content",
"fill",
"stroke",
"view"
] }, "mask-no-clip"],
"mask-composite": [{ mask: [
"add",
"subtract",
"intersect",
"exclude"
] }],
"mask-image-linear-pos": [{ "mask-linear": [isNumber] }],
"mask-image-linear-from-pos": [{ "mask-linear-from": scaleMaskImagePosition() }],
"mask-image-linear-to-pos": [{ "mask-linear-to": scaleMaskImagePosition() }],
"mask-image-linear-from-color": [{ "mask-linear-from": scaleColor() }],
"mask-image-linear-to-color": [{ "mask-linear-to": scaleColor() }],
"mask-image-t-from-pos": [{ "mask-t-from": scaleMaskImagePosition() }],
"mask-image-t-to-pos": [{ "mask-t-to": scaleMaskImagePosition() }],
"mask-image-t-from-color": [{ "mask-t-from": scaleColor() }],
"mask-image-t-to-color": [{ "mask-t-to": scaleColor() }],
"mask-image-r-from-pos": [{ "mask-r-from": scaleMaskImagePosition() }],
"mask-image-r-to-pos": [{ "mask-r-to": scaleMaskImagePosition() }],
"mask-image-r-from-color": [{ "mask-r-from": scaleColor() }],
"mask-image-r-to-color": [{ "mask-r-to": scaleColor() }],
"mask-image-b-from-pos": [{ "mask-b-from": scaleMaskImagePosition() }],
"mask-image-b-to-pos": [{ "mask-b-to": scaleMaskImagePosition() }],
"mask-image-b-from-color": [{ "mask-b-from": scaleColor() }],
"mask-image-b-to-color": [{ "mask-b-to": scaleColor() }],
"mask-image-l-from-pos": [{ "mask-l-from": scaleMaskImagePosition() }],
"mask-image-l-to-pos": [{ "mask-l-to": scaleMaskImagePosition() }],
"mask-image-l-from-color": [{ "mask-l-from": scaleColor() }],
"mask-image-l-to-color": [{ "mask-l-to": scaleColor() }],
"mask-image-x-from-pos": [{ "mask-x-from": scaleMaskImagePosition() }],
"mask-image-x-to-pos": [{ "mask-x-to": scaleMaskImagePosition() }],
"mask-image-x-from-color": [{ "mask-x-from": scaleColor() }],
"mask-image-x-to-color": [{ "mask-x-to": scaleColor() }],
"mask-image-y-from-pos": [{ "mask-y-from": scaleMaskImagePosition() }],
"mask-image-y-to-pos": [{ "mask-y-to": scaleMaskImagePosition() }],
"mask-image-y-from-color": [{ "mask-y-from": scaleColor() }],
"mask-image-y-to-color": [{ "mask-y-to": scaleColor() }],
"mask-image-radial": [{ "mask-radial": [isArbitraryVariable, isArbitraryValue] }],
"mask-image-radial-from-pos": [{ "mask-radial-from": scaleMaskImagePosition() }],
"mask-image-radial-to-pos": [{ "mask-radial-to": scaleMaskImagePosition() }],
"mask-image-radial-from-color": [{ "mask-radial-from": scaleColor() }],
"mask-image-radial-to-color": [{ "mask-radial-to": scaleColor() }],
"mask-image-radial-shape": [{ "mask-radial": ["circle", "ellipse"] }],
"mask-image-radial-size": [{ "mask-radial": [{
closest: ["side", "corner"],
farthest: ["side", "corner"]
}] }],
"mask-image-radial-pos": [{ "mask-radial-at": scalePosition() }],
"mask-image-conic-pos": [{ "mask-conic": [isNumber] }],
"mask-image-conic-from-pos": [{ "mask-conic-from": scaleMaskImagePosition() }],
"mask-image-conic-to-pos": [{ "mask-conic-to": scaleMaskImagePosition() }],
"mask-image-conic-from-color": [{ "mask-conic-from": scaleColor() }],
"mask-image-conic-to-color": [{ "mask-conic-to": scaleColor() }],
"mask-mode": [{ mask: [
"alpha",
"luminance",
"match"
] }],
"mask-origin": [{ "mask-origin": [
"border",
"padding",
"content",
"fill",
"stroke",
"view"
] }],
"mask-position": [{ mask: scaleBgPosition() }],
"mask-repeat": [{ mask: scaleBgRepeat() }],
"mask-size": [{ mask: scaleBgSize() }],
"mask-type": [{ "mask-type": ["alpha", "luminance"] }],
"mask-image": [{ mask: [
"none",
isArbitraryVariable,
isArbitraryValue
] }],
filter: [{ filter: [
"",
"none",
isArbitraryVariable,
isArbitraryValue
] }],
blur: [{ blur: scaleBlur() }],
brightness: [{ brightness: [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
contrast: [{ contrast: [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"drop-shadow": [{ "drop-shadow": [
"",
"none",
themeDropShadow,
isArbitraryVariableShadow,
isArbitraryShadow
] }],
"drop-shadow-color": [{ "drop-shadow": scaleColor() }],
grayscale: [{ grayscale: [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"hue-rotate": [{ "hue-rotate": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
invert: [{ invert: [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
saturate: [{ saturate: [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
sepia: [{ sepia: [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-filter": [{ "backdrop-filter": [
"",
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-blur": [{ "backdrop-blur": scaleBlur() }],
"backdrop-brightness": [{ "backdrop-brightness": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-contrast": [{ "backdrop-contrast": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-grayscale": [{ "backdrop-grayscale": [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-hue-rotate": [{ "backdrop-hue-rotate": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-invert": [{ "backdrop-invert": [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-opacity": [{ "backdrop-opacity": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-saturate": [{ "backdrop-saturate": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-sepia": [{ "backdrop-sepia": [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"border-collapse": [{ border: ["collapse", "separate"] }],
"border-spacing": [{ "border-spacing": scaleUnambiguousSpacing() }],
"border-spacing-x": [{ "border-spacing-x": scaleUnambiguousSpacing() }],
"border-spacing-y": [{ "border-spacing-y": scaleUnambiguousSpacing() }],
"table-layout": [{ table: ["auto", "fixed"] }],
caption: [{ caption: ["top", "bottom"] }],
transition: [{ transition: [
"",
"all",
"colors",
"opacity",
"shadow",
"transform",
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"transition-behavior": [{ transition: ["normal", "discrete"] }],
duration: [{ duration: [
isNumber,
"initial",
isArbitraryVariable,
isArbitraryValue
] }],
ease: [{ ease: [
"linear",
"initial",
themeEase,
isArbitraryVariable,
isArbitraryValue
] }],
delay: [{ delay: [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
animate: [{ animate: [
"none",
themeAnimate,
isArbitraryVariable,
isArbitraryValue
] }],
backface: [{ backface: ["hidden", "visible"] }],
perspective: [{ perspective: [
themePerspective,
isArbitraryVariable,
isArbitraryValue
] }],
"perspective-origin": [{ "perspective-origin": scalePositionWithArbitrary() }],
rotate: [{ rotate: scaleRotate() }],
"rotate-x": [{ "rotate-x": scaleRotate() }],
"rotate-y": [{ "rotate-y": scaleRotate() }],
"rotate-z": [{ "rotate-z": scaleRotate() }],
scale: [{ scale: scaleScale() }],
"scale-x": [{ "scale-x": scaleScale() }],
"scale-y": [{ "scale-y": scaleScale() }],
"scale-z": [{ "scale-z": scaleScale() }],
"scale-3d": ["scale-3d"],
skew: [{ skew: scaleSkew() }],
"skew-x": [{ "skew-x": scaleSkew() }],
"skew-y": [{ "skew-y": scaleSkew() }],
transform: [{ transform: [
isArbitraryVariable,
isArbitraryValue,
"",
"none",
"gpu",
"cpu"
] }],
"transform-origin": [{ origin: scalePositionWithArbitrary() }],
"transform-style": [{ transform: ["3d", "flat"] }],
translate: [{ translate: scaleTranslate() }],
"translate-x": [{ "translate-x": scaleTranslate() }],
"translate-y": [{ "translate-y": scaleTranslate() }],
"translate-z": [{ "translate-z": scaleTranslate() }],
"translate-none": ["translate-none"],
zoom: [{ zoom: [
isInteger,
isArbitraryVariable,
isArbitraryValue
] }],
accent: [{ accent: scaleColor() }],
appearance: [{ appearance: ["none", "auto"] }],
"caret-color": [{ caret: scaleColor() }],
"color-scheme": [{ scheme: [
"normal",
"dark",
"light",
"light-dark",
"only-dark",
"only-light"
] }],
cursor: [{ cursor: [
"auto",
"default",
"pointer",
"wait",
"text",
"move",
"help",
"not-allowed",
"none",
"context-menu",
"progress",
"cell",
"crosshair",
"vertical-text",
"alias",
"copy",
"no-drop",
"grab",
"grabbing",
"all-scroll",
"col-resize",
"row-resize",
"n-resize",
"e-resize",
"s-resize",
"w-resize",
"ne-resize",
"nw-resize",
"se-resize",
"sw-resize",
"ew-resize",
"ns-resize",
"nesw-resize",
"nwse-resize",
"zoom-in",
"zoom-out",
isArbitraryVariable,
isArbitraryValue
] }],
"field-sizing": [{ "field-sizing": ["fixed", "content"] }],
"pointer-events": [{ "pointer-events": ["auto", "none"] }],
resize: [{ resize: [
"none",
"",
"y",
"x"
] }],
"scroll-behavior": [{ scroll: ["auto", "smooth"] }],
"scrollbar-thumb-color": [{ "scrollbar-thumb": scaleColor() }],
"scrollbar-track-color": [{ "scrollbar-track": scaleColor() }],
"scrollbar-gutter": [{ "scrollbar-gutter": [
"auto",
"stable",
"both"
] }],
"scrollbar-w": [{ scrollbar: [
"auto",
"thin",
"none"
] }],
"scroll-m": [{ "scroll-m": scaleUnambiguousSpacing() }],
"scroll-mx": [{ "scroll-mx": scaleUnambiguousSpacing() }],
"scroll-my": [{ "scroll-my": scaleUnambiguousSpacing() }],
"scroll-ms": [{ "scroll-ms": scaleUnambiguousSpacing() }],
"scroll-me": [{ "scroll-me": scaleUnambiguousSpacing() }],
"scroll-mbs": [{ "scroll-mbs": scaleUnambiguousSpacing() }],
"scroll-mbe": [{ "scroll-mbe": scaleUnambiguousSpacing() }],
"scroll-mt": [{ "scroll-mt": scaleUnambiguousSpacing() }],
"scroll-mr": [{ "scroll-mr": scaleUnambiguousSpacing() }],
"scroll-mb": [{ "scroll-mb": scaleUnambiguousSpacing() }],
"scroll-ml": [{ "scroll-ml": scaleUnambiguousSpacing() }],
"scroll-p": [{ "scroll-p": scaleUnambiguousSpacing() }],
"scroll-px": [{ "scroll-px": scaleUnambiguousSpacing() }],
"scroll-py": [{ "scroll-py": scaleUnambiguousSpacing() }],
"scroll-ps": [{ "scroll-ps": scaleUnambiguousSpacing() }],
"scroll-pe": [{ "scroll-pe": scaleUnambiguousSpacing() }],
"scroll-pbs": [{ "scroll-pbs": scaleUnambiguousSpacing() }],
"scroll-pbe": [{ "scroll-pbe": scaleUnambiguousSpacing() }],
"scroll-pt": [{ "scroll-pt": scaleUnambiguousSpacing() }],
"scroll-pr": [{ "scroll-pr": scaleUnambiguousSpacing() }],
"scroll-pb": [{ "scroll-pb": scaleUnambiguousSpacing() }],
"scroll-pl": [{ "scroll-pl": scaleUnambiguousSpacing() }],
"snap-align": [{ snap: [
"start",
"end",
"center",
"align-none"
] }],
"snap-stop": [{ snap: ["normal", "always"] }],
"snap-type": [{ snap: [
"none",
"x",
"y",
"both"
] }],
"snap-strictness": [{ snap: ["mandatory", "proximity"] }],
touch: [{ touch: [
"auto",
"none",
"manipulation"
] }],
"touch-x": [{ "touch-pan": [
"x",
"left",
"right"
] }],
"touch-y": [{ "touch-pan": [
"y",
"up",
"down"
] }],
"touch-pz": ["touch-pinch-zoom"],
select: [{ select: [
"none",
"text",
"all",
"auto"
] }],
"will-change": [{ "will-change": [
"auto",
"scroll",
"contents",
"transform",
isArbitraryVariable,
isArbitraryValue
] }],
fill: [{ fill: ["none", ...scaleColor()] }],
"stroke-w": [{ stroke: [
isNumber,
isArbitraryVariableLength,
isArbitraryLength,
isArbitraryNumber
] }],
stroke: [{ stroke: ["none", ...scaleColor()] }],
"forced-color-adjust": [{ "forced-color-adjust": ["auto", "none"] }]
},
conflictingClassGroups: {
"container-named": ["container-type"],
overflow: ["overflow-x", "overflow-y"],
overscroll: ["overscroll-x", "overscroll-y"],
inset: [
"inset-x",
"inset-y",
"inset-bs",
"inset-be",
"start",
"end",
"top",
"right",
"bottom",
"left"
],
"inset-x": ["right", "left"],
"inset-y": ["top", "bottom"],
flex: [
"basis",
"grow",
"shrink"
],
gap: ["gap-x", "gap-y"],
p: [
"px",
"py",
"ps",
"pe",
"pbs",
"pbe",
"pt",
"pr",
"pb",
"pl"
],
px: ["pr", "pl"],
py: ["pt", "pb"],
m: [
"mx",
"my",
"ms",
"me",
"mbs",
"mbe",
"mt",
"mr",
"mb",
"ml"
],
mx: ["mr", "ml"],
my: ["mt", "mb"],
size: ["w", "h"],
"font-size": ["leading"],
"fvn-normal": [
"fvn-ordinal",
"fvn-slashed-zero",
"fvn-figure",
"fvn-spacing",
"fvn-fraction"
],
"fvn-ordinal": ["fvn-normal"],
"fvn-slashed-zero": ["fvn-normal"],
"fvn-figure": ["fvn-normal"],
"fvn-spacing": ["fvn-normal"],
"fvn-fraction": ["fvn-normal"],
"line-clamp": ["display", "overflow"],
rounded: [
"rounded-s",
"rounded-e",
"rounded-t",
"rounded-r",
"rounded-b",
"rounded-l",
"rounded-ss",
"rounded-se",
"rounded-ee",
"rounded-es",
"rounded-tl",
"rounded-tr",
"rounded-br",
"rounded-bl"
],
"rounded-s": ["rounded-ss", "rounded-es"],
"rounded-e": ["rounded-se", "rounded-ee"],
"rounded-t": ["rounded-tl", "rounded-tr"],
"rounded-r": ["rounded-tr", "rounded-br"],
"rounded-b": ["rounded-br", "rounded-bl"],
"rounded-l": ["rounded-tl", "rounded-bl"],
"border-spacing": ["border-spacing-x", "border-spacing-y"],
"border-w": [
"border-w-x",
"border-w-y",
"border-w-s",
"border-w-e",
"border-w-bs",
"border-w-be",
"border-w-t",
"border-w-r",
"border-w-b",
"border-w-l"
],
"border-w-x": ["border-w-r", "border-w-l"],
"border-w-y": ["border-w-t", "border-w-b"],
"border-color": [
"border-color-x",
"border-color-y",
"border-color-s",
"border-color-e",
"border-color-bs",
"border-color-be",
"border-color-t",
"border-color-r",
"border-color-b",
"border-color-l"
],
"border-color-x": ["border-color-r", "border-color-l"],
"border-color-y": ["border-color-t", "border-color-b"],
translate: [
"translate-x",
"translate-y",
"translate-none"
],
"translate-none": [
"translate",
"translate-x",
"translate-y",
"translate-z"
],
"scroll-m": [
"scroll-mx",
"scroll-my",
"scroll-ms",
"scroll-me",
"scroll-mbs",
"scroll-mbe",
"scroll-mt",
"scroll-mr",
"scroll-mb",
"scroll-ml"
],
"scroll-mx": ["scroll-mr", "scroll-ml"],
"scroll-my": ["scroll-mt", "scroll-mb"],
"scroll-p": [
"scroll-px",
"scroll-py",
"scroll-ps",
"scroll-pe",
"scroll-pbs",
"scroll-pbe",
"scroll-pt",
"scroll-pr",
"scroll-pb",
"scroll-pl"
],
"scroll-px": ["scroll-pr", "scroll-pl"],
"scroll-py": ["scroll-pt", "scroll-pb"],
touch: [
"touch-x",
"touch-y",
"touch-pz"
],
"touch-x": ["touch"],
"touch-y": ["touch"],
"touch-pz": ["touch"]
},
conflictingClassGroupModifiers: { "font-size": ["leading"] },
postfixLookupClassGroups: ["container-type"],
orderSensitiveModifiers: [
"*",
"**",
"after",
"backdrop",
"before",
"details-content",
"file",
"first-letter",
"first-line",
"marker",
"placeholder",
"selection"
]
};
};
var twMerge = createTailwindMerge(getDefaultConfig);
function cn(...inputs) {
return twMerge(clsx(inputs));
}
var f = 0;
Array.isArray;
function u(e, t, n, o, i, u) {
t || (t = {});
var a, c, p = t;
if ("ref" in p) for (c in p = {}, t) "ref" == c ? a = t[c] : p[c] = t[c];
var l = {
type: e,
props: p,
key: n,
ref: a,
__k: null,
__: null,
__b: 0,
__e: null,
__c: null,
constructor: void 0,
__v: --f,
__i: -1,
__u: 0,
__source: i,
__self: u
};
if ("function" == typeof e && (a = e.defaultProps)) for (c in a) void 0 === p[c] && (p[c] = a[c]);
return l$1.vnode && l$1.vnode(l), l;
}
function Badge({ className, ...props }) {
return u("span", {
"data-slot": "badge",
className: cn("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium", "bg-secondary text-secondary-foreground", className),
...props
});
}
function setRef(ref, value) {
if (typeof ref === "function") return ref(value);
else if (ref !== null && ref !== void 0) ref.current = value;
}
function composeRefs(...refs) {
return (node) => {
let hasCleanup = false;
const cleanups = refs.map((ref) => {
const cleanup = setRef(ref, node);
if (!hasCleanup && typeof cleanup == "function") hasCleanup = true;
return cleanup;
});
if (hasCleanup) return () => {
for (let i = 0; i < cleanups.length; i++) {
const cleanup = cleanups[i];
if (typeof cleanup == "function") cleanup();
else setRef(refs[i], null);
}
};
};
}
function useComposedRefs(...refs) {
return q$1(composeRefs(...refs), refs);
}
function createSlot(ownerName) {
const Slot2 = D((props, forwardedRef) => {
let { children, ...slotProps } = props;
let slottableElement = null;
let hasSlottable = false;
const newChildren = [];
if (isLazyComponent(children) && typeof use === "function") children = use(children._payload);
L.forEach(children, (maybeSlottable) => {
if (isSlottable(maybeSlottable)) {
hasSlottable = true;
const slottable = maybeSlottable;
let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
if (isLazyComponent(child) && typeof use === "function") child = use(child._payload);
slottableElement = getSlottableElementFromSlottable(slottable, child);
newChildren.push(slottableElement?.props?.children);
} else newChildren.push(maybeSlottable);
});
if (slottableElement) slottableElement = mn(slottableElement, void 0, newChildren);
else if (!hasSlottable && L.count(children) === 1 && hn(children)) slottableElement = children;
const slottableElementRef = slottableElement ? getElementRef(slottableElement) : void 0;
const composedRef = useComposedRefs(forwardedRef, slottableElementRef);
if (!slottableElement) {
if (children || children === 0) throw new Error(hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName));
return children;
}
const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});
if (slottableElement.type !== S) mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
return mn(slottableElement, mergedProps);
});
Slot2.displayName = `${ownerName}.Slot`;
return Slot2;
}
var Slot = createSlot("Slot");
var SLOTTABLE_IDENTIFIER = Symbol.for("radix.slottable");
var getSlottableElementFromSlottable = (slottable, child) => {
if ("child" in slottable.props) {
const child2 = slottable.props.child;
if (!hn(child2)) return null;
return mn(child2, void 0, slottable.props.children(child2.props.children));
}
return hn(child) ? child : null;
};
function mergeProps(slotProps, childProps) {
const overrideProps = { ...childProps };
for (const propName in childProps) {
const slotPropValue = slotProps[propName];
const childPropValue = childProps[propName];
if (/^on[A-Z]/.test(propName)) {
if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
const result = childPropValue(...args);
slotPropValue(...args);
return result;
};
else if (slotPropValue) overrideProps[propName] = slotPropValue;
} else if (propName === "style") overrideProps[propName] = {
...slotPropValue,
...childPropValue
};
else if (propName === "className") overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
}
return {
...slotProps,
...overrideProps
};
}
function getElementRef(element) {
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
if (mayWarn) return element.ref;
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
if (mayWarn) return element.props.ref;
return element.props.ref || element.ref;
}
function isSlottable(child) {
return hn(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
}
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
function isLazyComponent(element) {
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
}
function isPromiseLike(value) {
return typeof value === "object" && value !== null && "then" in value;
}
var createSlotError = (ownerName) => {
return `${ownerName} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`;
};
var createSlottableError = (ownerName) => {
return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
};
var use = compat_module_exports[" use ".trim().toString()];
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
var cx = clsx;
var cva = (base, config) => (props) => {
var _config_compoundVariants;
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
const { variants, defaultVariants } = config;
const getVariantClassNames = Object.keys(variants).map((variant) => {
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
if (variantProp === null) return null;
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
return variants[variant][variantKey];
});
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
let [key, value] = param;
if (value === void 0) return acc;
acc[key] = value;
return acc;
}, {});
return cx(base, getVariantClassNames, config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
return Object.entries(compoundVariantOptions).every((param) => {
let [key, value] = param;
return Array.isArray(value) ? value.includes({
...defaultVariants,
...propsWithoutUndefined
}[key]) : {
...defaultVariants,
...propsWithoutUndefined
}[key] === value;
}) ? [
...acc,
cvClass,
cvClassName
] : acc;
}, []), props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
};
var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", {
variants: {
variant: {
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",
ghost: "hover:bg-accent hover:text-accent-foreground"
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
icon: "size-9"
}
},
defaultVariants: {
variant: "default",
size: "default"
}
});
function Button({ className, variant, size, asChild = false, ...props }) {
return u(asChild ? Slot : "button", {
"data-slot": "button",
className: cn(buttonVariants({
variant,
size,
className
})),
...props
});
}
function formatStatusTime(timestamp) {
return new Date(timestamp).toLocaleTimeString();
}
function getStatusLabel(status) {
if (status.kind === "expert") return "专家";
if (status.kind === "office") return "办公";
if (status.kind === "fast") return "快速";
if (status.kind === "fallback-thinking") return "思考";
if (status.kind === "disabled") return "关闭";
if (status.kind === "waiting") return "检查中";
if (status.kind === "failed") return "失败";
return "待机";
}
function moveModeOrderItem(order, fromIndex, toIndex) {
const nextOrder = [...order];
const [item] = nextOrder.splice(fromIndex, 1);
if (!item) return nextOrder;
nextOrder.splice(toIndex, 0, item);
return nextOrder;
}
function ModeOrderEditor({ order, disabled, onOrderChange }) {
return u("div", {
className: "flex flex-col gap-2 rounded-md border bg-background p-3",
children: [
u("span", {
className: "flex items-center justify-between gap-3",
children: [u("span", {
className: "text-sm font-medium",
children: "模式优先级"
}), u("span", {
className: "text-xs text-muted-foreground",
children: "从上到下"
})]
}),
u("div", {
className: "flex flex-col gap-2",
children: order.map((mode, index) => u("div", {
className: cn("flex h-9 items-center justify-between gap-2 rounded-md border bg-muted/30 px-2", disabled && "opacity-50"),
children: [u("span", {
className: "flex min-w-0 items-center gap-2 text-sm",
children: [u("span", {
className: "flex size-5 shrink-0 items-center justify-center rounded-sm bg-background text-xs font-medium text-muted-foreground",
children: index + 1
}), u("span", {
className: "truncate",
children: DOUBAO_MODE_LABELS[mode]
})]
}), u("span", {
className: "flex shrink-0 items-center gap-1",
children: [u(Button, {
type: "button",
size: "icon",
variant: "ghost",
className: "size-7",
title: `上移${DOUBAO_MODE_LABELS[mode]}`,
disabled: disabled || index === 0,
onClick: () => onOrderChange(moveModeOrderItem(order, index, index - 1)),
children: u(ArrowUp, { "data-icon": "inline-start" })
}), u(Button, {
type: "button",
size: "icon",
variant: "ghost",
className: "size-7",
title: `下移${DOUBAO_MODE_LABELS[mode]}`,
disabled: disabled || index === order.length - 1,
onClick: () => onOrderChange(moveModeOrderItem(order, index, index + 1)),
children: u(ArrowDown, { "data-icon": "inline-start" })
})]
})]
}, mode))
}),
u("span", {
className: "text-xs leading-5 text-muted-foreground",
children: "自动检查时会按顺序尝试可用模式"
})
]
});
}
function SettingSwitchRow({ title, description, checked, disabled, onCheckedChange }) {
return u("button", {
type: "button",
role: "switch",
"aria-checked": checked,
disabled,
className: cn("flex w-full items-center justify-between gap-4 rounded-md border bg-background p-3 text-left transition-colors", "hover:bg-accent focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:outline-none", disabled && "cursor-not-allowed opacity-50 hover:bg-background"),
onClick: () => onCheckedChange(!checked),
children: [u("span", {
className: "flex min-w-0 flex-col gap-1",
children: [u("span", {
className: "text-sm font-medium",
children: title
}), u("span", {
className: "text-xs text-muted-foreground",
children: description
})]
}), u("span", {
className: "flex shrink-0 items-center gap-2",
children: [u("span", {
className: "text-xs font-medium text-muted-foreground",
children: checked ? "已开启" : "已关闭"
}), u("span", {
className: cn("inline-flex h-6 w-10 items-center rounded-full border border-transparent transition-colors", checked ? "bg-primary" : "bg-input"),
children: u("span", { className: cn("block size-5 rounded-full bg-background shadow-sm transition-transform", checked ? "translate-x-4" : "translate-x-0") })
})]
})]
});
}
function SettingsPanel({ config, status, onConfigChange, onRunNow }) {
const collapsed = config.panelCollapsed;
function updateConfig(patch) {
onConfigChange({
...config,
...patch
});
}
function updateDoubaoEnabled(enabled) {
onConfigChange({
...config,
assistants: {
...config.assistants,
doubao: {
...config.assistants.doubao,
enabled
}
}
});
}
function updateAutoCheckDelayMs(value) {
const autoCheckDelayMs = normalizeAutoCheckDelayMs(Number(value));
onConfigChange({
...config,
assistants: {
...config.assistants,
doubao: {
...config.assistants.doubao,
autoCheckDelayMs
}
}
});
}
function updateModeSwitchConfirmMs(value) {
const modeSwitchConfirmMs = normalizeModeSwitchConfirmMs(Number(value));
onConfigChange({
...config,
assistants: {
...config.assistants,
doubao: {
...config.assistants.doubao,
modeSwitchConfirmMs
}
}
});
}
function updatePreferredModeOrder(preferredModeOrder) {
onConfigChange({
...config,
assistants: {
...config.assistants,
doubao: {
...config.assistants.doubao,
preferredModeOrder
}
}
});
}
return u("div", {
className: cn("ai-assistant-enhancer fixed top-1/2 right-0 z-[2147483647] -translate-y-1/2", "flex items-center gap-2 text-foreground"),
children: [u(Button, {
type: "button",
size: "icon",
variant: "outline",
className: "rounded-r-none border-r-0 bg-background shadow-md",
title: collapsed ? "展开 AI 助手增强器" : "收起 AI 助手增强器",
onClick: () => updateConfig({ panelCollapsed: !collapsed }),
children: collapsed ? u(ChevronLeft, { "data-icon": "inline-start" }) : u(ChevronRight, { "data-icon": "inline-start" })
}), !collapsed && u("section", {
className: "w-80 rounded-l-md border bg-background p-4 shadow-lg",
children: [u("div", {
className: "mb-4 flex items-start justify-between gap-3",
children: [u("div", {
className: "flex items-center gap-2",
children: [u(Bot, {}), u("div", { children: [u("h2", {
className: "text-sm font-semibold",
children: "AI 助手增强器"
}), u("p", {
className: "text-xs text-muted-foreground",
children: "豆包模式自动优化"
})] })]
}), u(Badge, { children: getStatusLabel(status) })]
}), u("div", {
className: "flex flex-col gap-4",
children: [
u(SettingSwitchRow, {
title: "总开关",
description: "关闭后不再自动切换任何助手",
checked: config.enabled,
onCheckedChange: (enabled) => updateConfig({ enabled })
}),
u(SettingSwitchRow, {
title: "豆包",
description: "按优先级自动选择模式",
checked: config.assistants.doubao.enabled,
disabled: !config.enabled,
onCheckedChange: updateDoubaoEnabled
}),
u(ModeOrderEditor, {
order: config.assistants.doubao.preferredModeOrder,
disabled: !config.enabled || !config.assistants.doubao.enabled,
onOrderChange: updatePreferredModeOrder
}),
u("label", {
className: "flex flex-col gap-2 rounded-md border bg-background p-3",
children: [
u("span", {
className: "flex items-center justify-between gap-3",
children: [u("span", {
className: "text-sm font-medium",
children: "开始检查延迟"
}), u("span", {
className: "text-xs text-muted-foreground",
children: "毫秒"
})]
}),
u("input", {
type: "number",
min: 0,
max: 1e4,
step: 100,
value: config.assistants.doubao.autoCheckDelayMs,
disabled: !config.enabled || !config.assistants.doubao.enabled,
className: cn("h-8 rounded-md border bg-background px-2 text-sm outline-none transition-colors", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "disabled:cursor-not-allowed disabled:opacity-50"),
onChange: (event) => updateAutoCheckDelayMs(event.currentTarget.value)
}),
u("span", {
className: "text-xs leading-5 text-muted-foreground",
children: "刷新或新对话后等待页面稳定再检查;过早可能误判模式"
})
]
}),
u("label", {
className: "flex flex-col gap-2 rounded-md border bg-background p-3",
children: [
u("span", {
className: "flex items-center justify-between gap-3",
children: [u("span", {
className: "text-sm font-medium",
children: "模式确认延迟"
}), u("span", {
className: "text-xs text-muted-foreground",
children: "毫秒"
})]
}),
u("input", {
type: "number",
min: 500,
max: 5e3,
step: 100,
value: config.assistants.doubao.modeSwitchConfirmMs,
disabled: !config.enabled || !config.assistants.doubao.enabled,
className: cn("h-8 rounded-md border bg-background px-2 text-sm outline-none transition-colors", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "disabled:cursor-not-allowed disabled:opacity-50"),
onChange: (event) => updateModeSwitchConfirmMs(event.currentTarget.value)
}),
u("span", {
className: "text-xs leading-5 text-muted-foreground",
children: "模式切换较慢时调大;超时仍未生效才尝试下一项"
})
]
}),
u("div", {
className: "rounded-md border bg-muted/30 p-3",
children: [u("div", {
className: "mb-1 flex items-center justify-between gap-3",
children: [u("span", {
className: "text-xs font-medium",
children: "最近状态"
}), u("span", {
className: "text-xs text-muted-foreground",
children: formatStatusTime(status.updatedAt)
})]
}), u("p", {
className: "text-xs leading-5 text-muted-foreground",
children: status.message
})]
}),
u(Button, {
type: "button",
variant: "outline",
size: "sm",
className: "w-full",
disabled: !config.enabled || !config.assistants.doubao.enabled,
onClick: onRunNow,
children: [u(RefreshCw, { "data-icon": "inline-start" }), "立即检查"]
})
]
})]
})]
});
}
function App({ configStore, statusStore, onRunNow, onConfigChanged }) {
const [config, setConfig] = d(() => configStore.getConfig());
const [status, setStatus] = d(() => statusStore.getStatus());
y(() => statusStore.subscribe(setStatus), [statusStore]);
function handleConfigChange(nextConfig) {
configStore.setConfig(nextConfig);
setConfig(configStore.getConfig());
onConfigChanged();
}
return u(SettingsPanel, {
config,
status,
onConfigChange: handleConfigChange,
onRunNow
});
}
var MODE_TEXT = DOUBAO_MODE_LABELS;
var MODE_LABELS = Object.values(DOUBAO_MODE_LABELS);
var MODE_TRIGGER_SELECTOR = [
"button[data-slot=\"dropdown-menu-trigger\"]",
"[data-valid-btn=\"mode-select-action-btn\"]",
"button[aria-haspopup=\"menu\"]",
"[role=\"button\"][aria-haspopup=\"menu\"]",
"button",
"[role=\"button\"]"
].join(",");
var LOGIN_DIALOG_TEXT = "登录以解锁更多功能";
var NEW_CHAT_TEXT = "新对话";
var NEW_CHAT_TRIGGER_TEXT_MAX_LENGTH = 30;
var MODE_TRIGGER_WAIT_MS = 5e3;
var MODE_MENU_WAIT_MS = 1800;
function delay(ms) {
return new Promise((resolve) => window.setTimeout(resolve, ms));
}
function getElementText(element) {
return (element.textContent ?? "").replace(/\s+/g, "").trim();
}
function elementHasText(element, text) {
return getElementText(element).includes(text);
}
function isVisibleElement(element) {
const rect = element.getBoundingClientRect();
return rect.width > 0 && rect.height > 0;
}
function getModeFromText(text) {
const matchedLabels = MODE_LABELS.filter((label) => text.includes(label));
if (matchedLabels.length !== 1) return "unknown";
return Object.entries(MODE_TEXT).find(([, label]) => label === matchedLabels[0])?.[0] ?? "unknown";
}
function clickElement(element) {
if (element instanceof HTMLElement) {
if (typeof PointerEvent !== "undefined") {
element.dispatchEvent(new PointerEvent("pointerdown", {
bubbles: true,
cancelable: true,
pointerType: "mouse"
}));
element.dispatchEvent(new PointerEvent("pointerup", {
bubbles: true,
cancelable: true,
pointerType: "mouse"
}));
}
element.dispatchEvent(new MouseEvent("mousedown", {
bubbles: true,
cancelable: true
}));
element.dispatchEvent(new MouseEvent("mouseup", {
bubbles: true,
cancelable: true
}));
element.click();
}
}
async function waitForElement(getter, timeoutMs, intervalMs = 100) {
const startedAt = Date.now();
while (Date.now() - startedAt <= timeoutMs) {
const value = getter();
if (value) return value;
await delay(intervalMs);
}
return null;
}
async function waitForModeSwitch(mode, timeoutMs) {
const startedAt = Date.now();
let currentMode = getCurrentMode();
while (Date.now() - startedAt <= timeoutMs) {
if (hasLoginDialog()) return {
currentMode: getCurrentMode(),
loginBlocked: true
};
currentMode = getCurrentMode();
if (currentMode === mode) return {
currentMode,
loginBlocked: false
};
await delay(100);
}
return {
currentMode: getCurrentMode(),
loginBlocked: hasLoginDialog()
};
}
function hasLoginDialog() {
return (document.body.innerText ?? document.body.textContent ?? "").includes(LOGIN_DIALOG_TEXT);
}
function closeLoginDialog() {
const dialog = document.querySelector("[role=\"dialog\"]");
if (!dialog || !hasLoginDialog()) return;
const closeButton = Array.from(dialog.querySelectorAll("button")).find((button) => {
const text = getElementText(button);
return text === "close" || text === "关闭" || text.length === 0;
});
if (closeButton) {
clickElement(closeButton);
return;
}
document.dispatchEvent(new KeyboardEvent("keydown", {
key: "Escape",
bubbles: true
}));
}
function findModeTrigger() {
const trigger = Array.from(document.querySelectorAll(MODE_TRIGGER_SELECTOR)).filter(isVisibleElement).find((element) => MODE_LABELS.some((text) => elementHasText(element, text)));
if (!trigger) return null;
if (trigger instanceof HTMLElement) return trigger;
const clickable = trigger.closest("button,[role=\"button\"],[aria-haspopup]");
return clickable instanceof HTMLElement ? clickable : null;
}
function findModeClickTarget(trigger) {
const childButton = Array.from(trigger.querySelectorAll("button")).find((element) => isVisibleElement(element) && MODE_LABELS.some((label) => elementHasText(element, label)));
return childButton instanceof HTMLElement ? childButton : trigger;
}
function getModeFromTrigger(trigger) {
return [trigger, ...trigger.querySelectorAll("*")].filter((element) => {
if (!isVisibleElement(element)) return false;
return !element.closest("[role=\"menu\"]");
}).map((element) => getModeFromText(getElementText(element))).find((mode) => mode !== "unknown") ?? "unknown";
}
function isNewChatClickTarget(target) {
let current = target;
while (current && current !== document.body) {
const text = getElementText(current);
if (text.includes(NEW_CHAT_TEXT) && !MODE_LABELS.some((label) => text.includes(label)) && text.length <= NEW_CHAT_TRIGGER_TEXT_MAX_LENGTH && isVisibleElement(current)) return true;
current = current.parentElement;
}
return false;
}
function findModeMenuItem(mode) {
return findModeMenuItemByText(MODE_TEXT[mode]);
}
function hasModeMenuItems() {
return MODE_LABELS.some((label) => Boolean(findModeMenuItemByText(label)));
}
function findModeMenuItemByText(label) {
return Array.from(document.querySelectorAll("[role=\"menuitem\"]")).find((element) => elementHasText(element, label)) ?? null;
}
async function openModeMenu() {
if (hasModeMenuItems()) return true;
const trigger = await waitForElement(findModeTrigger, MODE_TRIGGER_WAIT_MS);
if (!trigger) return false;
if (trigger.getAttribute("data-state") !== "open") clickElement(findModeClickTarget(trigger));
return Boolean(await waitForElement(() => hasModeMenuItems() ? document.querySelector("[role=\"menuitem\"]") : null, MODE_MENU_WAIT_MS, 80));
}
function getCurrentMode() {
const trigger = findModeTrigger();
if (!trigger) return "unknown";
return getModeFromTrigger(trigger);
}
async function chooseMode(mode, confirmMs) {
if (!await openModeMenu()) return {
mode: getCurrentMode(),
changed: false,
reason: findModeTrigger() ? "已找到模式按钮,但未能打开豆包模式菜单" : "未找到豆包模式按钮"
};
const menuItem = findModeMenuItem(mode);
if (!menuItem) return {
mode: getCurrentMode(),
changed: false,
reason: `未找到${MODE_TEXT[mode]}选项`
};
clickElement(menuItem);
const { currentMode, loginBlocked } = await waitForModeSwitch(mode, confirmMs);
if (loginBlocked) {
closeLoginDialog();
await delay(120);
return {
mode: getCurrentMode(),
changed: false,
reason: `${MODE_TEXT[mode]}需要登录或权益,已关闭登录提示`
};
}
return {
mode: currentMode,
changed: currentMode === mode,
reason: currentMode === mode ? `已切换到${MODE_TEXT[mode]}` : `尝试切换${MODE_TEXT[mode]}后仍为${MODE_TEXT[currentMode] ?? "未知模式"}`
};
}
async function switchToBestMode(options) {
let currentMode = getCurrentMode();
const failedReasons = [];
for (const mode of options.preferredModeOrder) {
if (currentMode === mode) return {
mode: currentMode,
changed: false,
reason: failedReasons.length > 0 ? `${failedReasons.join(";")},当前已是${MODE_TEXT[currentMode]}` : `当前已是${MODE_TEXT[currentMode]}`
};
const result = await chooseMode(mode, options.modeSwitchConfirmMs);
if (result.mode === mode) return failedReasons.length > 0 ? {
...result,
reason: `${failedReasons.join(";")},${result.reason}`
} : result;
failedReasons.push(result.reason);
currentMode = result.mode;
}
return {
mode: getCurrentMode(),
changed: false,
reason: failedReasons.length > 0 ? failedReasons.join(";") : "未配置可尝试的豆包模式"
};
}
function watch(onChange) {
const handleClick = (event) => {
if (event.target instanceof Element && isNewChatClickTarget(event.target)) onChange();
};
document.addEventListener("click", handleClick, true);
window.addEventListener("popstate", onChange);
return () => {
document.removeEventListener("click", handleClick, true);
window.removeEventListener("popstate", onChange);
};
}
var doubaoAdapter = {
id: "doubao",
name: "豆包",
matches: (location) => location.hostname === "www.doubao.com" && location.pathname.startsWith("/chat"),
getCurrentMode,
switchToBestMode,
watch
};
function createStatusStore(initialStatus) {
let currentStatus = initialStatus;
const listeners = new Set();
return {
getStatus: () => currentStatus,
setStatus: (status) => {
currentStatus = status;
for (const listener of listeners) listener(currentStatus);
},
subscribe: (listener) => {
listeners.add(listener);
listener(currentStatus);
return () => {
listeners.delete(listener);
};
}
};
}
function createDoubaoStatus(kind, message) {
return {
assistantId: "doubao",
kind,
message,
updatedAt: Date.now()
};
}
var AUTO_RECHECK_INTERVAL_MS = 1500;
function getStatusKindByMode(mode) {
if (mode === "expert") return "expert";
if (mode === "office") return "office";
if (mode === "fast") return "fast";
return "failed";
}
function createEnhancerController(options) {
const { adapter, getConfig, statusStore, debounceMs = 300, autoRetryDelaysMs } = options;
let cleanupWatcher;
let timer;
const autoTimers = new Set();
let running = false;
let rerunAfterCurrent = false;
function clearScheduledRun() {
if (timer) {
window.clearTimeout(timer);
timer = void 0;
}
}
function clearAutoRuns() {
for (const autoTimer of autoTimers) window.clearTimeout(autoTimer);
autoTimers.clear();
}
function clearPendingRun() {
clearScheduledRun();
clearAutoRuns();
rerunAfterCurrent = false;
}
async function runOnce() {
if (running) return;
const config = getConfig();
if (!adapter.matches(window.location)) return;
if (!isDoubaoEnabled(config)) {
statusStore.setStatus(createDoubaoStatus("disabled", "脚本已关闭"));
return;
}
running = true;
statusStore.setStatus(createDoubaoStatus("waiting", "正在检查豆包模式"));
try {
const result = await adapter.switchToBestMode({
modeSwitchConfirmMs: config.assistants.doubao.modeSwitchConfirmMs,
preferredModeOrder: config.assistants.doubao.preferredModeOrder
});
statusStore.setStatus(createDoubaoStatus(getStatusKindByMode(result.mode), result.reason));
} catch (error) {
const message = error instanceof Error ? error.message : "未知错误";
statusStore.setStatus(createDoubaoStatus("failed", `自动切换失败:${message}`));
} finally {
running = false;
if (rerunAfterCurrent) {
rerunAfterCurrent = false;
scheduleRun();
}
}
}
function runScheduledOnce() {
if (running) {
rerunAfterCurrent = true;
return;
}
runOnce();
}
function scheduleRun() {
clearPendingRun();
timer = window.setTimeout(() => {
timer = void 0;
runScheduledOnce();
}, debounceMs);
}
function getAutoRunDelays() {
if (autoRetryDelaysMs) return autoRetryDelaysMs;
const { autoCheckDelayMs } = getConfig().assistants.doubao;
return [autoCheckDelayMs, autoCheckDelayMs + AUTO_RECHECK_INTERVAL_MS];
}
function scheduleAutoRun() {
clearPendingRun();
for (const delayMs of getAutoRunDelays()) {
const autoTimer = window.setTimeout(() => {
autoTimers.delete(autoTimer);
runScheduledOnce();
}, delayMs);
autoTimers.add(autoTimer);
}
}
return {
start: () => {
if (cleanupWatcher) return;
cleanupWatcher = adapter.watch(scheduleAutoRun);
scheduleAutoRun();
},
stop: () => {
clearPendingRun();
cleanupWatcher?.();
cleanupWatcher = void 0;
},
runOnce,
scheduleRun,
scheduleAutoRun
};
}
var src_default = "/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-semibold:600;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}@layer base,components;@layer utilities{.pointer-events-none{pointer-events:none}.fixed{position:fixed}.relative{position:relative}.top-1\\/2{top:50%}.right-0{right:calc(var(--spacing) * 0)}.z-\\[2147483647\\]{z-index:2147483647}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-80{width:calc(var(--spacing) * 80)}.w-full{width:100%}.min-w-0{min-width:calc(var(--spacing) * 0)}.shrink-0{flex-shrink:0}.translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing) * 4);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.border{border-style:var(--tw-border-style);border-width:1px}.border-r-0{border-right-style:var(--tw-border-style);border-right-width:0}.border-transparent{border-color:#0000}.bg-background{background-color:var(--background)}.bg-input{background-color:var(--input)}.bg-muted\\/30{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\\/30{background-color:color-mix(in oklab, var(--muted) 30%, transparent)}}.bg-primary{background-color:var(--primary)}.bg-secondary{background-color:var(--secondary)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-2{padding-block:calc(var(--spacing) * 2)}.text-left{text-align:left}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-nowrap{white-space:nowrap}.text-foreground{color:var(--foreground)}.text-muted-foreground{color:var(--muted-foreground)}.text-primary-foreground{color:var(--primary-foreground)}.text-secondary-foreground{color:var(--secondary-foreground)}.opacity-50{opacity:.5}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.running{animation-play-state:running}@media (hover:hover){.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-background:hover{background-color:var(--background)}.hover\\:bg-primary\\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab, var(--primary) 90%, transparent)}}.hover\\:text-accent-foreground:hover{color:var(--accent-foreground)}}.focus-visible\\:border-ring:focus-visible{border-color:var(--ring)}.focus-visible\\:ring-\\[3px\\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\\:ring-ring\\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\:ring-ring\\/50:focus-visible{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.focus-visible\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.has-\\[\\>svg\\]\\:px-2\\.5:has(>svg){padding-inline:calc(var(--spacing) * 2.5)}.has-\\[\\>svg\\]\\:px-3:has(>svg){padding-inline:calc(var(--spacing) * 3)}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-4 svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}}@property --tw-animation-delay{syntax:\"*\";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:\"*\";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:\"*\";inherits:false}@property --tw-animation-fill-mode{syntax:\"*\";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:\"*\";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:\"*\";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:\"*\";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:\"*\";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:\"*\";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:\"*\";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:\"*\";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:\"*\";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:\"*\";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:\"*\";inherits:false;initial-value:0}:host,:root{--radius:.5rem;--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(55.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--destructive:oklch(57.7% .245 27.325);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0)}:host(.dark),.dark{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0)}.ai-assistant-enhancer{color:var(--foreground);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}@property --tw-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\"*\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:\"*\";inherits:false;initial-value:solid}";
function createConfigStore() {
const getConfig = () => normalizeConfig(_GM_getValue(CONFIG_STORAGE_KEY, DEFAULT_CONFIG));
return {
getConfig,
setConfig: (config) => {
_GM_setValue(CONFIG_STORAGE_KEY, normalizeConfig(config));
},
updateConfig: (updater) => {
const nextConfig = normalizeConfig(updater(getConfig()));
_GM_setValue(CONFIG_STORAGE_KEY, nextConfig);
return nextConfig;
}
};
}
var configStore = createConfigStore();
var statusStore = createStatusStore(createDoubaoStatus("idle", "等待页面加载"));
var controller = createEnhancerController({
adapter: doubaoAdapter,
getConfig: configStore.getConfig,
statusStore
});
function toggleEnabled() {
configStore.updateConfig((config) => ({
...config,
enabled: !config.enabled
}));
controller.scheduleRun();
}
function registerMenus() {
if (typeof _GM_registerMenuCommand === "undefined") return;
_GM_registerMenuCommand("切换 AI 助手增强器开关", toggleEnabled);
_GM_registerMenuCommand("立即检查豆包模式", () => {
controller.runOnce();
});
}
function mountPanel() {
const { container } = createShadowContainer({
hostTag: "div",
attachTo: document.documentElement,
containerClass: "ai-assistant-enhancer-root",
containerAttrs: { "data-script": "ai-assistant-enhancer" },
styles: [src_default]
});
nn(u(App, {
configStore,
statusStore,
onRunNow: () => {
controller.runOnce();
},
onConfigChanged: () => void 0
}), container);
}
registerMenus();
mountPanel();
controller.start();
})();