Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix: 为媒体来源和挂载状态加入图标

Codex7dc7f5f4e2d6
diff --git a/docs/reference-snapshots/media-source-icons.md b/docs/reference-snapshots/media-source-icons.md
new file mode 100644
index 000000000..f7afcdfb2
--- /dev/null
+++ b/docs/reference-snapshots/media-source-icons.md
@@ -0,0 +1,8 @@
+# 媒体来源图标
+
+不登记到 `docs/reference-sources.json`:本文是二进制图标的取证记录,不是可重抓的上游 Markdown;原始文件与 PNG 的摘要分别列在下方。
+
+取证日期:2026-09-06。官网图标仅用于标识对应服务,权利归各服务所有;Pillow 将原文件无缩放转为 PNG。图标内嵌在本地模块,使用时不请求外站。本地磁盘复用项目已固定版本的 Lucide hard-drive。
+
+- 115: https://115.com/favicon.ico; source SHA-256 27217fc80a3ac0949acc55b43f9662a08bfab1026b6fee51e2a7f3151721b64a; PNG SHA-256 cb8761584ad38d6b44d1f50b2f9f6b57b1880243ccd88d435682c39d850e986a
+- pikpak: https://mypikpak.com/favicon-32x32.png; source SHA-256 c8aa2053bfa44e1c0a052c5fe3cdc540fd42471756d3017b654e72e671e69914; PNG SHA-256 1fb0e2d400c9277654194343ffd3bb5b92410c8da56e7ccee65997b0e4cab4d8
diff --git a/frontend/src/islands/configuration.tsx b/frontend/src/islands/configuration.tsx
index cfd2ccf68..02df698e2 100644
--- a/frontend/src/islands/configuration.tsx
+++ b/frontend/src/islands/configuration.tsx
@@ -10,7 +10,7 @@
import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks';
import type { JSX } from 'preact';
-import { fieldsetTitle, noteHtml, setActionBusy, selectFieldHtml, wireSelectField } from '@peach/legacy/ui';
+import { fieldsetTitle, noteHtml, setActionBusy, selectFieldHtml, wireSelectField, MEDIA_SOURCE_ICONS, selectOptionIconHtml } from '@peach/legacy/ui';
import { ApiError, apiGet, apiSend, errorMessage } from '../api';
export interface ConfigurationProps {
@@ -108,7 +108,7 @@ function MountStatus({ data }: { data: ConfigurationData }) {
if (!sources) return null;
return <section class="configfieldset" aria-labelledby="configMountsTitle"><div class="geist-fieldset-content">
<Html html={fieldsetTitle('configMountsTitle', '挂载状态')} />
- <dl class="configfacts">{sources.map((row) => <><dt>{({local: '本地磁盘', '115': 'CloudDrive · 115', pikpak: 'CloudDrive · PikPak'} as Record<string, string>)[row.location] || row.location}</dt><dd>{row.path || '未配置挂载点'} <span class={`configstatus ${row.online === true ? 'online' : row.online === false ? 'offline' : 'unknown'}`}>{row.online === true ? '在线' : row.online === false ? '离线' : '未检测'}</span></dd></>)}</dl>
+ <dl class="configfacts">{sources.map((row) => <><dt><span aria-hidden="true" dangerouslySetInnerHTML={{__html:selectOptionIconHtml(MEDIA_SOURCE_ICONS[row.location])}} />{({local: '本地磁盘', '115': 'CloudDrive · 115', pikpak: 'CloudDrive · PikPak'} as Record<string, string>)[row.location] || row.location}</dt><dd>{row.path || '未配置挂载点'} <span class={`configstatus ${row.online === true ? 'online' : row.online === false ? 'offline' : 'unknown'}`}>{row.online === true ? '在线' : row.online === false ? '离线' : '未检测'}</span></dd></>)}</dl>
{error ? <p class="configbad" role="alert">{error}</p> : null}
<button type="button" class="geist-button" onClick={(event) => refresh(event.currentTarget)}>刷新挂载状态</button>
</div></section>;
@@ -121,7 +121,7 @@ function MediaSourceSelect({ value, label, onChange }: { value: string; label: s
callback.current = onChange;
useLayoutEffect(() => {
const root = mount.current!;
- root.innerHTML = selectFieldHtml([['local', '本地磁盘'], ['115', 'CloudDrive · 115'], ['pikpak', 'CloudDrive · PikPak']], value, { label });
+ root.innerHTML = selectFieldHtml([['local', '本地磁盘'], ['115', 'CloudDrive · 115'], ['pikpak', 'CloudDrive · PikPak']].map(([kind, text]) => [kind!, text!, MEDIA_SOURCE_ICONS[kind!]!]), value, { label });
const field = wireSelectField(root.firstElementChild!);
control.current = field;
const change = () => callback.current(field.value);
diff --git a/frontend/src/legacy/ui.d.ts b/frontend/src/legacy/ui.d.ts
index 294520304..2dcf56ec6 100644
--- a/frontend/src/legacy/ui.d.ts
+++ b/frontend/src/legacy/ui.d.ts
@@ -18,6 +18,8 @@ export declare function fieldsetTitle(id: string, title: string): string;
export declare function selectFieldHtml(items: string[][], current: string,
options?: { label?: string; attr?: string; className?: string }): string;
export declare function wireSelectField(root: Element): HTMLElement & { value: string; disabled: boolean };
+export declare const MEDIA_SOURCE_ICONS: Record<string, string>;
+export declare function selectOptionIconHtml(mark?: string): string;
/** 用户触发的动作等待结果时的忙态:`aria-busy` 与 `aria-disabled` 一起写,控件仍可聚焦,
* 重复触发由遗留层的 `wireBusyActions` 拦住。请求等待期不许改用原生 `disabled`。 */
diff --git a/frontend/test/configuration.test.tsx b/frontend/test/configuration.test.tsx
index 3568bedc6..044f1fb76 100644
--- a/frontend/test/configuration.test.tsx
+++ b/frontend/test/configuration.test.tsx
@@ -76,6 +76,8 @@ describe('媒体文件夹列表', () => {
expect(el.querySelector('.configstatus.online')?.textContent).toBe('在线');
expect(el.querySelector('.configstatus.offline')?.textContent).toBe('离线');
expect(el.querySelector('.configstatus.unknown')?.textContent).toBe('未检测');
+ expect([...el.querySelectorAll('.configfacts [data-source-icon]')].map(node => node.getAttribute('data-source-icon')))
+ .toEqual(['fixture-115', 'fixture-pikpak', 'hard-drive']);
});
it('刷新挂载状态保留未保存的路径', async () => {
const media_sources = [{ location: '115', path: 'B:/', root: 'B:/', online: false }];
diff --git a/frontend/test/stubs/legacy-ui.ts b/frontend/test/stubs/legacy-ui.ts
index a0b35d815..f5dc87719 100644
--- a/frontend/test/stubs/legacy-ui.ts
+++ b/frontend/test/stubs/legacy-ui.ts
@@ -14,6 +14,9 @@ export const emptyStateHtml = (
export const fieldsetTitle = (id: string, title: string): string =>
`<h3 class="geist-fieldset-title" id="${id}">${title}</h3>`;
+export const MEDIA_SOURCE_ICONS: Record<string,string> = {local:'hard-drive','115':'fixture-115',pikpak:'fixture-pikpak'};
+export const selectOptionIconHtml = (mark?: string): string => mark ? `<i data-source-icon="${mark}"></i>` : '';
+
export const selectFieldHtml = (items: string[][], value: string, options: { label?: string } = {}): string =>
`<div class="gselect" data-value="${value}"><button type="button" aria-haspopup="listbox" aria-label="${options.label}">${items.find(item => item[0] === value)?.[1]}</button></div>`;
export const wireSelectField = (root: HTMLElement) => {
diff --git a/src/peach/routes_pages.py b/src/peach/routes_pages.py
index 743f0689c..ab152a90e 100644
--- a/src/peach/routes_pages.py
+++ b/src/peach/routes_pages.py
@@ -265,12 +265,12 @@ _CHEVRON_SVG = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-
#: 两样东西借自站内共用控件:整页的覆盖式滚动条(原生那条藏掉,滑块浮在内容上),
#: 以及高级设置的折叠(原生 <details> 不过渡高度)。页面里没有 <details> 时 wireCollapse
#: 什么也不做,所以每张页面都挂同一段脚本。
-_SHARED_SCRIPT = ('<script type="module">import{attachOverlayScrollbar,wireCollapse,selectFieldHtml,wireSelectField}from"/js/ui-components.js";'
+_SHARED_SCRIPT = ('<script type="module">import{attachOverlayScrollbar,wireCollapse,selectFieldHtml,wireSelectField,MEDIA_SOURCE_ICONS}from"/js/ui-components.js";'
'attachOverlayScrollbar(document.documentElement,{variant:"page"});'
'wireCollapse(document,"details","setup-collapse");'
'const enhance=()=>document.querySelectorAll("select[name=media_location]:not([hidden])").forEach(select=>{'
'const holder=document.createElement("div");'
- 'holder.innerHTML=selectFieldHtml(Array.from(select.options,o=>[o.value,o.text]),select.value,{label:select.getAttribute("aria-label")||"媒体来源"});'
+ 'holder.innerHTML=selectFieldHtml(Array.from(select.options,o=>[o.value,o.text,MEDIA_SOURCE_ICONS[o.value]]),select.value,{label:select.getAttribute("aria-label")||"媒体来源"});'
'select.after(holder);const field=wireSelectField(holder.firstElementChild);'
'field.addEventListener("change",()=>{select.value=field.value;select.dispatchEvent(new Event("change",{bubbles:true}));});'
'select.hidden=true;});enhance();'
@@ -320,7 +320,7 @@ def _button_rules() -> str:
def _document(title: str, body: str) -> str:
# 页内脚本对两张页面都生效:找不到对应控件时它什么也不做。
index = (PROJECT_ROOT / "web/index.html").read_text(encoding="utf-8")
- symbols = ''.join(re.findall(r'<symbol id="i-(?:check|chevron-down)"[^>]*>.*?</symbol>', index))
+ symbols = ''.join(re.findall(r'<symbol id="i-(?:check|chevron-down|hard-drive)"[^>]*>.*?</symbol>', index))
return (f"{_SETUP_HEAD}<title>{title}</title><style>{_theme_tokens()}{_scrollbar_rules()}</style>"
f'{_SETUP_STYLE}<style>{_button_rules()}</style></head><body><svg width="0" height="0" aria-hidden="true" style="position:absolute">{symbols}</svg><main>{body}</main>{_SETUP_SCRIPT}{_SHARED_SCRIPT}</body></html>\n')
diff --git a/tests/test_onboarding.py b/tests/test_onboarding.py
index 991b8ba28..5d3bbeac3 100644
--- a/tests/test_onboarding.py
+++ b/tests/test_onboarding.py
@@ -600,7 +600,7 @@ class SetupPageTests(_Case):
"""高级设置是 Geist Collapse:借主站的 wireCollapse,chevron 与高度都 200ms;滚动条也是主站那条。"""
body = self._get("/").text
self.assertIn('<summary><span>高级设置</span><svg viewBox="0 0 24 24" aria-hidden="true">', body)
- self.assertIn('import{attachOverlayScrollbar,wireCollapse,selectFieldHtml,wireSelectField}from"/js/ui-components.js";'
+ self.assertIn('import{attachOverlayScrollbar,wireCollapse,selectFieldHtml,wireSelectField,MEDIA_SOURCE_ICONS}from"/js/ui-components.js";'
'attachOverlayScrollbar(document.documentElement,{variant:"page"});'
'wireCollapse(document,"details","setup-collapse");', body)
self.assertIn('.fcollapse{overflow:hidden;transition:height .2s ease-in-out;margin:0 -6px;padding:0 6px}', body)
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 39370f931..f652abefc 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -2297,7 +2297,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageLacks("<select", "下拉一律走 Geist Select,不回落到浏览器控件")
self.assertPageLacks("color-scheme:dark;", "只有 <html> 声明配色,控件不再各自钉死一档")
self.assertCode(
- "<span data-select-label>${esc(chosen[1])}</span>${icon('chevron-down')}")
+ "<span data-select-label>${content(chosen)}</span>${icon('chevron-down')}")
self.assertPageContains(
".gselectfield>svg{width:16px;height:16px;flex:none;stroke:currentColor;fill:none;color:var(--muted)}")
diff --git a/web/css/01-base.css b/web/css/01-base.css
index 10625d26c..95f51e1bd 100644
--- a/web/css/01-base.css
+++ b/web/css/01-base.css
@@ -258,6 +258,9 @@ button[aria-busy="true"],[role="button"][aria-busy="true"]{
background:var(--ground);color:var(--ink);font:inherit;font-size:var(--fs-md);line-height:20px;
text-align:left;cursor:pointer;transition:border-color .12s ease,background-color .12s ease}
.gselectfield>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
+.gselectmenu [data-select-content]{display:flex;align-items:center;gap:8px;min-width:0}
+.gselectfield .gselectmark{vertical-align:-3px;margin-inline-end:8px}
+.gselectmark{width:16px;height:16px;flex:none;object-fit:contain;stroke:currentColor;fill:none}
.gselectfield>svg{width:16px;height:16px;flex:none;stroke:currentColor;fill:none;color:var(--muted)}
.gselectfield:hover:not(:disabled){border-color:var(--field-ring-hover)}
/* 展开时按住焦点态:菜单开着而触发器看起来没被点中,读起来像两个控件。 */
@@ -269,9 +272,9 @@ button[aria-busy="true"],[role="button"][aria-busy="true"]{
padding:0 8px;border:0;border-radius:var(--control-radius);background:transparent;color:var(--ink-2);
font:inherit;font-size:var(--fs-md);text-align:left;cursor:pointer}
.gselectmenu button:hover{background:var(--hover);color:var(--ink)}
-.gselectmenu button svg{width:16px;height:16px;flex:none;visibility:hidden;stroke:currentColor;fill:none}
+.gselectmenu button>svg{width:16px;height:16px;flex:none;visibility:hidden;stroke:currentColor;fill:none}
.gselectmenu button[aria-selected="true"]{background:var(--hover);color:var(--ink)}
-.gselectmenu button[aria-selected="true"] svg{visibility:visible}
+.gselectmenu button[aria-selected="true"]>svg{visibility:visible}
/* Geist Modal:确认一次写操作。实测 https://vercel.com/geist/modal(2026-09-04):
540px 宽、12px 圆角、窄屏两侧各留 10px,正文 20px 内边距,操作条粘在底、12px 内边距、
diff --git a/web/css/23-configuration.css b/web/css/23-configuration.css
index 7624f28fc..d0c41c42d 100644
--- a/web/css/23-configuration.css
+++ b/web/css/23-configuration.css
@@ -42,5 +42,6 @@
.configcheck{display:flex;align-items:center;gap:12px;min-height:32px;cursor:pointer;color:var(--ink)}
.configfacts{margin:0;display:grid;grid-template-columns:max-content minmax(0,1fr);gap:10px 24px;align-items:baseline}
.configfacts dt{color:var(--muted);font-size:var(--fs-sm)}.configfacts dd{margin:0;overflow-wrap:anywhere}
+.configfacts dt .gselectmark{vertical-align:-3px;margin-inline-end:8px}
@media(max-width:560px){.configfacts{grid-template-columns:minmax(0,1fr)}.configfacts dd{margin-top:-6px}}
@media(max-width:560px){.configpage{--control-h:44px}.configfieldset>.geist-fieldset-footer{flex-wrap:wrap}.configsource .geist-input{font-size:var(--fs-lg)}}
diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.js
index cd5277774..60058fff4 100644
--- a/web/dist/peach-ui.js
+++ b/web/dist/peach-ui.js
@@ -1,18 +1,18 @@
-import { emptyStateHtml as e, fieldsetTitle as t, noteHtml as n, selectFieldHtml as r, setActionBusy as i, wireSelectField as a } from "/js/ui-components.js";
-import { LOC as o, fmtDur as s, fmtSize as c } from "/js/core.js";
+import { MEDIA_SOURCE_ICONS as e, emptyStateHtml as t, fieldsetTitle as n, noteHtml as r, selectFieldHtml as i, selectOptionIconHtml as a, setActionBusy as o, wireSelectField as s } from "/js/ui-components.js";
+import { LOC as c, fmtDur as l, fmtSize as u } from "/js/core.js";
//#region node_modules/preact/dist/preact.module.js
-var l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, w = {}, T = [], E = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, D = Array.isArray;
-function O(e, t) {
+var d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E = {}, D = [], O = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, k = Array.isArray;
+function A(e, t) {
for (var n in t) e[n] = t[n];
return e;
}
-function k(e) {
+function ee(e) {
e && e.parentNode && e.parentNode.removeChild(e);
}
-function A(e, t, n) {
+function te(e, t, n) {
var r, i, a, o = {};
for (a in t) a == "key" ? r = t[a] : a == "ref" ? i = t[a] : o[a] = t[a];
- if (arguments.length > 2 && (o.children = arguments.length > 3 ? l.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (a in e.defaultProps) o[a] === void 0 && (o[a] = e.defaultProps[a]);
+ if (arguments.length > 2 && (o.children = arguments.length > 3 ? d.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (a in e.defaultProps) o[a] === void 0 && (o[a] = e.defaultProps[a]);
return j(e, o, r, i, null);
}
function j(e, t, n, r, i) {
@@ -27,11 +27,11 @@ function j(e, t, n, r, i) {
__e: null,
__c: null,
constructor: void 0,
- __v: i ?? ++d,
+ __v: i ?? ++p,
__i: -1,
__u: 0
};
- return i == null && u.vnode != null && u.vnode(a), a;
+ return i == null && f.vnode != null && f.vnode(a), a;
}
function M(e) {
return e.children;
@@ -44,42 +44,42 @@ function P(e, t) {
for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
return typeof e.type == "function" ? P(e) : null;
}
-function ee(e) {
+function ne(e) {
if (e.__P && e.__d) {
- var t = e.__v, n = t.__e, r = [], i = [], a = O({}, t);
- a.__v = t.__v + 1, u.vnode && u.vnode(a), de(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? P(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, pe(r, a, i), t.__e = t.__ = null, a.__e != n && te(a);
+ var t = e.__v, n = t.__e, r = [], i = [], a = A({}, t);
+ a.__v = t.__v + 1, f.vnode && f.vnode(a), pe(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? P(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, he(r, a, i), t.__e = t.__ = null, a.__e != n && re(a);
}
}
-function te(e) {
+function re(e) {
if ((e = e.__) != null && e.__c != null) return e.__e = e.__c.base = null, e.__k.some(function(t) {
if (t != null && t.__e != null) return e.__e = e.__c.base = t.__e;
- }), te(e);
+ }), re(e);
}
-function ne(e) {
- (!e.__d && (e.__d = !0) && p.push(e) && !re.__r++ || m != u.debounceRendering) && ((m = u.debounceRendering) || h)(re);
+function ie(e) {
+ (!e.__d && (e.__d = !0) && h.push(e) && !ae.__r++ || g != f.debounceRendering) && ((g = f.debounceRendering) || _)(ae);
}
-function re() {
+function ae() {
try {
- for (var e, t = 1; p.length;) p.length > t && p.sort(g), e = p.shift(), t = p.length, ee(e);
+ for (var e, t = 1; h.length;) h.length > t && h.sort(v), e = h.shift(), t = h.length, ne(e);
} finally {
- p.length = re.__r = 0;
+ h.length = ae.__r = 0;
}
}
-function ie(e, t, n, r, i, a, o, s, c, l, u) {
- var d, f, p, m, h, g, _ = r && r.__k || T, v = t.length;
- for (c = ae(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || w, p.__i = d, g = de(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && ge(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = oe(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
+function oe(e, t, n, r, i, a, o, s, c, l, u) {
+ var d, f, p, m, h, g, _ = r && r.__k || D, v = t.length;
+ for (c = se(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || E, p.__i = d, g = pe(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && ve(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = ce(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
return n.__e = h, c;
}
-function ae(e, t, n, r, i) {
+function se(e, t, n, r, i) {
var a, o, s, c, l, u = n.length, d = u, f = 0;
- for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = j(null, o, null, null, null) : D(o) ? o = e.__k[a] = j(M, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = j(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = se(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
- if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = P(s)), _e(s, s));
+ for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = j(null, o, null, null, null) : k(o) ? o = e.__k[a] = j(M, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = j(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = le(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
+ if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = P(s)), ye(s, s));
return r;
}
-function oe(e, t, n) {
+function ce(e, t, n) {
var r, i;
if (typeof e.type == "function") {
- for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = oe(r[i], t, n));
+ for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = ce(r[i], t, n));
return t;
}
e.__e != t && (t && e.type && !t.parentNode && (t = P(e)), t = n.insertBefore(e.__e, t || null));
@@ -88,7 +88,7 @@ function oe(e, t, n) {
while (t != null && t.nodeType == 8);
return t;
}
-function se(e, t, n, r) {
+function le(e, t, n, r) {
var i, a, o, s = e.key, c = e.type, l = t[n], u = l != null && !(2 & l.__u);
if (l === null && s == null || u && s == l.key && c == l.type) return n;
if (r > +!!u) {
@@ -96,18 +96,18 @@ function se(e, t, n, r) {
}
return -1;
}
-function ce(e, t, n) {
- t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || E.test(t) ? n : n + "px";
+function ue(e, t, n) {
+ t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || O.test(t) ? n : n + "px";
}
-function le(e, t, n, r, i) {
+function de(e, t, n, r, i) {
var a, o;
n: if (t == "style") {
if (typeof n == "string") e.style.cssText = n;
else {
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || ce(e.style, t, "");
- if (n) for (t in n) r && n[t] == r[t] || ce(e.style, t, n[t]);
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || ue(e.style, t, "");
+ if (n) for (t in n) r && n[t] == r[t] || ue(e.style, t, n[t]);
}
- } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(b, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[y] = r[y] : (n[y] = x, e.addEventListener(t, a ? C : S, a)) : e.removeEventListener(t, a ? C : S, a);
+ } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(S, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[x] = r[x] : (n[x] = C, e.addEventListener(t, a ? T : w, a)) : e.removeEventListener(t, a ? T : w, a);
else {
if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {
@@ -117,149 +117,149 @@ function le(e, t, n, r, i) {
typeof n == "function" || (n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
}
}
-function ue(e) {
+function fe(e) {
return function(t) {
if (this.l) {
var n = this.l[t.type + e];
- if (t[v] == null) t[v] = x++;
- else if (t[v] < n[y]) return;
- return n(u.event ? u.event(t) : t);
+ if (t[b] == null) t[b] = C++;
+ else if (t[b] < n[x]) return;
+ return n(f.event ? f.event(t) : t);
}
};
}
-function de(e, t, n, r, i, a, o, s, c, l) {
- var d, f, p, m, h, g, _, v, y, b, x, S, C, w, E, A, j = t.type;
+function pe(e, t, n, r, i, a, o, s, c, l) {
+ var u, d, p, m, h, g, _, v, y, b, x, S, C, w, T, E, O = t.type;
if (t.constructor !== void 0) return null;
- 128 & n.__u && (c = !!(32 & n.__u), a = [s = t.__e = n.__e]), (d = u.__b) && d(t);
- n: if (typeof j == "function") {
- f = o.length;
+ 128 & n.__u && (c = !!(32 & n.__u), a = [s = t.__e = n.__e]), (u = f.__b) && u(t);
+ n: if (typeof O == "function") {
+ d = o.length;
try {
- if (y = t.props, b = j.prototype && j.prototype.render, x = (d = j.contextType) && r[d.__c], S = d ? x ? x.props.value : d.__ : r, n.__c ? v = (p = t.__c = n.__c).__ = p.__E : (b ? t.__c = p = new j(y, S) : (t.__c = p = new N(y, S), p.constructor = j, p.render = ve), x && x.sub(p), p.state || (p.state = {}), p.__n = r, m = p.__d = !0, p.__h = [], p._sb = []), b && p.__s == null && (p.__s = p.state), b && j.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = O({}, p.__s)), O(p.__s, j.getDerivedStateFromProps(y, p.__s))), h = p.props, g = p.state, p.__v = t, m) b && j.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), b && p.componentDidMount != null && p.__h.push(p.componentDidMount);
+ if (y = t.props, b = O.prototype && O.prototype.render, x = (u = O.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? v = (p = t.__c = n.__c).__ = p.__E : (b ? t.__c = p = new O(y, S) : (t.__c = p = new N(y, S), p.constructor = O, p.render = be), x && x.sub(p), p.state || (p.state = {}), p.__n = r, m = p.__d = !0, p.__h = [], p._sb = []), b && p.__s == null && (p.__s = p.state), b && O.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = A({}, p.__s)), A(p.__s, O.getDerivedStateFromProps(y, p.__s))), h = p.props, g = p.state, p.__v = t, m) b && O.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), b && p.componentDidMount != null && p.__h.push(p.componentDidMount);
else {
- if (b && j.getDerivedStateFromProps == null && y !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(y, S), t.__v == n.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(y, p.__s, S)) {
+ if (b && O.getDerivedStateFromProps == null && y !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(y, S), t.__v == n.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(y, p.__s, S)) {
t.__v != n.__v && (p.props = y, p.state = p.__s, p.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
e && (e.__ = t);
- }), T.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && o.push(p), s = P(n);
+ }), D.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && o.push(p), s = P(n);
break n;
}
p.componentWillUpdate != null && p.componentWillUpdate(y, p.__s, S), b && p.componentDidUpdate != null && p.__h.push(function() {
p.componentDidUpdate(h, g, _);
});
}
- if (p.context = S, p.props = y, p.__P = e, p.__e = !1, C = u.__r, w = 0, b) p.state = p.__s, p.__d = !1, C && C(t), d = p.render(p.props, p.state, p.context), T.push.apply(p.__h, p._sb), p._sb = [];
+ if (p.context = S, p.props = y, p.__P = e, p.__e = !1, C = f.__r, w = 0, b) p.state = p.__s, p.__d = !1, C && C(t), u = p.render(p.props, p.state, p.context), D.push.apply(p.__h, p._sb), p._sb = [];
else do
- p.__d = !1, C && C(t), d = p.render(p.props, p.state, p.context), p.state = p.__s;
+ p.__d = !1, C && C(t), u = p.render(p.props, p.state, p.context), p.state = p.__s;
while (p.__d && ++w < 25);
- p.state = p.__s, p.getChildContext != null && (r = O(O({}, r), p.getChildContext())), b && !m && p.getSnapshotBeforeUpdate != null && (_ = p.getSnapshotBeforeUpdate(h, g)), E = d != null && d.type === M && d.key == null ? me(d.props.children) : d, s = ie(e, D(E) ? E : [E], t, n, r, i, a, o, s, c, l), p.base = t.__e, t.__u &= -161, p.__h.length && o.push(p), v && (p.__E = p.__ = null);
+ p.state = p.__s, p.getChildContext != null && (r = A(A({}, r), p.getChildContext())), b && !m && p.getSnapshotBeforeUpdate != null && (_ = p.getSnapshotBeforeUpdate(h, g)), T = u != null && u.type === M && u.key == null ? ge(u.props.children) : u, s = oe(e, k(T) ? T : [T], t, n, r, i, a, o, s, c, l), p.base = t.__e, t.__u &= -161, p.__h.length && o.push(p), v && (p.__E = p.__ = null);
} catch (e) {
- if (o.length = f, t.__v = null, c || a != null) {
+ if (o.length = d, t.__v = null, c || a != null) {
if (e.then) {
for (t.__u |= c ? 160 : 128; s && s.nodeType == 8 && s.nextSibling;) s = s.nextSibling;
a != null && (a[a.indexOf(s)] = null), t.__e = s;
- } else if (a != null) for (A = a.length; A--;) k(a[A]);
+ } else if (a != null) for (E = a.length; E--;) ee(a[E]);
} else t.__e = n.__e;
- t.__k ??= n.__k || [], e.then || fe(t), u.__e(e, t, n);
+ t.__k ??= n.__k || [], e.then || me(t), f.__e(e, t, n);
}
- } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = he(n.__e, t, n, r, i, a, o, c, l);
- return (d = u.diffed) && d(t), 128 & t.__u ? void 0 : s;
+ } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = _e(n.__e, t, n, r, i, a, o, c, l);
+ return (u = f.diffed) && u(t), 128 & t.__u ? void 0 : s;
}
-function fe(e) {
- e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(fe));
+function me(e) {
+ e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(me));
}
-function pe(e, t, n) {
- for (var r = 0; r < n.length; r++) ge(n[r], n[++r], n[++r]);
- u.__c && u.__c(t, e), e.some(function(t) {
+function he(e, t, n) {
+ for (var r = 0; r < n.length; r++) ve(n[r], n[++r], n[++r]);
+ f.__c && f.__c(t, e), e.some(function(t) {
try {
e = t.__h, t.__h = [], e.some(function(e) {
e.call(t);
});
} catch (e) {
- u.__e(e, t.__v);
+ f.__e(e, t.__v);
}
});
}
-function me(e) {
- return typeof e != "object" || !e || e.__b > 0 ? e : D(e) ? e.map(me) : e.constructor === void 0 ? O({}, e) : null;
+function ge(e) {
+ return typeof e != "object" || !e || e.__b > 0 ? e : k(e) ? e.map(ge) : e.constructor === void 0 ? A({}, e) : null;
}
-function he(e, t, n, r, i, a, o, s, c) {
- var d, f, p, m, h, g, _, v = n.props || w, y = t.props, b = t.type;
+function _e(e, t, n, r, i, a, o, s, c) {
+ var l, u, p, m, h, g, _, v = n.props || E, y = t.props, b = t.type;
if (b == "svg" ? i = "http://www.w3.org/2000/svg" : b == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i ||= "http://www.w3.org/1999/xhtml", a != null) {
- for (d = 0; d < a.length; d++) if ((h = a[d]) && "setAttribute" in h == !!b && (b ? h.localName == b : h.nodeType == 3)) {
- e = h, a[d] = null;
+ for (l = 0; l < a.length; l++) if ((h = a[l]) && "setAttribute" in h == !!b && (b ? h.localName == b : h.nodeType == 3)) {
+ e = h, a[l] = null;
break;
}
}
if (e == null) {
if (b == null) return document.createTextNode(y);
- e = document.createElementNS(i, b, y.is && y), s &&= (u.__m && u.__m(t, a), !1), a = null;
+ e = document.createElementNS(i, b, y.is && y), s &&= (f.__m && f.__m(t, a), !1), a = null;
}
if (b == null) v === y || s && e.data == y || (e.data = y);
else {
- if (a = b == "textarea" && y.defaultValue != null ? null : a && l.call(e.childNodes), !s && a != null) for (v = {}, d = 0; d < e.attributes.length; d++) v[(h = e.attributes[d]).name] = h.value;
- for (d in v) h = v[d], d == "dangerouslySetInnerHTML" ? p = h : d == "children" || d in y || d == "value" && "defaultValue" in y || d == "checked" && "defaultChecked" in y || le(e, d, null, h, i);
- for (d in y) h = y[d], d == "children" ? m = h : d == "dangerouslySetInnerHTML" ? f = h : d == "value" ? g = h : d == "checked" ? _ = h : s && typeof h != "function" || v[d] === h || le(e, d, h, v[d], i);
- if (f) s || p && (f.__html == p.__html || f.__html == e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];
- else if (p && (e.innerHTML = ""), ie(t.type == "template" ? e.content : e, D(m) ? m : [m], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && P(n, 0), s, c), a != null) for (d = a.length; d--;) k(a[d]);
- s && b != "textarea" || (d = "value", b == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[d] || b == "progress" && !g || b == "option" && g != v[d]) && le(e, d, g, v[d], i), d = "checked", _ != null && _ != e[d] && le(e, d, _, v[d], i));
+ if (a = b == "textarea" && y.defaultValue != null ? null : a && d.call(e.childNodes), !s && a != null) for (v = {}, l = 0; l < e.attributes.length; l++) v[(h = e.attributes[l]).name] = h.value;
+ for (l in v) h = v[l], l == "dangerouslySetInnerHTML" ? p = h : l == "children" || l in y || l == "value" && "defaultValue" in y || l == "checked" && "defaultChecked" in y || de(e, l, null, h, i);
+ for (l in y) h = y[l], l == "children" ? m = h : l == "dangerouslySetInnerHTML" ? u = h : l == "value" ? g = h : l == "checked" ? _ = h : s && typeof h != "function" || v[l] === h || de(e, l, h, v[l], i);
+ if (u) s || p && (u.__html == p.__html || u.__html == e.innerHTML) || (e.innerHTML = u.__html), t.__k = [];
+ else if (p && (e.innerHTML = ""), oe(t.type == "template" ? e.content : e, k(m) ? m : [m], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && P(n, 0), s, c), a != null) for (l = a.length; l--;) ee(a[l]);
+ s && b != "textarea" || (l = "value", b == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[l] || b == "progress" && !g || b == "option" && g != v[l]) && de(e, l, g, v[l], i), l = "checked", _ != null && _ != e[l] && de(e, l, _, v[l], i));
}
return e;
}
-function ge(e, t, n) {
+function ve(e, t, n) {
try {
if (typeof e == "function") {
var r = typeof e.__u == "function";
r && e.__u(), r && t == null || (e.__u = e(t));
} else e.current = t;
} catch (e) {
- u.__e(e, n);
+ f.__e(e, n);
}
}
-function _e(e, t, n) {
+function ye(e, t, n) {
var r, i;
- if (u.unmount && u.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || ge(r, null, t)), (r = e.__c) != null) {
+ if (f.unmount && f.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || ve(r, null, t)), (r = e.__c) != null) {
if (r.componentWillUnmount) try {
r.componentWillUnmount();
} catch (e) {
- u.__e(e, t);
+ f.__e(e, t);
}
r.base = r.__P = r.__n = null;
}
- if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && _e(r[i], t, n || typeof e.type != "function");
- n || k(e.__e), e.__c = e.__ = e.__e = void 0;
+ if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && ye(r[i], t, n || typeof e.type != "function");
+ n || ee(e.__e), e.__c = e.__ = e.__e = void 0;
}
-function ve(e, t, n) {
+function be(e, t, n) {
return this.constructor(e, n);
}
-function ye(e, t, n) {
+function xe(e, t, n) {
var r, i, a, o;
- t == document && (t = document.documentElement), u.__ && u.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], de(t, e = (!r && n || t).__k = A(M, null, [e]), i || w, w, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? l.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), pe(a, e, o), e.props.children = null;
+ t == document && (t = document.documentElement), f.__ && f.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], pe(t, e = (!r && n || t).__k = te(M, null, [e]), i || E, E, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? d.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), he(a, e, o), e.props.children = null;
}
-l = T.slice, u = { __e: function(e, t, n, r) {
+d = D.slice, f = { __e: function(e, t, n, r) {
for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {
if ((a = i.constructor) && a.getDerivedStateFromError != null && (i.setState(a.getDerivedStateFromError(e)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(e, r || {}), o = i.__d), o) return i.__E = i;
} catch (t) {
e = t;
}
throw e;
-} }, d = 0, f = function(e) {
+} }, p = 0, m = function(e) {
return e != null && e.constructor === void 0;
}, N.prototype.setState = function(e, t) {
- var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = O({}, this.state);
- typeof e == "function" && (e = e(O({}, n), this.props)), e && O(n, e), e != null && this.__v && (t && this._sb.push(t), ne(this));
+ var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = A({}, this.state);
+ typeof e == "function" && (e = e(A({}, n), this.props)), e && A(n, e), e != null && this.__v && (t && this._sb.push(t), ie(this));
}, N.prototype.forceUpdate = function(e) {
- this.__v && (this.__e = !0, e && this.__h.push(e), ne(this));
-}, N.prototype.render = M, p = [], h = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, g = function(e, t) {
+ this.__v && (this.__e = !0, e && this.__h.push(e), ie(this));
+}, N.prototype.render = M, h = [], _ = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, v = function(e, t) {
return e.__v.__b - t.__v.__b;
-}, re.__r = 0, _ = Math.random().toString(8), v = "__d" + _, y = "__a" + _, b = /(PointerCapture)$|Capture$/i, x = 0, S = ue(!1), C = ue(!0);
+}, ae.__r = 0, y = Math.random().toString(8), b = "__d" + y, x = "__a" + y, S = /(PointerCapture)$|Capture$/i, C = 0, w = fe(!1), T = fe(!0);
//#endregion
//#region src/api.ts
-var be = class extends Error {
+var Se = class extends Error {
status;
body;
constructor(e, t, n = null) {
super(e), this.name = "ApiError", this.status = t, this.body = n;
}
-}, xe = (e) => {
+}, Ce = (e) => {
if (!e || typeof e != "object") return "";
let t = e;
for (let e of [
@@ -281,10 +281,10 @@ async function I(e, t) {
try {
r = await n.json();
} catch {}
- if (!n.ok) throw new be(xe(r) || `请求失败(${n.status})`, n.status);
+ if (!n.ok) throw new Se(Ce(r) || `请求失败(${n.status})`, n.status);
return r;
}
-async function L(e, t, n = "POST", r) {
+async function we(e, t, n = "POST", r) {
let i = await fetch(e, {
method: n,
...r ? { signal: r } : {},
@@ -298,29 +298,29 @@ async function L(e, t, n = "POST", r) {
try {
a = await i.json();
} catch {}
- if (!i.ok) throw new be(xe(a) || `请求失败(${i.status})`, i.status, a);
+ if (!i.ok) throw new Se(Ce(a) || `请求失败(${i.status})`, i.status, a);
return a;
}
//#endregion
//#region node_modules/preact/hooks/dist/hooks.module.js
-var R, z, Se, Ce, we = 0, Te = [], B = u, Ee = B.__b, De = B.__r, Oe = B.diffed, ke = B.__c, Ae = B.unmount, je = B.__;
-function Me(e, t) {
- B.__h && B.__h(z, e, we || t), we = 0;
- var n = z.__H || (z.__H = {
+var L, R, Te, Ee, De = 0, Oe = [], z = f, ke = z.__b, Ae = z.__r, je = z.diffed, Me = z.__c, Ne = z.unmount, Pe = z.__;
+function Fe(e, t) {
+ z.__h && z.__h(R, e, De || t), De = 0;
+ var n = R.__H || (R.__H = {
__: [],
__h: []
});
return e >= n.__.length && n.__.push({}), n.__[e];
}
-function V(e) {
- return we = 1, Ne(He, e);
+function B(e) {
+ return De = 1, Ie(Ge, e);
}
-function Ne(e, t, n) {
- var r = Me(R++, 2);
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : He(void 0, t), function(e) {
+function Ie(e, t, n) {
+ var r = Fe(L++, 2);
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Ge(void 0, t), function(e) {
var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
- }], r.__c = z, !z.__f)) {
+ }], r.__c = R, !R.__f)) {
var i = function(e, t, n) {
if (!r.__c.__H) return !0;
var i = !1, o = r.__c.props !== e;
@@ -336,112 +336,112 @@ function Ne(e, t, n) {
}
return !i || o;
};
- z.__f = !0;
- var a = z.shouldComponentUpdate, o = z.componentWillUpdate;
- z.componentWillUpdate = function(e, t, n) {
+ R.__f = !0;
+ var a = R.shouldComponentUpdate, o = R.componentWillUpdate;
+ R.componentWillUpdate = function(e, t, n) {
if (this.__e) {
var r = a;
a = void 0, i(e, t, n), a = r;
}
o && o.call(this, e, t, n);
- }, z.shouldComponentUpdate = i;
+ }, R.shouldComponentUpdate = i;
}
return r.__N || r.__;
}
-function Pe(e, t) {
- var n = Me(R++, 3);
- !B.__s && Ve(n.__H, t) && (n.__ = e, n.u = t, z.__H.__h.push(n));
+function Le(e, t) {
+ var n = Fe(L++, 3);
+ !z.__s && We(n.__H, t) && (n.__ = e, n.u = t, R.__H.__h.push(n));
}
-function H(e, t) {
- var n = Me(R++, 4);
- !B.__s && Ve(n.__H, t) && (n.__ = e, n.u = t, z.__h.push(n));
+function V(e, t) {
+ var n = Fe(L++, 4);
+ !z.__s && We(n.__H, t) && (n.__ = e, n.u = t, R.__h.push(n));
}
-function U(e) {
- return we = 5, Fe(function() {
+function H(e) {
+ return De = 5, Re(function() {
return { current: e };
}, []);
}
-function Fe(e, t) {
- var n = Me(R++, 7);
- return Ve(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
+function Re(e, t) {
+ var n = Fe(L++, 7);
+ return We(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
}
-function Ie() {
- for (var e; e = Te.shift();) {
+function ze() {
+ for (var e; e = Oe.shift();) {
var t = e.__H;
if (e.__P && t) try {
- t.__h.some(ze), t.__h.some(Be), t.__h = [];
+ t.__h.some(He), t.__h.some(Ue), t.__h = [];
} catch (n) {
- t.__h = [], B.__e(n, e.__v);
+ t.__h = [], z.__e(n, e.__v);
}
}
}
-B.__b = function(e) {
- z = null, Ee && Ee(e);
-}, B.__ = function(e, t) {
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), je && je(e, t);
-}, B.__r = function(e) {
- De && De(e), R = 0;
- var t = (z = e.__c).__H;
- t && (Se === z ? (t.__h = [], z.__h = [], t.__.some(function(e) {
+z.__b = function(e) {
+ R = null, ke && ke(e);
+}, z.__ = function(e, t) {
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Pe && Pe(e, t);
+}, z.__r = function(e) {
+ Ae && Ae(e), L = 0;
+ var t = (R = e.__c).__H;
+ t && (Te === R ? (t.__h = [], R.__h = [], t.__.some(function(e) {
e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
- })) : (t.__h.some(ze), t.__h.some(Be), t.__h = [], R = 0)), Se = z;
-}, B.diffed = function(e) {
- Oe && Oe(e);
+ })) : (t.__h.some(He), t.__h.some(Ue), t.__h = [], L = 0)), Te = R;
+}, z.diffed = function(e) {
+ je && je(e);
var t = e.__c;
- t && t.__H && (t.__H.__h.length && (Te.push(t) !== 1 && Ce === B.requestAnimationFrame || ((Ce = B.requestAnimationFrame) || Re)(Ie)), t.__H.__.some(function(e) {
+ t && t.__H && (t.__H.__h.length && (Oe.push(t) !== 1 && Ee === z.requestAnimationFrame || ((Ee = z.requestAnimationFrame) || Ve)(ze)), t.__H.__.some(function(e) {
e.u &&= (e.__H = e.u, void 0);
- })), Se = z = null;
-}, B.__c = function(e, t) {
+ })), Te = R = null;
+}, z.__c = function(e, t) {
t.some(function(e) {
try {
- e.__h.some(ze), e.__h = e.__h.filter(function(e) {
- return !e.__ || Be(e);
+ e.__h.some(He), e.__h = e.__h.filter(function(e) {
+ return !e.__ || Ue(e);
});
} catch (n) {
t.some(function(e) {
e.__h &&= [];
- }), t = [], B.__e(n, e.__v);
+ }), t = [], z.__e(n, e.__v);
}
- }), ke && ke(e, t);
-}, B.unmount = function(e) {
- Ae && Ae(e);
+ }), Me && Me(e, t);
+}, z.unmount = function(e) {
+ Ne && Ne(e);
var t, n = e.__c;
n && n.__H && (n.__H.__.some(function(e) {
try {
- ze(e);
+ He(e);
} catch (e) {
t = e;
}
- }), n.__H = void 0, t && B.__e(t, n.__v));
+ }), n.__H = void 0, t && z.__e(t, n.__v));
};
-var Le = typeof requestAnimationFrame == "function";
-function Re(e) {
+var Be = typeof requestAnimationFrame == "function";
+function Ve(e) {
var t, n = function() {
- clearTimeout(r), Le && cancelAnimationFrame(t), setTimeout(e);
+ clearTimeout(r), Be && cancelAnimationFrame(t), setTimeout(e);
}, r = setTimeout(n, 35);
- Le && (t = requestAnimationFrame(n));
+ Be && (t = requestAnimationFrame(n));
}
-function ze(e) {
- var t = z, n = e.__c;
- typeof n == "function" && (e.__c = void 0, n()), z = t;
+function He(e) {
+ var t = R, n = e.__c;
+ typeof n == "function" && (e.__c = void 0, n()), R = t;
}
-function Be(e) {
- var t = z;
- e.__c = e.__(), z = t;
+function Ue(e) {
+ var t = R;
+ e.__c = e.__(), R = t;
}
-function Ve(e, t) {
+function We(e, t) {
return !e || e.length !== t.length || t.some(function(t, n) {
return t !== e[n];
});
}
-function He(e, t) {
+function Ge(e, t) {
return typeof t == "function" ? t(e) : t;
}
//#endregion
//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
-var Ue = 0;
+var Ke = 0;
Array.isArray;
-function W(e, t, n, r, i, a) {
+function U(e, t, n, r, i, a) {
t ||= {};
var o, s, c = t;
if ("ref" in c) for (s in c = {}, t) s == "ref" ? o = t[s] : c[s] = t[s];
@@ -456,177 +456,184 @@ function W(e, t, n, r, i, a) {
__e: null,
__c: null,
constructor: void 0,
- __v: --Ue,
+ __v: --Ke,
__i: -1,
__u: 0,
__source: i,
__self: a
};
if (typeof e == "function" && (o = e.defaultProps)) for (s in o) c[s] === void 0 && (c[s] = o[s]);
- return u.vnode && u.vnode(l), l;
+ return f.vnode && f.vnode(l), l;
}
//#endregion
//#region src/islands/configuration.tsx
-var We = "/api/configuration", Ge = "/api/pick-folder", Ke = 8e3, qe = (e, t) => I(We, t), G = ({ html: e, class: t }) => /* @__PURE__ */ W("div", {
+var qe = "/api/configuration", Je = "/api/pick-folder", Ye = 8e3, Xe = (e, t) => I(qe, t), W = ({ html: e, class: t }) => /* @__PURE__ */ U("div", {
class: t,
dangerouslySetInnerHTML: { __html: e }
-}), Je = (e) => !(e instanceof be) || e.status !== 400 ? null : e.body?.errors ?? null;
-function Ye({ facts: e }) {
- return /* @__PURE__ */ W("section", {
+}), Ze = (e) => !(e instanceof Se) || e.status !== 400 ? null : e.body?.errors ?? null;
+function Qe({ facts: e }) {
+ return /* @__PURE__ */ U("section", {
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "configFactsTitle",
- children: /* @__PURE__ */ W("div", {
+ children: /* @__PURE__ */ U("div", {
class: "geist-fieldset-content",
- children: [/* @__PURE__ */ W(G, { html: t("configFactsTitle", "运行信息") }), /* @__PURE__ */ W("dl", {
+ children: [/* @__PURE__ */ U(W, { html: n("configFactsTitle", "运行信息") }), /* @__PURE__ */ U("dl", {
class: "configfacts",
- children: e.map((e) => /* @__PURE__ */ W(M, { children: [/* @__PURE__ */ W("dt", { children: e.term }), /* @__PURE__ */ W("dd", { children: e.value })] }))
+ children: e.map((e) => /* @__PURE__ */ U(M, { children: [/* @__PURE__ */ U("dt", { children: e.term }), /* @__PURE__ */ U("dd", { children: e.value })] }))
})]
})
});
}
-function Xe({ data: e }) {
- let [n, r] = V(e.media_sources), [a, o] = V(""), s = U(null);
- Pe(() => () => s.current?.abort(), []);
- let c = async (e) => {
- if (s.current) return;
+function $e({ data: t }) {
+ let [r, i] = B(t.media_sources), [s, c] = B(""), l = H(null);
+ Le(() => () => l.current?.abort(), []);
+ let u = async (e) => {
+ if (l.current) return;
let t = new AbortController();
- s.current = t, i(e, !0), o("");
+ l.current = t, o(e, !0), c("");
try {
- let e = await I(We, t.signal);
- t.signal.aborted || r(e.media_sources);
+ let e = await I(qe, t.signal);
+ t.signal.aborted || i(e.media_sources);
} catch (e) {
- t.signal.aborted || o(F(e));
+ t.signal.aborted || c(F(e));
} finally {
- s.current = null, i(e, !1);
+ l.current = null, o(e, !1);
}
};
- return n ? /* @__PURE__ */ W("section", {
+ return r ? /* @__PURE__ */ U("section", {
class: "configfieldset",
"aria-labelledby": "configMountsTitle",
- children: /* @__PURE__ */ W("div", {
+ children: /* @__PURE__ */ U("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ W(G, { html: t("configMountsTitle", "挂载状态") }),
- /* @__PURE__ */ W("dl", {
+ /* @__PURE__ */ U(W, { html: n("configMountsTitle", "挂载状态") }),
+ /* @__PURE__ */ U("dl", {
class: "configfacts",
- children: n.map((e) => /* @__PURE__ */ W(M, { children: [/* @__PURE__ */ W("dt", { children: {
+ children: r.map((t) => /* @__PURE__ */ U(M, { children: [/* @__PURE__ */ U("dt", { children: [/* @__PURE__ */ U("span", {
+ "aria-hidden": "true",
+ dangerouslySetInnerHTML: { __html: a(e[t.location]) }
+ }), {
local: "本地磁盘",
115: "CloudDrive · 115",
pikpak: "CloudDrive · PikPak"
- }[e.location] || e.location }), /* @__PURE__ */ W("dd", { children: [
- e.path || "未配置挂载点",
+ }[t.location] || t.location] }), /* @__PURE__ */ U("dd", { children: [
+ t.path || "未配置挂载点",
" ",
- /* @__PURE__ */ W("span", {
- class: `configstatus ${e.online === !0 ? "online" : e.online === !1 ? "offline" : "unknown"}`,
- children: e.online === !0 ? "在线" : e.online === !1 ? "离线" : "未检测"
+ /* @__PURE__ */ U("span", {
+ class: `configstatus ${t.online === !0 ? "online" : t.online === !1 ? "offline" : "unknown"}`,
+ children: t.online === !0 ? "在线" : t.online === !1 ? "离线" : "未检测"
})
] })] }))
}),
- a ? /* @__PURE__ */ W("p", {
+ s ? /* @__PURE__ */ U("p", {
class: "configbad",
role: "alert",
- children: a
+ children: s
}) : null,
- /* @__PURE__ */ W("button", {
+ /* @__PURE__ */ U("button", {
type: "button",
class: "geist-button",
- onClick: (e) => c(e.currentTarget),
+ onClick: (e) => u(e.currentTarget),
children: "刷新挂载状态"
})
]
})
}) : null;
}
-function Ze({ value: e, label: t, onChange: n }) {
- let i = U(null), o = U(null), s = U(n);
- return s.current = n, H(() => {
- let n = i.current;
- n.innerHTML = r([
+function et({ value: t, label: n, onChange: r }) {
+ let a = H(null), o = H(null), c = H(r);
+ return c.current = r, V(() => {
+ let r = a.current;
+ r.innerHTML = i([
["local", "本地磁盘"],
["115", "CloudDrive · 115"],
["pikpak", "CloudDrive · PikPak"]
- ], e, { label: t });
- let c = a(n.firstElementChild);
- o.current = c;
- let l = () => s.current(c.value);
- return c.addEventListener("change", l), () => {
- o.current = null, c.disabled = !0, c.removeEventListener("change", l), n.replaceChildren();
+ ].map(([t, n]) => [
+ t,
+ n,
+ e[t]
+ ]), t, { label: n });
+ let l = s(r.firstElementChild);
+ o.current = l;
+ let u = () => c.current(l.value);
+ return l.addEventListener("change", u), () => {
+ o.current = null, l.disabled = !0, l.removeEventListener("change", u), r.replaceChildren();
};
- }, [t]), H(() => {
- o.current && (o.current.value = e);
- }, [e]), /* @__PURE__ */ W("div", {
- ref: i,
+ }, [n]), V(() => {
+ o.current && (o.current.value = t);
+ }, [t]), /* @__PURE__ */ U("div", {
+ ref: a,
class: "configsourcecontrol"
});
}
-function Qe({ data: e, receipt: r }) {
- let a = e.media_sources?.filter((e) => [
+function tt({ data: e, receipt: t }) {
+ let i = e.media_sources?.filter((e) => [
"local",
"115",
"pikpak"
- ].includes(e.location)), [o, s] = V(a?.length ? a.map((e) => e.path) : e.media_dirs.length ? e.media_dirs : [""]), [c, l] = V(a?.map((e) => e.location) ?? []), [u, d] = V(a?.map((e) => e.root) ?? []), [f, p] = V(String(e.port)), [m, h] = V(!1), [g, _] = V([]), [v, y] = V(""), [b, x] = V(""), [S, C] = V(null), [w, T] = V(null), E = U(!1), D = U(e.revision), O = U([]), k = U(null);
- H(() => {
+ ].includes(e.location)), [a, s] = B(i?.length ? i.map((e) => e.path) : e.media_dirs.length ? e.media_dirs : [""]), [c, l] = B(i?.map((e) => e.location) ?? []), [u, d] = B(i?.map((e) => e.root) ?? []), [f, p] = B(String(e.port)), [m, h] = B(!1), [g, _] = B([]), [v, y] = B(""), [b, x] = B(""), [S, C] = B(null), [w, T] = B(null), E = H(!1), D = H(e.revision), O = H([]), k = H(null);
+ V(() => {
w !== null && (O.current[w]?.focus(), T(null));
- }, [w]), Pe(() => {
+ }, [w]), Le(() => {
if (!S) return;
- let e = setTimeout(() => location.assign(S.url), Ke);
+ let e = setTimeout(() => location.assign(S.url), Ye);
return () => clearTimeout(e);
}, [S]);
let A = (e, t) => {
s((n) => n.map((n, r) => r === e ? t : n));
- }, j = () => {
- T(o.length), s((e) => [...e, ""]);
- }, M = (e) => {
+ }, ee = () => {
+ T(a.length), s((e) => [...e, ""]);
+ }, te = (e) => {
l((t) => t.filter((t, n) => n !== e)), d((t) => t.filter((t, n) => n !== e)), s((t) => t.filter((t, n) => n !== e)), _((t) => t.filter((t, n) => n !== e));
- }, N = (e, t) => {
+ }, j = (e, t) => {
_((n) => {
let r = [...n];
for (; r.length <= e;) r.push("");
return r[e] = t, r;
});
- }, P = async (e, t) => {
+ }, M = async (e, t) => {
if (t.getAttribute("aria-busy") !== "true") {
- i(t, !0);
+ o(t, !0);
try {
- let { path: t } = await L(Ge, { initial: o[e] ?? "" });
- t && (A(e, t), N(e, ""));
+ let { path: t } = await we(Je, { initial: a[e] ?? "" });
+ t && (A(e, t), j(e, ""));
} catch (t) {
- N(e, F(t));
+ j(e, F(t));
} finally {
- i(t, !1);
+ o(t, !1);
}
}
};
- return S ? /* @__PURE__ */ W("div", {
+ return S ? /* @__PURE__ */ U("div", {
class: "configsaved",
role: "status",
- children: [/* @__PURE__ */ W(G, { html: n("配置已保存,Peach 正在重新启动。", {
+ children: [/* @__PURE__ */ U(W, { html: r("配置已保存,Peach 正在重新启动。", {
variant: "success",
label: "已保存"
- }) }), /* @__PURE__ */ W("p", {
+ }) }), /* @__PURE__ */ U("p", {
class: "confighelp",
children: [
"几秒后自动打开新地址;没跳转就点 ",
- /* @__PURE__ */ W("a", {
+ /* @__PURE__ */ U("a", {
href: S.url,
children: "进入馆藏"
}),
"。"
]
})]
- }) : /* @__PURE__ */ W("form", {
+ }) : /* @__PURE__ */ U("form", {
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "configTitle",
- onSubmit: async (t) => {
- if (t.preventDefault(), !E.current) {
- E.current = !0, i(k.current, !0), x("");
+ onSubmit: async (n) => {
+ if (n.preventDefault(), !E.current) {
+ E.current = !0, o(k.current, !0), x("");
try {
- let t = await L(We, {
+ let n = await we(qe, {
revision: D.current,
- media_dirs: o,
- ...e.media_sources ? { media_sources: o.map((e, t) => ({
+ media_dirs: a,
+ ...e.media_sources ? { media_sources: a.map((e, t) => ({
path: e,
location: c[t] || "local",
root: u[t] || ""
@@ -634,40 +641,40 @@ function Qe({ data: e, receipt: r }) {
port: f,
scan_now: m
});
- D.current = t.revision, _([]), y(""), r("已保存配置"), C(t);
+ D.current = n.revision, _([]), y(""), t("已保存配置"), C(n);
} catch (e) {
- let t = Je(e);
+ let t = Ze(e);
t ? (_(t.media_dirs ?? []), y(t.port ?? "")) : (_([]), y(""), x(F(e)));
} finally {
- E.current = !1, i(k.current, !1);
+ E.current = !1, o(k.current, !1);
}
}
},
noValidate: !0,
- children: [/* @__PURE__ */ W("div", {
+ children: [/* @__PURE__ */ U("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ W(G, { html: t("configTitle", "这台电脑") }),
- /* @__PURE__ */ W("div", {
+ /* @__PURE__ */ U(W, { html: n("configTitle", "这台电脑") }),
+ /* @__PURE__ */ U("div", {
class: "configfield",
children: [
- /* @__PURE__ */ W("span", {
+ /* @__PURE__ */ U("span", {
class: "configlabel",
id: "configDirsLabel",
children: "媒体文件夹"
}),
- /* @__PURE__ */ W("div", {
+ /* @__PURE__ */ U("div", {
class: "configdirs",
role: "group",
"aria-labelledby": "configDirsLabel",
- children: o.map((t, n) => /* @__PURE__ */ W("div", {
+ children: a.map((t, n) => /* @__PURE__ */ U("div", {
class: "configdir",
children: [
- /* @__PURE__ */ W("span", {
+ /* @__PURE__ */ U("span", {
class: "configpathlabel",
children: ["本机文件夹 ", n + 1]
}),
- /* @__PURE__ */ W("input", {
+ /* @__PURE__ */ U("input", {
class: "geist-input",
type: "text",
value: t,
@@ -678,33 +685,33 @@ function Qe({ data: e, receipt: r }) {
O.current[n] = e;
}
}),
- /* @__PURE__ */ W("button", {
+ /* @__PURE__ */ U("button", {
type: "button",
class: "geist-button configpick",
"aria-label": "选择文件夹",
- onClick: (e) => P(n, e.currentTarget),
- children: /* @__PURE__ */ W("svg", {
+ onClick: (e) => M(n, e.currentTarget),
+ children: /* @__PURE__ */ U("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ W("use", { href: "#i-folder-search" })
+ children: /* @__PURE__ */ U("use", { href: "#i-folder-search" })
})
}),
- o.length > 1 ? /* @__PURE__ */ W("button", {
+ a.length > 1 ? /* @__PURE__ */ U("button", {
type: "button",
class: "geist-button configrm",
"aria-label": "移除这个文件夹",
- onClick: () => M(n),
- children: /* @__PURE__ */ W("svg", {
+ onClick: () => te(n),
+ children: /* @__PURE__ */ U("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ W("use", { href: "#i-x" })
+ children: /* @__PURE__ */ U("use", { href: "#i-x" })
})
}) : null,
- /* @__PURE__ */ W("div", {
+ /* @__PURE__ */ U("div", {
class: "configsource",
- children: [/* @__PURE__ */ W("div", {
+ children: [/* @__PURE__ */ U("div", {
class: "configsourcelabel",
- children: ["媒体来源", /* @__PURE__ */ W(Ze, {
+ children: ["媒体来源", /* @__PURE__ */ U(et, {
label: `媒体来源 ${n + 1}`,
value: c[n] || "local",
onChange: (e) => {
@@ -712,7 +719,7 @@ function Qe({ data: e, receipt: r }) {
t[n] = e, l(t);
}
})]
- }), e.windows === !1 ? /* @__PURE__ */ W("label", { children: ["Windows 中的对应路径", /* @__PURE__ */ W("input", {
+ }), e.windows === !1 ? /* @__PURE__ */ U("label", { children: ["Windows 中的对应路径", /* @__PURE__ */ U("input", {
class: "geist-input",
"aria-label": `Windows 中的对应路径 ${n + 1}`,
value: u[n] || "",
@@ -723,7 +730,7 @@ function Qe({ data: e, receipt: r }) {
}
})] }) : null]
}),
- g[n] ? /* @__PURE__ */ W("p", {
+ g[n] ? /* @__PURE__ */ U("p", {
class: "configbad",
role: "alert",
children: g[n]
@@ -731,39 +738,39 @@ function Qe({ data: e, receipt: r }) {
]
}, n))
}),
- /* @__PURE__ */ W("button", {
+ /* @__PURE__ */ U("button", {
type: "button",
class: "geist-button configadd",
- onClick: j,
+ onClick: ee,
children: "添加文件夹"
}),
- c.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ W("p", {
+ c.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ U("p", {
class: "confighelp",
- children: ["先在 CloudDrive 登录网盘并完成挂载。", /* @__PURE__ */ W("a", {
+ children: ["先在 CloudDrive 登录网盘并完成挂载。", /* @__PURE__ */ U("a", {
href: "https://www.clouddrive2.com/help.html",
target: "_blank",
rel: "noreferrer",
- children: ["挂载帮助", /* @__PURE__ */ W("svg", {
+ children: ["挂载帮助", /* @__PURE__ */ U("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ W("use", { href: "#i-external-link" })
+ children: /* @__PURE__ */ U("use", { href: "#i-external-link" })
})]
})]
}) : null,
- e.windows === !1 ? /* @__PURE__ */ W("p", {
+ e.windows === !1 ? /* @__PURE__ */ U("p", {
class: "confighelp",
children: "本机文件夹是这台电脑读取媒体的位置。Windows 中的对应路径用于匹配馆藏中已有的路径,例如 B:\\ 对应本机挂载文件夹。"
}) : null
]
}),
- /* @__PURE__ */ W("div", {
+ /* @__PURE__ */ U("div", {
class: "configfield",
children: [
- /* @__PURE__ */ W("label", {
+ /* @__PURE__ */ U("label", {
for: "configPort",
children: "本机访问端口"
}),
- /* @__PURE__ */ W("input", {
+ /* @__PURE__ */ U("input", {
id: "configPort",
class: "geist-input",
type: "text",
@@ -772,43 +779,43 @@ function Qe({ data: e, receipt: r }) {
"aria-invalid": v ? "true" : void 0,
onInput: (e) => p(e.currentTarget.value)
}),
- v ? /* @__PURE__ */ W("p", {
+ v ? /* @__PURE__ */ U("p", {
class: "configbad",
role: "alert",
children: v
}) : null,
- /* @__PURE__ */ W("p", {
+ /* @__PURE__ */ U("p", {
class: "confighelp",
children: "浏览器地址里冒号后面的数字,一般不用改。"
})
]
}),
- /* @__PURE__ */ W("label", {
+ /* @__PURE__ */ U("label", {
class: "configcheck",
- children: [/* @__PURE__ */ W("span", {
+ children: [/* @__PURE__ */ U("span", {
class: "pcheck",
- children: [/* @__PURE__ */ W("input", {
+ children: [/* @__PURE__ */ U("input", {
type: "checkbox",
checked: m,
onChange: (e) => h(e.currentTarget.checked)
- }), /* @__PURE__ */ W("span", {
+ }), /* @__PURE__ */ U("span", {
"aria-hidden": "true",
- children: /* @__PURE__ */ W("svg", {
+ children: /* @__PURE__ */ U("svg", {
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ W("use", { href: "#i-check" })
+ children: /* @__PURE__ */ U("use", { href: "#i-check" })
})
})]
- }), /* @__PURE__ */ W("span", { children: "保存后扫描媒体文件夹" })]
+ }), /* @__PURE__ */ U("span", { children: "保存后扫描媒体文件夹" })]
}),
- b ? /* @__PURE__ */ W(G, { html: n(b, {
+ b ? /* @__PURE__ */ U(W, { html: r(b, {
variant: "error",
label: "没有保存"
}) }) : null
]
- }), /* @__PURE__ */ W("div", {
+ }), /* @__PURE__ */ U("div", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: [/* @__PURE__ */ W("p", { children: "保存后 Peach 会重新启动,端口改了就用新地址打开。" }), /* @__PURE__ */ W("button", {
+ children: [/* @__PURE__ */ U("p", { children: "保存后 Peach 会重新启动,端口改了就用新地址打开。" }), /* @__PURE__ */ U("button", {
type: "submit",
class: "geist-button primary",
ref: k,
@@ -817,47 +824,47 @@ function Qe({ data: e, receipt: r }) {
})]
});
}
-function $e({ receipt: e, data: t, error: r }) {
- return r || !t ? /* @__PURE__ */ W(G, {
+function nt({ receipt: e, data: t, error: n }) {
+ return n || !t ? /* @__PURE__ */ U(W, {
class: "configpage",
- html: n(r || "没有读到配置", {
+ html: r(n || "没有读到配置", {
variant: "error",
label: "打不开配置"
})
- }) : /* @__PURE__ */ W("div", {
+ }) : /* @__PURE__ */ U("div", {
class: "configpage",
children: [
- t.editable ? /* @__PURE__ */ W(Qe, {
+ t.editable ? /* @__PURE__ */ U(tt, {
data: t,
receipt: e
- }) : /* @__PURE__ */ W(G, { html: n(t.notice, {
+ }) : /* @__PURE__ */ U(W, { html: r(t.notice, {
variant: "secondary",
label: "只读"
}) }),
- /* @__PURE__ */ W(Ye, { facts: t.facts }),
- /* @__PURE__ */ W(Xe, { data: t })
+ /* @__PURE__ */ U(Qe, { facts: t.facts }),
+ /* @__PURE__ */ U($e, { data: t })
]
});
}
//#endregion
//#region node_modules/@preact/signals-core/dist/signals-core.module.js
-var et = Symbol.for("preact-signals");
-function tt() {
- if (Y > 1) Y--;
+var rt = Symbol.for("preact-signals");
+function it() {
+ if (J > 1) J--;
else {
var e, t = !1;
for ((function() {
- var e = st;
- for (st = void 0; e !== void 0;) {
+ var e = ut;
+ for (ut = void 0; e !== void 0;) {
var t = e.S;
if (t.v === e.v) for (var n = t.t; n !== void 0; n = n.x) n.i === e.i && (n.i = t.i);
e = e.o;
}
- })(); J !== void 0;) {
- var n = J;
- for (J = void 0, it++; n !== void 0;) {
+ })(); q !== void 0;) {
+ var n = q;
+ for (q = void 0, st++; n !== void 0;) {
var r = n.u;
- if (n.u = void 0, n.f &= -3, !(8 & n.f) && dt(n)) try {
+ if (n.u = void 0, n.f &= -3, !(8 & n.f) && mt(n)) try {
n.c();
} catch (n) {
t ||= (e = n, !0);
@@ -865,116 +872,116 @@ function tt() {
n = r;
}
}
- if (it = 0, Y--, t) throw e;
+ if (st = 0, J--, t) throw e;
}
}
-function nt(e) {
- if (Y > 0) return e();
- ot = ++at, Y++;
+function at(e) {
+ if (J > 0) return e();
+ lt = ++ct, J++;
try {
return e();
} finally {
- tt();
+ it();
}
}
-var K, q = void 0;
-function rt(e) {
- var t = q, n = K;
- q = void 0, K = void 0;
+var G, K = void 0;
+function ot(e) {
+ var t = K, n = G;
+ K = void 0, G = void 0;
try {
return e();
} finally {
- q = t, K = n;
+ K = t, G = n;
}
}
-var J = void 0, Y = 0, it = 0, at = 0, ot = 0, st = void 0, ct = 0;
-function lt(e) {
- if (q !== void 0) {
+var q = void 0, J = 0, st = 0, ct = 0, lt = 0, ut = void 0, dt = 0;
+function ft(e) {
+ if (K !== void 0) {
var t = e.n;
- if (t === void 0 || t.t !== q) return t = {
+ if (t === void 0 || t.t !== K) return t = {
i: 0,
S: e,
- p: q.s,
+ p: K.s,
n: void 0,
- t: q,
+ t: K,
e: void 0,
x: void 0,
r: t
- }, q.s !== void 0 && (q.s.n = t), q.s = t, e.n = t, 32 & q.f && e.S(t), t;
- if (t.i === -1) return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = q.s, t.n = void 0, q.s.n = t, q.s = t), t;
+ }, K.s !== void 0 && (K.s.n = t), K.s = t, e.n = t, 32 & K.f && e.S(t), t;
+ if (t.i === -1) return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = K.s, t.n = void 0, K.s.n = t, K.s = t), t;
}
}
-function X(e, t) {
+function Y(e, t) {
this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
}
-X.prototype.brand = et, X.prototype.h = function() {
+Y.prototype.brand = rt, Y.prototype.h = function() {
return !0;
-}, X.prototype.S = function(e) {
+}, Y.prototype.S = function(e) {
var t = this, n = this.t;
- n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? rt(function() {
+ n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? ot(function() {
var e;
(e = t.W) == null || e.call(t);
}) : n.e = e);
-}, X.prototype.U = function(e) {
+}, Y.prototype.U = function(e) {
var t = this;
if (this.t !== void 0) {
var n = e.e, r = e.x;
- n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && rt(function() {
+ n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && ot(function() {
var e;
(e = t.Z) == null || e.call(t);
}));
}
-}, X.prototype.subscribe = function(e) {
+}, Y.prototype.subscribe = function(e) {
var t = this;
- return vt(function() {
+ return xt(function() {
var n = t.value;
- rt(function() {
+ ot(function() {
return e(n);
});
}, { name: "sub" });
-}, X.prototype.valueOf = function() {
+}, Y.prototype.valueOf = function() {
return this.value;
-}, X.prototype.toString = function() {
+}, Y.prototype.toString = function() {
return this.value + "";
-}, X.prototype.toJSON = function() {
+}, Y.prototype.toJSON = function() {
return this.value;
-}, X.prototype.peek = function() {
+}, Y.prototype.peek = function() {
var e = this;
- return rt(function() {
+ return ot(function() {
return e.value;
});
-}, Object.defineProperty(X.prototype, "value", {
+}, Object.defineProperty(Y.prototype, "value", {
get: function() {
- var e = lt(this);
+ var e = ft(this);
return e !== void 0 && (e.i = this.i), this.v;
},
set: function(e) {
if (e !== this.v) {
- if (it > 100) throw Error("Cycle detected");
+ if (st > 100) throw Error("Cycle detected");
(function(e) {
- Y !== 0 && it === 0 && e.l !== ot && (e.l = ot, st = {
+ J !== 0 && st === 0 && e.l !== lt && (e.l = lt, ut = {
S: e,
v: e.v,
i: e.i,
- o: st
+ o: ut
});
- })(this), this.v = e, this.i++, ct++, Y++;
+ })(this), this.v = e, this.i++, dt++, J++;
try {
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
} finally {
- tt();
+ it();
}
}
}
});
-function ut(e, t) {
- return new X(e, t);
+function pt(e, t) {
+ return new Y(e, t);
}
-function dt(e) {
+function mt(e) {
for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
return !1;
}
-function ft(e) {
+function ht(e) {
for (var t = e.s; t !== void 0; t = t.n) {
var n = t.S.n;
if (n !== void 0 && (t.r = n), t.S.n = t, t.i = -1, t.n === void 0) {
@@ -983,81 +990,81 @@ function ft(e) {
}
}
}
-function pt(e) {
+function gt(e) {
for (var t = e.s, n = void 0; t !== void 0;) {
var r = t.p;
t.i === -1 ? (t.S.U(t), r !== void 0 && (r.n = t.n), t.n !== void 0 && (t.n.p = r)) : n = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = r;
}
e.s = n;
}
-function Z(e, t) {
- X.call(this, void 0, t), this.x = e, this.s = void 0, this.g = ct - 1, this.f = 4;
+function X(e, t) {
+ Y.call(this, void 0, t), this.x = e, this.s = void 0, this.g = dt - 1, this.f = 4;
}
-Z.prototype = new X(), Z.prototype.h = function() {
+X.prototype = new Y(), X.prototype.h = function() {
if (this.f &= -3, 1 & this.f) return !1;
- if ((36 & this.f) == 32 || (this.f &= -5, this.g === ct)) return !0;
- if (this.g = ct, this.f |= 1, this.i > 0 && !dt(this)) return this.f &= -2, !0;
- var e = q;
+ if ((36 & this.f) == 32 || (this.f &= -5, this.g === dt)) return !0;
+ if (this.g = dt, this.f |= 1, this.i > 0 && !mt(this)) return this.f &= -2, !0;
+ var e = K;
try {
- ft(this), q = this;
+ ht(this), K = this;
var t = this.x();
(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
} catch (e) {
this.v = e, this.f |= 16, this.i++;
}
- return q = e, pt(this), this.f &= -2, !0;
-}, Z.prototype.S = function(e) {
+ return K = e, gt(this), this.f &= -2, !0;
+}, X.prototype.S = function(e) {
if (this.t === void 0) {
this.f |= 36;
for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
}
- X.prototype.S.call(this, e);
-}, Z.prototype.U = function(e) {
- if (this.t !== void 0 && (X.prototype.U.call(this, e), this.t === void 0)) {
+ Y.prototype.S.call(this, e);
+}, X.prototype.U = function(e) {
+ if (this.t !== void 0 && (Y.prototype.U.call(this, e), this.t === void 0)) {
this.f &= -33;
for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
}
-}, Z.prototype.N = function() {
+}, X.prototype.N = function() {
if (!(2 & this.f)) {
this.f |= 6;
for (var e = this.t; e !== void 0; e = e.x) e.t.N();
}
-}, Object.defineProperty(Z.prototype, "value", { get: function() {
+}, Object.defineProperty(X.prototype, "value", { get: function() {
if (1 & this.f) throw Error("Cycle detected");
- var e = lt(this);
+ var e = ft(this);
if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
return this.v;
} });
-function mt(e, t) {
- return new Z(e, t);
+function _t(e, t) {
+ return new X(e, t);
}
-function ht(e) {
+function vt(e) {
var t = e.m;
if (e.m = void 0, typeof t == "function") {
- Y++;
- var n = q;
- q = void 0;
+ J++;
+ var n = K;
+ K = void 0;
try {
t();
} catch (t) {
- throw e.f &= -2, e.f |= 8, gt(e), t;
+ throw e.f &= -2, e.f |= 8, yt(e), t;
} finally {
- q = n, tt();
+ K = n, it();
}
}
}
-function gt(e) {
+function yt(e) {
for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
- e.x = void 0, e.s = void 0, ht(e);
+ e.x = void 0, e.s = void 0, vt(e);
}
-function _t(e) {
- if (q !== this) throw Error("Out-of-order effect");
- pt(this), q = e, this.f &= -2, 8 & this.f && gt(this), tt();
+function bt(e) {
+ if (K !== this) throw Error("Out-of-order effect");
+ gt(this), K = e, this.f &= -2, 8 & this.f && yt(this), it();
}
-function Q(e, t) {
- this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, K && K.push(this);
+function Z(e, t) {
+ this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, G && G.push(this);
}
-Q.prototype.c = function() {
+Z.prototype.c = function() {
var e = this.S();
try {
if (8 & this.f || this.x === void 0) return;
@@ -1066,20 +1073,20 @@ Q.prototype.c = function() {
} finally {
e();
}
-}, Q.prototype.S = function() {
+}, Z.prototype.S = function() {
if (1 & this.f) throw Error("Cycle detected");
- this.f |= 1, this.f &= -9, ht(this), ft(this), Y++;
- var e = q;
- return q = this, _t.bind(this, e);
-}, Q.prototype.N = function() {
- 2 & this.f || (this.f |= 2, this.u = J, J = this);
-}, Q.prototype.d = function() {
- this.f |= 8, 1 & this.f || gt(this);
-}, Q.prototype.dispose = function() {
+ this.f |= 1, this.f &= -9, vt(this), ht(this), J++;
+ var e = K;
+ return K = this, bt.bind(this, e);
+}, Z.prototype.N = function() {
+ 2 & this.f || (this.f |= 2, this.u = q, q = this);
+}, Z.prototype.d = function() {
+ this.f |= 8, 1 & this.f || yt(this);
+}, Z.prototype.dispose = function() {
this.d();
};
-function vt(e, t) {
- var n = new Q(e, t);
+function xt(e, t) {
+ var n = new Z(e, t);
try {
n.c();
} catch (e) {
@@ -1090,35 +1097,35 @@ function vt(e, t) {
}
//#endregion
//#region node_modules/@preact/signals/dist/signals.module.js
-var yt, bt, xt = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, St = [];
-vt(function() {
- yt = this.N;
+var St, Ct, wt = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Tt = [];
+xt(function() {
+ St = this.N;
})();
-function $(e, t) {
- u[e] = t.bind(null, u[e] || function() {});
+function Q(e, t) {
+ f[e] = t.bind(null, f[e] || function() {});
}
-function Ct(e) {
- if (bt) {
- var t = bt;
- bt = void 0, t();
+function Et(e) {
+ if (Ct) {
+ var t = Ct;
+ Ct = void 0, t();
}
- bt = e && e.S();
+ Ct = e && e.S();
}
-function wt(e) {
- var t = this, n = e.data, r = Et(n);
+function Dt(e) {
+ var t = this, n = e.data, r = kt(n);
r.name = "ReactiveDom", r.value = n;
- var i = Fe(function() {
+ var i = Re(function() {
for (var e = t, n = t.__v; n = n.__;) if (n.__c) {
n.__c.__$f |= 4;
break;
}
- var i = mt(function() {
+ var i = _t(function() {
var e = r.value.value;
return e === 0 ? 0 : !0 === e ? "" : e || "";
- }), a = mt(function() {
- return !Array.isArray(i.value) && !f(i.value);
- }), o = vt(function() {
- if (this.N = kt, a.value) {
+ }), a = _t(function() {
+ return !Array.isArray(i.value) && !m(i.value);
+ }), o = xt(function() {
+ if (this.N = Mt, a.value) {
var t = i.value;
e.__v && e.__v.__e && e.__v.__e.nodeType === 3 && (e.__v.__e.data = t);
}
@@ -1129,14 +1136,14 @@ function wt(e) {
}, []), a = i[0], o = i[1];
return a.value ? o.peek() : o.value;
}
-wt.displayName = "ReactiveTextNode", Object.defineProperties(X.prototype, {
+Dt.displayName = "ReactiveTextNode", Object.defineProperties(Y.prototype, {
constructor: {
configurable: !0,
value: void 0
},
type: {
configurable: !0,
- value: wt
+ value: Dt
},
props: {
configurable: !0,
@@ -1151,35 +1158,35 @@ wt.displayName = "ReactiveTextNode", Object.defineProperties(X.prototype, {
configurable: !0,
value: 1
}
-}), $("__b", function(e, t) {
+}), Q("__b", function(e, t) {
if (typeof t.type == "string") {
var n, r = t.props;
for (var i in r) if (i !== "children") {
var a = r[i];
- a instanceof X && (n || (t.__np = n = {}), n[i] = a, r[i] = a.peek());
+ a instanceof Y && (n || (t.__np = n = {}), n[i] = a, r[i] = a.peek());
}
}
e(t);
-}), $("__r", function(e, t) {
+}), Q("__r", function(e, t) {
if (e(t), t.type !== M) {
- Ct();
+ Et();
var n, r = t.__c;
r && (r.__$f &= -2, (n = r.__$u) === void 0 && (r.__$u = n = function(e, t) {
var n;
- return vt(function() {
+ return xt(function() {
n = this;
}, { name: t }), n.c = e, n;
}(function(e) {
return function() {
var t;
- xt && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});
+ wt && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});
};
- }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), Ct(n);
+ }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), Et(n);
}
-}), $("__e", function(e, t, n, r) {
- Ct(), e(t, n, r);
-}), $("diffed", function(e, t) {
- Ct();
+}), Q("__e", function(e, t, n, r) {
+ Et(), e(t, n, r);
+}), Q("diffed", function(e, t) {
+ Et();
var n;
if (typeof t.type == "string" && (n = t.__e)) {
var r = t.__np, i = t.props, a = n.U;
@@ -1189,25 +1196,25 @@ wt.displayName = "ReactiveTextNode", Object.defineProperties(X.prototype, {
}
if (r) for (var c in a || (a = {}, n.U = a), r) {
var l = a[c], u = r[c];
- l === void 0 ? (l = Tt(n, c, u, i), a[c] = l) : l.o(u, i);
+ l === void 0 ? (l = Ot(n, c, u, i), a[c] = l) : l.o(u, i);
}
}
e(t);
});
-function Tt(e, t, n, r) {
- var i = t in e && e.ownerSVGElement === void 0, a = ut(n);
+function Ot(e, t, n, r) {
+ var i = t in e && e.ownerSVGElement === void 0, a = pt(n);
return {
o: function(e, t) {
a.value = e, r = t;
},
- d: vt(function() {
- this.N = kt;
+ d: xt(function() {
+ this.N = Mt;
var n = a.value.value;
r[t] !== n && (r[t] = n, i ? e[t] = n : n != null && (!1 !== n || t[4] === "-") ? e.setAttribute(t, n) : e.removeAttribute(t));
})
};
}
-$("unmount", function(e, t) {
+Q("unmount", function(e, t) {
if (typeof t.type == "string") {
var n = t.__e;
if (n) {
@@ -1231,7 +1238,7 @@ $("unmount", function(e, t) {
}
}
e(t);
-}), $("__h", function(e, t, n, r) {
+}), Q("__h", function(e, t, n, r) {
r < 3 && (t.__$f |= 2), e(t, n, r);
}), N.prototype.shouldComponentUpdate = function(e, t) {
if (this.__R) return !0;
@@ -1245,44 +1252,44 @@ $("unmount", function(e, t) {
for (var s in this.props) if (!(s in e)) return !0;
return !1;
};
-function Et(e, t) {
- return Fe(function() {
- return ut(e, t);
+function kt(e, t) {
+ return Re(function() {
+ return pt(e, t);
}, []);
}
-var Dt = function(e) {
+var At = function(e) {
queueMicrotask(function() {
queueMicrotask(e);
});
};
-function Ot() {
- nt(function() {
- for (var e; e = St.shift();) yt.call(e);
+function jt() {
+ at(function() {
+ for (var e; e = Tt.shift();) St.call(e);
});
}
-function kt() {
- St.push(this) === 1 && (u.requestAnimationFrame || Dt)(Ot);
+function Mt() {
+ Tt.push(this) === 1 && (f.requestAnimationFrame || At)(jt);
}
//#endregion
//#region src/state/quality-goals.ts
-var At = "/api/quality-goals?limit=200", jt = {
+var Nt = "/api/quality-goals?limit=200", Pt = {
data: null,
error: ""
-}, Mt = ut(jt), Nt = 0, Pt = mt(() => Mt.value);
-mt(() => Mt.value.data?.total ?? null);
-function Ft() {
- Nt += 1, Mt.value = jt;
+}, Ft = pt(Pt), It = 0, Lt = _t(() => Ft.value);
+_t(() => Ft.value.data?.total ?? null);
+function Rt() {
+ It += 1, Ft.value = Pt;
}
-async function It(e) {
- let t = Nt += 1;
+async function zt(e) {
+ let t = It += 1;
try {
- let n = await I(At, e);
- return t === Nt && (Mt.value = {
+ let n = await I(Nt, e);
+ return t === It && (Ft.value = {
data: n,
error: ""
}), n;
} catch (n) {
- throw !e?.aborted && t === Nt && (Mt.value = {
+ throw !e?.aborted && t === It && (Ft.value = {
data: null,
error: F(n)
}), n;
@@ -1290,62 +1297,62 @@ async function It(e) {
}
//#endregion
//#region src/islands/quality-goals.tsx
-var Lt = (e, t) => It(t), Rt = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;
-function zt({ openItem: t, javTitleHtml: r, javDisplayName: i, srcBadge: a }) {
- let { data: l, error: u } = Pt.value;
- if (u) return /* @__PURE__ */ W("div", {
+var Bt = (e, t) => zt(t), Vt = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;
+function Ht({ openItem: e, javTitleHtml: n, javDisplayName: i, srcBadge: a }) {
+ let { data: o, error: s } = Lt.value;
+ if (s) return /* @__PURE__ */ U("div", {
class: "qualitylist",
- dangerouslySetInnerHTML: { __html: n(u, {
+ dangerouslySetInnerHTML: { __html: r(s, {
variant: "error",
label: "读取失败"
}) }
});
- let d = l?.items ?? [];
- return d.length ? /* @__PURE__ */ W("div", {
+ let d = o?.items ?? [];
+ return d.length ? /* @__PURE__ */ U("div", {
class: "qualitylist",
- children: d.map((e) => /* @__PURE__ */ W("article", {
+ children: d.map((t) => /* @__PURE__ */ U("article", {
class: "qualityitem",
- children: [/* @__PURE__ */ W("button", {
+ children: [/* @__PURE__ */ U("button", {
class: "qualitycover",
type: "button",
- "aria-label": `打开 ${i(e)}`,
- onClick: () => t(e.id),
- children: /* @__PURE__ */ W("img", {
- src: Rt(e),
+ "aria-label": `打开 ${i(t)}`,
+ onClick: () => e(t.id),
+ children: /* @__PURE__ */ U("img", {
+ src: Vt(t),
alt: "",
loading: "lazy",
onError: (e) => e.currentTarget.remove()
})
- }), /* @__PURE__ */ W("div", { children: [
- /* @__PURE__ */ W("h3", { children: /* @__PURE__ */ W("button", {
+ }), /* @__PURE__ */ U("div", { children: [
+ /* @__PURE__ */ U("h3", { children: /* @__PURE__ */ U("button", {
type: "button",
"data-middle-truncate": !0,
- onClick: () => t(e.id),
- dangerouslySetInnerHTML: { __html: r(e) }
+ onClick: () => e(t.id),
+ dangerouslySetInnerHTML: { __html: n(t) }
}) }),
- /* @__PURE__ */ W("p", {
+ /* @__PURE__ */ U("p", {
class: "mono",
children: [
- /* @__PURE__ */ W("span", {
+ /* @__PURE__ */ U("span", {
style: "display:contents",
- dangerouslySetInnerHTML: { __html: a(e.location, e.cost) }
+ dangerouslySetInnerHTML: { __html: a(t.location, t.cost) }
}),
- /* @__PURE__ */ W("span", { children: o[e.location] ?? e.location }),
- /* @__PURE__ */ W("span", { children: s(e.duration) }),
- /* @__PURE__ */ W("span", { children: c(e.size ?? 0) })
+ /* @__PURE__ */ U("span", { children: c[t.location] ?? t.location }),
+ /* @__PURE__ */ U("span", { children: l(t.duration) }),
+ /* @__PURE__ */ U("span", { children: u(t.size ?? 0) })
]
}),
- e.reason ? /* @__PURE__ */ W("p", { children: e.reason }) : null
+ t.reason ? /* @__PURE__ */ U("p", { children: t.reason }) : null
] })]
- }, e.id))
- }) : /* @__PURE__ */ W("div", {
+ }, t.id))
+ }) : /* @__PURE__ */ U("div", {
class: "qualitylist",
- dangerouslySetInnerHTML: { __html: e("sparkles", "没有标记中的高清版目标", "现有版本都已满足条件,或还没有加入追踪。") }
+ dangerouslySetInnerHTML: { __html: t("sparkles", "没有标记中的高清版目标", "现有版本都已满足条件,或还没有加入追踪。") }
});
}
//#endregion
//#region src/jobs.ts
-async function Bt(e) {
+async function Ut(e) {
let t = e.pause || ((e) => new Promise((t) => setTimeout(t, e))), n = 0;
for (; e.active();) {
let r;
@@ -1360,11 +1367,11 @@ async function Bt(e) {
await t(2e3);
}
}
-function Vt(e) {
+function Wt(e) {
let t = document.createElement("div");
e.host.hidden = !0, t.dataset.followJob = "", t.setAttribute("aria-live", "polite"), e.host.prepend(t);
let n = e.storageKey || "peach-follow-job", r = sessionStorage.getItem(n) || void 0, i = !1;
- Bt({
+ Ut({
read: e.read,
active: () => !i && e.active() && t.isConnected,
keepWatching: e.watchIdle !== !1,
@@ -1390,49 +1397,49 @@ function Vt(e) {
}
//#endregion
//#region src/islands/scraping.tsx
-var Ht = (e, t) => I("/api/scraping", t);
-function Ut({ value: e, onChange: t }) {
- let n = U(null), i = U(t);
- return i.current = t, H(() => {
+var Gt = (e, t) => I("/api/scraping", t);
+function Kt({ value: e, onChange: t }) {
+ let n = H(null), r = H(t);
+ return r.current = t, V(() => {
let t = n.current;
- t.innerHTML = r([
+ t.innerHTML = i([
["environment", "系统代理"],
["direct", "应用直连"],
["proxy", "自定义代理"]
], e, { label: "连接方式" });
- let o = a(t.firstElementChild), s = () => i.current(o.value);
- return o.addEventListener("change", s), () => {
- o.disabled = !0, o.removeEventListener("change", s), t.replaceChildren();
+ let a = s(t.firstElementChild), o = () => r.current(a.value);
+ return a.addEventListener("change", o), () => {
+ a.disabled = !0, a.removeEventListener("change", o), t.replaceChildren();
};
- }, []), /* @__PURE__ */ W("div", {
+ }, []), /* @__PURE__ */ U("div", {
ref: n,
class: "scraping-network"
});
}
-function Wt({ source: e, toast: r }) {
- let [a, o] = V(e), [s, c] = V(e.network), [l, u] = V(""), [d, f] = V(""), [p, m] = V(""), [h, g] = V("paste"), [_, v] = V(""), [y, b] = V(!1), [x, S] = V(""), [C, w] = V([]), T = U(null), E = U(null);
- H(() => {
- E.current?.querySelectorAll("footer button").forEach((e) => i(e, y));
+function qt({ source: e, toast: t }) {
+ let [i, a] = B(e), [s, c] = B(e.network), [l, u] = B(""), [d, f] = B(""), [p, m] = B(""), [h, g] = B("paste"), [_, v] = B(""), [y, b] = B(!1), [x, S] = B(""), [C, w] = B([]), T = H(null), E = H(null);
+ V(() => {
+ E.current?.querySelectorAll("footer button").forEach((e) => o(e, y));
}, [y]);
- let D = U(new AbortController());
- Pe(() => () => D.current.abort(), []);
- async function O(t) {
+ let D = H(new AbortController());
+ Le(() => () => D.current.abort(), []);
+ async function O(n) {
if (!y) {
b(!0), S(""), w([]);
try {
- if (t === "check") {
- let t = await L("/api/scraping/check", { source: e.source }, "POST", D.current.signal);
+ if (n === "check") {
+ let t = await we("/api/scraping/check", { source: e.source }, "POST", D.current.signal);
D.current.signal.aborted || w(t.results);
} else {
- let n = await L("/api/scraping/settings", {
+ let r = await we("/api/scraping/settings", {
source: e.source,
network: s,
proxy: l,
cookie: d,
cookies_text: p,
- revoke: t === "revoke"
+ revoke: n === "revoke"
}, "POST", D.current.signal);
- D.current.signal.aborted || (o(n.saved), u(""), f(""), m(""), v(""), T.current && (T.current.value = ""), r(t === "revoke" ? "Cookie 已撤销" : "来源设置已保存"));
+ D.current.signal.aborted || (a(r.saved), u(""), f(""), m(""), v(""), T.current && (T.current.value = ""), t(n === "revoke" ? "Cookie 已撤销" : "来源设置已保存"));
}
} catch (e) {
D.current.signal.aborted || S(F(e));
@@ -1441,49 +1448,49 @@ function Wt({ source: e, toast: r }) {
}
}
}
- return /* @__PURE__ */ W("section", {
+ return /* @__PURE__ */ U("section", {
class: "scraping-source",
- children: /* @__PURE__ */ W("form", {
+ children: /* @__PURE__ */ U("form", {
ref: E,
class: "cleanupfieldset",
"data-geist-fieldset": !0,
onSubmit: (e) => {
e.preventDefault(), O("save");
},
- children: [/* @__PURE__ */ W("div", {
+ children: [/* @__PURE__ */ U("div", {
class: "geist-fieldset-content scraping-fields",
children: [
- /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: t(`scraping-${e.source}`, e.label) } }),
- /* @__PURE__ */ W("a", {
+ /* @__PURE__ */ U("div", { dangerouslySetInnerHTML: { __html: n(`scraping-${e.source}`, e.label) } }),
+ /* @__PURE__ */ U("a", {
class: "scraping-url",
href: e.login,
target: "_blank",
rel: "noopener noreferrer",
children: e.login
}),
- /* @__PURE__ */ W("div", {
+ /* @__PURE__ */ U("div", {
class: "scraping-label",
- children: ["连接方式", /* @__PURE__ */ W(Ut, {
+ children: ["连接方式", /* @__PURE__ */ U(Kt, {
value: s,
onChange: c
})]
}),
- s === "proxy" && /* @__PURE__ */ W("label", { children: ["代理地址", /* @__PURE__ */ W("input", {
+ s === "proxy" && /* @__PURE__ */ U("label", { children: ["代理地址", /* @__PURE__ */ U("input", {
class: "geist-input",
type: "password",
autoComplete: "off",
value: l,
- placeholder: a.proxy_saved ? "已保存,留空保留" : "http://127.0.0.1:7890",
+ placeholder: i.proxy_saved ? "已保存,留空保留" : "http://127.0.0.1:7890",
disabled: y,
onInput: (e) => u(e.currentTarget.value)
})] }),
- e.accepts_cookie && /* @__PURE__ */ W(M, { children: [
- /* @__PURE__ */ W("p", { children: a.cookie_saved ? "Cookie 已保存,登录是否有效请在抓取时确认。" : "需要登录时,任选一种方式提供 Cookie。" }),
- /* @__PURE__ */ W("div", {
+ e.accepts_cookie && /* @__PURE__ */ U(M, { children: [
+ /* @__PURE__ */ U("p", { children: i.cookie_saved ? "Cookie 已保存,登录是否有效请在抓取时确认。" : "需要登录时,任选一种方式提供 Cookie。" }),
+ /* @__PURE__ */ U("div", {
class: "insightswitch scraping-cookie-method",
role: "radiogroup",
"aria-label": "提供 Cookie 的方式(二选一)",
- children: [["paste", "粘贴 Cookie"], ["file", "导入文件"]].map(([t, n]) => /* @__PURE__ */ W("label", { children: [/* @__PURE__ */ W("input", {
+ children: [["paste", "粘贴 Cookie"], ["file", "导入文件"]].map(([t, n]) => /* @__PURE__ */ U("label", { children: [/* @__PURE__ */ U("input", {
type: "radio",
name: `cookie-method-${e.source}`,
value: t,
@@ -1491,29 +1498,29 @@ function Wt({ source: e, toast: r }) {
onChange: () => {
g(t), f(""), m(""), v("");
}
- }), /* @__PURE__ */ W("span", { children: n })] }, t))
+ }), /* @__PURE__ */ U("span", { children: n })] }, t))
}),
- h === "paste" ? /* @__PURE__ */ W("label", { children: ["Cookie", /* @__PURE__ */ W("input", {
+ h === "paste" ? /* @__PURE__ */ U("label", { children: ["Cookie", /* @__PURE__ */ U("input", {
class: "geist-input",
type: "password",
autoComplete: "off",
value: d,
disabled: y,
onInput: (e) => f(e.currentTarget.value)
- })] }) : /* @__PURE__ */ W("label", {
+ })] }) : /* @__PURE__ */ U("label", {
class: "scraping-file",
- children: ["Netscape Cookie 文件(.txt)", /* @__PURE__ */ W("span", {
+ children: ["Netscape Cookie 文件(.txt)", /* @__PURE__ */ U("span", {
class: "scraping-file-control",
children: [
- /* @__PURE__ */ W("span", {
+ /* @__PURE__ */ U("span", {
class: "geist-button",
children: "选择文件"
}),
- /* @__PURE__ */ W("span", {
+ /* @__PURE__ */ U("span", {
class: "scraping-file-name",
children: _ || "未选择文件"
}),
- /* @__PURE__ */ W("input", {
+ /* @__PURE__ */ U("input", {
ref: T,
type: "file",
accept: ".txt",
@@ -1543,31 +1550,31 @@ function Wt({ source: e, toast: r }) {
})]
})
] }),
- x && /* @__PURE__ */ W("div", {
+ x && /* @__PURE__ */ U("div", {
role: "alert",
- dangerouslySetInnerHTML: { __html: n(x, { variant: "error" }) }
+ dangerouslySetInnerHTML: { __html: r(x, { variant: "error" }) }
}),
- C.map((t) => /* @__PURE__ */ W("div", {
+ C.map((t) => /* @__PURE__ */ U("div", {
role: "status",
- dangerouslySetInnerHTML: { __html: n(`${e.label}${t.label === "来源页面" ? "" : " 高清图片"}:${t.ok ? "可连接" : "不能连接"}` + (t.width ? ` · ${t.width} × ${t.height}` : "") + (t.message ? `。${t.message}` : ""), { variant: t.ok ? "success" : "error" }) }
+ dangerouslySetInnerHTML: { __html: r(`${e.label}${t.label === "来源页面" ? "" : " 高清图片"}:${t.ok ? "可连接" : "不能连接"}` + (t.width ? ` · ${t.width} × ${t.height}` : "") + (t.message ? `。${t.message}` : ""), { variant: t.ok ? "success" : "error" }) }
}, t.label))
]
- }), /* @__PURE__ */ W("footer", {
+ }), /* @__PURE__ */ U("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
children: [
- /* @__PURE__ */ W("button", {
+ /* @__PURE__ */ U("button", {
class: "geist-button primary",
type: "submit",
children: "保存"
}),
- /* @__PURE__ */ W("button", {
+ /* @__PURE__ */ U("button", {
class: "geist-button",
type: "button",
onClick: () => void O("check"),
children: "检查连接"
}),
- e.accepts_cookie && a.cookie_saved && /* @__PURE__ */ W("button", {
+ e.accepts_cookie && i.cookie_saved && /* @__PURE__ */ U("button", {
class: "geist-button",
type: "button",
onClick: () => void O("revoke"),
@@ -1578,88 +1585,88 @@ function Wt({ source: e, toast: r }) {
})
});
}
-function Gt({ data: e, error: r, toast: a }) {
- let [o, s] = V(""), [c, l] = V(!1), [u, d] = V(""), f = U(null);
- H(() => i(f.current, c), [c]);
- let p = U(new AbortController()), m = U(0);
+function Jt({ data: e, error: t, toast: i }) {
+ let [a, s] = B(""), [c, l] = B(!1), [u, d] = B(""), f = H(null);
+ V(() => o(f.current, c), [c]);
+ let p = H(new AbortController()), m = H(0);
async function h(e = !1) {
let t = ++m.current;
- await Bt({
+ await Ut({
read: (e) => I("/api/scraping/cover", e),
active: () => !p.current.signal.aborted && t === m.current,
render: (t) => {
- l(t.status === "running"), t.status === "running" && (e = !1), t.status === "failed" && !e && d(t.error || "采集未取得"), t.status === "complete" && !e && a(t.result || "封面采集完成");
+ l(t.status === "running"), t.status === "running" && (e = !1), t.status === "failed" && !e && d(t.error || "采集未取得"), t.status === "complete" && !e && i(t.result || "封面采集完成");
},
disconnected: () => d("连接中断,正在重新读取后台进度")
});
}
- Pe(() => (h(!0), () => p.current.abort()), []);
+ Le(() => (h(!0), () => p.current.abort()), []);
async function g() {
if (!c) {
m.current++, l(!0), d("");
try {
- await L("/api/scraping/cover", { code: o }, "POST", p.current.signal), await h();
+ await we("/api/scraping/cover", { code: a }, "POST", p.current.signal), await h();
} catch (e) {
p.current.signal.aborted || (l(!1), d(F(e)));
}
}
}
- return r ? /* @__PURE__ */ W("div", {
+ return t ? /* @__PURE__ */ U("div", {
role: "alert",
- dangerouslySetInnerHTML: { __html: n(r, { variant: "error" }) }
- }) : /* @__PURE__ */ W("div", {
+ dangerouslySetInnerHTML: { __html: r(t, { variant: "error" }) }
+ }) : /* @__PURE__ */ U("div", {
class: "scraping-page",
children: [
- /* @__PURE__ */ W("p", { children: "高清图片可能需要代理才能下载,请先检查连接。" }),
- /* @__PURE__ */ W("section", {
+ /* @__PURE__ */ U("p", { children: "高清图片可能需要代理才能下载,请先检查连接。" }),
+ /* @__PURE__ */ U("section", {
class: "cleanupfieldset scraping-source",
"data-geist-fieldset": !0,
- children: /* @__PURE__ */ W("div", {
+ children: /* @__PURE__ */ U("div", {
class: "geist-fieldset-content scraping-fields",
children: [
- /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: t("scraping-cover", "高清封面") } }),
- /* @__PURE__ */ W("form", {
+ /* @__PURE__ */ U("div", { dangerouslySetInnerHTML: { __html: n("scraping-cover", "高清封面") } }),
+ /* @__PURE__ */ U("form", {
class: "scraping-cover-form",
onSubmit: (e) => {
e.preventDefault(), g();
},
- children: [/* @__PURE__ */ W("input", {
+ children: [/* @__PURE__ */ U("input", {
class: "geist-input",
"aria-label": "馆藏番号",
required: !0,
- value: o,
+ value: a,
disabled: c,
placeholder: "输入馆藏番号,如 ABW-232",
onInput: (e) => s(e.currentTarget.value)
- }), /* @__PURE__ */ W("button", {
+ }), /* @__PURE__ */ U("button", {
ref: f,
class: "geist-button primary",
type: "submit",
children: "抓取封面"
})]
}),
- u && /* @__PURE__ */ W("div", {
+ u && /* @__PURE__ */ U("div", {
role: "alert",
- dangerouslySetInnerHTML: { __html: n(u, { variant: "error" }) }
+ dangerouslySetInnerHTML: { __html: r(u, { variant: "error" }) }
})
]
})
}),
- e?.sources.map((e) => /* @__PURE__ */ W(Wt, {
+ e?.sources.map((e) => /* @__PURE__ */ U(qt, {
source: e,
- toast: a
+ toast: i
}, e.source))
]
});
}
//#endregion
//#region src/state/index.ts
-var Kt = { "quality-goals": {
- refresh: It,
- reset: Ft
-} }, qt = () => Object.keys(Kt);
-async function Jt(e) {
- let t = Kt[e];
+var Yt = { "quality-goals": {
+ refresh: zt,
+ reset: Rt
+} }, Xt = () => Object.keys(Yt);
+async function Zt(e) {
+ let t = Yt[e];
if (!t) throw Error(`未登记的共享 store:${String(e)}`);
try {
return await t.refresh(), !0;
@@ -1669,7 +1676,7 @@ async function Jt(e) {
}
//#endregion
//#region src/sidebar.ts
-function Yt(e) {
+function Qt(e) {
return [
"/",
"/unseen",
@@ -1679,39 +1686,39 @@ function Yt(e) {
"/junk-files"
].includes(e) || /^\/(item|mix|parts|editions)\//.test(e) || /^\/playlists\/\d+\/\d+$/.test(e) || /^\/(performers|studios|creators|series|agencies)\/.+/.test(e);
}
-function Xt(e, t) {
+function $t(e, t) {
return e.dataset.surface === t && e.querySelector(".dnav") ? !1 : (e.dataset.surface = t, e.replaceChildren(), !0);
}
-function Zt(e) {
+function en(e) {
let t = /* @__PURE__ */ new Map();
for (let n of e) for (let e of new Set(n.tags || [])) t.set(e, (t.get(e) || 0) + 1);
return [...t].sort((e, t) => t[1] - e[1]).slice(0, 30);
}
//#endregion
//#region src/islands.ts
-var Qt = {
+var tn = {
scraping: {
- load: Ht,
- component: Gt
+ load: Gt,
+ component: Jt
},
"quality-goals": {
- load: Lt,
- component: zt
+ load: Bt,
+ component: Ht
},
configuration: {
- load: qe,
- component: $e
+ load: Xe,
+ component: nt
}
-}, $t = () => Object.keys(Qt), en = /* @__PURE__ */ new Map();
-async function tn(e, t, n, r = {}) {
- let i = Qt[e];
+}, nn = () => Object.keys(tn), $ = /* @__PURE__ */ new Map();
+async function rn(e, t, n, r = {}) {
+ let i = tn[e];
if (!i) throw Error(`未注册的 island:${String(e)}`);
- nn(t);
+ an(t);
let a = {
controller: new AbortController(),
painted: !1
};
- en.set(t, a);
+ $.set(t, a);
let o;
try {
o = {
@@ -1725,9 +1732,9 @@ async function tn(e, t, n, r = {}) {
error: F(e)
};
}
- if (en.get(t) !== a) return;
+ if ($.get(t) !== a) return;
if (r.isCurrent && !r.isCurrent()) {
- en.delete(t);
+ $.delete(t);
return;
}
t.textContent = "", a.painted = !0;
@@ -1735,11 +1742,11 @@ async function tn(e, t, n, r = {}) {
...n,
...o
};
- ye(A(i.component, s), t);
+ xe(te(i.component, s), t);
}
-function nn(e) {
- let t = en.get(e);
- t && (t.controller.abort(), en.delete(e), t.painted && ye(null, e));
+function an(e) {
+ let t = $.get(e);
+ t && (t.controller.abort(), $.delete(e), t.painted && xe(null, e));
}
//#endregion
-export { Vt as followJobProgress, $t as islandNames, tn as mountIsland, Jt as refreshStore, Yt as sidebarHasCatalogContent, Zt as sidebarTagCounts, qt as storeNames, Xt as syncSidebarSurface, nn as unmountIsland, Bt as watchJob };
+export { Wt as followJobProgress, nn as islandNames, rn as mountIsland, Zt as refreshStore, Qt as sidebarHasCatalogContent, en as sidebarTagCounts, Xt as storeNames, $t as syncSidebarSurface, an as unmountIsland, Ut as watchJob };
diff --git a/web/js/media-source-icons.js b/web/js/media-source-icons.js
new file mode 100644
index 000000000..29931a42b
--- /dev/null
+++ b/web/js/media-source-icons.js
@@ -0,0 +1,2 @@
+/* 官方站点图标,来源与摘要见 docs/reference-snapshots/media-source-icons.md。 */
+export const MEDIA_SOURCE_ICONS = {"local": "hard-drive", "115": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAHB0lEQVR4nO2bbUwURxjH/zN38qIcb4JWoIoHFYumWhDbRquNiSlYC4ZGjVYrotHWD1VTLdY00X7zbA22Na21KWqsUMHYSiygJjaRQDW+VK2YioBarVZBQA9QDm6nedajCuxxHrfH7dX+kiXcvszM8+zO7DPP/JfBzcQmfx4O1jpJEmKUgBTHwUYIIAyAwbYRZtoYUCdBVDLwi5yxCgjfo1Uly2vd2T7mjkJj3vgsUVitcwWkqQxstAv1CAFxnoEfZjpdbvXPq05p1gFxqSZDexuWCIhMCMTDHTBcYGA5+n7YdrEwy6xOkS4yJi07uMliWSGEeB9ACPqGBsbYFwE+PpvP7l/Z6BEHCCFYzDRTBgATBMLhCRhofMiqLsrawRgTvSuiFxinbxjK2pErgAnQAAwoE3rMrTmw5s9eXOscxpSNE5iQ9glgEDQEA24LxtNrij8sc+Y67szJscmmTAjpiNaMJ+Q2CemI3Ea1n4CZM/N1p5pqPoXASngDDNmJAcbVBQWzrI5PfRLjzTX7AKTCuyhMNBjTHTmBOypFvvPeZzyRamt775+A2GRTpgTxHbwYDraoqiQrx2kHGFM2TqBBBYAPvBsLGJ9i7+3AenjPn9DiaN/rV6QeSUpxgl4pwotNMeWqbXw/PceYuAiEBvk7dZ2/Xz8MCQvE2JERGB4ZgteXOt8jyRY5cBPi1a4Ro77rybbwVtUIzzDAF7mmOYiPGexSOZt2Hu31tRS12mzbbvctMCYtO1iO7VVmUXqSy8bX323Bjp9OutoUk81GZQc0WSwr1J7YBAb4IiNtnMvlbCs4jpYHba4VIhAu26jkgLhUk8E2pVWVRenj5S7QWyxtVhQcOoecH0+o0h6ykWztNga0t2GJ2vP5oAA/ZKQldtv/1Q+/Yv8vFWg0P3BYhrm5Fa2WdjWbFWKzdVMnB8iZHJVZ/NZ4BPTvfPfzis64NJipgc1W2QG8I4endhor2OCHd1ITOu27/6AN2btK4XEE4mWbYXMAJTD74u5/f+A07jS2QAt02MzlH5Cmqn/3u/d9vV6HyeOM8nFP02Ezo7y9hPu31MwQr86YjHdnv9zjOTXX7+D4uWsoKv0D5WeuwgMIDv/Belq0gFDP+JBAf8zv0veVMEYNlLc508bir1t3sffw78g/eA5/16mS7X4SGNnOacVG7b4/wN+5CWTk4CAsnzcRh79djPlvOnaeWkhCjOK0XKVmoXWNzdhTchalpy7Ld9YZ+vv5YP2yqfK8YfDAALgbASmOxSRvoGmv67GqHcJCBuDFkRHybC5pdBQSno8EY457XPW1O5i9ajca7t13V9Oo359kxuQNlwFEo494JsyAGVNGYeGMcbJzeuLcxZt4e02e63MA+1yh1+C/cXFfQIPc1vxjmJSxFZt3lcJqleye+0LcEKyYP9GdzTH0uQM6oPj+y9xyzM3Kw83ae3bPmzc9ARGDAt3qAI9ysuI6Zn2wG7X1TYrHfX30WDb7FbfVz23iBI9yo/YeFq/bK88VlJicZHRX1WZNOIA4X3ULuw6cVjwWER6I6Ai3rLybOclSoBFy9p2wO/ePHTpQ9foYUMdJkwONUNvQjIuXlSVBOp36w5UEUclJkAQNcdPOXIDTs6oyjMRYshpLQ1gl5big5nq96nVxxio4SdEeps21QVx0uGJesPKK6mo5QbZz0uGRFA0agMLk4ZGh3faX/XaF9HKqQjZXlSyvlUcW0uFBA9BUWKmvUxZZbTps5vIPnS4XHoZecwsU0mgHyypRUU0JK3XpsJnTH1mByXABHoKySFvWzpAXQrtOiT/aXKx+hQwXOlSn/NE+ZldE4E6GDQlGwaZ5eG4YyYcfcbu+CRkf5+Nuk+PFE2d53Fbe8Q/JT0mBiT6CJjlLZ76Eoq8zMTyq88B36WodFqzdgxu37c8SXaDBZqtMpxEnJsW0XgixDm6CNAKUGaLU+OzkMQgN6t/peLtVwjf5x7Alr1xeE3QHjLFPqouz1ivqAwJ8fDabLa3LXF0hHjEsDBMSoqHjHH4+egwM7g9jVCgS46O69XOC0l6Hyiuxs/CU3VBYFRhqycbOu7pgTNmwEAI5aiyMvjbeiEkJRhifDUXkoCB5qbyt3YrmFguu3mxE5dVaHCq7hPIzV2CV+iAWY8isKV6zvUcHiIcSmVKt6IDV1BNXFWd1k8jwbicyJkh4TMIi/EewiaTmKinKudIFpKYi4bEsMfN+LLKI2o6SnNu7inR1HOw9eDlkQ08Kct7TxbLCkiEb3gpDdk8qUcJhmoVU1yQ8hvdRaGs7XHJAQcEsK6muvepJILn8EyjFCafyTDbx9Nca1g9bqM87euwfhzlbw1P9yQxBFZDwmAILaATbR1NJzhpP/P/ZHFzkqf1wsitP7aezSjyVH0/DDlr/fP4fOwTeE5lpP+gAAAAASUVORK5CYII=", "pikpak": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACY0lEQVR4nNWXy2tTQRSHv7m5RUWttqlNW1OairhKNbrU+lhE/AOkdCOIIO7arty0QhSxCIIQ7VJwIfgfCIJdFB+rgC32AVIflD5CbFUsoohJRiZzb5Ne05p4kxv94HCTc+bO+c0MM3eOoICD/TJswAAQBdoBH5UhA8wDo1mIv7ojpuyAsH9EBuQgkmuASXVJI4lN3BXDawIifXIQwQ28RDA0ERfDwpr2cQ9G7iSdhcOGteZeJ1eYKreB5DS1I2oiCJba2hDQVA9tjdDaCHMfICuhMwDJz5D8BMtftK9E2s2NttrJMOxvzSdT1rIb6goW69KIXsjr5/K+nxlIWWKWrOebJIxNFhXgK7r20QjcPL+59PllGH8LarDvU3oWFHU+CDZpK+TKA3j88vd+zGKd93av/y8lrKxao7Ls6bROrrj6EE6E9WzZppZKrJ0y0Hu8RAGhZuhohqk5nShp2Y/0+nZqxPaoFQsr2my2mNDSkBe01w/7AvAu9QcB/nrYs0vboU4qSsNOwCHAoMYY/5WAsckNt1NJ8WKY5TS+fF8/E7f/Lu5aQDrjLu5agOlzF3ct4NYFd3HXAk51uYv/k9vQLPeFr9/h4gh0dcCBNu17vaiP7nt9sGNblQVs3wo9x+DZNCRm9aUyFICebh0rF9PpWP22+QvqC3f2qLZyKda34XTMLsGLGSrO8xndtxMR6ZfqQ+tz7uczRyDor0zyxY/6LlDkoMqYVsUSKvSqho8SVB/JglqCUWqF4ImharVcueQ96j4bN3KFoiDmeXpJTOXO7QJVoyEZ8mgm0rm6sLA4talFef4LaurBZfZxNPMAAAAASUVORK5CYII="};
diff --git a/web/js/ui-components.js b/web/js/ui-components.js
index ea0c1ec32..e3a5447b4 100644
--- a/web/js/ui-components.js
+++ b/web/js/ui-components.js
@@ -1,4 +1,5 @@
import { esc, icon } from './core.js';
+export { MEDIA_SOURCE_ICONS } from './media-source-icons.js';
const NOTE_VARIANTS=new Set(['secondary','warning','error','success']);
@@ -546,14 +547,19 @@ export function wireAnchoredMenu(mount,toggle,menu){
`value`、`disabled` 和 `change` 三样按原生 select 的写法留在根元素上:调用方读写它跟
读写原生下拉一样,换掉的只是画法。 */
+export function selectOptionIconHtml(mark){
+ return !mark?'':mark.startsWith('data:image/png;base64,')
+ ?`<img class="gselectmark" src="${esc(mark)}" alt="" width="16" height="16">`:icon(mark,'gselectmark');
+}
export function selectFieldHtml(options,current,{label='',attr='',className=''}={}){
const chosen=options.find(([value])=>String(value)===String(current))||options[0]||['',''];
- const rows=options.map(([value,text])=>
+ const content=([,text,mark])=>`${selectOptionIconHtml(mark)}${esc(text)}`;
+ const rows=options.map(([value,text,mark])=>
`<button type="button" role="option" data-select-option="${esc(value)}"
- aria-selected="${String(value)===String(chosen[0])}" tabindex="-1">${icon('check')}<span>${esc(text)}</span></button>`).join('');
+ aria-selected="${String(value)===String(chosen[0])}" tabindex="-1">${icon('check')}<span data-select-content>${content([value,text,mark])}</span></button>`).join('');
return `<div class="gselect${className?` ${esc(className)}`:''}" ${attr}>
<button type="button" class="gselectfield" data-select-trigger aria-haspopup="listbox"
- aria-expanded="false" aria-label="${esc(label)}"><span data-select-label>${esc(chosen[1])}</span>${icon('chevron-down')}</button>
+ aria-expanded="false" aria-label="${esc(label)}"><span data-select-label>${content(chosen)}</span>${icon('chevron-down')}</button>
<div class="popmenu gselectmenu" role="listbox" aria-label="${esc(label)}" popover="manual" data-select-menu hidden>${rows}</div></div>`;
}
@@ -573,7 +579,7 @@ export function wireSelectField(root){
if(!picked)return;
options().forEach(option=>{
option.setAttribute('aria-selected',String(option===picked));option.tabIndex=option===picked?0:-1});
- label.textContent=picked.querySelector('span').textContent;
+ label.innerHTML=picked.querySelector('[data-select-content]').innerHTML;
};
options().forEach(option=>{
option.onclick=()=>{