filecat 7.31.0 → 7.32.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.
Files changed (42) hide show
  1. package/README.md +21 -18
  2. package/build/dist/{1075.ac72fe455fb6105f445c.js → 1075.edeec2fde4f576b4b774.js} +1 -1
  3. package/build/dist/1142.48287fd3666c35215a0c.js +1 -0
  4. package/build/dist/1448.ec0a69fe6ffca6c8df19.js +1 -0
  5. package/build/dist/1922.87a099397741d80df6ad.js +2 -0
  6. package/build/dist/2091.8324e03dcf28985539eb.js +1 -0
  7. package/build/dist/2136.20ea58a65c7fb22d5e43.js +1 -0
  8. package/build/dist/3187.67ad7348b6b7231e657d.js +1 -0
  9. package/build/dist/{3355.fde87101c5a125b8b35f.js → 3355.80b3ed1fdc66b35bd95a.js} +1 -1
  10. package/build/dist/4350.799e1d3b7382a15d295b.js +1 -0
  11. package/build/dist/{4598.0a8c8a04d718951d6692.js → 4598.4d016ea700f650cd1023.js} +1 -1
  12. package/build/dist/{47.1990e4d7ad6e60650aa0.js → 47.8c46e919a7977a77bc14.js} +1 -1
  13. package/build/dist/{6097.9ec647296d88d8025198.js → 6097.da228e297f45f3ec882d.js} +1 -1
  14. package/build/dist/610.9b08d7248340d26dead2.js +1 -0
  15. package/build/dist/6439.f3ddea3c0ef57dcbf23c.js +1 -0
  16. package/build/dist/7212.a825bc171875985e1aab.js +1 -0
  17. package/build/dist/{7678.7ad7da19e968caed935a.js → 7678.926d8c2225731a655537.js} +1 -1
  18. package/build/dist/7759.14e1e0dbbcfc86f3e4f1.js +1 -0
  19. package/build/dist/914.bb6f2b6d8ca806f9366a.js +1 -0
  20. package/build/dist/{9260.da294480ffc3c674bde0.js → 9260.7fbe354ea4e6bee93817.js} +1 -1
  21. package/build/dist/9290.6fd29c7dd03124235217.js +1 -0
  22. package/build/dist/9345.9342b70ddc66397cafce.js +1 -0
  23. package/build/dist/9546.fde8cbe4ebe2dafb6c27.js +1 -0
  24. package/build/dist/{9765.7f8eaa343038f1f21810.js → 9765.7f02ad22213339511811.js} +1 -1
  25. package/build/dist/9861.f266cc5eabb83fc5fa4b.js +1 -0
  26. package/build/dist/index.html +1 -1
  27. package/build/dist/main.b0bcf1b153b849530789.js +2 -0
  28. package/build/main.js +1 -1
  29. package/package.json +6 -1
  30. package/build/dist/1142.7969be5cf5634815b7de.js +0 -1
  31. package/build/dist/1448.2340fca4e068db687c5c.js +0 -1
  32. package/build/dist/1922.c114fe6ee22d708a2a57.js +0 -2
  33. package/build/dist/2136.d12515bfa6c2e0e47520.js +0 -1
  34. package/build/dist/4350.c743128b55202fecc4d7.js +0 -1
  35. package/build/dist/621.965609c72555c936154d.js +0 -1
  36. package/build/dist/6439.472fe94a045edf3755e3.js +0 -1
  37. package/build/dist/7759.0860534bbc24ba31f42c.js +0 -1
  38. package/build/dist/9345.1dbe1ec2d934dc5ca747.js +0 -1
  39. package/build/dist/9546.827d973d735209b0b43e.js +0 -1
  40. package/build/dist/main.20a6043a65debdfa5733.js +0 -2
  41. /package/build/dist/{1922.c114fe6ee22d708a2a57.js.LICENSE.txt → 1922.87a099397741d80df6ad.js.LICENSE.txt} +0 -0
  42. /package/build/dist/{main.20a6043a65debdfa5733.js.LICENSE.txt → main.b0bcf1b153b849530789.js.LICENSE.txt} +0 -0
