filecat 7.32.2 → 7.34.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.

Potentially problematic release.


This version of filecat might be problematic. Click here for more details.

Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/build/dist/1246.2504cc1737e1f6c1b7df.js +1 -0
  3. package/build/dist/1793.388505f01a0f2cfa51ee.js +1 -0
  4. package/build/dist/{1852.16cec79aa004d7d496ee.js → 1852.7968547974ff6e5027b7.js} +1 -1
  5. package/build/dist/{2136.20ea58a65c7fb22d5e43.js → 2136.bfc7af4db34b53764354.js} +1 -1
  6. package/build/dist/2539.4a8af43f286966a85f50.js +1 -0
  7. package/build/dist/2698.e88f57b81b7c2df01c62.js +1 -0
  8. package/build/dist/3187.0552ae51ab59bb661bc7.js +1 -0
  9. package/build/dist/3266.22923890ecd8f170b711.js +1 -0
  10. package/build/dist/3322.11cb2fb4604b71145f15.js +1 -0
  11. package/build/dist/{3355.fe615f78b2015ec080c2.js → 3355.ec9e7ac17d54afa75113.js} +1 -1
  12. package/build/dist/4350.f823a100b94e8f3b556f.js +1 -0
  13. package/build/dist/{4598.7f2b7c8ee1751b912cc6.js → 4598.9349c8620d667bd9abb8.js} +1 -1
  14. package/build/dist/{47.d5cc6abee0da2951a189.js → 47.a469f0a19c1a8a0adac1.js} +1 -1
  15. package/build/dist/526.bff76b57b88c2d4ffa93.js +1 -0
  16. package/build/dist/5599.3106e89134ff993bc90b.js +1 -0
  17. package/build/dist/{6097.fa01bd2ab412cdcb52df.js → 6097.225a48b1e7af976240b7.js} +1 -1
  18. package/build/dist/6439.3da5245841fe3c7cfbb8.js +1 -0
  19. package/build/dist/6471.c5f6de5c28d0ce0ece0e.js +1 -0
  20. package/build/dist/676.99d4464783ff2247e856.js +1 -0
  21. package/build/dist/6930.155cf4ed8fff0398c4b1.js +1 -0
  22. package/build/dist/6952.a3f54cf363c348c5ad16.js +1 -0
  23. package/build/dist/7518.39a7d163fd064dd730ea.js +1 -0
  24. package/build/dist/7576.98b973979d4ac9fd75d3.js +1 -0
  25. package/build/dist/{7678.954622f85bb32a50ad25.js → 7678.a2531207b9df0432c027.js} +1 -1
  26. package/build/dist/8891.bdc07e7b0fdb9b33cb83.js +1 -0
  27. package/build/dist/{9260.fd785c5b4418123dd54f.js → 9260.6e08158f53a391e6a8ad.js} +1 -1
  28. package/build/dist/9636.0a859e32ef66bfaa176d.js +1 -0
  29. package/build/dist/9724.e50b15571a3aed321e10.js +1 -0
  30. package/build/dist/{9765.046a87c8c6ed9427eb45.js → 9765.0a471505df15990bc7bc.js} +1 -1
  31. package/build/dist/9984.ab2ec08866b8f1eca3ca.js +1 -0
  32. package/build/dist/index.html +1 -1
  33. package/build/dist/main.e2009e388b74bf656c39.js +2 -0
  34. package/build/main.js +1 -1
  35. package/package.json +2 -1
  36. package/build/dist/3187.03c9284e30214b476487.js +0 -1
  37. package/build/dist/3322.36f73d119334675d9bc4.js +0 -1
  38. package/build/dist/4350.7412b41befe12857677f.js +0 -1
  39. package/build/dist/6439.e984788ff732b4eeaed8.js +0 -1
  40. package/build/dist/676.82cbafd4308ac08d1e69.js +0 -1
  41. package/build/dist/7133.867e3e82cd874862ec1f.js +0 -1
  42. package/build/dist/main.89376a85f16c77177628.js +0 -2
  43. /package/build/dist/{main.89376a85f16c77177628.js.LICENSE.txt → main.e2009e388b74bf656c39.js.LICENSE.txt} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6439],{74777(e,t,s){s.d(t,{Gd:()=>a,Hb:()=>i,Mu:()=>o,aM:()=>n,jk:()=>l});let n=function(e){return e[e.close=0]="close",e[e.length=1]="length",e[e.forver=2]="forver",e}({}),i=function(e){return e[e.independent=0]="independent",e[e.reuse=1]="reuse",e[e.single=2]="single",e}({});class a{mode;length;persist;session_mode}let l=function(e){return e.ffmpeg="ffmpeg",e.smartmontools="smartctl",e.ufw="ufw",e}({});let o=function(e){return e[e.auth=0]="auth",e[e.cmd=1]="cmd",e[e.cyc=2]="cyc",e[e.sys_env=3]="sys_env",e[e.private_sys_env=4]="private_sys_env",e[e.auto_upgrade=6]="auto_upgrade",e}({})},47996(e,t,s){s.d(t,{d:()=>i});s(96540);var n=s(74848);function i(e){return(0,n.jsxs)("div",{className:"instance-item",children:[(0,n.jsxs)("div",{className:"instance-item__toolbar",children:[(0,n.jsx)("span",{className:"instance-item__label",children:e.title}),e.toolbar]}),e.children]})}},77481(e,t,s){s.d(t,{S:()=>o,X:()=>l});var n=s(96540),i=s(61443),a=s(74848);function l(e){const[t,s]=n.useState([]),l=(0,n.useRef)(-1),[o,r]=(0,n.useState)(-1),[d,c]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const h=()=>{l.current=-1,r(-1),c(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let l=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(l=`${t} (${n.label})`)}return(0,a.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,a.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:l}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(o===s?"row-dragging":"")+(d===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(l.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||l.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",c(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=l.current,s=d;h(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:h,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function o(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},16439(e,t,s){s.r(t),s.d(t,{default:()=>je});var n=s(96540),i=s(75725),a=s(23430),l=s(7572),o=s(85997),r=s(61443),d=s(14284),c=s(53459),h=s(34843),u=s(82893),p=s(77481),m=s(74777),_=s(22022),x=s(4412),j=s(78247),v=s(62042),f=s(64484),y=s(23496),g=s(18840),w=s(6960),b=s(7523),k=s(74848);function S(){const{t:e}=(0,_.Bd)(),[,t]=(0,h.fp)(u.AG.prompt_card),[s,i]=(0,n.useState)(""),[a,x]=(0,n.useState)(5610),[j,f]=(0,n.useState)(5710);(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("sys_option/status");if(e.code===c.m.Success){const t=e.data?.sys_env;i((t?.browser_proxy_allow||[]).join("\n")),x(t?.browser_proxy_port_start||5610),f(t?.browser_proxy_port_end||5710)}})()},[]);return(0,k.jsxs)(l.Zp,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("网页代理")}),(0,k.jsx)(o.rA,{icon:"info",title:e("信息"),onClick:()=>{t({open:!0,title:e("信息"),context_div:(0,k.jsx)("div",{children:(0,k.jsx)("div",{children:e("wbvpn_tip")})})})}})]}),rightBottomCom:(0,k.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{const t=s.split("\n").map(e=>e.trim()).filter(e=>!!e);(await d.XO.post(y.s.setting_sys_option_status_save,{type:m.Mu.sys_env,value:{browser_proxy_allow:t,browser_proxy_port_start:Number(a)||5610,browser_proxy_port_end:Number(j)||5710}})).code===c.m.Success&&(0,v.SK)(e("修改成功"))}}),children:[(0,k.jsx)("div",{children:e("wbvpn_allow")}),(0,k.jsx)(r.Z2,{style:{minHeight:"5rem",resize:"vertical"},placeholder:e("wbvpn_allow_ph"),value:s,onChange:e=>{i(e.target.value)}}),(0,k.jsx)("div",{children:e("wbvpn_port_range")}),(0,k.jsx)(p.S,{isFlex:!0,columns:[(0,k.jsx)(r.Sm,{placeholder:"5610",value:a,handleInputChange:e=>x(e)}),(0,k.jsx)("span",{style:{padding:"0 6px"},children:"-"}),(0,k.jsx)(r.Sm,{placeholder:"5710",value:j,handleInputChange:e=>f(e)})]})]})}function C(){const[e,t]=(0,n.useState)(""),[s,a]=(0,n.useState)(""),[C,A]=(0,n.useState)(!1),[I,N]=(0,n.useState)(!1),[$,V]=(0,n.useState)(""),[B,P]=(0,n.useState)(!1),[F,z]=(0,n.useState)(""),[K,X]=(0,h.fp)(u.AG.prompt_card),[,O]=(0,h.fp)(u.AG.editorSetting),[T,M]=(0,n.useState)(m.aM.close),[q,D]=(0,n.useState)(!1),[H,U]=(0,n.useState)(m.Hb.independent),W=(0,f.T)(),[E,Z]=(0,n.useState)(void 0),[G,R]=(0,n.useState)(""),{t:L,i18n:J}=(0,_.Bd)(),Q=[`- ${L("过期策略:默认表示使用系统内置的1小时过期时间;指定时间按填写的秒数过期;永不过期则token一直有效")}`,`- ${L("独立token:每次登录都签发新的token,同一账号可以在多个设备同时登录,互不影响")}`,`- ${L("复用token:该账号已有未过期的token时直接复用它,不会签发新的")}`,`- ${L("单会话:每次登录签发新的token,并让该账号此前的所有token立即失效")}`].join("\n"),[Y,ee]=(0,h.fp)(u.AG.user_base_info),{check_user_auth:te}=(0,j.MH)(),{initUserInfo:se}=(0,n.useContext)(b.F),ne=async()=>{const e=await d.XO.get("sys_option/status");if(e.code===c.m.Success){P(e.data.recycle_open),z(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),a(s?.logo||""),A(s?.show_login_user_info),N(s?.hide_version??!1),V(s?.http_proxy||""),R(s?.control_env_str||g.CU)}const s=await d.XO.get("token");if(s.code===c.m.Success){const e=s.data;if(!e)return;e.length&&Z(e.length),e.mode&&M(e.mode),void 0!==e.persist&&D(e.persist),void 0!==e.session_mode&&U(e.session_mode)}};(0,n.useEffect)(()=>{ne()},[]);return(0,k.jsxs)("div",{children:[(0,k.jsx)(x.aZ,{children:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)("span",{className:"credits",children:[L("系统运行于"),": ",(0,w.s)(Y.runing_time_length)]}),(0,k.jsx)("span",{className:"credits",children:(0,k.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:7.34.0",null!=Y.latest_version&&"7.34.0"!==Y.latest_version?` -> ${Y.latest_version}`:""]})}),(0,k.jsx)("span",{className:"credits",children:(0,k.jsx)("a",{href:L("官网地址"),target:"_blank",children:`filecat ${L("功能文档")}`})}),(0,k.jsxs)("span",{className:"credits",children:[L("安装方式")," :",Y.process_env_run_env]})]})}),(0,k.jsx)(i.xh,{children:(0,k.jsxs)(i.fI,{children:[(0,k.jsxs)(i.VP,{widthPer:33,children:[(0,k.jsxs)(l.Zp,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:L("通用设置")})," ",(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{X({open:!0,title:L("信息"),context_div:(0,k.jsx)("div",{children:(0,k.jsx)("div",{children:L("sys_env_setting_tip")})})})},title:L("信息")})]}),rightBottomCom:(0,k.jsx)(o.C3,{text:L("确定修改"),clickFun:async()=>{(await d.XO.post(y.s.setting_sys_option_status_save,{type:m.Mu.sys_env,value:{web_site_title:e,show_login_user_info:C,hide_version:I,http_proxy:$,logo:s}})).code===c.m.Success&&((0,v.SK)(L("修改成功")),se())}}),rightTopCom:(0,k.jsx)(o.rA,{icon:"tune",title:L("环境控制"),onClick:()=>{j.xK.set_value_temp(G||g.CU),O({model:"ace/mode/yaml",open:!0,fileName:"",not_auto_save:!0,save:async e=>{const t=await d.XO.post(y.s.setting_sys_option_status_save,{type:m.Mu.sys_env,value:{control_env_str:e}});t.code===c.m.Success?(R(e),(0,v.SK)(L("修改成功")),ne()):(0,v.zN)(`${t.message??L("保存失败")}`)}})}}),children:[L("网站标题"),(0,k.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),L("网站 Logo"),(0,k.jsx)(r.Sm,{placeholder:L("lclorur"),value:s,handleInputChange:e=>{a(e)}}),(0,k.jsxs)("div",{children:[(0,k.jsx)("input",{type:"checkbox",checked:C,onChange:()=>{A(!C)}}),L("lgn_usr")]}),(0,k.jsxs)("div",{children:[(0,k.jsx)("input",{type:"checkbox",checked:I,onChange:()=>{N(!I)}}),L("hide_ver")]})]}),(0,k.jsx)(S,{})]}),(0,k.jsxs)(i.VP,{widthPer:33,children:[(0,k.jsxs)(l.Zp,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:L("文件回收站")})," ",(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{X({open:!0,title:L("信息"),context_div:(0,k.jsx)("div",{children:L("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:L("信息")})]}),rightBottomCom:(0,k.jsx)(o.C3,{text:L("确定修改"),clickFun:async()=>{if(B&&!F)return void(0,v.zN)(L("目录不能为空"));(await d.XO.post(y.s.setting_sys_option_status_save,{type:m.Mu.cyc,value:F,open:B})).code===c.m.Success&&(0,v.SK)(L("修改成功"))}}),children:[(0,k.jsx)(r.Sm,{placeholder:L("目录"),value:F,handleInputChange:e=>{z(e)}}),(0,k.jsx)(r.l6,{value:B,onChange:e=>{P(e)},options:[{title:L("开启"),value:!0},{title:L("关闭"),value:!1}]})]}),(0,k.jsxs)(l.Zp,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:L("会话token设置")}),(0,k.jsx)(o.rA,{icon:"info",title:L("登录会话"),onClick:()=>W(Q)})]}),rightBottomCom:(0,k.jsx)(p.S,{isFlex:!0,columns:[(0,k.jsx)(o.C3,{text:L("清空token"),clickFun:async()=>{(await d.XO.get("token/clear")).code===c.m.Success&&(0,v.SK)(L("清理完成,重新登录"))}}),(0,k.jsx)(o.C3,{text:L("保存"),clickFun:async()=>{const e=new m.Gd;e.mode=T,e.persist=q,e.session_mode=H,m.aM.length!==e.mode||E||(0,v.zN)(L("秒数不能为空")),e.length=parseInt(E);(await d.XO.post("token/save",e)).code===c.m.Success&&(0,v.SK)(L("保存成功"))}})]}),children:[(0,k.jsxs)("div",{className:"form_group",children:[(0,k.jsx)("div",{className:"form_label",children:L("过期策略")}),(0,k.jsx)(p.S,{isFlex:!0,columns:[(0,k.jsx)(r.U6,{name:"token_time_mode",value:1,context:L("默认"),selected:T===m.aM.close,onchange:()=>{M(m.aM.close)}}),(0,k.jsx)(r.U6,{name:"token_time_mode",value:1,context:L("指定时间"),selected:T===m.aM.length,onchange:()=>{M(m.aM.length)}}),(0,k.jsx)(r.U6,{name:"token_time_mode",value:1,context:L("永不过期"),selected:T===m.aM.forver,onchange:()=>{M(m.aM.forver)}})]}),T===m.aM.length&&(0,k.jsx)(r.Sm,{placeholder:L("秒"),value:E,handleInputChange:e=>{Z(e)}}),(0,k.jsx)(r.GL,{context:L("持久化"),selected:q,onchange:()=>D(!q)})]}),(0,k.jsxs)("div",{className:"form_group",children:[(0,k.jsx)("div",{className:"form_label",children:L("登录会话")}),(0,k.jsx)(p.S,{isFlex:!0,columns:[(0,k.jsx)(r.U6,{name:"token_session_mode",value:m.Hb.independent,context:L("独立token"),selected:H===m.Hb.independent,onchange:()=>U(m.Hb.independent)}),(0,k.jsx)(r.U6,{name:"token_session_mode",value:m.Hb.reuse,context:L("复用token"),selected:H===m.Hb.reuse,onchange:()=>U(m.Hb.reuse)}),(0,k.jsx)(r.U6,{name:"token_session_mode",value:m.Hb.single,context:L("单会话"),selected:H===m.Hb.single,onchange:()=>U(m.Hb.single)})]})]})]})]})]})})]})}var A=s(64694),I=s(92350),N=s(69675),$=s(32361);const V=[{key:"second",min:0,max:59,label:"秒"},{key:"minute",min:0,max:59,label:"分"},{key:"hour",min:0,max:23,label:"时"},{key:"day",min:1,max:31,label:"日"},{key:"month",min:1,max:12,label:"月"},{key:"week",min:0,max:7,label:"星期"}];function B(e){switch(e.mode){case"step":return`*/${e.step??1}`;case"range":return`${e.from??0}-${e.to??0}`;case"list":return(e.values??[]).join(",");default:return"*"}}function P(e){return[B(e.second),B(e.minute),B(e.hour),B(e.day),B(e.month),B(e.week)].join(" ")}function F(e,t,s){const n=(e??"").trim();if(!n)return null;if("*"===n)return{mode:"every"};if(n.startsWith("*/")){const e=Number(n.slice(2));return!Number.isInteger(e)||e<=0?null:{mode:"step",step:e}}if(n.includes("-")&&!n.includes(",")){const[e,i]=n.split("-").map(Number);return Number.isInteger(e)&&Number.isInteger(i)?e<t||i>s||e>i?null:{mode:"range",from:e,to:i}:null}const i=n.split(","),a=[];for(const e of i){const n=Number(e.trim());if(!Number.isInteger(n)||n<t||n>s)return null;a.push(n)}return 0===a.length?null:{mode:"list",values:a}}function z(e){const t=(e??"").trim().split(/\s+/);if(6!==t.length)return null;const s={};for(let e=0;e<6;e++){const n=V[e],i=F(t[e],n.min,n.max);if(!i)return null;s[n.key]=i}return s}function K(e){return e<10?`0${e}`:`${e}`}function X(e,t,s){switch(e.mode){case"step":return`每 ${e.step} ${t}`;case"range":return`${e.from} 到 ${e.to} ${t}`;case"list":return`${(e.values??[]).slice().sort((e,t)=>e-t).join("、")} ${t}`;default:return null}}function O(e){const{second:t,minute:s,hour:n,day:i,month:a,week:l}=e,o=(e,t)=>"list"===e.mode&&1===(e.values??[]).length&&e.values[0]===t,r=[];if("list"===n.mode&&"list"===s.mode&&o(t,0)){const e=(n.values??[]).slice().sort((e,t)=>e-t),t=(s.values??[]).slice().sort((e,t)=>e-t);e.length===t.length&&e.length>1&&t.length>1?r.push(e.map((e,s)=>`${K(e)}:${K(t[s])}`).join("、")):1===e.length&&1===t.length?r.push(`${K(e[0])}:${K(t[0])}`):r.push(`${e.map(K).join("、")} 时 ${t.join("、")} 分`)}else if("list"===n.mode&&"step"===s.mode&&o(t,0))r.push(`${(n.values??[]).map(K).join("、")} 时内每 ${s.step} 分钟`);else if("every"===n.mode&&"list"===s.mode&&o(t,0))r.push(`每小时的 ${(s.values??[]).join("、")} 分`);else if("every"===n.mode&&"step"===s.mode&&o(t,0))r.push(`每 ${s.step} 分钟`);else if("every"===n.mode&&"every"===s.mode&&o(t,0))r.push("每分钟");else if("every"===n.mode&&"every"===s.mode&&"step"===t.mode)r.push(`每 ${t.step} 秒`);else if("every"===n.mode&&"every"===s.mode&&"every"===t.mode)r.push("每秒");else if("every"===n.mode&&"every"===s.mode&&"list"===t.mode)r.push(`每分钟的第 ${(t.values??[]).join("、")} 秒`);else{const e=[],i=X(n,"时"),a=X(s,"分"),l=o(t,0)?null:X(t,"秒");i&&e.push(i),a&&e.push(a),l&&e.push(l),e.length>0&&r.push(e.join(" "))}const d="list"===i.mode&&1===(i.values??[]).length?i.values[0]:null,c="list"===a.mode&&1===(a.values??[]).length?a.values[0]:null,h="list"===l.mode&&1===(l.values??[]).length?l.values[0]:null;let u="";if(null!==c&&null!==d)u=`每年 ${c} 月 ${d} 号`;else if(null!==c)u=`每年 ${c} 月`;else if(null!==d)u=`每月 ${d} 号`;else if(null!==h)u=`每${["周日","周一","周二","周三","周四","周五","周六","周日"][h]??`星期 ${h}`}`;else{const e=[];"every"!==a.mode&&e.push(X(a,"月")),"every"!==i.mode&&e.push(X(i,"号")),"every"!==l.mode&&e.push(`星期 ${X(l,"")}`),e.length&&(u=e.join(" "))}u||(u="每天");const p=r.join(",");return/^(每|每天)/.test(p)?`${p}${"每天"===u?"":","+u} 执行`:`${u} ${p} 执行`}const T=[{label:"任意 (*)",value:"every"},{label:"每隔 (*/n)",value:"step"},{label:"区间 (a-b)",value:"range"},{label:"指定 (a,b)",value:"list"}];function M(e,t,s=!1){const n=[];for(let i=e;i<=t;i++)n.push({label:s?String(i).padStart(2,"0"):String(i),value:i});return n}const q=({label:e,field:t,min:s,max:i,pad:a,week_label:l,onChange:o})=>{const d=(0,n.useMemo)(()=>M(s,i,a),[s,i,a]),c=(0,n.useMemo)(()=>{if(!l)return d;const e=["周日","周一","周二","周三","周四","周五","周六","周日"];return d.map(t=>({value:t.value,label:`${t.value} (${e[t.value]})`}))},[d,l]);return(0,k.jsxs)("div",{className:"cron-field",children:[(0,k.jsx)("span",{className:"cron-field__label",children:e}),(0,k.jsx)(r.l6,{value:t.mode,onChange:e=>{o("every"===e?{mode:"every"}:"step"===e?{mode:"step",step:t.step??1}:"range"===e?{mode:"range",from:t.from??s,to:t.to??i}:{mode:"list",values:t.values??[s]})},options:T,no_border:!0,width:"7.5rem"}),"step"===t.mode&&(0,k.jsxs)("div",{className:"cron-field__param",children:[(0,k.jsx)("span",{children:"每"}),(0,k.jsx)(r.l6,{value:t.step??1,onChange:e=>o({mode:"step",step:e}),options:M(1,i),no_border:!0,width:"4.5rem"}),(0,k.jsx)("span",{children:e})]}),"range"===t.mode&&(0,k.jsxs)("div",{className:"cron-field__param",children:[(0,k.jsx)(r.l6,{value:t.from??s,onChange:e=>o({mode:"range",from:e,to:t.to??i}),options:c,no_border:!0,width:"6.5rem"}),(0,k.jsx)("span",{children:"到"}),(0,k.jsx)(r.l6,{value:t.to??i,onChange:e=>o({mode:"range",from:t.from??s,to:e}),options:c,no_border:!0,width:"6.5rem"})]}),"list"===t.mode&&(0,k.jsxs)("div",{className:"cron-field__param cron-field__param--list",children:[(t.values??[]).map((e,s)=>(0,k.jsxs)("span",{className:"cron-tag",children:[(0,k.jsx)(r.l6,{value:e,onChange:e=>((e,s)=>{const n=[...t.values??[]];n[e]=s,o({mode:"list",values:n})})(s,e),options:c,no_border:!0,width:"6.5rem"}),(0,k.jsx)("i",{className:"material-icons cron-tag__del",onClick:()=>(e=>{const s=(t.values??[]).filter((t,s)=>s!==e);o(s.length?{mode:"list",values:s}:{mode:"every"})})(s),children:"close"})]},s)),(0,k.jsx)("i",{className:"material-icons cron-tag__add",onClick:()=>{const e=[...t.values??[]],n=new Set(e);let a=s;for(;n.has(a)&&a<i;)a++;o({mode:"list",values:[...e,a]})},children:"add"})]})]})};const D=[{label:"每分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},second:{mode:"list",values:[0]}})},{label:"每 5 分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"step",step:5},second:{mode:"list",values:[0]}})},{label:"每小时",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 8 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[8]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每周一 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},week:{mode:"list",values:[1]}})},{label:"每月 1 号 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},day:{mode:"list",values:[1]}})}],H=({value:e,onChange:t,no_border:s})=>{const[i,a]=(0,n.useState)(!1),l=(0,n.useRef)(null),o=(0,n.useRef)(null),r=(0,n.useMemo)(()=>z(e??"")??{second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"}},[e]),d=!!e&&!z(e??""),c=(0,$.r)({active:i,trigger_ref:l,floating_ref:o,width:384,max_height:26});(0,N.$)(i,[l,o],()=>a(!1));const h=e=>{t(P(e))};return(0,k.jsxs)("div",{className:"cron-input "+(i?"cron-input--open":""),children:[(0,k.jsxs)("div",{ref:l,className:"cron-input__display "+(s?"cron-input__display--no-border":""),title:d?"表达式格式不正确":`${e||""} ${O(r)}`.trim(),onClick:()=>a(!i),children:[(0,k.jsx)("span",{className:"cron-input__expr "+(d?"cron-input__expr--invalid":""),children:e||"(未设置)"}),!s&&(0,k.jsx)("span",{className:"cron-input__desc",children:d?"表达式格式不正确":O(r)}),(0,k.jsx)("i",{className:"material-icons cron-input__arrow",children:"arrow_drop_down"})]}),i&&(0,k.jsxs)("div",{ref:o,className:"cron-editor",style:{left:c.left,top:c.top,...c.css_vars,visibility:c.ready?"visible":"hidden"},children:[(0,k.jsxs)("div",{className:"cron-editor__scroll",children:[(0,k.jsxs)("div",{className:"cron-editor__row",children:[(0,k.jsx)("span",{className:"cron-editor__title",children:"常用"}),(0,k.jsx)("div",{className:"cron-editor__presets",children:D.map(e=>(0,k.jsx)("button",{className:"cron-preset",onClick:()=>h(e.make()),children:e.label},e.label))})]}),(0,k.jsx)("div",{className:"cron-editor__fields",children:V.map(e=>(0,k.jsx)(q,{label:e.label,field:r[e.key],min:e.min,max:e.max,pad:"day"!==e.key&&"month"!==e.key&&"week"!==e.key,week_label:"week"===e.key,onChange:t=>{return s=e.key,n=t,void h({...r,[s]:n});var s,n}},e.key))})]}),(0,k.jsxs)("div",{className:"cron-editor__footer",children:[(0,k.jsx)("span",{className:"cron-editor__preview",children:P(r)}),(0,k.jsx)("button",{className:"cron-editor__done",onClick:()=>a(!1),children:"完成"})]})]})]})};var U=s(24659);function W(){const{t:e,i18n:t}=(0,_.Bd)(),{initUserInfo:s,reloadUserInfo:a}=(0,n.useContext)(b.F),[m,x]=(0,n.useState)([]),[f,y]=(0,n.useState)([]),[g,w]=(0,h.fp)(u.AG.prompt_card),[,S]=(0,h.fp)(u.AG.editorSetting),[C,N]=(0,n.useState)([]),[$,V]=(0,n.useState)([]),[B,P]=(0,n.useState)([]),[F,z]=(0,n.useState)([]),[K,X]=(0,n.useState)(""),[O,T]=(0,n.useState)([]),M=(0,U.K)(),q=[e("软件"),e("是否安装"),e("路径")],D=[e("编号"),e("路径"),e("备注")],W=[e("编号"),e("路径"),e("是否开启"),e("备注")],E=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("cron表达式"),e("用户id"),e("备注")],Z=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("big_res"),e("big_sz"),e("大文件并发数量"),e("big_ck"),e("备注")],G=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:R}=(0,j.MH)(),L=async()=>{const e=await d.XO.get("env/path/get");e.code===c.m.Success&&P(e.data)},J=async()=>{const e=await d.XO.get("workflow_setting_get");e.code===c.m.Success&&z(e.data)};(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("outside/software/get");e.code===c.m.Success&&y(e.data);const t=await d.XO.get("pty_cmd");t.code===c.m.Success&&X(t.data),L(),J();const s=await d.XO.get("protection_dir/sys");s.code===c.m.Success&&N(s.data??[]);const n=await d.XO.get("dir_upload_max_num");n.code===c.m.Success&&V(n.data??[]);const i=await d.XO.get("plugin/list");i.code===c.m.Success&&T(i.data??[])})()},[]);const Q=(0,I.Q)(),Y=async()=>{await d.XO.post("plugin/list/save",O)};return(0,k.jsxs)(n.Fragment,{children:[(0,k.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,k.jsx)(l.uF,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("up_conc")})," ",(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:e("信息")})]}),rightTopCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...$,{path:"",note:"",user_upload_num:2,sys_upload_num:6,ws_file_standard_size:52428800,ws_file_parallel_num:2,ws_file_block_mb_size:524288}])}}),(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of $)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,v.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,v.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,v.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,A.di)($,e=>e.index??0);(await d.XO.post("dir_upload_max_num/save",$)).code===c.m.Success&&((0,v.SK)(e("保存成功")),a())}})]}),children:(0,k.jsx)(p.X,{headers:Z,rows:$.map((t,s)=>{const n=[(0,k.jsx)(r.Sm,{value:t.index,placeholder:s,handleInputChange:e=>{t.index=parseInt(e)},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.user_upload_num,handleInputChange:e=>{t.user_upload_num=parseInt(e)},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.sys_upload_num,handleInputChange:e=>{t.sys_upload_num=parseInt(e)},no_border:!0}),(0,k.jsx)(r.l6,{value:!0===t.open_ws_file,onChange:e=>{t.open_ws_file=e,V([...$])},options:M,no_border:!0}),(0,k.jsx)(r.Sm,{value:"number"==typeof t.ws_file_standard_size?t.ws_file_standard_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_standard_size=1024*parseInt(e)*1024},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,k.jsx)(r.Sm,{value:"number"==typeof t.ws_file_block_mb_size?t.ws_file_block_mb_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_block_mb_size=1024*parseInt(e)*1024},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{$.splice(e,1),V([...$])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,A.TI)($,e,t))}})})}),(0,k.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,k.jsx)(l.uF,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("Workflow Job")}),(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:e("信息")})]}),rightTopCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{z([...F,{open:!1}])}}),(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("workflow_setting_save",F)).code===c.m.Success&&((0,v.SK)("ok"),J())}})]}),children:(0,k.jsx)(p.X,{headers:E,rows:F.map((t,s)=>{const n=[(0,k.jsx)("div",{children:s}),(0,k.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,k.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,z([...F])},options:M,no_border:!0}),(0,k.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,z([...F])},options:M,no_border:!0}),(0,k.jsx)(H,{value:t.cron_str,onChange:e=>{t.cron_str=e,z([...F])},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.user_id,handleInputChange:e=>{t.user_id=e},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{F.splice(e,1),z([...F])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{z((0,A.TI)(F,e,t))}})})}),(0,k.jsxs)(i.fI,{children:[(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,k.jsxs)(i.xh,{children:[(0,k.jsx)(l.uF,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("PATH")}),(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:e("信息")})]}),rightTopCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await d.XO.get("env/process/view");t.code===c.m.Success?w({open:!0,title:e("进程环境变量"),context_div:(0,k.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:"60vh",overflow:"auto",margin:0,fontSize:"0.85rem",lineHeight:"1.5"},children:t.data})}):(0,v.zN)(e("获取失败"))}}),(0,k.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await d.XO.get("env/process/get");t.code===c.m.Success?(j.xK.set_value_temp(t.data??""),S({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{await d.XO.post("env/process/save",{text:e})}})):(0,v.zN)(e("获取失败"))}}),(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...B,{path:"",note:""}])}}),(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("env/path/save",{paths:B})).code===c.m.Success&&((0,v.SK)(e("保存成功")),L(),s())}})]}),children:(0,k.jsx)(p.X,{headers:W,rows:B.map((t,s)=>{const n=[(0,k.jsx)("div",{children:s}),(0,k.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,k.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,P([...B])},options:M,no_border:!0}),(0,k.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{B.splice(e,1),P([...B])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{P((0,A.TI)(B,e,t))}})}),(0,k.jsx)(l.Zp,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("PTY CMD")}),(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{Q("pty")},title:e("信息")})]}),rightBottomCom:(0,k.jsx)(o.C3,{text:e("更新"),clickFun:async()=>{(await d.XO.post("pty_cmd/save",{str:K})).code===c.m.Success&&((0,v.SK)(e("保存成功")),a())}}),children:(0,k.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:K,handleInputChange:e=>{X(e)}})}),(0,k.jsx)(l.uF,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("插件配置")}),(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:e("信息")})]}),rightTopCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{T([...O,{name:"",path:"",note:"",open:!1}])}}),(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:Y})]}),children:(0,k.jsx)(p.X,{headers:G,rows:O.map((t,s)=>{const n=[s,(0,k.jsx)(r.Sm,{value:t.name,handleInputChange:e=>{t.name=e},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,k.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,T([...O])},options:M,no_border:!0}),(0,k.jsx)(o.mu,{icon:"edit",value:t.params,save:async e=>{t.params=e,await Y()},title:""}),(0,k.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),T([...O])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{T((0,A.TI)(O,e,t))}})})]})}),(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,k.jsxs)(i.xh,{children:[(0,k.jsx)(l.uF,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("系统保护路径")})," ",(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:e("信息")})]}),rightTopCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...C,{path:"",note:""}])}}),(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("protection_dir/sys/save",C)).code===c.m.Success&&((0,v.SK)(e("保存成功")),a())}})]}),children:(0,k.jsx)(p.X,{headers:D,rows:C.map((t,s)=>{const n=[(0,k.jsx)("div",{children:s}),(0,k.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),N([...C])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{N((0,A.TI)(C,e,t))}})}),(0,k.jsx)(l.uF,{title:e("外部软件"),rightTopCom:(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("outside/software/save",f)).code===c.m.Success&&((0,v.SK)(e("保存成功")),s())}}),children:(0,k.jsx)(p.X,{headers:q,rows:f.map((t,s)=>[(0,k.jsx)("div",{children:t.id}),(0,k.jsx)(l.fq,{ok:t.installed}),(0,k.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("use_env")}),(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{Q(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}var E=s(21499);function Z(e){const{t,i18n:s}=(0,_.Bd)(),[i,l]=(0,h.fp)(u.AG.user_base_info),o=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:a.oV.user_manage},{title:t("角色管理"),permission:a.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:a.oV.all_sys},{title:t("系统进程关闭"),permission:a.oV.sys_process_close},{title:t("dc_ctdl"),permission:a.oV.docker_container_update},{title:t("dc_idl"),permission:a.oV.docker_images_delete},{title:t("systemd管理"),permission:a.oV.systemd},{title:t("防火墙管理"),permission:a.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:a.oV.vir_net},{title:t("内网穿透"),permission:a.oV.tcp_proxy},{title:"ddns",permission:a.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:a.oV.ai_agent_setting},{title:t("ai_page"),permission:a.oV.ai_agent_page},{title:t("sw_mdl"),permission:a.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("log_del"),permission:a.oV.filecat_file_delete_cut_rename},{title:t("log_wr"),permission:a.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:a.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:a.oV.recycle_file_save},{title:t("文件分享"),permission:a.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:a.oV.sys_setting_page},{title:t("tk_time"),permission:a.oV.token_update},{title:t("修改密码"),permission:a.oV.update_password},{title:t("磁盘挂载"),permission:a.oV.sys_disk_mount},{title:t("通用设置"),permission:a.oV.sys_env_setting_key},{title:t("md_set"),permission:a.oV.md_editor_setting},{title:t("目录挂载"),permission:a.oV.file_mount},{title:t("文件服务"),permission:a.oV.file_server}]},{title:t("系统环境设置"),list:[{title:t("sys_env"),permission:a.oV.sys_env_page},{title:t("up_lim"),permission:a.oV.dir_upload_max_num},{title:t("path_md"),permission:a.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:a.oV.pty_cmd_update},{title:"workflow job",permission:a.oV.workflow_job},{title:t("path_up"),permission:a.oV.sys_protection_dir},{title:t("外部软件路径"),permission:a.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:a.oV.private_sys_env}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:a.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:a.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:a.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:a.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy},{title:t("http代理"),permission:a.oV.http_proxy},{title:t("pxy_off"),permission:a.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:a.oV.browser_proxy},{title:t("浏览器代理编辑"),permission:a.oV.browser_proxy_edit},{title:t("rdp代理"),permission:a.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("wf_run"),permission:a.oV.workflow_exe},{title:t("wf_user"),permission:a.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:a.oV.wol_proxy},{title:t("端口扫描"),permission:a.oV.port_scan},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy},{title:t("ssh_sv"),permission:a.oV.crypto_ssh_file},{title:t("cmd_rst"),permission:a.oV.shell_cmd_filecat_restart},{title:t("cmd_upg"),permission:a.oV.shell_cmd_filecat_upgrade},{title:t("cmd_dwn"),permission:a.oV.shell_cmd_filecat_kill_self},{title:t("cmd_ai"),permission:a.oV.ai_chat_cmd}]}];return(0,k.jsx)(n.Fragment,{children:o.map((t,s)=>(0,k.jsxs)("div",{children:[(0,k.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,k.jsxs)("div",{children:[(0,k.jsx)("input",{type:"checkbox",disabled:!t.noDisable&&e.is_disable(t.permission),checked:e.is_selected(t.permission,t.noDisable),onChange:()=>{e.select_auth(t.permission)}}),t.title]},s))]},s))})}const G=new Map;function R(){const{t:e,i18n:t}=(0,_.Bd)(),{initUserInfo:s,reloadUserInfo:m}=(0,n.useContext)(b.F),[x,j]=(0,h.fp)(u.AG.user_base_info),[f,y]=(0,n.useState)([]),[g,w]=(0,h.fp)(u.AG.prompt_card),[S,C]=(0,n.useState)(!1),[N,$]=(0,n.useState)(!1),[V,B]=(0,h.fp)(u.AG.confirm),[P,F]=(0,n.useState)(""),[z,K]=(0,n.useState)(""),[X,O]=(0,n.useState)(""),[T,M]=(0,n.useState)([]),[q,D]=(0,n.useState)([]),[H,U]=(0,n.useState)([]),[W,R]=(0,n.useState)(""),[L,J]=(0,n.useState)(""),[Q,Y]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,ae]=(0,n.useState)(""),[le,oe]=(0,n.useState)(!1),[re,de]=(0,n.useState)(""),[ce,he]=(0,n.useState)(""),[ue,pe]=(0,n.useState)({}),me=(0,I.o)(),[_e,xe]=(0,n.useState)([]),[je,ve]=(0,n.useState)(void 0),fe=[e("用户id"),e("用户名"),e("目录范围"),e("备注")],ye=async()=>{const e=await d.wm.get("all_users");if(e.code===c.m.Success){const t=e.data??[];if(je){const e=[];for(const s of t)`${s.id}${s.username}${s.cwd}${s.note}`.includes(je)&&e.push(s);y(e)}else y(t)}const t=await d.wm.get("all_roles");if(t.code===c.m.Success){xe(t.data),G.clear();for(const e of t.data)G.set(e.role_id,e)}},ge=e=>{F(e?.username??""),K(e?.password??""),O(e?.cwd??""),M(e?.access_dirs??[]),D(e?.not_access_dirs??[]),U(e?.only_read_dirs??[]),R(e?.access_cmd??""),J(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),ae(e?.note??""),oe(e?.is_root??!1),de(e?.id??""),e?.bind_role_id?we(e.bind_role_id,e.auth_list??[]):(he(""),pe({}))};(0,n.useEffect)(()=>{ye()},[]);const we=(e,t=[])=>{if(!e)return he(""),void pe({});const s=G.get(e);if(s){if(s.cwd&&O(s.cwd),s.access_dirs&&s.access_dirs.length>0&&M(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&D(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&U(s.only_read_dirs),s.access_cmd&&R(s.access_cmd),s.not_access_cmd&&J(s.not_access_cmd),s.language&&Y(s.language),s.theme&&te(s.theme),s.auth_list&&s.auth_list.length>0){const e=new Set(s.auth_list);for(const s of t)e.add(s);ne(Array.from(e))}he(e),pe(s)}},be=()=>{if(!P)return void(0,v.zN)("username not empty");if((0,E.CB)(P))return void(0,v.zN)("username not empty char");if(!X)return void(0,v.zN)("cwd not empty");const e=new a.E0;return e.language=Q,e.theme=ee,e.access_dirs=T,e.username=P,e.password=z,e.not_access_dirs=q,e.only_read_dirs=H,e.cwd=X,e.note=ie,e.access_cmd=W,e.not_access_cmd=L,e.auth_list=se,e.bind_role_id=ce,e};return(0,k.jsxs)(i.fI,{children:[(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,k.jsx)(i.xh,{children:(0,k.jsx)(l.uF,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:e("用户")})}),rightTopCom:(0,k.jsxs)("div",{className:"div-row",style:{gap:"0.5rem"},children:[(0,k.jsx)(r.Sm,{placeholder:e("过滤"),value:je,handleInputChange:e=>{ve(e)},handlerEnter:()=>{ye()}}),(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{C(!0),$(!1),ge(void 0)}})]}),children:(0,k.jsx)(p.X,{headers:fe,rows:f.map((t,s)=>{const n=[(0,k.jsx)("p",{children:t.id}),(0,k.jsx)(l.xP,{children:t.username}),(0,k.jsx)(l.xP,{children:t.cwd}),(0,k.jsx)(l.xP,{children:t.note}),(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{C(!1),$(!0),ge(e)})(t)}),!t.is_root&&(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{B({open:!0,title:e("确定删除吗"),handle:async()=>{const s=new a.E0;s.username=t,(await d.wm.post("delete_user",s)).code===c.m.Success&&((0,v.SK)(e("删除完成")),ye(),B({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(S||N)&&(0,k.jsx)(i.xh,{children:(0,k.jsxs)(l.Zp,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e(""+(S?"添加":"编辑"))})," "]}),rightBottomCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{C(!1),$(!1),ge(void 0)}}),S&&(0,k.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!z)return void(0,v.zN)("password not empty");if((0,E.CB)(z))return void(0,v.zN)("username not empty char");const t=be(),s=await d.wm.post("create_user",t);ye(),s.code===c.m.Success&&((0,v.SK)(e("创建完成")),ye(),C(!1),$(!1),ge(void 0))}}),N&&(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=be();if(!t)return;t.id=re;(await d.wm.post("save_user",t)).code===c.m.Success&&((0,v.SK)(e("保存完成")),ye())}})]}),children:[(0,k.jsx)("label",{children:e("用户名")}),(0,k.jsx)(r.Sm,{value:P,handleInputChange:e=>F(e)}),(0,k.jsx)("label",{children:e("密码")}),(0,k.jsx)(r.Sm,{type:"password",value:z,handleInputChange:e=>K(e)}),(0,k.jsxs)("label",{children:[!ue?.access_dirs?.length&&(0,k.jsx)(o.rA,{icon:"add",onClick:()=>{M([...T,""])},title:"添加"}),e("目录范围")]}),(0,k.jsx)(r.Sm,{disabled:""!==ue.cwd&&void 0!==ue.cwd,value:X,handleInputChange:e=>O(e)}),(T??[]).map((t,s)=>(0,k.jsxs)("div",{style:{display:"flex"},children:[(0,k.jsx)("div",{style:{width:"90%"},children:(0,k.jsx)(r.Sm,{disabled:0!==ue?.access_dirs?.length&&void 0!==ue?.access_dirs?.length,value:t,handleInputChange:e=>{T[s]=e,M([...T])}})}),0===ue?.access_dirs?.length||void 0===ue?.access_dirs?.length&&(0,k.jsx)(o.rA,{icon:"delete",onClick:()=>{T.splice(s,1),M([...T])},title:e("删除")})]},s)),(0,k.jsxs)("label",{children:[!ue?.not_access_dirs?.length&&(0,k.jsx)(o.rA,{icon:"add",onClick:()=>{D([...q,""])},title:e("添加")}),e("禁止目录范围")]}),(q??[]).map((t,s)=>(0,k.jsxs)("div",{style:{display:"flex"},children:[(0,k.jsx)("div",{style:{width:"90%"},children:(0,k.jsx)(r.Sm,{disabled:0!==ue?.not_access_dirs?.length&&void 0!==ue?.not_access_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,D([...q])}})}),0===ue?.not_access_dirs?.length||void 0===ue?.not_access_dirs?.length&&(0,k.jsx)(o.rA,{icon:"delete",onClick:()=>{q.splice(s,1),D([...q])},title:e("删除")})]},s)),(0,k.jsxs)("label",{children:[!ue?.only_read_dirs?.length&&(0,k.jsx)(o.rA,{icon:"add",onClick:()=>{U([...H,""])},title:e("添加")}),e("只读目录范围")]}),(H??[]).map((t,s)=>(0,k.jsxs)("div",{style:{display:"flex"},children:[(0,k.jsx)("div",{style:{width:"90%"},children:(0,k.jsx)(r.Sm,{disabled:0!==ue?.only_read_dirs?.length&&void 0!==ue?.only_read_dirs?.length,value:t,handleInputChange:e=>{H[s]=e,U([...H])}})}),0===ue?.only_read_dirs?.length||void 0===ue?.only_read_dirs?.length&&(0,k.jsx)(o.rA,{icon:"delete",onClick:()=>{H.splice(s,1),U([...H])},title:e("删除")})]},s)),(0,k.jsx)("label",{children:e("可执行的命令")}),(0,k.jsx)(r.Sm,{disabled:""!==ue.access_cmd&&void 0!==ue.access_cmd,value:W,placeholder:"use blank split",handleInputChange:e=>R(e)}),(0,k.jsx)("label",{children:e("禁止执行的命令")}),(0,k.jsx)(r.Sm,{disabled:""!==ue.not_access_cmd&&void 0!==ue.not_access_cmd,value:L,placeholder:"use blank split",handleInputChange:e=>J(e)}),!le&&(0,k.jsxs)(n.Fragment,{children:[(0,k.jsx)("label",{children:e("角色")}),(0,k.jsx)(r.l6,{value:ce,onChange:e=>{we(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let t of _e)e.push({title:t.role_name,value:t.role_id});return e})()})]}),(0,k.jsx)("label",{children:e("语言")}),(0,k.jsx)(r.l6,{disabled:""!==ue.language&&void 0!==ue.language,value:Q,onChange:e=>{Y(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,k.jsx)("label",{children:e("主题")}),(0,k.jsx)(r.l6,{disabled:""!==ue.theme&&void 0!==ue.theme,value:ee,onChange:e=>{te(e)},options:me}),(0,k.jsx)(Z,{is_disable:e=>{if(!0===le)return!0;if(ce){const t=G.get(ce);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===le||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,A.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,k.jsx)("label",{children:e("备注")}),(0,k.jsx)(r.Sm,{value:ie,handleInputChange:e=>ae(e)})]})})})]})}function L(){const{t:e,i18n:t}=(0,_.Bd)(),{initUserInfo:s}=(0,n.useContext)(b.F),[m,x]=(0,n.useState)([]),[j,f]=(0,h.fp)(u.AG.prompt_card),[y,g]=(0,n.useState)(!1),[w,S]=(0,n.useState)(!1),[C,N]=(0,h.fp)(u.AG.confirm),[$,V]=(0,n.useState)(""),[B,P]=(0,n.useState)(""),[F,z]=(0,n.useState)([]),[K,X]=(0,n.useState)([]),[O,T]=(0,n.useState)([]),[M,q]=(0,n.useState)(""),[D,H]=(0,n.useState)(""),[U,W]=(0,n.useState)(""),[E,G]=(0,n.useState)(""),[R,L]=(0,n.useState)([]),[J,Q]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,I.o)(),se=[e("角色id"),e("角色名"),e("备注")],ne=async()=>{const e=await d.wm.get("all_roles");e.code===c.m.Success&&x(e.data)},ie=e=>{V(e?.role_name??""),P(e?.cwd??""),z(e?.access_dirs??[]),X(e?.not_access_dirs??[]),T(e?.only_read_dirs??[]),q(e?.access_cmd??""),H(e?.not_access_cmd??""),W(e?.language??""),G(e?.theme??""),L(e?.auth_list??[]),Q(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const ae=()=>{if(!$)return void(0,v.zN)("role_name not empty");const e=new a.E0;return e.language=U,e.theme=E,e.access_dirs=F,e.role_name=$,e.not_access_dirs=K,e.only_read_dirs=O,e.cwd=B,e.access_cmd=M,e.not_access_cmd=D,e.auth_list=R,e.role_note=Y,e};return(0,k.jsxs)(i.fI,{children:[(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,k.jsx)(i.xh,{children:(0,k.jsx)(l.uF,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:e("角色")})}),rightTopCom:(0,k.jsx)("div",{children:(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{g(!0),S(!1),ie(void 0)}})}),children:(0,k.jsx)(p.X,{headers:se,rows:m.map((t,s)=>{const n=[(0,k.jsx)("p",{children:t.role_id}),(0,k.jsx)(l.xP,{children:t.role_name}),(0,k.jsx)(l.xP,{children:t.role_note}),(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{g(!1),S(!0),ie(e)})(t)}),!t.is_root&&(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{N({open:!0,title:e("确定删除吗"),handle:async()=>{const s=new a.E0;s.role_id=t,(await d.wm.post("delete_role",s)).code===c.m.Success&&((0,v.SK)(e("删除完成")),ne(),N({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(y||w)&&(0,k.jsx)(i.xh,{children:(0,k.jsxs)(l.Zp,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e(""+(y?"添加":"编辑"))})," "]}),rightBottomCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{g(!1),S(!1),ie(void 0)}}),y&&(0,k.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const t=ae();if(!t)return;const s=await d.wm.post("create_role",t);ne(),s.code===c.m.Success&&((0,v.SK)(e("创建完成")),ne(),g(!1),S(!1),ie(void 0))}}),w&&(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=ae();if(!t)return;t.role_id=J;(await d.wm.post("save_role",t)).code===c.m.Success&&((0,v.SK)(e("保存完成")),ne())}})]}),children:[(0,k.jsx)("label",{children:e("角色名")}),(0,k.jsx)(r.Sm,{value:$,handleInputChange:e=>V(e)}),(0,k.jsx)("label",{children:e("角色备注")}),(0,k.jsx)(r.Sm,{value:Y,handleInputChange:e=>ee(e)}),(0,k.jsxs)("label",{children:[(0,k.jsx)(o.rA,{icon:"add",onClick:()=>{z([...F,""])},title:"添加"}),e("目录范围")]}),(0,k.jsx)(r.Sm,{value:B,handleInputChange:e=>P(e)}),(F??[]).map((e,t)=>(0,k.jsxs)("div",{style:{display:"flex"},children:[(0,k.jsx)("div",{style:{width:"90%"},children:(0,k.jsx)(r.Sm,{value:e,handleInputChange:e=>{F[t]=e,z([...F])}})}),(0,k.jsx)(o.rA,{icon:"delete",onClick:()=>{F.splice(t,1),z([...F])},title:"删除"})]},t)),(0,k.jsxs)("label",{children:[(0,k.jsx)(o.rA,{icon:"add",onClick:()=>{X([...K,""])},title:"添加"}),e("禁止目录范围")]}),(K??[]).map((t,s)=>(0,k.jsxs)("div",{style:{display:"flex"},children:[(0,k.jsx)("div",{style:{width:"90%"},children:(0,k.jsx)(r.Sm,{value:t,handleInputChange:e=>{K[s]=e,X([...K])}})}),(0,k.jsx)(o.rA,{icon:"delete",onClick:()=>{K.splice(s,1),X([...K])},title:e("删除")})]},s)),(0,k.jsxs)("label",{children:[(0,k.jsx)(o.rA,{icon:"add",onClick:()=>{T([...O,""])},title:e("添加")}),e("只读目录范围")]}),(O??[]).map((e,t)=>(0,k.jsxs)("div",{style:{display:"flex"},children:[(0,k.jsx)("div",{style:{width:"90%"},children:(0,k.jsx)(r.Sm,{value:e,handleInputChange:e=>{O[t]=e,T([...O])}})}),(0,k.jsx)(o.rA,{icon:"delete",onClick:()=>{O.splice(t,1),T([...O])},title:"删除"})]},t)),(0,k.jsx)("label",{children:e("可执行的命令")}),(0,k.jsx)(r.Sm,{value:M,placeholder:"use blank split",handleInputChange:e=>q(e)}),(0,k.jsx)("label",{children:e("禁止执行的命令")}),(0,k.jsx)(r.Sm,{value:D,placeholder:"use blank split",handleInputChange:e=>H(e)}),(0,k.jsx)("label",{children:e("语言")}),(0,k.jsx)(r.l6,{value:U,onChange:e=>{W(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"NOT",value:""},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,k.jsx)("label",{children:e("主题")}),(0,k.jsx)(r.l6,{value:E,onChange:e=>{G(e)},options:te}),(0,k.jsx)(Z,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==R?.find(t=>t===e),select_auth:e=>{R?(R.find(t=>t==e)?(0,A.I)(R,t=>t===e):R.push(e),L([...R])):L([e])}})]})})})]})}var J=s(93245);function Q(e){const{t}=(0,_.Bd)(),[s,i]=(0,n.useState)((e.children_list??[]).map(e=>({path:e.path,note:e.note}))),a=[t("编号"),t("目录"),t("备注")],d=()=>{i([...s,{path:"",note:""}])};(0,n.useEffect)(()=>{s?.length||d()});return(0,k.jsx)(l.uF,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:t("sub_dir")})}),rightTopCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"add",title:t("添加"),onClick:d}),(0,k.jsx)(o.rA,{icon:"save",title:t("保存"),onClick:()=>{e.on_confirm(s.filter(e=>e.path))}}),(0,k.jsx)(o.rA,{icon:"close",title:t("取消"),onClick:e.on_cancel})]}),children:(0,k.jsx)(p.X,{headers:a,rows:s.map((e,n)=>[(0,k.jsx)("span",{children:n}),(0,k.jsx)(r.Sm,{value:e.path,handleInputChange:t=>{e.path=t},no_border:!0}),(0,k.jsx)(r.Sm,{value:e.note,handleInputChange:t=>{e.note=t},no_border:!0}),(0,k.jsx)("div",{children:(0,k.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>{i(s.filter((e,t)=>t!==n))}})})]),width:"10rem"})})}function Y(){const{t:e,i18n:t}=(0,_.Bd)(),{initUserInfo:s,reloadUserInfo:x}=(0,n.useContext)(b.F),[j,f]=(0,n.useState)([]),[g,w]=(0,h.fp)(u.AG.prompt_card),[S,C]=(0,n.useState)([]),[N,$]=(0,n.useState)([]),[V,B]=(0,n.useState)([]),[P,F]=(0,h.fp)(u.AG.user_base_info),z=(0,U.K)(),K=(0,I.o)(),X=[e("编号"),e("路径"),e("是否默认"),e("备注"),e("sub_dir")],O=[e("编号"),e("路径"),e("备注")],T=[e("编号"),e("命令"),e("父编号"),e("备注")],M=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[q,D]=(0,n.useState)(""),[H,W]=(0,n.useState)(""),[E,Z]=(0,n.useState)(""),[G,R]=(0,n.useState)(!1),[L,Y]=(0,n.useState)(""),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)(""),[ie,ae]=(0,n.useState)(!1),[le,oe]=(0,n.useState)(""),[re,de]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await d.XO.get("filesSetting");e.code===c.m.Success&&(f(e.data.dirs),$(e.data.quick_cmd),B(e.data.file_quick_cmd));const t=await d.XO.get("protection_dir");t.code===c.m.Success&&C(t.data??[])})(),Y(P?.user_data?.language),te(P?.user_data?.theme),ne(P?.user_data?.upload_file_ignore);const e=P?.user_data?.editor_auto_save;ae(!!e?.enable),oe(null!=e?.interval?String(e.interval):""),de(e?.editors??[])},[]);const ce=(0,I.Q)();return(0,k.jsx)(n.Fragment,{children:(0,k.jsxs)(i.fI,{children:[(0,k.jsxs)(i.VP,{widthPer:33,children:[(0,k.jsx)(i.xh,{children:(0,k.jsxs)(l.Zp,{title:e("修改密码"),rightBottomCom:(0,k.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{if(!q||!H)return void(0,v.zN)(e("账号密码不能为空"));if(H!==E)return void(0,v.zN)(e("两次密码不一样"));const t=new a.tl;t.username=q,t.password=H,t.confirm_password=E,t.user_id=P.user_data.id;(await d.wm.post("updatePassword",t)).code===c.m.Success&&(0,v.SK)(e("修改成功"))}}),children:[(0,k.jsx)(r.Sm,{placeholder:e("新账号"),value:q,handleInputChange:e=>{D(e)}}),(0,k.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{W(e)}}),(0,k.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{Z(e)}})]})}),(0,k.jsx)(i.xh,{children:(0,k.jsxs)(l.Zp,{title:e("个性化设置"),rightBottomCom:(0,k.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{(await d.XO.post(y.s.setting_sys_option_status_save,{type:m.Mu.private_sys_env,value:{language:L,theme:ee,upload_file_ignore:se}})).code===c.m.Success&&((0,v.SK)(e("修改成功")),s())}}),children:[e("语言"),(0,k.jsx)(r.l6,{value:L,onChange:e=>{Y(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"},{title:"Deutsch",value:"de"},{title:"ドイツ語",value:"ja"},{title:"독일어",value:"ko"},{title:"Немецкий язык",value:"ru"},{title:"Allemand",value:"fr"},{title:"Alemán",value:"es"}]}),e("主题"),(0,k.jsx)(r.l6,{value:ee,onChange:e=>{te(e)},options:K}),(0,k.jsx)(r.Sm,{value:se,handleInputChange:e=>{ne(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})}),(0,k.jsx)(i.xh,{children:(0,k.jsxs)(l.Zp,{title:e("编辑器自动保存"),rightBottomCom:(0,k.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{const t=parseInt(String(le),10);if(isNaN(t)||t<1)return void(0,v.zN)(e("请输入不小于 1 的整数(秒)"));(await d.wm.post(y.s.user_save_private_attr,{is_editor_auto_save:!0,editor_auto_save:{enable:ie,interval:t,editors:re}})).code===c.m.Success&&((0,v.SK)(e("修改成功")),s())}}),children:[(0,k.jsx)(r.BC,{label:e("开启"),children:(0,k.jsx)(r.l6,{value:ie,onChange:e=>{ae(e)},options:z,no_border:!0})}),(0,k.jsx)(r.BC,{label:e("自动保存间隔(秒)"),children:(0,k.jsx)(r.Sm,{type:"number",value:le,handleInputChange:e=>{oe(e)},placeholder:"30",no_border:!0})}),(0,k.jsx)("h3",{children:e("编辑器")}),J.d.map(t=>(0,k.jsxs)("div",{children:[(0,k.jsx)("input",{type:"checkbox",checked:re.includes(t.id),onChange:e=>{const s=e.target.checked;de(s?[...re,t.id]:re.filter(e=>e!==t.id))}}),e(t.label)]},t.id))]})})]}),(0,k.jsxs)(i.VP,{children:[(0,k.jsxs)(i.xh,{children:[(0,k.jsx)(l.uF,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("文件夹路径")})," ",(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{ce("文件夹路径")},title:e("信息")})]}),rightTopCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{f([...j,{note:"",default:!1,path:""}])}}),(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(let e=0;e<j.length;e++)j[e].index=e;(await d.XO.post("filesSetting/save",{dirs:j})).code===c.m.Success&&((0,v.SK)(e("保存成功")),x(),s())}})]}),children:(0,k.jsx)(p.X,{headers:X,rows:j.map((t,s)=>{const n=[(0,k.jsx)("div",{children:s}),(0,k.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,k.jsx)(r.l6,{value:t.default,onChange:e=>{((e,t,s)=>{const n=[];for(let e=0;e<j.length;e++)j[e].default=e===s&&t,n.push(j[e]);f(n)})(0,e,s)},options:z,no_border:!0}),(0,k.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,k.jsxs)("div",{className:"div-row",children:[(0,k.jsx)("span",{children:t.children?.length??0}),0!==s&&(0,k.jsx)(o.rA,{icon:"folder_open",title:e("sub_dir"),onClick:()=>(e=>{w({open:!0,main_context_div:(0,k.jsx)(Q,{children_list:e.children,on_cancel:()=>{w({open:!1})},on_confirm:t=>{e.children=t,f([...j]),w({open:!1})}})})})(t)})]}),(0,k.jsx)("div",{children:0!==s&&(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{j.splice(e,1),f([...j])})(s)})})];return n}),width:"10rem",onRowDrag:(e,t)=>{0!==e&&0!==t&&f((0,A.TI)(j,e,t))}})}),(0,k.jsx)(l.uF,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("个人保护路径")})," ",(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{ce("保护目录")},title:e("信息")})]}),rightTopCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{C([...S,{path:"",note:""}])}}),(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("protection_dir/save",S)).code===c.m.Success&&((0,v.SK)(e("保存成功")),x())}})]}),children:(0,k.jsx)(p.X,{headers:O,rows:S.map((t,s)=>{const n=[(0,k.jsx)("div",{children:s}),(0,k.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{S.splice(e,1),C([...S])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{C((0,A.TI)(S,e,t))}})})]}),(0,k.jsxs)(i.xh,{children:[(0,k.jsx)(l.uF,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("目录快捷命令")}),(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{ce("目录快捷命令")},title:"info"})]}),rightTopCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{$([...N,{cmd:"",note:""}])}}),(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("filesSetting/save",{quick_cmd:N})).code===c.m.Success&&((0,v.SK)(e("保存成功")),s())}})]}),children:(0,k.jsx)(p.X,{headers:T,rows:N.map((t,s)=>{const n=[(0,k.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{N.splice(e,1),$([...N])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{$((0,A.TI)(N,e,t))}})}),(0,k.jsx)(l.uF,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("文件快捷命令")}),(0,k.jsx)(o.rA,{icon:"info",onClick:()=>{ce("文件快捷命令")},title:"info"})]}),rightTopCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{B([...V,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("filesSetting/save",{file_quick_cmd:V})).code===c.m.Success&&((0,v.SK)(e("保存成功")),s())}})]}),children:(0,k.jsx)(p.X,{headers:M,rows:V.map((t,s)=>{const n=[(0,k.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,k.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),B([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{B((0,A.TI)(V,e,t))}})})]})]})]})})}var ee=s(45907),te=s(90764),se=s(17903);function ne(){const{t:e}=(0,_.Bd)(),t=(0,ee.y)(),[s,a]=(0,n.useState)([]),[r,c]=(0,n.useState)([]),[m,x]=(0,h.fp)(u.AG.mount_enabled),[j,f]=(0,n.useState)(!1),[y,g]=(0,n.useState)(""),[w,b]=(0,n.useState)((0,te.v)()),S=async()=>{try{const[e,t]=await Promise.all([d.I2.post("list",{}),d.I2.post("credential/list",{})]);a(Array.isArray(e?.data)?e.data:[]),c(Array.isArray(t?.data)?t.data:[])}catch(e){}};(0,n.useEffect)(()=>{S(),(async()=>{try{const e=await d.I2.post("enabled/get",{});x(!0===e?.data)}catch(e){x(!1)}})()},[]);const C=(0,se.ln)(w.credential_id,r),A=()=>{f(!1),g(""),b((0,te.v)())};return(0,k.jsxs)(i.fI,{children:[(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,k.jsx)(i.xh,{children:(0,k.jsx)(l.uF,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:e("网盘挂载")})}),rightTopCom:(0,k.jsxs)("div",{className:"div-row",children:[(0,k.jsx)(o.rA,{icon:!0===m?"cloud_done":"cloud_off",title:e(!0===m?"muntont":"muntoff"),selected:!0===m,onClick:async()=>{const t=!m;try{const s=await d.I2.post("enabled/set",{enabled:t}),n=!0===s?.data;x(n),(0,v.SK)(e(n?"挂载已启用":"挂载已停用"))}catch(e){}}}),(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A(),f(!0)}})]}),children:(0,k.jsx)(p.X,{headers:[e("编号"),e("备注"),e("挂载类型"),e("凭据"),e("账号"),e("操作")],rows:s.map((s,n)=>{const i=r.find(e=>e.id===s.credential_id),a=(i?.accounts??[]).find(e=>e.id===s.account_id);return[(0,k.jsx)("span",{children:n}),(0,k.jsx)(l.xP,{context:s.note||"-"}),(0,k.jsx)("p",{children:(c=s.driver,se.sI.find(e=>e.type===c)?.name??c)}),(0,k.jsx)(l.xP,{context:i?i.note:e("凭据已丢失")}),(0,k.jsx)(l.xP,{context:s.account_id?a?a.note||a.account_name||a.nickname||a.id:e("账号已丢失"):"-"}),(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{f(!0),g(e.id),b({driver:e.driver,mount_path:e.mount_path??"",credential_id:e.credential_id??"",account_id:e.account_id??"",root_dir:e.root_dir??"",note:e.note??"",color:e.color??se.OT,readonly:Boolean(e.readonly),forward_to_remote:Boolean(e.forward_to_remote)})})(s)}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.mount_path,confirm_fun:async()=>{try{await d.I2.post("delete",{id:s.id}),(0,v.SK)(e("已删除")),await S()}catch(e){}}})})(s)})]})];var c})})})})}),(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:j&&(0,k.jsx)(i.xh,{children:(0,k.jsx)(l.Zp,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:e(y?"编辑":"添加")})}),rightBottomCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{if(w.credential_id)try{const t=await d.I2.post("test",{id:y||void 0,driver:w.driver,credential_id:w.credential_id,account_id:w.account_id,root_dir:w.root_dir}),s=t?.data;s?.ok?(0,v.SK)(`${e("连接成功")}(${s.count??0})`):(0,v.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}else(0,v.zN)(e("请选择凭据"))}}),(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(w.credential_id)if(!C||w.account_id)if(w.mount_path.trim())try{await d.I2.post(y?"update":"add",{id:y||void 0,driver:w.driver,mount_path:w.mount_path,credential_id:w.credential_id,account_id:C?w.account_id:void 0,root_dir:w.root_dir,note:w.note,color:w.color,readonly:w.readonly,enabled:!0,forward_to_remote:"tcp_proxy"===w.driver&&Boolean(w.forward_to_remote)}),(0,v.SK)(e("保存成功")),await S()}catch(e){}else(0,v.zN)(e("munt_rq"));else(0,v.zN)(e("请选择账号"));else(0,v.zN)(e("请选择凭据"))}}),(0,k.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:A})]}),children:(0,k.jsx)(te.A,{value:w,onChange:b,creds:r})})})})]})}function ie(){const{t:e}=(0,_.Bd)(),{check_user_auth:t}=(0,j.MH)();return t(a.oV.file_mount)?(0,k.jsx)(i.xh,{children:(0,k.jsx)(i.fI,{children:(0,k.jsx)(i.VP,{widthPer:100,maxWidth:"90rem",children:(0,k.jsx)(ne,{})})})}):(0,k.jsx)(i.fI,{children:(0,k.jsx)(i.VP,{children:(0,k.jsx)(l.Zp,{self_title:(0,k.jsx)("h2",{children:e("网盘挂载")}),children:(0,k.jsx)("p",{children:e("nmuntpr")})})})})}var ae=s(47996);function le(e){const{src:t,name:s,size:i=1.5,show_name:a=!0,label:l,label_width:o,className:r}=e,[d,c]=(0,n.useState)(!1);(0,n.useEffect)(()=>{c(!1)},[t]);const h={width:`${i}rem`,height:`${i}rem`,borderRadius:"50%",flexShrink:0,verticalAlign:"middle"},u=["avatar",r].filter(Boolean).join(" "),p=t&&!d?(0,k.jsx)("img",{className:u,style:{...h,objectFit:"cover"},src:t,alt:s??"",referrerPolicy:"no-referrer",onError:()=>c(!0)}):(0,k.jsx)("span",{className:`${u} avatar--fallback`,style:{...h,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(s??"").trim().charAt(0).toUpperCase()||"?"}),m=a&&s?(0,k.jsxs)("span",{className:"avatar-with-name",children:[p,(0,k.jsx)("span",{className:"avatar__name",children:s})]}):p;if(void 0===l)return m;const _={whiteSpace:"nowrap",flex:"0 0 auto",textAlign:"right"};return o&&(_.width=o),(0,k.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem"},children:[(0,k.jsx)("label",{style:_,children:l}),(0,k.jsx)("div",{style:{flex:1,minWidth:0},children:m})]})}const oe=[{type:"webdav",name:"WebDAV",fields:[{key:"webdav_url",label:"Service URL",type:"text",required:!0,placeholder:"https://example.com/dav"}],accounts:!0,account_key:"account_name",account_fields:[{key:"account_name",label:"Username",type:"text"},{key:"password",label:"Password",type:"password",tip:"Use an app password for services like Nutstore or Synology"}]},{type:"ssh",name:"SSH / SFTP",fields:[{key:"ssh_host",label:"Host",type:"text",required:!0},{key:"ssh_port",label:"Port",type:"text",placeholder:"Default 22"}],accounts:!0,account_key:"account_name",account_fields:[{key:"account_name",label:"Username",type:"text",required:!0},{key:"password",label:"Password",type:"password",tip:"Can be left empty when a private key is set"},{key:"private_key",label:"Private key",type:"textarea",tip:"Takes precedence over the password when filled"}]},{type:"smb",name:"SMB / Windows share",fields:[{key:"smb_server",label:"Host",type:"text",required:!0,placeholder:"192.168.1.10 or nas.local"}],accounts:!0,account_key:"account_name",account_fields:[{key:"account_name",label:"Username",type:"text"},{key:"password",label:"Password",type:"password"}]},{type:"s3",name:"S3 compatible storage",fields:[{key:"s3_endpoint",label:"Endpoint",type:"text",required:!0,placeholder:"https://s3.amazonaws.com",tip:"Use the endpoint of your provider, e.g. Alibaba OSS, Tencent COS or MinIO"},{key:"s3_region",label:"Region",type:"text",placeholder:"us-east-1"},{key:"s3_force_path_style",label:"Force path style",type:"switch",tip:"Usually required by MinIO"}],accounts:!0,account_key:"account_name",account_fields:[{key:"account_name",label:"AccessKey",type:"text",required:!0},{key:"secret_key",label:"SecretKey",type:"password",required:!0}]},{type:"baidu",name:"Baidu Netdisk",fields:[{key:"baidu_app_id",label:"AppID",type:"text"},{key:"baidu_app_key",label:"AppKey",type:"text",required:!0},{key:"baidu_secret_key",label:"SecretKey",type:"password",required:!0}],accounts:!0,account_key:"account_name",account_fields:[]},{type:"local",name:"Local directory",fields:[],sources:!0},{type:"tcp_proxy",name:"TCP proxy FileCat",fields:[{key:"tcp_client_num_id",label:"Proxy client",type:"text",required:!0,options_source:"tcp_client",tip:"Pick one from the TCP proxy client list"},{key:"tcp_base_url",label:"Remote base_url",type:"text",placeholder:"/pre",tip:"Only needed when the remote FileCat has a base_url configured"}],accounts:!0,account_key:"account_name",account_fields:[{key:"account_name",label:"Username",type:"text",required:!0},{key:"password",label:"Password",type:"password"}]}];const re="webdav",de="@authorize",ce={baidu:[{keys:["baidu_app_id","baidu_app_key","baidu_secret_key"],on_next:"save_app"},{keys:[de]}],tcp_proxy:[{keys:["tcp_client_num_id"],on_next:"save_app"},{keys:["@tcp_account"]}]};function he(){const{t:e}=(0,_.Bd)(),t=(0,ee.y)(),[,s]=(0,h.fp)(u.AG.prompt_card),[a,c]=(0,n.useState)([]),[m,x]=(0,n.useState)([]),[j,f]=(0,n.useState)(!1),[y,g]=(0,n.useState)(""),[w,b]=(0,n.useState)(re),[S,C]=(0,n.useState)(""),[A,I]=(0,n.useState)({}),[N,$]=(0,n.useState)({}),[V,B]=(0,n.useState)("oob"),[P,F]=(0,n.useState)(""),[z,K]=(0,n.useState)(""),[X,O]=(0,n.useState)(""),[T,M]=(0,n.useState)(""),[q,D]=(0,n.useState)([]),[H,U]=(0,n.useState)(!0),W=async()=>{try{const e=await d.I2.post("credential/list",{}),t=Array.isArray(e?.data)?e.data:[];return c(t),x(oe),t}catch(e){return[]}},E=async e=>{const t=(await W()).find(t=>t.id===e);t&&D(t.accounts??[])};(0,n.useEffect)(()=>{W()},[]);const Z=m.find(e=>e.type===w),G=Z?.fields??[],R=!0===Z?.sources,L=!0===Z?.accounts,J=Z?.account_fields??[],Q=q,Y=(e,t)=>{D(s=>s.map((s,n)=>n===e?{...s,...t}:s))},te=()=>{D(e=>[...e,{id:"",account_name:"",password:"",secret_key:""}])},ne=(e,t)=>{D(s=>s.map((s,n)=>n===e?{...s,...t}:s))},ie=ce[w],he=()=>{f(!1),g(""),b(re),C(""),I({}),D([]),F(""),U(!0)},ue=async e=>{const t=Array.from(new Set(e.map(e=>e.options_source).filter(e=>Boolean(e)))),s={};for(const e of t){const t=await d.I2.post("credential/options",{source:e});s[e]=(t?.data??[]).map(e=>({label:e.label,value:e.value}))}$(s)},pe=async()=>{try{const e=await d.I2.post("baidu/authorize_url",{id:y,mode:V});e?.data&&window.open(e.data,"_blank","noopener,noreferrer")}catch(e){}},me=async()=>{if(P.trim())try{const t=await d.I2.post("baidu/exchange",{id:y,code:P.trim(),mode:V});(0,v.SK)(`${e("授权成功")}:${t?.data?.baidu_name??""}`),F(""),await E(y)}catch(e){}else(0,v.zN)(e("请填写授权码"))},_e=async()=>{if(z.trim())if(X.trim())try{const t=await d.I2.post("baidu/import",{id:y,uk:z.trim(),access_token:X.trim(),refresh_token:T.trim()});(0,v.SK)(`${e("添加成功")}:${t?.data?.baidu_name??""}`),K(""),O(""),M(""),await E(y)}catch(e){}else(0,v.zN)(e("请填写 access_token"));else(0,v.zN)(e("请填写账号 id"))},xe=async t=>{try{const s={credential_id:y};t.id&&(s.account_id=t.id),void 0!==t.note&&(s.note=t.note);for(const e of J){const n=t[e.key];null!=n&&(s[e.key]=String(n))}const n=await d.I2.post("credential/account_save",s);(0,v.SK)(e("保存成功"));const i=n?.data;D(e=>e.map(e=>e===t?{...e,...i}:e))}catch(e){}},je=async t=>{try{const s={credential_id:y};t.id&&(s.account_id=t.id);for(const e of J){const n=t[e.key];null!=n&&(s[e.key]=String(n))}const n=await d.I2.post("credential/account_verify",s),i=n?.data??{};i.ok?(0,v.SK)(e("账号可用")):(0,v.zN)(`${e("账号不可用")}:${i.error??""}`)}catch(e){}},ve=s=>{if(!s.id)return n=q.indexOf(s),void D(e=>e.filter((e,t)=>t!==n));var n;t({title:e("确认删除"),sub_title:s.note||s.account_name||s.id,confirm_fun:async()=>{try{await d.I2.post("credential/account_remove",{credential_id:y,account_id:s.id}),(0,v.SK)(e("已删除")),await E(y)}catch(e){}}})};return(0,k.jsxs)(i.fI,{children:[(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,k.jsx)(i.xh,{children:(0,k.jsx)(l.uF,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("网盘凭据")}),(0,k.jsx)(o.rA,{icon:"info",title:e("信息"),onClick:()=>{s({open:!0,title:e("信息"),context_div:(0,k.jsxs)("div",{children:[(0,k.jsxs)("ul",{children:[(0,k.jsx)("li",{children:e("crd_tp")}),(0,k.jsx)("li",{children:e("pwdkept")}),(0,k.jsx)("li",{children:e("tstbfrs")})]}),(0,k.jsxs)("ul",{children:[(0,k.jsxs)("li",{children:[(0,k.jsx)("b",{children:"WebDAV"}),":",e("prtwbdv")]}),(0,k.jsxs)("li",{children:[(0,k.jsx)("b",{children:"SSH / SFTP"}),":",e("prtsftp")]}),(0,k.jsxs)("li",{children:[(0,k.jsx)("b",{children:"S3 兼容对象存储"}),":",e("prt_s3")]}),(0,k.jsxs)("li",{children:[(0,k.jsx)("b",{children:"SMB"}),":",e("prt_smb")]}),(0,k.jsxs)("li",{children:[(0,k.jsx)("b",{children:"百度网盘"}),":",e("prt_bd")]}),(0,k.jsxs)("li",{children:[(0,k.jsx)("b",{children:e("内网穿透 FileCat")}),":",e("prt_tcp")]}),(0,k.jsxs)("li",{children:[(0,k.jsx)("b",{children:e("本地目录")}),":",e("prt_local")]})]})]})})}})]}),rightTopCom:(0,k.jsx)("div",{className:"div-row",children:(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{he(),f(!0)}})}),children:(0,k.jsx)(p.X,{headers:[e("编号"),e("备注"),e("类型"),e("操作")],rows:a.map((s,n)=>{return[(0,k.jsx)("span",{children:n}),(0,k.jsx)(l.xP,{context:s.note||"-"}),(0,k.jsx)(l.xP,{context:(i=s.type,m.find(e=>e.type===i)?.name??i)}),(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{f(!0),g(e.id),b(e.type),C(e.note??""),I({webdav_url:e.webdav_url,ssh_host:e.ssh_host,ssh_port:e.ssh_port,ssh_private_key:e.ssh_private_key,smb_server:e.smb_server,s3_endpoint:e.s3_endpoint,s3_region:e.s3_region,s3_force_path_style:e.s3_force_path_style,baidu_app_id:e.baidu_app_id,baidu_app_key:e.baidu_app_key,baidu_secret_key:e.baidu_secret_key,tcp_client_num_id:e.tcp_client_num_id,tcp_base_url:e.tcp_base_url}),D(e.accounts??[]),F(""),K(""),O(""),M(""),U(!1!==e.enabled);const t=m.find(t=>t.type===e.type)?.fields??[];t.some(e=>e.options_source)&&ue(t).catch(()=>{})})(s)}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.note,confirm_fun:async()=>{try{await d.I2.post("credential/delete",{id:s.id}),(0,v.SK)(e("已删除")),await W()}catch(e){}}})})(s)})]})];var i})})})})}),(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:j&&(0,k.jsxs)(n.Fragment,{children:[(0,k.jsx)(i.xh,{children:(0,k.jsxs)(l.Zp,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:e("凭据")})}),rightBottomCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=(t=>{if(!S.trim())return e("请填写备注");for(const s of G){if(!1===t.includes(s.key))continue;const n=String(A[s.key]??"").trim();if(s.required&&!n)return e(s.label)}})(G.map(e=>e.key));if(t)(0,v.zN)(`${e("请填写")}${t}`);else{if(R){const t=new Set;for(const s of Q){const n=String(s.account_name??"").trim(),i=String(s.path??"").trim();if(!n||!i)return void(0,v.zN)(e("源目录的名称和路径都不能为空"));if(t.has(n))return void(0,v.zN)(`${e("源目录名称重复")}:${n}`);t.add(n)}}if(L)for(const t of q)for(const s of J)if(s.required&&!String(t[s.key]??"").trim())return void(0,v.zN)(`${e("请填写")}${e(s.label)}`);try{const t=await d.I2.post(y?"credential/update":"credential/add",{id:y||void 0,type:w,note:S,...A,enabled:H});(0,v.SK)(e("保存成功"));const s=y||t.data?.id;if(!y&&t.data?.id&&g(t.data.id),(L||R)&&s)for(const e of q){if(e.id)continue;const t={credential_id:s};void 0!==e.note&&(t.note=e.note);const n=R?["account_name","path"]:J.map(e=>e.key);for(const s of n){const n=e[s];null!=n&&(t[s]=String(n))}const i=await d.I2.post("credential/account_save",t);Object.assign(e,i?.data??{})}await W()}catch(e){}}}}),(0,k.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:he})]}),children:[(0,k.jsx)(r.Sm,{placeholder:e("备注"),value:S,handleInputChange:C}),(0,k.jsx)(r.l6,{value:w,options:m.map(e=>({title:e.name,value:e.type})),onChange:e=>{b(e),I({}),$({}),F("");const t=m.find(t=>t.type===e)?.fields??[];t.some(e=>e.options_source)&&ue(t)}}),!R&&G.map(t=>{const s=A[t.key];return t.options_source?(0,k.jsx)(r.BC,{label:e(t.label),label_width:"6rem",children:(0,k.jsx)(r.l6,{value:String(s??""),options:N[t.options_source]??[],onChange:e=>I({...A,[t.key]:e})})},t.key):"switch"===t.type?(0,k.jsx)(r.BC,{label:e(t.label),label_width:"6rem",children:(0,k.jsx)(r.l6,{value:!0===s?"on":"off",options:[{title:e("开启"),value:"on"},{title:e("关闭"),value:"off"}],onChange:e=>I({...A,[t.key]:"on"===e})})},t.key):(0,k.jsx)(n.Fragment,{children:(0,k.jsx)(r.Sm,{type:"password"===t.type?"password":"text",placeholder:t.label,value:String(s??""),handleInputChange:e=>I({...A,[t.key]:e})})},t.key)})]})}),ie?.[1]?.keys?.includes(de)&&(0,k.jsx)(i.xh,{children:(0,k.jsx)(l.Zp,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:e("授权")})}),children:(0,k.jsxs)(n.Fragment,{children:[(0,k.jsx)(r.BC,{label:e("授权方式"),label_width:"6rem",children:(0,k.jsxs)("div",{className:"div-row",children:[(0,k.jsx)(r.U6,{name:"baidu_auth_mode",value:"one_click",context:e("一键授权"),selected:"one_click"===V,onchange:()=>B("one_click")}),(0,k.jsx)(r.U6,{name:"baidu_auth_mode",value:"oob",context:e("outh_ob"),selected:"oob"===V,onchange:()=>B("oob")})]})}),"oob"===V&&(0,k.jsx)(r.BC,{label:e("授权码"),label_width:"6rem",children:(0,k.jsx)(r.Sm,{placeholder:e("粘贴授权码 code"),value:P,handleInputChange:F})}),(0,k.jsxs)("div",{className:"div-row",children:[(0,k.jsx)(o.rA,{icon:"open_in_new",title:e("去授权"),onClick:pe}),"oob"===V&&(0,k.jsx)(o.rA,{icon:"check",title:e("完成授权"),onClick:me})]}),(0,k.jsx)(r.BC,{label:e("手动添加"),label_width:"6rem",children:(0,k.jsx)(r.Sm,{placeholder:e("账号 id(uk)"),value:z,handleInputChange:K})}),(0,k.jsx)(r.BC,{label:e("access_token"),label_width:"6rem",children:(0,k.jsx)(r.Sm,{placeholder:e("粘贴 access_token"),value:X,handleInputChange:O})}),(0,k.jsx)(r.BC,{label:e("refresh_token"),label_width:"6rem",children:(0,k.jsx)(r.Sm,{placeholder:e("粘贴 refresh_token"),value:T,handleInputChange:M})}),(0,k.jsx)("div",{className:"div-row",children:(0,k.jsx)(o.rA,{icon:"add",title:e("添加账号"),onClick:_e})})]},de)})}),R&&(0,k.jsx)(i.xh,{children:(0,k.jsxs)(l.Zp,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:e("目录")})}),children:[(0,k.jsx)("div",{className:"div-row",children:(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{D(e=>[...e,{id:"",account_name:"",path:""}])}})}),Q.map((t,s)=>(0,k.jsxs)(ae.d,{title:`#${s+1}`,toolbar:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:()=>(async t=>{const s=q[t];if(y)try{const n={credential_id:y};s.id&&(n.account_id=s.id),void 0!==s.note&&(n.note=s.note),void 0!==s.account_name&&(n.account_name=String(s.account_name)),void 0!==s.path&&(n.path=String(s.path));const i=await d.I2.post("credential/account_save",n);(0,v.SK)(e("保存成功"));const a=i?.data;D(e=>e.map((e,s)=>s===t?{...e,...a}:e))}catch(e){}else(0,v.zN)(e("请先保存凭据"))})(s)}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{ve(q[e])})(s)})]}),children:[(0,k.jsx)(r.BC,{label:e("备注"),label_width:"7rem",children:(0,k.jsx)(r.Sm,{placeholder:e("便于辨认的名字"),value:t.note??"",handleInputChange:e=>Y(s,{note:e})})}),(0,k.jsx)(r.BC,{label:e("名称"),label_width:"7rem",children:(0,k.jsx)(r.Sm,{placeholder:e("目录"),value:t.account_name??"",handleInputChange:e=>Y(s,{account_name:e})})}),(0,k.jsx)(r.BC,{label:e("目录"),label_width:"7rem",required:!0,children:(0,k.jsx)(r.Sm,{placeholder:e("本地绝对路径"),value:t.path,handleInputChange:e=>Y(s,{path:e})})})]},s))]})}),L&&(0,k.jsx)(i.xh,{children:(0,k.jsx)(l.Zp,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:e("账号")})}),children:(0,k.jsxs)(n.Fragment,{children:[J.length>0&&(0,k.jsx)("div",{className:"div-row",children:(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:te})}),q.map((t,s)=>(0,k.jsxs)(ae.d,{title:(0,k.jsx)(k.Fragment,{children:(0,k.jsx)("span",{children:`${e("账号")} #${s+1}`})}),toolbar:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:()=>xe(t)}),(0,k.jsx)(o.rA,{icon:"network_check",title:e("验证"),onClick:()=>je(t)}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>ve(t)})]}),children:[(0,k.jsx)(r.BC,{label:e("备注"),label_width:"7rem",children:(0,k.jsx)(r.Sm,{placeholder:e("便于辨认的名字"),value:t.note??"",handleInputChange:e=>ne(s,{note:e})})}),J.map(n=>(0,k.jsx)(r.BC,{label:e(n.label),label_width:"7rem",required:n.required,children:"textarea"===n.type?(0,k.jsx)(r.Z2,{style:{width:"100%",height:"6rem"},placeholder:n.placeholder?e(n.placeholder):"",value:String(t[n.key]??""),handleInputChange:e=>ne(s,{[n.key]:e})}):(0,k.jsx)(r.Sm,{type:"password"===n.type?"password":"text",placeholder:n.placeholder?e(n.placeholder):"",value:String(t[n.key]??""),handleInputChange:e=>ne(s,{[n.key]:e})})},n.key)),t.id&&void 0!==t.token&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(le,{src:t.avatar_url,name:t.nickname||t.account_name,label:e("头像"),label_width:"7rem"}),(0,k.jsx)(r.BC,{label:e("百度账号"),label_width:"7rem",children:(0,k.jsx)("p",{children:t.account_name||t.id})}),(0,k.jsx)(r.BC,{label:e("授权状态"),label_width:"7rem",children:(0,k.jsx)("p",{children:t.token?e("已授权"):e("未授权")})}),(0,k.jsx)(r.BC,{label:e("授权时间"),label_width:"7rem",children:(0,k.jsx)("p",{children:t.token?.obtained_at?(0,se.eK)(t.token.obtained_at):"-"})})]})]},t.id??s))]})})})]})})," "]})}function ue(){const{t:e}=(0,_.Bd)(),{check_user_auth:t}=(0,j.MH)();return t(a.oV.file_mount)?(0,k.jsx)(i.xh,{children:(0,k.jsx)(i.fI,{children:(0,k.jsx)(i.VP,{widthPer:100,maxWidth:"90rem",children:(0,k.jsx)(he,{})})})}):(0,k.jsx)(i.fI,{children:(0,k.jsx)(i.VP,{children:(0,k.jsx)(l.Zp,{self_title:(0,k.jsx)("h2",{children:e("网盘凭据")}),children:(0,k.jsx)("p",{children:e("nmuntpr")})})})})}const pe=[{value:"sftp",label:"SFTP"},{value:"webdav",label:"WebDAV"},{value:"smb",label:"SMB"}];function me(){const{t:e}=(0,_.Bd)(),t=(0,ee.y)(),s=(0,f.T)(),[a,c]=(0,n.useState)([]),[h,u]=(0,n.useState)("none"),[m,x]=(0,n.useState)(""),[j,y]=(0,n.useState)("sftp"),[g,w]=(0,n.useState)(""),[b,S]=(0,n.useState)(0),[C,A]=(0,n.useState)(!1),[I,N]=(0,n.useState)(""),[$,V]=(0,n.useState)(""),[B,P]=(0,n.useState)(""),[F,z]=(0,n.useState)([{share_name:"",path:"",readonly:!1}]),[K,X]=(0,n.useState)(""),[O,T]=(0,n.useState)(""),[M,q]=(0,n.useState)([{url_path:"",path:"",readonly:!1}]),[D,H]=(0,n.useState)([{username:"",password:"",path:"",readonly:!1}]),U=async()=>{const e=await d.od.post("list",{});c(e?.data??[])};(0,n.useEffect)(()=>{U()},[]);const W=()=>{x(""),y("sftp"),w(""),S(0),A(!1),N(""),V(""),P(""),z([{share_name:"",path:"",readonly:!1}]),X(""),T(""),q([{url_path:"",path:"",readonly:!1}]),H([{username:"",password:"",path:"",readonly:!1}])},E=()=>{u("none"),W()},Z=e=>"smb"===e?F:"webdav"===e?M:D,G=(e,t)=>{"smb"!==e?"webdav"!==e?H(t):q(t):z(t)},R=(e,t,s)=>{G(e,Z(e).map((e,n)=>n===t?{...e,...s}:e))},L=e=>"smb"===e.type?(e.smb?.shares??[]).map(e=>e.share_name).join(", "):"webdav"===e.type?(e.webdav?.shares??[]).map(e=>e.url_path).join(", "):(e.sftp?.shares??[]).map(e=>e.username).join(", ");return(0,k.jsxs)(i.fI,{children:[(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,k.jsx)(i.xh,{children:(0,k.jsx)(l.uF,{self_title:(0,k.jsx)("span",{className:" div-row ",children:(0,k.jsx)("h2",{children:e("文件服务")})}),rightTopCom:(0,k.jsx)("div",{className:"div-row",children:(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{W(),S(2022),u("add")}})}),children:(0,k.jsx)(p.X,{headers:[e("状态"),e("备注"),e("协议"),e("端口"),e("共享"),e("操作")],rows:a.map((s,n)=>{return[(0,k.jsx)(o.Ay,{checked:s.running,title:e("启用"),onChange:t=>(async(t,s)=>{await d.od.post(s?"start":"stop",{id:t.id}),(0,v.SK)(e(s?"已启用":"已禁用")),await U()})(s,t)}),(0,k.jsx)(l.xP,{children:s.note||"-"}),(0,k.jsx)("p",{children:(i=s.type,pe.find(e=>e.value===i)?.label??i)}),(0,k.jsx)("p",{children:s.port}),(0,k.jsx)(l.xP,{children:L(s)||"-"}),(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{W(),x(e.id),y(e.type),w(e.note),S(e.port),A(e.readonly),N(e.smb?.hostname??""),V(e.smb?.username??""),P(e.smb?.password??""),z(e.smb?.shares?.length?e.smb.shares.map(e=>({...e})):[{share_name:"",path:"",readonly:!1}]),X(e.webdav?.username??""),T(e.webdav?.password??""),q(e.webdav?.shares?.length?e.webdav.shares.map(e=>({...e})):[{url_path:"",path:"",readonly:!1}]),H(e.sftp?.shares?.length?e.sftp.shares.map(e=>({...e})):[{username:"",password:"",path:"",readonly:!1}]),u("edit")})(s)}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(s=>{t({title:e("确认删除"),confirm_fun:async()=>{await d.od.post("delete",{id:s.id}),(0,v.SK)(e("删除成功")),m===s.id&&E(),await U()}})})(s)})]})];var i})})})})}),(0,k.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:"none"!==h&&(0,k.jsx)(i.xh,{children:(0,k.jsxs)(l.Zp,{self_title:(0,k.jsxs)("span",{className:" div-row ",children:[(0,k.jsx)("h2",{children:e("add"===h?"添加":"编辑")}),(0,k.jsx)(o.rA,{icon:"info",title:e("说明"),onClick:()=>s(e("smb_known_issue_tip"))})]}),rightBottomCom:(0,k.jsxs)("div",{children:[(0,k.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:E}),(0,k.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t={type:j,note:g,port:Number(b),readonly:C};"smb"===j&&(t.smb={hostname:I,username:$,password:B,shares:F}),"webdav"===j&&(t.webdav={username:K,password:O,shares:M}),"sftp"===j&&(t.sftp={shares:D}),m?(t.id=m,await d.od.post("update",t)):await d.od.post("add",t),(0,v.SK)(e("保存成功")),E(),await U()}})]}),children:[(0,k.jsx)(r.BC,{label:e("协议"),label_width:"7rem",required:!0,children:(0,k.jsx)(r.l6,{value:j,options:pe,onChange:e=>y(e)})}),(0,k.jsx)(r.BC,{label:e("端口"),label_width:"7rem",required:!0,children:(0,k.jsx)(r.Sm,{placeholder:"1-65535",value:String(b||""),handleInputChange:e=>S(Number(e)||0)})}),(0,k.jsx)(r.BC,{label:e("备注"),label_width:"7rem",children:(0,k.jsx)(r.Sm,{value:g,handleInputChange:w})}),(0,k.jsx)(r.BC,{label:e("只读"),label_width:"7rem",children:(0,k.jsx)(o.Ay,{checked:C,onChange:A})}),"webdav"===j&&(0,k.jsxs)(n.Fragment,{children:[(0,k.jsx)(r.BC,{label:e("用户名"),label_width:"7rem",children:(0,k.jsx)(r.Sm,{placeholder:e("留空则不验证身份"),value:K,handleInputChange:X})}),(0,k.jsx)(r.BC,{label:e("密码"),label_width:"7rem",children:(0,k.jsx)(r.Sm,{type:"password",value:O,handleInputChange:T})})]}),"smb"===j&&(0,k.jsxs)(n.Fragment,{children:[(0,k.jsx)(r.BC,{label:e("主机名"),label_width:"7rem",children:(0,k.jsx)(r.Sm,{value:I,handleInputChange:N})}),(0,k.jsx)(r.BC,{label:e("用户名"),label_width:"7rem",children:(0,k.jsx)(r.Sm,{placeholder:e("留空则不验证身份"),value:$,handleInputChange:V})}),(0,k.jsx)(r.BC,{label:e("密码"),label_width:"7rem",children:(0,k.jsx)(r.Sm,{type:"password",value:B,handleInputChange:P})})]}),Z(j).map((t,s)=>(0,k.jsxs)(ae.d,{title:e("sftp"===j?"账号":"共享")+` #${s+1}`,toolbar:(0,k.jsxs)(k.Fragment,{children:["smb"===j&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("span",{children:e("共享名")}),(0,k.jsx)(r.Sm,{value:t.share_name,no_border:!0,width:"8rem",placeholder:"share",handleInputChange:e=>R(j,s,{share_name:e})})]}),"webdav"===j&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("span",{children:e("路径")}),(0,k.jsx)(r.Sm,{value:t.url_path,no_border:!0,width:"8rem",placeholder:"docs",handleInputChange:e=>R(j,s,{url_path:e})})]}),"sftp"===j&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("span",{children:e("用户名")}),(0,k.jsx)(r.Sm,{value:t.username,no_border:!0,width:"8rem",handleInputChange:e=>R(j,s,{username:e})}),(0,k.jsx)("span",{children:e("密码")}),(0,k.jsx)(r.Sm,{type:"password",value:t.password,no_border:!0,width:"8rem",handleInputChange:e=>R(j,s,{password:e})})]}),(0,k.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>(e=>{const t="smb"===e?{share_name:"",path:"",readonly:!1}:"webdav"===e?{url_path:"",path:"",readonly:!1}:{username:"",password:"",path:"",readonly:!1};G(e,[...Z(e),t])})(j)}),(0,k.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>((e,t)=>{G(e,Z(e).filter((e,s)=>s!==t))})(j,s)})]}),children:[(0,k.jsx)(r.BC,{label:e("目录"),label_width:"7rem",required:!0,children:(0,k.jsx)(r.Sm,{placeholder:e("对外提供的本地绝对路径"),value:t.path,handleInputChange:e=>R(j,s,{path:e})})}),(0,k.jsx)(r.BC,{label:e("只读"),label_width:"7rem",children:(0,k.jsx)(o.Ay,{checked:t.readonly,onChange:e=>R(j,s,{readonly:e})})})]},s))]})})})]})}function _e(){const{t:e}=(0,_.Bd)(),{check_user_auth:t}=(0,j.MH)();return t(a.oV.file_mount)?(0,k.jsx)(me,{}):(0,k.jsx)(i.fI,{children:(0,k.jsx)(l.Zp,{self_title:(0,k.jsx)("h2",{children:e("文件服务")}),children:(0,k.jsx)("p",{children:e("没有权限")})})})}var xe=s(87361);function je(){const{t:e}=(0,_.Bd)(),{check_user_auth:t}=(0,j.MH)(),s=[{index:2,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,k.jsx)(Y,{})}];return t(a.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,k.jsx)(C,{})}),t(a.oV.sys_env_page)&&s.push({index:3,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,k.jsx)(W,{})}),t(a.oV.file_mount)&&(s.push({index:5,name:e("网盘凭据"),rto:"credential_setting/",component:(0,k.jsx)(ue,{})}),s.push({index:5,name:e("网盘挂载"),rto:"mount_setting/",component:(0,k.jsx)(ie,{})})),t(a.oV.file_server)&&s.push({index:6,name:e("文件服务"),rto:"file_server_setting/",component:(0,k.jsx)(_e,{})}),t(a.oV.user_manage)&&s.push({index:7,name:e("用户管理"),rto:"user_manager/",component:(0,k.jsx)(R,{})}),t(a.oV.role_manage)&&s.push({index:8,name:e("角色管理"),rto:"role_manager/",component:(0,k.jsx)(L,{})}),(0,k.jsx)(i.W1,{optionList:s,father_route:xe.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>h,o:()=>p});var n=s(34843),i=s(82893),a=s(74777),l=s(96540),o=s(22022),r=s(23430),d=s(14284),c=s(74848);function h(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:l}=(0,o.Bd)();return e=>{let n;e===a.jk.ffmpeg?n=(0,c.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===a.jk.smartmontools?n=(0,c.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?n=(0,c.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,c.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?n=(0,c.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?n=(0,c.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?n=(0,c.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?n=(0,c.jsx)("div",{children:(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,c.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?n=(0,c.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?n=(0,c.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?n=(0,c.jsx)("div",{children:(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,c.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,c.jsxs)("li",{children:[(0,c.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,c.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,c.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,c.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?n=(0,c.jsx)("div",{children:s("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(n=(0,c.jsxs)("div",{children:[(0,c.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,c.jsxs)("ul",{children:[(0,c.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,c.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,c.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,c.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,c.jsx)("div",{children:n})})}}let u=r.Ky;function p(){const[e,t]=(0,l.useState)([]);return(0,l.useEffect)(()=>{(async()=>{try{const e=await d.XO.get("themes");if(0===e.code){const s=e.data||[];u=[...r.Ky,...s],t(u)}else console.warn("获取主题列表失败,使用默认列表"),t(u)}catch(e){t(u)}})()},[]),e}},6960(e,t,s){s.d(t,{s:()=>l});var n=s(72635);const i=1440,a=525600;function l(e){e=e>1e12?e:1e3*e;const t=Date.now(),s=Math.abs(t-e)/6e4;return s<1?n.Ay.t("小于一分钟"):s<60?`${s.toFixed(0)} ${n.Ay.t("分钟前")}`:s<i?`${(s/60).toFixed(0)} ${n.Ay.t("小时前")}`:s<43200?`${(s/i).toFixed(0)} ${n.Ay.t("天前")}`:s<a?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/a).toFixed(0)} ${n.Ay.t("年前")}`}},24659(e,t,s){s.d(t,{K:()=>i});var n=s(22022);const i=()=>{const{t:e}=(0,n.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6471],{96471(e,t,s){s.d(t,{MOBI:()=>F,isMOBI:()=>O});const r=e=>{if(!e)return"";const t=document.createElement("textarea");return t.innerHTML=e,t.value},n={XML:"application/xml",XHTML:"application/xhtml+xml",HTML:"text/html",CSS:"text/css",SVG:"image/svg+xml"},i={name:[0,32,"string"],type:[60,4,"string"],creator:[64,4,"string"],numRecords:[76,2,"uint"]},a={compression:[0,2,"uint"],numTextRecords:[8,2,"uint"],recordSize:[10,2,"uint"],encryption:[12,2,"uint"]},o={magic:[16,4,"string"],length:[20,4,"uint"],type:[24,4,"uint"],encoding:[28,4,"uint"],uid:[32,4,"uint"],version:[36,4,"uint"],titleOffset:[84,4,"uint"],titleLength:[88,4,"uint"],localeRegion:[94,1,"uint"],localeLanguage:[95,1,"uint"],resourceStart:[108,4,"uint"],huffcdic:[112,4,"uint"],numHuffcdic:[116,4,"uint"],exthFlag:[128,4,"uint"],trailingFlags:[240,4,"uint"],indx:[244,4,"uint"]},c={resourceStart:[108,4,"uint"],fdst:[192,4,"uint"],numFdst:[196,4,"uint"],frag:[248,4,"uint"],skel:[252,4,"uint"],guide:[260,4,"uint"]},l={magic:[0,4,"string"],length:[4,4,"uint"],count:[8,4,"uint"]},h={magic:[0,4,"string"],length:[4,4,"uint"],type:[8,4,"uint"],idxt:[20,4,"uint"],numRecords:[24,4,"uint"],encoding:[28,4,"uint"],language:[32,4,"uint"],total:[36,4,"uint"],ordt:[40,4,"uint"],ligt:[44,4,"uint"],numLigt:[48,4,"uint"],numCncx:[52,4,"uint"]},u={magic:[0,4,"string"],length:[4,4,"uint"],numControlBytes:[8,4,"uint"]},d={magic:[0,4,"string"],offset1:[8,4,"uint"],offset2:[12,4,"uint"]},f={magic:[0,4,"string"],length:[4,4,"uint"],numEntries:[8,4,"uint"],codeLength:[12,4,"uint"]},g={magic:[0,4,"string"],numEntries:[8,4,"uint"]},m={flags:[8,4,"uint"],dataStart:[12,4,"uint"],keyLength:[16,4,"uint"],keyStart:[20,4,"uint"]},p={1252:"windows-1252",65001:"utf-8"},w={100:["creator","string",!0],101:["publisher"],103:["description"],104:["isbn"],105:["subject","string",!0],106:["date"],108:["contributor","string",!0],109:["rights"],110:["subjectCode","string",!0],112:["source","string",!0],113:["asin"],121:["boundary","uint"],122:["fixedLayout"],125:["numResources","uint"],126:["originalResolution"],127:["zeroGutter"],128:["zeroMargin"],129:["coverURI"],132:["regionMagnification"],201:["coverOffset","uint"],202:["thumbnailOffset","uint"],503:["title"],524:["language","string",!0],527:["pageProgressionDirection"]},b={1:["ar","ar-SA","ar-IQ","ar-EG","ar-LY","ar-DZ","ar-MA","ar-TN","ar-OM","ar-YE","ar-SY","ar-JO","ar-LB","ar-KW","ar-AE","ar-BH","ar-QA"],2:["bg"],3:["ca"],4:["zh","zh-TW","zh-CN","zh-HK","zh-SG"],5:["cs"],6:["da"],7:["de","de-DE","de-CH","de-AT","de-LU","de-LI"],8:["el"],9:["en","en-US","en-GB","en-AU","en-CA","en-NZ","en-IE","en-ZA","en-JM",null,"en-BZ","en-TT","en-ZW","en-PH"],10:["es","es-ES","es-MX",null,"es-GT","es-CR","es-PA","es-DO","es-VE","es-CO","es-PE","es-AR","es-EC","es-CL","es-UY","es-PY","es-BO","es-SV","es-HN","es-NI","es-PR"],11:["fi"],12:["fr","fr-FR","fr-BE","fr-CA","fr-CH","fr-LU","fr-MC"],13:["he"],14:["hu"],15:["is"],16:["it","it-IT","it-CH"],17:["ja"],18:["ko"],19:["nl","nl-NL","nl-BE"],20:["no","nb","nn"],21:["pl"],22:["pt","pt-BR","pt-PT"],23:["rm"],24:["ro"],25:["ru"],26:["hr",null,"sr"],27:["sk"],28:["sq"],29:["sv","sv-SE","sv-FI"],30:["th"],31:["tr"],32:["ur"],33:["id"],34:["uk"],35:["be"],36:["sl"],37:["et"],38:["lv"],39:["lt"],41:["fa"],42:["vi"],43:["hy"],44:["az"],45:["eu"],46:["hsb"],47:["mk"],48:["st"],49:["ts"],50:["tn"],52:["xh"],53:["zu"],54:["af"],55:["ka"],56:["fo"],57:["hi"],58:["mt"],59:["se"],62:["ms"],63:["kk"],65:["sw"],67:["uz",null,"uz-UZ"],68:["tt"],69:["bn"],70:["pa"],71:["gu"],72:["or"],73:["ta"],74:["te"],75:["kn"],76:["ml"],77:["as"],78:["mr"],79:["sa"],82:["cy","cy-GB"],83:["gl","gl-ES"],87:["kok"],97:["ne"],98:["fy"]},y=(e,t)=>{const s=new e.constructor(e.length+t.length);return s.set(e),s.set(t,e.length),s},R=(e,t,s)=>{const r=new e.constructor(e.length+t.length+s.length);return r.set(e),r.set(t,e.length),r.set(s,e.length+t.length),r},x=new TextDecoder,S=e=>x.decode(e),L=e=>{if(!e)return;const t=e.byteLength,s=4===t?"getUint32":2===t?"getUint16":"getUint8";return new DataView(e)[s](0)},T=(e,t)=>Object.fromEntries(Array.from(Object.entries(e)).map(([e,[s,r,n]])=>[e,("string"===n?S:L)(t.slice(s,s+r))])),A=e=>new TextDecoder(p[e]),M=(e,t=0)=>{let s=0,r=0;for(const n of e.subarray(t,t+4))if(s=s<<7|(127&n)>>>0,r++,128&n)break;return{value:s,length:r}},C=e=>{let t=0;for(const s of e.subarray(-4))128&s&&(t=0),t=t<<7|127&s;return t},E=e=>{let t=0;for(;e>0;e>>=1)1&~e||t++;return t},k=e=>{let t=0;for(;!(1&e);)e>>=1,t++;return t},v=e=>{let t=[];for(let s=0;s<e.length;s++){const r=e[s];if(0===r)t.push(0);else if(r<=8)for(const n of e.subarray(s+1,(s+=r)+1))t.push(n);else if(r<=127)t.push(r);else if(r<=191){const n=r<<8|e[1+s++],i=(16383&n)>>>3,a=3+(7&n);for(let e=0;e<a;e++)t.push(t[t.length-i])}else t.push(32,128^r)}return Uint8Array.from(t)},I=(e,t)=>{const s=t+32,r=s>>3;let n=0n;for(let s=t>>3;s<=r;s++)n=n<<8n|BigInt(e[s]??0);return n>>8n-BigInt(7&s)&0xffffffffn},U=async(e,t)=>{const s=await t(e),r=T(h,s);if("INDX"!==r.magic)throw new Error("Invalid INDX record");const n=A(r.encoding),i=s.slice(r.length),a=T(u,i);if("TAGX"!==a.magic)throw new Error("Invalid TAGX section");const o=(a.length-12)/4,c=Array.from({length:o},(e,t)=>new Uint8Array(i.slice(12+4*t,12+4*t+4))),l={};let d=0;for(let s=0;s<r.numCncx;s++){const i=await t(e+r.numRecords+s+1),a=new Uint8Array(i);for(let e=0;e<a.byteLength;){const t=e,{value:s,length:r}=M(a,e);e+=r;const o=i.slice(e,e+s);e+=s,l[d+t]=n.decode(o)}d+=65536}const f=[];for(let s=0;s<r.numRecords;s++){const r=await t(e+1+s),n=new Uint8Array(r),i=T(h,r);if("INDX"!==i.magic)throw new Error("Invalid INDX record");for(let e=0;e<i.numRecords;e++){const t=i.idxt+4+2*e,s=L(r.slice(t,t+2)),o=L(r.slice(s,s+1)),l=S(r.slice(s+1,s+1+o)),h=[],u=s+1+o;let d=0,g=u+a.numControlBytes;for(const[e,t,s,i]of c){if(1&i){d++;continue}const a=u+d,o=L(r.slice(a,a+1))&s;if(o===s)if(E(s)>1){const{value:s,length:r}=M(n,g);h.push([e,null,s,t]),g+=r}else h.push([e,1,null,t]);else h.push([e,o>>k(s),null,t])}const m={};for(const[e,t,s,r]of h){const i=[];if(null!=t)for(let e=0;e<t*r;e++){const{value:e,length:t}=M(n,g);i.push(e),g+=t}else{let e=0;for(;e<s;){const{value:t,length:s}=M(n,g);i.push(t),g+=s,e+=s}}m[e]=i}f.push({name:l,tagMap:m})}}return{table:f,cncx:l}},O=async e=>"BOOKMOBI"===S(await e.slice(60,68).arrayBuffer());class B{#e;#t;pdb;async open(e){this.#e=e;const t=T(i,await e.slice(0,78).arrayBuffer());this.pdb=t;const s=await e.slice(78,78+8*t.numRecords).arrayBuffer();this.#t=Array.from({length:t.numRecords},(e,t)=>L(s.slice(8*t,8*t+4))).map((e,t,s)=>[e,s[t+1]])}loadRecord(e){const t=this.#t[e];if(!t)throw new RangeError("Record index out of bounds");return this.#e.slice(...t).arrayBuffer()}async loadMagic(e){const t=this.#t[e][0];return S(await this.#e.slice(t,t+4).arrayBuffer())}}class F extends B{#s=0;#r;#n;#i;#a;#o;constructor({unzlib:e}){super(),this.unzlib=e}async open(e){await super.open(e),this.headers=this.#c(await super.loadRecord(0)),this.#r=this.headers.mobi.resourceStart;let t=this.headers.mobi.version>=8;if(!t){const e=this.headers.exth?.boundary;if(e<4294967295)try{this.headers=this.#c(await super.loadRecord(e)),this.#s=e,t=!0}catch(e){console.warn(e),console.warn("Failed to open KF8; falling back to MOBI")}}return await this.#l(),t?new P(this).init():new z(this).init()}#c(e){const t=T(a,e),s=T(o,e);if("MOBI"!==s.magic)throw new Error("Missing MOBI header");const{titleOffset:r,titleLength:n,localeLanguage:i,localeRegion:h}=s;s.title=e.slice(r,r+n);const u=b[i];s.language=u?.[h>>2]??u?.[0];const d=64&s.exthFlag?((e,t)=>{const{magic:s,count:r}=T(l,e);if("EXTH"!==s)throw new Error("Invalid EXTH header");const n=A(t),i={};let a=12;for(let t=0;t<r;t++){const t=L(e.slice(a,a+4)),s=L(e.slice(a+4,a+8));if(t in w){const[r,o,c]=w[t],l=e.slice(a+8,a+s),h="uint"===o?L(l):n.decode(l);c?(i[r]??=[],i[r].push(h)):i[r]=h}a+=s}return i})(e.slice(s.length+16),s.encoding):null;return{palmdoc:t,mobi:s,exth:d,kf8:s.version>=8?T(c,e):null}}async#l(){const{palmdoc:e,mobi:t}=this.headers;this.#n=A(t.encoding),this.#i=new TextEncoder;const{compression:s}=e;if(this.#a=1===s?e=>e:2===s?v:17480===s?await(async(e,t)=>{const s=await t(e.huffcdic),{magic:r,offset1:n,offset2:i}=T(d,s);if("HUFF"!==r)throw new Error("Invalid HUFF record");const a=Array.from({length:256},(e,t)=>n+4*t).map(e=>L(s.slice(e,e+4))).map(e=>[128&e,31&e,e>>>8]),o=[null].concat(Array.from({length:32},(e,t)=>i+8*t).map(e=>[L(s.slice(e,e+4)),L(s.slice(e+4,e+8))])),c=[];for(let s=1;s<e.numHuffcdic;s++){const r=await t(e.huffcdic+s),n=T(f,r);if("CDIC"!==n.magic)throw new Error("Invalid CDIC record");const i=Math.min(1<<n.codeLength,n.numEntries-c.length),a=r.slice(n.length);for(let e=0;e<i;e++){const t=L(a.slice(2*e,2*e+2)),s=L(a.slice(t,t+2)),r=32767&s,n=32768&s,i=new Uint8Array(a.slice(t+2,t+2+r));c.push([i,n])}}const l=e=>{let t=new Uint8Array;const s=8*e.byteLength;for(let r=0;r<s;){const n=Number(I(e,r));let[i,h,u]=a[n>>>24];if(!i){for(;n>>>32-h<o[h][0];)h+=1;u=o[h][1]}if((r+=h)>s)break;const d=u-(n>>>32-h);let[f,g]=c[d];g||(f=l(f),c[d]=[f,!0]),t=y(t,f)}return t};return l})(t,this.loadRecord.bind(this)):null,!this.#a)throw new Error("Unknown compression type");const{trailingFlags:r}=t,n=1&r,i=E(r>>>1);this.#o=e=>{for(let t=0;t<i;t++){const t=C(e);e=e.subarray(0,-t)}if(n){const t=1+(3&e[e.length-1]);e=e.subarray(0,-t)}return e}}decode(...e){return this.#n.decode(...e)}encode(...e){return this.#i.encode(...e)}loadRecord(e){return super.loadRecord(this.#s+e)}loadMagic(e){return super.loadMagic(this.#s+e)}loadText(e){return this.loadRecord(e+1).then(e=>new Uint8Array(e)).then(this.#o).then(this.#a)}async loadResource(e){const t=await super.loadRecord(this.#r+e),s=S(t.slice(0,4));return"FONT"===s?(async(e,t)=>{const{flags:s,dataStart:r,keyLength:n,keyStart:i}=T(m,e),a=new Uint8Array(e.slice(r));if(2&s){const t=16===n?1024:1040,s=new Uint8Array(e.slice(i,i+n)),r=Math.min(t,a.length);for(var o=0;o<r;o++)a[o]=a[o]^s[o%s.length]}if(1&s)try{return await t(a)}catch(e){console.warn(e),console.warn("Failed to decompress font")}return a})(t,this.unzlib):"VIDE"===s||"AUDI"===s?t.slice(12):t}getNCX(){const e=this.headers.mobi.indx;if(e<4294967295)return(async(e,t)=>{const{table:s,cncx:r}=await U(e,t),n=s.map(({tagMap:e},t)=>({index:t,offset:e[1]?.[0],size:e[2]?.[0],label:r[e[3]]??"",headingLevel:e[4]?.[0],pos:e[6],parent:e[21]?.[0],firstChild:e[22]?.[0],lastChild:e[23]?.[0]})),i=e=>(null==e.firstChild||(e.children=n.filter(t=>t.parent===e.index).map(i)),e);return n.filter(e=>0===e.headingLevel).map(i)})(e,this.loadRecord.bind(this))}getMetadata(){const{mobi:e,exth:t}=this.headers;return{identifier:e.uid.toString(),title:r(t?.title||this.decode(e.title)),author:t?.creator?.map(r),publisher:r(t?.publisher),language:t?.language??e.language,published:t?.date,description:r(t?.description),subject:t?.subject?.map(r),rights:r(t?.rights),contributor:t?.contributor}}async getCover(){const{exth:e}=this.headers,t=e?.coverOffset<4294967295?e?.coverOffset:e?.thumbnailOffset<4294967295?e?.thumbnailOffset:null;if(null!=t){const e=await this.loadResource(t);return new Blob([e])}}}const H=/<\s*(?:mbp:)?pagebreak[^>]*>/gi,D=/<[^<>]+filepos=['"]{0,1}(\d+)[^<>]*>/gi;class z{parser=new DOMParser;serializer=new XMLSerializer;#h=new Map;#u=new Map;#d=new Map;#f;#g=[];#m=n.HTML;constructor(e){this.mobi=e}async init(){let e=new Uint8Array;for(let t=0;t<this.mobi.headers.palmdoc.numTextRecords;t++)e=y(e,await this.mobi.loadText(t));const t=Array.from(new Uint8Array(e),e=>String.fromCharCode(e)).join("");this.#f=[0].concat(Array.from(t.matchAll(H),e=>e.index)).map((e,s,r)=>t.slice(e,r[s+1])).map(e=>Uint8Array.from(e,e=>e.charCodeAt(0))).map(e=>({book:this,raw:e})).reduce((e,t)=>{const s=e[e.length-1];return t.start=s?.end??0,t.end=t.start+t.raw.byteLength,e.concat(t)},[]),this.sections=this.#f.map((e,t)=>({id:t,load:()=>this.loadSection(e),createDocument:()=>this.createDocument(e),size:e.end-e.start}));try{this.landmarks=await this.getGuide();const e=this.landmarks.find(({type:e})=>e?.includes("toc"))?.href;if(e){const{index:t}=this.resolveHref(e),s=await this.sections[t].createDocument();let r,n=0,i=0;const a=new Map,o=new Map;this.toc=Array.from(s.querySelectorAll("a[filepos]")).reduce((e,t)=>{const s=(e=>{let t=0;for(;e;){const s=e.parentElement;if(s){const e=s.tagName.toLowerCase();"p"===e?t+=1.5:"blockquote"===e&&(t+=2)}e=s}return t})(t),c={label:t.innerText?.trim()??"",href:`filepos:${t.getAttribute("filepos")}`},l=s>i?n+1:s===i?n:a.get(s)??Math.max(0,n-1);if(l>n)r?(r.subitems??=[],r.subitems.push(c),o.set(l,r)):e.push(c);else{const t=o.get(l);t?t.subitems.push(c):e.push(c)}return r=c,n=l,i=s,a.set(s,l),e},[])}}catch(e){console.warn(e)}return this.#g=[...new Set(Array.from(t.matchAll(D),e=>e[1]))].map(e=>({filepos:e,number:Number(e)})).sort((e,t)=>e.number-t.number),this.metadata=this.mobi.getMetadata(),this.getCover=this.mobi.getCover.bind(this.mobi),this}async getGuide(){const e=await this.createDocument(this.#f[0]);return Array.from(e.getElementsByTagName("reference"),e=>({label:e.getAttribute("title"),type:e.getAttribute("type")?.split(/\s/),href:`filepos:${e.getAttribute("filepos")}`}))}async loadResource(e){if(this.#h.has(e))return this.#h.get(e);const t=await this.mobi.loadResource(e),s=URL.createObjectURL(new Blob([t]));return this.#h.set(e,s),s}async loadRecindex(e){return this.loadResource(Number(e)-1)}async replaceResources(e){for(const t of e.querySelectorAll("img[recindex]")){const e=t.getAttribute("recindex");try{t.src=await this.loadRecindex(e)}catch{console.warn(`Failed to load image ${e}`)}}for(const t of e.querySelectorAll("[mediarecindex]")){const e=t.getAttribute("mediarecindex"),s=t.getAttribute("recindex");try{t.src=await this.loadRecindex(e),s&&(t.poster=await this.loadRecindex(s))}catch{console.warn(`Failed to load media ${e}`)}}for(const t of e.querySelectorAll("[filepos]")){const e=t.getAttribute("filepos");t.href=`filepos:${e}`}}async loadText(e){if(this.#u.has(e))return this.#u.get(e);const{raw:t}=e,s=this.#g.filter(({number:t})=>t>=e.start&&t<e.end).map(t=>({...t,offset:t.number-e.start}));let r=t;s.length&&(r=t.subarray(0,s[0].offset),s.forEach(({filepos:e,offset:n},i)=>{const a=s[i+1],o=this.mobi.encode(`<a id="filepos${e}"></a>`);r=R(r,o,t.subarray(n,a?.offset))}));const n=this.mobi.decode(r).replaceAll(H,"");return this.#u.set(e,n),n}async createDocument(e){const t=await this.loadText(e);return this.parser.parseFromString(t,this.#m)}async loadSection(e){if(this.#d.has(e))return this.#d.get(e);const t=await this.createDocument(e),s=t.createElement("style");t.head.append(s),s.append(t.createTextNode("blockquote {\n margin-block-start: 0;\n margin-block-end: 0;\n margin-inline-start: 1em;\n margin-inline-end: 0;\n }")),await this.replaceResources(t);const r=this.serializer.serializeToString(t),n=URL.createObjectURL(new Blob([r],{type:this.#m}));return this.#d.set(e,n),n}resolveHref(e){const t=e.match(/filepos:(.*)/)[1],s=Number(t);return{index:this.#f.findIndex(e=>e.end>s),anchor:e=>e.getElementById(`filepos${t}`)}}splitTOCHref(e){const t=e.match(/filepos:(.*)/)[1],s=Number(t);return[this.#f.findIndex(e=>e.end>s),`filepos${t}`]}getTOCFragment(e,t){return e.getElementById(t)}isExternal(e){return/^(?!blob|filepos)\w+:/i.test(e)}destroy(){for(const e of this.#h.values())URL.revokeObjectURL(e);for(const e of this.#d.values())URL.revokeObjectURL(e)}}const N=/kindle:(flow|embed):(\w+)(?:\?mime=(\w+\/[-+.\w]+))?/,X=/kindle:pos:fid:(\w+):off:(\w+)/,j=e=>{const[t,s]=e.match(X).slice(1);return{fid:parseInt(t,32),off:parseInt(s,32)}},G=(e=0,t=0)=>`kindle:pos:fid:${e.toString(32).toUpperCase().padStart(4,"0")}:off:${t.toString(32).toUpperCase().padStart(10,"0")}`,$=e=>{const t=e.match(/\s(id|name|aid)\s*=\s*['"]([^'"]*)['"]/i);if(!t)return;const[,s,r]=t;return`[${s}="${CSS.escape(r)}"]`},q=e=>{for(const t of e){if("page-spread-left"===t||"rendition:page-spread-left"===t)return"left";if("page-spread-right"===t||"rendition:page-spread-right"===t)return"right";if("rendition:page-spread-center"===t)return"center"}};class P{parser=new DOMParser;serializer=new XMLSerializer;#d=new Map;#p=new Map;#w=new Map;#b={};#f;#y;#R=new Uint8Array;#x=new Uint8Array;#S=-1;#L=-1;#m=n.XHTML;#T=new Map;constructor(e){this.mobi=e}async init(){const e=this.mobi.loadRecord.bind(this.mobi),{kf8:t}=this.mobi.headers;try{const s=await e(t.fdst),r=T(g,s);if("FDST"!==r.magic)throw new Error("Missing FDST record");const n=Array.from({length:r.numEntries},(e,t)=>12+8*t).map(e=>[L(s.slice(e,e+4)),L(s.slice(e+4,e+8))]);this.#b.fdstTable=n,this.#y=n[n.length-1][1]}catch{}const s=(await U(t.skel,e)).table.map(({name:e,tagMap:t},s)=>({index:s,name:e,numFrag:t[1][0],offset:t[6][0],length:t[6][1]})),i=await U(t.frag,e),a=i.table.map(({name:e,tagMap:t})=>({insertOffset:parseInt(e),selector:i.cncx[t[2][0]],index:t[4][0],offset:t[6][0],length:t[6][1]}));this.#b.skelTable=s,this.#b.fragTable=a,this.#f=s.reduce((e,t)=>{const s=e[e.length-1],r=s?.fragEnd??0,n=r+t.numFrag,i=a.slice(r,n),o=t.length+i.map(e=>e.length).reduce((e,t)=>e+t),c=(s?.totalLength??0)+o;return e.concat({skel:t,frags:i,fragEnd:n,length:o,totalLength:c})},[]);const o=await this.getResourcesByMagic(["RESC","PAGE"]),c=new Map;if(o.RESC){const e=await this.mobi.loadRecord(o.RESC),t=this.mobi.decode(e.slice(16)).replace(/\0/g,""),s=t.search(/\?>/),r=`<package>${t.slice(s)}</package>`,i=this.parser.parseFromString(r,n.XML);for(const e of i.querySelectorAll("spine > itemref")){const t=parseInt(e.getAttribute("skelid"));c.set(t,q(e.getAttribute("properties")?.split(" ")??[]))}}this.sections=this.#f.map((e,t)=>e.frags.length?{id:t,load:()=>this.loadSection(e),createDocument:()=>this.createDocument(e),size:e.length,pageSpread:c.get(t)}:{linear:"no"});try{const e=await this.mobi.getNCX(),t=({label:e,pos:s,children:n})=>{const[i,a]=s,o=G(i,a),c=this.#p.get(i);return c?c.push(a):this.#p.set(i,[a]),{label:r(e),href:o,subitems:n?.map(t)}};this.toc=e?.map(t),this.landmarks=await this.getGuide()}catch(e){console.warn(e)}const{exth:l}=this.mobi.headers;return this.dir=l.pageProgressionDirection,this.rendition={layout:"true"===l.fixedLayout?"pre-paginated":"reflowable",viewport:Object.fromEntries(l.originalResolution?.split("x")?.slice(0,2)?.map((e,t)=>[t?"height":"width",e])??[])},this.metadata=this.mobi.getMetadata(),this.getCover=this.mobi.getCover.bind(this.mobi),this}async getResourcesByMagic(e){const t={},s=this.mobi.headers.kf8.resourceStart,r=this.mobi.pdb.numRecords;for(let n=s;n<r;n++)try{const s=await this.mobi.loadMagic(n),r=e.find(e=>e===s);r&&(t[r]=n)}catch{}return t}async getGuide(){const e=this.mobi.headers.kf8.guide;if(e<4294967295){const t=this.mobi.loadRecord.bind(this.mobi),{table:s,cncx:r}=await U(e,t);return s.map(({name:e,tagMap:t})=>({label:r[t[1][0]]??"",type:e?.split(/\s/),href:G(t[6]?.[0]??t[3]?.[0])}))}}async loadResourceBlob(e){const{resourceType:t,id:s,type:r}=(e=>{const[t,s,r]=e.match(N).slice(1);return{resourceType:t,id:parseInt(s,32),type:r}})(e),i="flow"===t?await this.loadFlow(s):await this.mobi.loadResource(s-1),a=[n.XHTML,n.HTML,n.CSS,n.SVG].includes(r)?await this.replaceResources(this.mobi.decode(i)):i,o=r===n.SVG?this.parser.parseFromString(a,r):null;return[new Blob([a],{type:r}),o?.getElementsByTagNameNS("http://www.w3.org/2000/svg","image")?.length?o.documentElement:null]}async loadResource(e){if(this.#d.has(e))return this.#d.get(e);const[t,s]=await this.loadResourceBlob(e),r=s?e:URL.createObjectURL(t);return s&&this.#T.set(r,s),this.#d.set(e,r),r}replaceResources(e){return(async(e,t,s)=>{const r=[];e.replace(t,(...e)=>(r.push(e),null));const n=[];for(const e of r)n.push(await s(...e));return e.replace(t,()=>n.shift())})(e,new RegExp(N,"g"),this.loadResource.bind(this))}async loadRaw(e,t){const s=t-this.#R.length,r=null==this.#y?1/0:this.#y-this.#x.length-e;if(s<0||s<r){for(;this.#R.length<t;){const e=++this.#S,t=await this.mobi.loadText(e);this.#R=y(this.#R,t)}return this.#R.slice(e,t)}for(;this.#y-this.#x.length>e;){const e=this.mobi.headers.palmdoc.numTextRecords-1-++this.#L,t=await this.mobi.loadText(e);this.#x=y(t,this.#x)}const n=this.#y-this.#x.length;return this.#x.slice(e-n,t-n)}loadFlow(e){if(e<4294967295)return this.loadRaw(...this.#b.fdstTable[e])}async loadText(e){const{skel:t,frags:s,length:r}=e,n=await this.loadRaw(t.offset,t.offset+r);let i=n.slice(0,t.length);for(const e of s){const s=e.insertOffset-t.offset,r=t.length+e.offset,a=n.slice(r,r+e.length);i=R(i.slice(0,s),a,i.slice(s));const o=this.#p.get(e.index);if(o)for(const t of o){const s=this.mobi.decode(a).slice(t),r=$(s);this.#A(e.index,t,r)}}return this.mobi.decode(i)}async createDocument(e){const t=await this.loadText(e);return this.parser.parseFromString(t,this.#m)}async loadSection(e){if(this.#d.has(e))return this.#d.get(e);const t=await this.loadText(e),s=await this.replaceResources(t);let r=this.parser.parseFromString(s,this.#m);!r.querySelector("parsererror")&&r.documentElement?.namespaceURI||(this.#m=n.HTML,r=this.parser.parseFromString(s,this.#m));for(const[e,t]of this.#T)for(const s of r.querySelectorAll(`img[src="${e}"]`))s.replaceWith(t);const i=URL.createObjectURL(new Blob([this.serializer.serializeToString(r)],{type:this.#m}));return this.#d.set(e,i),i}getIndexByFID(e){return this.#f.findIndex(t=>t.frags.some(t=>t.index===e))}#A(e,t,s){const r=this.#w.get(e);if(r)r.set(t,s);else{const r=new Map;this.#w.set(e,r),r.set(t,s)}}async resolveHref(e){const{fid:t,off:s}=j(e),r=this.getIndexByFID(t);if(r<0)return;const n=this.#w.get(t)?.get(s);if(n)return{index:r,anchor:e=>e.querySelector(n)};const{skel:i,frags:a}=this.#f[r],o=a.find(e=>e.index===t),c=i.offset+i.length+o.offset,l=await this.loadRaw(c,c+o.length),h=this.mobi.decode(l).slice(s),u=$(h);this.#A(t,s,u);return{index:r,anchor:e=>e.querySelector(u)}}splitTOCHref(e){const t=j(e);return[this.getIndexByFID(t.fid),t]}getTOCFragment(e,{fid:t,off:s}){const r=this.#w.get(t)?.get(s);return e.querySelector(r)}isExternal(e){return/^(?!blob|kindle)\w+:/i.test(e)}destroy(){for(const e of this.#d.values())URL.revokeObjectURL(e)}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[676,4091,8319],{77481(e,t,s){s.d(t,{S:()=>l,X:()=>i});var n=s(96540),r=s(61443),o=s(74848);function i(e){const[t,s]=n.useState([]),i=(0,n.useRef)(-1),[l,c]=(0,n.useState)(-1),[a,u]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const d=()=>{i.current=-1,c(-1),u(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let i=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(i=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},s)})})}),(0,o.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(l===s?"row-dragging":"")+(a===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(i.current=s,c(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",u(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=i.current,s=a;d(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:d,children:t.map((s,n)=>{const r=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:r,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function l(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},48890(e,t,s){s.d(t,{Kw:()=>n,Tt:()=>r});var n=s(80952),r=(s(82327),s(1766),s(24854),s(90008),s(90846),s(40975),s(44286),s(30766),s(14973),s(69687),s(1234),s(47507),s(87268),s(55208),s(34678),s(24522));const o=`https://gcore.jsdelivr.net/npm/ace-builds@${n.version}/src-min-noconflict/`;n.config.set("basePath",o),n.config.set("modePath",o),n.config.set("themePath",o),n.config.set("workerPath",o)},84091(e,t,s){s.r(t),s.d(t,{default:()=>d});var n=s(96540),r=(s(80952),s(48890)),o=s(34843),i=s(82893),l=s(78247),c=s(93245),a=s(23430),u=s(74848);function d(e){const t=(0,n.useRef)(null),[s,d]=(0,o.fp)(i.AG.user_base_info),[f,p]=(0,n.useState)(!1),_=(0,n.useRef)(f);_.current=f;const h=(0,n.useRef)(e.save);h.current=e.save;const m=(0,n.useRef)(e.on_dirty);m.current=e.on_dirty,(0,n.useEffect)(()=>{m.current?.(f)},[f]);const x=async e=>{if(!h.current||!_.current)return;!1!==await h.current(e)&&p(!1)},v=(0,n.useRef)(x);v.current=x;const g=(0,n.useRef)(e.register);g.current=e.register;const j=(0,n.useRef)(e.on_view_state);j.current=e.on_view_state,(0,n.useEffect)(()=>{g.current?.({save:e=>v.current(e),get_view_state:()=>{const e=t.current;if(!e)return;const s=e.getCursorPosition();return{scroll:e.session.getScrollTop(),row:s.row,column:s.column}}})},[]),(0,c.a)(a.nE.ace,()=>!!h.current&&_.current,x);const w=s.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,n.useEffect)(()=>{const s=r.Kw.edit(t.current,{value:l.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${w}`,mode:e.model??r.Tt.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});s.setOptions({}),s.container.addEventListener("wheel",function(e){e.preventDefault()}),s.focus(),s.on("change",function(t){p(!0),e.on_change&&e.on_change()}),t.current=s;const n=e.view_state;if(n&&("number"==typeof n.scroll&&s.session.setScrollTop(n.scroll),"number"==typeof n.row)){const e={row:n.row,column:n.column??0};s.moveCursorToPosition(e),s.clearSelection(),s.scrollToLine(n.row,!1,!1);s.renderer.getFirstVisibleRow()<=n.row&&s.renderer.getLastVisibleRow()>=n.row||"number"!=typeof n.scroll||s.session.setScrollTop(n.scroll)}s.formatCode=()=>{const e=r.Kw.require("ace/ext/beautify"),s=t.current;s&&e.beautify(s.session)},l.xK.set_editor_temp(s,e.editor_id);const o=()=>{if(!j.current)return;const e=s.getCursorPosition();j.current({scroll:s.session.getScrollTop(),row:e.row,column:e.column})};return s.session.on("changeScrollTop",o),s.on("changeSelection",o),()=>{o(),l.xK.delete_editor_temp(e.editor_id),s.destroy()}},[]),(0,u.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}},60676(e,t,s){s.r(t),s.d(t,{default:()=>C});var n=s(96540),r=s(85997),o=s(42562),i=s(14284),l=s(52671),c=s(77481),a=s(7572),u=s(34843),d=s(82893),f=s(84091),p=s(78247),_=s(61443),h=s(23496),m=s(62042),x=s(22022),v=s(53459),g=s(7523),j=s(74848);function w(e,t="auto"){return"s"===t||"auto"===t&&e>=1e3?`${(e/1e3).toFixed(2)} s`:`${Math.round(e)} ms`}function y(e){const{running:t=!1,resetKey:s=0,format:r="auto",prefix:o="",onTick:i,className:l}=e,[c,a]=(0,n.useState)(0),u=(0,n.useRef)(0),d=(0,n.useRef)(null),f=(0,n.useRef)(t);f.current=t;const p=(0,n.useCallback)(()=>{null!==d.current&&(cancelAnimationFrame(d.current),d.current=null)},[]),_=(0,n.useCallback)(()=>{p();const e=()=>{const t=performance.now()-u.current;a(t),i?.(t),f.current&&(d.current=requestAnimationFrame(e))};e()},[i,p]);return(0,n.useEffect)(()=>{u.current=performance.now(),a(0),i?.(0),f.current&&_()},[s]),(0,n.useEffect)(()=>{t?_():p()},[t,_,p]),(0,n.useEffect)(()=>()=>p(),[p]),(0,j.jsxs)("span",{className:l,children:[o,w(c,r)]})}var S=s(87361),b=s(28319);function q(e){const[t,s]=(0,n.useState)("");return(0,j.jsxs)("div",{className:"db-query-preset-input",children:[(0,j.jsx)(_.Sm,{placeholder:e.placeholder,value:t,handleInputChange:s}),(0,j.jsx)("div",{className:"db-query-preset-input__actions",children:(0,j.jsx)(r.C3,{text:e.confirmText,clickFun:()=>e.onConfirm(t.trim())})})]})}function C(){const e=(0,l.Zp)(),{t}=(0,x.Bd)(),{initUserInfo:s}=(0,n.useContext)(g.F),[w,C]=(0,u.fp)(d.AG.sqlite_query_context),[k]=(0,u.fp)(d.AG.user_base_info),[,E]=(0,u.fp)(d.AG.prompt_card),N=(0,n.useMemo)(()=>w?.path??"",[w?.path]),A=(0,n.useMemo)(()=>w?.path?`${w?.name||"数据库"} | ${w.path}`:"未选择数据库",[w?.name,w?.path]),R=97,[K,L]=(0,n.useState)(""),[F,T]=(0,n.useState)("table"),[$,P]=(0,n.useState)(!1),[M,D]=(0,n.useState)(""),[O,Q]=(0,n.useState)(null),[G,I]=(0,n.useState)(!1),[J,V]=(0,n.useState)(0),[Z,W]=(0,n.useState)(!1),[B,H]=(0,n.useState)([]),[X,U]=(0,n.useState)(-1);(0,n.useEffect)(()=>{const e=k?.user_data?.sql_preset_list;e&&e.length?H([...e]):H([{index:0,note:t("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}])},[k?.user_data?.sql_preset_list]);const z=async e=>{const t=e.map((e,t)=>({...e,index:t})),n=await i.wm.post(h.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:t});return n?.code===v.m.Success&&(await s(),H(t),!0)},Y=async(e,s)=>{const n=[...B,{note:s||t("SQL 预设"),sql:e,env:b.sqlEnvDefault}];await z(n)&&(E({open:!1}),(0,m.SK)(t("创建成功")),U(n.length-1))},ee=(e,t)=>{if(!e)return"";for(const s of e.split("\n")){const e=s.indexOf("=");if(!(e<0)&&s.slice(0,e).trim()===t)return s.slice(e+1).trim()}return""},[te,se]=(0,n.useState)(""),[ne,re]=(0,n.useState)("");(0,n.useEffect)(()=>{p.xK.set_value_temp(K,R)},[K]),(0,n.useEffect)(()=>{L(""),D(""),Q(null),T("table"),I(!1),W(!1),V(0),se(""),re(""),p.xK.set_value_temp("",R),N||D("请先从文件右键打开一个数据库")},[N,w?.open]);const oe=async()=>{const e=(p.xK.get_editor_value(R)??K).trim();if(!N)return D("请先从文件右键打开一个数据库"),void Q(null);if(!e)return D("请输入 SQL 语句"),void Q(null);P(!0),D(""),W(!0),V(e=>e+1),I(!0);try{const s=(t=e,te?t.split(te).join(ne):t),n=await i.$M.post("sqlite/query",{path:N,sql:s});Q(n.data),T("table")}catch(e){D(e?.message??`${e}`),Q(null)}finally{I(!1),P(!1)}var t},ie=O?.columns?.length?O.columns:Object.keys(O?.rows?.[0]??{}),le=(O?.rows??[]).map(e=>ie.map(t=>{return null==(s=e[t])?"":"object"==typeof s?JSON.stringify(s):`${s}`;var s}));return w?.open?(0,j.jsx)(o.A,{name:A,on_close:()=>{w?.close?.(),C({...w,open:!1})},extra:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.rA,{icon:"play_arrow",title:"执行",onClick:oe},"run"),(0,j.jsx)(r.rA,{icon:"table_chart",title:"表格视图",onClick:()=>T("table")},"table"),(0,j.jsx)(r.rA,{icon:"data_object",title:"原 JSON",onClick:()=>T("json")},"json"),(0,j.jsx)(r.rA,{icon:"settings",title:t("SQL预设设置"),onClick:()=>{e(S.o.sql_preset_setting_page)}},"preset-setting")]}),children:(0,j.jsxs)("div",{className:"db-query-page__content",children:[(0,j.jsxs)(a.Zp,{title:"SQL 查询",rightTopCom:(0,j.jsxs)("div",{className:"db-query-page__preset-bar",children:[te&&(0,j.jsx)(_.Sm,{placeholder:`${t("替换")}: ${te}`,value:ne,handleInputChange:re,width:"12rem"}),B.length>0&&(0,j.jsx)(_.l6,{width:"16rem",tip:t("SQL预设"),value:X,onChange:e=>{const t=B[e];t&&(U(e),(e=>{p.xK.set_value_temp(e,R);const t=p.xK.get_editor(R);t&&t.setValue(e,-1),L(e)})(t.sql),se(ee(t.env??"","find")),re(""),D(""))},options:B.map((e,t)=>({value:t,title:`${e.note||e.sql.slice(0,24)}`}))}),(0,j.jsx)(r.C3,{text:t(X>=0?"更新保存":"创建新预选项"),clickFun:async()=>{const e=(p.xK.get_editor_value(R)??K).trim();if(!e)return void D(t("sql_in"));const s=[...B];if(X>=0&&s[X]){s[X].sql=e,s[X].note||(s[X].note=t("SQL 预设"));await z(s)&&(0,m.SK)(t("更新成功"))}else E({open:!0,title:t("创建新预选项"),context_div:(0,j.jsx)(q,{placeholder:t("请输入备注"),confirmText:t("确认"),onConfirm:t=>Y(e,t)}),cancel:()=>E({open:!1})})}})]}),rightBottomCom:(0,j.jsxs)("div",{className:"db-query-page__actions",children:[(0,j.jsx)(r.C3,{text:$?"查询中...":"执行查询",clickFun:oe}),(0,j.jsx)(r.C3,{text:"清空",clickFun:()=>{p.xK.set_value_temp("",R);const e=p.xK.get_editor(R);e&&e.setValue("",-1),L("")}}),(0,j.jsx)(r.C3,{text:"table"===F?"表格视图":"切换到表格",clickFun:()=>T("table")}),(0,j.jsx)(r.C3,{text:"json"===F?"原 JSON":"切换到 JSON",clickFun:()=>T("json")})]}),children:[(0,j.jsx)("div",{className:"db-query-page__editor",children:(0,j.jsx)(f.default,{name:"sqlite.sql",editor_id:R,model:"ace/mode/sql",on_change:()=>{const e=p.xK.get_editor_value(R)??"";L(e)},options:{showPrintMargin:!1,highlightActiveLine:!0,wrap:!0}})}),M&&(0,j.jsx)("div",{className:"db-query-page__error",children:M})]}),(0,j.jsxs)(a.Zp,{title:"查询结果",rightTopCom:(0,j.jsxs)("span",{className:"db-query-page__result-meta",children:[O?`${O.row_count} 行`:"暂无结果",Z&&(0,j.jsx)("span",{className:"db-query-page__elapsed",children:(0,j.jsx)(y,{running:G,resetKey:J,prefix:`${t("耗时")}: `,format:"auto"})})]}),children:[O&&"table"===F&&(0,j.jsx)(c.X,{headers:ie,rows:le}),O&&"json"===F&&(0,j.jsx)("pre",{className:"db-query-page__result-json",children:JSON.stringify(O.rows,null,2)}),!O&&!M&&(0,j.jsx)("div",{className:"db-query-page__hint",children:"先输入查询语句,再执行。支持 `select`、`with`、`pragma`、`explain`。"}),!O&&M&&(0,j.jsx)("div",{className:"db-query-page__hint",children:M})]})]})}):null}},28319(e,t,s){s.r(t),s.d(t,{default:()=>y,defaultSqlPreset:()=>j,sqlEnvDefault:()=>w});var n=s(96540),r=s(22022),o=s(4412),i=s(85997),l=s(75725),c=s(77481),a=s(7572),u=s(61443),d=s(34843),f=s(82893),p=s(14284),_=s(23496),h=s(53459),m=(s(62042),s(7523)),x=s(78247),v=s(52671),g=s(74848);function j(e){return{index:0,note:e("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}}const w='# 可选:设置 SQL 中的"替换词"(在查询页选中该预设后,会显示输入框)\n# 例子:SQL 为 SELECT * FROM t WHERE id = 123456 ,请填写下面的 find=123456\n# 这样查询页输入新值即可把 SQL 中的 123456 替换掉后再查询\nfind=';function y(){const{t:e}=(0,r.Bd)(),{initUserInfo:t}=(0,n.useContext)(m.F),[,s]=(0,d.fp)(f.AG.editorSetting),[y]=(0,d.fp)(f.AG.user_base_info),S=(0,v.Zp)(),b=n.useRef(-1),[q,C]=(0,n.useState)([]);(0,n.useEffect)(()=>{const t=y?.user_data?.sql_preset_list;C(t?.length?[...t]:[j(e)])},[e,y?.user_data?.sql_preset_list]);const k=async()=>{const e=q.map((e,t)=>({...e,index:t})),s=await p.wm.post(_.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:e});s?.code===h.m.Success&&await t()},E=(e,t)=>{b.current=e;const n=q[e][t]??"";x.xK.set_value_temp(n),s({model:"sql"===t?"ace/mode/sql":"ace/mode/ini",open:!0,fileName:"",save:async e=>{q[b.current][t]=e,C([...q]),x.xK.set_value_temp(""),k()}})},N=[e("编号"),e("备注"),e("SQL代码"),e("env编辑"),e("操作")];return(0,g.jsxs)("div",{children:[(0,g.jsx)(o.aZ,{position:"right",children:(0,g.jsx)(i.rA,{icon:"arrow_back",title:e("返回"),onClick:()=>S(-1)})}),(0,g.jsx)(l.jW,{isFull:!0,more:!0,children:(0,g.jsx)(l.NN,{children:(0,g.jsx)(l.xh,{children:(0,g.jsx)(l.fI,{children:(0,g.jsx)(l.VP,{widthPer:60,children:(0,g.jsx)(a.uF,{self_title:(0,g.jsx)("span",{className:"div-row",children:(0,g.jsx)("h2",{children:e("SQL 预设")})}),rightTopCom:(0,g.jsxs)("div",{className:"db-query-setting__toolbar",children:[(0,g.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>C([...q,{note:"",sql:"",env:w}])}),(0,g.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>k()})]}),children:(0,g.jsx)(c.X,{headers:N,rows:q.map((t,s)=>[(0,g.jsx)("div",{children:s+1}),(0,g.jsx)(u.Sm,{value:t.note,no_border:!0,placeholder:e("备注"),handleInputChange:e=>{t.note=e,C([...q])}}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"short_text",title:e("编辑SQL"),onClick:()=>E(s,"sql")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"settings",title:e("env编辑"),onClick:()=>E(s,"env")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>{q.splice(s,1),C([...q])}})})]),width:"8rem"})})})})})})})]})}},42562(e,t,s){s.d(t,{A:()=>l});var n=s(96540),r=s(85997),o=s(45907),i=s(74848);function l(e){const{name:t,dirty:s,loading:l,error:c,saving:a,on_save:u,on_close:d,children:f,extra:p}=e,_=(0,o.y)(),h=(0,n.useRef)(d),m=(0,n.useRef)(u),x=(0,n.useRef)(s);h.current=d,m.current=u,x.current=s;const v=()=>{x.current?_({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>h.current?.()}):h.current?.()};return(0,n.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),m.current?.(!1)):"Escape"===e.key&&v()};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,i.jsxs)("div",{className:"office-editor",children:[(0,i.jsxs)("div",{className:"office-editor__topbar",children:[(0,i.jsxs)("div",{className:"office-editor__name",children:[t,s&&(0,i.jsx)("span",{className:"office-editor__dirty",title:"有未保存的修改"})]}),(0,i.jsxs)("div",{className:"office-editor__ops",children:[p,u&&s&&(0,i.jsx)(r.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>u()}),(0,i.jsx)(r.rA,{icon:"close",title:"关闭 (Esc)",onClick:v})]})]}),(0,i.jsxs)("div",{className:"office-editor__body",children:[!l&&c&&(0,i.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:c}),!l&&!c&&f]})]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6930],{39922(t,e,s){s.d(e,{EL:()=>L,Lu:()=>i,RK:()=>c,Xp:()=>C,ob:()=>k,qg:()=>f,wT:()=>F,yT:()=>P});const n=(t,e)=>[-1,...e,t.length].reduce(({xs:e,a:s},n)=>({xs:e?.concat([t.slice(s+1,n)])??[],a:n}),{}).xs,r=/\d/,i=/^epubcfi\((.*)\)$/,o=t=>t.replace(/[\^[\](),;=]/g,"^$&"),a=t=>i.test(t)?t:`epubcfi(${t})`,c=(h=(...t)=>t.join("!"),(...t)=>`epubcfi(${h(...t.map(t=>t.match(i)?.[1]??t))})`);var h;const l=(t,e)=>((t,e)=>t.map((t,s,n)=>e(t,s,n)?s:null).filter(t=>null!=t))(t,([t])=>t===e),d=t=>{const e=[];let s;for(const[n,r]of t){if("/"===n)e.push({index:r});else{const t=e[e.length-1];if(":"===n)t.offset=r;else if("~"===n)t.temporal=r;else if("@"===n)t.spatial=(t.spatial??[]).concat(r);else if(";s"===n)t.side=r;else if("["===n){if("/"!==s||!r){t.text=(t.text??[]).concat(r);continue}t.id=r}}s=n}return e},u=t=>n(t,l(t,"!")).map(d),f=t=>{const e=(t=>{const e=[];let s,n,i="";const o=t=>(e.push(t),s=null,i=""),a=t=>(i+=t,n=!1);for(const e of Array.from(t.trim()).concat(""))if("^"!==e||n){if("!"===s)o(["!"]);else if(","===s)o([","]);else if("/"===s||":"===s){if(r.test(e)){a(e);continue}o([s,parseInt(i)])}else if("~"===s){if(r.test(e)||"."===e){a(e);continue}o(["~",parseFloat(i)])}else if("@"===s){if(":"===e){o(["@",parseFloat(i)]),s="@";continue}if(r.test(e)||"."===e){a(e);continue}o(["@",parseFloat(i)])}else{if("["===s){";"!==e||n?","!==e||n?"]"!==e||n?a(e):o(["[",i]):(o(["[",i]),s="["):(o(["[",i]),s=";");continue}if(s?.startsWith(";")){"="!==e||n?";"!==e||n?"]"!==e||n?a(e):o([s,i]):(o([s,i]),s=";"):(s=`;${i}`,i="");continue}}"/"!==e&&":"!==e&&"~"!==e&&"@"!==e&&"["!==e&&"!"!==e&&","!==e||(s=e)}else n=!0;return e})((s=t,s.match(i)?.[1]??s));var s;const o=l(e,",");if(!o.length)return u(e);const[a,c,h]=n(e,o).map(u);return{parent:a,start:c,end:h}},g=({index:t,id:e,offset:s,temporal:n,spatial:r,text:i,side:a})=>{const c=a?`;s=${a}`:"";return`/${t}`+(e?`[${o(e)}${c}]`:"")+(null!=s&&t%2?`:${s}`:"")+(n?`~${n}`:"")+(r?`@${r.join(":")}`:"")+(i||!e&&a?"["+(i?.map(o)?.join(",")??"")+c+"]":"")},p=t=>t.parent?[t.parent,t.start,t.end].map(p).join(","):t.map(t=>t.map(g).join("")).join("!"),m=t=>a(p(t)),w=(t,e)=>{return"string"==typeof t?m(w(f(t),e)):t.parent?(s=t.parent,n=t[e?"end":"start"],s.slice(0,-1).concat([s[s.length-1].concat(n[0])]).concat(n.slice(1))):t;var s,n},y=(t,e)=>{"string"==typeof t&&(t=f(t)),"string"==typeof e&&(e=f(e)),t=w(t),e=w(e,!0);const s=t[t.length-1],n=e[e.length-1],r=[],i=[],o=[];let a=!0;const c=Math.max(s.length,n.length);for(let t=0;t<c;t++){const e=s[t],c=n[t];a&&=e?.index===c?.index&&!e?.offset&&!c?.offset,a?r.push(e):(e&&i.push(e),c&&o.push(c))}const h=t.slice(0,-1).concat([r]);return m({parent:h,start:[i],end:[o]})},b=({nodeType:t})=>3===t||4===t,v=({nodeType:t})=>1===t,x=(t,e)=>{const s=Array.from(t.childNodes).filter(t=>b(t)||v(t));return e?s.map(t=>{const s=e(t);return s===NodeFilter.FILTER_REJECT?null:s===NodeFilter.FILTER_SKIP?x(t,e):t}).flat().filter(t=>t):s},A=(t,e)=>{const s=x(t,e).reduce((t,e)=>{let s=t[t.length-1];return s?b(e)?Array.isArray(s)?s.push(e):b(s)?t[t.length-1]=[s,e]:t.push(e):v(s)?t.push(null,e):t.push(e):t.push(e),t},[]);return v(s[0])&&s.unshift("first"),v(s[s.length-1])&&s.push("last"),s.unshift("before"),s.push("after"),s},E=(t,e,s)=>{const{id:n}=e[e.length-1];if(n){const e=t.ownerDocument.getElementById(n);if(e)return{node:e,offset:0}}for(const{index:n}of e){const e=t?A(t,s)[n]:null;if("first"===e)return{node:t.firstChild??t};if("last"===e)return{node:t.lastChild??t};if("before"===e)return{node:t,before:!0};if("after"===e)return{node:t,after:!0};t=e}const{offset:r}=e[e.length-1];if(!Array.isArray(t))return{node:t,offset:r};let i=0;for(const e of t){const{length:t}=e.nodeValue;if(i+t>=r)return{node:e,offset:r-i};i+=t}},T=(t,e,s)=>{const{parentNode:n,id:r}=t,i=A(n,s),o=i.findIndex(e=>Array.isArray(e)?e.some(e=>e===t):e===t),a=i[o];if(Array.isArray(a)){let s=0;for(const n of a){if(n===t){s+=e;break}s+=n.nodeValue.length}e=s}const c={id:r,index:o,offset:e};return(n!==t.ownerDocument.documentElement?T(n,null,s).concat(c):[c]).filter(t=>-1!==t.index)},P=(t,e)=>{const{startContainer:s,startOffset:n,endContainer:r,endOffset:i}=t,o=T(s,n,e);if(t.collapsed)return m([o]);const a=T(r,i,e);return y([o],[a])},C=(t,e,s)=>{const n=w(e),r=w(e,!0),i=t.documentElement,o=E(i,n[0],s),a=E(i,r[0],s),c=t.createRange();return o.before?c.setStartBefore(o.node):o.after?c.setStartAfter(o.node):c.setStart(o.node,o.offset),a.before?c.setEndBefore(a.node):a.after?c.setEndAfter(a.node):c.setEnd(a.node,a.offset),c},k=t=>{const e=[],{parentNode:s}=t[0],n=T(s);for(const[r,i]of A(s).entries()){const s=t[e.length];i===s&&e.push(m([n.concat({id:s.id,index:r})]))}return e},F=(t,e)=>E(t.documentElement,w(e)).node,L={fromIndex:t=>a("/6/"+2*(t+1)),toIndex:t=>t?.at(-1).index/2-1}},86930(t,e,s){s.r(e),s.d(e,{NotFoundError:()=>y,ResponseError:()=>w,UnsupportedTypeError:()=>b,View:()=>E,makeBook:()=>v});var n=s(39922);const r=t=>t.map(t=>t.subitems?.length?[t,r(t.subitems)].flat():t).flat();class i{async init({toc:t,ids:e,splitHref:s,getFragment:n}){(t=>{let e=0;const s=t=>{if(t.id=e++,t.subitems)for(const e of t.subitems)s(e)};for(const e of t)s(e)})(t);const i=r(t),o=new Map;for(const[t,e]of i.entries()){const[n,r]=await s(e?.href)??[],a={fragment:r,item:e};o.has(n)?o.get(n).items.push(a):o.set(n,{prev:i[t-1],items:[a]})}const a=new Map;for(const[t,s]of e.entries())o.has(s)?a.set(s,o.get(s)):a.set(s,a.get(e[t-1]));this.ids=e,this.map=a,this.getFragment=n}getProgress(t,e){if(!this.ids)return;const s=this.ids[t],n=this.map.get(s);if(!n)return null;const{prev:r,items:i}=n;if(!i)return r;if(!e||1===i.length&&!i[0].fragment)return i[0].item;const o=e.startContainer.getRootNode();for(const[t,{fragment:s}]of i.entries()){const n=this.getFragment(o,s);if(n&&e.comparePoint(n,0)>0)return i[t-1]?.item??r}return i[i.length-1].item}}class o{constructor(t,e,s){this.sizes=t.map(t=>"no"!=t.linear&&t.size>0?t.size:0),this.sizePerLoc=e,this.sizePerTimeUnit=s,this.sizeTotal=this.sizes.reduce((t,e)=>t+e,0),this.sectionFractions=this.#t()}#t(){const{sizeTotal:t}=this,e=[0];let s=0;for(const n of this.sizes)e.push((s+=n)/t);return e}getProgress(t,e,s=0){const{sizes:n,sizePerLoc:r,sizePerTimeUnit:i,sizeTotal:o}=this,a=n[t]??0,c=n.slice(0,t).reduce((t,e)=>t+e,0)+e*a,h=c+s*a,l=o-c,d=(1-e)*a;return{fraction:h/o,section:{current:t,total:n.length},location:{current:Math.floor(c/r),next:Math.floor(h/r),total:Math.ceil(o/r)},time:{section:d/i,total:l/i}}}getSection(t){if(t<=0)return[0,0];if(t>=1)return[this.sizes.length-1,1];t+=Number.EPSILON;const{sizeTotal:e}=this;let s=this.sectionFractions.findIndex(e=>e>t)-1;if(s<0)return[0,0];for(;!this.sizes[s];)s++;return[s,(t-this.sectionFractions[s])/(this.sizes[s]/e)]}}const a=t=>document.createElementNS("http://www.w3.org/2000/svg",t);class c{#e=a("svg");#s=new Map;#n=null;constructor(t){this.#n=t,Object.assign(this.#e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none"})}get element(){return this.#e}get#r(){return/^((?!chrome|android).)*AppleWebKit/i.test(navigator.userAgent)&&!window.chrome&&window.getComputedStyle(this.#n.body).zoom||1}#i(t){const e=t.commonAncestorContainer,s=Array.from(e.querySelectorAll?.("p")||[]);if(0===s.length)return[t];const n=[];return s.forEach(e=>{const s=document.createRange();t.intersectsNode(e)&&(s.selectNodeContents(e),s.compareBoundaryPoints(Range.START_TO_START,t)<0&&s.setStart(t.startContainer,t.startOffset),s.compareBoundaryPoints(Range.END_TO_END,t)>0&&s.setEnd(t.endContainer,t.endOffset),n.push(s))}),n}add(t,e,s,n){this.#s.has(t)&&this.remove(t),"function"==typeof e&&(e=e(this.#e.getRootNode()));const r=this.#r;let i=[];this.#i(e).forEach(t=>{const e=Array.from(t.getClientRects()).map(t=>({left:t.left*r,top:t.top*r,right:t.right*r,bottom:t.bottom*r,width:t.width*r,height:t.height*r}));i=i.concat(e)});const o=s(i,n);this.#e.append(o),this.#s.set(t,{range:e,draw:s,options:n,element:o,rects:i})}remove(t){this.#s.has(t)&&(this.#e.removeChild(this.#s.get(t).element),this.#s.delete(t))}redraw(){for(const t of this.#s.values()){const{range:e,draw:s,options:n,element:r}=t;this.#e.removeChild(r);const i=this.#r;let o=[];this.#i(e).forEach(t=>{const e=Array.from(t.getClientRects()).map(t=>({left:t.left*i,top:t.top*i,right:t.right*i,bottom:t.bottom*i,width:t.width*i,height:t.height*i}));o=o.concat(e)});const a=s(o,n);this.#e.append(a),t.element=a,t.rects=o}}hitTest({x:t,y:e}){const s=Array.from(this.#s.entries());for(let n=s.length-1;n>=0;n--){const[r,i]=s[n];for(const{left:s,top:n,right:o,bottom:a}of i.rects)if(n<=e&&s<=t&&a>e&&o>t)return[r,i.range]}return[]}static underline(t,e={}){const{color:s="red",width:n=2,padding:r=0,writingMode:i}=e,o=a("g");if(o.setAttribute("fill",s),"vertical-rl"===i||"vertical-lr"===i)for(const{right:e,top:s,height:i}of t){const t=a("rect");t.setAttribute("x",e-n/2+r),t.setAttribute("y",s),t.setAttribute("height",i),t.setAttribute("width",n),o.append(t)}else for(const{left:e,bottom:s,width:i}of t){const t=a("rect");t.setAttribute("x",e),t.setAttribute("y",s-n/2+r),t.setAttribute("height",n),t.setAttribute("width",i),o.append(t)}return o}static strikethrough(t,e={}){const{color:s="red",width:n=2,writingMode:r}=e,i=a("g");if(i.setAttribute("fill",s),"vertical-rl"===r||"vertical-lr"===r)for(const{right:e,left:s,top:r,height:o}of t){const t=a("rect");t.setAttribute("x",(e+s)/2),t.setAttribute("y",r),t.setAttribute("height",o),t.setAttribute("width",n),i.append(t)}else for(const{left:e,top:s,bottom:r,width:o}of t){const t=a("rect");t.setAttribute("x",e),t.setAttribute("y",(s+r)/2),t.setAttribute("height",n),t.setAttribute("width",o),i.append(t)}return i}static squiggly(t,e={}){const{color:s="red",width:n=2,padding:r=0,writingMode:i}=e,o=a("g");o.setAttribute("fill","none"),o.setAttribute("stroke",s),o.setAttribute("stroke-width",n);const c=1.5*n;if("vertical-rl"===i||"vertical-lr"===i)for(const{right:e,top:s,height:i}of t){const t=a("path"),h=Math.round(i/c/1.5),l=i/h,d=Array.from({length:h},(t,e)=>`l${e%2?-c:c} ${l}`).join("");t.setAttribute("d",`M${e-n/2+r} ${s}${d}`),o.append(t)}else for(const{left:e,bottom:s,width:i}of t){const t=a("path"),h=Math.round(i/c/1.5),l=i/h,d=Array.from({length:h},(t,e)=>`l${l} ${e%2?c:-c}`).join("");t.setAttribute("d",`M${e} ${s+n/2+r}${d}`),o.append(t)}return o}static highlight(t,e={}){const{color:s="red",padding:n=0}=e,r=a("g");r.setAttribute("fill",s),r.style.opacity="var(--overlayer-highlight-opacity, .3)",r.style.mixBlendMode="var(--overlayer-highlight-blend-mode, normal)";for(const{left:e,top:s,height:i,width:o}of t){const t=a("rect");t.setAttribute("x",e-n),t.setAttribute("y",s-n),t.setAttribute("height",i+2*n),t.setAttribute("width",o+2*n),r.append(t)}return r}static outline(t,e={}){const{color:s="red",width:n=3,padding:r=0,radius:i=3}=e,o=a("g");o.setAttribute("fill","none"),o.setAttribute("stroke",s),o.setAttribute("stroke-width",n);for(const{left:e,top:s,height:n,width:c}of t){const t=a("rect");t.setAttribute("x",e-r),t.setAttribute("y",s-r),t.setAttribute("height",n+2*r),t.setAttribute("width",c+2*r),t.setAttribute("rx",i),o.append(t)}return o}static copyImage([t],e={}){const{src:s}=e,n=a("image"),{left:r,top:i,height:o,width:c}=t;return n.setAttribute("href",s),n.setAttribute("x",r),n.setAttribute("y",i),n.setAttribute("height",o),n.setAttribute("width",c),n}}const h=(t,e)=>{const s=[];for(let n=e.currentNode;n;n=e.nextNode()){const e=t.comparePoint(n,0);if(0===e)s.push(n);else if(e>0)break}return s},l=(t,e)=>{const s=[];for(let t=e.nextNode();t;t=e.nextNode())s.push(t);return s},d=NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_CDATA_SECTION,u=t=>{if(1===t.nodeType){const e=t.tagName.toLowerCase();return"script"===e||"style"===e?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}return NodeFilter.FILTER_ACCEPT},f=function*(t,e){const s=t.commonAncestorContainer??t.body??t,n=document.createTreeWalker(s,d,{acceptNode:u}),r=(t.commonAncestorContainer?h:l)(t,n),i=r.map(t=>t.nodeValue??""),o=(t,e,s,n)=>{const i=document.createRange();return i.setStart(r[t],e),i.setEnd(r[s],n),i};for(const t of e(i,o))yield t},g="foliate-search:",p=async t=>t.isFile?t:(await Promise.all(Array.from(await new Promise((e,s)=>t.createReader().readEntries(t=>e(t),t=>s(t))),p))).flat(),m=async t=>{const e=await p(t),s=await Promise.all(e.map(t=>new Promise((e,s)=>t.file(s=>e([s,t.fullPath]),t=>s(t))))),n=new Map(s.map(([e,s])=>[s.replace(t.fullPath+"/",""),e])),r=new TextDecoder;return{loadText:async t=>{return e=await(t=>n.get(t)?.arrayBuffer()??null)(t),e?r.decode(e):null;var e},loadBlob:t=>n.get(t),getSize:t=>n.get(t)?.size??0}};class w extends Error{}class y extends Error{}class b extends Error{}const v=async t=>{let e;if("string"==typeof t&&(t=await(async t=>{const e=await fetch(t);if(!e.ok)throw new w(`${e.status} ${e.statusText}`,{cause:e});return new File([await e.blob()],new URL(e.url).pathname)})(t)),t.isDirectory){const n=await m(t),{EPUB:r}=await s.e(9984).then(s.bind(s,89984));e=await new r(n).init()}else{if(!t.size)throw new y("File not found");if(await(async t=>{const e=new Uint8Array(await t.slice(0,4).arrayBuffer());return 80===e[0]&&75===e[1]&&3===e[2]&&4===e[3]})(t)){const n=await(async t=>{const{configure:e,ZipReader:n,BlobReader:r,TextWriter:i,BlobWriter:o}=await s.e(9724).then(s.bind(s,89724));e({useWebWorkers:!1});const a=new n(new r(t)),c=await a.getEntries(),h=new Map(c.map(t=>[t.filename,t])),l=t=>(e,...s)=>h.has(e)?t(h.get(e),...s):null;return{entries:c,loadText:l(t=>t.getData(new i)),loadBlob:l((t,e)=>t.getData(new o(e))),getSize:t=>h.get(t)?.uncompressedSize??0}})(t);if((({name:t,type:e})=>"application/vnd.comicbook+zip"===e||t.endsWith(".cbz"))(t)){const{makeComicBook:r}=await s.e(2539).then(s.bind(s,2539));e=r(n,t)}else if((({name:t,type:e})=>"application/x-zip-compressed-fb2"===e||t.endsWith(".fb2.zip")||t.endsWith(".fbz"))(t)){const{makeFB2:t}=await s.e(526).then(s.bind(s,10526)),{entries:r}=n,i=r.find(t=>t.filename.endsWith(".fb2")),o=await n.loadBlob((i??r[0]).filename);e=await t(o)}else{const{EPUB:t}=await s.e(9984).then(s.bind(s,89984));e=await new t(n).init()}}else{const{isMOBI:n,MOBI:r}=await s.e(6471).then(s.bind(s,96471));if(await n(t)){const n=await s.e(5599).then(s.bind(s,55599));e=await new r({unzlib:n.unzlibSync}).open(t)}else if((({name:t,type:e})=>"application/x-fictionbook+xml"===e||t.endsWith(".fb2"))(t)){const{makeFB2:n}=await s.e(526).then(s.bind(s,10526));e=await n(t)}}}if(!e)throw new b("File type not supported");return e};class x{#o;#a;#c;#h;constructor(t,e,s={}){this.#a=t,this.#c=e,this.#h=s,this.#h.hidden&&this.hide(),this.#a.addEventListener("mousemove",({screenX:t,screenY:s})=>{t===this.#h.x&&s===this.#h.y||(this.#h.x=t,this.#h.y=s,this.show(),this.#o&&clearTimeout(this.#o),e()&&(this.#o=setTimeout(this.hide.bind(this),1e3)))},!1)}cloneFor(t){return new x(t,this.#c,this.#h)}hide(){this.#a.style.cursor="none",this.#h.hidden=!0}show(){this.#a.style.removeProperty("cursor"),this.#h.hidden=!1}}class A extends EventTarget{#l=[];#d=-1;pushState(t){const e=this.#l[this.#d];e===t||e?.fraction&&e.fraction===t.fraction||(this.#l[++this.#d]=t,this.#l.length=this.#d+1,this.dispatchEvent(new Event("index-change")))}replaceState(t){const e=this.#d;this.#l[e]=t}back(){const t=this.#d;if(t<=0)return;const e={state:this.#l[t-1]};this.#d=t-1,this.dispatchEvent(new CustomEvent("popstate",{detail:e})),this.dispatchEvent(new Event("index-change"))}forward(){const t=this.#d;if(t>=this.#l.length-1)return;const e={state:this.#l[t+1]};this.#d=t+1,this.dispatchEvent(new CustomEvent("popstate",{detail:e})),this.dispatchEvent(new Event("index-change"))}get canGoBack(){return this.#d>0}get canGoForward(){return this.#d<this.#l.length-1}clear(){this.#l=[],this.#d=-1}}class E extends HTMLElement{#u=this.attachShadow({mode:"closed"});#f;#g;#p;#m=new Map;#w=new x(this,()=>this.hasAttribute("autohide-cursor"));isFixedLayout=!1;lastLocation;history=new A;constructor(){super(),this.history.addEventListener("popstate",({detail:t})=>{const e=this.resolveNavigation(t.state);this.renderer.goTo(e)})}async open(t){if(("string"==typeof t||"function"==typeof t.arrayBuffer||t.isDirectory)&&(t=await v(t)),this.book=t,this.language=(t=>{if(!t)return{};try{const e=Intl.getCanonicalLocales(t)[0],s=new Intl.Locale(e),n=["zh","ja","kr"].includes(s.language),r=(s.getTextInfo?.()??s.textInfo)?.direction;return{canonical:e,locale:s,isCJK:n,direction:r}}catch(t){return console.warn(t),{}}})(t.metadata?.language),t.splitTOCHref&&t.getTOCFragment){const e=t.sections.map(t=>t.id);this.#f=new o(t.sections,1500,1600);const s=t.splitTOCHref.bind(t),n=t.getTOCFragment.bind(t);this.#g=new i,await this.#g.init({toc:t.toc??[],ids:e,splitHref:s,getFragment:n}),this.#p=new i,await this.#p.init({toc:t.pageList??[],ids:e,splitHref:s,getFragment:n})}if(this.isFixedLayout="pre-paginated"===this.book.rendition?.layout,this.isFixedLayout?(await s.e(1793).then(s.bind(s,51793)),this.renderer=document.createElement("foliate-fxl")):(await s.e(8891).then(s.bind(s,58891)),this.renderer=document.createElement("foliate-paginator")),this.renderer.setAttribute("exportparts","head,foot,filter,container"),this.renderer.addEventListener("load",t=>this.#y(t.detail)),this.renderer.addEventListener("relocate",t=>this.#b(t.detail)),this.renderer.addEventListener("create-overlayer",t=>t.detail.attach(this.#v(t.detail))),this.renderer.open(t),this.#u.append(this.renderer),t.sections.some(t=>t.mediaOverlay)){const e=t.media.activeClass,s=t.media.playbackActiveClass;let n;this.mediaOverlay=t.getMediaOverlay(),this.mediaOverlay.addEventListener("highlight",t=>{const r=this.resolveNavigation(t.detail.text);this.renderer.goTo(r).then(()=>{const{doc:t}=this.renderer.getContents().find(t=>t.index=r.index),i=r.anchor(t);i.classList.add(e),s&&i.ownerDocument.documentElement.classList.add(s),n=new WeakRef(i)})}),this.mediaOverlay.addEventListener("unhighlight",()=>{const t=n?.deref();t&&(t.classList.remove(e),s&&t.ownerDocument.documentElement.classList.remove(s))})}}close(){this.renderer?.destroy(),this.renderer?.remove(),this.#f=null,this.#g=null,this.#p=null,this.#m=new Map,this.lastLocation=null,this.history.clear(),this.tts=null,this.mediaOverlay=null}goToTextStart(){return this.goTo(this.book.landmarks?.find(t=>t.type.includes("bodymatter")||t.type.includes("text"))?.href??this.book.sections.findIndex(t=>"no"!==t.linear))}async init({lastLocation:t,showTextStart:e}){const s=t?this.resolveNavigation(t):null;s?(await this.renderer.goTo(s),this.history.pushState(t)):e?await this.goToTextStart():(this.history.pushState(0),await this.next())}#x(t,e,s){return this.dispatchEvent(new CustomEvent(t,{detail:e,cancelable:s}))}#b({reason:t,range:e,index:s,fraction:n,size:r}){const i=this.#f?.getProgress(s,n,r)??{},o=this.#g?.getProgress(s,e),a=this.#p?.getProgress(s,e),c=this.getCFI(s,e);this.lastLocation={...i,tocItem:o,pageItem:a,cfi:c,range:e},"snap"!==t&&"page"!==t&&"scroll"!==t||this.history.replaceState(c),this.#x("relocate",this.lastLocation)}#y({doc:t,index:e}){t.documentElement.lang||=this.language.canonical??"",this.language.isCJK||(t.documentElement.dir||=this.language.direction??""),this.#A(t,e),this.#w.cloneFor(t.documentElement),this.#x("load",{doc:t,index:e})}#A(t,e){const{book:s}=this,n=s.sections[e];t.addEventListener("click",t=>{const e=t.target.closest("a[href]");if(!e)return;t.preventDefault();const r=e.getAttribute("href"),i=n?.resolveHref?.(r)??r;s?.isExternal?.(i)?Promise.resolve(this.#x("external-link",{a:e,href:i},!0)).then(t=>t?globalThis.open(i,"_blank"):null).catch(t=>console.error(t)):Promise.resolve(this.#x("link",{a:e,href:i},!0)).then(t=>t?this.goTo(i):null).catch(t=>console.error(t))})}async addAnnotation(t,e){const{value:s}=t;if(s.startsWith(g)){const t=s.replace(g,""),{index:n,anchor:r}=await this.resolveNavigation(t),i=this.#E(n);if(i){const{overlayer:t,doc:n}=i;if(e)return void t.remove(s);const o=n?r(n):r;t.add(s,o,c.outline)}return}const{index:n,anchor:r}=await this.resolveNavigation(s),i=this.#E(n);if(i){const{overlayer:n,doc:o}=i;if(n.remove(s),!e){const e=o?r(o):r,i=(t,r)=>n.add(s,e,t,r);this.#x("draw-annotation",{draw:i,annotation:t,doc:o,range:e})}}return{index:n,label:this.#g.getProgress(n)?.label??""}}deleteAnnotation(t){return this.addAnnotation(t,!0)}#E(t){return this.renderer.getContents().find(e=>e.index===t&&e.overlayer)}#v({doc:t,index:e}){const s=new c(t);t.addEventListener("click",t=>{const[n,r]=s.hitTest(t);n&&!n.startsWith(g)&&this.#x("show-annotation",{value:n,index:e,range:r})},!1);const n=this.#m.get(e);if(n)for(const t of n)this.addAnnotation(t);return this.#x("create-overlay",{index:e}),s}async showAnnotation(t){const{value:e}=t,s=await this.goTo(e);if(s){const{index:t,anchor:n}=s,{doc:r}=this.#E(t),i=n(r);this.#x("show-annotation",{value:e,index:t,range:i})}}getCFI(t,e){const s=this.book.sections[t].cfi??n.EL.fromIndex(t);return e?n.RK(s,n.yT(e)):s}resolveCFI(t){if(this.book.resolveCFI)return this.book.resolveCFI(t);{const e=n.qg(t);return{index:n.EL.toIndex((e.parent??e).shift()),anchor:t=>n.Xp(t,e)}}}resolveNavigation(t){try{if("number"==typeof t)return{index:t};if("number"==typeof t.fraction){const[e,s]=this.#f.getSection(t.fraction);return{index:e,anchor:s}}return n.Lu.test(t)?this.resolveCFI(t):this.book.resolveHref(t)}catch(e){console.error(e),console.error(`Could not resolve target ${t}`)}}async goTo(t){const e=this.resolveNavigation(t);try{return await this.renderer.goTo(e),this.history.pushState(t),e}catch(e){console.error(e),console.error(`Could not go to ${t}`)}}async goToFraction(t){const[e,s]=this.#f.getSection(t);await this.renderer.goTo({index:e,anchor:s}),this.history.pushState({fraction:t})}async select(t){try{const e=await this.resolveNavigation(t);await this.renderer.goTo({...e,select:!0}),this.history.pushState(t)}catch(e){console.error(e),console.error(`Could not go to ${t}`)}}deselect(){for(const{doc:t}of this.renderer.getContents())t.defaultView.getSelection().removeAllRanges()}getSectionFractions(){return(this.#f?.sectionFractions??[]).map(t=>t+Number.EPSILON)}getProgressOf(t,e){const s=this.#g?.getProgress(t,e),n=this.#p?.getProgress(t,e);return{tocItem:s,pageItem:n}}async getTOCItemOf(t){try{const{index:e,anchor:s}=await this.resolveNavigation(t),n=await this.book.sections[e].createDocument(),r=s(n),i=r instanceof Range,o=i?r:n.createRange();return i||o.selectNodeContents(r),this.#g.getProgress(e,o)}catch(e){console.error(e),console.error(`Could not get ${t}`)}}async prev(t){await this.renderer.prev(t)}async next(t){await this.renderer.next(t)}goLeft(){return"rtl"===this.book.dir?this.next():this.prev()}goRight(){return"rtl"===this.book.dir?this.prev():this.next()}async*#T(t,e,s){const n=await this.book.sections[s].createDocument();for(const{range:r,excerpt:i}of t(n,e))yield{cfi:this.getCFI(s,r),excerpt:i}}async*#P(t,e){const{sections:s}=this.book;for(const[n,{createDocument:r}]of s.entries()){if(!r)continue;const i=await r(),o=Array.from(t(i,e),({range:t,excerpt:e})=>({cfi:this.getCFI(n,t),excerpt:e})),a=(n+1)/s.length;yield{progress:a},o.length&&(yield{index:n,subitems:o})}}async*search(t){this.clearSearch();const{searchMatcher:e}=await s.e(1246).then(s.bind(s,61246)),{query:n,index:r}=t,i=e(f,{defaultLocale:this.language,...t}),o=null!=r?this.#T(i,n,r):this.#P(i,n),a=[];this.#m.set(r,a);for await(const t of o)if(t.subitems){const e=t.subitems.map(({cfi:t})=>({value:g+t}));this.#m.set(t.index,e);for(const t of e)this.addAnnotation(t);yield{label:this.#g.getProgress(t.index)?.label??"",subitems:t.subitems}}else{if(t.cfi){const e={value:g+t.cfi};a.push(e),this.addAnnotation(e)}yield t}yield"done"}clearSearch(){for(const t of this.#m.values())for(const e of t)this.deleteAnnotation(e);this.#m.clear()}async initTTS(t="word"){const e=this.renderer.getContents()[0].doc;if(this.tts&&this.tts.doc===e)return;const{TTS:n}=await s.e(7518).then(s.bind(s,27518));this.tts=new n(e,f,t=>this.renderer.scrollToAnchor(t,!0),t)}startMediaOverlay(){const{index:t}=this.renderer.getContents()[0];return this.mediaOverlay.start(t)}}customElements.define("foliate-view",E)}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6952],{6952(e,n,t){t.r(n),t.d(n,{default:()=>i});t(96540);var o=t(94280),r=t(74848);function i(e){return(0,r.jsx)("div",{className:"ebook-inline",children:(0,r.jsx)(o.A,{url:e.url,name:e.name})})}},94280(e,n,t){t.d(n,{A:()=>_});var o=t(96540),r=t(22022),i=t(57889),a=t(85997),s=t(85072),l=t.n(s),c=t(97825),d=t.n(c),p=t(77659),u=t.n(p),f=t(55056),m=t.n(f),b=t(10540),v=t.n(b),h=t(41113),k=t.n(h),g=t(41494),w={};w.styleTagTransform=k(),w.setAttributes=m(),w.insert=u().bind(null,"head"),w.domAPI=d(),w.insertStyleElement=v();l()(g.A,w);g.A&&g.A.locals&&g.A.locals;var y=t(74848);const x={epub:"application/epub+zip",mobi:"application/x-mobipocket-ebook",azw:"application/vnd.amazon.ebook",azw3:"application/vnd.amazon.ebook",fb2:"application/x-fictionbook+xml",fbz:"application/x-zip-compressed-fb2",cbz:"application/vnd.comicbook+zip"};function _(e){const{url:n,name:s}=e,{t:l}=(0,r.Bd)(),c=(0,o.useRef)(),d=(0,o.useRef)(null),[p,u]=(0,o.useState)(!0),[f,m]=(0,o.useState)(""),[b,v]=(0,o.useState)([]),[h,k]=(0,o.useState)(!1),[g,w]=(0,o.useState)(0),_=()=>{const e=c.current;if(e){c.current=void 0;try{e.close()}catch(e){}e.remove()}},A=e=>{let n=0;"ArrowLeft"===e.key||"ArrowUp"===e.key?n=-1:"ArrowRight"!==e.key&&"ArrowDown"!==e.key||(n=1),!n||e.ctrlKey||e.metaKey||e.altKey||(e.preventDefault(),e.stopPropagation(),n<0?c.current?.goLeft():c.current?.goRight())};return(0,o.useLayoutEffect)(()=>()=>{_()},[]),(0,o.useEffect)(()=>{if(!n)return;let e=!0;return _(),u(!0),m(""),v([]),w(0),(async()=>{await t.e(6930).then(t.bind(t,86930));const o=()=>{const e=customElements.get("foliate-paginator");if(!e||e.__render_patched)return;const n=e.prototype.render,t=new WeakMap;e.prototype.render=function(...e){const o=t.get(this);o&&cancelAnimationFrame(o),t.set(this,requestAnimationFrame(()=>{t.delete(this),n.apply(this,e)}))},e.__render_patched=!0};o();const r=await i.l.get_bytes_url(n),a=s??"book.epub",l=a.slice(a.lastIndexOf(".")+1).toLowerCase(),p=new File([r],a,{type:x[l]??"application/octet-stream"});if(!e||!d.current)return;const f=document.createElement("foliate-view");d.current.appendChild(f),c.current=f,f.addEventListener("relocate",e=>{const n=e.detail;"number"==typeof n?.fraction&&w(Math.round(100*n.fraction))}),f.addEventListener("load",e=>{const n=e.detail?.doc;n?.addEventListener("keydown",A,!0)}),await f.open(p),e&&(o(),await f.init({showTextStart:!0}),e&&(v(function(e){const n=[],t=(e,o)=>{for(const r of e)n.push({label:String(r.label??"").trim(),href:r.href,depth:o}),r.subitems?.length&&t(r.subitems,o+1)};return e?.length&&t(e,0),n}(f.book?.toc)),u(!1)))})().catch(n=>{e&&(m(String(n?.message??n)),u(!1))}),()=>{e=!1}},[n]),(0,o.useEffect)(()=>(document.addEventListener("keydown",A,!0),()=>{document.removeEventListener("keydown",A,!0)}),[]),(0,o.useEffect)(()=>{const e=e=>e.includes("ResizeObserver loop"),n=n=>{e(String(n.message??""))&&(n.stopImmediatePropagation(),n.preventDefault())},t=n=>{e(String(n.reason?.message??n.reason??""))&&(n.stopImmediatePropagation(),n.preventDefault())};return window.addEventListener("error",n,!0),window.addEventListener("unhandledrejection",t,!0),()=>{window.removeEventListener("error",n,!0),window.removeEventListener("unhandledrejection",t,!0)}},[]),(0,y.jsxs)("div",{className:"ebook-body",children:[(0,y.jsxs)("div",{className:"ebook-bar",children:[e.extra_left,(0,y.jsx)(a.rA,{icon:"toc",title:l("目录"),onClick:()=>k(!h)}),(0,y.jsx)(a.rA,{icon:"chevron_left",title:l("上一页"),onClick:()=>c.current?.goLeft()}),(0,y.jsxs)("span",{className:"ebook-progress",children:[g,"%"]}),(0,y.jsx)(a.rA,{icon:"chevron_right",title:l("下一页"),onClick:()=>c.current?.goRight()})]}),(0,y.jsx)("div",{className:"ebook-view",ref:d}),p&&(0,y.jsx)("div",{className:"ebook-loading",children:l("加载中")}),f&&(0,y.jsx)("div",{className:"ebook-loading",children:f}),h&&(0,y.jsx)("div",{className:"ebook-toc",children:b.map((e,n)=>(0,y.jsx)("div",{className:"ebook-toc__item",style:{paddingLeft:.5+.9*e.depth+"rem"},onClick:()=>{c.current?.goTo(e.href),k(!1)},children:e.label},n))})]})}},41494(e,n,t){t.d(n,{A:()=>s});var o=t(31601),r=t.n(o),i=t(76314),a=t.n(i)()(r());a.push([e.id,"/* 电子书阅读器 */\n\n.ebook-body {\n /* 父级 .office-editor__body 是 block 布局,flex:1 不生效,必须给确定高度 */\n height: 100%;\n display: flex;\n position: relative;\n background: var(--background);\n}\n\n/* 操作条:浮在阅读区上方,不参与水位计算 */\n.ebook-bar {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: .2rem;\n padding: .2rem .5rem;\n}\n\n.ebook-view {\n flex: 1;\n min-width: 0;\n height: 100%;\n display: flex;\n /* foliate-view 是自定义元素,给了类名才拿得到尺寸 */\n overflow: hidden;\n}\n\n.ebook-view foliate-view {\n display: block;\n width: 100%;\n height: 100%;\n flex: 1;\n /* layout 隔离:内部重排不外溢,避免 foliate 在 ResizeObserver 回调里\n 重排导致容器尺寸变化再触发通知,形成 loop 告警 */\n contain: layout;\n}\n\n.ebook-progress {\n font-size: .8em;\n color: var(--textSecondary);\n min-width: 2.6rem;\n text-align: center;\n}\n\n/* 加载遮罩:盖在阅读区上,不参与布局,避免遮住 foliate-view 导致 open() 拿不到尺寸 */\n.ebook-loading {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--textSecondary);\n background: var(--background);\n}\n\n.ebook-toc {\n width: 16rem;\n flex-shrink: 0;\n overflow-y: auto;\n border-left: 1px solid var(--divider);\n background: var(--surfacePrimary);\n padding: .5rem 0;\n}\n\n.ebook-toc__item {\n padding: .35rem .5rem;\n font-size: .85em;\n cursor: pointer;\n color: var(--textPrimary);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ebook-toc__item:hover {\n background: var(--hover);\n}\n",""]);const s=a}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7518],{27518(t,e,n){n.d(e,{TTS:()=>u});const r="http://www.w3.org/XML/1998/namespace",i="http://www.w3.org/2001/10/synthesis",s=new Set(["article","aside","audio","blockquote","caption","details","dialog","div","dl","dt","dd","figure","footer","form","figcaption","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","math","nav","ol","p","pre","section","tr"]),a=t=>{const e=t.lang||t?.getAttributeNS?.(r,"lang");return e||(t.parentElement?a(t.parentElement):null)},o=t=>{const e=t?.getAttributeNS?.(r,"lang");return e||(t.parentElement?o(t.parentElement):null)},l=(t,e,n)=>{const s=a(t.commonAncestorContainer),l=o(t.commonAncestorContainer),h=((t="en",e="word")=>{const n=new Intl.Segmenter(t,{granularity:e}),r="word"===e;return function*(t,e){const i=t.join("").replace(/\r\n/g," ").replace(/\r/g," ").replace(/\n/g," ");let s=0,a=-1,o=0;const l=Array.from(n.segment(i)),h=[];for(let t=0;t<l.length;t++){const e=l[t],n=l[t+1],r=e.segment.trim(),i=n?.segment?.trim(),s=/(?:^|\s)([A-Z][a-z]{1,5})\.$/.test(r),a=/^[A-Z]/.test(i||"");if(s&&a){const r={index:e.index,segment:e.segment+(n?.segment||""),isWordLike:!0};h.push(r),t++}else h.push(e)}for(const{index:n,segment:l,isWordLike:c}of h){if(r&&!c)continue;for(;o<=n;)o+=t[++a].length;const h=a,u=n-(o-t[a].length),d=n+l.length-1;if(d<i.length)for(;o<=d;)o+=t[++a].length;const g=a,m=d-(o-t[a].length)+1;yield[(s++).toString(),e(h,u,g,m)]}}})(s,n),c=t.cloneContents(),u=[...e(t,h)],d=[...e(c,h)];for(const[t,e]of d){const n=document.createElement("foliate-mark");n.dataset.name=t,e.insertNode(n)}const g=((t,e)=>{const n=document.implementation.createDocument(i,"speak"),{lang:s}=e;s&&n.documentElement.setAttributeNS(r,"lang",s);const a=(t,e,s)=>{if(!t)return;if(3===t.nodeType)return n.createTextNode(t.textContent);if(4===t.nodeType)return n.createCDATASection(t.textContent);if(1!==t.nodeType)return;let o;const l=t.nodeName.toLowerCase();"foliate-mark"===l?(o=n.createElementNS(i,"mark"),o.setAttribute("name",t.dataset.name)):"br"===l?o=n.createElementNS(i,"break"):"em"!==l&&"strong"!==l||(o=n.createElementNS(i,"emphasis"));const h=t.lang||t.getAttributeNS(r,"lang");h&&(o||(o=n.createElementNS(i,"lang")),o.setAttributeNS(r,"lang",h));const c=t.getAttributeNS(i,"alphabet")||s;if(!o){const e=t.getAttributeNS(i,"ph");e&&(o=n.createElementNS(i,"phoneme"),c&&o.setAttribute("alphabet",c),o.setAttribute("ph",e))}o||(o=e);let u=t.firstChild;for(;u;){const t=a(u,o,c);t&&o!==t&&o.append(t),u=u.nextSibling}return o};return a(t.firstChild,n.documentElement,e.alphabet),n})(c,{lang:s,alphabet:l});return{entries:u,ssml:g}},h=t=>!t.toString().trim();class c{#t=[];#e;#n=-1;#r;constructor(t,e=t=>t){this.#e=t,this.#r=e}current(){if(this.#t[this.#n])return this.#r(this.#t[this.#n])}first(){if(this.#t[0])return this.#n=0,this.#r(this.#t[0])}prev(){const t=this.#n-1;if(this.#t[t])return this.#n=t,this.#r(this.#t[t])}next(){const t=this.#n+1;if(this.#t[t])return this.#n=t,this.#r(this.#t[t]);for(;;){const{done:e,value:n}=this.#e.next();if(e)break;if(this.#t.push(n),this.#t[t])return this.#n=t,this.#r(this.#t[t])}}find(t){const e=this.#t.findIndex(e=>t(e));if(e>-1)return this.#n=e,this.#r(this.#t[e]);for(;;){const{done:e,value:n}=this.#e.next();if(e)break;if(this.#t.push(n),t(n))return this.#n=this.#t.length-1,this.#r(n)}}}class u{#i;#s;#a;#o=new XMLSerializer;constructor(t,e,n,r){this.doc=t,this.highlight=n,this.#i=new c(function*(t){let e;const n=t.createTreeWalker(t.body,NodeFilter.SHOW_ELEMENT);for(let r=n.nextNode();r;r=n.nextNode()){const n=r.tagName.toLowerCase();s.has(n)&&(e&&(e.setEndBefore(r),h(e)||(yield e)),e=t.createRange(),e.setStart(r,0))}e||(e=t.createRange(),e.setStart(t.body.firstChild??t.body,0)),e.setEndAfter(t.body.lastChild??t.body),h(e)||(yield e)}(t),t=>{const{entries:n,ssml:i}=l(t,e,r);return this.#s=new Map(n),[i,t]})}#l(t,e){return e?t.querySelector(`mark[name="${CSS.escape(e)}"`):null}#h(t,e){if(!t)return;if(!e)return this.#o.serializeToString(t);const n=document.implementation.createDocument(i,"speak");n.documentElement.replaceWith(n.importNode(t.documentElement,!0));let r=e(n)?.previousSibling;for(;r;){const t=r.previousSibling??r.parentNode?.previousSibling;r.parentNode.removeChild(r),r=t}return this.#o.serializeToString(n)}start(){this.#a=null;const[t]=this.#i.first()??[];return t?this.#h(t,t=>this.#l(t,this.#a)):this.next()}resume(){const[t]=this.#i.current()??[];return t?this.#h(t,t=>this.#l(t,this.#a)):this.next()}prev(t){this.#a=null;const[e,n]=this.#i.prev()??[];return t&&n&&this.highlight(n.cloneRange()),this.#h(e)}next(t){this.#a=null;const[e,n]=this.#i.next()??[];return t&&n&&this.highlight(n.cloneRange()),this.#h(e)}from(t){this.#a=null;const[e]=this.#i.find(e=>t.compareBoundaryPoints(Range.END_TO_START,e)<=0);let n;for(const[e,r]of this.#s.entries())if(t.compareBoundaryPoints(Range.START_TO_START,r)<=0){n=e;break}return this.#h(e,t=>this.#l(t,n))}setMark(t){const e=this.#s.get(t);e&&(this.#a=t,this.highlight(e.cloneRange()))}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7576],{92188(e,a,i){i.d(a,{v:()=>n});var s=i(96540),l=i(74848);function n(e){const a=(0,s.useRef)(null),i=(0,s.useRef)(null);return(0,l.jsx)("div",{className:"image-ex-container",ref:a,style:{height:"100%"},children:(0,l.jsx)("img",{className:"image-ex-img image-ex-img-center",ref:i,src:e.path,alt:""})})}},97576(e,a,i){i.r(a),i.d(a,{default:()=>n});i(96540);var s=i(92188),l=i(74848);function n(e){return(0,l.jsx)("div",{className:"image-inline",children:(0,l.jsx)(s.v,{path:e.url})})}}}]);