pixivflow 2.30.0 → 2.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/dist/commands/WebUICommand.d.ts +2 -2
- package/dist/commands/WebUICommand.js +9 -7
- package/dist/package.json +1 -1
- package/dist/version.js +1 -1
- package/dist/webui/package.json +1 -1
- package/package.json +2 -1
- package/webui-frontend/dist/assets/CheckCircleOutlined-H3DnUyMO.js +2 -0
- package/webui-frontend/dist/assets/ClearOutlined-BpODq7I7.js +2 -0
- package/webui-frontend/dist/assets/CloseCircleOutlined-BFfS5iXd.js +2 -0
- package/webui-frontend/dist/assets/Config-DRElCeDC.js +16 -0
- package/webui-frontend/dist/assets/Dashboard-aqPMquSO.js +2 -0
- package/webui-frontend/dist/assets/DeleteOutlined-BFmW1oWe.js +2 -0
- package/webui-frontend/dist/assets/Download-DCKDU51K.js +2 -0
- package/webui-frontend/dist/assets/Files-nNoRY5tl.js +5 -0
- package/webui-frontend/dist/assets/PictureOutlined-U51jGr2U.js +2 -0
- package/webui-frontend/dist/assets/SortDescendingOutlined-CckVuL_b.js +2 -0
- package/webui-frontend/dist/assets/ThunderboltOutlined-ulcCd7ui.js +2 -0
- package/webui-frontend/dist/assets/UrlDownload-Bzs0AZN0.js +3 -0
- package/webui-frontend/dist/assets/dateUtils-gQt2uAjS.js +2 -0
- package/webui-frontend/dist/assets/errorCodeTranslator-BqIackMm.js +3 -0
- package/webui-frontend/dist/assets/index-B2ns27ii.js +2 -0
- package/webui-frontend/dist/assets/index-B7yYDv10.js +2 -0
- package/webui-frontend/dist/assets/index-Bbsa44oT.js +2 -0
- package/webui-frontend/dist/assets/index-C2ANILg9.js +19 -0
- package/webui-frontend/dist/assets/index-CDrp3NIf.js +8 -0
- package/webui-frontend/dist/assets/index-CFtP5lqo.js +22 -0
- package/webui-frontend/dist/assets/index-CJln3zA7.js +14 -0
- package/webui-frontend/dist/assets/index-CZhfhXvc.js +2 -0
- package/webui-frontend/dist/assets/index-CfHs6AUn.js +2 -0
- package/webui-frontend/dist/assets/index-DG6kGbYq.js +217 -0
- package/webui-frontend/dist/assets/index-DHwJxrFi.css +1 -0
- package/webui-frontend/dist/assets/index-DPigBPWX.js +2 -0
- package/webui-frontend/dist/assets/index-DarObP-C.js +2 -0
- package/webui-frontend/dist/assets/index-_EG4kaKN.js +47 -0
- package/webui-frontend/dist/assets/row-_c51T55h.js +20 -0
- package/webui-frontend/dist/assets/socket-oqYz9cKb.js +2 -0
- package/webui-frontend/dist/assets/useAuth-wCjAOx6S.js +9 -0
- package/webui-frontend/dist/assets/useConfig-Ds7RpIL1.js +9 -0
- package/webui-frontend/dist/assets/useDownload-BlxvZNEm.js +2 -0
- package/webui-frontend/dist/assets/useErrorHandler-BOvHue1w.js +84 -0
- package/webui-frontend/dist/index.html +15 -0
package/README.en.md
CHANGED
|
@@ -69,7 +69,7 @@ pixivflow scheduler # long-running cron collection
|
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
Prefer not to hand-write config? The interactive wizard `pixivflow setup` generates it.
|
|
72
|
-
For a GUI, run `pixivflow
|
|
72
|
+
For a GUI, run `pixivflow web` (frontend:
|
|
73
73
|
[pixivflow-webui](https://github.com/redtidev1918/pixivflow-webui)).
|
|
74
74
|
|
|
75
75
|
Downloading Pixiv ugoira additionally needs `python3` and `ffmpeg`: frames are
|
|
@@ -249,7 +249,7 @@ ledger; dry-run by default).
|
|
|
249
249
|
| `pixivflow download --url <url>` | Direct download via URL |
|
|
250
250
|
| `pixivflow random` | Random popular artwork |
|
|
251
251
|
| `pixivflow scheduler` | Start scheduled jobs |
|
|
252
|
-
| `pixivflow
|
|
252
|
+
| `pixivflow web` | Start the WebUI |
|
|
253
253
|
| `pixivflow config` | Manage config (view / edit / backup / restore) |
|
|
254
254
|
| `pixivflow status` | Download stats and recent records |
|
|
255
255
|
| `pixivflow health` | Health check: config, directories, connectivity |
|
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ pixivflow scheduler # 按 cron 配置长期挂机自动收集
|
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
不想手写配置?运行交互式向导 `pixivflow setup` 一步步生成。图形界面用
|
|
67
|
-
`pixivflow
|
|
67
|
+
`pixivflow web`(前端见 [pixivflow-webui](https://github.com/redtidev1918/pixivflow-webui))。
|
|
68
68
|
|
|
69
69
|
下载 Pixiv 动图(ugoira)还需要 `python3` 和 `ffmpeg`:程序按逐帧延迟合成循环 GIF,
|
|
70
70
|
可直接作为动画交付给下游。官方 Docker 镜像已包含两者,详见
|
|
@@ -227,7 +227,7 @@ pixivflow outbox cancel <id> # 只取消尚未执行的 row
|
|
|
227
227
|
| `pixivflow download --url <url>` | 通过 URL 直接下载 |
|
|
228
228
|
| `pixivflow random` | 随机下载热门作品 |
|
|
229
229
|
| `pixivflow scheduler` | 启动定时任务 |
|
|
230
|
-
| `pixivflow
|
|
230
|
+
| `pixivflow web` | 启动 WebUI |
|
|
231
231
|
| `pixivflow config` | 配置管理(查看 / 编辑 / 备份 / 恢复) |
|
|
232
232
|
| `pixivflow status` | 下载统计与最近记录 |
|
|
233
233
|
| `pixivflow health` | 健康检查:配置、目录可写性、连通性 |
|
|
@@ -8,8 +8,8 @@ import { CommandContext, CommandArgs, CommandResult } from './types';
|
|
|
8
8
|
* WebUI command - Start WebUI server
|
|
9
9
|
*/
|
|
10
10
|
export declare class WebUICommand extends BaseCommand {
|
|
11
|
-
readonly name = "
|
|
12
|
-
readonly description = "Start WebUI server";
|
|
11
|
+
readonly name = "web";
|
|
12
|
+
readonly description = "Start WebUI server (memory only when used)";
|
|
13
13
|
readonly aliases: string[];
|
|
14
14
|
readonly metadata: {
|
|
15
15
|
category: CommandCategory;
|
|
@@ -18,9 +18,9 @@ const child_process_1 = require("child_process");
|
|
|
18
18
|
* WebUI command - Start WebUI server
|
|
19
19
|
*/
|
|
20
20
|
class WebUICommand extends Command_1.BaseCommand {
|
|
21
|
-
name = '
|
|
22
|
-
description = 'Start WebUI server';
|
|
23
|
-
aliases = ['w'];
|
|
21
|
+
name = 'web';
|
|
22
|
+
description = 'Start WebUI server (memory only when used)';
|
|
23
|
+
aliases = ['w', 'webui'];
|
|
24
24
|
metadata = {
|
|
25
25
|
category: metadata_1.CommandCategory.UTILITY,
|
|
26
26
|
requiresAuth: false,
|
|
@@ -437,10 +437,12 @@ Auto-Build Feature:
|
|
|
437
437
|
the command will automatically build the frontend before starting.
|
|
438
438
|
|
|
439
439
|
Examples:
|
|
440
|
-
pixivflow
|
|
441
|
-
pixivflow
|
|
442
|
-
pixivflow
|
|
443
|
-
pixivflow
|
|
440
|
+
pixivflow web # Start WebUI (loads frontend only now)
|
|
441
|
+
pixivflow web --port 8080 # Use custom port
|
|
442
|
+
pixivflow web --host 0.0.0.0 # Bind to all interfaces
|
|
443
|
+
pixivflow web --static-path ./webui-frontend/dist # Use custom static path
|
|
444
|
+
|
|
445
|
+
Backward-compatible aliases: pixivflow webui, pixivflow w`;
|
|
444
446
|
}
|
|
445
447
|
}
|
|
446
448
|
exports.WebUICommand = WebUICommand;
|
package/dist/package.json
CHANGED
package/dist/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BUILD = void 0;
|
|
4
4
|
// GENERATED by scripts/write-version.js — do not edit manually.
|
|
5
|
-
exports.BUILD = { version: '2.
|
|
5
|
+
exports.BUILD = { version: '2.31.0', commit: '4642dce0724a' };
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/dist/webui/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixivflow",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.0",
|
|
4
4
|
"description": "🎨 Pixiv 下载、筛选与自动收集工具 - 批量下载插画和小说、按标签/热度/日期筛选、定时任务与可靠 HTTP 交付 | Pixiv downloader and automation toolkit with filtering, scheduling and reliable HTTP delivery",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -135,6 +135,7 @@
|
|
|
135
135
|
},
|
|
136
136
|
"files": [
|
|
137
137
|
"dist/",
|
|
138
|
+
"webui-frontend/dist/",
|
|
138
139
|
"!dist/**/*.map",
|
|
139
140
|
"config/examples/",
|
|
140
141
|
"config/fly-two-bots.example.json",
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,I as a,_ as r}from"./index-DG6kGbYq.js";var l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},n=function(t,c){return e.createElement(a,r({},t,{ref:c,icon:l}))},o=e.forwardRef(n);export{o as R};
|
|
2
|
+
//# sourceMappingURL=CheckCircleOutlined-H3DnUyMO.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,I as r,_ as c}from"./index-DG6kGbYq.js";var l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6a25.95 25.95 0 0025.6 30.4h723c1.5 0 3-.1 4.4-.4a25.88 25.88 0 0021.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"}}]},name:"clear",theme:"outlined"},n=function(a,t){return e.createElement(r,c({},a,{ref:t,icon:l}))},h=e.forwardRef(n);export{h as R};
|
|
2
|
+
//# sourceMappingURL=ClearOutlined-BpODq7I7.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,I as l,_ as r}from"./index-DG6kGbYq.js";var t={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"},o=function(a,c){return e.createElement(l,r({},a,{ref:c,icon:t}))},i=e.forwardRef(o);export{i as R};
|
|
2
|
+
//# sourceMappingURL=CloseCircleOutlined-BFfS5iXd.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{r as o,I as rn,_ as de,f as Rn,g as An,h as G,w as st,i as Se,k as lt,l as ct,m as Me,n as ie,o as _n,p as dt,q as Xe,t as ut,F as ft,v as gt,x as ht,y as mt,z as Ye,A as X,C as pt,D as xt,E as yt,G as vt,H as jt,J as bt,K as wt,L as St,M as Sn,N as Cn,O as Ct,P as It,T as kt,b as H,U as Be,Q as ue,V as In,s as V,j as e,W as T,X as U,a as _e,B as R,c as on,e as On,d as Et,Y as W,Z as Ce,$ as Nt,S as Dt,a0 as Tt,a1 as $t}from"./index-DG6kGbYq.js";import{u as Ft,a as Ve,c as Ze,C as Pe,R as Mn,b as Rt}from"./useConfig-Ds7RpIL1.js";import{t as ye,e as ze}from"./errorCodeTranslator-BqIackMm.js";import{u as ke,F as sn}from"./useErrorHandler-BOvHue1w.js";import{F as w,u as At,R as q}from"./useAuth-wCjAOx6S.js";import{B as _t,t as Ot,i as Mt,a as zt,g as zn,b as Bt,c as Vt,d as Pt,e as Lt,f as Ht,h as Wt,j as Gt,k as qt,T as oe,R as ln,l as Bn}from"./index-_EG4kaKN.js";import{T as Ie}from"./index-CJln3zA7.js";import{R as Ut}from"./CheckCircleOutlined-H3DnUyMO.js";import{a as Ee,T as Kt}from"./row-_c51T55h.js";import{D as Jt}from"./index-B2ns27ii.js";import{S as Vn}from"./index-B7yYDv10.js";import{I as Q}from"./index-DPigBPWX.js";import{M as cn}from"./index-CDrp3NIf.js";import{S as Pn,R as Ln}from"./ThunderboltOutlined-ulcCd7ui.js";import{P as dn}from"./index-CfHs6AUn.js";import{R as un}from"./DeleteOutlined-BFmW1oWe.js";var Qt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},Xt=function(t,a){return o.createElement(rn,de({},t,{ref:a,icon:Qt}))},Yt=o.forwardRef(Xt);function an(){return typeof BigInt=="function"}function Hn(n){return!n&&n!==0&&!Number.isNaN(n)||!String(n).trim()}function ce(n){var t=n.trim(),a=t.startsWith("-");a&&(t=t.slice(1)),t=t.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),t.startsWith(".")&&(t="0".concat(t));var r=t||"0",i=r.split("."),s=i[0]||"0",c=i[1]||"0";s==="0"&&c==="0"&&(a=!1);var l=a?"-":"";return{negative:a,negativeStr:l,trimStr:r,integerStr:s,decimalStr:c,fullStr:"".concat(l).concat(r)}}function fn(n){var t=String(n);return!Number.isNaN(Number(t))&&t.includes("e")}function le(n){var t=String(n);if(fn(n)){var a=Number(t.slice(t.indexOf("e-")+2)),r=t.match(/\.(\d+)/);return r!=null&&r[1]&&(a+=r[1].length),a}return t.includes(".")&&gn(t)?t.length-t.indexOf(".")-1:0}function Le(n){var t=String(n);if(fn(n)){if(n>Number.MAX_SAFE_INTEGER)return String(an()?BigInt(n).toString():Number.MAX_SAFE_INTEGER);if(n<Number.MIN_SAFE_INTEGER)return String(an()?BigInt(n).toString():Number.MIN_SAFE_INTEGER);t=n.toFixed(le(t))}return ce(t).fullStr}function gn(n){return typeof n=="number"?!Number.isNaN(n):n?/^\s*-?\d+(\.\d+)?\s*$/.test(n)||/^\s*-?\d+\.\s*$/.test(n)||/^\s*-?\.\d+\s*$/.test(n):!1}var Zt=(function(){function n(t){if(An(this,n),G(this,"origin",""),G(this,"negative",void 0),G(this,"integer",void 0),G(this,"decimal",void 0),G(this,"decimalLen",void 0),G(this,"empty",void 0),G(this,"nan",void 0),Hn(t)){this.empty=!0;return}if(this.origin=String(t),t==="-"||Number.isNaN(t)){this.nan=!0;return}var a=t;if(fn(a)&&(a=Number(a)),a=typeof a=="string"?a:Le(a),gn(a)){var r=ce(a);this.negative=r.negative;var i=r.trimStr.split(".");this.integer=BigInt(i[0]);var s=i[1]||"0";this.decimal=BigInt(s),this.decimalLen=s.length}else this.nan=!0}return Rn(n,[{key:"getMark",value:function(){return this.negative?"-":""}},{key:"getIntegerStr",value:function(){return this.integer.toString()}},{key:"getDecimalStr",value:function(){return this.decimal.toString().padStart(this.decimalLen,"0")}},{key:"alignDecimal",value:function(a){var r="".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(a,"0"));return BigInt(r)}},{key:"negate",value:function(){var a=new n(this.toString());return a.negative=!a.negative,a}},{key:"cal",value:function(a,r,i){var s=Math.max(this.getDecimalStr().length,a.getDecimalStr().length),c=this.alignDecimal(s),l=a.alignDecimal(s),u=r(c,l).toString(),m=i(s),d=ce(u),g=d.negativeStr,f=d.trimStr,v="".concat(g).concat(f.padStart(m+1,"0"));return new n("".concat(v.slice(0,-m),".").concat(v.slice(-m)))}},{key:"add",value:function(a){if(this.isInvalidate())return new n(a);var r=new n(a);return r.isInvalidate()?this:this.cal(r,function(i,s){return i+s},function(i){return i})}},{key:"multi",value:function(a){var r=new n(a);return this.isInvalidate()||r.isInvalidate()?new n(NaN):this.cal(r,function(i,s){return i*s},function(i){return i*2})}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return this.nan}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(a){return this.toString()===a?.toString()}},{key:"lessEquals",value:function(a){return this.add(a.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return a?this.isInvalidate()?"":ce("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),n})(),ei=(function(){function n(t){if(An(this,n),G(this,"origin",""),G(this,"number",void 0),G(this,"empty",void 0),Hn(t)){this.empty=!0;return}this.origin=String(t),this.number=Number(t)}return Rn(n,[{key:"negate",value:function(){return new n(-this.toNumber())}},{key:"add",value:function(a){if(this.isInvalidate())return new n(a);var r=Number(a);if(Number.isNaN(r))return this;var i=this.number+r;if(i>Number.MAX_SAFE_INTEGER)return new n(Number.MAX_SAFE_INTEGER);if(i<Number.MIN_SAFE_INTEGER)return new n(Number.MIN_SAFE_INTEGER);var s=Math.max(le(this.number),le(r));return new n(i.toFixed(s))}},{key:"multi",value:function(a){var r=Number(a);if(this.isInvalidate()||Number.isNaN(r))return new n(NaN);var i=this.number*r;if(i>Number.MAX_SAFE_INTEGER)return new n(Number.MAX_SAFE_INTEGER);if(i<Number.MIN_SAFE_INTEGER)return new n(Number.MIN_SAFE_INTEGER);var s=Math.max(le(this.number),le(r));return new n(i.toFixed(s))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return Number.isNaN(this.number)}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(a){return this.toNumber()===a?.toNumber()}},{key:"lessEquals",value:function(a){return this.add(a.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return a?this.isInvalidate()?"":Le(this.number):this.origin}}]),n})();function ee(n){return an()?new Zt(n):new ei(n)}function Oe(n,t,a){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(n==="")return"";var i=ce(n),s=i.negativeStr,c=i.integerStr,l=i.decimalStr,u="".concat(t).concat(l),m="".concat(s).concat(c);if(a>=0){var d=Number(l[a]);if(d>=5&&!r){var g=ee(n).add("".concat(s,"0.").concat("0".repeat(a)).concat(10-d));return Oe(g.toString(),t,a,r)}return a===0?m:"".concat(m).concat(t).concat(l.padEnd(a,"0").slice(0,a))}return u===".0"?m:"".concat(m).concat(u)}function ni(n,t){return typeof Proxy<"u"&&n?new Proxy(n,{get:function(r,i){if(t[i])return t[i];var s=r[i];return typeof s=="function"?s.bind(r):s}}):n}function ti(n,t){var a=o.useRef(null);function r(){try{var s=n.selectionStart,c=n.selectionEnd,l=n.value,u=l.substring(0,s),m=l.substring(c);a.current={start:s,end:c,value:l,beforeTxt:u,afterTxt:m}}catch{}}function i(){if(n&&a.current&&t)try{var s=n.value,c=a.current,l=c.beforeTxt,u=c.afterTxt,m=c.start,d=s.length;if(s.startsWith(l))d=l.length;else if(s.endsWith(u))d=s.length-a.current.afterTxt.length;else{var g=l[m-1],f=s.indexOf(g,m-1);f!==-1&&(d=f+1)}n.setSelectionRange(d,d)}catch(v){st(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(v.message))}}return[r,i]}var ii=function(){var t=o.useState(!1),a=Se(t,2),r=a[0],i=a[1];return lt(function(){i(ct())},[]),r},ai=200,ri=600;function oi(n){var t=n.prefixCls,a=n.upNode,r=n.downNode,i=n.upDisabled,s=n.downDisabled,c=n.onStep,l=o.useRef(),u=o.useRef([]),m=o.useRef();m.current=c;var d=function(){clearTimeout(l.current)},g=function(E,p){E.preventDefault(),d(),m.current(p);function _(){m.current(p),l.current=setTimeout(_,ai)}l.current=setTimeout(_,ri)};o.useEffect(function(){return function(){d(),u.current.forEach(function(y){return Me.cancel(y)})}},[]);var f=ii();if(f)return null;var v="".concat(t,"-handler"),j=ie(v,"".concat(v,"-up"),G({},"".concat(v,"-up-disabled"),i)),x=ie(v,"".concat(v,"-down"),G({},"".concat(v,"-down-disabled"),s)),S=function(){return u.current.push(Me(d))},h={unselectable:"on",role:"button",onMouseUp:S,onMouseLeave:S};return o.createElement("div",{className:"".concat(v,"-wrap")},o.createElement("span",de({},h,{onMouseDown:function(E){g(E,!0)},"aria-label":"Increase Value","aria-disabled":i,className:j}),a||o.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-up-inner")})),o.createElement("span",de({},h,{onMouseDown:function(E){g(E,!1)},"aria-label":"Decrease Value","aria-disabled":s,className:x}),r||o.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-down-inner")})))}function kn(n){var t=typeof n=="number"?Le(n):ce(n).fullStr,a=t.includes(".");return a?ce(t.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:n+"0"}const si=(function(){var n=o.useRef(0),t=function(){Me.cancel(n.current)};return o.useEffect(function(){return t},[]),function(a){t(),n.current=Me(function(){a()})}});var li=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","changeOnWheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur","domRef"],ci=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],En=function(t,a){return t||a.isEmpty()?a.toString():a.toNumber()},Nn=function(t){var a=ee(t);return a.isInvalidate()?null:a},di=o.forwardRef(function(n,t){var a=n.prefixCls,r=n.className,i=n.style,s=n.min,c=n.max,l=n.step,u=l===void 0?1:l,m=n.defaultValue,d=n.value,g=n.disabled,f=n.readOnly,v=n.upHandler,j=n.downHandler,x=n.keyboard,S=n.changeOnWheel,h=S===void 0?!1:S,y=n.controls,E=y===void 0?!0:y;n.classNames;var p=n.stringMode,_=n.parser,O=n.formatter,$=n.precision,P=n.decimalSeparator,C=n.onChange,k=n.onInput,D=n.onPressEnter,A=n.onStep,B=n.changeOnBlur,J=B===void 0?!0:B,te=n.domRef,He=_n(n,li),De="".concat(a,"-input"),ae=o.useRef(null),re=o.useState(!1),Te=Se(re,2),fe=Te[0],ve=Te[1],Y=o.useRef(!1),se=o.useRef(!1),ge=o.useRef(!1),We=o.useState(function(){return ee(d??m)}),$e=Se(We,2),M=$e[0],he=$e[1];function Kn(I){d===void 0&&he(I)}var Ge=o.useCallback(function(I,b){if(!b)return $>=0?$:Math.max(le(I),le(u))},[$,u]),qe=o.useCallback(function(I){var b=String(I);if(_)return _(b);var F=b;return P&&(F=F.replace(P,".")),F.replace(/[^\w.-]+/g,"")},[_,P]),Ue=o.useRef(""),hn=o.useCallback(function(I,b){if(O)return O(I,{userTyping:b,input:String(Ue.current)});var F=typeof I=="number"?Le(I):I;if(!b){var N=Ge(F,b);if(gn(F)&&(P||N>=0)){var ne=P||".";F=Oe(F,ne,N)}}return F},[O,Ge,P]),Jn=o.useState(function(){var I=m??d;return M.isInvalidate()&&["string","number"].includes(dt(I))?Number.isNaN(I)?"":I:hn(M.toString(),!1)}),mn=Se(Jn,2),je=mn[0],pn=mn[1];Ue.current=je;function be(I,b){pn(hn(I.isInvalidate()?I.toString(!1):I.toString(!b),b))}var me=o.useMemo(function(){return Nn(c)},[c,$]),pe=o.useMemo(function(){return Nn(s)},[s,$]),xn=o.useMemo(function(){return!me||!M||M.isInvalidate()?!1:me.lessEquals(M)},[me,M]),yn=o.useMemo(function(){return!pe||!M||M.isInvalidate()?!1:M.lessEquals(pe)},[pe,M]),Qn=ti(ae.current,fe),vn=Se(Qn,2),Xn=vn[0],Yn=vn[1],jn=function(b){return me&&!b.lessEquals(me)?me:pe&&!pe.lessEquals(b)?pe:null},Ke=function(b){return!jn(b)},Fe=function(b,F){var N=b,ne=Ke(N)||N.isEmpty();if(!N.isEmpty()&&!F&&(N=jn(N)||N,ne=!0),!f&&!g&&ne){var we=N.toString(),Qe=Ge(we,F);return Qe>=0&&(N=ee(Oe(we,".",Qe)),Ke(N)||(N=ee(Oe(we,".",Qe,!0)))),N.equals(M)||(Kn(N),C?.(N.isEmpty()?null:En(p,N)),d===void 0&&be(N,F)),N}return M},Zn=si(),bn=function I(b){if(Xn(),Ue.current=b,pn(b),!se.current){var F=qe(b),N=ee(F);N.isNaN()||Fe(N,!0)}k?.(b),Zn(function(){var ne=b;_||(ne=b.replace(/。/g,".")),ne!==b&&I(ne)})},et=function(){se.current=!0},nt=function(){se.current=!1,bn(ae.current.value)},tt=function(b){bn(b.target.value)},Je=function(b){var F;if(!(b&&xn||!b&&yn)){Y.current=!1;var N=ee(ge.current?kn(u):u);b||(N=N.negate());var ne=(M||ee(0)).add(N.toString()),we=Fe(ne,!1);A?.(En(p,we),{offset:ge.current?kn(u):u,type:b?"up":"down"}),(F=ae.current)===null||F===void 0||F.focus()}},wn=function(b){var F=ee(qe(je)),N;F.isNaN()?N=Fe(M,b):N=Fe(F,b),d!==void 0?be(M,!1):N.isNaN()||be(N,!1)},it=function(){Y.current=!0},at=function(b){var F=b.key,N=b["shiftKey"];Y.current=!0,ge.current=N,F==="Enter"&&(se.current||(Y.current=!1),wn(!1),D?.(b)),x!==!1&&!se.current&&["Up","ArrowUp","Down","ArrowDown"].includes(F)&&(Je(F==="Up"||F==="ArrowUp"),b.preventDefault())},rt=function(){Y.current=!1,ge.current=!1};o.useEffect(function(){if(h&&fe){var I=function(N){Je(N.deltaY<0),N.preventDefault()},b=ae.current;if(b)return b.addEventListener("wheel",I,{passive:!1}),function(){return b.removeEventListener("wheel",I)}}});var ot=function(){J&&wn(!1),ve(!1),Y.current=!1};return Xe(function(){M.isInvalidate()||be(M,!1)},[$,O]),Xe(function(){var I=ee(d);he(I);var b=ee(qe(je));(!I.equals(b)||!Y.current||O)&&be(I,Y.current)},[d]),Xe(function(){O&&Yn()},[je]),o.createElement("div",{ref:te,className:ie(a,r,G(G(G(G(G({},"".concat(a,"-focused"),fe),"".concat(a,"-disabled"),g),"".concat(a,"-readonly"),f),"".concat(a,"-not-a-number"),M.isNaN()),"".concat(a,"-out-of-range"),!M.isInvalidate()&&!Ke(M))),style:i,onFocus:function(){ve(!0)},onBlur:ot,onKeyDown:at,onKeyUp:rt,onCompositionStart:et,onCompositionEnd:nt,onBeforeInput:it},E&&o.createElement(oi,{prefixCls:a,upNode:v,downNode:j,upDisabled:xn,downDisabled:yn,onStep:Je}),o.createElement("div",{className:"".concat(De,"-wrap")},o.createElement("input",de({autoComplete:"off",role:"spinbutton","aria-valuemin":s,"aria-valuemax":c,"aria-valuenow":M.isInvalidate()?null:M.toString(),step:u},He,{ref:ut(ae,t),className:De,value:je,onChange:tt,disabled:g,readOnly:f}))))}),ui=o.forwardRef(function(n,t){var a=n.disabled,r=n.style,i=n.prefixCls,s=i===void 0?"rc-input-number":i,c=n.value,l=n.prefix,u=n.suffix,m=n.addonBefore,d=n.addonAfter,g=n.className,f=n.classNames,v=_n(n,ci),j=o.useRef(null),x=o.useRef(null),S=o.useRef(null),h=function(E){S.current&&Ot(S.current,E)};return o.useImperativeHandle(t,function(){return ni(S.current,{focus:h,nativeElement:j.current.nativeElement||x.current})}),o.createElement(_t,{className:g,triggerFocus:h,prefixCls:s,value:c,disabled:a,style:r,prefix:l,suffix:u,addonAfter:d,addonBefore:m,classNames:f,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"},ref:j},o.createElement(di,de({prefixCls:s,disabled:a,ref:S,domRef:x,className:f?.input},v)))});const fi=n=>{var t;const a=(t=n.handleVisible)!==null&&t!==void 0?t:"auto",r=n.controlHeightSM-n.lineWidth*2;return Object.assign(Object.assign({},Mt(n)),{controlWidth:90,handleWidth:r,handleFontSize:n.fontSize/2,handleVisible:a,handleActiveBg:n.colorFillAlter,handleBg:n.colorBgContainer,filledHandleBg:new ft(n.colorFillSecondary).onBackground(n.colorBgContainer).toHexString(),handleHoverColor:n.colorPrimary,handleBorderColor:n.colorBorder,handleOpacity:a===!0?1:0,handleVisibleWidth:a===!0?r:0})},Dn=({componentCls:n,borderRadiusSM:t,borderRadiusLG:a},r)=>{const i=r==="lg"?a:t;return{[`&-${r}`]:{[`${n}-handler-wrap`]:{borderStartEndRadius:i,borderEndEndRadius:i},[`${n}-handler-up`]:{borderStartEndRadius:i},[`${n}-handler-down`]:{borderEndEndRadius:i}}}},gi=n=>{const{componentCls:t,lineWidth:a,lineType:r,borderRadius:i,inputFontSizeSM:s,inputFontSizeLG:c,controlHeightLG:l,controlHeightSM:u,colorError:m,paddingInlineSM:d,paddingBlockSM:g,paddingBlockLG:f,paddingInlineLG:v,colorIcon:j,motionDurationMid:x,handleHoverColor:S,handleOpacity:h,paddingInline:y,paddingBlock:E,handleBg:p,handleActiveBg:_,colorTextDisabled:O,borderRadiusSM:$,borderRadiusLG:P,controlWidth:C,handleBorderColor:k,filledHandleBg:D,lineHeightLG:A,calc:B}=n;return[{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ye(n)),zn(n)),{display:"inline-block",width:C,margin:0,padding:0,borderRadius:i}),Bt(n,{[`${t}-handler-wrap`]:{background:p,[`${t}-handler-down`]:{borderBlockStart:`${X(a)} ${r} ${k}`}}})),Vt(n,{[`${t}-handler-wrap`]:{background:D,[`${t}-handler-down`]:{borderBlockStart:`${X(a)} ${r} ${k}`}},"&:focus-within":{[`${t}-handler-wrap`]:{background:p}}})),Pt(n,{[`${t}-handler-wrap`]:{background:p,[`${t}-handler-down`]:{borderBlockStart:`${X(a)} ${r} ${k}`}}})),Lt(n)),{"&-rtl":{direction:"rtl",[`${t}-input`]:{direction:"rtl"}},"&-lg":{padding:0,fontSize:c,lineHeight:A,borderRadius:P,[`input${t}-input`]:{height:B(l).sub(B(a).mul(2)).equal(),padding:`${X(f)} ${X(v)}`}},"&-sm":{padding:0,fontSize:s,borderRadius:$,[`input${t}-input`]:{height:B(u).sub(B(a).mul(2)).equal(),padding:`${X(g)} ${X(d)}`}},"&-out-of-range":{[`${t}-input-wrap`]:{input:{color:m}}},"&-group":Object.assign(Object.assign(Object.assign({},Ye(n)),Wt(n)),{"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",textAlign:"start",verticalAlign:"top",[`${t}-affix-wrapper`]:{width:"100%"},"&-lg":{[`${t}-group-addon`]:{borderRadius:P,fontSize:n.fontSizeLG}},"&-sm":{[`${t}-group-addon`]:{borderRadius:$}}},Gt(n)),qt(n)),{[`&:not(${t}-compact-first-item):not(${t}-compact-last-item)${t}-compact-item`]:{[`${t}, ${t}-group-addon`]:{borderRadius:0}},[`&:not(${t}-compact-last-item)${t}-compact-first-item`]:{[`${t}, ${t}-group-addon`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${t}-compact-first-item)${t}-compact-last-item`]:{[`${t}, ${t}-group-addon`]:{borderStartStartRadius:0,borderEndStartRadius:0}}})}),[`&-disabled ${t}-input`]:{cursor:"not-allowed"},[t]:{"&-input":Object.assign(Object.assign(Object.assign(Object.assign({},Ye(n)),{width:"100%",padding:`${X(E)} ${X(y)}`,textAlign:"start",backgroundColor:"transparent",border:0,borderRadius:i,outline:0,transition:`all ${x} linear`,appearance:"textfield",fontSize:"inherit"}),Ht(n.colorTextPlaceholder)),{'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':{margin:0,appearance:"none"}})},[`&:hover ${t}-handler-wrap, &-focused ${t}-handler-wrap`]:{width:n.handleWidth,opacity:1}})},{[t]:Object.assign(Object.assign(Object.assign({[`${t}-handler-wrap`]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,width:n.handleVisibleWidth,opacity:h,height:"100%",borderStartStartRadius:0,borderStartEndRadius:i,borderEndEndRadius:i,borderEndStartRadius:0,display:"flex",flexDirection:"column",alignItems:"stretch",transition:`all ${x}`,overflow:"hidden",[`${t}-handler`]:{display:"flex",alignItems:"center",justifyContent:"center",flex:"auto",height:"40%",[`
|
|
2
|
+
${t}-handler-up-inner,
|
|
3
|
+
${t}-handler-down-inner
|
|
4
|
+
`]:{marginInlineEnd:0,fontSize:n.handleFontSize}}},[`${t}-handler`]:{height:"50%",overflow:"hidden",color:j,fontWeight:"bold",lineHeight:0,textAlign:"center",cursor:"pointer",borderInlineStart:`${X(a)} ${r} ${k}`,transition:`all ${x} linear`,"&:active":{background:_},"&:hover":{height:"60%",[`
|
|
5
|
+
${t}-handler-up-inner,
|
|
6
|
+
${t}-handler-down-inner
|
|
7
|
+
`]:{color:S}},"&-up-inner, &-down-inner":Object.assign(Object.assign({},pt()),{color:j,transition:`all ${x} linear`,userSelect:"none"})},[`${t}-handler-up`]:{borderStartEndRadius:i},[`${t}-handler-down`]:{borderEndEndRadius:i}},Dn(n,"lg")),Dn(n,"sm")),{"&-disabled, &-readonly":{[`${t}-handler-wrap`]:{display:"none"},[`${t}-input`]:{color:"inherit"}},[`
|
|
8
|
+
${t}-handler-up-disabled,
|
|
9
|
+
${t}-handler-down-disabled
|
|
10
|
+
`]:{cursor:"not-allowed"},[`
|
|
11
|
+
${t}-handler-up-disabled:hover &-handler-up-inner,
|
|
12
|
+
${t}-handler-down-disabled:hover &-handler-down-inner
|
|
13
|
+
`]:{color:O}})}]},hi=n=>{const{componentCls:t,paddingBlock:a,paddingInline:r,inputAffixPadding:i,controlWidth:s,borderRadiusLG:c,borderRadiusSM:l,paddingInlineLG:u,paddingInlineSM:m,paddingBlockLG:d,paddingBlockSM:g,motionDurationMid:f}=n;return{[`${t}-affix-wrapper`]:Object.assign(Object.assign({[`input${t}-input`]:{padding:`${X(a)} 0`}},zn(n)),{position:"relative",display:"inline-flex",alignItems:"center",width:s,padding:0,paddingInlineStart:r,"&-lg":{borderRadius:c,paddingInlineStart:u,[`input${t}-input`]:{padding:`${X(d)} 0`}},"&-sm":{borderRadius:l,paddingInlineStart:m,[`input${t}-input`]:{padding:`${X(g)} 0`}},[`&:not(${t}-disabled):hover`]:{zIndex:1},"&-focused, &:focus":{zIndex:1},[`&-disabled > ${t}-disabled`]:{background:"transparent"},[`> div${t}`]:{width:"100%",border:"none",outline:"none",[`&${t}-focused`]:{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},[`${t}-handler-wrap`]:{zIndex:2},[t]:{position:"static",color:"inherit","&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center",pointerEvents:"none"},"&-prefix":{marginInlineEnd:i},"&-suffix":{insetBlockStart:0,insetInlineEnd:0,height:"100%",marginInlineEnd:r,marginInlineStart:i,transition:`margin ${f}`}},[`&:hover ${t}-handler-wrap, &-focused ${t}-handler-wrap`]:{width:n.handleWidth,opacity:1},[`&:not(${t}-affix-wrapper-without-controls):hover ${t}-suffix`]:{marginInlineEnd:n.calc(n.handleWidth).add(r).equal()}}),[`${t}-underlined`]:{borderRadius:0}}},mi=gt("InputNumber",n=>{const t=ht(n,zt(n));return[gi(t),hi(t),mt(t)]},fi,{unitless:{handleOpacity:!0},resetFont:!1});var pi=function(n,t){var a={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.indexOf(r)<0&&(a[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(a[r[i]]=n[r[i]]);return a};const Wn=o.forwardRef((n,t)=>{const{getPrefixCls:a,direction:r}=o.useContext(xt),i=o.useRef(null);o.useImperativeHandle(t,()=>i.current);const{className:s,rootClassName:c,size:l,disabled:u,prefixCls:m,addonBefore:d,addonAfter:g,prefix:f,suffix:v,bordered:j,readOnly:x,status:S,controls:h,variant:y}=n,E=pi(n,["className","rootClassName","size","disabled","prefixCls","addonBefore","addonAfter","prefix","suffix","bordered","readOnly","status","controls","variant"]),p=a("input-number",m),_=yt(p),[O,$,P]=mi(p,_),{compactSize:C,compactItemClassnames:k}=vt(p,r);let D=o.createElement(Yt,{className:`${p}-handler-up-inner`}),A=o.createElement(Ct,{className:`${p}-handler-down-inner`});const B=typeof h=="boolean"?h:void 0;typeof h=="object"&&(D=typeof h.upIcon>"u"?D:o.createElement("span",{className:`${p}-handler-up-inner`},h.upIcon),A=typeof h.downIcon>"u"?A:o.createElement("span",{className:`${p}-handler-down-inner`},h.downIcon));const{hasFeedback:J,status:te,isFormItemInput:He,feedbackIcon:De}=o.useContext(jt),ae=It(te,S),re=bt(M=>{var he;return(he=l??C)!==null&&he!==void 0?he:M}),Te=o.useContext(wt),fe=u??Te,[ve,Y]=St("inputNumber",y,j),se=J&&o.createElement(o.Fragment,null,De),ge=ie({[`${p}-lg`]:re==="large",[`${p}-sm`]:re==="small",[`${p}-rtl`]:r==="rtl",[`${p}-in-form-item`]:He},$),We=`${p}-group`,$e=o.createElement(ui,Object.assign({ref:i,disabled:fe,className:ie(P,_,s,c,k),upHandler:D,downHandler:A,prefixCls:p,readOnly:x,controls:B,prefix:f,suffix:se||v,addonBefore:d&&o.createElement(Cn,{form:!0,space:!0},d),addonAfter:g&&o.createElement(Cn,{form:!0,space:!0},g),classNames:{input:ge,variant:ie({[`${p}-${ve}`]:Y},Sn(p,ae,J)),affixWrapper:ie({[`${p}-affix-wrapper-sm`]:re==="small",[`${p}-affix-wrapper-lg`]:re==="large",[`${p}-affix-wrapper-rtl`]:r==="rtl",[`${p}-affix-wrapper-without-controls`]:h===!1||fe||x},$),wrapper:ie({[`${We}-rtl`]:r==="rtl"},$),groupWrapper:ie({[`${p}-group-wrapper-sm`]:re==="small",[`${p}-group-wrapper-lg`]:re==="large",[`${p}-group-wrapper-rtl`]:r==="rtl",[`${p}-group-wrapper-${ve}`]:Y},Sn(`${p}-group-wrapper`,ae,J),$)}},E));return O($e)}),K=Wn,xi=n=>o.createElement(kt,{theme:{components:{InputNumber:{handleVisible:!0}}}},o.createElement(Wn,Object.assign({},n)));K._InternalPanelDoNotUseOrYouWillBeFired=xi;var yi={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"},vi=function(t,a){return o.createElement(rn,de({},t,{ref:a,icon:yi}))},Gn=o.forwardRef(vi),ji={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},bi=function(t,a){return o.createElement(rn,de({},t,{ref:a,icon:ji}))},wi=o.forwardRef(bi);function Si(){const{t:n}=H(),t=Be(),[a]=w.useForm(),{config:r,isLoading:i,updateAsync:s,validate:c,isUpdating:l,isValidating:u}=Ft(),{handleError:m,handleSuccess:d}=ke();return o.useEffect(()=>{if(r){const x=Ci(r);a.setFieldsValue(x)}},[r,a]),{form:a,config:r,isLoading:i,isUpdating:l,isValidating:u,handleSave:async()=>{try{const x=a.getFieldsValue();await s(x),d(n("config.saveSuccess"))}catch(x){const S=In(x),h=ki(S,n);m(S,h)}},handleValidate:()=>{a.validateFields().then(x=>{c(x)})},handleTargetChange:async()=>{try{const x=a.getFieldsValue(),S={...Ii(r),...x,targets:x.targets};await s(S)}catch(x){const S=In(x),h=ye(S.code,n,S.params,n("config.saveFailed"))??n("config.saveFailed");m(S,h)}},getConfigPreview:()=>JSON.stringify(a.getFieldsValue(),null,2),refreshConfig:()=>t.invalidateQueries({queryKey:ue.CONFIG})}}const Ci=n=>{const{_meta:t,_validation:a,...r}=n;return{...r,targets:Array.isArray(r.targets)?r.targets:[]}},Ii=n=>{if(!n)return{};const{_meta:t,_validation:a,...r}=n;return r},ki=(n,t)=>{if(n.code==="CONFIG_INVALID"&&Array.isArray(n.details)){const a=n.details.map(r=>{if(typeof r=="object"&&r&&"code"in r){const{code:i,params:s}=r;return ye(i,t,s)}return String(r)});return`${ye(n.code,t)}: ${a.join(", ")}`}return ye(n.code,t,n.params,n.message)||n.message||t("config.saveFailed")};function Ei(n=!1){const[t,a]=o.useState(n),[r,i]=o.useState(void 0),[s,c]=o.useState(void 0),[l,u]=o.useState(void 0),m=o.useCallback((j,x)=>{a(!0),j&&(i(j),x&&(u(x),V.loading({content:j,key:x,duration:0})))},[]),d=o.useCallback(j=>{a(!1),i(void 0),c(void 0),l&&(V.destroy(l),j&&V.success({content:j,key:l,duration:2}),u(void 0))},[l]),g=o.useCallback(j=>{c(Math.max(0,Math.min(100,j)))},[]),f=o.useCallback(j=>{i(j),l&&V.loading({content:j,key:l,duration:0})},[l]);return{...o.useMemo(()=>({loading:t,message:r,progress:s}),[t,r,s]),startLoading:m,stopLoading:d,updateProgress:g,updateMessage:f,setLoading:a}}const Ni="config-import";function Di(n){const{t}=H(),a=Be(),{refetch:r}=Ve(),{handleWarning:i,handleSuccess:s,handleError:c}=ke(),{loading:l,startLoading:u,stopLoading:m}=Ei(),d=o.useMemo(()=>{if(!n)return null;const{_meta:h,_validation:y,...E}=n;return E},[n]),g=o.useCallback(()=>{if(!d){i(t("config.configNotLoaded"));return}const h=JSON.stringify(d,null,2),y=new Blob([h],{type:"application/json"}),E=URL.createObjectURL(y),p=document.createElement("a");p.href=E,p.download=`config-${new Date().toISOString().split("T")[0]}.json`,p.click(),URL.revokeObjectURL(E),s(t("config.configExported"))},[d,s,i,t]),f=o.useCallback(async h=>{const y=await new Promise(($,P)=>{const C=new FileReader;C.onload=k=>$(k.target?.result??""),C.onerror=()=>P(new Error(t("config.configReadFailed",{defaultValue:"Failed to read config file"}))),C.readAsText(h)}),E=JSON.parse(y);if(typeof E!="object"||E===null)throw new Error(t("config.configFormatError"));const{_meta:p,_validation:_,...O}=E;return O},[t]),v=o.useCallback(()=>{const h=document.createElement("input");h.type="file",h.accept=".json",h.multiple=!0,h.onchange=async y=>{const E=y.target,p=Array.from(E.files??[]);if(p.length===0)return;u(void 0,Ni);let _=0,O=0;const $=[];let P=null;try{for(const C of p){let k;try{k=await f(C)}catch(D){O++,$.push(`${C.name}: ${D instanceof Error?D.message:t("config.configFormatError")}`);continue}try{const D=await Ze.validateConfig(k);if(!D.valid){const A=Array.isArray(D.errors)&&D.errors.length>0?D.errors.join(", "):t("config.validationFailed");O++,$.push(`${C.name}: ${A}`);continue}}catch(D){console.warn("[Config Import] Validation error:",D)}try{const D=C.name.replace(/\.json$/i,"").replace(/^standalone\.config\./i,""),A=new Date().toISOString().split("T")[0],B=D?`${D}-${A}`:`imported-${A}`;P=(await Ze.importConfigFile(k,B)).path,_++}catch(D){const{message:A}=ze(D);O++,$.push(`${C.name}: ${A||(D instanceof Error?D.message:t("config.unknownError"))}`)}}if(P)try{await Ze.switchConfigFile(P)}catch(C){c(C)}if(await a.invalidateQueries({queryKey:ue.CONFIG}),await a.invalidateQueries({queryKey:ue.CONFIG_FILES}),r(),_>0&&O===0)s(p.length===1?t("config.configImportedAndSaved"):t("config.configBatchImportedSuccess",{count:_}));else if(_>0&&O>0)V.warning(t("config.configBatchImportedPartial",{success:_,total:p.length,failed:O})),console.warn(`[Config Import] Failed files:
|
|
14
|
+
`,$.join(`
|
|
15
|
+
`));else{const C=p.length===1?`${t("config.configImportFailed")}: ${$[0]||t("config.unknownError")}`:t("config.configBatchImportedFailed",{count:O});V.error(C)}}finally{m()}},h.click()},[c,s,f,a,r,u,m,t]),j=o.useCallback(async h=>{try{await navigator.clipboard.writeText(h),s(t("config.configCopied"))}catch(y){c(y,t("config.clipboardCopyFailed",{defaultValue:"Failed to copy config to clipboard"}))}},[c,s,t]),x=o.useCallback(()=>{setTimeout(()=>{window.location.reload()},1e3)},[]),S=o.useCallback(()=>{setTimeout(()=>{window.location.reload()},1e3)},[]);return{handleExportConfig:g,handleImportConfig:v,handleCopyConfig:j,handleConfigFileSwitch:x,handleConfigApplied:S,isImporting:l}}function Ti(){const[n,t]=o.useState(!1),[a,r]=o.useState(!1),[i,s]=o.useState(null),c=o.useCallback(()=>{t(!0)},[]),l=o.useCallback(()=>{t(!1)},[]),u=o.useCallback(d=>{s(d),r(!0)},[]),m=o.useCallback(()=>{r(!1),s(null)},[]);return{previewVisible:n,jsonEditorVisible:a,editingConfigFile:i,openPreview:c,closePreview:l,openJsonEditor:u,closeJsonEditor:m}}function $i(){const[n,t]=o.useState("files"),a=o.useCallback(r=>{t(r)},[]);return{activeTab:n,setActiveTab:a}}const{Title:Fi,Text:Ri}=oe,{Option:Ai}=U;function _i({currentConfigPath:n,configFiles:t,onConfigFileSwitch:a,refetchConfigFiles:r}){const{t:i}=H(),s=Be(),{handleError:c,handleSuccess:l}=ke(),u=t?.find(d=>d.isActive),m=async d=>{const g=t.find(f=>f.filename===d);if(g&&!g.isActive)try{await _e.switchConfigFile(g.path),l(i("config.configSwitched")),await s.invalidateQueries({queryKey:ue.CONFIG}),await s.invalidateQueries({queryKey:ue.CONFIG_FILES}),await Promise.resolve(r()),await Promise.resolve(a())}catch(f){c(f,i("config.configSwitchFailed"))}};return e.jsxs("div",{style:{flex:"1 1 auto",minWidth:200},children:[e.jsx(Fi,{level:2,style:{margin:0,whiteSpace:"normal",wordBreak:"normal"},children:i("config.title")}),e.jsxs(T,{direction:"vertical",size:"small",style:{marginTop:8},children:[e.jsxs(Ri,{type:"secondary",style:{fontSize:12},children:[i("config.currentConfigFile"),": ",n]}),t&&t.length>0&&e.jsx(U,{value:u?.filename||void 0,onChange:m,style:{width:300,fontSize:12},placeholder:i("config.selectConfigFile"),size:"small",children:t.map(d=>e.jsxs(Ai,{value:d.filename,children:[d.isActive&&e.jsx(Ie,{color:"green",style:{marginRight:8},children:i("config.activeConfig")}),d.filename]},d.filename))})]})]})}function Oi({onRefresh:n,onPreview:t,onExport:a,onImport:r,onCopy:i,onValidate:s,onSave:c,isValidating:l,isUpdating:u,isImporting:m=!1}){const{t:d}=H(),{authenticated:g}=At(),f=!g,v=d("common.loginRequired");return e.jsxs(T,{wrap:!0,children:[e.jsx(R,{icon:e.jsx(on,{}),onClick:n,children:d("common.refresh")}),e.jsx(R,{icon:e.jsx(On,{}),onClick:t,children:d("config.previewConfig")}),e.jsx(R,{icon:e.jsx(Et,{}),onClick:a,children:d("config.exportConfig")}),e.jsx(W,{title:f?v:void 0,children:e.jsx(R,{icon:e.jsx(wi,{}),onClick:r,loading:m,disabled:m||f,children:d("config.importConfig")})}),e.jsx(R,{icon:e.jsx(ln,{}),onClick:i,children:d("config.copyConfig")}),e.jsx(R,{icon:e.jsx(Ut,{}),onClick:s,loading:l,children:d("config.validateConfig")}),e.jsx(W,{title:f?v:void 0,children:e.jsx(R,{type:"primary",icon:e.jsx(Gn,{}),onClick:c,loading:u,disabled:f,children:d("config.saveConfig")})})]})}const{Panel:Mi}=Pe,{Title:en,Text:nn}=oe,Ne=({title:n,description:t,children:a,collapsible:r=!1,defaultCollapsed:i=!1,card:s=!0,extra:c,style:l,className:u})=>r?e.jsx(Pe,{defaultActiveKey:i?[]:["1"],style:l,className:u,children:e.jsx(Mi,{header:e.jsxs(T,{direction:"vertical",size:0,children:[e.jsx(en,{level:5,style:{margin:0},children:n}),t&&e.jsx(nn,{type:"secondary",style:{fontSize:12},children:t})]}),extra:c,children:a},"1")}):s?e.jsx(Ee,{title:e.jsxs(T,{direction:"vertical",size:0,children:[e.jsx(en,{level:5,style:{margin:0},children:n}),t&&e.jsx(nn,{type:"secondary",style:{fontSize:12},children:t})]}),extra:c,style:l,className:u,children:a}):e.jsx("div",{style:l,className:u,children:e.jsxs(T,{direction:"vertical",size:8,style:{width:"100%"},children:[e.jsx(en,{level:5,style:{margin:0},children:n}),t&&e.jsx(nn,{type:"secondary",style:{fontSize:12},children:t}),a]})}),{Option:Re}=U,zi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabBasic"),children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[n("config.logLevel"),e.jsx(W,{title:n("config.logLevelTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"logLevel",children:e.jsxs(U,{children:[e.jsx(Re,{value:"debug",children:n("config.logLevelDebug")}),e.jsx(Re,{value:"info",children:n("config.logLevelInfo")}),e.jsx(Re,{value:"warn",children:n("config.logLevelWarn")}),e.jsx(Re,{value:"error",children:n("config.logLevelError")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[n("config.initialDelay"),e.jsx(W,{title:n("config.initialDelayTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"initialDelay",children:e.jsx(K,{min:0,style:{width:"100%"},placeholder:n("config.initialDelayPlaceholder")})})]})},{Option:Ae}=U,Bi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabNetwork"),children:[e.jsx(w.Item,{label:n("config.networkTimeout"),name:["network","timeoutMs"],children:e.jsx(K,{min:1e3,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.networkRetries"),name:["network","retries"],children:e.jsx(K,{min:0,max:10,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.networkRetryDelay"),name:["network","retryDelay"],children:e.jsx(K,{min:0,style:{width:"100%"}})}),e.jsx(Jt,{children:n("config.proxySettings")}),e.jsx(w.Item,{label:n("config.proxyEnabled"),name:["network","proxy","enabled"],valuePropName:"checked",children:e.jsx(Vn,{})}),e.jsx(w.Item,{noStyle:!0,shouldUpdate:(t,a)=>t.network?.proxy?.enabled!==a.network?.proxy?.enabled,children:({getFieldValue:t})=>t(["network","proxy","enabled"])?e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{label:n("config.proxyHost"),name:["network","proxy","host"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.proxyPort"),name:["network","proxy","port"],children:e.jsx(K,{min:1,max:65535,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.proxyProtocol"),name:["network","proxy","protocol"],children:e.jsxs(U,{children:[e.jsx(Ae,{value:"http",children:"HTTP"}),e.jsx(Ae,{value:"https",children:"HTTPS"}),e.jsx(Ae,{value:"socks4",children:"SOCKS4"}),e.jsx(Ae,{value:"socks5",children:"SOCKS5"})]})}),e.jsx(w.Item,{label:n("config.proxyUsername"),name:["network","proxy","username"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.proxyPassword"),name:["network","proxy","password"],children:e.jsx(Q.Password,{})})]}):null})]})},{Option:z,OptGroup:xe}=U,Vi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabStorage"),children:[e.jsx(w.Item,{label:n("config.storageDatabasePath"),name:["storage","databasePath"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageDownloadDirectory"),name:["storage","downloadDirectory"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageIllustrationDirectory"),name:["storage","illustrationDirectory"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageNovelDirectory"),name:["storage","novelDirectory"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageIllustrationOrganization"),name:["storage","illustrationOrganization"],tooltip:n("config.storageIllustrationOrganizationTooltip"),children:e.jsxs(U,{children:[e.jsxs(xe,{label:n("config.organizationGroupSimple"),children:[e.jsx(z,{value:"flat",children:n("config.organizationFlat")}),e.jsx(z,{value:"byAuthor",children:n("config.organizationByAuthor")}),e.jsx(z,{value:"byTag",children:n("config.organizationByTag")})]}),e.jsxs(xe,{label:n("config.organizationGroupDate"),children:[e.jsx(z,{value:"byDate",children:n("config.organizationByDate")}),e.jsx(z,{value:"byDay",children:n("config.organizationByDay")}),e.jsx(z,{value:"byDownloadDate",children:n("config.organizationByDownloadDate")}),e.jsx(z,{value:"byDownloadDay",children:n("config.organizationByDownloadDay")})]}),e.jsxs(xe,{label:n("config.organizationGroupCombined"),children:[e.jsx(z,{value:"byAuthorAndTag",children:n("config.organizationByAuthorAndTag")}),e.jsx(z,{value:"byDateAndAuthor",children:n("config.organizationByDateAndAuthor")}),e.jsx(z,{value:"byDayAndAuthor",children:n("config.organizationByDayAndAuthor")}),e.jsx(z,{value:"byDownloadDateAndAuthor",children:n("config.organizationByDownloadDateAndAuthor")}),e.jsx(z,{value:"byDownloadDayAndAuthor",children:n("config.organizationByDownloadDayAndAuthor")})]})]})}),e.jsx(w.Item,{label:n("config.storageNovelOrganization"),name:["storage","novelOrganization"],tooltip:n("config.storageNovelOrganizationTooltip"),children:e.jsxs(U,{children:[e.jsxs(xe,{label:n("config.organizationGroupSimple"),children:[e.jsx(z,{value:"flat",children:n("config.organizationFlat")}),e.jsx(z,{value:"byAuthor",children:n("config.organizationByAuthor")}),e.jsx(z,{value:"byTag",children:n("config.organizationByTag")})]}),e.jsxs(xe,{label:n("config.organizationGroupDate"),children:[e.jsx(z,{value:"byDate",children:n("config.organizationByDate")}),e.jsx(z,{value:"byDay",children:n("config.organizationByDay")}),e.jsx(z,{value:"byDownloadDate",children:n("config.organizationByDownloadDate")}),e.jsx(z,{value:"byDownloadDay",children:n("config.organizationByDownloadDay")})]}),e.jsxs(xe,{label:n("config.organizationGroupCombined"),children:[e.jsx(z,{value:"byAuthorAndTag",children:n("config.organizationByAuthorAndTag")}),e.jsx(z,{value:"byDateAndAuthor",children:n("config.organizationByDateAndAuthor")}),e.jsx(z,{value:"byDayAndAuthor",children:n("config.organizationByDayAndAuthor")}),e.jsx(z,{value:"byDownloadDateAndAuthor",children:n("config.organizationByDownloadDateAndAuthor")}),e.jsx(z,{value:"byDownloadDayAndAuthor",children:n("config.organizationByDownloadDayAndAuthor")})]})]})})]})},Pi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabScheduler"),children:[e.jsx(w.Item,{label:n("config.schedulerEnabled"),name:["scheduler","enabled"],valuePropName:"checked",children:e.jsx(Vn,{})}),e.jsx(w.Item,{label:n("config.schedulerCron"),name:["scheduler","cron"],children:e.jsx(Q,{placeholder:n("config.schedulerCronPlaceholder")})}),e.jsx(w.Item,{label:n("config.schedulerTimezone"),name:["scheduler","timezone"],children:e.jsx(Q,{placeholder:n("config.schedulerTimezonePlaceholder")})}),e.jsx(w.Item,{label:n("config.schedulerMaxExecutions"),name:["scheduler","maxExecutions"],children:e.jsx(K,{min:1,style:{width:"100%"},placeholder:n("config.schedulerMaxExecutionsPlaceholder")})}),e.jsx(w.Item,{label:n("config.schedulerMinInterval"),name:["scheduler","minInterval"],children:e.jsx(K,{min:0,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.schedulerTimeout"),name:["scheduler","timeout"],children:e.jsx(K,{min:1e3,style:{width:"100%"},placeholder:n("config.schedulerTimeoutPlaceholder")})})]})},Li=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabDownload"),children:[e.jsx(w.Item,{label:n("config.downloadConcurrency"),name:["download","concurrency"],children:e.jsx(K,{min:1,max:10,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.downloadMaxRetries"),name:["download","maxRetries"],children:e.jsx(K,{min:0,max:10,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.downloadRetryDelay"),name:["download","retryDelay"],children:e.jsx(K,{min:0,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.downloadTimeout"),name:["download","timeout"],children:e.jsx(K,{min:1e3,style:{width:"100%"}})})]})},{Option:L}=U,{Panel:tn}=Pe,{Step:Tn}=Pn,{Text:Hi,Paragraph:Wi}=oe,Gi=({visible:n,editingTarget:t,onSave:a,onCancel:r})=>{const{t:i}=H(),[s]=w.useForm(),[c,l]=o.useState(0),u={tagSearch:{name:i("config.templateTagSearch"),description:i("config.templateTagSearchDesc"),config:{type:"illustration",mode:"search",tag:"",limit:20,searchTarget:"partial_match_for_tags",sort:"date_desc"}},ranking:{name:i("config.templateRanking"),description:i("config.templateRankingDesc"),config:{type:"illustration",mode:"ranking",rankingMode:"day",limit:30}},multiTag:{name:i("config.templateMultiTag"),description:i("config.templateMultiTagDesc"),config:{type:"illustration",mode:"search",tag:"",limit:30,searchTarget:"partial_match_for_tags"}},highQuality:{name:i("config.templateHighQuality"),description:i("config.templateHighQualityDesc"),config:{type:"illustration",mode:"search",tag:"",limit:20,minBookmarks:1e3,sort:"popular_desc"}},novel:{name:i("config.templateNovel"),description:i("config.templateNovelDesc"),config:{type:"novel",mode:"search",tag:"",limit:10}}};o.useEffect(()=>{n&&(t?(s.setFieldsValue(t),l(1)):(s.resetFields(),l(0)))},[n,t,s]);const m=f=>{s.setFieldsValue(f.config),l(1)},d=async()=>{try{const f=await s.validateFields();a(f),s.resetFields(),l(0)}catch{}},g=()=>{s.resetFields(),l(0),r()};return e.jsxs(cn,{title:e.jsxs(T,{children:[i(t?"config.editTarget":"config.addTarget"),!t&&e.jsx(W,{title:i("config.templateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),open:n,onOk:d,onCancel:g,width:800,okText:i("common.save"),cancelText:i("common.cancel"),children:[e.jsxs(Pn,{current:c,style:{marginBottom:24},children:[e.jsx(Tn,{title:i("config.stepSelectTemplate"),description:i("config.stepSelectTemplateDesc")}),e.jsx(Tn,{title:i("config.stepConfigure"),description:i("config.stepConfigureDesc")})]}),c===0&&!t&&e.jsxs("div",{children:[e.jsx(Wi,{type:"secondary",style:{marginBottom:16},children:i("config.templateSelectDescription")}),e.jsxs(T,{direction:"vertical",style:{width:"100%"},size:"middle",children:[Object.entries(u).map(([f,v])=>e.jsx(Ee,{hoverable:!0,style:{cursor:"pointer"},onClick:()=>m(v),children:e.jsxs(T,{style:{width:"100%",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx(oe.Title,{level:5,style:{margin:0},children:v.name}),e.jsx(Hi,{type:"secondary",children:v.description})]}),e.jsx(R,{type:"primary",icon:e.jsx(Ln,{}),children:i("config.useTemplate")})]})},f)),e.jsx(R,{block:!0,type:"dashed",onClick:()=>l(1),style:{marginTop:8},children:i("config.skipTemplate")})]})]}),c===1&&e.jsx(w,{form:s,layout:"vertical",children:e.jsxs(Pe,{defaultActiveKey:["basic"],ghost:!0,children:[e.jsxs(tn,{header:i("config.targetBasicSettings"),children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetType"),e.jsx(W,{title:i("config.targetTypeTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"type",rules:[{required:!0,message:i("config.targetTypeRequired")}],children:e.jsxs(U,{children:[e.jsx(L,{value:"illustration",children:i("config.typeIllustration")}),e.jsx(L,{value:"novel",children:i("config.typeNovel")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetMode"),e.jsx(W,{title:i("config.targetModeTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"mode",initialValue:"search",children:e.jsxs(U,{children:[e.jsx(L,{value:"search",children:i("config.modeSearch")}),e.jsx(L,{value:"ranking",children:i("config.modeRanking")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetLimit"),e.jsx(W,{title:i("config.targetLimitTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"limit",rules:[{type:"number",min:1,max:1e3,message:i("config.targetLimitRange")}],children:e.jsx(K,{min:1,max:1e3,style:{width:"100%"},placeholder:i("config.targetLimitPlaceholder")})})]},"basic"),e.jsx(tn,{header:i("config.targetModeSettings"),children:e.jsx(w.Item,{noStyle:!0,shouldUpdate:(f,v)=>f.mode!==v.mode,children:({getFieldValue:f})=>(f("mode")||"search")==="search"?e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetTag"),e.jsx(W,{title:i("config.targetTagTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"tag",rules:[{validator:(j,x)=>!x||x.trim()===""?Promise.reject(new Error(i("config.targetTagRequired"))):Promise.resolve()}],children:e.jsx(Q,{placeholder:i("config.targetTagPlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.searchTarget"),e.jsx(W,{title:i("config.searchTargetTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"searchTarget",initialValue:"partial_match_for_tags",children:e.jsxs(U,{children:[e.jsxs(L,{value:"partial_match_for_tags",children:[i("config.searchTargetPartial")," (",i("common.recommended"),")"]}),e.jsx(L,{value:"exact_match_for_tags",children:i("config.searchTargetExact")}),e.jsx(L,{value:"title_and_caption",children:i("config.searchTargetTitle")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.sort"),e.jsx(W,{title:i("config.sortTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"sort",initialValue:"date_desc",children:e.jsxs(U,{children:[e.jsx(L,{value:"date_desc",children:i("config.sortDateDesc")}),e.jsx(L,{value:"date_asc",children:i("config.sortDateAsc")}),e.jsx(L,{value:"popular_desc",children:i("config.sortPopularDesc")})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.rankingMode"),e.jsx(W,{title:i("config.rankingModeTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"rankingMode",initialValue:"day",children:e.jsxs(U,{children:[e.jsx(L,{value:"day",children:i("config.rankingDay")}),e.jsx(L,{value:"week",children:i("config.rankingWeek")}),e.jsx(L,{value:"month",children:i("config.rankingMonth")}),e.jsx(L,{value:"day_male",children:i("config.rankingDayMale")}),e.jsx(L,{value:"day_female",children:i("config.rankingDayFemale")}),e.jsx(L,{value:"day_ai",children:i("config.rankingDayAI")}),e.jsx(L,{value:"week_original",children:i("config.rankingWeekOriginal")}),e.jsx(L,{value:"week_rookie",children:i("config.rankingWeekRookie")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.rankingDate"),e.jsx(W,{title:i("config.rankingDateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"rankingDate",children:e.jsx(Q,{placeholder:i("config.rankingDatePlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.filterTag"),e.jsx(W,{title:i("config.filterTagTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"filterTag",children:e.jsx(Q,{placeholder:i("config.filterTagPlaceholder")})})]})})},"mode"),e.jsxs(tn,{header:i("config.targetAdvancedFilters"),children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.minBookmarks"),e.jsx(W,{title:i("config.minBookmarksTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"minBookmarks",children:e.jsx(K,{min:0,style:{width:"100%"},placeholder:i("config.minBookmarksPlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.startDate"),e.jsx(W,{title:i("config.startDateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"startDate",children:e.jsx(Q,{placeholder:i("config.startDatePlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.endDate"),e.jsx(W,{title:i("config.endDateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"endDate",children:e.jsx(Q,{placeholder:i("config.endDatePlaceholder")})})]},"advanced")]})})]})};function qi(){const{t:n}=H();return e.jsx(Ce,{message:n("config.targetsTitle"),description:n("config.targetsDescription"),type:"info",showIcon:!0})}const{Text:Z}=oe;function Ui({targets:n,onAdd:t,onEdit:a,onDelete:r}){const{t:i}=H(),s=o.useMemo(()=>[{title:i("config.targetType"),dataIndex:"type",key:"type",width:100,render:c=>e.jsx(Ie,{color:c==="illustration"?"blue":"green",children:i(c==="illustration"?"config.typeIllustration":"config.typeNovel")})},{title:i("config.targetMode"),dataIndex:"mode",key:"mode",width:100,render:c=>c?e.jsx(Ie,{color:c==="ranking"?"purple":"cyan",children:i(c==="ranking"?"config.modeRanking":"config.modeSearch")}):"-"},{title:i("config.targetConfig"),key:"config",render:(c,l)=>{if(l.mode==="ranking"){const u={day:i("config.rankingDay"),week:i("config.rankingWeek"),month:i("config.rankingMonth"),day_male:i("config.rankingDayMale"),day_female:i("config.rankingDayFemale"),day_ai:i("config.rankingDayAI"),week_original:i("config.rankingWeekOriginal"),week_rookie:i("config.rankingWeekRookie")};return e.jsxs(T,{direction:"vertical",size:"small",style:{fontSize:12},children:[e.jsx(Z,{strong:!0,children:u[l.rankingMode||"day"]||l.rankingMode}),l.filterTag&&e.jsxs(Z,{type:"secondary",children:[i("config.filterTag"),": ",l.filterTag]}),l.rankingDate&&e.jsxs(Z,{type:"secondary",children:[i("config.rankingDate"),": ",l.rankingDate]})]})}return l.seriesId?e.jsxs(Z,{children:[i("config.seriesId"),": ",l.seriesId]}):l.novelId?e.jsxs(Z,{children:[i("config.novelId"),": ",l.novelId]}):e.jsxs(T,{direction:"vertical",size:"small",style:{fontSize:12},children:[e.jsx(Z,{strong:!0,children:l.tag||"-"}),l.searchTarget&&e.jsx(Z,{type:"secondary",children:l.searchTarget==="partial_match_for_tags"?i("config.searchTargetPartial"):l.searchTarget==="exact_match_for_tags"?i("config.searchTargetExact"):i("config.searchTargetTitle")}),l.sort&&e.jsx(Z,{type:"secondary",children:l.sort==="date_desc"?i("config.sortDateDesc"):l.sort==="date_asc"?i("config.sortDateAsc"):i("config.sortPopularDesc")})]})}},{title:i("config.targetFilters"),key:"filters",width:150,render:(c,l)=>e.jsxs(T,{direction:"vertical",size:"small",style:{fontSize:12},children:[l.limit&&e.jsxs(Z,{children:[i("config.limit"),": ",l.limit]}),l.minBookmarks&&e.jsxs(Z,{type:"secondary",children:[i("config.minBookmarks")," ≥ ",l.minBookmarks]}),(l.startDate||l.endDate)&&e.jsxs(Z,{type:"secondary",children:[l.startDate&&`${i("config.from")} ${l.startDate}`,l.endDate&&` ${i("config.to")} ${l.endDate}`]})]})},{title:i("common.actions"),key:"action",width:150,render:(c,l,u)=>e.jsxs(T,{children:[e.jsx(R,{type:"link",icon:e.jsx(Bn,{}),onClick:()=>a(l,u),size:"small",children:i("common.edit")}),e.jsx(dn,{title:i("config.deleteTargetConfirm"),onConfirm:()=>r(u),okText:i("common.ok"),cancelText:i("common.cancel"),children:e.jsx(R,{type:"link",danger:!0,icon:e.jsx(un,{}),size:"small",children:i("common.delete")})})]})}],[r,a,i]);return e.jsx(Ee,{title:i("config.targetsList"),extra:e.jsx(R,{icon:e.jsx(Ln,{}),onClick:t,children:i("config.addTarget")}),children:e.jsx(sn,{columns:s,dataSource:n,rowKey:c=>c._rowKey?c._rowKey:String(c._index??c.tag??c.mode??"target"),pagination:!1,locale:{emptyText:i("config.targetsEmpty")}})})}const Ki=({form:n,onTargetChange:t})=>{const[a,r]=o.useState(!1),[i,s]=o.useState(null);o.useEffect(()=>{const j=n.getFieldValue("targets");Array.isArray(j)||n.setFieldsValue({targets:[]})},[n]);const c=w.useWatch("targets",n)||n.getFieldValue("targets")||[],l=o.useCallback(()=>{t&&t()},[t]),u=o.useCallback(()=>{s(null),r(!0)},[]),m=o.useCallback((j,x)=>{s({...j,_index:x}),r(!0)},[]),d=o.useCallback(j=>{const S=(n.getFieldValue("targets")||[]).filter((h,y)=>y!==j);n.setFieldsValue({targets:S}),l()},[n,l]),g=o.useCallback(j=>{const S=[...n.getFieldValue("targets")||[]];i&&typeof i._index=="number"?S[i._index]=j:S.push(j),n.setFieldsValue({targets:S}),r(!1),s(null),l()},[i,n,l]),f=o.useCallback(()=>{r(!1),s(null)},[]),v=o.useMemo(()=>c.map((j,x)=>({...j,_index:x,_rowKey:`${j.type||"target"}-${x}`})),[c]);return e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{name:"targets",hidden:!0,children:e.jsx("input",{type:"hidden"})}),e.jsxs(T,{direction:"vertical",style:{width:"100%"},size:"large",children:[e.jsx(qi,{}),e.jsx(Ui,{targets:v,onAdd:u,onEdit:m,onDelete:d})]}),e.jsx(Gi,{visible:a,editingTarget:i,onSave:g,onCancel:f})]})},qn=({value:n,onChange:t,language:a="text",readOnly:r=!1,placeholder:i="Enter code...",minHeight:s=200,maxHeight:c=600,showCopyButton:l=!0,style:u,className:m})=>{const d=o.useRef(null),[g,f]=o.useState(!1),v=h=>{t&&t(h.target.value)},j=async()=>{try{await navigator.clipboard.writeText(n),f(!0),V.success("Copied to clipboard"),setTimeout(()=>f(!1),2e3)}catch{V.error("Failed to copy")}},x=h=>{if(a==="json"&&!r){const y=h.clipboardData.getData("text");try{const E=JSON.parse(y),p=JSON.stringify(E,null,2);h.preventDefault(),t&&t(p)}catch{}}},S={fontFamily:'Monaco, Menlo, "Ubuntu Mono", Consolas, "source-code-pro", monospace',fontSize:"14px",lineHeight:"1.6",padding:"12px",border:"1px solid #d9d9d9",borderRadius:"4px",backgroundColor:a==="json"?"#1f1f1f":"#fff",color:a==="json"?"#fff":"#000",minHeight:`${s}px`,maxHeight:`${c}px`,overflow:"auto",resize:"vertical",width:"100%",...u};return e.jsxs("div",{className:m,children:[l&&e.jsx(T,{style:{marginBottom:8,justifyContent:"flex-end",width:"100%"},children:e.jsx(R,{size:"small",icon:g?e.jsx(Nt,{}):e.jsx(ln,{}),onClick:j,disabled:!n,children:g?"Copied":"Copy"})}),e.jsx("textarea",{ref:d,value:n,onChange:v,onPaste:x,readOnly:r,placeholder:i,style:S,spellCheck:!1})]})},Un=({visible:n,filename:t,onClose:a,onConfigFileSwitch:r})=>{const{t:i}=H(),s=Be(),{configFiles:c,refetch:l}=Ve(),[u,m]=o.useState(""),[d,g]=o.useState(!1),[f,v]=o.useState(""),[j,x]=o.useState(!1),[S,h]=o.useState(!1),y=o.useRef(""),E=o.useRef(""),p=o.useRef(!1);o.useEffect(()=>{n&&t?_():(m(""),v(""),x(!1),y.current="",E.current="")},[n,t]),o.useEffect(()=>{if(!n||!t||p.current)return;let C,k=!0;const D=async()=>{if(!(!k||!t||p.current))try{const B=(await _e.getConfigFileContent(t)).data.data.content,J=y.current,te=E.current;B!==J&&B!==te&&!p.current?(x(!0),v(B),y.current=B):B===te?(x(!1),v(B),y.current=B):p.current||(v(B),y.current=B)}catch(A){console.warn("Failed to poll config file content:",A)}};return D(),C=setInterval(()=>{p.current||D()},5e3),()=>{k=!1,C&&clearInterval(C)}},[n,t,S]),o.useEffect(()=>{y.current=f},[f]),o.useEffect(()=>{E.current=u},[u]),o.useEffect(()=>{p.current=S},[S]);const _=async()=>{try{g(!0);const k=(await _e.getConfigFileContent(t)).data.data.content;m(k),v(k),y.current=k,E.current=k,x(!1)}catch(C){const{message:k}=ze(C),D=C instanceof Error?C.message:void 0;V.error(`${i("config.configFileReadFailed")}: ${k||D||i("config.unknownError")}`)}finally{g(!1)}},O=async()=>{await _(),V.success(i("config.jsonEditorRefreshed"))},$=async()=>{if(t)try{g(!0);try{JSON.parse(u)}catch{V.error(i("config.jsonFormatError"));return}await _e.updateConfigFileContent(t,u),V.success(i("config.configSaved")),v(u),y.current=u,E.current=u,x(!1),h(!1),p.current=!1,await s.invalidateQueries({queryKey:ue.CONFIG}),await s.invalidateQueries({queryKey:ue.CONFIG_FILES}),l(),c?.find(k=>k.filename===t&&k.isActive)?r?r():setTimeout(()=>{window.location.reload()},1e3):a()}catch(C){const{errorCode:k,message:D,details:A}=ze(C);if(k==="CONFIG_INVALID"&&A&&Array.isArray(A)){const B=A.map(J=>{if(typeof J=="object"&&J!==null&&"code"in J){const te=J;return ye(te.code,i,te.params)}return String(J)});V.error(`${ye(k,i)}: ${B.join(", ")}`)}else V.error(D||i("config.configSaveFailed"))}finally{g(!1)}},P=()=>{try{const C=JSON.parse(u),k=JSON.stringify(C,null,2);m(k),V.success(i("config.jsonFormatted"))}catch{V.error(i("config.jsonFormatError"))}};return e.jsx(cn,{title:e.jsxs(T,{children:[i("config.editJson"),e.jsxs("span",{style:{color:"#999",fontSize:14},children:["(",t,")"]})]}),open:n,onCancel:a,width:900,footer:[e.jsx(R,{onClick:P,children:i("config.formatJson")},"format"),e.jsx(R,{onClick:a,children:i("common.cancel")},"cancel"),e.jsx(R,{type:"primary",icon:e.jsx(Gn,{}),loading:d,onClick:$,children:i("config.saveConfig")},"save")],children:e.jsxs(Dt,{spinning:d&&!u,children:[j&&e.jsx(Ce,{message:i("config.jsonEditorExternalChanges"),description:i("config.jsonEditorExternalChangesDesc"),type:"warning",showIcon:!0,style:{marginBottom:16},action:e.jsx(R,{size:"small",onClick:O,children:i("config.refresh")})}),e.jsx(qn,{value:u,onChange:C=>{m(C),h(!0),p.current=!0,j&&C!==f&&x(!1)},language:"json",minHeight:400,maxHeight:600,placeholder:i("config.jsonEditorPlaceholder")}),e.jsx(Ce,{message:i("config.jsonEditorWarning"),type:"warning",showIcon:!0,style:{marginTop:16}})]})})},{Text:$n}=oe,Ji=({onConfigFileSwitch:n,onJsonEditorOpen:t})=>{const{t:a}=H(),{configFiles:r,isLoading:i,refetch:s,switchFileAsync:c,deleteFileAsync:l}=Ve(),{handleError:u}=ke(),[m,d]=o.useState(!1),[g,f]=o.useState(null),v=async h=>{if(t){t(h);return}try{f(h),d(!0)}catch(y){const{message:E}=ze(y),p=y instanceof Error?y:null;V.error(`${a("config.configFileReadFailed")}: ${E||p?.message||a("config.unknownError")}`)}},j=async h=>{if(!h.isActive)try{await c(h.path),V.success(a("config.configSwitched")),n&&n()}catch(y){u(y)}},x=async h=>{try{await l(h),V.success(a("config.configFileDeleted")),s()}catch(y){u(y)}},S=[{title:a("config.fileName"),dataIndex:"filename",key:"filename",render:(h,y)=>e.jsxs(T,{children:[e.jsx($n,{strong:y.isActive,children:h}),y.isActive&&e.jsx(Ie,{color:"green",children:a("config.activeConfig")})]})},{title:a("config.filePath"),dataIndex:"pathRelative",key:"pathRelative",render:h=>e.jsx($n,{type:"secondary",style:{fontSize:12},children:h})},{title:a("config.fileModified"),dataIndex:"modifiedTime",key:"modifiedTime",render:h=>new Date(h).toLocaleString()},{title:a("config.fileSize"),dataIndex:"size",key:"size",render:h=>`${(h/1024).toFixed(2)} KB`},{title:a("common.actions"),key:"action",width:250,render:(h,y)=>e.jsxs(T,{children:[e.jsx(R,{type:"link",icon:e.jsx(Bn,{}),onClick:()=>v(y.filename),size:"small",children:a("config.editJson")}),!y.isActive&&e.jsx(R,{type:"link",icon:e.jsx(Mn,{}),onClick:()=>j(y),size:"small",children:a("config.switch")}),e.jsx(dn,{title:a("config.deleteConfigFileConfirm"),onConfirm:()=>x(y.filename),okText:a("common.ok"),cancelText:a("common.cancel"),children:e.jsx(R,{type:"link",danger:!0,icon:e.jsx(un,{}),size:"small",children:a("common.delete")})})]})}];return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{title:a("config.configFiles"),extra:e.jsx(R,{icon:e.jsx(on,{}),onClick:()=>s(),children:a("common.refresh")}),children:r&&r.length>0?e.jsx(sn,{columns:S,dataSource:r,rowKey:"filename",loading:i,pagination:{pageSize:10},locale:{emptyText:a("config.configFilesEmpty")}}):e.jsx(Ce,{message:a("config.configFilesEmpty"),description:a("config.configFilesEmptyDesc"),type:"info",showIcon:!0})}),m&&g&&e.jsx(Un,{visible:m,filename:g,onClose:()=>{d(!1),f(null)},onConfigFileSwitch:n})]})},{Text:Fn}=oe,Qi=({onConfigApplied:n})=>{const{t}=H(),{history:a,isLoading:r,refetch:i,applyAsync:s,deleteAsync:c}=Rt(),{handleError:l}=ke(),u=async g=>{try{await s(g),V.success(t("config.configApplied")),n&&n()}catch(f){l(f)}},m=async g=>{try{await c(g),V.success(t("config.historyDeleted")),i()}catch(f){l(f)}},d=[{title:t("config.historyName"),dataIndex:"name",key:"name",render:(g,f)=>e.jsxs(T,{children:[e.jsx(Fn,{strong:f.is_active===1,children:g}),f.is_active===1&&e.jsx(Ie,{color:"green",children:t("config.activeConfig")})]})},{title:t("config.historyDescription"),dataIndex:"description",key:"description",render:g=>g||e.jsx(Fn,{type:"secondary",children:"-"})},{title:t("config.historyCreatedAt"),dataIndex:"created_at",key:"created_at",render:g=>new Date(g).toLocaleString()},{title:t("config.historyUpdatedAt"),dataIndex:"updated_at",key:"updated_at",render:g=>new Date(g).toLocaleString()},{title:t("common.actions"),key:"action",width:200,render:(g,f)=>e.jsxs(T,{children:[e.jsx(R,{type:"link",icon:e.jsx(Mn,{}),onClick:()=>u(f.id),size:"small",children:t("config.apply")}),e.jsx(dn,{title:t("config.deleteHistoryConfirm"),onConfirm:()=>m(f.id),okText:t("common.ok"),cancelText:t("common.cancel"),children:e.jsx(R,{type:"link",danger:!0,icon:e.jsx(un,{}),size:"small",children:t("common.delete")})})]})}];return e.jsx(Ee,{title:t("config.configHistory"),extra:e.jsx(R,{icon:e.jsx(on,{}),onClick:()=>i(),children:t("common.refresh")}),children:a&&a.length>0?e.jsx(sn,{columns:d,dataSource:a,rowKey:"id",loading:r,pagination:{pageSize:10},locale:{emptyText:t("config.historyEmpty")}}):e.jsx(Ce,{message:t("config.historyEmpty"),description:t("config.historyEmptyDesc"),type:"info",showIcon:!0})})},{Text:Xi}=oe;function Yi({form:n,onConfigFileSwitch:t,onJsonEditorOpen:a,onConfigApplied:r,onTargetChange:i}){const{t:s}=H(),c=o.useMemo(()=>[{key:"files",label:e.jsxs(e.Fragment,{children:[e.jsx(On,{})," ",s("config.tabConfigFiles")]}),children:e.jsx(Ji,{onConfigFileSwitch:t,onJsonEditorOpen:a})},{key:"history",label:e.jsxs(e.Fragment,{children:[e.jsx(Tt,{})," ",s("config.tabHistory")]}),children:e.jsx(Qi,{onConfigApplied:r})}],[r,t,a,s]),l=o.useMemo(()=>[{key:"basic",label:s("config.tabBasic"),children:e.jsx(zi,{})},{key:"pixiv",label:s("config.tabPixiv"),children:e.jsx("div",{children:e.jsx(Xi,{type:"secondary",children:s("config.pixivCredentialsHidden")})})},{key:"network",label:s("config.tabNetwork"),children:e.jsx(Bi,{})},{key:"storage",label:s("config.tabStorage"),children:e.jsx(Vi,{})},{key:"scheduler",label:s("config.tabScheduler"),children:e.jsx(Pi,{})},{key:"download",label:s("config.tabDownload"),children:e.jsx(Li,{})},{key:"targets",label:s("config.tabTargets"),children:e.jsx(Ki,{form:n,onTargetChange:i})}],[n,i,s]),u=o.useMemo(()=>[...c||[],...l||[]],[l,c]);return{managementTabItems:c,formTabItems:l,tabItems:u}}function Zi({form:n,activeTab:t,onTabChange:a,onConfigFileSwitch:r,onJsonEditorOpen:i,onConfigApplied:s,onTargetChange:c}){const{tabItems:l}=Yi({form:n,onConfigFileSwitch:r,onJsonEditorOpen:i,onConfigApplied:s,onTargetChange:c});return e.jsx(w,{form:n,layout:"vertical",children:e.jsx(Kt,{activeKey:t,onChange:a,items:l})})}function ea({visible:n,configPreview:t,onClose:a}){const{t:r}=H(),i=()=>{navigator.clipboard.writeText(t),V.success(r("config.configCopied"))};return e.jsx(cn,{title:r("config.previewConfig"),open:n,onCancel:a,footer:[e.jsx(R,{icon:e.jsx(ln,{}),onClick:i,children:r("common.copy")},"copy"),e.jsx(R,{onClick:a,children:r("common.close")},"close")],width:800,children:e.jsx(qn,{value:t,readOnly:!0,language:"json",minHeight:400,maxHeight:600})})}function xa(){const{t:n}=H(),{activeTab:t,setActiveTab:a}=$i(),{previewVisible:r,jsonEditorVisible:i,editingConfigFile:s,openPreview:c,closePreview:l,openJsonEditor:u,closeJsonEditor:m}=Ti(),{form:d,config:g,isLoading:f,isUpdating:v,isValidating:j,handleSave:x,handleValidate:S,handleTargetChange:h,getConfigPreview:y,refreshConfig:E}=Si(),{handleExportConfig:p,handleImportConfig:_,handleCopyConfig:O,handleConfigFileSwitch:$,handleConfigApplied:P,isImporting:C}=Di(g),{configFiles:k,refetch:D}=Ve();if(f)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"48px 0"},children:e.jsx($t,{})});const A=g?._meta?.configPathRelative??g?._meta?.configPath??n("config.unknown");return e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:16,width:"100%",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:16,flexWrap:"wrap"},children:[e.jsx(_i,{currentConfigPath:A,configFiles:k,onConfigFileSwitch:$,refetchConfigFiles:D}),e.jsx(Oi,{onRefresh:E,onPreview:c,onExport:p,onImport:_,onCopy:()=>O(y()),onValidate:S,onSave:x,isValidating:j,isUpdating:v,isImporting:C})]}),e.jsx(Zi,{form:d,activeTab:t,onTabChange:a,onConfigFileSwitch:$,onJsonEditorOpen:u,onConfigApplied:P,onTargetChange:h}),e.jsx(ea,{visible:r,configPreview:y(),onClose:l}),i&&s&&e.jsx(Un,{visible:i,filename:s,onClose:m,onConfigFileSwitch:$})]})}export{xa as default};
|
|
16
|
+
//# sourceMappingURL=Config-DRElCeDC.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as o,R as x,u as p,Q as f,b as S,r as g,s as c,j as s,S as j,B as y,c as w,d as v,e as R}from"./index-DG6kGbYq.js";import{R as u,C as i,a as d}from"./row-_c51T55h.js";import{S as h}from"./index-DarObP-C.js";import{R as m}from"./PictureOutlined-U51jGr2U.js";const b={async getStatsOverview(){return(await o.getStatsOverview()).data.data},async getDownloadStats(t){return(await o.getDownloadStats(t)).data.data},async getTagStats(t){return(await o.getTagStats(t)).data.data},async getAuthorStats(t){return(await o.getAuthorStats(t)).data.data}};function D(t=x.STATS_OVERVIEW){const{data:a,isLoading:e,error:r,refetch:l}=p({queryKey:f.STATS_OVERVIEW,queryFn:()=>b.getStatsOverview(),refetchInterval:t});return{stats:a,isLoading:e,error:r,refetch:l}}function C(){const{t}=S(),{stats:a,isLoading:e,refetch:r}=D(),l=g.useCallback(async()=>{c.loading({content:t("dashboard.refreshingStats"),key:"refresh-stats"});try{await r(),c.success({content:t("dashboard.statsRefreshed"),key:"refresh-stats",duration:2})}catch{c.error({content:t("dashboard.refreshStatsFailed"),key:"refresh-stats",duration:2})}},[r,t]);if(e)return s.jsx(j,{size:"large",style:{display:"block",textAlign:"center",marginTop:50}});const n=a||{totalDownloads:0,illustrations:0,novels:0,recentDownloads:0};return s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h2",{style:{margin:0},children:t("dashboard.title")}),s.jsx(y,{icon:s.jsx(w,{}),onClick:l,loading:e,children:t("dashboard.refreshStats")})]}),s.jsxs(u,{gutter:16,style:{marginTop:24},children:[s.jsx(i,{span:8,children:s.jsx(d,{children:s.jsx(h,{title:t("dashboard.totalDownloads"),value:n.totalDownloads,prefix:s.jsx(v,{})})})}),s.jsx(i,{span:8,children:s.jsx(d,{children:s.jsx(h,{title:t("dashboard.illustrations"),value:n.illustrations,prefix:s.jsx(m,{})})})}),s.jsx(i,{span:8,children:s.jsx(d,{children:s.jsx(h,{title:t("dashboard.novels"),value:n.novels,prefix:s.jsx(R,{})})})})]}),s.jsx(u,{gutter:16,style:{marginTop:16},children:s.jsx(i,{span:24,children:s.jsx(d,{title:t("dashboard.recentDownloads"),children:s.jsx("p",{children:t("dashboard.recentDownloadsDesc",{count:n.recentDownloads})})})})})]})}export{C as default};
|
|
2
|
+
//# sourceMappingURL=Dashboard-aqPMquSO.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,I as a,_ as r}from"./index-DG6kGbYq.js";var l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},n=function(t,c){return e.createElement(a,r({},t,{ref:c,icon:l}))},h=e.forwardRef(n);export{h as R};
|
|
2
|
+
//# sourceMappingURL=DeleteOutlined-BFmW1oWe.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as g,I as G,_ as X,b as C,j as e,d as fe,W as y,Y as oe,B as k,c as Q,Z as D,U as je,S as ye,s as f,Q as U,X as K,a as ae,u as Te}from"./index-DG6kGbYq.js";import{R as W,d as se,u as ke,a as Ce,b as Ie,c as ve}from"./useDownload-BlxvZNEm.js";import{R as re,C as Se,u as De}from"./useConfig-Ds7RpIL1.js";import{a as O,R as be,C as H}from"./row-_c51T55h.js";import{S as B}from"./index-DarObP-C.js";import{R as Z}from"./CheckCircleOutlined-H3DnUyMO.js";import{R as J}from"./CloseCircleOutlined-BFfS5iXd.js";import{u as Re,P as Ae,F as E}from"./useAuth-wCjAOx6S.js";import{T as R}from"./index-_EG4kaKN.js";import{f as b}from"./dateUtils-gQt2uAjS.js";import{D as I}from"./index-Bbsa44oT.js";import{T as F}from"./index-CJln3zA7.js";import{M as Y}from"./index-CDrp3NIf.js";import{R as V}from"./DeleteOutlined-BFmW1oWe.js";import{F as de}from"./useErrorHandler-BOvHue1w.js";import{P as ne}from"./index-CfHs6AUn.js";import{R as $e}from"./ClearOutlined-BpODq7I7.js";import{e as v,t as S}from"./errorCodeTranslator-BqIackMm.js";import"./socket-oqYz9cKb.js";var Me={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"},Fe=function(p,m){return g.createElement(G,X({},p,{ref:m,icon:Me}))},q=g.forwardRef(Fe),ze={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"}}]},name:"redo",theme:"outlined"},Oe=function(p,m){return g.createElement(G,X({},p,{ref:m,icon:ze}))},Le=g.forwardRef(Oe),Pe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},He=function(p,m){return g.createElement(G,X({},p,{ref:m,icon:Pe}))},z=g.forwardRef(He);const Be=({total:o,completed:p,failed:m,stopped:n})=>{const{t:l}=C();return e.jsx(O,{style:{marginBottom:16},children:e.jsxs(be,{gutter:16,children:[e.jsx(H,{span:6,children:e.jsx(B,{title:l("download.totalTasks"),value:o,prefix:e.jsx(fe,{})})}),e.jsx(H,{span:6,children:e.jsx(B,{title:l("download.completed"),value:p,valueStyle:{color:"#3f8600"},prefix:e.jsx(Z,{})})}),e.jsx(H,{span:6,children:e.jsx(B,{title:l("download.failed"),value:m,valueStyle:{color:"#cf1322"},prefix:e.jsx(J,{})})}),e.jsx(H,{span:6,children:e.jsx(B,{title:l("download.stopped"),value:n,valueStyle:{color:"#8c8c8c"},prefix:e.jsx(z,{})})})]})})},{Text:$}=R,Ee=({hasActiveTask:o,onStartClick:p,onRunAllClick:m,onStopClick:n,isStarting:l,isRunningAll:s,isStopping:d,storage:i,onRefreshConfig:u})=>{const{t}=C(),{authenticated:w}=Re(),r=!w,h=t("common.loginRequired"),a=i?.illustrationDirectory||(i?.downloadDirectory?`${i.downloadDirectory}/illustrations`:"./downloads/illustrations"),c=i?.novelDirectory||(i?.downloadDirectory?`${i.downloadDirectory}/novels`:"./downloads/novels");return e.jsxs(O,{title:e.jsxs(y,{children:[e.jsx(q,{}),e.jsx("span",{children:t("download.taskOperations")})]}),style:{marginBottom:16},children:[e.jsxs(y,{wrap:!0,children:[e.jsx(oe,{title:r?h:void 0,children:e.jsx(k,{type:"primary",size:"large",icon:e.jsx(re,{}),onClick:p,disabled:o||r,loading:l,children:t("download.startDownload")})}),e.jsx(oe,{title:r?h:void 0,children:e.jsx(k,{size:"large",icon:e.jsx(Q,{}),onClick:m,disabled:o||r,loading:s,children:t("download.downloadAll")})}),e.jsx(k,{danger:!0,size:"large",icon:e.jsx(z,{}),onClick:n,disabled:!o,loading:d,children:t("download.stopCurrent")})]}),o&&e.jsx(D,{message:t("download.hasActiveTask"),description:t("download.hasActiveTaskDesc"),type:"info",showIcon:!0,style:{marginTop:16}}),i&&e.jsx(D,{message:e.jsxs(y,{children:[e.jsx("span",{children:t("download.fileSavePath")}),u&&e.jsx(k,{type:"text",size:"small",icon:e.jsx(Q,{}),onClick:u,title:t("download.refreshPath")})]}),description:e.jsxs(y,{direction:"vertical",size:"small",style:{width:"100%"},children:[e.jsxs($,{children:[e.jsx($,{strong:!0,children:t("download.illustrationPath")}),a]}),e.jsxs($,{children:[e.jsx($,{strong:!0,children:t("download.novelPath")}),c]}),e.jsx($,{type:"secondary",style:{fontSize:"12px"},children:t("download.pathTip")})]}),type:"info",showIcon:!0,style:{marginTop:16}})]})},_e=({logs:o,isRunning:p=!1})=>{const{t:m}=C(),n=g.useRef(null);if(g.useEffect(()=>{n.current&&o.length>0&&n.current.scrollIntoView({behavior:"smooth"})},[o]),!o||o.length===0)return null;const l={error:"#ff4d4f",warn:"#faad14",info:"#1890ff",debug:"#8c8c8c"};return e.jsx("div",{style:{marginTop:16},children:e.jsx(Se,{items:[{key:"logs",label:e.jsxs(y,{children:[e.jsx(q,{}),e.jsxs("span",{children:[m("download.realtimeLogs")," (",o.length," ",m("download.entries"),")"]})]}),children:e.jsxs("div",{style:{maxHeight:"400px",overflowY:"auto",backgroundColor:"#1f1f1f",padding:"12px",borderRadius:"4px",fontFamily:"monospace",fontSize:"12px",lineHeight:"1.6"},children:[o.map((s,d)=>{const i=b(s.timestamp,{hour:"2-digit",minute:"2-digit",second:"2-digit"});return e.jsxs("div",{style:{marginBottom:"4px",color:l[s.level]||"#ffffff"},children:[e.jsxs("span",{style:{color:"#8c8c8c",marginRight:"8px"},children:["[",i,"]"]}),e.jsxs("span",{style:{color:l[s.level]||"#ffffff",marginRight:"8px",fontWeight:"bold"},children:["[",s.level.toUpperCase(),"]"]}),e.jsx("span",{children:s.message})]},d)}),e.jsx("div",{ref:n})]})}],defaultActiveKey:p?["logs"]:[]})})},{Text:N}=R,qe=({task:o,logs:p,onStop:m,isStopping:n})=>{const{t:l}=C(),s=i=>{const u={running:{color:"processing",icon:e.jsx(W,{}),text:l("download.statusRunning")},completed:{color:"success",icon:e.jsx(Z,{}),text:l("download.statusCompleted")},failed:{color:"error",icon:e.jsx(J,{}),text:l("download.statusFailed")},stopped:{color:"default",icon:e.jsx(z,{}),text:l("download.statusStopped")}},t=u[i]||u.running;return t?e.jsx(F,{color:t.color,icon:t.icon,children:t.text}):null},d=(i,u)=>{const t=new Date(i).getTime(),w=u?new Date(u).getTime():Date.now(),r=Math.floor((w-t)/1e3);if(r<60)return`${r} ${l("download.seconds")}`;if(r<3600){const h=Math.floor(r/60),a=r%60;return`${h} ${l("download.minutes")} ${a} ${l("download.seconds")}`}else{const h=Math.floor(r/3600),a=Math.floor(r%3600/60);return`${h} ${l("download.hours")} ${a} ${l("download.minutes")}`}};return e.jsxs(O,{title:e.jsxs(y,{children:[e.jsx(W,{}),e.jsx("span",{children:l("download.currentTask")})]}),style:{marginBottom:16},extra:e.jsx(k,{danger:!0,icon:e.jsx(z,{}),onClick:m,loading:n,children:l("download.stopTask")}),children:[e.jsxs(I,{column:2,bordered:!0,children:[e.jsx(I.Item,{label:l("download.taskId"),span:1,children:e.jsx(N,{code:!0,children:o.taskId})}),e.jsx(I.Item,{label:l("download.status"),span:1,children:s(o.status)}),e.jsx(I.Item,{label:l("download.startTime"),span:1,children:b(o.startTime)}),e.jsx(I.Item,{label:l("download.duration"),span:1,children:e.jsx(N,{strong:!0,children:d(new Date(o.startTime),o.endTime?new Date(o.endTime):void 0)})}),o.progress&&e.jsxs(I.Item,{label:l("download.progress"),span:2,children:[e.jsx(Ae,{percent:Math.round(o.progress.current/o.progress.total*100),status:o.status==="running"?"active":"success",format:()=>`${o.progress?.current||0} / ${o.progress?.total||0}`}),o.progress.message&&e.jsx(N,{type:"secondary",style:{display:"block",marginTop:8},children:o.progress.message})]}),o.endTime&&e.jsx(I.Item,{label:l("download.endTime"),span:2,children:b(o.endTime)}),o.error&&e.jsx(I.Item,{label:l("download.errorInfo"),span:2,children:e.jsx(D,{message:o.error,type:"error",showIcon:!0})})]}),p&&p.length>0&&e.jsx(_e,{logs:p,isRunning:o.status==="running"})]})},{Text:_}=R,Ke=({tasks:o,hasActiveTask:p,onRefresh:m,onResume:n,onDelete:l,onDeleteAll:s,isResuming:d,isDeleting:i,isDeletingAll:u})=>{const{t}=C();if(!o||o.length===0)return null;const w=[{title:t("download.tag"),dataIndex:"tag",key:"tag",width:150,render:r=>e.jsx(_,{strong:!0,children:r})},{title:t("download.type"),dataIndex:"type",key:"type",width:100,render:r=>e.jsx(F,{color:r==="illustration"?"blue":"purple",children:t(r==="illustration"?"download.typeIllustration":"download.typeNovel")})},{title:t("download.incompleteStatus"),dataIndex:"status",key:"status",width:120,render:r=>{const a={failed:{color:"error",text:t("download.statusFailed")},partial:{color:"warning",text:t("download.statusPartial")}}[r]||{color:"default",text:r};return e.jsx(F,{color:a.color,children:a.text})}},{title:t("download.errorMessage"),dataIndex:"message",key:"message",ellipsis:{showTitle:!1},width:300,render:r=>{if(!r)return e.jsx(_,{type:"secondary",children:"-"});const h=r.toLowerCase();let a=null;return h.includes("401")||h.includes("unauthorized")?a=t("download.error401"):h.includes("403")||h.includes("forbidden")?a=t("download.error403"):h.includes("timeout")||h.includes("timed out")?a=t("download.errorTimeout"):h.includes("failed after")&&(a=t("download.errorRetries")),e.jsxs("div",{children:[e.jsx(_,{type:"danger",ellipsis:{tooltip:r},children:r}),a&&e.jsx("div",{style:{marginTop:4},children:e.jsxs(_,{type:"secondary",style:{fontSize:"12px"},children:["💡 ",a]})})]})}},{title:t("download.executedAt"),dataIndex:"executedAt",key:"executedAt",width:180,render:r=>b(r)},{title:t("download.actions"),key:"action",width:150,fixed:"right",render:(r,h)=>e.jsxs(y,{children:[e.jsx(k,{type:"link",icon:e.jsx(Le,{}),onClick:()=>n(h.tag,h.type),disabled:p||d,loading:d,children:t("download.resumeDownload")}),e.jsx(k,{type:"link",danger:!0,icon:e.jsx(V,{}),onClick:()=>{Y.confirm({title:t("download.confirmDelete"),content:t("download.confirmDeleteDesc",{tag:h.tag,type:h.type==="illustration"?t("download.typeIllustration"):t("download.typeNovel")}),okText:t("common.delete"),okType:"danger",cancelText:t("common.cancel"),onOk:()=>l(h.id)})},disabled:i,loading:i,children:t("download.deleteTask")})]})}];return e.jsxs(O,{title:e.jsxs(y,{children:[e.jsx(q,{}),e.jsx("span",{children:t("download.incompleteTasks")})]}),style:{marginBottom:16},extra:e.jsxs(y,{children:[e.jsx(k,{size:"small",icon:e.jsx(Q,{}),onClick:m,children:t("download.refreshList")}),e.jsx(k,{size:"small",danger:!0,icon:e.jsx(V,{}),onClick:()=>{Y.confirm({title:t("download.confirmDeleteAll"),content:t("download.confirmDeleteAllDesc",{count:o.length}),okText:t("common.delete"),okType:"danger",cancelText:t("common.cancel"),onOk:s})},loading:u,disabled:u,children:t("download.deleteAll")})]}),children:[e.jsx(D,{message:t("download.incompleteTasksFound",{count:o.length}),description:t("download.incompleteTasksDesc"),type:"warning",showIcon:!0,style:{marginBottom:16}}),e.jsx(de,{columns:w,dataSource:o,rowKey:"id",pagination:{pageSize:10,showSizeChanger:!0,showTotal:r=>t("download.totalEntries",{total:r})},size:"small",scroll:{x:800}})]})},{Text:M}=R,Ne=({tasks:o,isLoading:p,calculateDuration:m})=>{const{t:n}=C(),l=je(),[s,d]=g.useState(null),[i,u]=g.useState(!1),t=async a=>{try{d(a),await se.deleteTaskHistory(a),f.success(n("download.deleteTaskHistorySuccess")),l.invalidateQueries({queryKey:U.DOWNLOAD_STATUS()})}catch(c){const x=c?.response?.data?.data?.message||c?.message||n("download.deleteTaskHistoryFailed");f.error(x)}finally{d(null)}},w=async()=>{try{u(!0);const a=await se.deleteAllTaskHistory();f.success(n("download.deleteAllTaskHistorySuccess",{count:a.deletedCount})),l.invalidateQueries({queryKey:U.DOWNLOAD_STATUS()})}catch(a){const c=a?.response?.data?.data?.message||a?.message||n("download.deleteAllTaskHistoryFailed");f.error(c)}finally{u(!1)}},r=a=>{const c={running:{color:"processing",icon:e.jsx(W,{}),text:n("download.statusRunning")},completed:{color:"success",icon:e.jsx(Z,{}),text:n("download.statusCompleted")},failed:{color:"error",icon:e.jsx(J,{}),text:n("download.statusFailed")},stopped:{color:"default",icon:e.jsx(z,{}),text:n("download.statusStopped")}},x=c[a]||c.running;return x?e.jsx(F,{color:x.color,icon:x.icon,children:x.text}):null},h=[{title:n("download.taskId"),dataIndex:"taskId",key:"taskId",width:120,render:a=>e.jsxs(M,{code:!0,children:[a.slice(0,8),"..."]})},{title:n("download.status"),dataIndex:"status",key:"status",width:100,render:a=>r(a)},{title:n("download.duration"),key:"duration",width:120,render:(a,c)=>m(new Date(c.startTime),c.endTime?new Date(c.endTime):void 0)},{title:n("download.startTime"),dataIndex:"startTime",key:"startTime",width:180,render:a=>b(a)},{title:n("download.endTime"),dataIndex:"endTime",key:"endTime",width:180,render:a=>b(a)},{title:n("download.errorInfo"),dataIndex:"error",key:"error",ellipsis:!0,render:a=>a?e.jsx(M,{type:"danger",ellipsis:{tooltip:a},children:a}):e.jsx(M,{type:"secondary",children:"-"})},{title:n("download.actions"),key:"actions",width:100,fixed:"right",render:(a,c)=>e.jsx(ne,{title:n("download.deleteTaskHistoryConfirm"),description:n("download.deleteTaskHistoryConfirmDesc",{taskId:c.taskId.slice(0,8)}),onConfirm:()=>t(c.taskId),okText:n("common.confirm"),cancelText:n("common.cancel"),okButtonProps:{danger:!0},children:e.jsx(k,{type:"link",danger:!0,size:"small",icon:e.jsx(V,{}),loading:s===c.taskId,disabled:c.status==="running",children:n("common.delete")})})}];return e.jsx(O,{title:e.jsxs(y,{children:[e.jsx(q,{}),e.jsx("span",{children:n("download.taskHistory")})]}),extra:o&&o.length>0?e.jsx(ne,{title:n("download.deleteAllTaskHistoryConfirm"),description:n("download.deleteAllTaskHistoryConfirmDesc",{count:o.length}),onConfirm:w,okText:n("common.confirm"),cancelText:n("common.cancel"),okButtonProps:{danger:!0},children:e.jsx(k,{danger:!0,size:"small",icon:e.jsx($e,{}),loading:i,children:n("download.deleteAll")})}):null,children:p?e.jsxs("div",{style:{textAlign:"center",padding:"40px 0"},children:[e.jsx(ye,{size:"large"}),e.jsx("div",{style:{marginTop:16},children:e.jsx(M,{type:"secondary",children:n("download.loadingHistory")})})]}):o&&o.length>0?e.jsx(de,{columns:h,dataSource:o,rowKey:"taskId",pagination:{pageSize:10,showSizeChanger:!0,showTotal:a=>n("download.taskRecords",{total:a}),pageSizeOptions:["10","20","50","100"]},size:"middle",scroll:{x:1e3}}):e.jsx("div",{style:{textAlign:"center",padding:"40px 0"},children:e.jsx(M,{type:"secondary",children:n("download.noHistory")})})})},{Text:le}=R,Qe=({open:o,onCancel:p,onFinish:m,isSubmitting:n,configFiles:l=[],targets:s=[]})=>{const{t:d}=C(),[i]=E.useForm(),u=()=>{i.resetFields(),p()};return e.jsxs(Y,{title:e.jsxs(y,{children:[e.jsx(re,{}),e.jsx("span",{children:d("download.startDownloadModal")})]}),open:o,onCancel:u,onOk:()=>i.submit(),confirmLoading:n,okText:d("common.start"),cancelText:d("common.cancel"),width:600,children:[e.jsx(D,{message:d("download.startDownloadTip"),description:d("download.startDownloadTipDesc"),type:"info",showIcon:!0,style:{marginBottom:24}}),e.jsxs(E,{form:i,onFinish:m,layout:"vertical",children:[e.jsx(E.Item,{name:"configPaths",label:d("download.selectConfigFiles"),tooltip:d("download.selectConfigFilesTooltip"),extra:d("download.selectConfigFilesExtra"),children:e.jsx(K,{mode:"multiple",placeholder:d("download.selectConfigFilesPlaceholder"),allowClear:!0,size:"large",showSearch:!0,filterOption:(t,w)=>w?.label?.toLowerCase().includes(t.toLowerCase())||!1,options:l.map(t=>({label:`${t.filename}${t.isActive?` (${d("config.activeConfig")})`:""}`,value:t.path}))})}),e.jsx(E.Item,{name:"targetId",label:d("download.selectTarget"),tooltip:d("download.selectTargetTooltip"),extra:d("download.selectTargetExtra"),children:e.jsx(K,{placeholder:d("download.selectTargetPlaceholder"),allowClear:!0,size:"large",showSearch:!0,filterOption:(t,w)=>{const r=w?.children;return(typeof r=="string"?r:String(r||"")).toLowerCase().includes(t.toLowerCase())},children:s.map((t,w)=>e.jsx(K.Option,{value:w.toString(),children:e.jsxs(y,{children:[e.jsx(F,{color:t.type==="illustration"?"blue":"purple",children:t.type==="illustration"?d("download.typeIllustration"):d("download.typeNovel")}),e.jsx(le,{strong:!0,children:t.tag||`Target ${w+1}`}),t.limit&&e.jsxs(le,{type:"secondary",children:["(",d("download.limit"),": ",t.limit," ",d("download.entries"),")"]})]})},w))})}),s.length===0&&e.jsx(D,{message:d("download.noTargetsFound"),description:d("download.noTargetsFoundDesc"),type:"warning",showIcon:!0})]})]})};function Ue(o,p,m,n,l){const{t:s}=C(),[d,i]=g.useState(!1),u=g.useCallback(async c=>{try{await o({targetId:c.targetId,configPaths:c.configPaths}),f.success(s("download.taskStarted")),i(!1)}catch(x){const{errorCode:j,message:T}=v(x);f.error(S(j,s,void 0,T||s("download.startFailed")))}},[o,s]),t=g.useCallback(async c=>{try{await p(c),f.success(s("download.taskStopped"))}catch(x){const{errorCode:j,message:T}=v(x);f.error(S(j,s,void 0,T||s("download.stopFailed")))}},[p,s]),w=g.useCallback(()=>{ae.runAllDownloads().then(()=>{f.success(s("download.allTargetsStarted"))}).catch(c=>{const{errorCode:x,message:j}=v(c);f.error(S(x,s,void 0,j||s("download.startFailed")))})},[s]),r=g.useCallback(async(c,x)=>{try{await m({tag:c,type:x}),f.success(s("download.taskResumedWithTag",{tag:c,type:s(x==="illustration"?"download.typeIllustration":"download.typeNovel")}))}catch(j){const{errorCode:T,message:A,params:L}=v(j);f.error(S(T,s,L,A||s("download.resumeFailed")))}},[m,s]),h=g.useCallback(async c=>{try{await n(c),f.success(s("download.incompleteTaskDeleted"))}catch(x){const{errorCode:j,message:T,params:A}=v(x);f.error(S(j,s,A,T||s("download.deleteFailed")))}},[n,s]),a=g.useCallback(async()=>{try{const x=(await l())?.deletedCount||0;x===0?f.info(s("download.noIncompleteTasks")):f.success(s("download.allIncompleteTasksDeleted",{count:x}))}catch(c){const{errorCode:x,message:j,params:T}=v(c);x?f.error(S(x,s,T,j||s("download.deleteAllFailed"))):f.error(j||s("download.deleteAllFailed")),console.error("Delete all incomplete tasks error:",c)}},[l,s]);return{showStartModal:d,setShowStartModal:i,handleStart:u,handleStop:t,handleRunAll:w,handleResume:r,handleDelete:h,handleDeleteAll:a}}function We(o){const{t:p}=C(),m=g.useMemo(()=>{const l=o||[],s=l.filter(u=>u.status==="completed").length,d=l.filter(u=>u.status==="failed").length,i=l.filter(u=>u.status==="stopped").length;return{total:l.length,completed:s,failed:d,stopped:i}},[o]),n=g.useCallback((l,s)=>{const d=new Date(l).getTime(),i=s?new Date(s).getTime():Date.now(),u=Math.floor((i-d)/1e3);if(u<60)return`${u} ${p("download.seconds")}`;if(u<3600){const t=Math.floor(u/60),w=u%60;return`${t} ${p("download.minutes")} ${w} ${p("download.seconds")}`}else{const t=Math.floor(u/3600),w=Math.floor(u%3600/60);return`${t} ${p("download.hours")} ${w} ${p("download.minutes")}`}},[p]);return{taskStats:m,calculateDuration:n}}const{Title:Ye,Paragraph:Ve}=R;function xt(){const{t:o}=C(),{startAsync:p,isStarting:m,stopAsync:n,isStopping:l}=ke(),{isLoading:s,hasActiveTask:d,activeTask:i,allTasks:u}=Ce(void 0,2e3),t=i?.taskId,{logs:w}=Ie(t,void 0,2e3),{tasks:r,refetch:h,resumeAsync:a,deleteAsync:c,deleteAllAsync:x,isResuming:j,isDeleting:T,isDeletingAll:A}=ve(),{config:L,refetch:ie}=De(),{data:ce}=Te({queryKey:U.CONFIG_FILES,queryFn:()=>ae.listConfigFiles()}),{showStartModal:ue,setShowStartModal:ee,handleStart:pe,handleStop:te,handleRunAll:me,handleResume:he,handleDelete:xe,handleDeleteAll:we}=Ue(p,n,a,c,x),{taskStats:P,calculateDuration:ge}=We(u);return e.jsxs("div",{children:[e.jsx(Ye,{level:2,children:o("download.title")}),e.jsx(Ve,{type:"secondary",style:{marginBottom:24},children:o("download.description")}),e.jsx(Be,{total:P.total,completed:P.completed,failed:P.failed,stopped:P.stopped}),e.jsx(Ee,{hasActiveTask:d,onStartClick:()=>ee(!0),onRunAllClick:me,onStopClick:()=>i?.taskId&&te(i.taskId),isStarting:m,isRunningAll:!1,isStopping:l,storage:L?.storage,onRefreshConfig:ie}),i&&e.jsx(qe,{task:i,logs:w,onStop:()=>i.taskId&&te(i.taskId),isStopping:l}),r&&r.length>0&&e.jsx(Ke,{tasks:r,hasActiveTask:d,onRefresh:h,onResume:he,onDelete:xe,onDeleteAll:we,isResuming:j,isDeleting:T,isDeletingAll:A}),e.jsx(Ne,{tasks:u||[],isLoading:s,calculateDuration:ge}),e.jsx(Qe,{open:ue,onCancel:()=>ee(!1),onFinish:pe,isSubmitting:m,configFiles:ce?.data?.data||[],targets:L?.targets||[]})]})}export{xt as default};
|
|
2
|
+
//# sourceMappingURL=Download-DCKDU51K.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{r as i,D as qe,a8 as Pt,n as Q,O as on,v as kt,x as st,z as an,A as Ye,ab as sn,a6 as Ct,ae as ln,h as fe,a5 as cn,aO as un,a4 as z,a3 as lt,i as W,aP as dn,m as fn,o as ke,a2 as je,_ as ee,a9 as mn,p as Nt,a7 as ct,I as Ee,F as Ie,aQ as gn,aA as vn,ad as He,aR as Te,aS as pn,E as zt,aF as Tt,aT as We,ac as hn,aD as xn,a as Ne,U as $t,u as Dt,Q as Ve,b as be,j as a,B as se,aH as wn,W as Oe,X as Re,aU as ut,e as dt,S as Lt,aN as yn,s as Ze,Z as rt}from"./index-DG6kGbYq.js";import{u as Ft}from"./errorCodeTranslator-BqIackMm.js";import{a as Cn,b as Me,u as vt,c as _t,F as bn,C as ot}from"./useErrorHandler-BOvHue1w.js";import{R as pt,C as Ce,a as ze}from"./row-_c51T55h.js";import{R as At,I as Sn}from"./index-DPigBPWX.js";import{R as Bt,a as Xt}from"./SortDescendingOutlined-CckVuL_b.js";import{S as Ae}from"./index-DarObP-C.js";import{R as Ue}from"./PictureOutlined-U51jGr2U.js";import{f as bt}from"./dateUtils-gQt2uAjS.js";import{T as Be}from"./index-CJln3zA7.js";import{P as jn}from"./index-CfHs6AUn.js";import{R as In}from"./DeleteOutlined-BFmW1oWe.js";import{D as On,g as Rn,i as En,M as Yt}from"./index-CDrp3NIf.js";import{T as Ht}from"./index-_EG4kaKN.js";import{D as ye}from"./index-Bbsa44oT.js";const Qe=({children:t})=>{const{getPrefixCls:e}=i.useContext(qe),n=e("breadcrumb");return i.createElement("li",{className:`${n}-separator`,"aria-hidden":"true"},t===""?t:t||"/")};Qe.__ANT_BREADCRUMB_SEPARATOR=!0;var Mn=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};function Pn(t,e){if(t.title===void 0||t.title===null)return null;const n=Object.keys(e).join("|");return typeof t.title=="object"?t.title:String(t.title).replace(new RegExp(`:(${n})`,"g"),(r,o)=>e[o]||r)}function Wt(t,e,n,r){if(n==null)return null;const{className:o,onClick:l}=e,u=Mn(e,["className","onClick"]),d=Object.assign(Object.assign({},Pt(u,{data:!0,aria:!0})),{onClick:l});return r!==void 0?i.createElement("a",Object.assign({},d,{className:Q(`${t}-link`,o),href:r}),n):i.createElement("span",Object.assign({},d,{className:Q(`${t}-link`,o)}),n)}function kn(t,e){return(r,o,l,u,d)=>{if(e)return e(r,o,l,u);const c=Pn(r,o);return Wt(t,r,c,d)}}var ft=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};const Vt=t=>{const{prefixCls:e,separator:n="/",children:r,menu:o,overlay:l,dropdownProps:u,href:d}=t,s=(g=>{if(o||l){const f=Object.assign({},u);if(o){const v=o||{},{items:x}=v,m=ft(v,["items"]);f.menu=Object.assign(Object.assign({},m),{items:x?.map((p,j)=>{var{key:w,title:M,label:R,path:I}=p,h=ft(p,["key","title","label","path"]);let b=R??M;return I&&(b=i.createElement("a",{href:`${d}${I}`},b)),Object.assign(Object.assign({},h),{key:w??j,label:b})})})}else l&&(f.overlay=l);return i.createElement(Cn,Object.assign({placement:"bottom"},f),i.createElement("span",{className:`${e}-overlay-link`},g,i.createElement(on,null)))}return g})(r);return s!=null?i.createElement(i.Fragment,null,i.createElement("li",null,s),n&&i.createElement(Qe,null,n)):null},Zt=t=>{const{prefixCls:e,children:n,href:r}=t,o=ft(t,["prefixCls","children","href"]),{getPrefixCls:l}=i.useContext(qe),u=l("breadcrumb",e);return i.createElement(Vt,Object.assign({},o,{prefixCls:u}),Wt(u,o,n,r))};Zt.__ANT_BREADCRUMB_ITEM=!0;const Nn=t=>{const{componentCls:e,iconCls:n,calc:r}=t;return{[e]:Object.assign(Object.assign({},an(t)),{color:t.itemColor,fontSize:t.fontSize,[n]:{fontSize:t.iconFontSize},ol:{display:"flex",flexWrap:"wrap",margin:0,padding:0,listStyle:"none"},a:Object.assign({color:t.linkColor,transition:`color ${t.motionDurationMid}`,padding:`0 ${Ye(t.paddingXXS)}`,borderRadius:t.borderRadiusSM,height:t.fontHeight,display:"inline-block",marginInline:r(t.marginXXS).mul(-1).equal(),"&:hover":{color:t.linkHoverColor,backgroundColor:t.colorBgTextHover}},sn(t)),"li:last-child":{color:t.lastItemColor},[`${e}-separator`]:{marginInline:t.separatorMargin,color:t.separatorColor},[`${e}-link`]:{[`
|
|
2
|
+
> ${n} + span,
|
|
3
|
+
> ${n} + a
|
|
4
|
+
`]:{marginInlineStart:t.marginXXS}},[`${e}-overlay-link`]:{borderRadius:t.borderRadiusSM,height:t.fontHeight,display:"inline-block",padding:`0 ${Ye(t.paddingXXS)}`,marginInline:r(t.marginXXS).mul(-1).equal(),[`> ${n}`]:{marginInlineStart:t.marginXXS,fontSize:t.fontSizeIcon},"&:hover":{color:t.linkHoverColor,backgroundColor:t.colorBgTextHover,a:{color:t.linkHoverColor}},a:{"&:hover":{backgroundColor:"transparent"}}},[`&${t.componentCls}-rtl`]:{direction:"rtl"}})}},zn=t=>({itemColor:t.colorTextDescription,lastItemColor:t.colorText,iconFontSize:t.fontSize,linkColor:t.colorTextDescription,linkHoverColor:t.colorText,separatorColor:t.colorTextDescription,separatorMargin:t.marginXS}),Tn=kt("Breadcrumb",t=>{const e=st(t,{});return Nn(e)},zn);var St=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};function $n(t){const{breadcrumbName:e,children:n}=t,r=St(t,["breadcrumbName","children"]),o=Object.assign({title:e},r);return n&&(o.menu={items:n.map(l=>{var{breadcrumbName:u}=l,d=St(l,["breadcrumbName"]);return Object.assign(Object.assign({},d),{title:u})})}),o}function Dn(t,e){return i.useMemo(()=>t||(e?e.map($n):null),[t,e])}var Ln=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};const Fn=(t,e)=>{if(e===void 0)return e;let n=(e||"").replace(/^\//,"");return Object.keys(t).forEach(r=>{n=n.replace(`:${r}`,t[r])}),n},ht=t=>{const{prefixCls:e,separator:n="/",style:r,className:o,rootClassName:l,routes:u,items:d,children:c,itemRender:s,params:g={}}=t,f=Ln(t,["prefixCls","separator","style","className","rootClassName","routes","items","children","itemRender","params"]),{getPrefixCls:v,direction:x,breadcrumb:m}=i.useContext(qe);let p;const j=v("breadcrumb",e),[w,M,R]=Tn(j),I=Dn(d,u),h=kn(j,s);if(I&&I.length>0){const y=[],E=d||u;p=I.map((O,C)=>{const{path:k,key:N,type:P,menu:T,overlay:$,onClick:B,className:G,separator:J,dropdownProps:V}=O,X=Fn(g,k);X!==void 0&&y.push(X);const K=N??C;if(P==="separator")return i.createElement(Qe,{key:K},J);const Y={},re=C===I.length-1;T?Y.menu=T:$&&(Y.overlay=$);let{href:Z}=O;return y.length&&X!==void 0&&(Z=`#/${y.join("/")}`),i.createElement(Vt,Object.assign({key:K},Y,Pt(O,{data:!0,aria:!0}),{className:G,dropdownProps:V,href:Z,separator:re?"":n,onClick:B,prefixCls:j}),h(O,g,E,y,Z))})}else if(c){const y=Ct(c).length;p=Ct(c).map((E,O)=>{if(!E)return E;const C=O===y-1;return ln(E,{separator:C?"":n,key:O})})}const b=Q(j,m?.className,{[`${j}-rtl`]:x==="rtl"},o,l,M,R),S=Object.assign(Object.assign({},m?.style),r);return w(i.createElement("nav",Object.assign({className:b,style:S},f),i.createElement("ol",null,p)))};ht.Item=Zt;ht.Separator=Qe;function Ut(){var t=document.documentElement.clientWidth,e=window.innerHeight||document.documentElement.clientHeight;return{width:t,height:e}}function _n(t){var e=t.getBoundingClientRect(),n=document.documentElement;return{left:e.left+(window.pageXOffset||n.scrollLeft)-(n.clientLeft||document.body.clientLeft||0),top:e.top+(window.pageYOffset||n.scrollTop)-(n.clientTop||document.body.clientTop||0)}}var $e=i.createContext(null),An=function(e){var n=e.visible,r=e.maskTransitionName,o=e.getContainer,l=e.prefixCls,u=e.rootClassName,d=e.icons,c=e.countRender,s=e.showSwitch,g=e.showProgress,f=e.current,v=e.transform,x=e.count,m=e.scale,p=e.minScale,j=e.maxScale,w=e.closeIcon,M=e.onActive,R=e.onClose,I=e.onZoomIn,h=e.onZoomOut,b=e.onRotateRight,S=e.onRotateLeft,y=e.onFlipX,E=e.onFlipY,O=e.onReset,C=e.toolbarRender,k=e.zIndex,N=e.image,P=i.useContext($e),T=d.rotateLeft,$=d.rotateRight,B=d.zoomIn,G=d.zoomOut,J=d.close,V=d.left,X=d.right,K=d.flipX,Y=d.flipY,re="".concat(l,"-operations-operation");i.useEffect(function(){var L=function(_){_.keyCode===lt.ESC&&R()};return n&&window.addEventListener("keydown",L),function(){window.removeEventListener("keydown",L)}},[n]);var Z=function(F,_){F.preventDefault(),F.stopPropagation(),M(_)},A=i.useCallback(function(L){var F=L.type,_=L.disabled,q=L.onClick,H=L.icon;return i.createElement("div",{key:F,className:Q(re,"".concat(l,"-operations-operation-").concat(F),fe({},"".concat(l,"-operations-operation-disabled"),!!_)),onClick:q},H)},[re,l]),de=s?A({icon:V,onClick:function(F){return Z(F,-1)},type:"prev",disabled:f===0}):void 0,oe=s?A({icon:X,onClick:function(F){return Z(F,1)},type:"next",disabled:f===x-1}):void 0,te=A({icon:Y,onClick:E,type:"flipY"}),D=A({icon:K,onClick:y,type:"flipX"}),le=A({icon:T,onClick:S,type:"rotateLeft"}),U=A({icon:$,onClick:b,type:"rotateRight"}),ne=A({icon:G,onClick:h,type:"zoomOut",disabled:m<=p}),ce=A({icon:B,onClick:I,type:"zoomIn",disabled:m===j}),me=i.createElement("div",{className:"".concat(l,"-operations")},te,D,le,U,ne,ce);return i.createElement(cn,{visible:n,motionName:r},function(L){var F=L.className,_=L.style;return i.createElement(un,{open:!0,getContainer:o??document.body},i.createElement("div",{className:Q("".concat(l,"-operations-wrapper"),F,u),style:z(z({},_),{},{zIndex:k})},w===null?null:i.createElement("button",{className:"".concat(l,"-close"),onClick:R},w||J),s&&i.createElement(i.Fragment,null,i.createElement("div",{className:Q("".concat(l,"-switch-left"),fe({},"".concat(l,"-switch-left-disabled"),f===0)),onClick:function(H){return Z(H,-1)}},V),i.createElement("div",{className:Q("".concat(l,"-switch-right"),fe({},"".concat(l,"-switch-right-disabled"),f===x-1)),onClick:function(H){return Z(H,1)}},X)),i.createElement("div",{className:"".concat(l,"-footer")},g&&i.createElement("div",{className:"".concat(l,"-progress")},c?c(f+1,x):i.createElement("bdi",null,"".concat(f+1," / ").concat(x))),C?C(me,z(z({icons:{prevIcon:de,nextIcon:oe,flipYIcon:te,flipXIcon:D,rotateLeftIcon:le,rotateRightIcon:U,zoomOutIcon:ne,zoomInIcon:ce},actions:{onActive:M,onFlipY:E,onFlipX:y,onRotateLeft:S,onRotateRight:b,onZoomOut:h,onZoomIn:I,onReset:O,onClose:R},transform:v},P?{current:f,total:x}:{}),{},{image:N})):me)))})},Xe={x:0,y:0,rotate:0,scale:1,flipX:!1,flipY:!1};function Bn(t,e,n,r){var o=i.useRef(null),l=i.useRef([]),u=i.useState(Xe),d=W(u,2),c=d[0],s=d[1],g=function(m){s(Xe),dn(Xe,c)||r?.({transform:Xe,action:m})},f=function(m,p){o.current===null&&(l.current=[],o.current=fn(function(){s(function(j){var w=j;return l.current.forEach(function(M){w=z(z({},w),M)}),o.current=null,r?.({transform:w,action:p}),w})})),l.current.push(z(z({},c),m))},v=function(m,p,j,w,M){var R=t.current,I=R.width,h=R.height,b=R.offsetWidth,S=R.offsetHeight,y=R.offsetLeft,E=R.offsetTop,O=m,C=c.scale*m;C>n?(C=n,O=n/c.scale):C<e&&(C=M?C:e,O=C/c.scale);var k=j??innerWidth/2,N=w??innerHeight/2,P=O-1,T=P*I*.5,$=P*h*.5,B=P*(k-c.x-y),G=P*(N-c.y-E),J=c.x-(B-T),V=c.y-(G-$);if(m<1&&C===1){var X=b*C,K=S*C,Y=Ut(),re=Y.width,Z=Y.height;X<=re&&K<=Z&&(J=0,V=0)}f({x:J,y:V,scale:C},p)};return{transform:c,resetTransform:g,updateTransform:f,dispatchZoomChange:v}}function jt(t,e,n,r){var o=e+n,l=(n-r)/2;if(n>r){if(e>0)return fe({},t,l);if(e<0&&o<r)return fe({},t,-l)}else if(e<0||o>r)return fe({},t,e<0?l:-l);return{}}function Gt(t,e,n,r){var o=Ut(),l=o.width,u=o.height,d=null;return t<=l&&e<=u?d={x:0,y:0}:(t>l||e>u)&&(d=z(z({},jt("x",n,t,l)),jt("y",r,e,u))),d}var Pe=1,Xn=1;function Yn(t,e,n,r,o,l,u){var d=o.rotate,c=o.scale,s=o.x,g=o.y,f=i.useState(!1),v=W(f,2),x=v[0],m=v[1],p=i.useRef({diffX:0,diffY:0,transformX:0,transformY:0}),j=function(h){!e||h.button!==0||(h.preventDefault(),h.stopPropagation(),p.current={diffX:h.pageX-s,diffY:h.pageY-g,transformX:s,transformY:g},m(!0))},w=function(h){n&&x&&l({x:h.pageX-p.current.diffX,y:h.pageY-p.current.diffY},"move")},M=function(){if(n&&x){m(!1);var h=p.current,b=h.transformX,S=h.transformY,y=s!==b&&g!==S;if(!y)return;var E=t.current.offsetWidth*c,O=t.current.offsetHeight*c,C=t.current.getBoundingClientRect(),k=C.left,N=C.top,P=d%180!==0,T=Gt(P?O:E,P?E:O,k,N);T&&l(z({},T),"dragRebound")}},R=function(h){if(!(!n||h.deltaY==0)){var b=Math.abs(h.deltaY/100),S=Math.min(b,Xn),y=Pe+S*r;h.deltaY>0&&(y=Pe/y),u(y,"wheel",h.clientX,h.clientY)}};return i.useEffect(function(){var I,h,b,S;if(e){b=Me(window,"mouseup",M,!1),S=Me(window,"mousemove",w,!1);try{window.top!==window.self&&(I=Me(window.top,"mouseup",M,!1),h=Me(window.top,"mousemove",w,!1))}catch{}}return function(){var y,E,O,C;(y=b)===null||y===void 0||y.remove(),(E=S)===null||E===void 0||E.remove(),(O=I)===null||O===void 0||O.remove(),(C=h)===null||C===void 0||C.remove()}},[n,x,s,g,d,e]),{isMoving:x,onMouseDown:j,onMouseMove:w,onMouseUp:M,onWheel:R}}function Hn(t){return new Promise(function(e){if(!t){e(!1);return}var n=document.createElement("img");n.onerror=function(){return e(!1)},n.onload=function(){return e(!0)},n.src=t})}function Kt(t){var e=t.src,n=t.isCustomPlaceholder,r=t.fallback,o=i.useState(n?"loading":"normal"),l=W(o,2),u=l[0],d=l[1],c=i.useRef(!1),s=u==="error";i.useEffect(function(){var x=!0;return Hn(e).then(function(m){!m&&x&&d("error")}),function(){x=!1}},[e]),i.useEffect(function(){n&&!c.current?d("loading"):s&&d("normal")},[e]);var g=function(){d("normal")},f=function(m){c.current=!1,u==="loading"&&m!==null&&m!==void 0&&m.complete&&(m.naturalWidth||m.naturalHeight)&&(c.current=!0,g())},v=s&&r?{src:r}:{onLoad:g,src:e};return[f,v,u]}function Ge(t,e){var n=t.x-e.x,r=t.y-e.y;return Math.hypot(n,r)}function Wn(t,e,n,r){var o=Ge(t,n),l=Ge(e,r);if(o===0&&l===0)return[t.x,t.y];var u=o/(o+l),d=t.x+u*(e.x-t.x),c=t.y+u*(e.y-t.y);return[d,c]}function Vn(t,e,n,r,o,l,u){var d=o.rotate,c=o.scale,s=o.x,g=o.y,f=i.useState(!1),v=W(f,2),x=v[0],m=v[1],p=i.useRef({point1:{x:0,y:0},point2:{x:0,y:0},eventType:"none"}),j=function(h){p.current=z(z({},p.current),h)},w=function(h){if(e){h.stopPropagation(),m(!0);var b=h.touches,S=b===void 0?[]:b;S.length>1?j({point1:{x:S[0].clientX,y:S[0].clientY},point2:{x:S[1].clientX,y:S[1].clientY},eventType:"touchZoom"}):j({point1:{x:S[0].clientX-s,y:S[0].clientY-g},eventType:"move"})}},M=function(h){var b=h.touches,S=b===void 0?[]:b,y=p.current,E=y.point1,O=y.point2,C=y.eventType;if(S.length>1&&C==="touchZoom"){var k={x:S[0].clientX,y:S[0].clientY},N={x:S[1].clientX,y:S[1].clientY},P=Wn(E,O,k,N),T=W(P,2),$=T[0],B=T[1],G=Ge(k,N)/Ge(E,O);u(G,"touchZoom",$,B,!0),j({point1:k,point2:N,eventType:"touchZoom"})}else C==="move"&&(l({x:S[0].clientX-E.x,y:S[0].clientY-E.y},"move"),j({eventType:"move"}))},R=function(){if(n){if(x&&m(!1),j({eventType:"none"}),r>c)return l({x:0,y:0,scale:r},"touchZoom");var h=t.current.offsetWidth*c,b=t.current.offsetHeight*c,S=t.current.getBoundingClientRect(),y=S.left,E=S.top,O=d%180!==0,C=Gt(O?b:h,O?h:b,y,E);C&&l(z({},C),"dragRebound")}};return i.useEffect(function(){var I;return n&&e&&(I=Me(window,"touchmove",function(h){return h.preventDefault()},{passive:!1})),function(){var h;(h=I)===null||h===void 0||h.remove()}},[n,e]),{isTouching:x,onTouchStart:w,onTouchMove:M,onTouchEnd:R}}var Zn=["fallback","src","imgRef"],Un=["prefixCls","src","alt","imageInfo","fallback","movable","onClose","visible","icons","rootClassName","closeIcon","getContainer","current","count","countRender","scaleStep","minScale","maxScale","transitionName","maskTransitionName","imageRender","imgCommonProps","toolbarRender","onTransform","onChange"],Gn=function(e){var n=e.fallback,r=e.src,o=e.imgRef,l=ke(e,Zn),u=Kt({src:r,fallback:n}),d=W(u,2),c=d[0],s=d[1];return je.createElement("img",ee({ref:function(f){o.current=f,c(f)}},l,s))},qt=function(e){var n=e.prefixCls,r=e.src,o=e.alt,l=e.imageInfo,u=e.fallback,d=e.movable,c=d===void 0?!0:d,s=e.onClose,g=e.visible,f=e.icons,v=f===void 0?{}:f,x=e.rootClassName,m=e.closeIcon,p=e.getContainer,j=e.current,w=j===void 0?0:j,M=e.count,R=M===void 0?1:M,I=e.countRender,h=e.scaleStep,b=h===void 0?.5:h,S=e.minScale,y=S===void 0?1:S,E=e.maxScale,O=E===void 0?50:E,C=e.transitionName,k=C===void 0?"zoom":C,N=e.maskTransitionName,P=N===void 0?"fade":N,T=e.imageRender,$=e.imgCommonProps,B=e.toolbarRender,G=e.onTransform,J=e.onChange,V=ke(e,Un),X=i.useRef(),K=i.useContext($e),Y=K&&R>1,re=K&&R>=1,Z=i.useState(!0),A=W(Z,2),de=A[0],oe=A[1],te=Bn(X,y,O,G),D=te.transform,le=te.resetTransform,U=te.updateTransform,ne=te.dispatchZoomChange,ce=Yn(X,c,g,b,D,U,ne),me=ce.isMoving,L=ce.onMouseDown,F=ce.onWheel,_=Vn(X,c,g,y,D,U,ne),q=_.isTouching,H=_.onTouchStart,pe=_.onTouchMove,Se=_.onTouchEnd,ge=D.rotate,ve=D.scale,Je=Q(fe({},"".concat(n,"-moving"),me));i.useEffect(function(){de||oe(!0)},[de]);var et=function(){le("close")},tt=function(){ne(Pe+b,"zoomIn")},he=function(){ne(Pe/(Pe+b),"zoomOut")},xe=function(){U({rotate:ge+90},"rotateRight")},De=function(){U({rotate:ge-90},"rotateLeft")},Le=function(){U({flipX:!D.flipX},"flipX")},Fe=function(){U({flipY:!D.flipY},"flipY")},tn=function(){le("reset")},nt=function(we){var _e=w+we;!Number.isInteger(_e)||_e<0||_e>R-1||(oe(!1),le(we<0?"prev":"next"),J?.(_e,w))},nn=function(we){!g||!Y||(we.keyCode===lt.LEFT?nt(-1):we.keyCode===lt.RIGHT&&nt(1))},rn=function(we){g&&(ve!==1?U({x:0,y:0,scale:1},"doubleClick"):ne(Pe+b,"doubleClick",we.clientX,we.clientY))};i.useEffect(function(){var ae=Me(window,"keydown",nn,!1);return function(){ae.remove()}},[g,Y,w]);var wt=je.createElement(Gn,ee({},$,{width:e.width,height:e.height,imgRef:X,className:"".concat(n,"-img"),alt:o,style:{transform:"translate3d(".concat(D.x,"px, ").concat(D.y,"px, 0) scale3d(").concat(D.flipX?"-":"").concat(ve,", ").concat(D.flipY?"-":"").concat(ve,", 1) rotate(").concat(ge,"deg)"),transitionDuration:(!de||q)&&"0s"},fallback:u,src:r,onWheel:F,onMouseDown:L,onDoubleClick:rn,onTouchStart:H,onTouchMove:pe,onTouchEnd:Se,onTouchCancel:Se})),yt=z({url:r,alt:o},l);return je.createElement(je.Fragment,null,je.createElement(On,ee({transitionName:k,maskTransitionName:P,closable:!1,keyboard:!0,prefixCls:n,onClose:s,visible:g,classNames:{wrapper:Je},rootClassName:x,getContainer:p},V,{afterClose:et}),je.createElement("div",{className:"".concat(n,"-img-wrapper")},T?T(wt,z({transform:D,image:yt},K?{current:w}:{})):wt)),je.createElement(An,{visible:g,transform:D,maskTransitionName:P,closeIcon:m,getContainer:p,prefixCls:n,rootClassName:x,icons:v,countRender:I,showSwitch:Y,showProgress:re,current:w,count:R,scale:ve,minScale:y,maxScale:O,toolbarRender:B,onActive:nt,onZoomIn:tt,onZoomOut:he,onRotateRight:xe,onRotateLeft:De,onFlipX:Le,onFlipY:Fe,onClose:s,onReset:tn,zIndex:V.zIndex!==void 0?V.zIndex+1:void 0,image:yt}))},mt=["crossOrigin","decoding","draggable","loading","referrerPolicy","sizes","srcSet","useMap","alt"];function Kn(t){var e=i.useState({}),n=W(e,2),r=n[0],o=n[1],l=i.useCallback(function(d,c){return o(function(s){return z(z({},s),{},fe({},d,c))}),function(){o(function(s){var g=z({},s);return delete g[d],g})}},[]),u=i.useMemo(function(){return t?t.map(function(d){if(typeof d=="string")return{data:{src:d}};var c={};return Object.keys(d).forEach(function(s){["src"].concat(mn(mt)).includes(s)&&(c[s]=d[s])}),{data:c}}):Object.keys(r).reduce(function(d,c){var s=r[c],g=s.canPreview,f=s.data;return g&&d.push({data:f,id:c}),d},[])},[t,r]);return[u,l,!!t]}var qn=["visible","onVisibleChange","getContainer","current","movable","minScale","maxScale","countRender","closeIcon","onChange","onTransform","toolbarRender","imageRender"],Qn=["src"],Jn=function(e){var n,r=e.previewPrefixCls,o=r===void 0?"rc-image-preview":r,l=e.children,u=e.icons,d=u===void 0?{}:u,c=e.items,s=e.preview,g=e.fallback,f=Nt(s)==="object"?s:{},v=f.visible,x=f.onVisibleChange,m=f.getContainer,p=f.current,j=f.movable,w=f.minScale,M=f.maxScale,R=f.countRender,I=f.closeIcon,h=f.onChange,b=f.onTransform,S=f.toolbarRender,y=f.imageRender,E=ke(f,qn),O=Kn(c),C=W(O,3),k=C[0],N=C[1],P=C[2],T=ct(0,{value:p}),$=W(T,2),B=$[0],G=$[1],J=i.useState(!1),V=W(J,2),X=V[0],K=V[1],Y=((n=k[B])===null||n===void 0?void 0:n.data)||{},re=Y.src,Z=ke(Y,Qn),A=ct(!!v,{value:v,onChange:function(q,H){x?.(q,H,B)}}),de=W(A,2),oe=de[0],te=de[1],D=i.useState(null),le=W(D,2),U=le[0],ne=le[1],ce=i.useCallback(function(_,q,H,pe){var Se=P?k.findIndex(function(ge){return ge.data.src===q}):k.findIndex(function(ge){return ge.id===_});G(Se<0?0:Se),te(!0),ne({x:H,y:pe}),K(!0)},[k,P]);i.useEffect(function(){oe?X||G(0):K(!1)},[oe]);var me=function(q,H){G(q),h?.(q,H)},L=function(){te(!1),ne(null)},F=i.useMemo(function(){return{register:N,onPreview:ce}},[N,ce]);return i.createElement($e.Provider,{value:F},l,i.createElement(qt,ee({"aria-hidden":!oe,movable:j,visible:oe,prefixCls:o,closeIcon:I,onClose:L,mousePosition:U,imgCommonProps:Z,src:re,fallback:g,icons:d,minScale:w,maxScale:M,getContainer:m,current:B,count:k.length,countRender:R,onTransform:b,toolbarRender:S,imageRender:y,onChange:me},E)))},It=0;function er(t,e){var n=i.useState(function(){return It+=1,String(It)}),r=W(n,1),o=r[0],l=i.useContext($e),u={data:e,canPreview:t};return i.useEffect(function(){if(l)return l.register(o,u)},[]),i.useEffect(function(){l&&l.register(o,u)},[t,e]),o}var tr=["src","alt","onPreviewClose","prefixCls","previewPrefixCls","placeholder","fallback","width","height","style","preview","className","onClick","onError","wrapperClassName","wrapperStyle","rootClassName"],nr=["src","visible","onVisibleChange","getContainer","mask","maskClassName","movable","icons","scaleStep","minScale","maxScale","imageRender","toolbarRender"],xt=function(e){var n=e.src,r=e.alt,o=e.onPreviewClose,l=e.prefixCls,u=l===void 0?"rc-image":l,d=e.previewPrefixCls,c=d===void 0?"".concat(u,"-preview"):d,s=e.placeholder,g=e.fallback,f=e.width,v=e.height,x=e.style,m=e.preview,p=m===void 0?!0:m,j=e.className,w=e.onClick,M=e.onError,R=e.wrapperClassName,I=e.wrapperStyle,h=e.rootClassName,b=ke(e,tr),S=s&&s!==!0,y=Nt(p)==="object"?p:{},E=y.src,O=y.visible,C=O===void 0?void 0:O,k=y.onVisibleChange,N=k===void 0?o:k,P=y.getContainer,T=P===void 0?void 0:P,$=y.mask,B=y.maskClassName,G=y.movable,J=y.icons,V=y.scaleStep,X=y.minScale,K=y.maxScale,Y=y.imageRender,re=y.toolbarRender,Z=ke(y,nr),A=E??n,de=ct(!!C,{value:C,onChange:N}),oe=W(de,2),te=oe[0],D=oe[1],le=Kt({src:n,isCustomPlaceholder:S,fallback:g}),U=W(le,3),ne=U[0],ce=U[1],me=U[2],L=i.useState(null),F=W(L,2),_=F[0],q=F[1],H=i.useContext($e),pe=!!p,Se=function(){D(!1),q(null)},ge=Q(u,R,h,fe({},"".concat(u,"-error"),me==="error")),ve=i.useMemo(function(){var he={};return mt.forEach(function(xe){e[xe]!==void 0&&(he[xe]=e[xe])}),he},mt.map(function(he){return e[he]})),Je=i.useMemo(function(){return z(z({},ve),{},{src:A})},[A,ve]),et=er(pe,Je),tt=function(xe){var De=_n(xe.target),Le=De.left,Fe=De.top;H?H.onPreview(et,A,Le,Fe):(q({x:Le,y:Fe}),D(!0)),w?.(xe)};return i.createElement(i.Fragment,null,i.createElement("div",ee({},b,{className:ge,onClick:pe?tt:w,style:z({width:f,height:v},I)}),i.createElement("img",ee({},ve,{className:Q("".concat(u,"-img"),fe({},"".concat(u,"-img-placeholder"),s===!0),j),style:z({height:v},x),ref:ne},ce,{width:f,height:v,onError:M})),me==="loading"&&i.createElement("div",{"aria-hidden":"true",className:"".concat(u,"-placeholder")},s),$&&pe&&i.createElement("div",{className:Q("".concat(u,"-mask"),B),style:{display:x?.display==="none"?"none":void 0}},$)),!H&&pe&&i.createElement(qt,ee({"aria-hidden":!te,visible:te,prefixCls:c,onClose:Se,mousePosition:_,src:A,alt:r,imageInfo:{width:f,height:v},fallback:g,getContainer:T,icons:J,movable:G,scaleStep:V,minScale:X,maxScale:K,rootClassName:h,imageRender:Y,imgCommonProps:ve,toolbarRender:re},Z)))};xt.PreviewGroup=Jn;var rr={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H188V494h440v326z"}},{tag:"path",attrs:{d:"M819.3 328.5c-78.8-100.7-196-153.6-314.6-154.2l-.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7.4 12.6-6.1v-63.9c12.9.1 25.9.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8a325.95 325.95 0 016.5 140.9h74.9c14.8-103.6-11.3-213-81-302.3z"}}]},name:"rotate-left",theme:"outlined"},or=function(e,n){return i.createElement(Ee,ee({},e,{ref:n,icon:rr}))},ar=i.forwardRef(or),ir={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M480.5 251.2c13-1.6 25.9-2.4 38.8-2.5v63.9c0 6.5 7.5 10.1 12.6 6.1L660 217.6c4-3.2 4-9.2 0-12.3l-128-101c-5.1-4-12.6-.4-12.6 6.1l-.2 64c-118.6.5-235.8 53.4-314.6 154.2A399.75 399.75 0 00123.5 631h74.9c-.9-5.3-1.7-10.7-2.4-16.1-5.1-42.1-2.1-84.1 8.9-124.8 11.4-42.2 31-81.1 58.1-115.8 27.2-34.7 60.3-63.2 98.4-84.3 37-20.6 76.9-33.6 119.1-38.8z"}},{tag:"path",attrs:{d:"M880 418H352c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H396V494h440v326z"}}]},name:"rotate-right",theme:"outlined"},sr=function(e,n){return i.createElement(Ee,ee({},e,{ref:n,icon:ir}))},lr=i.forwardRef(sr),cr={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"swap",theme:"outlined"},ur=function(e,n){return i.createElement(Ee,ee({},e,{ref:n,icon:cr}))},Ot=i.forwardRef(ur),dr={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"}}]},name:"zoom-in",theme:"outlined"},fr=function(e,n){return i.createElement(Ee,ee({},e,{ref:n,icon:dr}))},mr=i.forwardRef(fr),gr={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"}}]},name:"zoom-out",theme:"outlined"},vr=function(e,n){return i.createElement(Ee,ee({},e,{ref:n,icon:gr}))},pr=i.forwardRef(vr);const gt=t=>({position:t||"absolute",inset:0}),hr=t=>{const{iconCls:e,motionDurationSlow:n,paddingXXS:r,marginXXS:o,prefixCls:l,colorTextLightSolid:u}=t;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",color:u,background:new Ie("#000").setA(.5).toRgbString(),cursor:"pointer",opacity:0,transition:`opacity ${n}`,[`.${l}-mask-info`]:Object.assign(Object.assign({},vn),{padding:`0 ${Ye(r)}`,[e]:{marginInlineEnd:o,svg:{verticalAlign:"baseline"}}})}},xr=t=>{const{previewCls:e,modalMaskBg:n,paddingSM:r,marginXL:o,margin:l,paddingLG:u,previewOperationColorDisabled:d,previewOperationHoverColor:c,motionDurationSlow:s,iconCls:g,colorTextLightSolid:f}=t,v=new Ie(n).setA(.1),x=v.clone().setA(.2);return{[`${e}-footer`]:{position:"fixed",bottom:o,left:{_skip_check_:!0,value:"50%"},display:"flex",flexDirection:"column",alignItems:"center",color:t.previewOperationColor,transform:"translateX(-50%)"},[`${e}-progress`]:{marginBottom:l},[`${e}-close`]:{position:"fixed",top:o,right:{_skip_check_:!0,value:o},display:"flex",color:f,backgroundColor:v.toRgbString(),borderRadius:"50%",padding:r,outline:0,border:0,cursor:"pointer",transition:`all ${s}`,"&:hover":{backgroundColor:x.toRgbString()},[`& > ${g}`]:{fontSize:t.previewOperationSize}},[`${e}-operations`]:{display:"flex",alignItems:"center",padding:`0 ${Ye(u)}`,backgroundColor:v.toRgbString(),borderRadius:100,"&-operation":{marginInlineStart:r,padding:r,cursor:"pointer",transition:`all ${s}`,userSelect:"none",[`&:not(${e}-operations-operation-disabled):hover > ${g}`]:{color:c},"&-disabled":{color:d,cursor:"not-allowed"},"&:first-of-type":{marginInlineStart:0},[`& > ${g}`]:{fontSize:t.previewOperationSize}}}}},wr=t=>{const{modalMaskBg:e,iconCls:n,previewOperationColorDisabled:r,previewCls:o,zIndexPopup:l,motionDurationSlow:u}=t,d=new Ie(e).setA(.1),c=d.clone().setA(.2);return{[`${o}-switch-left, ${o}-switch-right`]:{position:"fixed",insetBlockStart:"50%",zIndex:t.calc(l).add(1).equal(),display:"flex",alignItems:"center",justifyContent:"center",width:t.imagePreviewSwitchSize,height:t.imagePreviewSwitchSize,marginTop:t.calc(t.imagePreviewSwitchSize).mul(-1).div(2).equal(),color:t.previewOperationColor,background:d.toRgbString(),borderRadius:"50%",transform:"translateY(-50%)",cursor:"pointer",transition:`all ${u}`,userSelect:"none","&:hover":{background:c.toRgbString()},"&-disabled":{"&, &:hover":{color:r,background:"transparent",cursor:"not-allowed",[`> ${n}`]:{cursor:"not-allowed"}}},[`> ${n}`]:{fontSize:t.previewOperationSize}},[`${o}-switch-left`]:{insetInlineStart:t.marginSM},[`${o}-switch-right`]:{insetInlineEnd:t.marginSM}}},yr=t=>{const{motionEaseOut:e,previewCls:n,motionDurationSlow:r,componentCls:o}=t;return[{[`${o}-preview-root`]:{[n]:{height:"100%",textAlign:"center",pointerEvents:"none"},[`${n}-body`]:Object.assign(Object.assign({},gt()),{overflow:"hidden"}),[`${n}-img`]:{maxWidth:"100%",maxHeight:"70%",verticalAlign:"middle",transform:"scale3d(1, 1, 1)",cursor:"grab",transition:`transform ${r} ${e} 0s`,userSelect:"none","&-wrapper":Object.assign(Object.assign({},gt()),{transition:`transform ${r} ${e} 0s`,display:"flex",justifyContent:"center",alignItems:"center","& > *":{pointerEvents:"auto"},"&::before":{display:"inline-block",width:1,height:"50%",marginInlineEnd:-1,content:'""'}})},[`${n}-moving`]:{[`${n}-preview-img`]:{cursor:"grabbing","&-wrapper":{transitionDuration:"0s"}}}}},{[`${o}-preview-root`]:{[`${n}-wrap`]:{zIndex:t.zIndexPopup}}},{[`${o}-preview-operations-wrapper`]:{position:"fixed",zIndex:t.calc(t.zIndexPopup).add(1).equal()},"&":[xr(t),wr(t)]}]},Cr=t=>{const{componentCls:e}=t;return{[e]:{position:"relative",display:"inline-block",[`${e}-img`]:{width:"100%",height:"auto",verticalAlign:"middle"},[`${e}-img-placeholder`]:{backgroundColor:t.colorBgContainerDisabled,backgroundImage:"url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",backgroundRepeat:"no-repeat",backgroundPosition:"center center",backgroundSize:"30%"},[`${e}-mask`]:Object.assign({},hr(t)),[`${e}-mask:hover`]:{opacity:1},[`${e}-placeholder`]:Object.assign({},gt())}}},br=t=>{const{previewCls:e}=t;return{[`${e}-root`]:gn(t,"zoom"),"&":En(t,!0)}},Sr=t=>({zIndexPopup:t.zIndexPopupBase+80,previewOperationColor:new Ie(t.colorTextLightSolid).setA(.65).toRgbString(),previewOperationHoverColor:new Ie(t.colorTextLightSolid).setA(.85).toRgbString(),previewOperationColorDisabled:new Ie(t.colorTextLightSolid).setA(.25).toRgbString(),previewOperationSize:t.fontSizeIcon*1.5}),Qt=kt("Image",t=>{const e=`${t.componentCls}-preview`,n=st(t,{previewCls:e,modalMaskBg:new Ie("#000").setA(.45).toRgbString(),imagePreviewSwitchSize:t.controlHeightLG});return[Cr(n),yr(n),Rn(st(n,{componentCls:e})),br(n)]},Sr);var jr=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};const Jt={rotateLeft:i.createElement(ar,null),rotateRight:i.createElement(lr,null),zoomIn:i.createElement(mr,null),zoomOut:i.createElement(pr,null),close:i.createElement(pn,null),left:i.createElement(Te,null),right:i.createElement(He,null),flipX:i.createElement(Ot,null),flipY:i.createElement(Ot,{rotate:90})},Ir=t=>{var{previewPrefixCls:e,preview:n}=t,r=jr(t,["previewPrefixCls","preview"]);const{getPrefixCls:o,direction:l}=i.useContext(qe),u=o("image",e),d=`${u}-preview`,c=o(),s=zt(u),[g,f,v]=Qt(u,s),[x]=Tt("ImagePreview",typeof n=="object"?n.zIndex:void 0),m=i.useMemo(()=>Object.assign(Object.assign({},Jt),{left:l==="rtl"?i.createElement(He,null):i.createElement(Te,null),right:l==="rtl"?i.createElement(Te,null):i.createElement(He,null)}),[l]),p=i.useMemo(()=>{var j;if(n===!1)return n;const w=typeof n=="object"?n:{},M=Q(f,v,s,(j=w.rootClassName)!==null&&j!==void 0?j:"");return Object.assign(Object.assign({},w),{transitionName:We(c,"zoom",w.transitionName),maskTransitionName:We(c,"fade",w.maskTransitionName),rootClassName:M,zIndex:x})},[n,c,x,f,v,s]);return g(i.createElement(xt.PreviewGroup,Object.assign({preview:p,previewPrefixCls:d,icons:m},r)))};var Rt=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};const en=t=>{const{prefixCls:e,preview:n,className:r,rootClassName:o,style:l,fallback:u}=t,d=Rt(t,["prefixCls","preview","className","rootClassName","style","fallback"]),{getPrefixCls:c,getPopupContainer:s,className:g,style:f,preview:v,fallback:x}=hn("image"),[m]=xn("Image"),p=c("image",e),j=c(),w=zt(p),[M,R,I]=Qt(p,w),h=Q(o,R,I,w),b=Q(r,R,g),[S]=Tt("ImagePreview",typeof n=="object"?n.zIndex:void 0),y=i.useMemo(()=>{if(n===!1)return n;const C=typeof n=="object"?n:{},{getContainer:k,closeIcon:N,rootClassName:P,destroyOnClose:T,destroyOnHidden:$}=C,B=Rt(C,["getContainer","closeIcon","rootClassName","destroyOnClose","destroyOnHidden"]);return Object.assign(Object.assign({mask:i.createElement("div",{className:`${p}-mask-info`},i.createElement(At,null),m?.preview),icons:Jt},B),{destroyOnClose:$??T,rootClassName:Q(h,P),getContainer:k??s,transitionName:We(j,"zoom",C.transitionName),maskTransitionName:We(j,"fade",C.maskTransitionName),zIndex:S,closeIcon:N??v?.closeIcon})},[n,m,v?.closeIcon]),E=Object.assign(Object.assign({},f),l),O=u??x;return M(i.createElement(xt,Object.assign({prefixCls:p,preview:y,rootClassName:h,className:b,style:E,fallback:O},d)))};en.PreviewGroup=Ir;var Or={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M946.5 505L560.1 118.8l-25.9-25.9a31.5 31.5 0 00-44.4 0L77.5 505a63.9 63.9 0 00-18.8 46c.4 35.2 29.7 63.3 64.9 63.3h42.5V940h691.8V614.3h43.4c17.1 0 33.2-6.7 45.3-18.8a63.6 63.6 0 0018.7-45.3c0-17-6.7-33.1-18.8-45.2zM568 868H456V664h112v204zm217.9-325.7V868H632V640c0-22.1-17.9-40-40-40H432c-22.1 0-40 17.9-40 40v228H238.1V542.3h-96l370-369.7 23.1 23.1L882 542.3h-96.1z"}}]},name:"home",theme:"outlined"},Rr=function(e,n){return i.createElement(Ee,ee({},e,{ref:n,icon:Or}))},Er=i.forwardRef(Rr),Mr={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 01144-53.5L537 318.9a32.05 32.05 0 000 45.3l124.5 124.5a32.05 32.05 0 0045.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z"}}]},name:"tool",theme:"outlined"},Pr=function(e,n){return i.createElement(Ee,ee({},e,{ref:n,icon:Mr}))},kr=i.forwardRef(Pr);const Ke={async listFiles(t){return(await Ne.listFiles(t)).data.data},async getRecentFiles(t){return(await Ne.getRecentFiles(t)).data.data},async getFilePreview(t,e){return(await Ne.getFilePreview(t,e)).data},async deleteFile(t,e){await Ne.deleteFile(t,e)},async normalizeFiles(t){return(await Ne.normalizeFiles(t)).data.data}};function Nr(t){const e=$t(),{handleError:n}=vt(),{data:r,isLoading:o,error:l,refetch:u}=Dt({queryKey:Ve.FILES(t),queryFn:()=>Ke.listFiles(t)}),d=Ft({mutationFn:({id:c,path:s,type:g})=>Ke.deleteFile(c,{path:s,type:g}),onSuccess:()=>{e.invalidateQueries({queryKey:Ve.FILES()})},onError:c=>n(c)});return{files:r?.files??[],directories:r?.directories??[],currentPath:r?.currentPath??"",isLoading:o,error:l,refetch:u,deleteFile:d.mutate,deleteFileAsync:d.mutateAsync,isDeleting:d.isPending}}function zr(t,e){const{data:n,isLoading:r,error:o,refetch:l}=Dt({queryKey:Ve.FILES_PREVIEW(t,e),queryFn:()=>Ke.getFilePreview(t,e),enabled:!!t});return{previewUrl:n?URL.createObjectURL(n):null,previewBlob:n,isLoading:r,error:o,refetch:l}}function Tr(){const t=$t(),{handleError:e}=vt(),n=Ft({mutationFn:r=>Ke.normalizeFiles(r),onSuccess:()=>{t.invalidateQueries({queryKey:Ve.FILES()})},onError:r=>e(r)});return{normalize:n.mutate,normalizeAsync:n.mutateAsync,isNormalizing:n.isPending,normalizeResult:n.data}}function $r({currentPath:t,onNavigate:e,onGoBack:n}){const{t:r}=be(),o=[{title:a.jsx(se,{type:"link",icon:a.jsx(Er,{}),onClick:()=>e(""),style:{padding:0},children:r("files.root")})},...t?t.split("/").map((l,u,d)=>{const c=d.slice(0,u+1).join("/");return{title:a.jsx(se,{type:"link",onClick:()=>e(c),style:{padding:0},children:l})}}):[]];return a.jsxs(a.Fragment,{children:[a.jsx(ht,{items:o}),t&&a.jsx(se,{icon:a.jsx(Te,{}),onClick:n,children:r("files.goBack")})]})}const{Option:ie}=Re,{Search:Dr}=Sn;function Lr({searchText:t,onSearchChange:e,dateFilter:n,onDateFilterChange:r,sortBy:o,onSortByChange:l,sortOrder:u,onSortOrderChange:d}){const{t:c}=be();return a.jsxs(pt,{gutter:16,align:"middle",children:[a.jsx(Ce,{flex:"auto",children:a.jsx(Dr,{placeholder:c("files.searchPlaceholder"),allowClear:!0,prefix:a.jsx(wn,{}),value:t,onChange:s=>e(s.target.value),style:{width:"100%"}})}),a.jsx(Ce,{children:a.jsxs(Oe,{children:[a.jsxs(Re,{value:n,onChange:r,style:{width:140},children:[a.jsx(ie,{value:"all",children:c("files.filterAll")}),a.jsx(ie,{value:"today",children:c("files.filterToday")}),a.jsx(ie,{value:"yesterday",children:c("files.filterYesterday")}),a.jsx(ie,{value:"thisWeek",children:c("files.filterThisWeek")}),a.jsx(ie,{value:"lastWeek",children:c("files.filterLastWeek")}),a.jsx(ie,{value:"thisMonth",children:c("files.filterThisMonth")}),a.jsx(ie,{value:"lastMonth",children:c("files.filterLastMonth")})]}),a.jsxs(Re,{value:o,onChange:l,style:{width:150},children:[a.jsx(ie,{value:"name",children:c("files.sortByName")}),a.jsx(ie,{value:"time",children:c("files.sortByTime")}),a.jsx(ie,{value:"downloadedAt",children:c("files.sortByDownloadTime")}),a.jsx(ie,{value:"size",children:c("files.sortBySize")}),a.jsx(ie,{value:"type",children:c("files.sortByType")})]}),a.jsx(se,{icon:u==="asc"?a.jsx(Bt,{}):a.jsx(Xt,{}),onClick:()=>d(u==="asc"?"desc":"asc"),children:c(u==="asc"?"files.ascending":"files.descending")})]})})]})}function Fr({directories:t,files:e,images:n,totalSize:r}){const{t:o}=be();return a.jsxs(pt,{gutter:16,style:{marginBottom:16},children:[a.jsx(Ce,{xs:24,sm:12,md:6,children:a.jsx(ze,{children:a.jsx(Ae,{title:o("files.directories"),value:t,prefix:a.jsx(ut,{}),valueStyle:{color:"#1890ff"}})})}),a.jsx(Ce,{xs:24,sm:12,md:6,children:a.jsx(ze,{children:a.jsx(Ae,{title:o("files.files"),value:e,prefix:a.jsx(_t,{}),valueStyle:{color:"#52c41a"}})})}),a.jsx(Ce,{xs:24,sm:12,md:6,children:a.jsx(ze,{children:a.jsx(Ae,{title:o("files.images"),value:n,prefix:a.jsx(Ue,{}),valueStyle:{color:"#faad14"}})})}),a.jsx(Ce,{xs:24,sm:12,md:6,children:a.jsx(ze,{children:a.jsx(Ae,{title:o("files.totalSize"),value:r,valueStyle:{color:"#722ed1"}})})})]})}const at=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],Et=[".txt",".md",".text"];function _r({files:t,directories:e,loading:n=!1,sortBy:r,sortOrder:o,onSort:l,onPreview:u,onDelete:d,onNavigate:c}){const{t:s}=be(),g=m=>m?m<1024?`${m} B`:m<1024*1024?`${(m/1024).toFixed(2)} KB`:`${(m/(1024*1024)).toFixed(2)} MB`:"-",f=m=>r!==m?null:o==="asc"?a.jsx(Bt,{}):a.jsx(Xt,{}),v=i.useMemo(()=>[...e,...t],[e,t]),x=[{title:a.jsxs("span",{style:{cursor:"pointer",userSelect:"none"},onClick:()=>l("name"),children:[s("files.name")," ",f("name")]}),dataIndex:"name",key:"name",width:300,ellipsis:{showTitle:!0},render:(m,p)=>a.jsxs("div",{style:{display:"flex",alignItems:"center",width:"100%",minWidth:0},children:[a.jsx("span",{style:{flexShrink:0,marginRight:8},children:p.type==="directory"?a.jsx(ut,{style:{color:"#1890ff",fontSize:16}}):at.includes(p.extension?.toLowerCase()||"")?a.jsx(Ue,{style:{color:"#52c41a",fontSize:16}}):a.jsx(dt,{style:{fontSize:16}})}),a.jsx(se,{type:"link",onClick:()=>{p.type==="directory"?c(p.path):u(p)},style:{padding:0,height:"auto",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"left"},title:m,children:m})]})},{title:a.jsxs("span",{style:{cursor:"pointer",userSelect:"none"},onClick:()=>l("type"),children:[s("files.type")," ",f("type")]}),dataIndex:"type",key:"type",width:120,render:(m,p)=>{if(m==="directory")return a.jsx(Be,{color:"blue",icon:a.jsx(ut,{}),children:s("files.typeDirectory")});const j=p.extension?.toLowerCase()||"";return at.includes(j)?a.jsx(Be,{color:"green",icon:a.jsx(Ue,{}),children:s("files.typeImage")}):Et.includes(j)?a.jsx(Be,{color:"orange",icon:a.jsx(dt,{}),children:s("files.typeText")}):a.jsx(Be,{icon:a.jsx(_t,{}),children:s("files.typeFile")})}},{title:a.jsxs("span",{style:{cursor:"pointer",userSelect:"none"},onClick:()=>l("size"),children:[s("files.size")," ",f("size")]}),dataIndex:"size",key:"size",width:120,render:m=>g(m)},{title:a.jsxs("span",{style:{cursor:"pointer",userSelect:"none"},onClick:()=>l("time"),children:[s("files.modified")," ",f("time")]}),dataIndex:"modified",key:"modified",width:180,render:m=>bt(m)},{title:a.jsxs("span",{style:{cursor:"pointer",userSelect:"none"},onClick:()=>l("downloadedAt"),children:[s("files.downloadedAt")," ",f("downloadedAt")]}),dataIndex:"downloadedAt",key:"downloadedAt",width:180,render:(m,p)=>p.type==="directory"?"-":m?bt(m):a.jsx("span",{style:{color:"#999"},children:s("files.unknown")})},{title:s("files.actions"),key:"action",width:150,fixed:"right",render:(m,p)=>a.jsxs(Oe,{children:[p.type==="file"&&(at.includes(p.extension?.toLowerCase()||"")||Et.includes(p.extension?.toLowerCase()||""))&&a.jsx(se,{type:"link",icon:a.jsx(At,{}),onClick:()=>u(p),size:"small",children:s("files.preview")}),p.type==="file"&&a.jsx(jn,{title:s("files.confirmDelete"),onConfirm:()=>d(p),okText:s("common.ok"),cancelText:s("common.cancel"),children:a.jsx(se,{type:"link",danger:!0,icon:a.jsx(In,{}),size:"small",children:s("files.delete")})})]})}];return a.jsx("div",{style:{overflowX:"auto"},children:a.jsx(bn,{columns:x,dataSource:v,rowKey:"path",loading:n,scroll:{x:900},pagination:{pageSize:50,showSizeChanger:!0,showTotal:(m,p)=>s("files.displaying",{start:p[0],end:p[1],total:m}),pageSizeOptions:["20","50","100","200"]}})})}const Ar=({title:t="Preview",type:e="custom",content:n,imageUrl:r,loading:o=!1,renderContent:l,width:u=800,showFooter:d=!1,open:c,...s})=>{const g=()=>{if(o)return a.jsx("div",{style:{textAlign:"center",padding:"40px 0"},children:a.jsx(Lt,{indicator:a.jsx(yn,{style:{fontSize:24},spin:!0})})});if(l)return l();switch(e){case"image":return a.jsx("div",{style:{textAlign:"center"},children:a.jsx(en,{src:r||(typeof n=="string"?n:void 0),alt:t,style:{maxWidth:"100%"},preview:!1})});case"text":return a.jsx("div",{style:{maxHeight:"60vh",overflow:"auto",padding:"16px",backgroundColor:"#f5f5f5",borderRadius:"4px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:n});case"json":return a.jsx("div",{style:{maxHeight:"60vh",overflow:"auto",padding:"16px",backgroundColor:"#1f1f1f",borderRadius:"4px",fontFamily:"monospace",fontSize:"12px",color:"#fff"},children:a.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(()=>{try{return JSON.stringify(typeof n=="string"?JSON.parse(n):n,null,2)}catch{return typeof n=="string"?n:String(n)}})()})});case"custom":default:return a.jsx("div",{children:n})}};return a.jsx(Yt,{title:t,open:c,width:u,footer:d?s.footer:null,...s,children:g()})},Br=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],Xr=[".txt",".md",".text"];function Yr({visible:t,file:e,fileType:n,onClose:r,files:o=[],onNavigate:l}){const{t:u}=be(),[d,c]=i.useState(""),s=e?.extension?.toLowerCase()||"",g=Br.includes(s),f=Xr.includes(s),{previewUrl:v,isLoading:x}=zr(g?e?.path:void 0,n),m=e?o.findIndex(I=>I.path===e.path):-1,p=m>0,j=m>=0&&m<o.length-1;if(i.useEffect(()=>{if(!t||!l||!e)return;const I=h=>{const b=p?o[m-1]:void 0,S=j?o[m+1]:void 0;h.key==="ArrowLeft"&&b?l(b):h.key==="ArrowRight"&&S&&l(S)};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[t,e,o,m,p,j,l]),i.useEffect(()=>{t&&e&&f?(async()=>{try{const h=`/api/files/preview?path=${encodeURIComponent(e.path)}&type=${n}`,b=await fetch(h);b.ok?c(await b.text()):(Ze.error(u("files.loadContentFailed")),r())}catch{Ze.error(u("files.loadContentFailed")),r()}})():t||c("")},[t,e,f,n,u,r]),!e)return null;let w="custom";g?w="image":f&&(w="text");const M=I=>{const h=I==="prev"?m-1:m+1;if(h<0||h>=o.length||!l)return null;const b=o[h];return b?a.jsx(se,{icon:I==="prev"?a.jsx(Te,{}):a.jsx(He,{}),onClick:()=>l(b)}):null},R=o.length>1&&m>=0?a.jsxs(Oe,{align:"center",style:{display:"flex",justifyContent:"center"},children:[M("prev"),a.jsxs("span",{style:{color:"#6b7280"},children:[m+1," / ",o.length]}),M("next")]}):null;return a.jsx(Ar,{open:t,title:e.name,type:w,imageUrl:g&&v||void 0,content:f?d:void 0,loading:x||f&&!d&&t,onCancel:r,width:800,showFooter:!1,renderContent:R?()=>a.jsxs("div",{children:[w==="image"?a.jsx("img",{src:v||void 0,alt:e.name,style:{maxWidth:"100%",display:"block",margin:"0 auto"}}):w==="text"?a.jsx("div",{style:{maxHeight:"60vh",overflow:"auto",padding:"16px",background:"#f5f5f5",borderRadius:"4px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:d}):a.jsx("div",{children:e.name}),a.jsx("div",{style:{marginTop:"12px"},children:R})]}):void 0})}const{Option:it}=Re,{Text:ue}=Ht;function Hr({visible:t,onClose:e}){const{t:n}=be(),{normalizeAsync:r,isNormalizing:o,normalizeResult:l}=Tr(),[u,d]=i.useState({dryRun:!0,normalizeNames:!0,reorganize:!0,updateDatabase:!0,type:"all"}),c=async()=>{try{await r({...u,dryRun:!0})}catch{}},s=async()=>{try{await r({...u,dryRun:!1}),e()}catch{}},g=()=>{d({dryRun:!0,normalizeNames:!0,reorganize:!0,updateDatabase:!0,type:"all"}),e()},f=l?.result;return a.jsx(Yt,{open:t,onCancel:g,title:n("files.normalizeTitle"),width:700,footer:[a.jsx(se,{onClick:g,children:n("common.cancel")},"cancel"),a.jsx(se,{onClick:c,loading:o,children:n("files.previewButton")},"preview"),a.jsx(se,{type:"primary",onClick:s,loading:o,danger:!u.dryRun,children:n("files.executeNormalize")},"execute")],children:a.jsxs(Oe,{direction:"vertical",style:{width:"100%"},size:"large",children:[a.jsx(rt,{message:n("files.normalizeTitle"),description:n("files.normalizeDescription"),type:"info",showIcon:!0}),a.jsxs("div",{children:[a.jsx(ue,{strong:!0,children:n("files.normalizeOptions")}),a.jsxs(Oe,{direction:"vertical",style:{marginTop:8,width:"100%"},children:[a.jsx(ot,{checked:u.normalizeNames,onChange:v=>d({...u,normalizeNames:v.target.checked}),children:n("files.normalizeNames")}),a.jsx(ot,{checked:u.reorganize,onChange:v=>d({...u,reorganize:v.target.checked}),children:n("files.reorganize")}),a.jsx(ot,{checked:u.updateDatabase,onChange:v=>d({...u,updateDatabase:v.target.checked}),children:n("files.updateDatabase")})]})]}),a.jsxs("div",{children:[a.jsx(ue,{strong:!0,children:n("files.fileType")}),a.jsxs(Re,{value:u.type,onChange:v=>d({...u,type:v}),style:{width:"100%",marginTop:8},children:[a.jsx(it,{value:"all",children:n("files.allTypes")}),a.jsx(it,{value:"illustration",children:n("files.illustrationOnly")}),a.jsx(it,{value:"novel",children:n("files.novelOnly")})]})]}),o&&a.jsxs("div",{style:{textAlign:"center",padding:"20px"},children:[a.jsx(Lt,{size:"large"}),a.jsx("div",{style:{marginTop:16},children:a.jsx(ue,{children:n("files.processing")})})]}),f&&a.jsxs("div",{children:[a.jsx(ue,{strong:!0,children:n("files.normalizeResult")}),a.jsxs(ye,{bordered:!0,column:1,size:"small",style:{marginTop:8},children:[a.jsx(ye.Item,{label:n("files.totalFiles"),children:f.totalFiles}),a.jsx(ye.Item,{label:n("files.processedFiles"),children:f.processedFiles}),a.jsx(ye.Item,{label:n("files.movedFiles"),children:a.jsx(ue,{type:"success",children:f.movedFiles})}),a.jsx(ye.Item,{label:n("files.renamedFiles"),children:a.jsx(ue,{type:"success",children:f.renamedFiles})}),a.jsx(ye.Item,{label:n("files.updatedDatabase"),children:a.jsx(ue,{type:"success",children:f.updatedDatabase})}),a.jsx(ye.Item,{label:n("files.skippedFiles"),children:f.skippedFiles}),a.jsx(ye.Item,{label:n("files.errors"),children:f.errors?.length>0?a.jsx(ue,{type:"danger",children:f.errors.length}):a.jsx(ue,{type:"success",children:"0"})})]}),f.errors&&f.errors.length>0&&a.jsx(rt,{message:n("files.processingErrors"),description:a.jsx("div",{style:{maxHeight:"200px",overflow:"auto"},children:f.errors.map((v,x)=>a.jsxs("div",{style:{marginBottom:8},children:[a.jsxs(ue,{type:"danger",strong:!0,children:[v.file,":"]}),a.jsx(ue,{type:"danger",style:{marginLeft:8},children:v.error})]},x))}),type:"error",style:{marginTop:16}}),u.dryRun&&a.jsx(rt,{message:n("files.previewMode"),description:n("files.previewModeDesc"),type:"warning",style:{marginTop:16}})]})]})})}function Wr(){const[t,e]=i.useState(""),n=i.useCallback(l=>{e(l)},[]),r=i.useCallback(()=>{const l=t.split("/");l.pop(),n(l.join("/"))},[t,n]),o=i.useCallback(()=>{e("")},[]);return{currentPath:t,handleNavigate:n,handleGoBack:r,resetPath:o}}const Vr=[".jpg",".jpeg",".png",".gif",".webp",".bmp"];function Zr(t,e,n){const{t:r}=be(),{handleError:o}=vt(),[l,u]=i.useState(!1),[d,c]=i.useState(null),s=i.useCallback(v=>{if(v.type==="directory"){n?.(v.path);return}const x=v.extension?.toLowerCase()||"",m=Vr.includes(x),p=[".txt",".md",".text"].includes(x);m||p?(c(v),u(!0)):Ze.info(r("files.previewNotSupported"))},[n,r]),g=i.useCallback(async v=>{try{await t({id:v.name,path:v.path,type:e}),Ze.success(r("files.fileDeleted"))}catch(x){o(x)}},[t,e,o,r]),f=i.useCallback(()=>{u(!1),c(null)},[]);return{previewVisible:l,previewFile:d,handlePreview:s,handleDelete:g,closePreview:f}}function Ur(t,e,n,r){const o=i.useCallback(c=>{if(c==="all")return{startDate:null,endDate:null};const s=new Date;let g,f=null;switch(c){case"today":g=new Date(s.getFullYear(),s.getMonth(),s.getDate()),f=new Date(s.getFullYear(),s.getMonth(),s.getDate(),23,59,59,999);break;case"yesterday":const v=new Date(s);v.setDate(v.getDate()-1),g=new Date(v.getFullYear(),v.getMonth(),v.getDate()),f=new Date(v.getFullYear(),v.getMonth(),v.getDate(),23,59,59,999);break;case"thisWeek":const x=s.getDay();g=new Date(s),g.setDate(s.getDate()-x),g.setHours(0,0,0,0);break;case"lastWeek":const m=new Date(s);m.setDate(s.getDate()-s.getDay()-7),m.setHours(0,0,0,0),g=m;const p=new Date(m);p.setDate(m.getDate()+6),p.setHours(23,59,59,999),f=p;break;case"thisMonth":g=new Date(s.getFullYear(),s.getMonth(),1);break;case"lastMonth":g=new Date(s.getFullYear(),s.getMonth()-1,1),f=new Date(s.getFullYear(),s.getMonth(),0,23,59,59,999);break;default:g=new Date(0)}return{startDate:g,endDate:f}},[]),l=i.useMemo(()=>{let c=[...e,...t];if(n){const s=n.toLowerCase();c=c.filter(g=>g.name.toLowerCase().includes(s))}if(r!=="all"){const{startDate:s,endDate:g}=o(r);s&&(c=c.filter(f=>{if(f.type==="directory")return!0;if(!f.downloadedAt)return!1;const v=new Date(f.downloadedAt),x=v>=s,m=g?v<=g:!0;return x&&m}))}return c},[e,t,n,r,o]),{filteredDirectories:u,filteredFiles:d}=i.useMemo(()=>{const c=l.filter(g=>g.type==="directory"),s=l.filter(g=>g.type==="file");return{filteredDirectories:c,filteredFiles:s}},[l]);return{filteredDirectories:u,filteredFiles:d}}const Gr=[".jpg",".jpeg",".png",".gif",".webp",".bmp"];function Kr(t,e){return i.useMemo(()=>{const r=[...e,...t],o=r.filter(s=>s.type==="directory").length,l=r.filter(s=>s.type==="file").length,u=r.filter(s=>s.type==="file"&&s.size).reduce((s,g)=>s+(g.size||0),0),d=r.filter(s=>s.type==="file"&&Gr.includes(s.extension?.toLowerCase()||"")).length;return{directories:o,files:l,totalSize:(s=>s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(2)} KB`:`${(s/(1024*1024)).toFixed(2)} MB`)(u),images:d}},[e,t])}const{Title:qr}=Ht,{Option:Mt}=Re;function go(){const{t}=be(),[e,n]=i.useState("illustration"),[r,o]=i.useState(!1),{currentPath:l,handleNavigate:u,handleGoBack:d,resetPath:c}=Wr(),[s,g]=i.useState("type"),[f,v]=i.useState("asc"),[x,m]=i.useState(""),[p,j]=i.useState("all"),{files:w,directories:M,isLoading:R,deleteFileAsync:I}=Nr({path:l,type:e,sort:s,order:f,dateFilter:p==="all"?void 0:p}),h=Ur(w,M,x,p),{previewVisible:b,previewFile:S,handlePreview:y,handleDelete:E,closePreview:O}=Zr(I,e,u),C=Kr(w,M),k=P=>{n(P),c(),m("")},N=P=>{s===P?v(f==="asc"?"desc":"asc"):(g(P),v("asc"))};return a.jsxs("div",{children:[a.jsxs(pt,{justify:"space-between",align:"middle",style:{marginBottom:16},children:[a.jsx(Ce,{children:a.jsx(qr,{level:2,style:{margin:0},children:t("files.title")})}),a.jsx(Ce,{children:a.jsxs(Oe,{children:[a.jsxs(Re,{value:e,onChange:k,style:{width:150},children:[a.jsxs(Mt,{value:"illustration",children:[a.jsx(Ue,{})," ",t("dashboard.illustrations")]}),a.jsxs(Mt,{value:"novel",children:[a.jsx(dt,{})," ",t("dashboard.novels")]})]}),a.jsx(se,{type:"primary",icon:a.jsx(kr,{}),onClick:()=>o(!0),children:t("files.normalizeFiles")})]})})]}),a.jsx(Fr,{directories:C.directories,files:C.files,images:C.images,totalSize:C.totalSize}),a.jsx(ze,{style:{overflow:"hidden"},children:a.jsxs(Oe,{direction:"vertical",style:{width:"100%"},size:"middle",children:[a.jsx(Lr,{searchText:x,onSearchChange:m,dateFilter:p,onDateFilterChange:j,sortBy:s,onSortByChange:g,sortOrder:f,onSortOrderChange:v}),a.jsx($r,{currentPath:l,onNavigate:u,onGoBack:d}),a.jsx(_r,{files:h.filteredFiles,directories:h.filteredDirectories,loading:R,sortBy:s,sortOrder:f,onSort:N,onPreview:y,onDelete:E,onNavigate:u,fileType:e})]})}),a.jsx(Yr,{visible:b,file:S,fileType:e,onClose:O,files:w,onNavigate:y}),a.jsx(Hr,{visible:r,onClose:()=>o(!1)})]})}export{go as default};
|
|
5
|
+
//# sourceMappingURL=Files-nNoRY5tl.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,I as c,_ as a}from"./index-DG6kGbYq.js";var n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2zM304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z"}}]},name:"picture",theme:"outlined"},i=function(t,r){return e.createElement(c,a({},t,{ref:r,icon:n}))},u=e.forwardRef(i);export{u as R};
|
|
2
|
+
//# sourceMappingURL=PictureOutlined-U51jGr2U.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as c,I as n,_ as a}from"./index-DG6kGbYq.js";var l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0012.6 0l112-141.9c4.1-5.2.4-13-6.3-13z"}}]},name:"sort-ascending",theme:"outlined"},h=function(e,t){return c.createElement(n,a({},e,{ref:t,icon:l}))},d=c.forwardRef(h),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM310.3 167.1a8 8 0 00-12.6 0L185.7 309c-4.2 5.3-.4 13 6.3 13h76v530c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V322h76c6.7 0 10.5-7.8 6.3-13l-112-141.9z"}}]},name:"sort-descending",theme:"outlined"},i=function(e,t){return c.createElement(n,a({},e,{ref:t,icon:o}))},v=c.forwardRef(i);export{d as R,v as a};
|
|
2
|
+
//# sourceMappingURL=SortDescendingOutlined-CckVuL_b.js.map
|