package/README.md CHANGED
@@ -49,24 +49,27 @@ FileCat是采用[filebrowser](https://github.com/filebrowser/filebrowser)的ui
49
49
 
50
50
  ## 功能特性
51
51
 
52
- | 类别 | 功能 |
53
- |------|---------------------------------------------------------------|
54
- | 文件管理 | 浏览、上传、下载、编辑、在线预览(图片、视频、Markdown、绘图等) |
55
- | 网盘与协议挂载 | 将百度网盘、SSH(SFTP)、S3、WebDAV 、SMB 挂载为本地目录,与本地文件使用同一套操作 |
56
- | 文件服务 | 反向把本地目录以 SMB、WebDAV、SFTP 协议对外提供,可被 Windows 资源管理器、各类客户端直接访问 |
57
- | Markdown 所见即所得 | 类 Typora 的 Markdown 编辑体验,所见即所得 |
58
- | AI Agent | 集成大语言模型,智能辅助运维和文件处理(需自行配置 API),支持接入 QQ, 企业微信 ,飞书 ,钉钉 第三方平台机器人 |
59
- | 内网穿透 | 将内网暴露到公网,或者多个内网之间互相通信 ,基于此功能可以实现各个客户端无缝的文件操作体验,像CI/CD这样的需求,就可以在多个机器上部署一个成为客户端,进跨机器的CI/CD自动化构建 |
60
- | SSH 终端 | 浏览器内置 Web 终端,随时连接服务器 |
61
- | Windows 远程桌面 | 浏览器中直接操作远程 Windows 桌面(RDP) |
62
- | 系统信息看板 | 实时 CPU、内存、磁盘、网络等系统监控 |
63
- | CI/CD 工作流 | 支持自定义命令流水线,实现持续集成与部署 |
64
- | 超大日志查看 | 任意大小的文本日志文件秒开,高效定位问题 |
65
- | 深度搜索 | 递归搜索文件名或文件内容,支持正则、忽略大小写与排除过滤;点击搜索框左侧放大镜图标打开 |
66
- | Excalidraw 绘图 | 内置白板绘图工具 |
67
- | 多用户管理 | 完善的权限体系 |
68
- | 可分享链接 | 生成文件分享链接,方便他人下载 |
69
- | 多路径挂载 | 支持挂载多个文件系统路径 |
52
+ | 类别 | 功能 |
53
+ |------|------|
54
+ | 文件管理 | 浏览、上传、下载、重命名、移动、复制、压缩解压,支持拖拽上传与分页滚动加载 |
55
+ | 文件预览 | 图片、视频、音频、PDF、Office 文档、Markdown、代码、日志等格式在线预览 |
56
+ | Office 编辑器 | 在线编辑 Word(docx)、Excel(xlsx)、PowerPoint(pptx),无需本地安装 Office |
57
+ | Markdown 所见即所得 | 类 Typora 的实时预览编辑,内置 7 套主题,支持 Mermaid / SVG 绘图与 KaTeX 公式 |
58
+ | 代码编辑器 | 内置 Ace 编辑器,支持语法高亮、多语言识别与 Studio 分栏代码模式 |
59
+ | 超大日志查看 | 任意大小的日志文件秒开,支持虚拟滚动、实时追踪与关键字高亮 |
60
+ | 深度搜索 | 递归搜索文件名或文件内容,支持正则、忽略大小写与排除过滤,点击搜索框左侧放大镜打开 |
61
+ | 网盘与协议挂载 | 将 百度网盘 / SSH(SFTP) / S3 / WebDAV / SMB 挂载为本地目录,与本地文件使用同一套操作 |
62
+ | 文件服务 | 反向把本地目录通过 SMB / WebDAV / SFTP 对外提供,可被 Windows 资源管理器等标准客户端直接访问 |
63
+ | 内网穿透 | 将内网服务暴露到公网,或多个内网之间互相通信;多机部署后可实现跨机器的文件同步与 CI/CD 自动化 |
64
+ | SSH 终端 | 浏览器内置 Web 终端,随时连接服务器,支持挂载的 SSH 主机直连 |
65
+ | Windows 远程桌面 | 浏览器中直接操作远程 Windows 桌面(RDP) |
66
+ | CI/CD 工作流 | 支持自定义命令流水线(.workflow.yml / .act),实现持续集成与部署 |
67
+ | 系统管理 | 系统信息看板(CPU / 内存 / 磁盘 / 网络)、进程管理、systemd 服务、防火墙(ufw / nftables)、Docker 配置 |
68
+ | Git 管理 | 内置 Git 客户端,支持变更暂存提交、提交历史树形图、分支与远程分支管理、Diff 对比、Blame、Stash、Tag |
69
+ | AI Agent | 集成大语言模型智能辅助运维与文件处理(需自行配置 API),支持接入 QQ / 企业微信 / 飞书 / 钉钉 机器人 |
70
+ | Excalidraw 绘图 | 内置白板绘图工具,可直接编辑 .draw 文件 |
71
+ | 多用户管理 | 完善的权限体系,支持角色、用户级权限配置与目录访问限制 |
72
+ | 可分享链接 | 生成文件或目录的分享链接,可设置密码与有效期 |
70
73
 
71
74
  ---
72
75
 
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1075,4877],{69918(t,e,n){n.d(e,{Ce:()=>i,FG:()=>r.FG,fy:()=>c,gC:()=>a});var r=n(18840),o=n(14284),s=n(53459);async function a(){try{const t=await o.XO.get("md_editor_setting/get");return{...r.FG,...t?.data??{}}}catch(t){return{...r.FG}}}async function c(t){const e=await o.XO.post("md_editor_setting/save",t);return e?.code!==s.m.Success?null:{...r.FG,...e.data??t}}function i(t,e){t&&(t.style.setProperty("--md-editor-max-width",e.content_max_width),t.style.setProperty("--md-editor-padding",e.content_padding),t.style.setProperty("--md-editor-font-size",e.font_size),t.style.setProperty("--md-editor-line-height",e.line_height))}},64877(t,e,n){n.r(e),n.d(e,{default:()=>a});var r=n(96540),o=n(22022),s=n(74848);function a(t){const{t:e}=(0,o.Bd)(),[n,a]=(0,r.useState)(new Set),c=(0,r.useMemo)(()=>function(t){const e=[],n=[];for(const r of t){const t={...r,children:[]};for(;n.length>0&&n[n.length-1].level>=t.level;)n.pop();0===n.length?e.push(t):n[n.length-1].children.push(t),n.push(t)}return e}(t.items),[t.items]),i=(r,o)=>r.map(r=>{const c=r.children.length>0,l=n.has(r.pos),d=r.pos===t.active_pos;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:`md-outline-item md-outline-item--h${r.level}${d?" md-outline-item--active":""}`,style:{paddingLeft:.4+.75*o+"em"},title:r.text,onClick:()=>t.on_click(r),children:[(0,s.jsx)("i",{className:"material-icons md-outline-arrow"+(c?"":" md-outline-arrow--empty"),onClick:c?t=>{return e=r.pos,t.stopPropagation(),void a(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});var e}:void 0,children:c?l?"arrow_right":"arrow_drop_down":""}),(0,s.jsx)("span",{className:"md-outline-text",children:r.text||e("未命名标题")})]}),c&&!l&&i(r.children,o+1)]},r.pos)});return 0===t.items.length?(0,s.jsx)("div",{className:"md-outline md-outline--empty",children:(0,s.jsx)("div",{className:"md-outline-tip",children:e("no_head")})}):(0,s.jsx)("div",{className:"md-outline",children:(0,s.jsx)("div",{className:"md-outline-list",children:i(c,0)})})}},76118(t,e,n){n.d(e,{A:()=>mt});var r=n(96540),o=n(22022),s=n(34843),a=n(82893),c=n(42845),i=n(1575),l=n(58903),d=n(89781),u=n(61396),h=n(46762),m=n(73337),p=n(89552),f=n(86059),g=n(5091),_=n(23802),b=n(41105),k=n(99724);const y=new _.A({html:!0,linkify:!0,breaks:!1,typographer:!1});function v(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}y.renderer.rules.html_block=(t,e)=>`<div data-html-block="${(0,b.pC)(t[e].content)}"></div>`,y.renderer.rules.html_inline=(t,e)=>`<span data-html-inline="${(0,b.pC)(t[e].content)}"></span>`,y.renderer.rules.fence=(t,e)=>{const n=t[e],r=n.info?n.info.trim().split(/\s+/)[0]:"",o=n.content.replace(/\n$/,""),s=y.utils.escapeHtml(o),a=r?` class="language-${v(r)}"`:"";return`<pre${r?` data-language="${v(r)}"`:""}><code${a}>${s}</code></pre>\n`},y.inline.ruler.before("escape","math_inline",function(t,e){const n=t.pos,r=t.src,o=[{open:"\\(",close:"\\)"},{open:"$",close:"$"}];if(r.startsWith("$$",n))return!1;for(const s of o){if(!r.startsWith(s.open,n))continue;const o=n+s.open.length,a=r.indexOf(s.close,o);if(a<0)continue;const c=r.slice(o,a);if(c.trim()){if("$"===s.open){const t=r[a+1];if(void 0!==t&&/\d/.test(t))continue}if(!e){const e=t.push("math_inline","span",0);e.content=c,e.markup=s.open,e.meta={raw:r.slice(n,a+s.close.length)}}return t.pos=a+s.close.length,!0}}return!1}),y.block.ruler.before("fence","math_block",function(t,e,n,r){const o=t.bMarks[e]+t.tShift[e],s=t.eMarks[e],a=t.src.slice(o,s).trim(),c=[{open:"\\[",close:"\\]"},{open:"$$",close:"$$"}];for(const s of c){if(!a.startsWith(s.open))continue;if(a.endsWith(s.close)&&a.length>s.open.length+s.close.length){if(r)return!0;const n=a.slice(s.open.length,a.length-s.close.length),o=t.push("math_block","div",0);return o.content=n,o.markup=s.open,o.meta={raw:a},o.map=[e,e+1],t.line=e+1,!0}const c=a.slice(s.open.length);for(let a=e+1;a<n;a++){const n=t.bMarks[a]+t.tShift[a],i=t.eMarks[a],l=t.src.slice(n,i);if(!l.trimEnd().endsWith(s.close))continue;if(r)return!0;const d=[c,...t.getLines(e+1,a,t.tShift[e],!1).split("\n")].filter((t,e)=>!(0===e&&!t.trim())),u=l.trimEnd().slice(0,-s.close.length);d.push(u);const h=t.push("math_block","div",0);return h.content=d.join("\n").trim(),h.markup=s.open,h.map=[e,a+1],h.meta={raw:t.src.slice(o,t.eMarks[a]).trimEnd()},t.line=a+1,!0}}return!1},{alt:["paragraph","reference","blockquote","list"]}),y.renderer.rules.math_inline=(t,e)=>`<span data-math-inline="${(0,b.pC)(t[e].meta.raw)}"></span>`,y.renderer.rules.math_block=(t,e)=>`<div data-math-block="${(0,b.pC)(t[e].meta.raw)}"></div>`;const w=y.renderer.rules.fence;function $(t){const e=y.render(t??""),n=(new DOMParser).parseFromString(e,"text/html");return l.S4.fromSchema(g.Y).parse(n.body)}function M(t){let e="";return t.forEach(t=>{if(t.isText){let n=t.marks.some(t=>"code"===t.type.name)?t.text??"":function(t){return t.replace(/([\\`*_<>])/g,"\\$1")}(t.text??"");for(const e of t.marks)switch(e.type.name){case"code":n=`\`${t.text??""}\``;break;case"strong":n=`**${n}**`;break;case"em":n=`*${n}*`;break;case"strike":n=`~~${n}~~`;break;case"link":n=`[${n}](${e.attrs.href}${e.attrs.title?` "${e.attrs.title}"`:""})`}e+=n}else if("image"===t.type.name){const{src:n,alt:r,title:o}=t.attrs;e+=`![${r??""}](${n}${o?` "${o}"`:""})`}else"hard_break"===t.type.name?e+=" \n":"html_inline"===t.type.name?e+=t.attrs.value:"math_inline"===t.type.name&&(e+=t.attrs.raw)}),e}function x(t){const e=[];if(t.forEach(t=>{const n=[],r=[];t.forEach(t=>{var e;n.push((e=t.textContent,e.replace(/\|/g,"\\|").replace(/\n/g," ")).trim()),r.push("table_header"===t.type.name)}),e.push({cells:n,header_flags:r})}),0===e.length)return"";const n=Math.max(...e.map(t=>t.cells.length)),r=e[0].header_flags.some(t=>t),o=Array.from({length:n},(t,n)=>Math.max(3,...e.map(t=>A(t.cells[n]??"")))),s=t=>`| ${Array.from({length:n},(e,n)=>{return r=t[n]??"",s=o[n],r+" ".repeat(Math.max(0,s-A(r)));var r,s}).join(" | ")} |`,a=[];if(r){a.push(s(e[0].cells)),a.push(`| ${o.map(t=>"-".repeat(t)).join(" | ")} |`);for(let t=1;t<e.length;t++)a.push(s(e[t].cells))}else{a.push(s(new Array(n).fill(""))),a.push(`| ${o.map(t=>"-".repeat(t)).join(" | ")} |`);for(const t of e)a.push(s(t.cells))}return a.join("\n")}function A(t){let e=0;for(const n of t){const t=n.codePointAt(0)??0;e+=t>=4352&&t<=4447||t>=11904&&t<=42191||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510?2:1}return e}function E(t,e=""){switch(t.type.name){case"paragraph":{const n=M(t).split("\n");return n[0]+n.slice(1).map(t=>`\n${e}${t}`).join("")}case"heading":return`${e}${"#".repeat(t.attrs.level)} ${M(t)}`;case"blockquote":return O(t,"").split("\n").map(t=>`${e}> ${t}`).join("\n");case"code_block":{const n=t.attrs.language??"",r=t.textContent;let o=3;for(const t of r.match(/`+/g)??[])o=Math.max(o,t.length+1);const s="`".repeat(o),a=r.split("\n").map(t=>e+t).join("\n");return`${e}${s}${n}\n${a}\n${e}${s}`}case"horizontal_rule":return`${e}---`;case"html_block":return t.attrs.value.replace(/\n+$/,"").split("\n").map(t=>e+t).join("\n");case"math_block":return t.attrs.raw.replace(/\n+$/,"").split("\n").map(t=>e+t).join("\n");case"bullet_list":{const n=[];return t.forEach((t,r,o)=>{n.push(S(t,e,`${e}- `,`${e} `,o))}),n.join("\n")}case"ordered_list":{const n=[],r=t.attrs.order??1;return t.forEach((t,o,s)=>{n.push(S(t,e,`${e}${r+s}. `,`${e} `,s))}),n.join("\n")}case"table":return x(t).split("\n").map(t=>e+t).join("\n");default:return e+M(t)}}function S(t,e,n,r,o){const s=t.attrs.checked,a=null===s?"":s?"[x] ":"[ ] ",c=[];t.forEach(t=>{c.push(E(t,r))});const i=c.join("\n").split("\n");return n+a+i[0]+(i.length>1?"\n"+i.slice(1).join("\n"):"")}function O(t,e=""){const n=[];return t.forEach(t=>{n.push(E(t,e))}),n.join("\n\n")}function D(t){return O(t).trim()+"\n"}function C(t){const e=[];if(t.content.forEach(t=>e.push(t)),1===e.length&&"code_block"===e[0].type.name&&"markdown"===e[0].attrs.language)return e[0].textContent;const n=t.openStart??0,r=t.openEnd??0;return 1===e.length&&1===n&&1===r?N(t.content):O(t.content)}function N(t){const e=[];t.forEach(t=>{["ordered_list","bullet_list","list_item","blockquote"].includes(t.type.name)?e.push(N(t)):e.push(E(t,""))});const n=t.type&&("ordered_list"===t.type.name||"bullet_list"===t.type.name);return e.join(n?"\n":"\n\n")}y.renderer.rules.fence=(t,e,n,r,o)=>{const s=t[e],a=s.info.trim().toLowerCase();return(0,k.lG)(a)?`<div data-math-block="${(0,b.pC)(`$$\n${s.content.trim()}\n$$`)}"></div>`:w(t,e,n,r,o)},y.core.ruler.push("list_item_softbreak_to_hard",t=>{let e=0;for(const n of t.tokens)if("list_item_open"!==n.type)if("list_item_close"!==n.type){if(!(e<=0||"inline"!==n.type)&&n.children)for(const t of n.children)"softbreak"===t.type&&(t.type="hardbreak",t.tag="br")}else e--;else e++});n(64877);var L=n(19878);const z=new c.hs("md_source_highlight");function j(t,e,n){let r=e;for(const e of t){if("string"==typeof e){r+=e.length;continue}const t=r;Array.isArray(e.children)&&(r=j(e.children,r,n)),e.scope&&n.push({from:t,to:r,cls:`hljs-${e.scope}`})}return r}function T(t,e){const n=t.textContent;if(!n)return[];const r=t.attrs.language??"";if(!r||!L.A.getLanguage(r))return[];let o;try{o=L.A.highlight(n,{language:r,ignoreIllegals:!0})}catch{return[]}const s=[],a=o._emitter?.rootNode;a?.children&&j(a.children,0,s);const c=e+1,l=[];for(const t of s){const e=Math.min(t.from,n.length),r=Math.min(t.to,n.length);e>=r||l.push(i.NZ.inline(c+e,c+r,{class:t.cls}))}return l}function R(){return new c.k_({key:z,props:{decorations(t){const e=function(t){const e=[];return t.descendants((t,n)=>"code_block"!==t.type.name||(e.push(...T(t,n)),!1)),i.zF.create(t,e)}(t.doc);return e.find().length?e:null}}})}var V=n(89117),P=n(86063),G=n(89871);const I=new c.hs("md-graph"),q=new Map,F=new Map,W=new Map,H=new Map;function B(t,e){return`${t}\0${e}`}function K(t,e,n){return(r,o)=>{const s=B(r,o),a=t.get(s);if(a)return Promise.resolve(a);let c=e.get(s);return c||(c=n(r,o).then(n=>(t.set(s,n),e.delete(s),n)),e.set(s,c)),c}}const U=K(q,F,(t,e)=>(0,V.U6)(t,e)),J=K(W,H,(t,e)=>(0,P.Hn)(e));function X(t,e){const n=document.createElement("button");return n.className="md-graph__edit",n.type="button",n.textContent=G.Ay.t("clk_edt"),n.addEventListener("click",n=>{n.stopPropagation(),function(t,e){if(!t)return;const n=Math.min(e+1,t.state.doc.content.size);t.dispatch(t.state.tr.setSelection(c.U3.near(t.state.doc.resolve(n),1))),t.focus()}(t(),e)}),n}function Y(t,e){if(e.error)return t.className="md-graph__body",void(t.textContent=e.error);t.className="md-graph__body",t.innerHTML=e.svg}function Z(t,e,n,r){const o=document.createElement("div");o.className="md-graph",o.setAttribute("contenteditable","false");const s=document.createElement("div");s.className="md-graph__body",s.addEventListener("click",()=>{const n=q.get(B(e,t));n&&!n.error&&n.svg&&function(t){const e=document.createElement("div");e.className="md-graph-zoom";const n=document.createElement("div");let r;n.className="md-graph-zoom__body";const o=document.createElement("button");o.className="md-graph-zoom__close",o.type="button",o.title=G.Ay.t("取消"),o.innerHTML='<i class="material-icons">close</i>';const s=t=>{"Escape"===t.key&&a()};function a(){"function"==typeof r&&r(),document.removeEventListener("keydown",s),e.remove()}e.addEventListener("click",t=>{t.target===e&&a()}),o.addEventListener("click",a),document.addEventListener("keydown",s),e.append(n,o),document.body.appendChild(e),r=t(n)}(t=>{t.innerHTML=n.svg})}),o.append(s,X(r,n));const a=q.get(B(e,t));return a?(a.error&&o.classList.add("md-graph--error"),Y(s,a),o):(o.classList.add("md-graph--loading"),s.textContent=G.Ay.t("rendering"),U(e,t).then(t=>{o.isConnected&&(o.classList.remove("md-graph--loading"),t.error&&o.classList.add("md-graph--error"),Y(s,t))}),o)}function Q(t,e,n){const r=[],{from:o,to:s}=t.selection;return t.doc.descendants((t,a)=>{if("code_block"!==t.type.name)return;const c=t.attrs.language,l=(0,V.Hm)(c),d=(0,P.hj)(c);if(!l&&!d)return;const u=a,h=a+t.nodeSize;if(function(t,e,n,r){return t<=r&&e>=n}(o,s,u,h))return;const m=t.textContent;if(!m.trim())return;r.push(i.NZ.node(u,h,{class:"md-graph-hidden"}));const p=`graph-${c}-${u}-${m}`;d?r.push(i.NZ.widget(h,()=>function(t,e,n,r,o){const s=document.createElement("div");s.className="md-graph md-graph--mind",s.setAttribute("contenteditable","false"),s.textContent=G.Ay.t("rendering");const a=X(r,n);let c=null;return s.__unmount=()=>{c?.destroy(),c=null},J(e,t).then(t=>{s.isConnected&&(s.textContent="",s.append(a),t.mount(s).then(t=>{s.isConnected?c=t:t.destroy()}).catch(t=>{console.error("[mind] mount failed",t)}))}),s.addEventListener("click",()=>{o?.(t,e=>function(t,e,n,r){if(!t||r===n)return;const o=t.state.doc;let s=null;const a=o.nodeAt(e);if(a&&"code_block"===a.type.name&&a.textContent===n?s={from:e+1,to:e+a.nodeSize-1}:o.descendants((t,e)=>!(s||"code_block"===t.type.name&&"smm-mind"===t.attrs.language&&t.textContent===n&&(s={from:e+1,to:e+t.nodeSize-1},1))),!s)return;const c=t.state.tr.replaceWith(s.from,s.to,t.state.schema.text(r));t.dispatch(c)}(r(),n,t,e))}),s}(m,c,u,e,n),{side:-1,ignoreSelection:!0,key:p,destroy:t=>t.__unmount?.()})):r.push(i.NZ.widget(h,()=>Z(m,c,u,e),{side:-1,ignoreSelection:!0,key:p}))}),i.zF.create(t.doc,r)}function tt(t){let e=null;return new c.k_({key:I,props:{decorations(n){const r=Q(n,()=>e,t);return r.find().length?r:null}},view:t=>(e=t,{destroy(){e=null}})})}const et=new Map;class nt{dom;node;view;get_pos;render_box;source_input;editing=!1;draft=null;painted_raw="";constructor(t,e,n){this.node=t,this.view=e,this.get_pos=n;const r="math_block"===t.type.name;this.dom=document.createElement(r?"div":"span"),this.dom.className=r?"md-math md-math--block":"md-math md-math--inline",this.dom.setAttribute("contenteditable","false"),this.render_box=document.createElement("span"),this.render_box.className="md-math__render",this.source_input=document.createElement("textarea"),this.source_input.className="md-math__source",this.source_input.setAttribute("spellcheck","false"),this.source_input.setAttribute("wrap","off"),this.source_input.setAttribute("rows","1"),this.dom.append(this.render_box,this.source_input),function(t,e){et.set(t,e)}(n(),this),this.source_input.addEventListener("input",()=>{this.draft=this.source_input.value,this.auto_size()}),this.source_input.addEventListener("blur",()=>this.commit()),this.source_input.addEventListener("keydown",t=>{t.stopPropagation(),"Escape"===t.key&&(t.preventDefault(),this.draft=null,this.set_editing(!1))});for(const t of["beforeinput","paste","input","keyup","keypress"])this.source_input.addEventListener(t,t=>t.stopPropagation());this.render_box.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),this.focus_source()}),this.paint(t)}paint(t){const e=t.attrs.raw;if(this.editing)return this.dom.setAttribute("data-mode","source"),null===this.draft&&(this.source_input.value=e),void this.auto_size();if(this.dom.setAttribute("data-mode","preview"),this.painted_raw===e)return;this.painted_raw=e;const n=this.render_box;n.classList.add("md-math--loading"),n.textContent="",n.textContent=e,(0,k.z$)(n,t.attrs.tex,"math_block"===t.type.name?"block":"inline",e)}auto_size(){const t=this.source_input;t.style.height="0px",t.style.height=`${t.scrollHeight}px`}focus_source(){this.editing||(this.set_editing(!0),this.source_input.focus(),this.source_input.setSelectionRange(this.source_input.value.length,this.source_input.value.length))}set_editing(t){this.editing!==t&&(this.editing=t,this.paint(this.node))}set_selected(t){t?this.focus_source():this.editing&&(this.commit(),this.set_editing(!1))}commit(){if(null===this.draft)return;const t=this.draft;if(this.draft=null,t===this.node.attrs.raw)return;const e=this.get_pos(),n=this.view.state.doc.nodeAt(e);if(!n)return;const r=(0,k.V)(t),o=r?.tex??t;this.view.dispatch(this.view.state.tr.setNodeMarkup(e,void 0,{...n.attrs,raw:t,tex:o})),this.painted_raw=""}update(t){if(t.type!==this.node.type)return!1;const e=t.attrs.raw!==this.node.attrs.raw;return this.node=t,e&&(this.draft=null,this.painted_raw=""),this.paint(t),!0}stopEvent(t){return this.dom.contains(t.target)}ignoreMutation(){return!0}destroy(){this.draft=null,function(t){for(const[e,n]of et)if(n===t)return void et.delete(e)}(this)}}function rt(t){const e=t.state.selection,n=e.from,r=e.to;for(const[t,e]of et){const o=r>t&&n<=t+1;e.set_selected(o)}}var ot=n(67951),st=(n(41631),n(50576),n(70432),n(74848));function at(t){return 0===t?(0,ot.uf)("paragraph"):(0,ot.uf)("heading",{level:t})}function ct(t){return!(!t.ctrlKey&&!t.metaKey)}function it(t,e){let n=null;try{const r=t.domAtPos(e).node,o=1===r.nodeType?r:r.parentElement;n=o?o.closest(".md-filecat-content > *")??o:null}catch{}if(!n)return;const r=n.closest(".md-editor-scroll");if(!r)return;const o=parseFloat(getComputedStyle(n).scrollMarginTop)||0,s=r.scrollTop+n.getBoundingClientRect().top-r.getBoundingClientRect().top-o,a=r.scrollHeight-r.clientHeight;!function(t,e){const n=t.scrollTop,r=e-n;if(Math.abs(r)<1)return;const o=performance.now(),s=e=>{const a=Math.min(1,(e-o)/500);t.scrollTop=n+r*(1-Math.pow(1-a,3)),a<1&&requestAnimationFrame(s)};requestAnimationFrame(s)}(r,Math.max(0,Math.min(s,a)))}function lt(t,e){return(0,f.D8)(1)(t,e)}const dt=r.forwardRef(function(t,e){const{t:n}=(0,o.Bd)(),_=(0,r.useRef)(null),k=(0,r.useRef)(null),[,y]=(0,s.fp)(a.AG.mind_editor),v=(0,r.useRef)(t.on_change),w=(0,r.useRef)(t.on_save),M=(0,r.useRef)(t.on_selection_change),x=(0,r.useRef)(t.on_source_mode_change),A=(0,r.useRef)();return A.current=(t,e)=>{y({name:n("思维导图"),code_source:t,on_save_code:t=>e(t)})},(0,r.useEffect)(()=>{v.current=t.on_change,w.current=t.on_save,M.current=t.on_selection_change,x.current=t.on_source_mode_change}),(0,r.useEffect)(()=>{if(!_.current)return;g.Y;(0,b.sL)(t.doc_path?t.doc_path.replace(/[^/]*$/,""):"");const n=c.$t.create({doc:$(t.value??""),plugins:[(0,d.b6)(),R(),tt((t,e)=>A.current?.(t,e)),new c.k_({view:t=>(rt(t),{update:(t,e)=>{t.state.selection===e.selection&&t.state.doc===e.doc||rt(t)}})}),(0,ot.k5)(),(0,u.w)({"Mod-a":ot.Rx,"Mod-z":d.tN,"Mod-y":d.ZS,"Mod-Shift-z":d.ZS,"Mod-b":(0,ot.NH)("strong"),"Mod-i":(0,ot.NH)("em"),"Mod-Shift-x":(0,ot.NH)("strike"),"Mod-`":(0,ot.NH)("code"),"Mod-1":(t,e)=>at(1)(t,e),"Mod-2":(t,e)=>at(2)(t,e),"Mod-3":(t,e)=>at(3)(t,e),"Mod-0":(t,e)=>at(0)(t,e),"Mod-Shift-8":ot.fK,"Mod-Shift-9":ot.oB,"Mod-Shift-.":ot.Vu,Tab:ot.G8.sink,"Shift-Tab":ot.G8.lift,"Mod-Enter":lt,"Mod-s":()=>(w.current?.(),!0)}),(0,f.LF)({allowTableNodeSelection:!0}),(0,f.AL)(),(0,m.A)({color:"var(--primary, #1a73e8)",width:2}),(0,p.z)(),(0,u.w)({Enter:(0,h.st)(ot.x0,h.pC,ot.G8.split,h.Z1,h.iz,h.aw),"Shift-Enter":(t,e)=>{const{hard_break:n}=t.schema.nodes;return e&&e(t.tr.replaceSelectionWith(n.create()).scrollIntoView()),!0},"Mod-Enter":h.I$}),(0,u.w)(h.RV)]}),r=t=>t.setAttribute("data-img-error",""),o=t=>"IMG"===t.tagName&&!t.classList.contains("ProseMirror-separator"),s=t=>{const e=t.target;"IMG"===e?.tagName&&o(e)&&r(e)},a=t=>{const e=t.target;"IMG"===e?.tagName&&o(e)&&(t=>{t.removeAttribute("data-img-error")})(e)},y=_.current;y.addEventListener("error",s,!0),y.addEventListener("load",a,!0);const E=()=>{y.querySelectorAll("img").forEach(t=>{if(!o(t))return;const e=t;e.dataset.imgSeen||(e.dataset.imgSeen="1",e.complete?0===e.naturalWidth&&r(e):r(e))})},S=new MutationObserver(()=>{requestAnimationFrame(E)});S.observe(y,{childList:!0,subtree:!0}),E();let O=null;if(O=new i.Lz(_.current,{state:n,editable:()=>!1!==t.editable,nodeViews:{...(0,b.op)(),math_block:(t,e,n)=>new nt(t,e,n),math_inline:(t,e,n)=>new nt(t,e,n)},handleClickOn(t,e,n,r,o){if(!ct(o))return!1;const s=function(t){if(!(t instanceof Element))return null;const e=t.closest("a[href]"),n=e?.getAttribute("href");return n||null}(o.target)??function(t,e){const n=t.doc.content.size,r=Math.max(0,Math.min(e,n));let o;try{o=t.doc.resolve(r)}catch{return null}for(const e of[1,-1]){const o=1===e?r:r-1;if(!(o<0||o>=n))try{const e=t.doc.resolve(o).marks().find(t=>"link"===t.type.name);if(e?.attrs?.href)return e.attrs.href}catch{}}try{const t=o.parent.marks.find(t=>"link"===t.type.name);if(t?.attrs?.href)return t.attrs.href}catch{}return null}(t.state,e);return!!s&&(window.open(s,"_blank","noopener,noreferrer"),!0)},clipboardTextSerializer:t=>C(t),handlePaste(t,e){const n=e.clipboardData?.getData("text/plain");if(!n)return!1;const{from:r,to:o}=t.state.selection;if(ht(t.state.doc,r)&&ht(t.state.doc,o))return t.dispatch(t.state.tr.insertText(n.replace(/\r\n?/g,"\n"),r,o).scrollIntoView()),!0;const s=e.clipboardData?.getData("text/html");if(s&&function(t){if(!t)return!1;try{const e=(new DOMParser).parseFromString(t,"text/html"),n=Array.from(e.body.children);return 1===n.length&&"PRE"===n[0].tagName}catch{return!1}}(s)){const e=$(n);return t.dispatch(t.state.tr.replaceSelection(new l.Ji(e.content,0,0)).scrollIntoView()),!0}return!1},handleDOMEvents:{keydown:(t,e)=>{if(ct(e)&&t.dom.classList.add("md-ctrl-down"),ut(t.state.doc)&&"Enter"===e.key&&!e.ctrlKey&&!e.metaKey&&!e.altKey){e.preventDefault();const{from:n,to:r}=t.state.selection;return t.dispatch(t.state.tr.insertText("\n",n,r).scrollIntoView()),!0}return!1},keyup:(t,e)=>(ct(e)||t.dom.classList.remove("md-ctrl-down"),!1),blur:t=>(t.dom.classList.remove("md-ctrl-down"),!1),beforeinput:(t,e)=>{if(!ut(t.state.doc))return!1;const n=e;if("insertText"!==n.inputType)return!1;const r=n.data;if(null==r)return!1;n.preventDefault();const{from:o,to:s}=t.state.selection;return t.dispatch(t.state.tr.insertText(r.replace(/\r\n?/g,"\n"),o,s).scrollIntoView()),!0}},dispatchTransaction(t){const e=O.state.apply(t);O.updateState(e);const n=ut(e.doc);n?O.dom.classList.add("md-source-mode"):O.dom.classList.remove("md-source-mode"),n!==ut(t.before)&&x.current?.(n),t.docChanged&&v.current?.(n?e.doc.textContent:D(e.doc)),(t.selectionSet||t.docChanged)&&M.current?.()},attributes:{class:"md-filecat-content",spellcheck:"false"}}),k.current=O,t.initial_source_mode&&!ut(O.state.doc)){const t=D(O.state.doc),e=O.state.schema.nodes.code_block.create({language:"markdown"},t?O.state.schema.text(t):null),n=O.state.tr;n.replaceWith(0,O.state.doc.content.size,e),n.setMeta("addToHistory",!1),O.dispatch(n)}const N={get_markdown:()=>ut(O.state.doc)?O.state.doc.textContent:D(O.state.doc),set_markdown:t=>{const e=$(t);O.dispatch(O.state.tr.replaceWith(0,O.state.doc.content.size,e.content))},focus:()=>O.focus(),get_view:()=>k.current,in_table:()=>function(t){const{$from:e}=t.selection;for(let t=e.depth;t>0;t--){if("table"===e.node(t).type.name)return!0}return!1}(O.state),active_marks:()=>(O.state.storedMarks??O.state.selection.$from.marks()).map(t=>t.type.name),active_block:()=>{const{$from:t}=O.state.selection;for(let e=t.depth;e>0;e--){const n=t.node(e);if("heading"===n.type.name)return{name:"heading",level:n.attrs.level};if("paragraph"===n.type.name)return{name:"paragraph"}}return{name:"paragraph"}},insert_table:(t=3,e=3)=>{const n=function(t,e,n){const r=(0,f.e)(t),o=r.table,s=r.row,a=r.cell,c=r.header_cell??r.cell;if(!o||!s||!a)return null;const i=t=>s.create(null,Array.from({length:e},()=>t.createAndFill())),l=i(c),d=Array.from({length:n},()=>i(a));return o.create(null,[l,...d])}(O.state.schema,t,e);if(!n)return;const{from:r}=O.state.selection,o=O.state.doc.resolve(r);let s=r;for(let t=o.depth;t>0;t--)if("table"===o.node(t).type.name){s=o.after(t);break}const a=O.state.tr;s===r?a.replaceSelectionWith(n):a.insert(s,n),O.dispatch(a.scrollIntoView());const c=O.state.doc.resolve(Math.min(s+3,O.state.doc.content.size));try{O.dispatch(O.state.tr.setSelection(O.state.selection.constructor.near(c)))}catch{}},get_headings:()=>function(t){const e=[];return t.doc.descendants((t,n)=>("heading"!==t.type.name||e.push({level:t.attrs.level,text:t.textContent,pos:n}),!0)),e}(O.state),scroll_to_pos:t=>{const e=O.state.doc.content.size,n=Math.max(0,Math.min(t,e)),r=O.state.doc.nodeAt(n);let o;try{o=r?c.U3.near(O.state.doc.resolve(n+1),1):c.U3.near(O.state.doc.resolve(n),1)}catch{o=c.U3.near(O.state.doc.resolve(0),1)}O.dispatch(O.state.tr.setSelection(o)),it(O,o.from),O.focus()},is_source_mode:()=>ut(O.state.doc),enter_source_mode:()=>{if(ut(O.state.doc))return;const t=D(O.state.doc),e=O.state.schema.nodes.code_block.create({language:"markdown"},t?O.state.schema.text(t):null),n=O.state.tr;n.replaceWith(0,O.state.doc.content.size,e),O.dispatch(n),O.dom.classList.add("md-source-mode")},exit_source_mode:()=>{if(!ut(O.state.doc))return;const t=$(O.state.doc.textContent),e=O.state.tr;e.replaceWith(0,O.state.doc.content.size,t.content),O.dispatch(e),O.dom.classList.remove("md-source-mode")}};return"function"==typeof e?e(N):e&&(e.current=N),t.on_ready?.(N),()=>{S.disconnect(),y.removeEventListener("error",s,!0),y.removeEventListener("load",a,!0),O.destroy(),k.current=null}},[]),(0,st.jsx)("div",{className:"md-filecat",ref:_})});function ut(t){if(1!==t.childCount)return!1;const e=t.firstChild;return!!e&&"code_block"===e.type.name&&"markdown"===e.attrs.language}function ht(t,e){const n=t.resolve(e);for(let t=n.depth;t>0;t--)if("code_block"===n.node(t).type.name)return!0;return!1}const mt=dt},67951(t,e,n){n.d(e,{G8:()=>g,NH:()=>u,Rx:()=>_,Vu:()=>f,fK:()=>m,k5:()=>l,oB:()=>p,uf:()=>h,x0:()=>d});var r=n(38341),o=n(5091),s=n(42845),a=n(46762),c=n(3772);function i(t,e){return new r.fV(t,(t,n,r,o)=>{const s=t.schema.marks[e],a=n[1];if(!s||!a)return null;const c=n[0].indexOf(a);if(c<0)return null;const i=r+c,l=i+a.length,d=t.tr;return d.delete(l,o),d.delete(r,i),d.addMark(r,r+a.length,s.create()),d.removeStoredMark(s),d})}function l(){const t=o.Y;return(0,r.sM)({rules:[(0,r.JJ)(/^(#{1,6})\s$/,t.nodes.heading,t=>({level:t[1].length})),(0,r.JJ)(/^#([1-6])\s$/,t.nodes.heading,t=>({level:Number(t[1])})),(0,r.JJ)(/^```([\w-]*)\s$/,t.nodes.code_block,t=>({language:t[1]??""})),(0,r.tG)(/^\s*>\s$/,t.nodes.blockquote),(0,r.tG)(/^\s*([-+*])\s$/,t.nodes.bullet_list),(0,r.tG)(/^(\d+)\.\s$/,t.nodes.ordered_list,t=>({order:Number(t[1])})),i(/(?:\*\*)([^*]+)(?:\*\*)$/,"strong"),i(/(?:__)([^_]+)(?:__)$/,"strong"),i(/(?<![*])\*([^*]+)\*$/,"em"),i(/(?<![_])_([^_]+)_$/,"em"),i(/(?:~~)([^~]+)(?:~~)$/,"strike"),i(/(?:`)([^`]+)(?:`)$/,"code"),new r.fV(/!\[([^\]]*)\]\(([^)\s]+)\)$/,(t,e,n,r)=>{const o=e[1]??"",s=e[2];return s?t.tr.replaceWith(n,r,t.schema.nodes.image.create({src:s,alt:o})):null}),...r.Fr,r.gO]})}const d=(t,e)=>{const{$from:n,empty:r}=t.selection;if(!r||"paragraph"!==n.parent.type.name)return!1;const o=n.parent.textContent;if(!o.trim())return!1;const a=function(t){const e=t.trim(),n=/^#([1-6])$/.exec(e);if(n)return{type:"heading",attrs:{level:Number(n[1])}};const r=/^(#{1,6})$/.exec(e);if(r)return{type:"heading",attrs:{level:r[1].length}};const o=/^```([\w-]*)$/.exec(e);return o?{type:"code_block",attrs:{language:o[1]??""}}:/^(?:-{3,}|\*{3,}|_{3,})$/.test(e.replace(/\s+/g,""))?{type:"horizontal_rule"}:/^>\s*$/.test(e)?{type:"blockquote"}:/^[-+*]\s*$/.test(e)?{type:"bullet_list"}:/^\d+[.)]$/.test(e)?{type:"ordered_list"}:null}(o);if(!a)return!1;if("blockquote"===a.type&&n.depth>1)return!1;const c=t.schema.nodes[a.type];if(!c)return!1;const i=n.before(n.depth),l=n.after(n.depth);if(e){const n=t.tr,r=c.createAndFill(a.attrs)??c.create(a.attrs);n.replaceWith(i,l,r);const o=Math.min(i+1,n.doc.content.size);try{n.setSelection(s.U3.near(n.doc.resolve(o),1))}catch{}n.scrollIntoView(),e(n)}return!0};function u(t){return(e,n)=>{const r=e.schema.marks[t];return!!r&&(0,a.wh)(r)(e,n)}}function h(t,e={}){return(n,r)=>{const o=n.schema.nodes[t];if(!o)return!1;const{$from:s,$to:a}=n.selection,c=s.blockRange(a);if(!c)return!1;const i=s.parent,l=i.type===o&&Object.entries(e).every(([t,e])=>i.attrs[t]===e),d=l?n.schema.nodes.paragraph:o,u=l?{}:e;return r&&r(n.tr.setBlockType(c.start,c.end,d,u)),!0}}const m=(t,e)=>(0,c.Sd)(t.schema.nodes.bullet_list)(t,e),p=(t,e)=>(0,c.Sd)(t.schema.nodes.ordered_list)(t,e),f=(t,e)=>{const{blockquote:n}=t.schema.nodes,{$from:r,$to:o}=t.selection,s=r.blockRange(o);if(!s)return!1;if(s.parent.type===n&&s.depth>0){const n=r.before(s.depth),o=t.tr.doc.nodeAt(n);if(o&&1===o.childCount)return e&&e(t.tr.replaceWith(n,n+o.nodeSize,o.child(0)).scrollIntoView()),!0;if(e){const n=t.tr,o=r.parent,a=r.after(s.depth);n.delete(s.start,s.end),n.insert(a,o),e(n.scrollIntoView())}return!0}return e&&e(t.tr.wrap(s,[{type:n}]).scrollIntoView()),!0},g={sink:(0,c.$B)(o.Y.nodes.list_item),lift:(0,c.T2)(o.Y.nodes.list_item),split:(0,c.wn)(o.Y.nodes.list_item),wrap_bullet:m,wrap_ordered:p},_=(t,e)=>{const{$from:n}=t.selection;return"code_block"===n.parent.type.name&&(e&&e(t.tr.setSelection(s.U3.create(t.doc,n.start(),n.end())).scrollIntoView()),!0)}},96763(t,e,n){n.d(e,{Kz:()=>a,P7:()=>l,_8:()=>h,_D:()=>u,bN:()=>s,o3:()=>c,sO:()=>d});var r=n(14284),o=n(53459);function s(t,e){const n="md-theme-style-"+t,r=document.getElementById(n);if(!e)return void r?.remove();let o=r;o||(o=document.createElement("style"),o.id=n,document.head.appendChild(o)),o.textContent=e}async function a(){try{const t=await r.XO.get("md_theme/list");return t?.code===o.m.Success?t.data??[]:[]}catch(t){return[]}}const c="md-theme-change";function i(){window.dispatchEvent(new Event(c))}async function l(t){try{const e=await r.XO.get(`md_theme/get?id=${encodeURIComponent(t)}`);return e?.code===o.m.Success?e.data??"":""}catch(t){return""}}async function d(){try{const t=await r.XO.get("md_theme/active");return t?.code===o.m.Success?t.data??"":""}catch(t){return""}}async function u(t){const e=await r.XO.post("md_theme/save",t);return e?.code!==o.m.Success?null:(i(),e.data)}async function h(t){const e=await r.XO.post("md_theme/del",{id:t});return e?.code===o.m.Success&&(i(),!0)}},5091(t,e,n){n.d(e,{Y:()=>u});var r=n(58903),o=n(86059),s=n(41105),a=n(99724);const c=(0,o.of)({tableGroup:"block",cellContent:"block+",cellAttributes:{}}),i={align:{default:null}},l={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:i,parseDOM:[{tag:"p"}],toDOM:t=>["p",t.attrs.align?{style:`text-align:${t.attrs.align}`}:{},0]},heading:{content:"inline*",group:"block",attrs:{level:{default:1},...i},defining:!0,parseDOM:[1,2,3,4,5,6].map(t=>({tag:`h${t}`,attrs:{level:t}})),toDOM(t){const e=t.attrs.align?{style:`text-align:${t.attrs.align}`}:{};return[`h${t.attrs.level}`,e,0]}},bullet_list:{group:"block",content:"list_item+",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},ordered_list:{group:"block",content:"list_item+",attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:t=>({order:Number(t.getAttribute("start")??1)})}],toDOM:t=>1===t.attrs.order?["ol",0]:["ol",{start:t.attrs.order},0]},list_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:null}},parseDOM:[{tag:"li",getAttrs:t=>{const e=t,n=e.querySelector("input[type=checkbox]");if(n)return{checked:n.checked};const r=e.getAttribute("data-checked");return{checked:null===r?null:"true"===r}}}],toDOM:t=>null!==t.attrs.checked?["li",{"data-checked":String(t.attrs.checked)},0]:["li",0]},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},code_block:{content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>{const e=t.querySelector("code"),n=/language-([\w-]+)/.exec(e?.className??"");return{language:n?n[1]:""}}}],toDOM:t=>["pre",{"data-language":t.attrs.language},["code",0]]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},html_block:{group:"block",atom:!0,code:!0,attrs:{value:{default:""}},parseDOM:[{tag:"div[data-html-block]",getAttrs:t=>({value:(0,s.Ne)(t.getAttribute("data-html-block")??"")})}],toDOM:t=>["div",{"data-html-block":t.attrs.value}]},html_inline:{inline:!0,group:"inline",atom:!0,code:!0,attrs:{value:{default:""}},parseDOM:[{tag:"span[data-html-inline]",getAttrs:t=>({value:(0,s.Ne)(t.getAttribute("data-html-inline")??"")})}],toDOM:t=>["span",{"data-html-inline":t.attrs.value}]},math_inline:{inline:!0,group:"inline",atom:!0,attrs:{raw:{default:""},tex:{default:""}},parseDOM:[{tag:"span[data-math-inline]",getAttrs:t=>{const e=t,n=(0,s.Ne)(e.getAttribute("data-math-inline")??"");return{raw:n,tex:(0,a.V)(n)?.tex??""}}}],toDOM:t=>["span",{"data-math-inline":t.attrs.raw}]},math_block:{group:"block",atom:!0,code:!0,attrs:{raw:{default:""},tex:{default:""}},parseDOM:[{tag:"div[data-math-block]",getAttrs:t=>{const e=t,n=(0,s.Ne)(e.getAttribute("data-math-block")??"");return{raw:n,tex:(0,a.V)(n)?.tex??""}}}],toDOM:t=>["div",{"data-math-block":t.attrs.raw}]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},image:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:t=>{const e=t;return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title")}}}],toDOM(t){const{src:e,alt:n,title:r}=t.attrs,o={src:(0,s.KR)(e)};return n&&(o.alt=n),r&&(o.title=r),["img",o]}},text:{group:"inline"},...c},d={strong:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight=bold"}],toDOM:()=>["strong",0]},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"}],toDOM:()=>["s",0]},code:{parseDOM:[{tag:"code",getAttrs:t=>"PRE"!==t.parentElement?.tagName&&null}],toDOM:()=>["code",0]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:t=>{const e=t;return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM(t){const{href:e,title:n}=t.attrs;return["a",{href:e,title:n,rel:"noopener noreferrer",target:"_blank"},0]}}},u=new r.Sj({nodes:l,marks:d})}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1075,4877],{69918(t,e,n){n.d(e,{Ce:()=>i,FG:()=>r.FG,fy:()=>c,gC:()=>a});var r=n(18840),o=n(14284),s=n(53459);async function a(){try{const t=await o.XO.get("md_editor_setting/get");return{...r.FG,...t?.data??{}}}catch(t){return{...r.FG}}}async function c(t){const e=await o.XO.post("md_editor_setting/save",t);return e?.code!==s.m.Success?null:{...r.FG,...e.data??t}}function i(t,e){t&&(t.style.setProperty("--md-editor-max-width",e.content_max_width),t.style.setProperty("--md-editor-padding",e.content_padding),t.style.setProperty("--md-editor-font-size",e.font_size),t.style.setProperty("--md-editor-line-height",e.line_height))}},64877(t,e,n){n.r(e),n.d(e,{default:()=>a});var r=n(96540),o=n(22022),s=n(74848);function a(t){const{t:e}=(0,o.Bd)(),[n,a]=(0,r.useState)(new Set),c=(0,r.useMemo)(()=>function(t){const e=[],n=[];for(const r of t){const t={...r,children:[]};for(;n.length>0&&n[n.length-1].level>=t.level;)n.pop();0===n.length?e.push(t):n[n.length-1].children.push(t),n.push(t)}return e}(t.items),[t.items]),i=(r,o)=>r.map(r=>{const c=r.children.length>0,l=n.has(r.pos),d=r.pos===t.active_pos;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:`md-outline-item md-outline-item--h${r.level}${d?" md-outline-item--active":""}`,style:{paddingLeft:.4+.75*o+"em"},title:r.text,onClick:()=>t.on_click(r),children:[(0,s.jsx)("i",{className:"material-icons md-outline-arrow"+(c?"":" md-outline-arrow--empty"),onClick:c?t=>{return e=r.pos,t.stopPropagation(),void a(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});var e}:void 0,children:c?l?"arrow_right":"arrow_drop_down":""}),(0,s.jsx)("span",{className:"md-outline-text",children:r.text||e("未命名标题")})]}),c&&!l&&i(r.children,o+1)]},r.pos)});return 0===t.items.length?(0,s.jsx)("div",{className:"md-outline md-outline--empty",children:(0,s.jsx)("div",{className:"md-outline-tip",children:e("no_head")})}):(0,s.jsx)("div",{className:"md-outline",children:(0,s.jsx)("div",{className:"md-outline-list",children:i(c,0)})})}},76118(t,e,n){n.d(e,{A:()=>pt});var r=n(96540),o=n(22022),s=n(34843),a=n(82893),c=n(42845),i=n(1575),l=n(58903),d=n(89781),u=n(61396),h=n(46762),p=n(73337),m=n(89552),f=n(86059),g=n(5091),_=n(23802),b=n(41105),k=n(99724);const y=new _.A({html:!0,linkify:!0,breaks:!1,typographer:!1});function v(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}y.renderer.rules.html_block=(t,e)=>`<div data-html-block="${(0,b.pC)(t[e].content)}"></div>`,y.renderer.rules.html_inline=(t,e)=>`<span data-html-inline="${(0,b.pC)(t[e].content)}"></span>`,y.renderer.rules.fence=(t,e)=>{const n=t[e],r=n.info?n.info.trim().split(/\s+/)[0]:"",o=n.content.replace(/\n$/,""),s=y.utils.escapeHtml(o),a=r?` class="language-${v(r)}"`:"";return`<pre${r?` data-language="${v(r)}"`:""}><code${a}>${s}</code></pre>\n`},y.inline.ruler.before("escape","math_inline",function(t,e){const n=t.pos,r=t.src,o=[{open:"\\(",close:"\\)"},{open:"$",close:"$"}];if(r.startsWith("$$",n))return!1;for(const s of o){if(!r.startsWith(s.open,n))continue;const o=n+s.open.length,a=r.indexOf(s.close,o);if(a<0)continue;const c=r.slice(o,a);if(c.trim()){if("$"===s.open){const t=r[a+1];if(void 0!==t&&/\d/.test(t))continue}if(!e){const e=t.push("math_inline","span",0);e.content=c,e.markup=s.open,e.meta={raw:r.slice(n,a+s.close.length)}}return t.pos=a+s.close.length,!0}}return!1}),y.block.ruler.before("fence","math_block",function(t,e,n,r){const o=t.bMarks[e]+t.tShift[e],s=t.eMarks[e],a=t.src.slice(o,s).trim(),c=[{open:"\\[",close:"\\]"},{open:"$$",close:"$$"}];for(const s of c){if(!a.startsWith(s.open))continue;if(a.endsWith(s.close)&&a.length>s.open.length+s.close.length){if(r)return!0;const n=a.slice(s.open.length,a.length-s.close.length),o=t.push("math_block","div",0);return o.content=n,o.markup=s.open,o.meta={raw:a},o.map=[e,e+1],t.line=e+1,!0}const c=a.slice(s.open.length);for(let a=e+1;a<n;a++){const n=t.bMarks[a]+t.tShift[a],i=t.eMarks[a],l=t.src.slice(n,i);if(!l.trimEnd().endsWith(s.close))continue;if(r)return!0;const d=[c,...t.getLines(e+1,a,t.tShift[e],!1).split("\n")].filter((t,e)=>!(0===e&&!t.trim())),u=l.trimEnd().slice(0,-s.close.length);d.push(u);const h=t.push("math_block","div",0);return h.content=d.join("\n").trim(),h.markup=s.open,h.map=[e,a+1],h.meta={raw:t.src.slice(o,t.eMarks[a]).trimEnd()},t.line=a+1,!0}}return!1},{alt:["paragraph","reference","blockquote","list"]}),y.renderer.rules.math_inline=(t,e)=>`<span data-math-inline="${(0,b.pC)(t[e].meta.raw)}"></span>`,y.renderer.rules.math_block=(t,e)=>`<div data-math-block="${(0,b.pC)(t[e].meta.raw)}"></div>`;const w=y.renderer.rules.fence;function $(t){const e=y.render(t??""),n=(new DOMParser).parseFromString(e,"text/html");return l.S4.fromSchema(g.Y).parse(n.body)}function M(t){let e="";return t.forEach(t=>{if(t.isText){let n=t.marks.some(t=>"code"===t.type.name)?t.text??"":function(t){return t.replace(/([\\`*_<>])/g,"\\$1")}(t.text??"");for(const e of t.marks)switch(e.type.name){case"code":n=`\`${t.text??""}\``;break;case"strong":n=`**${n}**`;break;case"em":n=`*${n}*`;break;case"strike":n=`~~${n}~~`;break;case"link":n=`[${n}](${e.attrs.href}${e.attrs.title?` "${e.attrs.title}"`:""})`}e+=n}else if("image"===t.type.name){const{src:n,alt:r,title:o}=t.attrs;e+=`![${r??""}](${n}${o?` "${o}"`:""})`}else"hard_break"===t.type.name?e+=" \n":"html_inline"===t.type.name?e+=t.attrs.value:"math_inline"===t.type.name&&(e+=t.attrs.raw)}),e}function x(t){const e=[];if(t.forEach(t=>{const n=[],r=[];t.forEach(t=>{var e;n.push((e=t.textContent,e.replace(/\|/g,"\\|").replace(/\n/g," ")).trim()),r.push("table_header"===t.type.name)}),e.push({cells:n,header_flags:r})}),0===e.length)return"";const n=Math.max(...e.map(t=>t.cells.length)),r=e[0].header_flags.some(t=>t),o=Array.from({length:n},(t,n)=>Math.max(3,...e.map(t=>A(t.cells[n]??"")))),s=t=>`| ${Array.from({length:n},(e,n)=>{return r=t[n]??"",s=o[n],r+" ".repeat(Math.max(0,s-A(r)));var r,s}).join(" | ")} |`,a=[];if(r){a.push(s(e[0].cells)),a.push(`| ${o.map(t=>"-".repeat(t)).join(" | ")} |`);for(let t=1;t<e.length;t++)a.push(s(e[t].cells))}else{a.push(s(new Array(n).fill(""))),a.push(`| ${o.map(t=>"-".repeat(t)).join(" | ")} |`);for(const t of e)a.push(s(t.cells))}return a.join("\n")}function A(t){let e=0;for(const n of t){const t=n.codePointAt(0)??0;e+=t>=4352&&t<=4447||t>=11904&&t<=42191||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510?2:1}return e}function E(t,e=""){switch(t.type.name){case"paragraph":{const n=M(t).split("\n");return n[0]+n.slice(1).map(t=>`\n${e}${t}`).join("")}case"heading":return`${e}${"#".repeat(t.attrs.level)} ${M(t)}`;case"blockquote":return O(t,"").split("\n").map(t=>`${e}> ${t}`).join("\n");case"code_block":{const n=t.attrs.language??"",r=t.textContent;let o=3;for(const t of r.match(/`+/g)??[])o=Math.max(o,t.length+1);const s="`".repeat(o),a=r.split("\n").map(t=>e+t).join("\n");return`${e}${s}${n}\n${a}\n${e}${s}`}case"horizontal_rule":return`${e}---`;case"html_block":return t.attrs.value.replace(/\n+$/,"").split("\n").map(t=>e+t).join("\n");case"math_block":return t.attrs.raw.replace(/\n+$/,"").split("\n").map(t=>e+t).join("\n");case"bullet_list":{const n=[];return t.forEach((t,r,o)=>{n.push(S(t,e,`${e}- `,`${e} `,o))}),n.join("\n")}case"ordered_list":{const n=[],r=t.attrs.order??1;return t.forEach((t,o,s)=>{n.push(S(t,e,`${e}${r+s}. `,`${e} `,s))}),n.join("\n")}case"table":return x(t).split("\n").map(t=>e+t).join("\n");default:return e+M(t)}}function S(t,e,n,r,o){const s=t.attrs.checked,a=null===s?"":s?"[x] ":"[ ] ",c=[];t.forEach(t=>{c.push(E(t,r))});const i=c.join("\n").split("\n");return n+a+i[0]+(i.length>1?"\n"+i.slice(1).join("\n"):"")}function O(t,e=""){const n=[];return t.forEach(t=>{n.push(E(t,e))}),n.join("\n\n")}function C(t){return O(t).trim()+"\n"}function D(t){const e=[];if(t.content.forEach(t=>e.push(t)),1===e.length&&"code_block"===e[0].type.name&&"markdown"===e[0].attrs.language)return e[0].textContent;const n=t.openStart??0,r=t.openEnd??0;return 1===e.length&&1===n&&1===r?N(t.content):O(t.content)}function N(t){const e=[];t.forEach(t=>{["ordered_list","bullet_list","list_item","blockquote"].includes(t.type.name)?e.push(N(t)):e.push(E(t,""))});const n=t.type&&("ordered_list"===t.type.name||"bullet_list"===t.type.name);return e.join(n?"\n":"\n\n")}y.renderer.rules.fence=(t,e,n,r,o)=>{const s=t[e],a=s.info.trim().toLowerCase();return(0,k.lG)(a)?`<div data-math-block="${(0,b.pC)(`$$\n${s.content.trim()}\n$$`)}"></div>`:w(t,e,n,r,o)},y.core.ruler.push("list_item_softbreak_to_hard",t=>{let e=0;for(const n of t.tokens)if("list_item_open"!==n.type)if("list_item_close"!==n.type){if(!(e<=0||"inline"!==n.type)&&n.children)for(const t of n.children)"softbreak"===t.type&&(t.type="hardbreak",t.tag="br")}else e--;else e++});n(64877);var L=n(19878);const z=new c.hs("md_source_highlight");function j(t,e,n){let r=e;for(const e of t){if("string"==typeof e){r+=e.length;continue}const t=r;Array.isArray(e.children)&&(r=j(e.children,r,n)),e.scope&&n.push({from:t,to:r,cls:`hljs-${e.scope}`})}return r}function T(t,e){const n=t.textContent;if(!n)return[];const r=t.attrs.language??"";if(!r||!L.A.getLanguage(r))return[];let o;try{o=L.A.highlight(n,{language:r,ignoreIllegals:!0})}catch{return[]}const s=[],a=o._emitter?.rootNode;a?.children&&j(a.children,0,s);const c=e+1,l=[];for(const t of s){const e=Math.min(t.from,n.length),r=Math.min(t.to,n.length);e>=r||l.push(i.NZ.inline(c+e,c+r,{class:t.cls}))}return l}function R(){return new c.k_({key:z,props:{decorations(t){const e=function(t){const e=[];return t.descendants((t,n)=>"code_block"!==t.type.name||(e.push(...T(t,n)),!1)),i.zF.create(t,e)}(t.doc);return e.find().length?e:null}}})}var V=n(89117),F=n(86063),P=n(89871);const G=new c.hs("md-graph"),I=new Map,q=new Map,W=new Map,H=new Map;function B(t,e){return`${t}\0${e}`}function K(t,e,n){return(r,o)=>{const s=B(r,o),a=t.get(s);if(a)return Promise.resolve(a);let c=e.get(s);return c||(c=n(r,o).then(n=>(t.set(s,n),e.delete(s),n)),e.set(s,c)),c}}const U=K(I,q,(t,e)=>(0,V.U6)(t,e)),J=K(W,H,(t,e)=>(0,F.Hn)(e));function X(t,e){const n=document.createElement("button");return n.className="md-graph__edit",n.type="button",n.textContent=P.Ay.t("clk_edt"),n.addEventListener("click",n=>{n.stopPropagation(),function(t,e){if(!t)return;const n=Math.min(e+1,t.state.doc.content.size);t.dispatch(t.state.tr.setSelection(c.U3.near(t.state.doc.resolve(n),1))),t.focus()}(t(),e)}),n}function Y(t,e){if(e.error)return t.className="md-graph__body",void(t.textContent=e.error);t.className="md-graph__body",t.innerHTML=e.svg}function Z(t,e,n,r){const o=document.createElement("div");o.className="md-graph",o.setAttribute("contenteditable","false");const s=document.createElement("div");s.className="md-graph__body",s.addEventListener("click",()=>{const n=I.get(B(e,t));n&&!n.error&&n.svg&&function(t){const e=document.createElement("div");e.className="md-graph-zoom";const n=document.createElement("div");let r;n.className="md-graph-zoom__body";const o=document.createElement("button");o.className="md-graph-zoom__close",o.type="button",o.title=P.Ay.t("取消"),o.innerHTML='<i class="material-icons">close</i>';const s=t=>{"Escape"===t.key&&a()};function a(){"function"==typeof r&&r(),document.removeEventListener("keydown",s),e.remove()}e.addEventListener("click",t=>{t.target===e&&a()}),o.addEventListener("click",a),document.addEventListener("keydown",s),e.append(n,o),document.body.appendChild(e),r=t(n)}(t=>{t.innerHTML=n.svg})}),o.append(s,X(r,n));const a=I.get(B(e,t));return a?(a.error&&o.classList.add("md-graph--error"),Y(s,a),o):(o.classList.add("md-graph--loading"),s.textContent=P.Ay.t("rendering"),U(e,t).then(t=>{o.isConnected&&(o.classList.remove("md-graph--loading"),t.error&&o.classList.add("md-graph--error"),Y(s,t))}),o)}function Q(t,e,n){const r=[],{from:o,to:s}=t.selection;return t.doc.descendants((t,a)=>{if("code_block"!==t.type.name)return;const c=t.attrs.language,l=(0,V.Hm)(c),d=(0,F.hj)(c);if(!l&&!d)return;const u=a,h=a+t.nodeSize;if(function(t,e,n,r){return t<=r&&e>=n}(o,s,u,h))return;const p=t.textContent;if(!p.trim())return;r.push(i.NZ.node(u,h,{class:"md-graph-hidden"}));const m=`graph-${c}-${u}-${p}`;d?r.push(i.NZ.widget(h,()=>function(t,e,n,r,o){const s=document.createElement("div");s.className="md-graph md-graph--mind",s.setAttribute("contenteditable","false"),s.textContent=P.Ay.t("rendering");const a=X(r,n);let c=null;return s.__unmount=()=>{c?.destroy(),c=null},J(e,t).then(t=>{s.isConnected&&(s.textContent="",s.append(a),t.mount(s).then(t=>{s.isConnected?c=t:t.destroy()}).catch(t=>{console.error("[mind] mount failed",t)}))}),s.addEventListener("click",()=>{o?.(t,e=>function(t,e,n,r){if(!t||r===n)return;const o=t.state.doc;let s=null;const a=o.nodeAt(e);if(a&&"code_block"===a.type.name&&a.textContent===n?s={from:e+1,to:e+a.nodeSize-1}:o.descendants((t,e)=>!(s||"code_block"===t.type.name&&"smm-mind"===t.attrs.language&&t.textContent===n&&(s={from:e+1,to:e+t.nodeSize-1},1))),!s)return;const c=t.state.tr.replaceWith(s.from,s.to,t.state.schema.text(r));t.dispatch(c)}(r(),n,t,e))}),s}(p,c,u,e,n),{side:-1,ignoreSelection:!0,key:m,destroy:t=>t.__unmount?.()})):r.push(i.NZ.widget(h,()=>Z(p,c,u,e),{side:-1,ignoreSelection:!0,key:m}))}),i.zF.create(t.doc,r)}function tt(t){let e=null;return new c.k_({key:G,props:{decorations(n){const r=Q(n,()=>e,t);return r.find().length?r:null}},view:t=>(e=t,{destroy(){e=null}})})}const et=new Map;class nt{dom;node;view;get_pos;render_box;source_input;editing=!1;draft=null;painted_raw="";constructor(t,e,n){this.node=t,this.view=e,this.get_pos=n;const r="math_block"===t.type.name;this.dom=document.createElement(r?"div":"span"),this.dom.className=r?"md-math md-math--block":"md-math md-math--inline",this.dom.setAttribute("contenteditable","false"),this.render_box=document.createElement("span"),this.render_box.className="md-math__render",this.source_input=document.createElement("textarea"),this.source_input.className="md-math__source",this.source_input.setAttribute("spellcheck","false"),this.source_input.setAttribute("wrap","off"),this.source_input.setAttribute("rows","1"),this.dom.append(this.render_box,this.source_input),function(t,e){et.set(t,e)}(n(),this),this.source_input.addEventListener("input",()=>{this.draft=this.source_input.value,this.auto_size()}),this.source_input.addEventListener("blur",()=>this.commit()),this.source_input.addEventListener("keydown",t=>{t.stopPropagation(),"Escape"===t.key&&(t.preventDefault(),this.draft=null,this.set_editing(!1))});for(const t of["beforeinput","paste","input","keyup","keypress"])this.source_input.addEventListener(t,t=>t.stopPropagation());this.render_box.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),this.focus_source()}),this.paint(t)}paint(t){const e=t.attrs.raw;if(this.editing)return this.dom.setAttribute("data-mode","source"),null===this.draft&&(this.source_input.value=e),void this.auto_size();if(this.dom.setAttribute("data-mode","preview"),this.painted_raw===e)return;this.painted_raw=e;const n=this.render_box;n.classList.add("md-math--loading"),n.textContent="",n.textContent=e,(0,k.z$)(n,t.attrs.tex,"math_block"===t.type.name?"block":"inline",e)}auto_size(){const t=this.source_input;t.style.height="0px",t.style.height=`${t.scrollHeight}px`}focus_source(){this.editing||(this.set_editing(!0),this.source_input.focus(),this.source_input.setSelectionRange(this.source_input.value.length,this.source_input.value.length))}set_editing(t){this.editing!==t&&(this.editing=t,this.paint(this.node))}set_selected(t){t?this.focus_source():this.editing&&(this.commit(),this.set_editing(!1))}commit(){if(null===this.draft)return;const t=this.draft;if(this.draft=null,t===this.node.attrs.raw)return;const e=this.get_pos(),n=this.view.state.doc.nodeAt(e);if(!n)return;const r=(0,k.V)(t),o=r?.tex??t;this.view.dispatch(this.view.state.tr.setNodeMarkup(e,void 0,{...n.attrs,raw:t,tex:o})),this.painted_raw=""}update(t){if(t.type!==this.node.type)return!1;const e=t.attrs.raw!==this.node.attrs.raw;return this.node=t,e&&(this.draft=null,this.painted_raw=""),this.paint(t),!0}stopEvent(t){return this.dom.contains(t.target)}ignoreMutation(){return!0}destroy(){this.draft=null,function(t){for(const[e,n]of et)if(n===t)return void et.delete(e)}(this)}}function rt(t){const e=t.state.selection,n=e.from,r=e.to;for(const[t,e]of et){const o=r>t&&n<=t+1;e.set_selected(o)}}var ot=n(67951),st=(n(41631),n(50576),n(70432),n(74848));function at(t){return 0===t?(0,ot.uf)("paragraph"):(0,ot.uf)("heading",{level:t})}function ct(t){return!(!t.ctrlKey&&!t.metaKey)}function it(t,e){let n=null;try{const r=t.domAtPos(e).node,o=1===r.nodeType?r:r.parentElement;n=o?o.closest(".md-filecat-content > *")??o:null}catch{}if(!n)return;const r=n.closest(".md-editor-scroll");if(!r)return;const o=parseFloat(getComputedStyle(n).scrollMarginTop)||0,s=r.scrollTop+n.getBoundingClientRect().top-r.getBoundingClientRect().top-o,a=r.scrollHeight-r.clientHeight;!function(t,e){const n=t.scrollTop,r=e-n;if(Math.abs(r)<1)return;const o=performance.now(),s=e=>{const a=Math.min(1,(e-o)/500);t.scrollTop=n+r*(1-Math.pow(1-a,3)),a<1&&requestAnimationFrame(s)};requestAnimationFrame(s)}(r,Math.max(0,Math.min(s,a)))}function lt(t,e){return(0,f.D8)(1)(t,e)}const dt=r.forwardRef(function(t,e){const{t:n}=(0,o.Bd)(),_=(0,r.useRef)(null),k=(0,r.useRef)(null),[,y]=(0,s.fp)(a.AG.mind_editor),v=(0,r.useRef)(t.on_change),w=(0,r.useRef)(t.on_save),M=(0,r.useRef)(t.on_selection_change),x=(0,r.useRef)(t.on_source_mode_change),A=(0,r.useRef)();return A.current=(t,e)=>{y({name:n("思维导图"),code_source:t,on_save_code:t=>e(t)})},(0,r.useEffect)(()=>{v.current=t.on_change,w.current=t.on_save,M.current=t.on_selection_change,x.current=t.on_source_mode_change}),(0,r.useEffect)(()=>{if(!_.current)return;g.Y;(0,b.sL)(t.doc_path?t.doc_path.replace(/[^/]*$/,""):"");const n=c.$t.create({doc:$(t.value??""),plugins:[(0,d.b6)(),R(),tt((t,e)=>A.current?.(t,e)),new c.k_({view:t=>(rt(t),{update:(t,e)=>{t.state.selection===e.selection&&t.state.doc===e.doc||rt(t)}})}),(0,ot.k5)(),(0,u.w)({"Mod-a":ot.Rx,"Mod-z":d.tN,"Mod-y":d.ZS,"Mod-Shift-z":d.ZS,"Mod-b":(0,ot.NH)("strong"),"Mod-i":(0,ot.NH)("em"),"Mod-Shift-x":(0,ot.NH)("strike"),"Mod-`":(0,ot.NH)("code"),"Mod-1":(t,e)=>at(1)(t,e),"Mod-2":(t,e)=>at(2)(t,e),"Mod-3":(t,e)=>at(3)(t,e),"Mod-0":(t,e)=>at(0)(t,e),"Mod-Shift-8":ot.fK,"Mod-Shift-9":ot.oB,"Mod-Shift-.":ot.Vu,Tab:ot.G8.sink,"Shift-Tab":ot.G8.lift,"Mod-Enter":lt,"Mod-s":()=>(w.current?.(),!0)}),(0,f.LF)({allowTableNodeSelection:!0}),(0,f.AL)(),(0,p.A)({color:"var(--primary, #1a73e8)",width:2}),(0,m.z)(),(0,u.w)({Enter:(0,h.st)(ot.x0,h.pC,ot.CF,ot.G8.split,h.Z1,h.iz,h.aw),"Shift-Enter":(t,e)=>{const{hard_break:n}=t.schema.nodes;return e&&e(t.tr.replaceSelectionWith(n.create()).scrollIntoView()),!0},"Mod-Enter":h.I$}),(0,u.w)(h.RV)]}),r=t=>t.setAttribute("data-img-error",""),o=t=>"IMG"===t.tagName&&!t.classList.contains("ProseMirror-separator"),s=t=>{const e=t.target;"IMG"===e?.tagName&&o(e)&&r(e)},a=t=>{const e=t.target;"IMG"===e?.tagName&&o(e)&&(t=>{t.removeAttribute("data-img-error")})(e)},y=_.current;y.addEventListener("error",s,!0),y.addEventListener("load",a,!0);const E=()=>{y.querySelectorAll("img").forEach(t=>{if(!o(t))return;const e=t;e.dataset.imgSeen||(e.dataset.imgSeen="1",e.complete?0===e.naturalWidth&&r(e):r(e))})},S=new MutationObserver(()=>{requestAnimationFrame(E)});S.observe(y,{childList:!0,subtree:!0}),E();let O=null;if(O=new i.Lz(_.current,{state:n,editable:()=>!1!==t.editable,nodeViews:{...(0,b.op)(),math_block:(t,e,n)=>new nt(t,e,n),math_inline:(t,e,n)=>new nt(t,e,n)},handleClickOn(t,e,n,r,o){if(!ct(o))return!1;const s=function(t){if(!(t instanceof Element))return null;const e=t.closest("a[href]"),n=e?.getAttribute("href");return n||null}(o.target)??function(t,e){const n=t.doc.content.size,r=Math.max(0,Math.min(e,n));let o;try{o=t.doc.resolve(r)}catch{return null}for(const e of[1,-1]){const o=1===e?r:r-1;if(!(o<0||o>=n))try{const e=t.doc.resolve(o).marks().find(t=>"link"===t.type.name);if(e?.attrs?.href)return e.attrs.href}catch{}}try{const t=o.parent.marks.find(t=>"link"===t.type.name);if(t?.attrs?.href)return t.attrs.href}catch{}return null}(t.state,e);return!!s&&(window.open(s,"_blank","noopener,noreferrer"),!0)},clipboardTextSerializer:t=>D(t),handlePaste(t,e){const n=e.clipboardData?.getData("text/plain");if(!n)return!1;const{from:r,to:o}=t.state.selection;if(ht(t.state.doc,r)&&ht(t.state.doc,o))return t.dispatch(t.state.tr.insertText(n.replace(/\r\n?/g,"\n"),r,o).scrollIntoView()),!0;const s=e.clipboardData?.getData("text/html");if(s&&function(t){if(!t)return!1;try{const e=(new DOMParser).parseFromString(t,"text/html"),n=Array.from(e.body.children);return 1===n.length&&"PRE"===n[0].tagName}catch{return!1}}(s)){const e=$(n);return t.dispatch(t.state.tr.replaceSelection(new l.Ji(e.content,0,0)).scrollIntoView()),!0}return!1},handleDOMEvents:{keydown:(t,e)=>{if(ct(e)&&t.dom.classList.add("md-ctrl-down"),ut(t.state.doc)&&"Enter"===e.key&&!e.ctrlKey&&!e.metaKey&&!e.altKey){e.preventDefault();const{from:n,to:r}=t.state.selection;return t.dispatch(t.state.tr.insertText("\n",n,r).scrollIntoView()),!0}return!1},keyup:(t,e)=>(ct(e)||t.dom.classList.remove("md-ctrl-down"),!1),blur:t=>(t.dom.classList.remove("md-ctrl-down"),!1),beforeinput:(t,e)=>{if(!ut(t.state.doc))return!1;const n=e;if("insertText"!==n.inputType)return!1;const r=n.data;if(null==r)return!1;n.preventDefault();const{from:o,to:s}=t.state.selection;return t.dispatch(t.state.tr.insertText(r.replace(/\r\n?/g,"\n"),o,s).scrollIntoView()),!0}},dispatchTransaction(t){const e=O.state.apply(t);O.updateState(e);const n=ut(e.doc);n?O.dom.classList.add("md-source-mode"):O.dom.classList.remove("md-source-mode"),n!==ut(t.before)&&x.current?.(n),t.docChanged&&v.current?.(n?e.doc.textContent:C(e.doc)),(t.selectionSet||t.docChanged)&&M.current?.()},attributes:{class:"md-filecat-content",spellcheck:"false"}}),k.current=O,t.initial_source_mode&&!ut(O.state.doc)){const t=C(O.state.doc),e=O.state.schema.nodes.code_block.create({language:"markdown"},t?O.state.schema.text(t):null),n=O.state.tr;n.replaceWith(0,O.state.doc.content.size,e),n.setMeta("addToHistory",!1),O.dispatch(n)}const N={get_markdown:()=>ut(O.state.doc)?O.state.doc.textContent:C(O.state.doc),set_markdown:t=>{const e=$(t);O.dispatch(O.state.tr.replaceWith(0,O.state.doc.content.size,e.content))},focus:()=>O.focus(),get_view:()=>k.current,in_table:()=>function(t){const{$from:e}=t.selection;for(let t=e.depth;t>0;t--){if("table"===e.node(t).type.name)return!0}return!1}(O.state),active_marks:()=>(O.state.storedMarks??O.state.selection.$from.marks()).map(t=>t.type.name),active_block:()=>{const{$from:t}=O.state.selection;for(let e=t.depth;e>0;e--){const n=t.node(e);if("heading"===n.type.name)return{name:"heading",level:n.attrs.level};if("paragraph"===n.type.name)return{name:"paragraph"}}return{name:"paragraph"}},insert_table:(t=3,e=3)=>{const n=function(t,e,n){const r=(0,f.e)(t),o=r.table,s=r.row,a=r.cell,c=r.header_cell??r.cell;if(!o||!s||!a)return null;const i=t=>s.create(null,Array.from({length:e},()=>t.createAndFill())),l=i(c),d=Array.from({length:n},()=>i(a));return o.create(null,[l,...d])}(O.state.schema,t,e);if(!n)return;const{from:r}=O.state.selection,o=O.state.doc.resolve(r);let s=r;for(let t=o.depth;t>0;t--)if("table"===o.node(t).type.name){s=o.after(t);break}const a=O.state.tr;s===r?a.replaceSelectionWith(n):a.insert(s,n),O.dispatch(a.scrollIntoView());const c=O.state.doc.resolve(Math.min(s+3,O.state.doc.content.size));try{O.dispatch(O.state.tr.setSelection(O.state.selection.constructor.near(c)))}catch{}},get_headings:()=>function(t){const e=[];return t.doc.descendants((t,n)=>("heading"!==t.type.name||e.push({level:t.attrs.level,text:t.textContent,pos:n}),!0)),e}(O.state),scroll_to_pos:t=>{const e=O.state.doc.content.size,n=Math.max(0,Math.min(t,e)),r=O.state.doc.nodeAt(n);let o;try{o=r?c.U3.near(O.state.doc.resolve(n+1),1):c.U3.near(O.state.doc.resolve(n),1)}catch{o=c.U3.near(O.state.doc.resolve(0),1)}O.dispatch(O.state.tr.setSelection(o)),it(O,o.from),O.focus()},is_source_mode:()=>ut(O.state.doc),enter_source_mode:()=>{if(ut(O.state.doc))return;const t=C(O.state.doc),e=O.state.schema.nodes.code_block.create({language:"markdown"},t?O.state.schema.text(t):null),n=O.state.tr;n.replaceWith(0,O.state.doc.content.size,e),O.dispatch(n),O.dom.classList.add("md-source-mode")},exit_source_mode:()=>{if(!ut(O.state.doc))return;const t=$(O.state.doc.textContent),e=O.state.tr;e.replaceWith(0,O.state.doc.content.size,t.content),O.dispatch(e),O.dom.classList.remove("md-source-mode")}};return"function"==typeof e?e(N):e&&(e.current=N),t.on_ready?.(N),()=>{S.disconnect(),y.removeEventListener("error",s,!0),y.removeEventListener("load",a,!0),O.destroy(),k.current=null}},[]),(0,st.jsx)("div",{className:"md-filecat",ref:_})});function ut(t){if(1!==t.childCount)return!1;const e=t.firstChild;return!!e&&"code_block"===e.type.name&&"markdown"===e.attrs.language}function ht(t,e){const n=t.resolve(e);for(let t=n.depth;t>0;t--)if("code_block"===n.node(t).type.name)return!0;return!1}const pt=dt},67951(t,e,n){n.d(e,{CF:()=>g,G8:()=>_,NH:()=>u,Rx:()=>b,Vu:()=>f,fK:()=>p,k5:()=>l,oB:()=>m,uf:()=>h,x0:()=>d});var r=n(38341),o=n(5091),s=n(42845),a=n(46762),c=n(3772);function i(t,e){return new r.fV(t,(t,n,r,o)=>{const s=t.schema.marks[e],a=n[1];if(!s||!a)return null;const c=n[0].indexOf(a);if(c<0)return null;const i=r+c,l=i+a.length,d=t.tr;return d.delete(l,o),d.delete(r,i),d.addMark(r,r+a.length,s.create()),d.removeStoredMark(s),d})}function l(){const t=o.Y;return(0,r.sM)({rules:[(0,r.JJ)(/^(#{1,6})\s$/,t.nodes.heading,t=>({level:t[1].length})),(0,r.JJ)(/^#([1-6])\s$/,t.nodes.heading,t=>({level:Number(t[1])})),(0,r.JJ)(/^```([\w-]*)\s$/,t.nodes.code_block,t=>({language:t[1]??""})),(0,r.tG)(/^\s*>\s$/,t.nodes.blockquote),(0,r.tG)(/^\s*([-+*])\s$/,t.nodes.bullet_list),(0,r.tG)(/^(\d+)\.\s$/,t.nodes.ordered_list,t=>({order:Number(t[1])})),i(/(?:\*\*)([^*]+)(?:\*\*)$/,"strong"),i(/(?:__)([^_]+)(?:__)$/,"strong"),i(/(?<![*])\*([^*]+)\*$/,"em"),i(/(?<![_])_([^_]+)_$/,"em"),i(/(?:~~)([^~]+)(?:~~)$/,"strike"),i(/(?:`)([^`]+)(?:`)$/,"code"),new r.fV(/!\[([^\]]*)\]\(([^)\s]+)\)$/,(t,e,n,r)=>{const o=e[1]??"",s=e[2];return s?t.tr.replaceWith(n,r,t.schema.nodes.image.create({src:s,alt:o})):null}),...r.Fr,r.gO]})}const d=(t,e)=>{const{$from:n,empty:r}=t.selection;if(!r||"paragraph"!==n.parent.type.name)return!1;const o=n.parent.textContent;if(!o.trim())return!1;const a=function(t){const e=t.trim(),n=/^#([1-6])$/.exec(e);if(n)return{type:"heading",attrs:{level:Number(n[1])}};const r=/^(#{1,6})$/.exec(e);if(r)return{type:"heading",attrs:{level:r[1].length}};const o=/^```([\w-]*)$/.exec(e);return o?{type:"code_block",attrs:{language:o[1]??""}}:/^(?:-{3,}|\*{3,}|_{3,})$/.test(e.replace(/\s+/g,""))?{type:"horizontal_rule"}:/^>\s*$/.test(e)?{type:"blockquote"}:/^[-+*]\s*$/.test(e)?{type:"bullet_list"}:/^\d+[.)]$/.test(e)?{type:"ordered_list"}:null}(o);if(!a)return!1;if("blockquote"===a.type&&n.depth>1)return!1;const c=t.schema.nodes[a.type];if(!c)return!1;const i=n.before(n.depth),l=n.after(n.depth);if(e){const n=t.tr,r=c.createAndFill(a.attrs)??c.create(a.attrs);n.replaceWith(i,l,r);const o=Math.min(i+1,n.doc.content.size);try{n.setSelection(s.U3.near(n.doc.resolve(o),1))}catch{}n.scrollIntoView(),e(n)}return!0};function u(t){return(e,n)=>{const r=e.schema.marks[t];return!!r&&(0,a.wh)(r)(e,n)}}function h(t,e={}){return(n,r)=>{const o=n.schema.nodes[t];if(!o)return!1;const{$from:s,$to:a}=n.selection,c=s.blockRange(a);if(!c)return!1;const i=s.parent,l=i.type===o&&Object.entries(e).every(([t,e])=>i.attrs[t]===e),d=l?n.schema.nodes.paragraph:o,u=l?{}:e;return r&&r(n.tr.setBlockType(c.start,c.end,d,u)),!0}}const p=(t,e)=>(0,c.Sd)(t.schema.nodes.bullet_list)(t,e),m=(t,e)=>(0,c.Sd)(t.schema.nodes.ordered_list)(t,e),f=(t,e)=>{const{blockquote:n}=t.schema.nodes,{$from:r,$to:o}=t.selection,s=r.blockRange(o);if(!s)return!1;if(s.parent.type===n&&s.depth>0){const n=r.before(s.depth),o=t.tr.doc.nodeAt(n);if(o&&1===o.childCount)return e&&e(t.tr.replaceWith(n,n+o.nodeSize,o.child(0)).scrollIntoView()),!0;if(e){const n=t.tr,o=r.parent,a=r.after(s.depth);n.delete(s.start,s.end),n.insert(a,o),e(n.scrollIntoView())}return!0}return e&&e(t.tr.wrap(s,[{type:n}]).scrollIntoView()),!0},g=(t,e)=>{const{$from:n}=t.selection,{list_item:r,paragraph:o}=t.schema.nodes;return 3===n.depth&&(n.node(-1).type===r&&n.parent.type===o&&(0===n.parent.content.size&&(1===n.node(-1).childCount&&(0,c.T2)(r)(t,e))))},_={sink:(0,c.$B)(o.Y.nodes.list_item),lift:(0,c.T2)(o.Y.nodes.list_item),split:(0,c.wn)(o.Y.nodes.list_item),wrap_bullet:p,wrap_ordered:m},b=(t,e)=>{const{$from:n}=t.selection;return"code_block"===n.parent.type.name&&(e&&e(t.tr.setSelection(s.U3.create(t.doc,n.start(),n.end())).scrollIntoView()),!0)}},96763(t,e,n){n.d(e,{Kz:()=>a,P7:()=>l,_8:()=>h,_D:()=>u,bN:()=>s,o3:()=>c,sO:()=>d});var r=n(14284),o=n(53459);function s(t,e){const n="md-theme-style-"+t,r=document.getElementById(n);if(!e)return void r?.remove();let o=r;o||(o=document.createElement("style"),o.id=n,document.head.appendChild(o)),o.textContent=e}async function a(){try{const t=await r.XO.get("md_theme/list");return t?.code===o.m.Success?t.data??[]:[]}catch(t){return[]}}const c="md-theme-change";function i(){window.dispatchEvent(new Event(c))}async function l(t){try{const e=await r.XO.get(`md_theme/get?id=${encodeURIComponent(t)}`);return e?.code===o.m.Success?e.data??"":""}catch(t){return""}}async function d(){try{const t=await r.XO.get("md_theme/active");return t?.code===o.m.Success?t.data??"":""}catch(t){return""}}async function u(t){const e=await r.XO.post("md_theme/save",t);return e?.code!==o.m.Success?null:(i(),e.data)}async function h(t){const e=await r.XO.post("md_theme/del",{id:t});return e?.code===o.m.Success&&(i(),!0)}},5091(t,e,n){n.d(e,{Y:()=>u});var r=n(58903),o=n(86059),s=n(41105),a=n(99724);const c=(0,o.of)({tableGroup:"block",cellContent:"block+",cellAttributes:{}}),i={align:{default:null}},l={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:i,parseDOM:[{tag:"p"}],toDOM:t=>["p",t.attrs.align?{style:`text-align:${t.attrs.align}`}:{},0]},heading:{content:"inline*",group:"block",attrs:{level:{default:1},...i},defining:!0,parseDOM:[1,2,3,4,5,6].map(t=>({tag:`h${t}`,attrs:{level:t}})),toDOM(t){const e=t.attrs.align?{style:`text-align:${t.attrs.align}`}:{};return[`h${t.attrs.level}`,e,0]}},bullet_list:{group:"block",content:"list_item+",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},ordered_list:{group:"block",content:"list_item+",attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:t=>({order:Number(t.getAttribute("start")??1)})}],toDOM:t=>1===t.attrs.order?["ol",0]:["ol",{start:t.attrs.order},0]},list_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:null}},parseDOM:[{tag:"li",getAttrs:t=>{const e=t,n=e.querySelector("input[type=checkbox]");if(n)return{checked:n.checked};const r=e.getAttribute("data-checked");return{checked:null===r?null:"true"===r}}}],toDOM:t=>null!==t.attrs.checked?["li",{"data-checked":String(t.attrs.checked)},0]:["li",0]},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},code_block:{content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>{const e=t.querySelector("code"),n=/language-([\w-]+)/.exec(e?.className??"");return{language:n?n[1]:""}}}],toDOM:t=>["pre",{"data-language":t.attrs.language},["code",0]]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},html_block:{group:"block",atom:!0,code:!0,attrs:{value:{default:""}},parseDOM:[{tag:"div[data-html-block]",getAttrs:t=>({value:(0,s.Ne)(t.getAttribute("data-html-block")??"")})}],toDOM:t=>["div",{"data-html-block":t.attrs.value}]},html_inline:{inline:!0,group:"inline",atom:!0,code:!0,attrs:{value:{default:""}},parseDOM:[{tag:"span[data-html-inline]",getAttrs:t=>({value:(0,s.Ne)(t.getAttribute("data-html-inline")??"")})}],toDOM:t=>["span",{"data-html-inline":t.attrs.value}]},math_inline:{inline:!0,group:"inline",atom:!0,attrs:{raw:{default:""},tex:{default:""}},parseDOM:[{tag:"span[data-math-inline]",getAttrs:t=>{const e=t,n=(0,s.Ne)(e.getAttribute("data-math-inline")??"");return{raw:n,tex:(0,a.V)(n)?.tex??""}}}],toDOM:t=>["span",{"data-math-inline":t.attrs.raw}]},math_block:{group:"block",atom:!0,code:!0,attrs:{raw:{default:""},tex:{default:""}},parseDOM:[{tag:"div[data-math-block]",getAttrs:t=>{const e=t,n=(0,s.Ne)(e.getAttribute("data-math-block")??"");return{raw:n,tex:(0,a.V)(n)?.tex??""}}}],toDOM:t=>["div",{"data-math-block":t.attrs.raw}]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},image:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:t=>{const e=t;return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title")}}}],toDOM(t){const{src:e,alt:n,title:r}=t.attrs,o={src:(0,s.KR)(e)};return n&&(o.alt=n),r&&(o.title=r),["img",o]}},text:{group:"inline"},...c},d={strong:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight=bold"}],toDOM:()=>["strong",0]},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"}],toDOM:()=>["s",0]},code:{parseDOM:[{tag:"code",getAttrs:t=>"PRE"!==t.parentElement?.tagName&&null}],toDOM:()=>["code",0]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:t=>{const e=t;return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM(t){const{href:e,title:n}=t.attrs;return["a",{href:e,title:n,rel:"noopener noreferrer",target:"_blank"},0]}}},u=new r.Sj({nodes:l,marks:d})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1142],{71142(e,t,r){r.r(t),r.d(t,{default:()=>ae});var n=r(96540),s=r(7523),o=r(34843),c=r(82893),i=r(78247),l=r(23430),u=r(85997),a=r(57952),d=r(62042),m=r(53459),f=r(14284),_=r(57889),v=r(23496),h=r(22022),p=r(76118),g=r(67951),w=r(74848);function x(e){const{t}=(0,h.Bd)(),r=(0,n.useRef)(null),[s,o]=(0,n.useState)({marks:[],block:{name:"paragraph"}}),[c,i]=(0,n.useState)(null),l=(0,n.useCallback)(()=>{const t=e.get_view();if(!t)return;const r=t.state.selection,n=t.state.storedMarks??r.$from.marks();if(o({marks:n.map(e=>e.type.name),block:k(r.$from)}),r.empty)return void i(null);const s=t.coordsAtPos(r.from),c=t.coordsAtPos(r.to),l=(Math.min(s.left,c.left)+Math.max(s.right,c.right))/2,u=Math.min(s.top,c.top),a=Math.max(s.bottom,c.bottom);i({top:u,bottom:a,left:l})},[e.get_view]);(0,n.useEffect)(()=>{l();const t=e.get_view();if(!t)return;const r=()=>l();t.dom.addEventListener("keyup",r),t.dom.addEventListener("mouseup",r),document.addEventListener("selectionchange",r);const n=t.dom.closest(".md-editor-context");return n?.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),()=>{t.dom.removeEventListener("keyup",r),t.dom.removeEventListener("mouseup",r),document.removeEventListener("selectionchange",r),n?.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[l,e.get_view,e.refresh_key]);const u=t=>{const r=e.get_view();r&&(t(r.state,r.dispatch),r.focus(),l())},a=e=>s.marks.includes(e),d=e=>"heading"===s.block.name&&s.block.level===e,[m,f]=(0,n.useState)({w:0,h:36});if((0,n.useLayoutEffect)(()=>{if(!c||!r.current)return;const e=r.current.offsetWidth,t=r.current.offsetHeight;f(r=>r.w===e&&r.h===t?r:{w:e,h:t})},[c,e.refresh_key]),!c)return null;const _=(e,r,n,s,o=!1)=>(0,w.jsx)("button",{className:"mdtb__btn"+(o?" mdtb__btn--on":""),title:t(n),onMouseDown:e=>e.preventDefault(),onClick:s,children:r},e),v=m.w/2,p=v+4,x=Math.max(p,window.innerWidth-v-4),y=document.querySelector(".header")?.getBoundingClientRect().bottom??0,b=c.top-m.h-8,E=b<y+4,j={top:E?Math.min(c.bottom+8,window.innerHeight-m.h-4):b,left:Math.min(x,Math.max(p,c.left))};return(0,w.jsxs)("div",{className:"mdtb mdtb--floating"+(E?" mdtb--below":""),ref:r,style:j,children:[_("h1","H1","一级标题",()=>u((0,g.uf)("heading",{level:1})),d(1)),_("h2","H2","二级标题",()=>u((0,g.uf)("heading",{level:2})),d(2)),_("h3","H3","三级标题",()=>u((0,g.uf)("heading",{level:3})),d(3)),(0,w.jsx)("span",{className:"mdtb__sep"}),_("b","B","加粗",()=>u((0,g.NH)("strong")),a("strong")),_("i","I","斜体",()=>u((0,g.NH)("em")),a("em")),_("s","S","删除线",()=>u((0,g.NH)("strike")),a("strike")),_("code","</>","行内代码",()=>u((0,g.NH)("code")),a("code")),(0,w.jsx)("span",{className:"mdtb__sep"}),_("ul","≔","无序列表",()=>u(g.fK)),_("ol","1.","有序列表",()=>u(g.oB)),_("quote","❝","引用",()=>u(g.Vu))]})}function k(e){for(let t=e.depth;t>0;t--){const r=e.node(t).type.name;if("heading"===r)return{name:"heading",level:e.node(t).attrs.level};if("paragraph"===r)return{name:"paragraph"}}return{name:"paragraph"}}var y=r(42845),b=r(75725),E=r(86059);const j="cut",S="copy",C="paste",N="strong",L="em",R="strike",A="code",H="h1",M="h2",G="h3",z="paragraph",B="bullet",$="ordered",F="quote",D="code_block",K="clean",P="row_before",T="row_after",U="row_delete",W="col_before",Y="col_after",X="col_delete",q="header_toggle",I="cell_merge",V="cell_split",J="table_delete",O="table_insert",Z="select_all";function Q(e){const{t}=(0,h.Bd)(),[r,s]=(0,n.useState)(null),o=(0,n.useRef)(e.get_view);o.current=e.get_view,(0,n.useEffect)(()=>{const e=e=>{const t=o.current();if(!t)return;const r=e.target;if(!r||!r.closest(".md-filecat-content"))return;e.preventDefault();const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(n){const e=t.state.selection;if(n.pos<e.from||n.pos>e.to)try{t.dispatch(t.state.tr.setSelection(y.U3.near(t.state.doc.resolve(n.pos))))}catch{}}const c=!!r.closest("td, th");s({x:e.clientX,y:e.clientY,in_table:c||(0,E.aH)(t.state)})};return document.addEventListener("contextmenu",e,!0),()=>document.removeEventListener("contextmenu",e,!0)},[]);const c=()=>s(null),i=(0,n.useCallback)(e=>{const t=o.current();t&&(e(t.state,t.dispatch),t.focus(),c())},[]),l=e=>{const t=o.current();t?.focus(),document.execCommand(e),c()};if(!r)return null;const u=r.in_table?[{r:t("上方插入行"),v:P},{r:t("下方插入行"),v:T},{r:t("左侧插入列"),v:W},{r:t("右侧插入列"),v:Y},{r:t("删除行"),v:U},{r:t("删除列"),v:X},{r:t("切换表头行"),v:q},{r:t("合并单元格"),v:I},{r:t("拆分单元格"),v:V},{r:t("删除表格"),v:J}]:[],a=[{r:t("剪切"),v:j},{r:t("复制"),v:S},{r:t("粘贴"),v:C},{r:t("格式"),v:"format",items:[{r:t("加粗"),v:N},{r:t("斜体"),v:L},{r:t("删除线"),v:R},{r:t("行内代码"),v:A}]},{r:t("段落"),v:"block",items:[{r:t("一级标题"),v:H},{r:t("二级标题"),v:M},{r:t("三级标题"),v:G},{r:t("正文"),v:z}]},{r:t("插入"),v:"insert",items:[{r:t("无序列表"),v:B},{r:t("有序列表"),v:$},{r:t("引用"),v:F},{r:t("代码块"),v:D},{r:t("插入表格"),v:O}]},...u.length?[{r:t("表格"),v:"table",items:u}]:[],{r:t("清除格式"),v:K},{r:t("全选"),v:Z}];return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(b.rY,{click:c}),(0,w.jsx)(b.sw,{x:r.x,y:r.y,items:a,click:t=>{switch(t){case j:return l("cut");case S:return l("copy");case C:return l("paste");case N:return i((0,g.NH)("strong"));case L:return i((0,g.NH)("em"));case R:return i((0,g.NH)("strike"));case A:return i((0,g.NH)("code"));case H:return i((0,g.uf)("heading",{level:1}));case M:return i((0,g.uf)("heading",{level:2}));case G:return i((0,g.uf)("heading",{level:3}));case z:return i((0,g.uf)("paragraph"));case B:return i(g.fK);case $:return i(g.oB);case F:return i(g.Vu);case D:return i((0,g.uf)("code_block"));case O:return c(),void e.on_insert_table?.();case P:return i(E.JD);case T:return i(E.gC);case W:return i(E.RC);case Y:return i(E.GU);case U:return i(E.aR);case X:return i(E.gR);case q:return i(E.uC);case I:return i(E.w7);case V:return i(E.L0);case J:return i(E.kG);case K:return i((e,t)=>{const{from:r,to:n}=e.selection;let s=e.tr;return e.doc.nodesBetween(r,n,(e,t)=>{if(e.isText)for(const r of e.marks)s=s.removeMark(t,t+e.nodeSize,r.type)}),t?.(s),!0});case Z:return i((e,t)=>{const{TextSelection:r}=e.selection.constructor;return t?.(e.tr.setSelection(r.create(e.doc,0,e.doc.content.size))),!0})}}})]})}var ee=r(64877);function te(e){const t=[];if(!e)return t;const r=e.split(/(\n)/);let n=null,s=0;for(let e=0;e<r.length;e+=2){const o=r[e],c=s;s+=o.length+(r[e+1]?.length??0);const i=o.endsWith("\r")?o.slice(0,-1):o,l=i.trimStart(),u=/^(`{3,}|~{3,})/.exec(l);if(u){const e=u[1][0];null===n?n=e:n===e&&(n=null);continue}if(null!==n)continue;const a=/^ {0,3}(#{1,6})\s+(.*)$/.exec(i);if(!a)continue;const d=a[1].length,m=a[2].replace(/\s+#+\s*$/,"").trim();t.push({level:d,text:m,pos:c})}return t}var re=r(69918),ne=r(96763),se=r(40505);function oe(e){const{t}=(0,h.Bd)(),[r,s]=(0,n.useState)(!1),[i,l]=(0,n.useState)({x:0,y:0}),[a,d]=(0,n.useState)([]),[m]=(0,o.fp)(c.AG.user_base_info);(0,n.useEffect)(()=>{if(!r)return;let e=!1;return(0,ne.Kz)().then(t=>{e||d(t)}),()=>{e=!0}},[r]);const f=(e,t)=>(0,w.jsx)("div",{style:{...(0,se.ok)(t===m?.user_data?.md_editor_theme)},children:e});return(0,w.jsxs)(n.Fragment,{children:[(0,w.jsx)(u.rA,{icon:"palette",title:t("主题"),onClick:e=>{l({x:e.clientX,y:e.clientY}),s(!0)}}),r&&(0,w.jsx)(b.rY,{click:()=>s(!1),children:(0,w.jsx)(b.sw,{x:i.x,y:i.y,items:[{r:f(t("follow_sys"),""),v:""},...a.map(e=>({r:f(e.id,e.id),v:e.id}))],click:t=>{s(!1),e.on_change(t)}})})]})}var ce=r(2543),ie=r(52671),le=r(87361),ue=r(93245);function ae(e){const t=e.pane,{t:r}=(0,h.Bd)(),g=(0,ie.Zp)(),{check_user_auth:k}=(0,i.MH)(),y=k(l.oV.md_editor_setting),[b,E]=(0,o.fp)(c.AG.md_editor),j=t??b,S=(0,o.fp)(c.AG.md_editor_last_context)[1],C=(0,n.useRef)(null),[N,L]=(0,n.useState)(null),[R,A]=(0,n.useState)(!1),[H,M]=(0,n.useState)(!1),[G,z]=(0,n.useState)(0),B=(0,n.useRef)(null),[$,F]=(0,n.useState)([]),[D,K]=(0,n.useState)(-1),[P,T]=(0,n.useState)(15),[U,W]=(0,n.useState)(!1),Y=(0,n.useRef)(null),X=(0,n.useRef)(null),[q,I]=(0,o.fp)(c.AG.md_editor_show_outline),[V,J]=(0,o.fp)(c.AG.md_editor_mode),O=(0,n.useCallback)(()=>{const e="wysiwyg"===V?"source":"wysiwyg",t=B.current;t&&("source"===e?t.enter_source_mode():t.exit_source_mode(),J(e))},[V]),[Z]=(0,o.fp)(c.AG.md_editor_setting),[se,ae]=(0,o.fp)(c.AG.md_theme_css),[de]=(0,o.fp)(c.AG.user_base_info),{initUserInfo:me}=(0,n.useContext)(s.F),fe=(0,n.useRef)(null),_e=(0,n.useRef)(null);(0,n.useEffect)(()=>{_e.current},[de]),(0,n.useEffect)(()=>{(0,re.Ce)(Y.current,Z)},[Z]);(0,n.useEffect)(()=>{(0,ne.bN)("editor",se)},[se]),(0,n.useEffect)(()=>{const e=()=>{(0,ne.sO)().then(ae)};return window.addEventListener(ne.o3,e),()=>window.removeEventListener(ne.o3,e)},[]);const ve=(0,n.useRef)([]),he=(0,n.useCallback)(()=>{const e=B.current;if(!e)return;const t=e.is_source_mode()?te(e.get_markdown()):e.get_headings();ve.current=t,F(t)},[]);(0,n.useEffect)(()=>{t?.on_outline?.($,D)},[$,D]);const pe=(0,n.useCallback)(()=>{const e=B.current,t=e?.get_view();if(!e||!t)return;const r=e.is_source_mode()?t.state.selection.from-1:t.state.selection.from;let n=-1;for(const e of ve.current){if(!(e.pos<=r))break;n=e.pos}K(n)},[]);(0,n.useEffect)(()=>{let e=!1;if(j?.url)return M(!1),A(!0),_.l.get(j.url).then(t=>{if(e)return;L(t??"")}).catch(()=>{e||((0,d.zN)(r("打开失败")),L(""))}).finally(()=>{e||A(!1)}),()=>{e=!0};L(null)},[j?.url]),(0,n.useEffect)(()=>{const e=()=>z(e=>e+1);return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[]);const ge=(0,n.useRef)(O);ge.current=O,(0,n.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"/"===e.key&&(e.preventDefault(),e.stopPropagation(),ge.current())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,n.useEffect)(()=>{he(),pe()},[G,V,he,pe]);const we=(0,n.useCallback)(ce.throttle(e=>{if(!Y.current||!X.current)return;const t=parseFloat(getComputedStyle(Y.current).fontSize),r=e.clientX/t,n=window.innerWidth/t-4,s=2.25+X.current.offsetWidth/t;r<=n&&r>=s&&T(parseFloat(r.toFixed(2)))},32),[]),xe=()=>{W(!1),Y.current?.removeEventListener("pointermove",we)},ke=e=>{const t=B.current;t&&(t.scroll_to_pos(t.is_source_mode()?e.pos+1:e.pos),K(e.pos))},ye=async(e=!1)=>{if(!j?.name||!j?.path)return;const t=B.current?.get_markdown();if(void 0===t)return;const n=j.path.slice(0,j.path.length-j.name.length),s=`${encodeURIComponent(n)}${j.name}`;(await f.$M.post(`save/${s}`,{context:t})).code===m.m.Success?(M(!1),e||(0,d.SK)(r("保存成功"))):(0,d.zN)(r("保存失败"))},be=(0,n.useRef)(ye);be.current=ye;const Ee=(0,n.useRef)(H),je=(0,n.useRef)(null);Ee.current=H,(0,ue.a)(l.nE.md,()=>Ee.current,e=>ye(e),j.readonly);const Se=()=>{window.print()},Ce=(0,n.useRef)(V);Ce.current=V;const Ne=(0,n.useRef)(ke);Ne.current=ke;const Le=(0,n.useRef)(Se);Le.current=Se,(0,n.useEffect)(()=>{t?.on_dirty?.(H)},[H]),(0,n.useEffect)(()=>{t?.register?.({save:e=>be.current(e),export_pdf:()=>Le.current(),toggle_mode:()=>ge.current(),mode:()=>Ce.current,goto_heading:e=>Ne.current(e),dirty:()=>Ee.current,get_scroll:()=>je.current?.scrollTop??0,set_scroll:e=>{const t=je.current;t&&(t.scrollTop=e)}})},[]);const Re=()=>{E({}),M(!1),L(null),B.current=null,b?.close?.()},Ae=(0,n.useMemo)(()=>j?.url??"md_editor",[j?.url]);if(!j?.name)return null;const He=!!t,Me=(0,w.jsxs)("div",{className:"md-editor-context",ref:Y,children:[R&&(0,w.jsxs)("div",{className:"common-box common-box-center",children:[r("加载中"),"..."]}),!R&&null!==N&&(0,w.jsxs)(n.Fragment,{children:[!He&&q&&(0,w.jsx)("div",{className:"md-outline-panel",style:{width:`${P}em`},children:(0,w.jsx)(ee.default,{items:$,active_pos:D,on_click:ke})}),!He&&q&&(0,w.jsx)("div",{className:"md-editor-divider",ref:X,onPointerDown:()=>{W(!0),Y.current?.addEventListener("pointermove",we)},onPointerUp:xe}),!He&&U&&(0,w.jsx)("div",{className:"md-editor-drag-overlay",onPointerUp:xe}),(0,w.jsx)("div",{className:"md-editor-scroll",ref:je,children:(0,w.jsxs)("div",{className:"md-editor-sheet",children:["wysiwyg"===V&&(0,w.jsx)(x,{get_view:()=>B.current?.get_view()??null,refresh_key:G}),(0,w.jsx)(p.A,{value:N,ref:B,initial_source_mode:"source"===V,doc_path:j?.path,on_ready:e=>{const t=e.is_source_mode()?te(e.get_markdown()):e.get_headings();ve.current=t,F(t),K(-1)},on_change:()=>{H||M(!0),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{const e=B.current?.get_markdown()??"";e&&S(e)},800)},on_save:()=>be.current(),on_selection_change:()=>z(e=>e+1),on_source_mode_change:e=>{J(e?"source":"wysiwyg"),z(e=>e+1)}},Ae),"wysiwyg"===V&&(0,w.jsx)(Q,{get_view:()=>B.current?.get_view()??null,on_insert_table:()=>{B.current?.insert_table(3,3),M(!0)}})]})})]})]});return He?Me:(0,w.jsxs)("div",{id:"md-editor-container",ref:fe,children:[(0,w.jsx)(a.A,{ignore_tags:!0,left_children:[(0,w.jsx)(u.rA,{title:r("关闭"),icon:"close",onClick:Re},1),(0,w.jsx)("div",{className:"md-editor-title",children:j.name},3),...H&&!j.readonly?[(0,w.jsx)(u.rA,{title:r("保存"),icon:"save",onClick:ye},2)]:[],(0,w.jsx)(u.rA,{title:r("大纲"),icon:"list",onClick:()=>I(e=>!e),selected:q},4),...j.readonly?[]:[(0,w.jsx)(u.rA,{title:r("wysiwyg"===V?"源码模式":"实时编辑模式"),icon:"wysiwyg"===V?"code":"edit",onClick:O},5)],...j.readonly?[]:[(0,w.jsx)(oe,{on_change:async e=>{const t=await f.wm.post(v.s.user_save_private_attr,{is_md_theme:!0,md_editor_theme:e});t?.code===m.m.Success?(_e.current=e,await me(),(0,d.SK)(r("保存成功"))):(0,d.zN)(r("保存失败"))}},8)],(0,w.jsx)(u.rA,{title:r("导出PDF"),icon:"print",onClick:Se},7),...y&&!j.readonly?[(0,w.jsx)(u.rA,{title:r("编辑器设置"),icon:"settings",onClick:()=>{Re(),g(le.o.md_editor_setting_page)}},6)]:[]]}),Me]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1448],{74777(e,t,i){i.d(t,{Gd:()=>n,Hb:()=>s,Mu:()=>r,aM:()=>l,jk:()=>a});let l=function(e){return e[e.close=0]="close",e[e.length=1]="length",e[e.forver=2]="forver",e}({}),s=function(e){return e[e.independent=0]="independent",e[e.reuse=1]="reuse",e[e.single=2]="single",e}({});class n{mode;length;persist;session_mode}let a=function(e){return e.ffmpeg="ffmpeg",e.smartmontools="smartctl",e.ufw="ufw",e}({});let r=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}({})},11448(e,t,i){i.r(t),i.d(t,{PLATFORM_META:()=>b,RebotCard:()=>v,RebotCardContainer:()=>f,default:()=>y});var l=i(22022),s=i(96540),n=i(85997),a=i(4412),r=i(75725),c=i(61443),d=i(7572),o=i(14284),p=i(53459),h=i(62042),m=i(78247),x=i(23430),u=i(52671),j=i(92350),_=i(74848);const b={qq:{key:"qq",label:"QQ 机器人",icon:"QQ",color:"#12B7F5",fields:[{key:"appId",label:"AppId",type:"text",placeholder:"请输入机器人 AppId",required:!0},{key:"clientSecret",label:"密钥",type:"password",placeholder:"请输入机器人密钥",required:!0}]},dingtalk:{key:"dingtalk",label:"钉钉机器人",icon:"钉钉",color:"#0089FF",fields:[{key:"appId",label:"ClientId (AppKey)",type:"text",placeholder:"请输入应用 ClientId",required:!0},{key:"clientSecret",label:"ClientSecret (AppSecret)",type:"password",placeholder:"请输入应用 ClientSecret",required:!0}]},wecom:{key:"wecom",label:"企业微信机器人",icon:"企业微信",color:"#07C160",fields:[{key:"appId",label:"botId",type:"text",placeholder:"请输入机器人 botId",required:!0},{key:"clientSecret",label:"Secret",type:"password",placeholder:"请输入机器人 Secret",required:!0}]},lark:{key:"lark",label:"飞书机器人",icon:"飞书",color:"#3370FF",fields:[{key:"appId",label:"App ID",type:"text",placeholder:"请输入应用 App ID",required:!0},{key:"clientSecret",label:"App Secret",type:"password",placeholder:"请输入应用 App Secret",required:!0}]}},g=Object.entries(b).map(([e,t])=>({value:e,title:t.label,color:t.color}));function f(e){const{t}=(0,l.Bd)(),[i,a]=(0,s.useState)(!1),[r,d]=(0,s.useState)(!1),o=(t,i)=>{const l=[...e.items];l[t]={...l[t],...i},e.setItems(l)},p=t=>{const i=[...e.items];i.splice(t,1),e.setItems(i)},h=t=>{e.setItems([...e.items,{...e.items[t],open:!1,name:(e.items[t].name||"")+" (副本)"}])};return(0,_.jsxs)(s.Fragment,{children:[(0,_.jsx)("div",{className:"airebot-setting__toolbar",children:!1!==e.have_auth_edit&&(0,_.jsxs)(_.Fragment,{children:[i?(0,_.jsxs)("div",{className:"airebot-setting__add-select",children:[(0,_.jsx)(c.l6,{options:g,defaultValue:"qq",onChange:t=>{return i=t,e.setItems([...e.items,{platform:i,name:"",open:!1,appId:"",clientSecret:"",note:""}]),void a(!1);var i},width:"180px"}),(0,_.jsx)(n.rA,{icon:"cancel",title:t("取消"),onClick:()=>a(!1)})]}):(0,_.jsx)(n.rA,{icon:"add",title:t("添加机器人"),onClick:()=>a(!0)}),(0,_.jsx)(n.rA,{icon:"save",title:t(r?"保存中...":"保存"),onClick:()=>{r||(async()=>{d(!0),await e.save(),d(!1)})()}})]})}),0===e.items.length?(0,_.jsxs)("div",{className:"airebot-setting__empty",children:[(0,_.jsx)("span",{className:"material-symbols-outlined airebot-setting__empty-icon",children:"smart_toy"}),(0,_.jsx)("p",{children:t("还没有配置任何机器人")}),(0,_.jsx)("p",{className:"airebot-setting__empty-hint",children:t("点击上方「添加机器人」按钮来开始配置")})]}):(0,_.jsx)("div",{className:"airebot-setting__grid",children:e.items.map((e,t)=>(0,_.jsx)(v,{item:e,index:t,onChange:o,onDelete:p,onCopy:h},t))})]})}const v=({item:e,index:t,onChange:i,onDelete:s,onCopy:a})=>{const{t:r}=(0,l.Bd)(),o=b[e.platform]??b.qq,p=e._status||"disconnected";e.open;return(0,_.jsx)(d.Zp,{self_title:(0,_.jsx)("div",{className:"airebot-setting__card-header",children:(0,_.jsx)("span",{className:"material-symbols-outlined airebot-setting__card-icon",style:{color:o.color},children:o.icon})}),rightTopCom:(0,_.jsxs)("div",{className:"airebot-setting__card-actions",children:[(0,_.jsx)(n.Ay,{checked:!!e.open,onChange:e=>i(t,{open:e})}),(0,_.jsx)(n.rA,{icon:"content_copy",title:r("复制"),onClick:()=>a(t)}),(0,_.jsx)(n.rA,{icon:"delete",title:r("删除"),onClick:()=>s(t)})]}),children:(0,_.jsxs)("div",{className:"airebot-setting__card-fields",children:[(0,_.jsxs)("div",{className:"airebot-setting__field",children:[(0,_.jsx)("label",{className:"airebot-setting__field-label",children:r("平台")}),(0,_.jsx)(c.l6,{options:g,value:e.platform,onChange:e=>i(t,{platform:e}),width:"100%"})]}),(0,_.jsxs)("div",{className:"airebot-setting__field",children:[(0,_.jsx)("label",{className:"airebot-setting__field-label",children:r("名称")}),(0,_.jsx)(c.Sm,{value:e.name||"",handleInputChange:e=>i(t,{name:e}),placeholder:r("给机器人起个名字")})]}),o.fields.map(l=>{const s=e[l.key]??"";return(0,_.jsxs)("div",{className:"airebot-setting__field",children:[(0,_.jsxs)("label",{className:"airebot-setting__field-label",children:[l.label,l.required&&(0,_.jsx)("span",{className:"airebot-setting__field-required",children:"*"})]}),(0,_.jsx)(c.Sm,{type:l.type,value:s,handleInputChange:e=>i(t,{[l.key]:e}),placeholder:l.placeholder})]},l.key)}),(0,_.jsxs)("div",{className:"airebot-setting__field ",children:[(0,_.jsx)("label",{className:"airebot-setting__field-label",children:r("模型编号")}),(0,_.jsx)(c.Sm,{value:e.model_index,handleInputChange:e=>i(t,{model_index:e}),placeholder:r("使用指定模型(可选)")})]}),(0,_.jsxs)("div",{className:"airebot-setting__field ",children:[(0,_.jsx)("label",{className:"airebot-setting__field-label",children:r("用户id")}),(0,_.jsx)(c.Sm,{value:e.user_id||"",handleInputChange:e=>i(t,{user_id:e}),placeholder:r("默认使用root账户(继承权限,可选)")})]}),(0,_.jsxs)("div",{className:"airebot-setting__field airebot-setting__field-full",children:[(0,_.jsx)("label",{className:"airebot-setting__field-label",children:r("备注")}),(0,_.jsx)(c.Sm,{value:e.note||"",handleInputChange:e=>i(t,{note:e}),placeholder:r("备注信息(可选)")})]})]})})};function y(){const{t:e}=(0,l.Bd)(),t=(0,u.Zp)(),{check_user_auth:i}=(0,m.MH)(),[c,d]=(0,s.useState)([]),b=(0,j.Q)(),g=async()=>{const e=await o.XO.get("ai_rebot_setting");e.code===p.m.Success&&d(e.data?.list??[])};(0,s.useEffect)(()=>{g()},[]);return(0,_.jsxs)("div",{className:"airebot-setting",children:[(0,_.jsx)(a.aZ,{position:"right",children:i(x.oV.ai_agent_setting)&&(0,_.jsx)(n.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>t(-1)})}),(0,_.jsx)(r.fI,{children:(0,_.jsxs)(r.VP,{widthPer:100,children:[(0,_.jsxs)("div",{className:"airebot-setting__page-title",children:[(0,_.jsx)("h2",{children:e("机器人配置")}),(0,_.jsx)(n.rA,{icon:"info",onClick:()=>{b("机器人配置")},title:"信息"})]}),(0,_.jsx)(f,{items:c,setItems:d,save:async()=>{const t={list:c.map((e,t)=>({...e,index:t}))};(await o.XO.post("ai_rebot_setting/save",t)).code===p.m.Success&&((0,h.SK)(e("保存成功")),await g())},have_auth_edit:i(x.oV.ai_agent_setting)})]})})]})}},92350(e,t,i){i.d(t,{Q:()=>p,o:()=>m});var l=i(34843),s=i(82893),n=i(74777),a=i(96540),r=i(22022),c=i(23430),d=i(14284),o=i(74848);function p(){const[e,t]=(0,l.fp)(s.AG.prompt_card),{t:i,i18n:a}=(0,r.Bd)();return e=>{let l;e===n.jk.ffmpeg?l=(0,o.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===n.jk.smartmontools?l=(0,o.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?l=(0,o.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,o.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?l=(0,o.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?l=(0,o.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?l=(0,o.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?l=(0,o.jsx)("div",{children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,o.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?l=(0,o.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?l=(0,o.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?l=(0,o.jsx)("div",{children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,o.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,o.jsxs)("li",{children:[(0,o.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,o.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,o.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,o.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?l=(0,o.jsx)("div",{children:i("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(l=(0,o.jsxs)("div",{children:[(0,o.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,o.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,o.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,o.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,o.jsx)("div",{children:l})})}}let h=c.Ky;function m(){const[e,t]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{try{const e=await d.XO.get("themes");if(0===e.code){const i=e.data||[];h=[...c.Ky,...i],t(h)}else console.warn("获取主题列表失败,使用默认列表"),t(h)}catch(e){t(h)}})()},[]),e}}}]);