filecat 7.9.0 → 7.10.1

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 (125) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +182 -182
  3. package/build/dist/{4967.3fd3bd40a2b5a3b52428.js → 1060.198d91e2dfc174317c3a.js} +1 -1
  4. package/build/dist/1075.05eed88707339ca32044.js +1 -0
  5. package/build/dist/{1142.121454b1de53689b7367.js → 1142.bc43fae2e5e38d9359df.js} +1 -1
  6. package/build/dist/1384.edbad9c24d883a59724d.js +1 -0
  7. package/build/dist/1417.d390b18dd58ff5c28160.js +1 -0
  8. package/build/dist/1448.4db495e1389c0c8445b3.js +1 -0
  9. package/build/dist/{3324.22efcb1c431177b1cf5f.js → 1455.26a021eb94e5bdd5bec2.js} +1 -1
  10. package/build/dist/{1636.b6a17252dfd0d22f09a7.js → 1636.b80b1883358e132d3424.js} +1 -1
  11. package/build/dist/{1832.8ea5c3e8288df0b7fd5c.js → 1832.a01933ba5df99576ecc2.js} +1 -1
  12. package/build/dist/2300.c99b1dd4e752cdfd5e32.js +2 -0
  13. package/build/dist/{2300.9e1baa1c0368abe53d96.js.LICENSE.txt → 2300.c99b1dd4e752cdfd5e32.js.LICENSE.txt} +1 -1
  14. package/build/dist/239.f570f06d4b9c020f1013.js +1 -0
  15. package/build/dist/{2479.dcc88b3370f0f1d66e02.js → 2479.294792ef5d360ad64abc.js} +1 -1
  16. package/build/dist/2542.26cb302b60de23166227.js +1 -0
  17. package/build/dist/{259.81bb9e049e5ef587a96f.js → 259.3c0eb22e9b43ffb63c9c.js} +1 -1
  18. package/build/dist/2626.3bcfe1f26d9cb796a925.js +1 -0
  19. package/build/dist/{2674.7fd28dae86ccdb247851.js → 2674.15ca3c6ac911cf6e6e2f.js} +1 -1
  20. package/build/dist/3233.43bdd7c12ca829d56116.js +1 -0
  21. package/build/dist/3299.6ab0d94f02171cd762cc.js +1 -0
  22. package/build/dist/{6992.f6a07311a638794c24f7.js → 3471.ef3b5dcfe37963034187.js} +1 -1
  23. package/build/dist/{3528.56eeefab6fca5884e2a6.js → 3528.0f8f34028d92fa87c518.js} +1 -1
  24. package/build/dist/{3659.8a31495bb8f38c0ffa7c.js → 3659.dd03dc2ac52a3ff19105.js} +1 -1
  25. package/build/dist/4004.f0193c43fb891fdfb0e4.js +1 -0
  26. package/build/dist/{4560.8ef2e4b60cc86d019dd6.js → 4560.fd9f8cf2d6022b1d3a94.js} +1 -1
  27. package/build/dist/{4903.b5451ed0802b3f7c07b2.js → 4903.070aaa53a243baf05133.js} +1 -1
  28. package/build/dist/{4946.c95d4f426146e0180172.js → 4946.d578f6ba367a742d80bf.js} +2 -2
  29. package/build/dist/4986.f244efce9cf6be21f846.js +1 -0
  30. package/build/dist/5272.1f0dfac07ba202e7d323.js +1 -0
  31. package/build/dist/{5308.052f45c15785487b3766.js → 5308.d1e5ccb49396fc1b026d.js} +1 -1
  32. package/build/dist/{5516.645e4a900df9bdc1806c.js → 5516.88521f3a3c7101c46df3.js} +1 -1
  33. package/build/dist/5614.43bdd7c12ca829d56116.js +1 -0
  34. package/build/dist/{5139.adf9574d9b54a216e041.js → 5709.81f43e3c021fafdfe36f.js} +1 -1
  35. package/build/dist/{5744.e9f1efb88a617b05b709.js → 5744.0f8a0432b73b2eb0a7ff.js} +1 -1
  36. package/build/dist/{5877.ca081c4798194230243c.js → 5877.98d0475aaf4058b9a715.js} +1 -1
  37. package/build/dist/{6247.917e3fbef5dc5fbaf937.js → 6247.525b0b68872036ac2fa6.js} +1 -1
  38. package/build/dist/{7520.fbb0bc2a05cf94e15418.js → 6322.552511b5cb12cd0c821c.js} +1 -1
  39. package/build/dist/6492.17ecd8515fa512ce9306.js +1 -0
  40. package/build/dist/{676.a75318a8b598d8daadf0.js → 676.356039ef6f28f96b8c8b.js} +1 -1
  41. package/build/dist/{6805.bf0c964ab84f0fcc78be.js → 6805.373ac0e7d6555e4a6459.js} +1 -1
  42. package/build/dist/{6919.8cf13c01184b7148b28e.js → 6919.c7cc8617b658198d4924.js} +1 -1
  43. package/build/dist/{7038.4e4fc8e405c56d3080e2.js → 7038.166f915547d27e4dc5e4.js} +1 -1
  44. package/build/dist/{7759.0b68912ff9ef10869f59.js → 7759.7cd3fe8e5d37df25804c.js} +1 -1
  45. package/build/dist/7873.e3098bc6f510e5bea55f.js +1 -0
  46. package/build/dist/7923.d44556578af4d3d7cea3.js +2 -0
  47. package/build/dist/{7943.19d2de387eeb7f513d8e.js → 7943.acf25a5e98dd13290985.js} +1 -1
  48. package/build/dist/8090.8977224618a14ae42159.js +2 -0
  49. package/build/dist/8302.ce97557b7cf7c8387942.js +1 -0
  50. package/build/dist/8319.6a6b9651c87a1bb4cbb9.js +1 -0
  51. package/build/dist/{8603.4142ce42c1635f493eca.js → 8603.f1cbcfd64cde885f9809.js} +1 -1
  52. package/build/dist/8649.d6055ad75975b803bbc1.js +1 -0
  53. package/build/dist/{8727.3628c746061aed7a4077.js → 8727.8658835acb7e0b6e5acc.js} +1 -1
  54. package/build/dist/{8765.a5633d054abb67142fc3.js → 8765.8758c290a6b132f2ce7f.js} +1 -1
  55. package/build/dist/8772.2c35012c25ac9eb5f74d.js +2 -0
  56. package/build/dist/{8772.e8f9731c1c061f1cdf56.js.LICENSE.txt → 8772.2c35012c25ac9eb5f74d.js.LICENSE.txt} +1 -1
  57. package/build/dist/8781.6bd14487d172e004e3d3.js +1 -0
  58. package/build/dist/{9299.6c06dad1abe098b61766.js → 9299.7358ccf05b1415ed7959.js} +1 -1
  59. package/build/dist/9334.a25983aafdcbde63ae5e.js +1 -0
  60. package/build/dist/{9546.e7206c968e92371ae2b1.js → 9546.2cecad04cf676a6616cd.js} +1 -1
  61. package/build/dist/dark.css +839 -839
  62. package/build/dist/filerobot-image-editor.min.js +42445 -42445
  63. package/build/dist/google-dark.css +2032 -2032
  64. package/build/dist/google.css +1719 -1719
  65. package/build/dist/index.html +1 -1
  66. package/build/dist/main.ab3398f34c41e61310ae.js +2 -0
  67. package/build/dist/{main.3a12152528aff6ae213a.js.LICENSE.txt → main.ab3398f34c41e61310ae.js.LICENSE.txt} +1 -1
  68. package/build/dist/rle.js +17867 -17867
  69. package/build/main.js +1 -1
  70. package/build/plugin/core.type.d.ts +62 -0
  71. package/build/threads.work.filecat.js +1 -1
  72. package/env +26 -26
  73. package/package.json +211 -211
  74. package/shell/build.js +161 -161
  75. package/shell/config/.babelrc +14 -14
  76. package/shell/config/base.webpack.config.js +78 -78
  77. package/shell/config/common-bin.config.js +44 -44
  78. package/shell/config/env.js +10 -10
  79. package/shell/config/prebuild-file-path.js +17 -17
  80. package/shell/config/webpack.exe.config.js +36 -36
  81. package/shell/config/webpack.npm.config.js +44 -44
  82. package/shell/config/webpack.web.config.js +152 -152
  83. package/shell/dev.js +51 -51
  84. package/shell/docker-build.sh +2 -2
  85. package/shell/filecat +1 -1
  86. package/shell/filecat-watch +1 -1
  87. package/shell/install.js +48 -48
  88. package/shell/net-agent/git-clone.bat +23 -23
  89. package/shell/net-agent/git-pull.bat +17 -17
  90. package/shell/net-agent/git-push.bat +17 -17
  91. package/shell/pkg.ts +50 -50
  92. package/shell/postinstall-optional.js +29 -29
  93. package/shell/start/filecat-install.sh +22 -22
  94. package/shell/start/filecat-run.sh +2 -2
  95. package/shell/start/windows-install.js +178 -178
  96. package/shell/start/windows-uninstall.js +131 -131
  97. package/shell/util/file.js +46 -46
  98. package/build/dist/1075.40103ec059c6b23b056e.js +0 -1
  99. package/build/dist/1384.0d0fc5faa899c9eddcbe.js +0 -1
  100. package/build/dist/1417.7e511043474084a2a65b.js +0 -1
  101. package/build/dist/1448.0710f04bed1c52e6a5db.js +0 -1
  102. package/build/dist/2300.9e1baa1c0368abe53d96.js +0 -2
  103. package/build/dist/2542.23fb13b1623c9f7c3fc1.js +0 -1
  104. package/build/dist/2626.05d1faa293e0a3318b9b.js +0 -1
  105. package/build/dist/2851.2195b5906b2c224c7bf7.js +0 -1
  106. package/build/dist/3140.794a212da633caf38b3a.js +0 -2
  107. package/build/dist/3233.fb6bffd5e097e4ac9423.js +0 -1
  108. package/build/dist/3299.f37767d30b6999df4014.js +0 -1
  109. package/build/dist/4004.5d68418ad5c2321cb11f.js +0 -1
  110. package/build/dist/4986.78047106f3a0d2d71199.js +0 -1
  111. package/build/dist/5272.0b70ee8ec5f083fb9f5b.js +0 -1
  112. package/build/dist/5614.fb6bffd5e097e4ac9423.js +0 -1
  113. package/build/dist/6492.3ee4060598de873d8e8f.js +0 -1
  114. package/build/dist/7756.2f851693ba030c42dde8.js +0 -1
  115. package/build/dist/7873.11d04b741d2b499d9cb9.js +0 -1
  116. package/build/dist/7923.861345fd55941e8089a1.js +0 -2
  117. package/build/dist/8014.28b5cf8c3787dc829aa4.js +0 -1
  118. package/build/dist/8302.5ae5bfe8baa0084204bb.js +0 -1
  119. package/build/dist/8319.c15a3674ec7abc493595.js +0 -1
  120. package/build/dist/8772.e8f9731c1c061f1cdf56.js +0 -2
  121. package/build/dist/8781.58f0c51870d3dd2689d7.js +0 -1
  122. package/build/dist/main.3a12152528aff6ae213a.js +0 -2
  123. /package/build/dist/{4946.c95d4f426146e0180172.js.LICENSE.txt → 4946.d578f6ba367a742d80bf.js.LICENSE.txt} +0 -0
  124. /package/build/dist/{7923.861345fd55941e8089a1.js.LICENSE.txt → 7923.d44556578af4d3d7cea3.js.LICENSE.txt} +0 -0
  125. /package/build/dist/{3140.794a212da633caf38b3a.js.LICENSE.txt → 8090.8977224618a14ae42159.js.LICENSE.txt} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4986],{94986(e,a,s){s.r(a),s.d(a,{WorkerUrl:()=>r});var t=s(35450),r=(s(22130),new URL("file:///D:/projects/filecat/node_modules/@excalidraw/excalidraw/dist/prod/subset-worker.chunk.js"));typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{if(e.data.command===t.a.Subset){let a=await(0,t.c)(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]})}})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4091,5272],{48890(e,n,t){t.d(n,{Kw:()=>i,Tt:()=>o});var i=t(80952),o=(t(82327),t(1766),t(24854),t(90008),t(90846),t(40975),t(44286),t(30766),t(14973),t(69687),t(1234),t(47507),t(87268),t(34678),t(24522));const d=`https://gcore.jsdelivr.net/npm/ace-builds@${i.version}/src-min-noconflict/`;i.config.set("basePath",d),i.config.set("modePath",d),i.config.set("themePath",d),i.config.set("workerPath",d)},84091(e,n,t){t.r(n),t.d(n,{default:()=>m});var i=t(96540),o=(t(80952),t(48890)),d=t(34843),r=t(82893),a=t(78247),s=t(74848);function m(e){const n=(0,i.useRef)(null),[t,m]=(0,d.fp)(r.AG.user_base_info),l=t.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,i.useEffect)(()=>{const t=o.Kw.edit(n.current,{value:a.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${l}`,mode:e.model??o.Tt.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return t.setOptions({}),t.container.addEventListener("wheel",function(e){e.preventDefault()}),t.focus(),t.on("change",function(n){e.on_change&&e.on_change()}),n.current=t,t.formatCode=()=>{const e=o.Kw.require("ace/ext/beautify"),t=n.current;t&&e.beautify(t.session)},a.xK.set_editor_temp(t,e.editor_id),()=>{a.xK.delete_editor_temp(e.editor_id),t.destroy()}},[]),(0,s.jsx)("div",{ref:n,style:{height:"100%",width:"100%"}})}},26559(e,n,t){var i=t(96540),o=t(34843),d=t(82893),r=t(76118),a=t(69918),s=t(8332),m=t(74848);const l=i.memo(function(e){const[n]=(0,o.fp)(d.AG.md_editor_last_context),[t]=(0,i.useState)(n?.trim()?n:s.$);return(0,m.jsx)("div",{className:e.className,ref:n=>e.setting&&(0,a.Ce)(n,e.setting),children:(0,m.jsx)("div",{className:"md-editor-scroll",children:(0,m.jsx)("div",{className:"md-editor-sheet",children:(0,m.jsx)(r.A,{value:t})})})})});t.d(n,["A",0,l])},8332(e,n,t){t.d(n,["$",0,'# 一级标题 Heading 1\n\n## 二级标题 Heading 2\n\n### 三级标题 Heading 3\n\n#### 四级标题 Heading 4\n\n##### 五级标题 Heading 5\n\n###### 六级标题 Heading 6\n\n这是一段普通正文,用来观察字体、字号、行高和文字颜色。中间可以包含 **加粗文字**、*斜体文字*、~~删除线~~、`行内代码` 以及 [一个链接](https://github.com/xiaobaidadada/filecat)。\n\n> 这是一段引用文字。\n> 引用通常用来强调摘录的内容,左侧一般会有一条竖线。\n\n- 无序列表第一项\n- 无序列表第二项\n - 嵌套的子项\n- 无序列表第三项\n\n1. 有序列表第一项\n2. 有序列表第二项\n3. 有序列表第三项\n\n```javascript\n// 代码块\nfunction greet(name) {\n console.log(`Hello, ${name}!`);\n}\ngreet("filecat");\n```\n\n| 列一 | 列二 | 列三 |\n| --- | --- | --- |\n| 内容 A | 内容 B | 内容 C |\n| 内容 D | 内容 E | 内容 F |\n\n---\n\n最后一段正文,用于观察段落之间的间距。\n',"V",0,'/* ===== md 主题 =====\n 选择器请从 .md-editor-sheet 开始写 —— 它是正文容器的类名,\n 编辑器与右侧预览用的是同一个类名,一处书写、两处生效。\n\n 注意:css 原样注入页面,不做任何改写。\n 写成 body、h1 这种全局选择器会真的作用到整个后台界面,不要这么写。\n\n 下面每一组都可以直接改,不需要的整段删掉即可。\n ============================================ */\n\n/* ---------- 正文 ---------- */\n.md-editor-sheet {\n font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; /* 字体 */\n font-size: 16px; /* 字号 */\n line-height: 1.7; /* 行高:1.7 约为字号的 1.7 倍 */\n color: #333333; /* 文字颜色 */\n}\n\n/* ---------- 整页底色 ----------\n 底色必须写在 .md-editor-scroll(滚动容器)上,不要写在 .md-editor-sheet。\n 纸张高度只有一屏,写在纸张上的底色长文档一滚就露底(上半截有色、下半截变回灰)。\n 深色主题尤其要注意:这一条不写,滚动时就会白一半黑一半。 */\n.md-editor-scroll {\n background: #ffffff;\n}\n\n/* ---------- 标题 h1 ~ h6 ---------- */\n.md-editor-sheet h1 {\n font-size: 2em; /* 相对正文字号的倍数 */\n font-weight: 600; /* 字重:400 常规 / 600 半粗 / 700 粗 */\n color: #1a1a1a;\n margin-top: 1.4em;\n margin-bottom: 0.6em;\n padding-bottom: 0.3em;\n border-bottom: 1px solid #eaecef; /* 标题下划线,不需要就删掉这行 */\n}\n.md-editor-sheet h2 { font-size: 1.5em; font-weight: 600; margin-top: 1.3em; margin-bottom: 0.6em; }\n.md-editor-sheet h3 { font-size: 1.25em; font-weight: 600; margin-top: 1.2em; margin-bottom: 0.5em; }\n.md-editor-sheet h4 { font-size: 1em; font-weight: 600; margin-top: 1.1em; margin-bottom: 0.5em; }\n.md-editor-sheet h5 { font-size: 0.9em; font-weight: 600; margin-top: 1em; margin-bottom: 0.5em; }\n.md-editor-sheet h6 { font-size: 0.85em; font-weight: 600; color: #6a737d; margin-top: 1em; margin-bottom: 0.5em; }\n\n/* ---------- 段落与行内元素 ---------- */\n.md-editor-sheet p {\n margin: 0 0 1em; /* 段落间距:上 右 下 左,下边距控制段与段的距离 */\n}\n.md-editor-sheet strong { font-weight: 600; } /* 加粗文字 */\n.md-editor-sheet em { font-style: italic; } /* 斜体文字 */\n.md-editor-sheet a { color: #0366d6; text-decoration: none; } /* 链接颜色;加下划线写 underline */\n.md-editor-sheet a:hover { text-decoration: underline; } /* 鼠标悬停时的链接样式 */\n.md-editor-sheet del { color: #999999; } /* 删除线文字 */\n\n/* ---------- 引用 ---------- */\n.md-editor-sheet blockquote {\n margin: 0 0 1em;\n padding: 0.4em 1em;\n color: #6a737d; /* 引用文字颜色 */\n border-left: 4px solid #dfe2e5; /* 左侧竖线,这是引用最明显的特征 */\n background: #f6f8fa; /* 引用底色,不需要就删掉 */\n}\n\n/* ---------- 代码 ---------- */\n.md-editor-sheet code {\n font-family: Consolas, Monaco, "Courier New", monospace; /* 等宽字体 */\n font-size: 0.88em;\n color: #476582; /* 行内代码文字色 */\n background: rgba(27, 31, 35, 0.05); /* 行内代码底色 */\n padding: 0.2em 0.4em;\n border-radius: 3px; /* 圆角 */\n}\n.md-editor-sheet pre {\n padding: 1em;\n overflow: auto; /* 内容太宽时出现横向滚动条 */\n background: #f6f8fa; /* 代码块底色 */\n border-radius: 6px;\n margin: 0 0 1em;\n}\n.md-editor-sheet pre code {\n background: transparent; /* 代码块里的 code 不要再叠一层底色 */\n padding: 0;\n}\n\n/* ---------- 列表 ---------- */\n.md-editor-sheet ul, .md-editor-sheet ol {\n padding-left: 2em; /* 缩进 */\n margin: 0 0 1em;\n}\n.md-editor-sheet li { margin: 0.25em 0; } /* 列表项之间的间距 */\n\n/* ---------- 表格 ---------- */\n.md-editor-sheet table {\n width: 100%;\n border-collapse: collapse; /* 相邻边框合并成一条线 */\n margin: 0 0 1em;\n}\n.md-editor-sheet table th, .md-editor-sheet table td {\n padding: 6px 13px;\n border: 1px solid #dfe2e5; /* 单元格边框 */\n}\n.md-editor-sheet table th {\n font-weight: 600;\n background: #f6f8fa; /* 表头底色 */\n}\n\n/* ---------- 分割线 ---------- */\n.md-editor-sheet hr {\n height: 1px; /* 线的粗细 */\n border: 0;\n background: #e1e4e8; /* 线的颜色 */\n margin: 1.6em 0;\n}\n\n/* ---------- 图片 ---------- */\n.md-editor-sheet img {\n max-width: 100%; /* 防止大图撑破版面 */\n border-radius: 4px;\n}\n'])},35272(e,n,t){t.r(n),t.d(n,{default:()=>b});var i=t(96540),o=t(22022),d=t(61973),r=t(85997),a=t(4412),s=t(70447),m=t(75725),l=t(61443),c=t(62042),h=t(23430),f=t(78247),g=t(84091),u=t(26559),p=t(96763),x=t(8332),_=t(74848);function b(){const{t:e}=(0,o.Bd)(),n=(0,d.Zp)(),[t]=(0,d.ok)(),{check_user_auth:b}=(0,f.MH)(),v=b(h.oV.md_theme),w=t.get("id")??"",j=!w,[k,N]=(0,i.useState)(""),[y,C]=(0,i.useState)(x.V),[K,z]=(0,i.useState)(!0),[P,S]=(0,i.useState)(!1),A=88;(0,i.useEffect)(()=>{if(!w){const e=x.V;return f.xK.set_value_temp(e,A),N(""),C(e),void z(!1)}Promise.all([(0,p.Kz)(),(0,p.P7)(w)]).then(([e,n])=>{const t=e.find(e=>e.id===w),i=n||x.V;f.xK.set_value_temp(i,A),N(t?.id??""),C(i)}).finally(()=>z(!1))},[w]),(0,i.useEffect)(()=>{if(K)return;const e=f.xK.get_editor(A);e&&(e.setValue(f.xK.get_value_temp(A)??"",-1),e.clearSelection())},[K]),(0,i.useEffect)(()=>{K||(0,p.bN)("theme_preview",y)},[y,K]);return(0,_.jsxs)("div",{children:[(0,_.jsx)(a.aZ,{position:"right",children:(0,_.jsx)(r.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>n(-1)})}),(0,_.jsx)(m.jW,{isFull:!0,more:!0,children:(0,_.jsx)(m.NN,{children:(0,_.jsxs)("div",{className:"md-theme-editor",children:[(0,_.jsx)("div",{className:"md-theme-editor__left",children:(0,_.jsxs)(s.Zp,{title:e(j?"新建主题":"编辑主题"),titleCom:(0,_.jsx)(_.Fragment,{children:v&&(0,_.jsx)(r.C3,{text:e(P?"保存中":"保存"),clickFun:()=>{P||(async()=>{const t=k.trim();if(t){S(!0);try{await(0,p._D)({id:j?void 0:w,name:t,css:f.xK.get_editor_value(A)??y})?((0,c.SK)(e("保存成功")),n(-1)):(0,c.zN)(e("保存失败"))}finally{S(!1)}}else(0,c.zN)(e("请输入主题名称"))})()}})}),children:[(0,_.jsx)(l.BC,{label:e("主题名称"),label_width:"6rem",children:(0,_.jsx)(l.Sm,{value:k,disabled:!v,placeholder:e("请输入主题名称"),handleInputChange:e=>N(e)})}),(0,_.jsx)("div",{className:"md-theme-editor__ace",children:(0,_.jsx)(g.default,{name:"theme.css",editor_id:A,model:"ace/mode/css",on_change:()=>{const e=f.xK.get_editor_value(A);void 0!==e&&C(e)},options:{showPrintMargin:!1,highlightActiveLine:!0,wrap:!0}})})]})}),(0,_.jsx)("div",{className:"md-theme-editor__right",children:(0,_.jsx)(s.Zp,{title:e("预览"),titleCom:(0,_.jsx)("span",{className:"md-theme-editor__tip",children:e("主题实时预览")}),children:(0,_.jsx)(u.A,{className:"md-theme-preview"})})})]})})})]})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5308],{65308(e,t,o){o.r(t),o.d(t,{default:()=>p});var a=o(96540),n=o(34843),i=o(82893),r=o(34289),d=o(14284),s=o(38240),c=o(62042),l=o(52671),m=o(74848);let f,u=!1;function p(){const[e,t]=(0,n.fp)(i.AG.image_editor),o=(0,l.Zp)();(0,l.zy)();return(0,a.useEffect)(()=>((async()=>{if(!u)try{await(0,s.J)("filerobot-image-editor.min.js"),u=!0}catch(e){return void(0,c.zN)("加载资源失败")}const a=(0,r.GG)("file",e.path),n=window.FilerobotImageEditor,{TABS:i,TOOLS:l}=n,m={defaultSavedImageName:e.name,source:d.$M.getDownloadUrl(a),onSave:async(t,o)=>{const n=t.extension,i=t.name??e.name,s=await new Promise(e=>t.imageCanvas.toBlob(e,t.mimeType));await d.$M.put(`${encodeURIComponent(`${(0,r.Yp)(a)}${i}.${n}`)}`,s,void 0),(0,c.SK)("保存成功")},annotationsCommon:{fill:"#151717",stroke:"#ec0f42",shadowColor:"#151717"},Text:{text:""},Rotate:{angle:90,componentType:"slider"},tabsIds:[Object.values(i)],defaultTabId:i.ANNOTATE,defaultToolId:l.ANNOTATE};f=new n(document.querySelector("#editor_container"),m),f.render({onClose:a=>{f.terminate();const n=e.close;t({}),n?.(),o((0,r.vX)())}})})(),()=>{f&&f.terminate()}),[]),(0,m.jsx)("div",{id:"image-editor-container",children:(0,m.jsx)("div",{className:"image-editor-context",children:(0,m.jsx)("div",{id:"editor_container",className:"image-editor-context"})})})}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5308],{65308(e,t,o){o.r(t),o.d(t,{default:()=>p});var a=o(96540),n=o(34843),i=o(82893),r=o(34289),d=o(14284),s=o(38240),c=o(62042),l=o(61973),m=o(74848);let f,u=!1;function p(){const[e,t]=(0,n.fp)(i.AG.image_editor),o=(0,l.Zp)();(0,l.zy)();return(0,a.useEffect)(()=>((async()=>{if(!u)try{await(0,s.J)("filerobot-image-editor.min.js"),u=!0}catch(e){return void(0,c.zN)("加载资源失败")}const a=(0,r.GG)("file",e.path),n=window.FilerobotImageEditor,{TABS:i,TOOLS:l}=n,m={defaultSavedImageName:e.name,source:d.$M.getDownloadUrl(a),onSave:async(t,o)=>{const n=t.extension,i=t.name??e.name,s=await new Promise(e=>t.imageCanvas.toBlob(e,t.mimeType));await d.$M.put(`${encodeURIComponent(`${(0,r.Yp)(a)}${i}.${n}`)}`,s,void 0),(0,c.SK)("保存成功")},annotationsCommon:{fill:"#151717",stroke:"#ec0f42",shadowColor:"#151717"},Text:{text:""},Rotate:{angle:90,componentType:"slider"},tabsIds:[Object.values(i)],defaultTabId:i.ANNOTATE,defaultToolId:l.ANNOTATE};f=new n(document.querySelector("#editor_container"),m),f.render({onClose:a=>{f.terminate();const n=e.close;t({}),n?.(),o((0,r.vX)())}})})(),()=>{f&&f.terminate()}),[]),(0,m.jsx)("div",{id:"image-editor-container",children:(0,m.jsx)("div",{className:"image-editor-context",children:(0,m.jsx)("div",{id:"editor_container",className:"image-editor-context"})})})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5516],{52811(e,t,a){a.r(t),a.d(t,{default:()=>f,parseScene:()=>A});var n=a(96540),s=a(64572),r=a(34843),l=a(82893),o=a(14284),i=a(34289),c=a(62042),d=a(52671),u=a(57889),g=a(22022),m=a(53459),w=(a(3561),a(74848));function A(e){if(!e)return null;const t="string"==typeof e?e:e.context??e.data??e;if(!t)return null;try{return"string"==typeof t?JSON.parse(t):t}catch{return null}}function f(){const[e,t]=(0,r.fp)(l.AG.excalidraw_editor),[a,f]=(0,n.useState)(null),[x,p]=(0,n.useState)(null),[v,h]=(0,n.useState)(!1),y=(0,d.Zp)(),{t:S}=(0,g.Bd)(),k=(0,n.useRef)(()=>{});(0,n.useEffect)(()=>{k.current=z}),(0,n.useEffect)(()=>{let t=!1;return(async()=>{if(e?.url){h(!0);try{const a=await u.l.get(e.url);if(t)return;const n=A(a);if(!n)throw new Error("invalid excalidraw scene");p(n)}catch{t||(p(null),(0,c.zN)("Load Excalidraw file failed"))}finally{t||h(!1)}}else p(null)})(),()=>{t=!0}},[e?.url]);const z=async()=>{if(!a)return void(0,c.zN)("Editor is not ready");const t=a.getSceneElements(),n=a.getAppState(),r=a.getFiles(),l=(0,s.nu)(t,n,r,"local"),d=JSON.parse(l);d.appState={...d.appState??{},zoom:n.zoom,scrollX:n.scrollX,scrollY:n.scrollY,viewBackgroundColor:n.viewBackgroundColor,gridSize:n.gridSize};(await o.$M.post(`save/${encodeURIComponent((0,i.GG)("file",(0,i.vX)()))}${e.name}`,{context:JSON.stringify(d)})).code===m.m.Success&&(0,c.SK)("保存成功")};return(0,n.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key||83===e.keyCode)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),k.current())};return window.addEventListener("keydown",e,!0),document.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("keydown",e,!0)}},[]),(0,w.jsx)("div",{id:"excalidraw-container",children:(0,w.jsxs)("div",{className:"excalidraw-context",children:[v&&(0,w.jsx)("div",{className:"common-box common-box-center",children:"Loading..."}),!v&&x&&(0,w.jsx)(s.Td,{langCode:"zh-CN",initialData:x,excalidrawAPI:e=>f(e),onKeyDown:e=>!(!e.ctrlKey&&!e.metaKey||"s"!==e.key&&"S"!==e.key&&83!==e.keyCode)&&(e.preventDefault(),k.current(),!0),UIOptions:{dockedSidebarBreakpoint:0},children:(0,w.jsxs)(s.zU,{children:[(0,w.jsx)(s.zU.Item,{onSelect:()=>{t({}),y((0,i.vX)()),e?.close?.()},children:S("关闭")}),(0,w.jsx)(s.zU.Item,{onSelect:z,children:S("保存到服务器")}),(0,w.jsxs)(s.zU.Group,{title:"Excalidraw items",children:[(0,w.jsx)(s.zU.DefaultItems.LoadScene,{}),(0,w.jsx)(s.zU.DefaultItems.Export,{}),(0,w.jsx)(s.zU.DefaultItems.SaveToActiveFile,{}),(0,w.jsx)(s.zU.DefaultItems.SaveAsImage,{}),(0,w.jsx)(s.zU.DefaultItems.ClearCanvas,{}),(0,w.jsx)(s.zU.DefaultItems.ToggleTheme,{}),(0,w.jsx)(s.zU.DefaultItems.ChangeCanvasBackground,{})]})]})},e.url??"excalidraw")]})})}},51953(e){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg=="},17834(e){e.exports='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>'},56933(e){e.exports='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path fill="%23ced4da" d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>'}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5516],{52811(e,t,a){a.r(t),a.d(t,{default:()=>f,parseScene:()=>A});var n=a(96540),s=a(60882),r=a(34843),l=a(82893),o=a(14284),i=a(34289),c=a(62042),d=a(61973),u=a(57889),g=a(22022),m=a(53459),w=(a(3561),a(74848));function A(e){if(!e)return null;const t="string"==typeof e?e:e.context??e.data??e;if(!t)return null;try{return"string"==typeof t?JSON.parse(t):t}catch{return null}}function f(){const[e,t]=(0,r.fp)(l.AG.excalidraw_editor),[a,f]=(0,n.useState)(null),[x,p]=(0,n.useState)(null),[v,h]=(0,n.useState)(!1),y=(0,d.Zp)(),{t:S}=(0,g.Bd)(),k=(0,n.useRef)(()=>{});(0,n.useEffect)(()=>{k.current=z}),(0,n.useEffect)(()=>{let t=!1;return(async()=>{if(e?.url){h(!0);try{const a=await u.l.get(e.url);if(t)return;const n=A(a);if(!n)throw new Error("invalid excalidraw scene");p(n)}catch{t||(p(null),(0,c.zN)("Load Excalidraw file failed"))}finally{t||h(!1)}}else p(null)})(),()=>{t=!0}},[e?.url]);const z=async()=>{if(!a)return void(0,c.zN)("Editor is not ready");const t=a.getSceneElements(),n=a.getAppState(),r=a.getFiles(),l=(0,s.nu)(t,n,r,"local"),d=JSON.parse(l);d.appState={...d.appState??{},zoom:n.zoom,scrollX:n.scrollX,scrollY:n.scrollY,viewBackgroundColor:n.viewBackgroundColor,gridSize:n.gridSize};(await o.$M.post(`save/${encodeURIComponent((0,i.GG)("file",(0,i.vX)()))}${e.name}`,{context:JSON.stringify(d)})).code===m.m.Success&&(0,c.SK)("保存成功")};return(0,n.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key||83===e.keyCode)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),k.current())};return window.addEventListener("keydown",e,!0),document.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("keydown",e,!0)}},[]),(0,w.jsx)("div",{id:"excalidraw-container",children:(0,w.jsxs)("div",{className:"excalidraw-context",children:[v&&(0,w.jsx)("div",{className:"common-box common-box-center",children:"Loading..."}),!v&&x&&(0,w.jsx)(s.Td,{langCode:"zh-CN",initialData:x,excalidrawAPI:e=>f(e),onKeyDown:e=>!(!e.ctrlKey&&!e.metaKey||"s"!==e.key&&"S"!==e.key&&83!==e.keyCode)&&(e.preventDefault(),k.current(),!0),UIOptions:{dockedSidebarBreakpoint:0},children:(0,w.jsxs)(s.zU,{children:[(0,w.jsx)(s.zU.Item,{onSelect:()=>{t({}),y((0,i.vX)()),e?.close?.()},children:S("关闭")}),(0,w.jsx)(s.zU.Item,{onSelect:z,children:S("保存到服务器")}),(0,w.jsxs)(s.zU.Group,{title:"Excalidraw items",children:[(0,w.jsx)(s.zU.DefaultItems.LoadScene,{}),(0,w.jsx)(s.zU.DefaultItems.Export,{}),(0,w.jsx)(s.zU.DefaultItems.SaveToActiveFile,{}),(0,w.jsx)(s.zU.DefaultItems.SaveAsImage,{}),(0,w.jsx)(s.zU.DefaultItems.ClearCanvas,{}),(0,w.jsx)(s.zU.DefaultItems.ToggleTheme,{}),(0,w.jsx)(s.zU.DefaultItems.ChangeCanvasBackground,{})]})]})},e.url??"excalidraw")]})})}},51953(e){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg=="},17834(e){e.exports='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>'},56933(e){e.exports='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path fill="%23ced4da" d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>'}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3233,5614],{33616(e){var n;self,n=()=>(()=>{"use strict";var e,n={};return e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.FitAddon=void 0,e.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const n=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(n._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,n=e._renderService.dimensions;if(0===n.css.cell.width||0===n.css.cell.height)return;const t=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(r.getPropertyValue("height")),i=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),l=o-(parseInt(s.getPropertyValue("padding-top"))+parseInt(s.getPropertyValue("padding-bottom"))),a=i-(parseInt(s.getPropertyValue("padding-right"))+parseInt(s.getPropertyValue("padding-left")))-t;return{cols:Math.max(2,Math.floor(a/n.css.cell.width)),rows:Math.max(1,Math.floor(l/n.css.cell.height))}}},n})(),e.exports=n()},40654(e,n,t){"use strict";t.r(n),t.d(n,{default:()=>E});var r=t(96540),o=t(33616),i=(t(97856),t(85072)),s=t.n(i),l=t(97825),a=t.n(l),c=t(77659),d=t.n(c),u=t(55056),m=t.n(u),p=t(10540),h=t.n(p),x=t(41113),f=t.n(x),g=t(86739),v={};v.styleTagTransform=f(),v.setAttributes=m(),v.insert=d().bind(null,"head"),v.domAPI=a(),v.insertStyleElement=h();s()(g.A,v);g.A&&g.A.locals&&g.A.locals;var y=t(40505),_=t(62042),b=t(84369),w=t(74848);function E(e){const[n,t]=(0,r.useState)(25),i=(0,r.useRef)(null),s=(0,r.useCallback)(new o.FitAddon,[]),l=(0,r.useRef)(null),a=(0,r.useRef)(null),{dragging:c,on_pointer_down:d,on_pointer_up:u}=(0,b.y)({direction:"vertical",target_ref:l,get_start_size:()=>n,px_to_unit:e=>e/parseFloat(getComputedStyle(l.current).fontSize),min:()=>{const e=parseFloat(getComputedStyle(l.current).fontSize);return 2.25+i.current.offsetHeight/e},max:()=>{const e=parseFloat(getComputedStyle(l.current).fontSize);return window.innerHeight/e-4},throttle:32,on_change:e=>{s.fit(),t(parseFloat(e.toFixed(2)))}});if((0,r.useEffect)(()=>{e.terminal&&(e.terminal.options.convertEol=!0,e.terminal.open(a.current),e.terminal.loadAddon(s),s.fit(),e.init&&e.init(e.terminal.rows,e.terminal.cols),e.terminal.attachCustomKeyEventHandler(n=>{if(n.ctrlKey&&"c"===n.key){const t=e.terminal.getSelection();if(t)return(0,y.lW)(t),(0,_.SK)("已复制"),n.preventDefault(),e.terminal.focus(),!1}else if("keydown"===n.type&&"v"===n.key&&n.ctrlKey)return!1;return!0}))},[e.terminal]),(0,r.useEffect)(()=>()=>{e.terminal&&e.terminal.dispose()},[]),e.show)return e.get_simple?(0,w.jsx)("div",{className:"pty",style:{height:"100%"},ref:a}):(0,w.jsxs)("div",{className:"shell",style:{height:`${n}em`,display:""+(e.file_shell_hidden?"none":"block")},ref:l,children:[(0,w.jsx)("div",{className:"shell__divider",ref:i,onPointerDown:d,onPointerUp:u}),(0,w.jsx)("div",{className:"pty",style:{height:n-1+"em"},ref:a}),c&&(0,w.jsx)("div",{className:"shell__overlay",onPointerUp:u})]})}},85614(e,n,t){"use strict";t.r(n),t.d(n,{default:()=>s});var r=t(96540),o=(t(40654),t(74848));const i=r.lazy(()=>Promise.resolve().then(t.bind(t,40654)));function s(e){return(0,o.jsx)(r.Fragment,{children:(0,o.jsx)(i,{...e})})}},84369(e,n,t){"use strict";t.d(n,{y:()=>s});var r=t(96540),o=t(2543);function i(e){if(void 0!==e)return"function"==typeof e?e():e}function s(e){const{direction:n="vertical",target_ref:t,get_start_size:s,px_to_unit:l,min:a,max:c,throttle:d,on_change:u,on_drag_end:m}=e,[p,h]=(0,r.useState)(!1),x=(0,r.useRef)(null),f=(0,r.useRef)(u);f.current=u;const g=e=>"vertical"===n?e.clientY:e.clientX,v=(0,r.useRef)({direction:n,get_start_size:s,px_to_unit:l,min:a,max:c,get_pos:g});v.current={direction:n,get_start_size:s,px_to_unit:l,min:a,max:c,get_pos:g};const y=(0,r.useCallback)(e=>{const n=x.current;if(!n)return;const{px_to_unit:t,min:r,max:o,get_pos:s}=v.current,l=n.pos-s(e);let a=n.size+t(l);const c=i(r),d=i(o);void 0!==c&&(a=Math.max(c,a)),void 0!==d&&(a=Math.min(d,a)),f.current(a)},[]),_=r.useMemo(()=>void 0===d?y:o.throttle(e=>y(e),d),[d,y]),b=(0,r.useCallback)(()=>{x.current=null,h(!1);const e=_;"function"==typeof e.cancel&&e.cancel(),m?.()},[_,m]),w=(0,r.useCallback)(e=>{const{get_start_size:n,get_pos:t}=v.current;x.current={pos:t(e),size:n()},h(!0)},[]);return(0,r.useEffect)(()=>{if(!p)return;const e=t?.current??window;return e.addEventListener("pointermove",_),e.addEventListener("pointerup",b),()=>{e.removeEventListener("pointermove",_),e.removeEventListener("pointerup",b)}},[p,_,b,t]),(0,r.useEffect)(()=>{const e=_;return()=>{"function"==typeof e.cancel&&e.cancel()}},[_]),{dragging:p,on_pointer_down:w,on_pointer_up:b}}},86739(e,n,t){"use strict";var r=t(31601),o=t.n(r),i=t(76314),s=t.n(i)()(o());s.push([e.id,'/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * https://github.com/chjj/term.js\n * @license MIT\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the "Software"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * Originally forked from (with the author\'s permission):\n * Fabrice Bellard\'s javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n */\n\n/**\n * Default styles for xterm.js\n */\n\n.xterm {\n cursor: text;\n position: relative;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}\n\n.xterm.focus,\n.xterm:focus {\n outline: none;\n}\n\n.xterm .xterm-helpers {\n position: absolute;\n top: 0;\n /**\n * The z-index of the helpers must be higher than the canvases in order for\n * IMEs to appear on top.\n */\n z-index: 5;\n}\n\n.xterm .xterm-helper-textarea {\n padding: 0;\n border: 0;\n margin: 0;\n /* Move textarea out of the screen to the far left, so that the cursor is not visible */\n position: absolute;\n opacity: 0;\n left: -9999em;\n top: 0;\n width: 0;\n height: 0;\n z-index: -5;\n /** Prevent wrapping so the IME appears against the textarea at the correct position */\n white-space: nowrap;\n overflow: hidden;\n resize: none;\n}\n\n.xterm .composition-view {\n /* TODO: Composition position got messed up somewhere */\n background: #000;\n color: #FFF;\n display: none;\n position: absolute;\n white-space: nowrap;\n z-index: 1;\n}\n\n.xterm .composition-view.active {\n display: block;\n}\n\n.xterm .xterm-viewport {\n /* On OS X this is required in order for the scroll bar to appear fully opaque */\n background-color: #000;\n overflow-y: scroll;\n cursor: default;\n position: absolute;\n right: 0;\n left: 0;\n top: 0;\n bottom: 0;\n}\n\n.xterm .xterm-screen {\n position: relative;\n}\n\n.xterm .xterm-screen canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.xterm .xterm-scroll-area {\n visibility: hidden;\n}\n\n.xterm-char-measure-element {\n display: inline-block;\n visibility: hidden;\n position: absolute;\n top: 0;\n left: -9999em;\n line-height: normal;\n}\n\n.xterm.enable-mouse-events {\n /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */\n cursor: default;\n}\n\n.xterm.xterm-cursor-pointer,\n.xterm .xterm-cursor-pointer {\n cursor: pointer;\n}\n\n.xterm.column-select.focus {\n /* Column selection mode */\n cursor: crosshair;\n}\n\n.xterm .xterm-accessibility:not(.debug),\n.xterm .xterm-message {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n z-index: 10;\n color: transparent;\n pointer-events: none;\n}\n\n.xterm .xterm-accessibility-tree:not(.debug) *::selection {\n color: transparent;\n}\n\n.xterm .xterm-accessibility-tree {\n user-select: text;\n white-space: pre;\n}\n\n.xterm .live-region {\n position: absolute;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n}\n\n.xterm-dim {\n /* Dim should not apply to background, so the opacity of the foreground color is applied\n * explicitly in the generated class and reset to 1 here */\n opacity: 1 !important;\n}\n\n.xterm-underline-1 { text-decoration: underline; }\n.xterm-underline-2 { text-decoration: double underline; }\n.xterm-underline-3 { text-decoration: wavy underline; }\n.xterm-underline-4 { text-decoration: dotted underline; }\n.xterm-underline-5 { text-decoration: dashed underline; }\n\n.xterm-overline {\n text-decoration: overline;\n}\n\n.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }\n.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }\n.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }\n.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }\n.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }\n\n.xterm-strikethrough {\n text-decoration: line-through;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration {\n\tz-index: 6;\n\tposition: absolute;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {\n\tz-index: 7;\n}\n\n.xterm-decoration-overview-ruler {\n z-index: 8;\n position: absolute;\n top: 0;\n right: 0;\n pointer-events: none;\n}\n\n.xterm-decoration-top {\n z-index: 2;\n position: relative;\n}\n',""]);const l=s;t.d(n,["A",0,l])}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5139],{35139(e,r,t){function n(e){function r(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(n=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new n(e)}t.r(r),t.d(r,{default:()=>a});const i=async(e,r,t=e.name,a)=>{const o=[],l=[];var s,u=!1,c=!1;try{for(var f,y=function(e){var r,t,i,a=2;for("undefined"!=typeof Symbol&&(t=Symbol.asyncIterator,i=Symbol.iterator);a--;){if(t&&null!=(r=e[t]))return r.call(e);if(i&&null!=(r=e[i]))return new n(r.call(e));t="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());u=!(f=await y.next()).done;u=!1){const n=f.value,s=`${t}/${n.name}`;"file"===n.kind?l.push(n.getFile().then(r=>(r.directoryHandle=e,r.handle=n,Object.defineProperty(r,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>s})))):"directory"!==n.kind||!r||a&&a(n)||o.push(i(n,r,s,a))}}catch(e){c=!0,s=e}finally{try{u&&null!=y.return&&await y.return()}finally{if(c)throw s}}return[...(await Promise.all(o)).flat(),...await Promise.all(l)]};var a=async(e={})=>{e.recursive=e.recursive||!1;const r=await window.showDirectoryPicker({id:e.id,startIn:e.startIn});return i(r,e.recursive,void 0,e.skipDirectory)}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5709],{38090(e,r,t){function n(e){function r(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(n=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new n(e)}t.r(r),t.d(r,{default:()=>a});const i=async(e,r,t=e.name,a)=>{const o=[],l=[];var s,u=!1,c=!1;try{for(var f,y=function(e){var r,t,i,a=2;for("undefined"!=typeof Symbol&&(t=Symbol.asyncIterator,i=Symbol.iterator);a--;){if(t&&null!=(r=e[t]))return r.call(e);if(i&&null!=(r=e[i]))return new n(r.call(e));t="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());u=!(f=await y.next()).done;u=!1){const n=f.value,s=`${t}/${n.name}`;"file"===n.kind?l.push(n.getFile().then(r=>(r.directoryHandle=e,r.handle=n,Object.defineProperty(r,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>s})))):"directory"!==n.kind||!r||a&&a(n)||o.push(i(n,r,s,a))}}catch(e){c=!0,s=e}finally{try{u&&null!=y.return&&await y.return()}finally{if(c)throw s}}return[...(await Promise.all(o)).flat(),...await Promise.all(l)]};var a=async(e={})=>{e.recursive=e.recursive||!1;const r=await window.showDirectoryPicker({id:e.id,startIn:e.startIn});return i(r,e.recursive,void 0,e.skipDirectory)}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5516,5744],{52811(e,t,n){n.r(t),n.d(t,{default:()=>w,parseScene:()=>f});var r=n(96540),a=n(64572),s=n(34843),o=n(82893),l=n(14284),c=n(34289),i=n(62042),d=n(52671),u=n(57889),p=n(22022),m=n(53459),g=(n(3561),n(74848));function f(e){if(!e)return null;const t="string"==typeof e?e:e.context??e.data??e;if(!t)return null;try{return"string"==typeof t?JSON.parse(t):t}catch{return null}}function w(){const[e,t]=(0,s.fp)(o.AG.excalidraw_editor),[n,w]=(0,r.useState)(null),[x,v]=(0,r.useState)(null),[y,h]=(0,r.useState)(!1),S=(0,d.Zp)(),{t:A}=(0,p.Bd)(),k=(0,r.useRef)(()=>{});(0,r.useEffect)(()=>{k.current=z}),(0,r.useEffect)(()=>{let t=!1;return(async()=>{if(e?.url){h(!0);try{const n=await u.l.get(e.url);if(t)return;const r=f(n);if(!r)throw new Error("invalid excalidraw scene");v(r)}catch{t||(v(null),(0,i.zN)("Load Excalidraw file failed"))}finally{t||h(!1)}}else v(null)})(),()=>{t=!0}},[e?.url]);const z=async()=>{if(!n)return void(0,i.zN)("Editor is not ready");const t=n.getSceneElements(),r=n.getAppState(),s=n.getFiles(),o=(0,a.nu)(t,r,s,"local"),d=JSON.parse(o);d.appState={...d.appState??{},zoom:r.zoom,scrollX:r.scrollX,scrollY:r.scrollY,viewBackgroundColor:r.viewBackgroundColor,gridSize:r.gridSize};(await l.$M.post(`save/${encodeURIComponent((0,c.GG)("file",(0,c.vX)()))}${e.name}`,{context:JSON.stringify(d)})).code===m.m.Success&&(0,i.SK)("保存成功")};return(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key||83===e.keyCode)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),k.current())};return window.addEventListener("keydown",e,!0),document.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("keydown",e,!0)}},[]),(0,g.jsx)("div",{id:"excalidraw-container",children:(0,g.jsxs)("div",{className:"excalidraw-context",children:[y&&(0,g.jsx)("div",{className:"common-box common-box-center",children:"Loading..."}),!y&&x&&(0,g.jsx)(a.Td,{langCode:"zh-CN",initialData:x,excalidrawAPI:e=>w(e),onKeyDown:e=>!(!e.ctrlKey&&!e.metaKey||"s"!==e.key&&"S"!==e.key&&83!==e.keyCode)&&(e.preventDefault(),k.current(),!0),UIOptions:{dockedSidebarBreakpoint:0},children:(0,g.jsxs)(a.zU,{children:[(0,g.jsx)(a.zU.Item,{onSelect:()=>{t({}),S((0,c.vX)()),e?.close?.()},children:A("关闭")}),(0,g.jsx)(a.zU.Item,{onSelect:z,children:A("保存到服务器")}),(0,g.jsxs)(a.zU.Group,{title:"Excalidraw items",children:[(0,g.jsx)(a.zU.DefaultItems.LoadScene,{}),(0,g.jsx)(a.zU.DefaultItems.Export,{}),(0,g.jsx)(a.zU.DefaultItems.SaveToActiveFile,{}),(0,g.jsx)(a.zU.DefaultItems.SaveAsImage,{}),(0,g.jsx)(a.zU.DefaultItems.ClearCanvas,{}),(0,g.jsx)(a.zU.DefaultItems.ToggleTheme,{}),(0,g.jsx)(a.zU.DefaultItems.ChangeCanvasBackground,{})]})]})},e.url??"excalidraw")]})})}},16575(e,t,n){n.r(t),n.d(t,{default:()=>p});var r=n(96540),a=n(64572),s=n(57889),o=n(14284),l=n(62042),c=n(53459),i=n(22022),d=n(52811),u=(n(3561),n(74848));function p(e){const{t}=(0,i.Bd)(),[n,p]=(0,r.useState)(null),[m,g]=(0,r.useState)(null),[f,w]=(0,r.useState)(!1),x=(0,r.useRef)(!1),v=(0,r.useRef)(!1),y=(0,r.useRef)({api:n,props:e});y.current={api:n,props:e};const h=async()=>{const e=(()=>{const e=y.current.api;if(!e)return null;const t=e.getSceneElements(),n=e.getAppState(),r=e.getFiles(),s=(0,a.nu)(t,n,r,"local"),o=JSON.parse(s);return o.appState={...o.appState??{},zoom:n.zoom,scrollX:n.scrollX,scrollY:n.scrollY,viewBackgroundColor:n.viewBackgroundColor,gridSize:n.gridSize},JSON.stringify(o)})();if(null===e)return(0,l.zN)(t("编辑器尚未就绪")),!1;return(await o.$M.post(`save/${encodeURIComponent(y.current.props.save_path)}`,{context:e})).code===c.m.Success&&(x.current=!1,y.current.props.on_dirty?.(!1),y.current.props.on_saved?.(),(0,l.SK)(t("保存成功")),!0)};return(0,r.useEffect)(()=>{e.register?.({save:h,is_dirty:()=>x.current})},[e.register]),(0,r.useEffect)(()=>{let n=!1;return(async()=>{if(e.url){w(!0);try{const t=await s.l.get(e.url);if(n)return;const r=(0,d.parseScene)(t);if(!r)throw new Error("invalid excalidraw scene");g(r)}catch{n||(g(null),(0,l.zN)(t("加载画板失败")))}finally{n||w(!1)}}else g(null)})(),()=>{n=!0}},[e.url]),(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key||83===e.keyCode)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),h())};return window.addEventListener("keydown",e,!0),document.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("keydown",e,!0)}},[]),(0,u.jsxs)("div",{className:"excalidraw-inline",children:[f&&(0,u.jsx)("div",{className:"common-box common-box-center",children:"Loading..."}),!f&&m&&(0,u.jsx)(a.Td,{langCode:"zh-CN",initialData:m,excalidrawAPI:e=>p(e),onChange:()=>{v.current?x.current||(x.current=!0,y.current.props.on_dirty?.(!0)):v.current=!0},onKeyDown:e=>!(!e.ctrlKey&&!e.metaKey||"s"!==e.key&&"S"!==e.key&&83!==e.keyCode)&&(e.preventDefault(),h(),!0),UIOptions:{dockedSidebarBreakpoint:0},children:(0,u.jsxs)(a.zU,{children:[(0,u.jsx)(a.zU.Item,{onSelect:()=>h(),children:t("保存到服务器")}),(0,u.jsxs)(a.zU.Group,{title:"Excalidraw items",children:[(0,u.jsx)(a.zU.DefaultItems.Export,{}),(0,u.jsx)(a.zU.DefaultItems.SaveAsImage,{}),(0,u.jsx)(a.zU.DefaultItems.ClearCanvas,{}),(0,u.jsx)(a.zU.DefaultItems.ToggleTheme,{}),(0,u.jsx)(a.zU.DefaultItems.ChangeCanvasBackground,{})]})]})},e.reset_key??e.url??"excalidraw")]})}},51953(e){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg=="},17834(e){e.exports='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>'},56933(e){e.exports='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path fill="%23ced4da" d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>'}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5516,5744],{52811(e,t,n){n.r(t),n.d(t,{default:()=>w,parseScene:()=>f});var r=n(96540),a=n(60882),s=n(34843),o=n(82893),l=n(14284),c=n(34289),i=n(62042),d=n(61973),u=n(57889),p=n(22022),m=n(53459),g=(n(3561),n(74848));function f(e){if(!e)return null;const t="string"==typeof e?e:e.context??e.data??e;if(!t)return null;try{return"string"==typeof t?JSON.parse(t):t}catch{return null}}function w(){const[e,t]=(0,s.fp)(o.AG.excalidraw_editor),[n,w]=(0,r.useState)(null),[x,v]=(0,r.useState)(null),[y,h]=(0,r.useState)(!1),S=(0,d.Zp)(),{t:A}=(0,p.Bd)(),k=(0,r.useRef)(()=>{});(0,r.useEffect)(()=>{k.current=z}),(0,r.useEffect)(()=>{let t=!1;return(async()=>{if(e?.url){h(!0);try{const n=await u.l.get(e.url);if(t)return;const r=f(n);if(!r)throw new Error("invalid excalidraw scene");v(r)}catch{t||(v(null),(0,i.zN)("Load Excalidraw file failed"))}finally{t||h(!1)}}else v(null)})(),()=>{t=!0}},[e?.url]);const z=async()=>{if(!n)return void(0,i.zN)("Editor is not ready");const t=n.getSceneElements(),r=n.getAppState(),s=n.getFiles(),o=(0,a.nu)(t,r,s,"local"),d=JSON.parse(o);d.appState={...d.appState??{},zoom:r.zoom,scrollX:r.scrollX,scrollY:r.scrollY,viewBackgroundColor:r.viewBackgroundColor,gridSize:r.gridSize};(await l.$M.post(`save/${encodeURIComponent((0,c.GG)("file",(0,c.vX)()))}${e.name}`,{context:JSON.stringify(d)})).code===m.m.Success&&(0,i.SK)("保存成功")};return(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key||83===e.keyCode)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),k.current())};return window.addEventListener("keydown",e,!0),document.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("keydown",e,!0)}},[]),(0,g.jsx)("div",{id:"excalidraw-container",children:(0,g.jsxs)("div",{className:"excalidraw-context",children:[y&&(0,g.jsx)("div",{className:"common-box common-box-center",children:"Loading..."}),!y&&x&&(0,g.jsx)(a.Td,{langCode:"zh-CN",initialData:x,excalidrawAPI:e=>w(e),onKeyDown:e=>!(!e.ctrlKey&&!e.metaKey||"s"!==e.key&&"S"!==e.key&&83!==e.keyCode)&&(e.preventDefault(),k.current(),!0),UIOptions:{dockedSidebarBreakpoint:0},children:(0,g.jsxs)(a.zU,{children:[(0,g.jsx)(a.zU.Item,{onSelect:()=>{t({}),S((0,c.vX)()),e?.close?.()},children:A("关闭")}),(0,g.jsx)(a.zU.Item,{onSelect:z,children:A("保存到服务器")}),(0,g.jsxs)(a.zU.Group,{title:"Excalidraw items",children:[(0,g.jsx)(a.zU.DefaultItems.LoadScene,{}),(0,g.jsx)(a.zU.DefaultItems.Export,{}),(0,g.jsx)(a.zU.DefaultItems.SaveToActiveFile,{}),(0,g.jsx)(a.zU.DefaultItems.SaveAsImage,{}),(0,g.jsx)(a.zU.DefaultItems.ClearCanvas,{}),(0,g.jsx)(a.zU.DefaultItems.ToggleTheme,{}),(0,g.jsx)(a.zU.DefaultItems.ChangeCanvasBackground,{})]})]})},e.url??"excalidraw")]})})}},16575(e,t,n){n.r(t),n.d(t,{default:()=>p});var r=n(96540),a=n(60882),s=n(57889),o=n(14284),l=n(62042),c=n(53459),i=n(22022),d=n(52811),u=(n(3561),n(74848));function p(e){const{t}=(0,i.Bd)(),[n,p]=(0,r.useState)(null),[m,g]=(0,r.useState)(null),[f,w]=(0,r.useState)(!1),x=(0,r.useRef)(!1),v=(0,r.useRef)(!1),y=(0,r.useRef)({api:n,props:e});y.current={api:n,props:e};const h=async()=>{const e=(()=>{const e=y.current.api;if(!e)return null;const t=e.getSceneElements(),n=e.getAppState(),r=e.getFiles(),s=(0,a.nu)(t,n,r,"local"),o=JSON.parse(s);return o.appState={...o.appState??{},zoom:n.zoom,scrollX:n.scrollX,scrollY:n.scrollY,viewBackgroundColor:n.viewBackgroundColor,gridSize:n.gridSize},JSON.stringify(o)})();if(null===e)return(0,l.zN)(t("编辑器尚未就绪")),!1;return(await o.$M.post(`save/${encodeURIComponent(y.current.props.save_path)}`,{context:e})).code===c.m.Success&&(x.current=!1,y.current.props.on_dirty?.(!1),y.current.props.on_saved?.(),(0,l.SK)(t("保存成功")),!0)};return(0,r.useEffect)(()=>{e.register?.({save:h,is_dirty:()=>x.current})},[e.register]),(0,r.useEffect)(()=>{let n=!1;return(async()=>{if(e.url){w(!0);try{const t=await s.l.get(e.url);if(n)return;const r=(0,d.parseScene)(t);if(!r)throw new Error("invalid excalidraw scene");g(r)}catch{n||(g(null),(0,l.zN)(t("加载画板失败")))}finally{n||w(!1)}}else g(null)})(),()=>{n=!0}},[e.url]),(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key||83===e.keyCode)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),h())};return window.addEventListener("keydown",e,!0),document.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("keydown",e,!0)}},[]),(0,u.jsxs)("div",{className:"excalidraw-inline",children:[f&&(0,u.jsx)("div",{className:"common-box common-box-center",children:"Loading..."}),!f&&m&&(0,u.jsx)(a.Td,{langCode:"zh-CN",initialData:m,excalidrawAPI:e=>p(e),onChange:()=>{v.current?x.current||(x.current=!0,y.current.props.on_dirty?.(!0)):v.current=!0},onKeyDown:e=>!(!e.ctrlKey&&!e.metaKey||"s"!==e.key&&"S"!==e.key&&83!==e.keyCode)&&(e.preventDefault(),h(),!0),UIOptions:{dockedSidebarBreakpoint:0},children:(0,u.jsxs)(a.zU,{children:[(0,u.jsx)(a.zU.Item,{onSelect:()=>h(),children:t("保存到服务器")}),(0,u.jsxs)(a.zU.Group,{title:"Excalidraw items",children:[(0,u.jsx)(a.zU.DefaultItems.Export,{}),(0,u.jsx)(a.zU.DefaultItems.SaveAsImage,{}),(0,u.jsx)(a.zU.DefaultItems.ClearCanvas,{}),(0,u.jsx)(a.zU.DefaultItems.ToggleTheme,{}),(0,u.jsx)(a.zU.DefaultItems.ChangeCanvasBackground,{})]})]})},e.reset_key??e.url??"excalidraw")]})}},51953(e){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg=="},17834(e){e.exports='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>'},56933(e){e.exports='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path fill="%23ced4da" d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>'}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5877],{77481(e,t,n){n.d(t,{S:()=>c,X:()=>l});var s=n(96540),a=n(61443),r=n(74848);function l(e){const[t,n]=s.useState([]),l=(0,s.useRef)(-1),[c,o]=(0,s.useState)(-1),[i,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const u=()=>{l.current=-1,o(-1),d(-1)};return(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let l=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(l=`${t} (${s.label})`)}return(0,r.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,r.jsx)(a.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:l}):t},n)})})}),(0,r.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,r.jsx)("tr",{className:s?(c===n?"row-dragging":"")+(i===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(l.current=n,o(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||l.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=l.current,n=i;u(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:u,children:t.map((n,s)=>{const a=s===t.length-1?"small":"";return(0,r.jsx)("td",{className:a,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function c(e){return(0,r.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,r.jsx)("div",{children:e},t))})}},83029(e,t,n){n.d(t,{N:()=>j});var s=n(96540),a=n(34843),r=n(82893),l=n(74848);function c(e){const[t,n]=(0,a.fp)(r.AG.user_base_info);return(0,l.jsx)("div",{children:e.div?(0,l.jsx)("div",{className:"nav_list_a",style:{background:e.color},children:e.name}):e.clickItem||"dir"===e._type?(0,l.jsx)("div",{className:"nav_list_a",style:{background:e.color},onClick:()=>{"dir"!==e._type?e.clickItem&&e.clickItem(e):e.click_dir(e.item)},children:e.name}):(0,l.jsx)("a",{href:e.url,target:e.target,className:"nav_list_a",style:{background:e.color},children:e.name})})}var o=n(64694),i=n(61443),d=n(85997),u=n(52671),h=n(22022);const p=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let m,x,_=[];const f=[];function j(e){const[t,n]=(0,s.useState)([]),[j,v]=(0,s.useState)(-1),g=(0,u.zy)(),[S,y]=(0,s.useState)(!1),[C,w]=(0,s.useState)(!1),{t:k}=(0,h.Bd)(),[b,I]=(0,s.useState)([]),[N,D]=(0,a.fp)(r.AG.nav_index_add_item_by_now_list),A=e=>{-1!==j?f[j]._children=e:_=e};(0,s.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();_=t,n(_)})()},[g]);(0,s.useEffect)(()=>{if(N){const e=[...t,{name:"",color:(0,o.Lr)(p),...N}];A(e),n(e),y(!0),D(void 0)}},[N]);const K=e=>{v(j+1),n(e._children),f.push(e)};return(0,l.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==j&&(0,l.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{n(0===j?_:f[j-1]._children),v(j-1),f.pop()}}),t.map((a,r)=>(0,l.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{m=t})(0,r),onDrop:e=>((e,s)=>{e.preventDefault();const a=t[m],r=t[s];if(r&&"dir"===r._type){const e=[...t];return e.splice(m,1),r._children||(r._children=[]),r._children.push(a),A(e),void n(e)}const l=[...t],c=l[m];l.splice(m,1),l.splice(s,0,c),A(l),n(l)})(e,r),style:{cursor:S?"move":"pointer"},children:[(0,l.jsx)(c,{name:a.name,item:a,...a,div:S,target:"_blank",click_dir:K,clickItem:e.clickItem}),S&&(void 0!==b.find(e=>e===r)||C)&&(0,l.jsxs)("div",{className:C?"":" site_edit ",children:["dir"===a._type?(0,l.jsxs)(s.Fragment,{children:[(0,l.jsx)(i.Sm,{value:a.name,handleInputChange:e=>{a.name=e},placeholder:k("输入类目名"),no_border:!0}),(0,l.jsx)(i.Sm,{value:a.color,handleInputChange:e=>{a.color=e},placeholder:"color",no_border:!0})]}):e.items.map((e,t)=>(0,l.jsx)("div",{children:(0,l.jsx)(i.Sm,{value:a[e.key],handleInputChange:t=>{a[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!C&&(0,l.jsx)(d.C3,{text:k("折叠"),clickFun:()=>{I((0,o.P1)(b,r))}})]}),S&&(0,l.jsx)("div",{style:{display:"block"},children:(0,l.jsxs)("span",{className:"div-row ",children:[(0,l.jsx)(d.C3,{text:k("删除"),clickFun:()=>{(e=>{const s=[...t];s.splice(e,1),A(s),n(s)})(r)}}),(0,l.jsx)(d.C3,{text:k("编辑"),clickFun:()=>{void 0===b.find(e=>e===r)&&I([...b,r])}})]})})]},r)),S&&(0,l.jsxs)("div",{style:{display:"block"},children:[(0,l.jsx)(d.rA,{title:k("取消"),icon:"cancel",onClick:()=>{I([]),y(!1),x&&(n(x),A(x)),w(!1)}}),(0,l.jsx)(d.rA,{title:k("添加"),icon:"add",onClick:async()=>{const s=[...t,{name:"",color:(0,o.Lr)(p),...e.get_pre_add_item&&await e.get_pre_add_item()}];A(s),n(s)}}),(0,l.jsx)(d.rA,{title:k("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];A(e),n(e)}}),(0,l.jsx)(d.rA,{title:k("全部编辑"),icon:C?"unfold_less":"unfold_more",onClick:()=>{w(!C)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,l.jsx)(d.rA,{icon:S?"save":"edit",title:k(S?"保存":"编辑"),onClick:async()=>{S?e.save&&await e.save(_):x=t,y(!S)}})]})}},65877(e,t,n){n.r(t),n.d(t,{default:()=>A});var s=n(96540),a=n(75725),r=n(61443),l=n(70447),c=n(85997),o=n(34289),i=n(22022),d=n(62042),u=n(14284),h=n(53459),p=n(74848);function m(e){const{t}=(0,i.Bd)(),[n,m]=(0,s.useState)(t("毫秒")),[x,_]=(0,s.useState)(""),[f,j]=(0,s.useState)(""),[v,g]=(0,s.useState)(null),[S,y]=(0,s.useState)(null),[C,w]=(0,s.useState)(Date.now());return(0,s.useEffect)(()=>{(async()=>{const e=await u.Yu.get("sys_time/get");if(e.code===h.m.Success){const t=await e.data;g(t.timestamp),y(t.timezone),w(t.timestamp)}})();const e=setInterval(()=>{w(e=>e+1e3)},1e3);return()=>clearInterval(e)},[]),(0,p.jsxs)(a.fI,{children:[(0,p.jsx)(a.VP,{widthPer:33,children:(0,p.jsxs)(l.Zp,{title:t("时间转换器"),rightBottomCom:(0,p.jsx)(c.C3,{text:t("确定"),clickFun:function(){if(!x&&!f)return void(0,d.zN)("不能都为空");let e=0;const t=""!==x&&0!==x;if(t){if(!(0,o.kf)(x))return void(0,d.zN)("must be number !");e=parseInt(x),"分秒"===n&&(e*=1e3)}const s=new Date(t?e:f),a=new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(s);if(j(a),!x){const e=s.getTime();_("毫秒"===n?e:e/1e3)}}}),children:[(0,p.jsx)(r.l6,{value:n,options:[{title:t("毫秒"),value:"毫秒"},{title:t("分秒"),value:"分秒"}],onChange:function(e){m(e)}}),(0,p.jsx)(r.Sm,{placeholder:n,value:x,handleInputChange:e=>{_(e)}}),(0,p.jsx)(r.Sm,{placeholder:t("格式化时间"),value:f,handleInputChange:e=>{j(e)}})]})}),(0,p.jsx)(a.VP,{children:null!==v&&null!==S&&(0,p.jsxs)(l.Zp,{title:t("服务器时间"),children:[(0,p.jsxs)("h1",{children:[t("时区"),": ",S]}),(0,p.jsxs)("h1",{children:[t("时间"),": ",new Date(C).toLocaleString(navigator.language,{timeZone:S})]})]})})]})}var x=n(4412),_=n(83029),f=n(78247),j=n(23430);function v(e){const{t}=(0,i.Bd)(),{check_user_auth:n}=(0,f.MH)(),[a,l]=(0,s.useState)(""),o=async e=>{const t=e||a;if(!t)return void(0,d.zN)("mac地址不能为空");(await u._U.post("wol/exec",{mac:t})).code===h.m.Success&&(0,d.SK)("发送唤醒命令成功")};return(0,p.jsxs)("div",{children:[(0,p.jsxs)(x.aZ,{position:"right",children:[(0,p.jsx)(c.rA,{icon:"play_arrow",title:t("发送"),onClick:()=>{o()}}),(0,p.jsx)(r.$Z,{placeholder:t("mac_dst"),icon:"laptop_mac",value:a,handleInputChange:e=>l(e)})]}),(0,p.jsx)(_.N,{have_auth_edit:n(j.oV.wol_proxy_tag_update),getItems:async()=>{const e=await u._U.get("wol/tag");return e.code===h.m.Success?e.data:[]},save:async e=>{(await u._U.post("wol/tag/save",e)).code!==h.m.Success&&(0,d.zN)("网络错误")},clickItem:async e=>{l(e.mac),o(e.mac)},items:[{key:"name",preName:t("名字")},{key:"mac",preName:"mac"+t("地址")},{key:"color",preName:"color"}]})]})}var g=n(77481),S=n(34843),y=n(82893),C=n(40505);let w;function k(){const[e,t]=(0,s.useState)("rsa"),[n,o]=(0,s.useState)("pem"),{t:m,i18n:_}=(0,i.Bd)(),[f,j]=(0,S.fp)(y.AG.confirm),[v,k]=(0,s.useState)(""),[b,I]=(0,s.useState)(""),N=async t=>{if(!b||!v)return void(0,d.zN)("密钥不能为空");let n="id_"+e;"pub"===t&&(n+=".pub"),j({open:!0,title:m("将覆盖密钥文件"),sub_title:`之前的密钥将作废。 将会作为 ${n} 文件保存到系统上的"${w}"目录下,此目录会作为openssh(git)所使用的默认目录。`,handle:async()=>{(await u.cD.post("save_openssh",{name:n,context:"pub"===t?v:b})).code===h.m.Success&&((0,d.SK)("完成"),j({open:!1,handle:null}))}})};return(0,p.jsxs)(s.Fragment,{children:[(0,p.jsx)(x.aZ,{position:"right",children:(0,p.jsx)(g.S,{isFlex:!0,columns:[(0,p.jsx)(r.l6,{tip:m("加密算法"),value:e,width:"auto",onChange:e=>{t(e)},options:[{title:m("RSA"),value:"rsa"},{title:m("DSA"),value:"dsa"},{title:m("ECDSA"),value:"ecdsa"}]}),(0,p.jsx)(r.l6,{tip:m("输出格式"),value:n,width:"auto",onChange:e=>{o(e)},options:[{title:m("普通PEM"),value:"pem"},{title:m("opensshPEM"),value:"openssh_pem"}]}),(0,p.jsx)(c.rA,{icon:"play_arrow",title:m("生成"),onClick:()=>{(async()=>{const t=await u.cD.post("generate",{type:e,form:n});t.code===h.m.Success&&(k(t.data.public_key),I(t.data.private_key),w=t.data.home_path)})()}})]})}),(0,p.jsx)(a.xh,{children:(0,p.jsxs)(a.fI,{children:[(0,p.jsx)(a.VP,{children:(0,p.jsx)(l.Zp,{title:m("公钥"),titleCom:(0,p.jsx)(c.rA,{title:m("复制"),icon:"copy_all",onClick:()=>{v&&((0,C.lW)(v),(0,d.SK)("完成"))}}),rightBottomCom:"openssh_pem"===n&&(0,p.jsx)(c.C3,{text:m("ssh_dir"),clickFun:()=>{N("pub")}}),children:(0,p.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",height:"270px"},onChange:e=>{k(e.target.value)},value:v})})}),(0,p.jsx)(a.VP,{children:(0,p.jsx)(l.Zp,{title:m("私钥"),titleCom:(0,p.jsx)(c.rA,{title:m("复制"),icon:"copy_all",onClick:()=>{b&&((0,C.lW)(b),(0,d.SK)("成功"))}}),rightBottomCom:"openssh_pem"===n&&(0,p.jsx)(c.C3,{text:m("ssh_dir"),clickFun:()=>{N("pri")}}),children:(0,p.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",height:"270px"},value:b,onChange:e=>{I(e.target.value)}})})})]})})]})}var b=n(14944),I=n(92275);function N(){const{t:e}=(0,i.Bd)(),[t,n]=(0,s.useState)(""),[o,u]=(0,s.useState)("1"),[h,m]=(0,s.useState)("65535"),[x,_]=(0,s.useState)("100"),[f,j]=(0,s.useState)("2000"),[v,S]=(0,s.useState)(!1),[y,C]=(0,s.useState)(null),[w,k]=(0,s.useState)([]),[N,D]=(0,s.useState)(null),A=(0,s.useRef)([]),K=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!K.current)return K.current=!0,b.ws.addMsg(I.HK.port_scan_progress,e=>{C(e.context)}),b.ws.addMsg(I.HK.port_scan_result,e=>{const t=e.context,n=[...A.current,t];A.current=n,k(n)}),b.ws.addMsg(I.HK.port_scan_end,t=>{D(t.context),S(!1),t.context.cancelled?(0,d.zN)(e("扫描已取消")):(0,d.SK)(e("扫描完成"))}),()=>{b.ws.sendData(I.HK.port_scan_cancel,{}),b.ws.removeMsg(I.HK.port_scan_progress),b.ws.removeMsg(I.HK.port_scan_result),b.ws.removeMsg(I.HK.port_scan_end),K.current=!1}},[]);return(0,p.jsx)(a.xh,{children:(0,p.jsx)(a.fI,{children:(0,p.jsx)(a.VP,{children:(0,p.jsxs)(l.Zp,{title:e("TCP ")+e("端口扫描"),titleCom:(0,p.jsxs)("span",{children:[y&&(0,p.jsxs)("span",{children:[e("已发现"),": ",y.openCount]}),N&&(0,p.jsxs)("span",{children:[e("总计扫描"),": ",N.totalScanned," | ",e("开放"),": ",N.totalOpen]})]}),rightBottomCom:v?(0,p.jsx)(c.C3,{text:e("取消"),clickFun:()=>{b.ws.sendData(I.HK.port_scan_cancel,{}).catch(()=>{})}}):(0,p.jsx)(c.C3,{text:e("扫描"),clickFun:()=>(()=>{if(!t)return void(0,d.zN)(e("hostreq"));const n=parseInt(o),s=parseInt(h);isNaN(n)||isNaN(s)||n<1||s<1||n>65535||s>65535?(0,d.zN)(e("端口范围无效")):n>s?(0,d.zN)(e("portrng")):(S(!0),C(null),k([]),A.current=[],D(null),b.ws.sendData(I.HK.port_scan_req,{host:t,startPort:n,endPort:s,concurrency:parseInt(x)||100,timeout:parseInt(f)||2e3}).catch(()=>{}))})()}),children:[(0,p.jsx)(r.Sm,{placeholder:e("目标主机"),value:t,handleInputChange:e=>n(e)}),(0,p.jsx)(r.Sm,{placeholder:e("起始端口"),value:o,handleInputChange:e=>u(e)}),(0,p.jsx)(r.Sm,{placeholder:e("结束端口"),value:h,handleInputChange:e=>m(e)}),(0,p.jsx)(r.Sm,{placeholder:e("并发数"),value:x,handleInputChange:e=>_(e)}),(0,p.jsx)(r.Sm,{placeholder:e("超时(ms)"),value:f,handleInputChange:e=>j(e)}),v&&y&&(0,p.jsxs)("div",{children:[(0,p.jsxs)("p",{children:[e("已扫描"),": ",y.scanned," / ",y.total]}),(0,p.jsx)(l.gz,{progress:y.percent})]}),w.length>0&&(0,p.jsx)(g.X,{headers:[e("端口"),e("状态")],rows:w.map(t=>[t.port,(0,p.jsx)("span",{children:e("开放")})])}),v&&0===w.length&&(0,p.jsx)("p",{children:e("正在扫描...")}),!v&&N&&0===w.length&&(0,p.jsx)("p",{children:e("未发现开放端口")}),!v&&!N&&0===w.length&&(0,p.jsx)("p",{children:e("scan_in")})]})})})})}var D=n(87361);function A(e){const{t}=(0,i.Bd)(),{check_user_auth:n}=(0,f.MH)(),s=[];return s.push({index:1,name:t("时间工具"),rto:"timeutil/",component:(0,p.jsx)(m,{})},{index:1,name:t("非对称密钥"),rto:"crypto/",component:(0,p.jsx)(k,{})}),n(j.oV.port_scan)&&s.push({index:1,name:t("端口扫描"),rto:"portscan/",component:(0,p.jsx)(N,{})}),n(j.oV.wol_proxy)&&s.push({index:1,name:t("网络唤醒"),rto:"netwol/",component:(0,p.jsx)(v,{})}),(0,p.jsx)(a.W1,{optionList:s,father_route:D.o.toolbox})}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5877],{77481(e,t,n){n.d(t,{S:()=>c,X:()=>l});var s=n(96540),a=n(61443),r=n(74848);function l(e){const[t,n]=s.useState([]),l=(0,s.useRef)(-1),[c,o]=(0,s.useState)(-1),[i,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const u=()=>{l.current=-1,o(-1),d(-1)};return(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let l=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(l=`${t} (${s.label})`)}return(0,r.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,r.jsx)(a.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:l}):t},n)})})}),(0,r.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,r.jsx)("tr",{className:s?(c===n?"row-dragging":"")+(i===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(l.current=n,o(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||l.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=l.current,n=i;u(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:u,children:t.map((n,s)=>{const a=s===t.length-1?"small":"";return(0,r.jsx)("td",{className:a,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function c(e){return(0,r.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,r.jsx)("div",{children:e},t))})}},83029(e,t,n){n.d(t,{N:()=>j});var s=n(96540),a=n(34843),r=n(82893),l=n(74848);function c(e){const[t,n]=(0,a.fp)(r.AG.user_base_info);return(0,l.jsx)("div",{children:e.div?(0,l.jsx)("div",{className:"nav_list_a",style:{background:e.color},children:e.name}):e.clickItem||"dir"===e._type?(0,l.jsx)("div",{className:"nav_list_a",style:{background:e.color},onClick:()=>{"dir"!==e._type?e.clickItem&&e.clickItem(e):e.click_dir(e.item)},children:e.name}):(0,l.jsx)("a",{href:e.url,target:e.target,className:"nav_list_a",style:{background:e.color},children:e.name})})}var o=n(64694),i=n(61443),d=n(85997),u=n(61973),h=n(22022);const p=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let m,x,_=[];const f=[];function j(e){const[t,n]=(0,s.useState)([]),[j,v]=(0,s.useState)(-1),g=(0,u.zy)(),[S,y]=(0,s.useState)(!1),[C,w]=(0,s.useState)(!1),{t:k}=(0,h.Bd)(),[b,I]=(0,s.useState)([]),[N,D]=(0,a.fp)(r.AG.nav_index_add_item_by_now_list),A=e=>{-1!==j?f[j]._children=e:_=e};(0,s.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();_=t,n(_)})()},[g]);(0,s.useEffect)(()=>{if(N){const e=[...t,{name:"",color:(0,o.Lr)(p),...N}];A(e),n(e),y(!0),D(void 0)}},[N]);const K=e=>{v(j+1),n(e._children),f.push(e)};return(0,l.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==j&&(0,l.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{n(0===j?_:f[j-1]._children),v(j-1),f.pop()}}),t.map((a,r)=>(0,l.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{m=t})(0,r),onDrop:e=>((e,s)=>{e.preventDefault();const a=t[m],r=t[s];if(r&&"dir"===r._type){const e=[...t];return e.splice(m,1),r._children||(r._children=[]),r._children.push(a),A(e),void n(e)}const l=[...t],c=l[m];l.splice(m,1),l.splice(s,0,c),A(l),n(l)})(e,r),style:{cursor:S?"move":"pointer"},children:[(0,l.jsx)(c,{name:a.name,item:a,...a,div:S,target:"_blank",click_dir:K,clickItem:e.clickItem}),S&&(void 0!==b.find(e=>e===r)||C)&&(0,l.jsxs)("div",{className:C?"":" site_edit ",children:["dir"===a._type?(0,l.jsxs)(s.Fragment,{children:[(0,l.jsx)(i.Sm,{value:a.name,handleInputChange:e=>{a.name=e},placeholder:k("输入类目名"),no_border:!0}),(0,l.jsx)(i.Sm,{value:a.color,handleInputChange:e=>{a.color=e},placeholder:"color",no_border:!0})]}):e.items.map((e,t)=>(0,l.jsx)("div",{children:(0,l.jsx)(i.Sm,{value:a[e.key],handleInputChange:t=>{a[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!C&&(0,l.jsx)(d.C3,{text:k("折叠"),clickFun:()=>{I((0,o.P1)(b,r))}})]}),S&&(0,l.jsx)("div",{style:{display:"block"},children:(0,l.jsxs)("span",{className:"div-row ",children:[(0,l.jsx)(d.C3,{text:k("删除"),clickFun:()=>{(e=>{const s=[...t];s.splice(e,1),A(s),n(s)})(r)}}),(0,l.jsx)(d.C3,{text:k("编辑"),clickFun:()=>{void 0===b.find(e=>e===r)&&I([...b,r])}})]})})]},r)),S&&(0,l.jsxs)("div",{style:{display:"block"},children:[(0,l.jsx)(d.rA,{title:k("取消"),icon:"cancel",onClick:()=>{I([]),y(!1),x&&(n(x),A(x)),w(!1)}}),(0,l.jsx)(d.rA,{title:k("添加"),icon:"add",onClick:async()=>{const s=[...t,{name:"",color:(0,o.Lr)(p),...e.get_pre_add_item&&await e.get_pre_add_item()}];A(s),n(s)}}),(0,l.jsx)(d.rA,{title:k("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];A(e),n(e)}}),(0,l.jsx)(d.rA,{title:k("全部编辑"),icon:C?"unfold_less":"unfold_more",onClick:()=>{w(!C)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,l.jsx)(d.rA,{icon:S?"save":"edit",title:k(S?"保存":"编辑"),onClick:async()=>{S?e.save&&await e.save(_):x=t,y(!S)}})]})}},65877(e,t,n){n.r(t),n.d(t,{default:()=>A});var s=n(96540),a=n(75725),r=n(61443),l=n(70447),c=n(85997),o=n(34289),i=n(22022),d=n(62042),u=n(14284),h=n(53459),p=n(74848);function m(e){const{t}=(0,i.Bd)(),[n,m]=(0,s.useState)(t("毫秒")),[x,_]=(0,s.useState)(""),[f,j]=(0,s.useState)(""),[v,g]=(0,s.useState)(null),[S,y]=(0,s.useState)(null),[C,w]=(0,s.useState)(Date.now());return(0,s.useEffect)(()=>{(async()=>{const e=await u.Yu.get("sys_time/get");if(e.code===h.m.Success){const t=await e.data;g(t.timestamp),y(t.timezone),w(t.timestamp)}})();const e=setInterval(()=>{w(e=>e+1e3)},1e3);return()=>clearInterval(e)},[]),(0,p.jsxs)(a.fI,{children:[(0,p.jsx)(a.VP,{widthPer:33,children:(0,p.jsxs)(l.Zp,{title:t("时间转换器"),rightBottomCom:(0,p.jsx)(c.C3,{text:t("确定"),clickFun:function(){if(!x&&!f)return void(0,d.zN)("不能都为空");let e=0;const t=""!==x&&0!==x;if(t){if(!(0,o.kf)(x))return void(0,d.zN)("must be number !");e=parseInt(x),"分秒"===n&&(e*=1e3)}const s=new Date(t?e:f),a=new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(s);if(j(a),!x){const e=s.getTime();_("毫秒"===n?e:e/1e3)}}}),children:[(0,p.jsx)(r.l6,{value:n,options:[{title:t("毫秒"),value:"毫秒"},{title:t("分秒"),value:"分秒"}],onChange:function(e){m(e)}}),(0,p.jsx)(r.Sm,{placeholder:n,value:x,handleInputChange:e=>{_(e)}}),(0,p.jsx)(r.Sm,{placeholder:t("格式化时间"),value:f,handleInputChange:e=>{j(e)}})]})}),(0,p.jsx)(a.VP,{children:null!==v&&null!==S&&(0,p.jsxs)(l.Zp,{title:t("服务器时间"),children:[(0,p.jsxs)("h1",{children:[t("时区"),": ",S]}),(0,p.jsxs)("h1",{children:[t("时间"),": ",new Date(C).toLocaleString(navigator.language,{timeZone:S})]})]})})]})}var x=n(4412),_=n(83029),f=n(78247),j=n(23430);function v(e){const{t}=(0,i.Bd)(),{check_user_auth:n}=(0,f.MH)(),[a,l]=(0,s.useState)(""),o=async e=>{const t=e||a;if(!t)return void(0,d.zN)("mac地址不能为空");(await u._U.post("wol/exec",{mac:t})).code===h.m.Success&&(0,d.SK)("发送唤醒命令成功")};return(0,p.jsxs)("div",{children:[(0,p.jsxs)(x.aZ,{position:"right",children:[(0,p.jsx)(c.rA,{icon:"play_arrow",title:t("发送"),onClick:()=>{o()}}),(0,p.jsx)(r.$Z,{placeholder:t("mac_dst"),icon:"laptop_mac",value:a,handleInputChange:e=>l(e)})]}),(0,p.jsx)(_.N,{have_auth_edit:n(j.oV.wol_proxy_tag_update),getItems:async()=>{const e=await u._U.get("wol/tag");return e.code===h.m.Success?e.data:[]},save:async e=>{(await u._U.post("wol/tag/save",e)).code!==h.m.Success&&(0,d.zN)("网络错误")},clickItem:async e=>{l(e.mac),o(e.mac)},items:[{key:"name",preName:t("名字")},{key:"mac",preName:"mac"+t("地址")},{key:"color",preName:"color"}]})]})}var g=n(77481),S=n(34843),y=n(82893),C=n(40505);let w;function k(){const[e,t]=(0,s.useState)("rsa"),[n,o]=(0,s.useState)("pem"),{t:m,i18n:_}=(0,i.Bd)(),[f,j]=(0,S.fp)(y.AG.confirm),[v,k]=(0,s.useState)(""),[b,I]=(0,s.useState)(""),N=async t=>{if(!b||!v)return void(0,d.zN)("密钥不能为空");let n="id_"+e;"pub"===t&&(n+=".pub"),j({open:!0,title:m("将覆盖密钥文件"),sub_title:`之前的密钥将作废。 将会作为 ${n} 文件保存到系统上的"${w}"目录下,此目录会作为openssh(git)所使用的默认目录。`,handle:async()=>{(await u.cD.post("save_openssh",{name:n,context:"pub"===t?v:b})).code===h.m.Success&&((0,d.SK)("完成"),j({open:!1,handle:null}))}})};return(0,p.jsxs)(s.Fragment,{children:[(0,p.jsx)(x.aZ,{position:"right",children:(0,p.jsx)(g.S,{isFlex:!0,columns:[(0,p.jsx)(r.l6,{tip:m("加密算法"),value:e,width:"auto",onChange:e=>{t(e)},options:[{title:m("RSA"),value:"rsa"},{title:m("DSA"),value:"dsa"},{title:m("ECDSA"),value:"ecdsa"}]}),(0,p.jsx)(r.l6,{tip:m("输出格式"),value:n,width:"auto",onChange:e=>{o(e)},options:[{title:m("普通PEM"),value:"pem"},{title:m("opensshPEM"),value:"openssh_pem"}]}),(0,p.jsx)(c.rA,{icon:"play_arrow",title:m("生成"),onClick:()=>{(async()=>{const t=await u.cD.post("generate",{type:e,form:n});t.code===h.m.Success&&(k(t.data.public_key),I(t.data.private_key),w=t.data.home_path)})()}})]})}),(0,p.jsx)(a.xh,{children:(0,p.jsxs)(a.fI,{children:[(0,p.jsx)(a.VP,{children:(0,p.jsx)(l.Zp,{title:m("公钥"),titleCom:(0,p.jsx)(c.rA,{title:m("复制"),icon:"copy_all",onClick:()=>{v&&((0,C.lW)(v),(0,d.SK)("完成"))}}),rightBottomCom:"openssh_pem"===n&&(0,p.jsx)(c.C3,{text:m("ssh_dir"),clickFun:()=>{N("pub")}}),children:(0,p.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",height:"270px"},onChange:e=>{k(e.target.value)},value:v})})}),(0,p.jsx)(a.VP,{children:(0,p.jsx)(l.Zp,{title:m("私钥"),titleCom:(0,p.jsx)(c.rA,{title:m("复制"),icon:"copy_all",onClick:()=>{b&&((0,C.lW)(b),(0,d.SK)("成功"))}}),rightBottomCom:"openssh_pem"===n&&(0,p.jsx)(c.C3,{text:m("ssh_dir"),clickFun:()=>{N("pri")}}),children:(0,p.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",height:"270px"},value:b,onChange:e=>{I(e.target.value)}})})})]})})]})}var b=n(14944),I=n(92275);function N(){const{t:e}=(0,i.Bd)(),[t,n]=(0,s.useState)(""),[o,u]=(0,s.useState)("1"),[h,m]=(0,s.useState)("65535"),[x,_]=(0,s.useState)("100"),[f,j]=(0,s.useState)("2000"),[v,S]=(0,s.useState)(!1),[y,C]=(0,s.useState)(null),[w,k]=(0,s.useState)([]),[N,D]=(0,s.useState)(null),A=(0,s.useRef)([]),K=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!K.current)return K.current=!0,b.ws.addMsg(I.HK.port_scan_progress,e=>{C(e.context)}),b.ws.addMsg(I.HK.port_scan_result,e=>{const t=e.context,n=[...A.current,t];A.current=n,k(n)}),b.ws.addMsg(I.HK.port_scan_end,t=>{D(t.context),S(!1),t.context.cancelled?(0,d.zN)(e("扫描已取消")):(0,d.SK)(e("扫描完成"))}),()=>{b.ws.sendData(I.HK.port_scan_cancel,{}),b.ws.removeMsg(I.HK.port_scan_progress),b.ws.removeMsg(I.HK.port_scan_result),b.ws.removeMsg(I.HK.port_scan_end),K.current=!1}},[]);return(0,p.jsx)(a.xh,{children:(0,p.jsx)(a.fI,{children:(0,p.jsx)(a.VP,{children:(0,p.jsxs)(l.Zp,{title:e("TCP ")+e("端口扫描"),titleCom:(0,p.jsxs)("span",{children:[y&&(0,p.jsxs)("span",{children:[e("已发现"),": ",y.openCount]}),N&&(0,p.jsxs)("span",{children:[e("总计扫描"),": ",N.totalScanned," | ",e("开放"),": ",N.totalOpen]})]}),rightBottomCom:v?(0,p.jsx)(c.C3,{text:e("取消"),clickFun:()=>{b.ws.sendData(I.HK.port_scan_cancel,{}).catch(()=>{})}}):(0,p.jsx)(c.C3,{text:e("扫描"),clickFun:()=>(()=>{if(!t)return void(0,d.zN)(e("hostreq"));const n=parseInt(o),s=parseInt(h);isNaN(n)||isNaN(s)||n<1||s<1||n>65535||s>65535?(0,d.zN)(e("端口范围无效")):n>s?(0,d.zN)(e("portrng")):(S(!0),C(null),k([]),A.current=[],D(null),b.ws.sendData(I.HK.port_scan_req,{host:t,startPort:n,endPort:s,concurrency:parseInt(x)||100,timeout:parseInt(f)||2e3}).catch(()=>{}))})()}),children:[(0,p.jsx)(r.Sm,{placeholder:e("目标主机"),value:t,handleInputChange:e=>n(e)}),(0,p.jsx)(r.Sm,{placeholder:e("起始端口"),value:o,handleInputChange:e=>u(e)}),(0,p.jsx)(r.Sm,{placeholder:e("结束端口"),value:h,handleInputChange:e=>m(e)}),(0,p.jsx)(r.Sm,{placeholder:e("并发数"),value:x,handleInputChange:e=>_(e)}),(0,p.jsx)(r.Sm,{placeholder:e("超时(ms)"),value:f,handleInputChange:e=>j(e)}),v&&y&&(0,p.jsxs)("div",{children:[(0,p.jsxs)("p",{children:[e("已扫描"),": ",y.scanned," / ",y.total]}),(0,p.jsx)(l.gz,{progress:y.percent})]}),w.length>0&&(0,p.jsx)(g.X,{headers:[e("端口"),e("状态")],rows:w.map(t=>[t.port,(0,p.jsx)("span",{children:e("开放")})])}),v&&0===w.length&&(0,p.jsx)("p",{children:e("正在扫描...")}),!v&&N&&0===w.length&&(0,p.jsx)("p",{children:e("未发现开放端口")}),!v&&!N&&0===w.length&&(0,p.jsx)("p",{children:e("scan_in")})]})})})})}var D=n(87361);function A(e){const{t}=(0,i.Bd)(),{check_user_auth:n}=(0,f.MH)(),s=[];return s.push({index:1,name:t("时间工具"),rto:"timeutil/",component:(0,p.jsx)(m,{})},{index:1,name:t("非对称密钥"),rto:"crypto/",component:(0,p.jsx)(k,{})}),n(j.oV.port_scan)&&s.push({index:1,name:t("端口扫描"),rto:"portscan/",component:(0,p.jsx)(N,{})}),n(j.oV.wol_proxy)&&s.push({index:1,name:t("网络唤醒"),rto:"netwol/",component:(0,p.jsx)(v,{})}),(0,p.jsx)(a.W1,{optionList:s,father_route:D.o.toolbox})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6247],{77481(e,t,n){n.d(t,{S:()=>i,X:()=>s});var r=n(96540),o=n(61443),l=n(74848);function s(e){const[t,n]=r.useState([]),s=(0,r.useRef)(-1),[i,a]=(0,r.useState)(-1),[c,d]=(0,r.useState)(-1);(0,r.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const h=()=>{s.current=-1,a(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((t,n)=>{const r=!!e.filter&&(e.filter.column??0)===n;let s=t;if(r){const n=e.filter,r=n.options.find(e=>e.value===n.value);null!=n.value&&r&&(s=`${t} (${r.label})`)}return(0,l.jsx)("th",{className:r?"table-filter-col":"",children:r?(0,l.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:s}):t},n)})})}),(0,l.jsx)("tbody",{children:t.map((t,n)=>{const r=!!e.onRowDrag;return(0,l.jsx)("tr",{className:r?(i===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:r,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{r&&(s.current=n,a(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!r||s.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{r&&(t.preventDefault(),(()=>{const t=s.current,n=c;h(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:h,children:t.map((n,r)=>{const o=r===t.length-1?"small":"";return(0,l.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},r)})},n)})})]})}function i(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,l.jsx)("div",{children:e},t))})}},66247(e,t,n){n.r(t),n.d(t,{default:()=>C});var r=n(96540),o=n(75725),l=n(70447),s=n(85997),i=n(77481),a=n(61443),c=n(22022),d=n(14284),h=n(53459),u=n(62042),f=n(87361),x=n(40505),p=n(4412),j=n(52671),_=n(34843),m=n(82893),w=n(21469),v=n(21499),g=n(64694),b=n(74848);function C(){const{t:e,i18n:t}=(0,c.Bd)(),n=(0,j.Zp)(),C=[e("编号"),e("路径"),e("过期小时"),e("token"),e("备注"),e("剩余时间(h)"),e("下载次数")],[k,S]=(0,r.useState)([]),[y,A]=(0,_.fp)(m.AG.prompt_card),D=async()=>{const e=await d.XO.get("get_share_file_list");if(e.code===h.m.Success){const t=e.data??[],n=Date.now();for(const e of t)try{if(null!=e.left_hour&&e.left_hour>0){const t=n-e.time_stamp,r=36e5*e.left_hour-t;e.show_left_hour=parseFloat((r/36e5).toFixed(2))}else e.show_left_hour=e.left_hour}catch(e){}S(t)}};(0,r.useEffect)(()=>{D()},[]);return(0,b.jsxs)("div",{className:"common-box ",style:{overflowY:"auto"},children:[(0,b.jsx)(p.aZ,{position:"right",children:(0,b.jsx)(s.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{n(-1)}})}),(0,b.jsx)(o.J,{widthPer:100,children:(0,b.jsx)(l.uF,{self_title:(0,b.jsxs)("span",{className:" div-row ",children:[(0,b.jsx)("h2",{children:e("文件分享列表")}),(0,b.jsx)(s.rA,{icon:"info",title:e("提示"),onClick:()=>{let e=(0,b.jsx)("div",{children:"小时设置为-1或者不设置就没有过期时间"});A({open:!0,title:"信息",context_div:(0,b.jsx)("div",{children:e})})}})]}),titleCom:(0,b.jsxs)("div",{children:[(0,b.jsx)(s.rA,{icon:"add",title:e("添加"),onClick:()=>{S([...k,{note:"",path:""}])}}),(0,b.jsx)(s.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("set_share_file_list",k)).code===h.m.Success&&((0,u.SK)("保存成功"),D())}})]}),children:(0,b.jsx)(i.X,{headers:C,onRowDrag:(e,t)=>{S((0,g.TI)(k,e,t))},rows:k.map((t,n)=>{const r=[(0,b.jsx)("div",{children:n}),(0,b.jsx)(a.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.left_hour,handleInputChange:e=>{t.left_hour=parseFloat(e),t.time_stamp=Date.now()},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.token,handleInputChange:e=>{t.token=e},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,b.jsx)("p",{children:t.show_left_hour}),(0,b.jsx)("p",{children:t.download_num}),(0,b.jsxs)("div",{children:[(0,b.jsx)(s.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),S([...k])})(n)}),t.id&&(0,b.jsx)(s.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);(0,x.lW)(e),(0,u.SK)(e)}}),t.id&&(0,b.jsx)(s.rA,{icon:"open_in_new",title:e("打开新页面"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);window.open(e)}})]})];return r}),width:"10rem"})})})]})}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6247],{77481(e,t,n){n.d(t,{S:()=>i,X:()=>s});var r=n(96540),o=n(61443),l=n(74848);function s(e){const[t,n]=r.useState([]),s=(0,r.useRef)(-1),[i,a]=(0,r.useState)(-1),[c,d]=(0,r.useState)(-1);(0,r.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const h=()=>{s.current=-1,a(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((t,n)=>{const r=!!e.filter&&(e.filter.column??0)===n;let s=t;if(r){const n=e.filter,r=n.options.find(e=>e.value===n.value);null!=n.value&&r&&(s=`${t} (${r.label})`)}return(0,l.jsx)("th",{className:r?"table-filter-col":"",children:r?(0,l.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:s}):t},n)})})}),(0,l.jsx)("tbody",{children:t.map((t,n)=>{const r=!!e.onRowDrag;return(0,l.jsx)("tr",{className:r?(i===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:r,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{r&&(s.current=n,a(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!r||s.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{r&&(t.preventDefault(),(()=>{const t=s.current,n=c;h(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:h,children:t.map((n,r)=>{const o=r===t.length-1?"small":"";return(0,l.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},r)})},n)})})]})}function i(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,l.jsx)("div",{children:e},t))})}},66247(e,t,n){n.r(t),n.d(t,{default:()=>C});var r=n(96540),o=n(75725),l=n(70447),s=n(85997),i=n(77481),a=n(61443),c=n(22022),d=n(14284),h=n(53459),u=n(62042),f=n(87361),x=n(40505),p=n(4412),j=n(61973),_=n(34843),m=n(82893),w=n(21469),v=n(21499),g=n(64694),b=n(74848);function C(){const{t:e,i18n:t}=(0,c.Bd)(),n=(0,j.Zp)(),C=[e("编号"),e("路径"),e("过期小时"),e("token"),e("备注"),e("剩余时间(h)"),e("下载次数")],[k,S]=(0,r.useState)([]),[y,A]=(0,_.fp)(m.AG.prompt_card),D=async()=>{const e=await d.XO.get("get_share_file_list");if(e.code===h.m.Success){const t=e.data??[],n=Date.now();for(const e of t)try{if(null!=e.left_hour&&e.left_hour>0){const t=n-e.time_stamp,r=36e5*e.left_hour-t;e.show_left_hour=parseFloat((r/36e5).toFixed(2))}else e.show_left_hour=e.left_hour}catch(e){}S(t)}};(0,r.useEffect)(()=>{D()},[]);return(0,b.jsxs)("div",{className:"common-box ",style:{overflowY:"auto"},children:[(0,b.jsx)(p.aZ,{position:"right",children:(0,b.jsx)(s.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{n(-1)}})}),(0,b.jsx)(o.J,{widthPer:100,children:(0,b.jsx)(l.uF,{self_title:(0,b.jsxs)("span",{className:" div-row ",children:[(0,b.jsx)("h2",{children:e("文件分享列表")}),(0,b.jsx)(s.rA,{icon:"info",title:e("提示"),onClick:()=>{let e=(0,b.jsx)("div",{children:"小时设置为-1或者不设置就没有过期时间"});A({open:!0,title:"信息",context_div:(0,b.jsx)("div",{children:e})})}})]}),titleCom:(0,b.jsxs)("div",{children:[(0,b.jsx)(s.rA,{icon:"add",title:e("添加"),onClick:()=>{S([...k,{note:"",path:""}])}}),(0,b.jsx)(s.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("set_share_file_list",k)).code===h.m.Success&&((0,u.SK)("保存成功"),D())}})]}),children:(0,b.jsx)(i.X,{headers:C,onRowDrag:(e,t)=>{S((0,g.TI)(k,e,t))},rows:k.map((t,n)=>{const r=[(0,b.jsx)("div",{children:n}),(0,b.jsx)(a.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.left_hour,handleInputChange:e=>{t.left_hour=parseFloat(e),t.time_stamp=Date.now()},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.token,handleInputChange:e=>{t.token=e},no_border:!0}),(0,b.jsx)(a.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,b.jsx)("p",{children:t.show_left_hour}),(0,b.jsx)("p",{children:t.download_num}),(0,b.jsxs)("div",{children:[(0,b.jsx)(s.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),S([...k])})(n)}),t.id&&(0,b.jsx)(s.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);(0,x.lW)(e),(0,u.SK)(e)}}),t.id&&(0,b.jsx)(s.rA,{icon:"open_in_new",title:e("打开新页面"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);window.open(e)}})]})];return r}),width:"10rem"})})})]})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7520],{85139(e,t,r){r.r(t),r.d(t,{default:()=>i});var i=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,r)=>{const i=document.createElement("input");i.type="file",i.webkitdirectory=!0;const c=e=>{"function"==typeof a&&a(),t(e)},a=e[0].legacySetup&&e[0].legacySetup(c,()=>a(r),i);i.addEventListener("change",()=>{let t=Array.from(i.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(t=t.filter(t=>t.webkitRelativePath.split("/").every(t=>!e[0].skipDirectory({name:t,kind:"directory"})))):t=t.filter(e=>2===e.webkitRelativePath.split("/").length),c(t)}),i.click()}))}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6322],{26322(e,t,r){r.r(t),r.d(t,{default:()=>i});var i=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,r)=>{const i=document.createElement("input");i.type="file",i.webkitdirectory=!0;const c=e=>{"function"==typeof a&&a(),t(e)},a=e[0].legacySetup&&e[0].legacySetup(c,()=>a(r),i);i.addEventListener("change",()=>{let t=Array.from(i.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(t=t.filter(t=>t.webkitRelativePath.split("/").every(t=>!e[0].skipDirectory({name:t,kind:"directory"})))):t=t.filter(e=>2===e.webkitRelativePath.split("/").length),c(t)}),i.click()}))}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6492],{11356(t,e){e.k=void 0;e.k=function(t,e){void 0===e&&(e={listUnicodeChar:""}),(e=e||{}).listUnicodeChar=!!e.hasOwnProperty("listUnicodeChar")&&e.listUnicodeChar,e.stripListLeaders=!e.hasOwnProperty("stripListLeaders")||e.stripListLeaders,e.gfm=!e.hasOwnProperty("gfm")||e.gfm,e.useImgAltText=!e.hasOwnProperty("useImgAltText")||e.useImgAltText,e.preserveLinks=!!e.hasOwnProperty("preserveLinks")&&e.preserveLinks;var r=t||"";r=r.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*$/gm,"");try{e.stripListLeaders&&(r=e.listUnicodeChar?r.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,e.listUnicodeChar+" $1"):r.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,"$1")),e.gfm&&(r=r.replace(/\n={2,}/g,"\n").replace(/~{3}.*\n/g,"").replace(/~~/g,"").replace(/`{3}.*\n/g,"")),e.preserveLinks&&(r=r.replace(/\[(.*?)\][\[\(](.*?)[\]\)]/g,"$1 ($2)")),r=r.replace(/<[^>]*>/g,"").replace(/^[=\-]{2,}\s*$/g,"").replace(/\[\^.+?\](\: .*?$)?/g,"").replace(/\s{0,2}\[.*?\]: .*?$/g,"").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g,e.useImgAltText?"$1":"").replace(/\[(.*?)\][\[\(].*?[\]\)]/g,"$1").replace(/^\s{0,3}>\s?/g,"").replace(/(^|\n)\s{0,3}>\s?/g,"\n\n").replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g,"").replace(/^(\n)?\s{0,}#{1,6}\s+| {0,}(\n)?\s{0,}#{0,} {0,}(\n)?\s{0,}$/gm,"$1$2$3").replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g,"$2").replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g,"$2").replace(/(`{3,})(.*?)\1/gm,"$2").replace(/`(.+?)`/g,"$1").replace(/\n{2,}/g,"\n\n")}catch(e){return console.error(e),t}return r}},6492(t,e,r){r.r(e),r.d(e,{parseMermaidToExcalidraw:()=>Ie});class o{constructor({converter:t}){this.convert=(t,e)=>this.converter(t,{...e,fontSize:e.fontSize||20}),this.converter=t}}var n,s,i;!function(t){t.ROUND="round",t.STADIUM="stadium",t.DOUBLECIRCLE="doublecircle",t.CIRCLE="circle",t.DIAMOND="diamond",t.CYLINDER="cylinder"}(n||(n={})),function(t){t.COLOR="color"}(s||(s={})),function(t){t.FILL="fill",t.STROKE="stroke",t.STROKE_WIDTH="stroke-width",t.STROKE_DASHARRAY="stroke-dasharray"}(i||(i={}));var a=r(11356);const l={arrow_circle:{endArrowhead:"circle"},arrow_cross:{endArrowhead:"bar"},arrow_open:{endArrowhead:null,startArrowhead:null},double_arrow_circle:{endArrowhead:"circle",startArrowhead:"circle"},double_arrow_cross:{endArrowhead:"bar",startArrowhead:"bar"},double_arrow_point:{endArrowhead:"arrow",startArrowhead:"arrow"}},c=t=>{let e=t.text;return"markdown"===t.labelType&&(e=(0,a.k)(t.text)),d(e)},d=t=>t.replace(/\s?(fa|fab):[a-zA-Z0-9-]+/g,""),u=t=>{const e={};return Object.keys(t).forEach(r=>{switch(r){case i.FILL:e.backgroundColor=t[r],e.fillStyle="solid";break;case i.STROKE:e.strokeColor=t[r];break;case i.STROKE_WIDTH:e.strokeWidth=Number(t[r]?.split("px")[0]);break;case i.STROKE_DASHARRAY:e.strokeStyle="dashed"}}),e},h=t=>{const e={};return Object.keys(t).forEach(r=>{if(r===s.COLOR)e.strokeColor=t[r]}),e},p=(t,e)=>Math.max(20,Math.ceil(t.length*e*.62)),g=new o({converter:(t,e)=>{const r=[],o=e.fontSize,{getGroupIds:s,getParentId:i}=(t=>{const e={};t.subGraphs.map(r=>{r.nodeIds.forEach(o=>{e[r.id]={id:r.id,parent:null,isLeaf:!1},e[o]={id:o,parent:r.id,isLeaf:void 0!==t.vertices[o]}})});const r={};return[...Object.keys(t.vertices),...t.subGraphs.map(t=>t.id)].forEach(t=>{if(!e[t])return;let o=e[t];const n=[];for(o.isLeaf||n.push(`subgraph_group_${o.id}`);o.parent;)n.push(`subgraph_group_${o.parent}`),o=e[o.parent];r[t]=n}),{getGroupIds:t=>r[t]||[],getParentId:t=>e[t]?e[t].parent:null}})(t);return t.subGraphs.reverse().forEach(t=>{const e=s(t.id),n=c(t),i=p(n,o||16)+64,a=Math.max(t.width,i),l=t.x-(a-t.width)/2,d=u(t.containerStyle),g=h(t.labelStyle),y={id:t.id,type:"rectangle",groupIds:e,x:l,y:t.y,width:a,height:t.height,label:{groupIds:e,text:n,fontSize:o,verticalAlign:"top",...g},...d};r.push(y)}),Object.values(t.vertices).forEach(t=>{if(!t)return;const e=s(t.id),i=c(t),a=((t,e,r,o)=>{const s=o||20;if(t!==n.CYLINDER||!e||e.includes("\n"))return s;const i=Math.max(20,r-12);return p(e,s)<=i?s:Math.max(12,Math.floor(i/(.62*e.length)))})(t.type,i,t.width,o),l=u(t.containerStyle),d=h(t.labelStyle);let g={id:t.id,type:"rectangle",groupIds:e,x:t.x,y:t.y,width:t.width,height:t.height,strokeWidth:2,label:{groupIds:e,text:i,fontSize:a,...d},link:t.link||null,...l};switch(t.type){case n.STADIUM:case n.ROUND:g={...g,roundness:{type:3}};break;case n.DOUBLECIRCLE:{const o=5;e.push(`doublecircle_${t.id}}`);const n={type:"ellipse",groupIds:e,x:t.x+o,y:t.y+o,width:t.width-2*o,height:t.height-2*o,strokeWidth:2,roundness:{type:3},label:{groupIds:e,text:i,fontSize:a,...d}};g={...g,groupIds:e,type:"ellipse"},r.push(n);break}case n.CIRCLE:g.type="ellipse";break;case n.DIAMOND:g.type="diamond"}r.push(g)}),t.edges.forEach(t=>{let e=[];const n=i(t.start),a=i(t.end);n&&n===a&&(e=s(n));const{startX:d,startY:u,reflectionPoints:h}=t,p=h.map(t=>{return e=t.x-h[0].x,r=t.y-h[0].y,[e,r];var e,r}),g=(y=t.type||"arrow_point",l[y]);var y;const f=r.find(e=>e.id===t.start),b=r.find(e=>e.id===t.end);if(!f||!b)return;const m={id:`${t.start}_${t.end}`,type:"arrow",groupIds:e,x:d,y:u,strokeWidth:"thick"===t.stroke?4:2,strokeStyle:"dotted"===t.stroke?"dashed":void 0,points:p,...t.text?{label:{text:c(t),fontSize:o,groupIds:e}}:{},roundness:{type:2},...g,start:{id:f.id||""},end:{id:b.id||""}};r.push(m)}),{elements:r}}});let y=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_","");const f=new o({converter:t=>{const e=y(),{width:r,height:o}=t,n={type:"image",x:0,y:0,width:r,height:o,status:"saved",fileId:e};return{files:{[e]:{id:e,mimeType:t.mimeType,dataURL:t.dataURL}},elements:[n]}}}),b=(t,e)=>[t,e],m=t=>t.replace(/\\n/g,"\n"),x=t=>{const e={type:"line",x:t.startX,y:t.startY,points:[b(0,0),b(t.endX-t.startX,t.endY-t.startY)],width:t.endX-t.startX,height:t.endY-t.startY,strokeStyle:t.strokeStyle||"solid",strokeColor:t.strokeColor||"#000",strokeWidth:t.strokeWidth||1};return t.groupId&&Object.assign(e,{groupIds:[t.groupId]}),t.id&&Object.assign(e,{id:t.id}),e},w=t=>{const e={type:"text",x:t.x,y:t.y,width:t.width,height:t.height,text:m(t.text)||"",fontSize:t.fontSize,verticalAlign:"top",strokeColor:t.color};return t.groupId&&Object.assign(e,{groupIds:[t.groupId]}),t.id&&Object.assign(e,{id:t.id}),e},S=t=>{const e={text:m(t?.label?.text||""),fontSize:t?.label?.fontSize,textAlign:t.label?.textAlign,verticalAlign:t.label?.verticalAlign||"middle",strokeColor:t.label?.color||"#000",...t.groupId?{groupIds:[t.groupId]}:{}};let r={};"rectangle"===t.type&&"activation"===t.subtype&&(r={backgroundColor:"#e9ecef",fillStyle:"solid"});const o={id:t.id,type:t.type,x:t.x,y:t.y,width:t.width,height:t.height,label:e,strokeStyle:t?.strokeStyle,strokeWidth:t?.strokeWidth,strokeColor:t?.strokeColor,backgroundColor:t?.bgColor,fillStyle:"solid",...r};return t.groupId&&Object.assign(o,{groupIds:[t.groupId]}),o},A=t=>{const e={type:"arrow",x:t.startX,y:t.startY,points:t.points?.map(([t,e])=>b(t,e))||[b(0,0),b(t.endX-t.startX,t.endY-t.startY)],width:t.endX-t.startX,height:t.endY-t.startY,strokeStyle:t?.strokeStyle||"solid",endArrowhead:t?.endArrowhead||null,startArrowhead:t?.startArrowhead||null,label:{text:m(t?.label?.text||""),fontSize:16,textAlign:t?.label?.textAlign,verticalAlign:t?.label?.verticalAlign},roundness:{type:2},start:t.start,end:t.end};return t.groupId&&Object.assign(e,{groupIds:[t.groupId]}),e},k=t=>{if(!t)return!0;const e=t.trim().toLowerCase();return"transparent"===e||"none"===e||"rgba(0,0,0,0)"===e||"rgba(0, 0, 0, 0)"===e},E=(t,e,r=!0)=>{const o=t,n=o.groupIds??[];if(n.includes(e)||(o.groupIds=[...n,e]),!r||!o.label)return;const s=o.label.groupIds??[];s.includes(e)||(o.label.groupIds=[...s,e])},v=new o({converter:t=>{const e=[],r=[];if(Object.values(t.nodes).forEach(t=>{t&&t.length&&t.forEach(t=>{let o;switch(t.type){case"line":o=x(t);break;case"rectangle":case"ellipse":o=S(t);break;case"text":o=w(t);break;default:throw`unknown type ${t.type}`}"rectangle"===t.type&&"activation"===t?.subtype?r.push(o):e.push(o)})}),Object.values(t.lines).forEach(t=>{t&&e.push(x(t))}),Object.values(t.arrows).forEach(t=>{t&&(e.push(A(t)),t.sequenceNumber&&e.push(S(t.sequenceNumber)))}),e.push(...r),t.loops){const{lines:r,texts:o,nodes:n}=t.loops;r.forEach(t=>{e.push(x(t))}),o.forEach(t=>{e.push(w(t))}),n.forEach(t=>{e.push(S(t))})}return t.groups&&t.groups.forEach(t=>{const{actorKeys:r,name:o}=t;let n=1/0,s=1/0,i=0,a=0;if(!r.length)return;const l=e.filter(t=>{if(t.id){const e=t.id.indexOf("-"),o=t.id.substring(0,e);return r.includes(o)}return!1});if(!l.length)return;if(l.forEach(t=>{void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height&&(n=Math.min(n,t.x),s=Math.min(s,t.y),i=Math.max(i,t.x+t.width),a=Math.max(a,t.y+t.height))}),!(Number.isFinite(n)&&Number.isFinite(s)&&Number.isFinite(i)&&Number.isFinite(a)))return;const c=n-10,d=s-10,u=i-n+20,h=a-s+20,p=y(),g=y(),f=S({type:"rectangle",x:c,y:d,width:u,height:h,bgColor:k(t.fill)?void 0:t.fill,strokeColor:"#1f1f1f",strokeWidth:1,id:p,groupId:g});if(e.unshift(f),e.forEach(t=>{t.id!==p&&void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height&&t.x>=n&&t.x+t.width<=i&&t.y>=s&&t.y+t.height<=a&&E(t,g)}),o){const t=w({type:"text",id:y(),text:o,x:c+4,y:d-24,width:(b=o,m=16,Math.max(20,Math.round(b.length*m*.6))),height:24,fontSize:16,color:"#1f1f1f",groupId:g});E(t,g,!1),e.push(t)}var b,m}),{elements:e}}}),C=new o({converter:t=>{const e=[];return t.nodes.forEach(t=>{t&&t.length&&t.forEach(t=>{let r;switch(t.type){case"line":r=x(t);break;case"rectangle":case"ellipse":r=S(t);break;case"text":r=w(t);break;default:throw`unknown type ${t.type}`}e.push(r)})}),Object.values(t.lines).forEach(t=>{t&&e.push(x(t))}),Object.values(t.arrows).forEach(t=>{if(!t)return;const r=A(t);e.push(r)}),Object.values(t.text).forEach(t=>{const r=w(t);e.push(r)}),Object.values(t.namespaces).forEach(r=>{const o=Object.keys(r.classes),n=[...o],s=[...t.lines,...t.arrows,...t.text];o.forEach(t=>{const e=s.filter(e=>e.metadata&&e.metadata.classId===t).map(t=>t.id);e.length&&n.push(...e)});const i={type:"frame",id:y(),name:r.id,children:n};e.push(i)}),{elements:e}}}),I=new o({converter:t=>{const e=[];return t.nodes.forEach(t=>{t&&t.length&&t.forEach(t=>{let r;switch(t.type){case"line":r=x(t);break;case"rectangle":case"ellipse":r=S(t);break;case"text":r=w(t);break;default:throw`unknown type ${t.type}`}e.push(r)})}),t.lines.forEach(t=>{e.push(x(t))}),t.arrows.forEach(t=>{e.push(A(t))}),t.text.forEach(t=>{e.push(w(t))}),{elements:e}}}),O=(t,e)=>[t,e],L="#000000",N=new Set(["choice","fork","join","stateStart","stateEnd","divider"]),$=t=>"stateEnd"===t.shape?[`state_end_group_${t.id}`]:void 0,T=t=>"rectWithTitle"===t.shape&&t.description.length?[t.text,...t.description].join("\n"):t.text;let Y;const R=(t,e)=>{const r=(()=>{if(void 0!==Y)return Y;if("undefined"==typeof document)return Y=null,Y;try{Y=document.createElement("canvas").getContext("2d")}catch{Y=null}return Y})();return r?(r.font=`${e}px Excalifont, sans-serif`,r.measureText(t).width):t.length*e*.6},X=(t,e,r)=>{if(R(t,e)<=r)return[t];const o=[];let n="";for(const s of t){const t=`${n}${s}`;n&&R(t,e)>r?(o.push(n),n=s):n=t}return n&&o.push(n),o},_=(t,e,r)=>{const o=t.map(t=>((t,e,r)=>{if(!t.trim())return t;if(R(t,e)<=r)return t;const o=t.split(/\s+/).filter(Boolean),n=[];let s="";for(const t of o){const o=X(t,e,r);for(const[t,i]of o.entries()){const o=s?`${s}${s&&0===t?" ":""}${i}`:i;R(o,e)<=r?s=o:(s&&n.push(s),s=i)}o.length}return n.push(s),n.join("\n")})(t,e,r)).join("\n"),n=o.split("\n");return{width:Math.max(...n.map(t=>R(t,e))),height:n.length*e*1.25}},q=t=>{const e=T(t);if(!e||N.has(t.shape))return 16;const r=Math.max(1,t.width-10),o=Math.max(1,t.height-10),n=e.split("\n");if(n.length>1){if(Math.max(...n.map(t=>R(t,16)))<=r)return 16}return((t,e,r,o)=>{const n=t.split("\n");for(let t=16;t>=14;t-=1){const{height:o}=_(n,t,e);if(o<=r)return t}return o})(e,r,o,1===n.length?16:14)},M=t=>{const e=u(t.containerStyle),r=(t=>{if(N.has(t.shape))return;const e=T(t);return e?{text:e,fontSize:q(t),verticalAlign:"rectWithTitle"===t.shape||"roundedWithTitle"===t.shape?"top":"middle",...h(t.labelStyle)}:void 0})(t),o="choice"===t.shape?"diamond":"stateStart"===t.shape||"stateEnd"===t.shape?"ellipse":"rectangle",n="rect"===t.shape||"rectWithTitle"===t.shape||"roundedWithTitle"===t.shape,s="stateStart"===t.shape||"fork"===t.shape||"join"===t.shape,i=e.backgroundColor||e.strokeColor||L,a=e.strokeColor||e.backgroundColor||L;return{id:t.id,type:o,...$(t)?{groupIds:$(t)}:{},x:t.x,y:t.y,width:t.width,height:t.height,...r?{label:r}:{},...e,...n?{roundness:{type:3}}:{},...s?{backgroundColor:i,strokeColor:a,fillStyle:"solid"}:{}}},z=new o({converter:t=>{const e=[];return t.nodes.forEach(t=>{if(!t.isRenderable)return;const r=M(t);e.push(r);const o=(t=>{if(!t.dividerLine)return null;const e=u(t.containerStyle);return{id:`${t.id}__divider`,type:"line",x:t.dividerLine.startX,y:t.dividerLine.startY,width:t.dividerLine.endX-t.dividerLine.startX,height:t.dividerLine.endY-t.dividerLine.startY,points:[O(0,0),O(t.dividerLine.endX-t.dividerLine.startX,t.dividerLine.endY-t.dividerLine.startY)],strokeColor:e.strokeColor||"#000",strokeWidth:e.strokeWidth||1}})(t);o&&e.push(o),"stateEnd"===t.shape&&e.push((t=>{const e=u(t.containerStyle),r=Math.max(2,.32*Math.min(t.width,t.height)),o=t.endInnerColor||e.strokeColor||e.backgroundColor||L;return{id:`${t.id}__inner`,type:"ellipse",groupIds:$(t),x:t.x+r,y:t.y+r,width:Math.max(1,t.width-2*r),height:Math.max(1,t.height-2*r),backgroundColor:o,strokeColor:o,fillStyle:"solid",strokeWidth:1}})(t))}),t.edges.forEach(t=>{e.push((t=>{const e=t.reflectionPoints.map((t,e,r)=>{const o=r[0];return 0===e?O(0,0):O(t.x-o.x,t.y-o.y)});return{id:t.id,type:"arrow",x:t.startX,y:t.startY,width:t.endX-t.startX,height:t.endY-t.startY,points:e,strokeColor:t.strokeColor||"#000",strokeWidth:t.strokeWidth||2,strokeStyle:t.strokeStyle||"solid",endArrowhead:t.isNoteEdge?null:"triangle",roundness:{type:2},start:{id:t.start},end:{id:t.end},...t.text?{label:{text:t.text,fontSize:16}}:{}}})(t))}),{elements:e}}}),D=t=>{const e=(t=F(t)).replace(/#(\d+);/g,"&#$1;").replace(/#([a-z]+);/g,"&$1;"),r=document.createElement("textarea");return r.innerHTML=e,r.value},W=t=>{const e=t.getAttribute("transform"),r=e?.match(/translate\(([ \d.-]+),\s*([\d.-]+)\)/);let o=0,n=0;return r&&(o=Number(r[1]),n=Number(r[2])),{transformX:o,transformY:n}},F=function(t){return t.replace(/fl°°/g,"#").replace(/fl°/g,"&").replace(/¶ß/g,";")},B=(t,e=.5)=>{const r=[];return t.forEach(t=>{const o=r[r.length-1];if(!o)return void r.push(t);Math.hypot(t[0]-o[0],t[1]-o[1])<=e||r.push(t)}),r},j=t=>{const e=t.getAttribute("d");if(!e)return null;const r=Array.from(e.matchAll(/-?\d*\.?\d+(?:e[-+]?\d+)?/gi),t=>Number(t[0]));return r.length<4?null:{startX:r[0],startY:r[1],endX:r[r.length-2],endY:r[r.length-1]}},K=t=>{const e=t.getAttribute("data-points");if(!e){const e=j(t);return e?[{x:e.startX,y:e.startY},{x:e.endX,y:e.endY}]:[]}try{const t=atob(e),r=JSON.parse(t);return Array.isArray(r)?r.filter(t=>t&&"number"==typeof t.x&&"number"==typeof t.y&&Number.isFinite(t.x)&&Number.isFinite(t.y)):[]}catch{return[]}},P=(t,e={x:0,y:0},r="LM")=>{if("path"!==t.tagName.toLowerCase())throw new Error(`Invalid input: Expected an HTMLElement of tag "path", got ${t.tagName}`);const o=t.getAttribute("d");if(!o)throw new Error('Path element does not contain a "d" attribute');const n=o.split(new RegExp(`(?=[${r}])`)),s=n[0].substring(1).split(",").map(t=>parseFloat(t)),i=n[n.length-1].substring(1).split(",").map(t=>parseFloat(t)),a=n.map(t=>{const e=t[0],r=t.substring(1).split(",").map(t=>parseFloat(t));return"C"===e?{x:r[4],y:r[5],command:e}:{x:r[0],y:r[1],command:e}}).filter((t,e,r)=>{if(0===e||e===r.length-1)return!0;if(t.x===r[e-1].x&&t.y===r[e-1].y)return!1;if(e===r.length-2&&"C"===t.command)return!1;if(e===r.length-2&&(r[e-1].x===t.x||r[e-1].y===t.y)){const e=r[r.length-1];return Math.hypot(e.x-t.x,e.y-t.y)>20}return t.x!==r[e-1].x||t.y!==r[e-1].y}).map(t=>({x:t.x+e.x,y:t.y+e.y}));return{startX:s[0]+e.x,startY:s[1]+e.y,endX:i[0]+e.x,endY:i[1]+e.y,reflectionPoints:a}},U=(t,e={})=>(t=>({...t,elements:t.elements.map(t=>{if(!("points"in t)||!Array.isArray(t.points))return t;const e=t.points;if(e.length<2)return t;const r=B(e);return r.length===e.length?t:{...t,points:r}})}))((()=>{switch(t.type){case"graphImage":return f.convert(t,e);case"flowchart":return g.convert(t,e);case"sequence":return v.convert(t,e);case"class":return C.convert(t,e);case"erd":return I.convert(t,e);case"state":return z.convert(t,e);default:throw new Error(`graphToExcalidraw: unknown graph type "${t.type}, only flowcharts are supported!"`)}})());var H=r(62300);const V={rect:"rectangle",circle:"ellipse"},G={startOnLoad:!1,flowchart:{curve:"linear"},themeVariables:{fontSize:"20px"},maxEdges:500,maxTextSize:5e4},J=t=>t.replace(/\s*!important\s*$/i,"").trim(),Z=(t,e)=>{let r=e;for(;r<t.length&&/\s/.test(t[r]);)r+=1;const o=r;for(;r<t.length&&/[a-z-]/i.test(t[r]);)r+=1;if(r===o)return!1;for(;r<t.length&&/\s/.test(t[r]);)r+=1;return":"===t[r]},Q=t=>{const e=[];let r=0;for(;r<t.length;){for(;r<t.length&&/[\s;,]/.test(t[r]);)r+=1;if(r>=t.length)break;const o=r;for(;r<t.length&&":"!==t[r]&&";"!==t[r]&&","!==t[r];)r+=1;if(r>=t.length||":"!==t[r])break;const n=t.substring(o,r).trim().toLowerCase();r+=1;const s=r;let i=0,a=null;for(;r<t.length;){const e=t[r];if(a)e===a&&"\\"!==t[r-1]&&(a=null),r+=1;else if('"'!==e&&"'"!==e)if("("!==e)if(")"!==e){if(0===i){if(";"===e||","===e)break;if(/\s/.test(e)&&Z(t,r))break}r+=1}else i=Math.max(0,i-1),r+=1;else i+=1,r+=1;else a=e,r+=1}const l=J(t.substring(s,r));n&&l&&e.push({property:n,value:l}),r<t.length&&(";"===t[r]||","===t[r])&&(r+=1)}return e},tt=t=>{const e=J(t);if(!e)return!1;if("undefined"!=typeof CSS&&"function"==typeof CSS.supports)return CSS.supports("color",e);if("undefined"!=typeof document){const t=document.createElement("div");return t.style.color="",t.style.color=e,""!==t.style.color}return!1},et=(t,e)=>{const r=t.getAttribute("style");return r&&Q(r).find(t=>t.property===e)?.value||""},rt=(...t)=>{for(const e of t){const t=J(e||"");if(tt(t))return t}},ot=(t,e)=>{const r=t.querySelector("text, foreignObject, div, span, p")||t,o=rt(r.getAttribute?.("fill"),et(r,"fill"),r.style?.fill);if(o)return o;const n=rt(r.getAttribute?.("color"),et(r,"color"),r.style?.color);if(n)return n;const s=rt(e);return s||void 0},nt=(t,e,r)=>{switch(e){case i.FILL:case i.STROKE:tt(r)&&(t[e]=r);break;case i.STROKE_WIDTH:case i.STROKE_DASHARRAY:t[e]=r}},st=(t,e,r)=>{e===s.COLOR&&tt(r)&&(t[s.COLOR]=r)},it=(t,e,r)=>{t&&Q(t).forEach(({property:t,value:o})=>{nt(e,t,o),st(r,t,o)})},at=(t,e)=>{t&&Q(t).forEach(({property:t,value:r})=>{"fill"===t&&tt(r)?e[s.COLOR]=r:st(e,t,r)})},lt=(t,e)=>{if(!t)return;[[i.FILL,t.getAttribute("fill")],[i.STROKE,t.getAttribute("stroke")],[i.STROKE_WIDTH,t.getAttribute("stroke-width")],[i.STROKE_DASHARRAY,t.getAttribute("stroke-dasharray")]].forEach(([t,r])=>{const o=J(r||"");o&&nt(e,t,o)})},ct=(t,e)=>{if(!t)return;const r=t.getAttribute("fill")||t.getAttribute("color"),o=J(r||"");tt(o)&&(e[s.COLOR]=o)},dt=(t,e,r,o)=>{if(!(e instanceof Map))return;const n=e.get(t);n&&(n.styles?.forEach(t=>{Q(t).forEach(({property:t,value:e})=>{nt(r,t,e),st(o,t,e)})}),n.textStyles?.forEach(t=>{Q(t).forEach(({property:t,value:e})=>{st(o,t,e)})}))},ut=(t,e,r)=>{const o=e.querySelector(`[id*="${t.domId}"]`);if(!o)return;let n;"a"===o.parentElement?.tagName.toLowerCase()&&(n=o.parentElement.getAttribute("xlink:href"));const s=ht(n?o.parentElement:o,e),i=o.getBBox(),a={width:i.width,height:i.height},l={},c={};t.classes&&r instanceof Map&&(Array.isArray(t.classes)?t.classes:[t.classes]).forEach(t=>{dt(t,r,l,c)}),t.styles?.forEach(t=>{it(t,l,c)});const d=o.querySelector(".label-container");it(d?.getAttribute("style"),l,c),lt(d,l);return Array.from(o.querySelectorAll(".label, .nodeLabel, .label text, .label tspan, .label span, .label div")).forEach(t=>{at(t.getAttribute("style"),c),ct(t,c)}),{id:t.id,labelType:t.labelType,text:D(t.text||""),type:t.type,link:n||void 0,...s,...a,containerStyle:l,labelStyle:c}},ht=(t,e)=>{if(!t)throw new Error("Element not found");let r=t.parentElement?.parentElement;const o=t.childNodes[0];let n={x:0,y:0};if(o){const{transformX:t,transformY:e}=W(o),r=o.getBBox();n={x:Number(o.getAttribute("x"))||t+r.x||0,y:Number(o.getAttribute("y"))||e+r.y||0}}const{transformX:s,transformY:i}=W(t),a={x:s+n.x,y:i+n.y};for(;r&&r.id!==e.id;){if("root"===r.classList.value&&r.hasAttribute("transform")){const{transformX:t,transformY:e}=W(r);a.x+=t,a.y+=e}r=r.parentElement}return a},pt=(t,e)=>{const r=t.getVertices(),o=t.getEdges(),n=t.getSubGraphs(),s=t.getClasses(),i={},a=s instanceof Map?s:{};r instanceof Map?r.forEach((t,r)=>{i[r]=ut(t,e,a)}):"object"==typeof r&&null!==r&&Object.entries(r).forEach(([t,r])=>{i[t]=ut(r,e,a)});const l=new Map,c=(Array.isArray(o)?o:[]).map(t=>{if(!e.querySelector(`[id*="${t.id}"]`))return null;const r=`${t.start}-${t.end}`,o=l.get(r)||0;return l.set(r,o+1),((t,e,r)=>{const o=r.querySelector(`[id*="${t.id}"]`);if(!o)throw new Error("Edge element not found");const n=ht(o,r),s=P(o,n);return t.length=void 0,{...t,...s,text:D(t.text)}})(t,0,e)}).filter(t=>null!==t&&t.reflectionPoints.length>1),d=(Array.isArray(n)?n:[]).map(t=>((t,e,r)=>{const o=t.nodes.map(t=>t.startsWith("flowchart-")?t.split("-")[1]:t),n=e.querySelector(`[id='${t.id}']`);if(!n)throw new Error("SubGraph element not found");const s=ht(n,e),i=n.getBBox(),a={width:i.width,height:i.height},l={},c={},d=n.querySelector(":scope > rect, :scope > path, :scope > polygon, :scope > ellipse")||n.querySelector(".cluster > rect, .cluster > path, .cluster > polygon, .cluster > ellipse")||n.querySelector("rect, path, polygon, ellipse");it(n.getAttribute("style"),l,c),it(d?.getAttribute("style"),l,c),lt(d,l);const u=n.querySelector(".cluster-label text, .cluster-label tspan")||n.querySelector("text");return at(u?.getAttribute("style"),c),ct(u,c),dt(t.id,r,l,c),t.classes?.forEach(t=>{dt(t,r,l,c)}),{id:t.id,nodeIds:o,text:D(t.title),labelType:"text",...s,...a,containerStyle:l,labelStyle:c}})(t,e,a));return{type:"flowchart",subGraphs:d,vertices:i,edges:c}},gt=(t,e,r,o,n)=>{const s={type:"arrow"};return s.startX=t,s.startY=e,s.endX=r,s.endY=o,Object.assign(s,{...n}),s},yt=(t,e,r,o)=>({type:"text",x:t,y:e,text:r,width:o?.width||20,height:o?.height||20,fontSize:o?.fontSize||20,id:o?.id,color:o?.color,groupId:o?.groupId,metadata:o?.metadata}),ft=(t,e,r)=>{const o={},n=Number(t.getAttribute("x")),s=Number(t.getAttribute("y"));o.type="text",o.text=D(e),r?.id&&(o.id=r.id),r?.groupId&&(o.groupId=r.groupId);const i=t.getBBox();o.width=i.width,o.height=i.height,o.x=n-i.width/2,o.y=s;const a=parseInt(getComputedStyle(t).fontSize);return o.fontSize=a,o.color=ot(t),o},bt=(t,e,r={})=>{const o={};o.type=e;const{label:n,subtype:s,id:i,groupId:a}=r;o.id=i,a&&(o.groupId=a),n&&(o.label={text:D(n.text),fontSize:16,textAlign:n?.textAlign,verticalAlign:n?.verticalAlign});const l=t.getBBox();switch(o.x=l.x,o.y=l.y,o.width=l.width,o.height=l.height,o.subtype=s,s){case"highlight":const e=t.getAttribute("fill");e&&(o.bgColor=J(e));break;case"note":o.strokeStyle="dashed"}return o},mt=(t,e,r,o,n,s)=>{const i={};i.startX=e,i.startY=r,i.endX=o,s?.groupId&&(i.groupId=s.groupId),s?.id&&(i.id=s.id),i.endY=n;const a=t.getAttribute("stroke");return i.strokeColor=a?J(a):null,i.strokeWidth=Number(t.getAttribute("stroke-width")),i.type="line",i},xt={0:"SOLID",1:"DOTTED",3:"SOLID_CROSS",4:"DOTTED_CROSS",5:"SOLID_OPEN",6:"DOTTED_OPEN",24:"SOLID_POINT",25:"DOTTED_POINT"},wt=0,St=1,At=2,kt=3,Et=4,vt=5,Ct=6,It=24,Ot=25,Lt=27,Nt=t=>{let e;switch(t){case wt:case kt:case vt:case It:e="solid";break;case St:case Et:case Ct:case Ot:e="dotted";break;default:e="solid"}return e},$t=(t,e,r)=>{if(!t)throw"root node not found";const o=y(),n=Array.from(t.children),s=[];return n.forEach((t,n)=>{const i=`${r?.id}-${n}`;let a;switch(t.tagName){case"line":const r=Number(t.getAttribute("x1")),n=Number(t.getAttribute("y1")),s=Number(t.getAttribute("x2")),l=Number(t.getAttribute("y2"));a=mt(t,r,n,s,l,{groupId:o,id:i});break;case"text":a=ft(t,e,{groupId:o,id:i});break;case"circle":a=bt(t,"ellipse",{label:t.textContent?{text:t.textContent}:void 0,groupId:o,id:i});default:a=bt(t,V[t.tagName],{label:t.textContent?{text:t.textContent}:void 0,groupId:o,id:i})}s.push(a)}),s},Tt=(t,e)=>{const r=e.getAttribute("fill"),o=e.getAttribute("stroke"),n=e.getAttribute("stroke-width"),s=e.getAttribute("stroke-dasharray");r&&"none"!==r&&(t.bgColor=J(r)),o&&"none"!==o&&(t.strokeColor=J(o)),n&&(t.strokeWidth=Number(n)),s&&s.trim()&&(t.strokeStyle="dashed")},Yt=(t,e,r)=>{const o=[],n=Array.from(e.querySelectorAll('[class*="messageLine"]')),s=Object.keys(xt),i=t.filter(t=>s.includes(t.type.toString()));return n.forEach((t,e)=>{const n=i[e],s=xt[n.type],a=((t,e)=>{const r={};e?.label&&(r.label={text:D(e.label),fontSize:16});const o=t.tagName;if("line"===o)r.startX=Number(t.getAttribute("x1")),r.startY=Number(t.getAttribute("y1")),r.endX=Number(t.getAttribute("x2")),r.endY=Number(t.getAttribute("y2"));else if("path"===o){const e=t.getAttribute("d");if(!e)throw new Error('Path element does not contain a "d" attribute');const o=e.split(/(?=[LC])/),n=o[0].substring(1).split(",").map(t=>parseFloat(t)),s=[];o.forEach(t=>{const e=t.substring(1).trim().split(" ").map(t=>{const[e,r]=t.split(",");return[parseFloat(e)-n[0],parseFloat(r)-n[1]]});s.push(...e)});const i=s[s.length-1];r.startX=n[0],r.startY=n[1],r.endX=i[0],r.endY=i[1],r.points=s}if(e?.label){const t=10;r.startY=r.startY-t,r.endY=r.endY-t}const n=t.getAttribute("stroke"),s=(n&&"none"!==n?n:"")||getComputedStyle(t).stroke||"";return r.strokeColor=s?J(s):null,r.strokeWidth=Number(t.getAttribute("stroke-width")),r.type="arrow",r.strokeStyle=e?.strokeStyle||"solid",r.startArrowhead=e?.startArrowhead||null,r.endArrowhead=e?.endArrowhead||null,r})(t,{label:n?.message,strokeStyle:Nt(n.type),endArrowhead:"SOLID_OPEN"===s||"DOTTED_OPEN"===s?null:"arrow"}),l=r[n.from],c=r[n.to];l?.topId&&c?.topId&&(a.start={type:l.bindType||"rectangle",id:l.topId},a.end={type:c.bindType||"rectangle",id:c.topId}),((t,e)=>{if(t.nextElementSibling?.classList.contains("sequenceNumber")){const r=t.nextElementSibling?.textContent;if(!r)throw new Error("sequence number not present");const o=30,n=o/2,s=10,i={type:"rectangle",x:e.startX-s,y:e.startY-n,label:{text:r,fontSize:14},bgColor:"#e9ecef",height:o,subtype:"sequence"};Object.assign(e,{sequenceNumber:i})}})(t,a),o.push(a)}),o},Rt=(t,e)=>{const r=t.db,o=[],n=r.getBoxes().map(t=>({...t,fill:J(t.fill||"")})),s=(t=>{const e=Array.from(t.querySelectorAll(".rect")).filter(t=>"g"!==t.parentElement?.tagName),r=[];return e.forEach(t=>{const e=bt(t,"rectangle",{label:{text:""},subtype:"highlight"});r.push(e)}),r})(e),i=r.getActors(),{nodes:a,lines:l,actorMap:c}=((t,e)=>{const r=Array.from(e.querySelectorAll(".actor-top")),o=Array.from(e.querySelectorAll(".actor-bottom")),n=[],s=[],i={},a=t instanceof Map?Array.from(t.values()):Object.values(t),l=Array.from(e.querySelectorAll(".actor-line")),c=(t,e)=>{const r=t.name,o=l.find(t=>t.getAttribute("name")===r);if(o)return o;const n="participant"===t.type?e.parentElement?.previousElementSibling:e.previousElementSibling;return n?"line"===n.tagName?n:n.querySelector("line"):null};return a.forEach(t=>{const e=r.find(e=>e.getAttribute("name")===t.name),a=o.find(e=>e.getAttribute("name")===t.name);if(!e||!a)throw"root not found";const l=t.description;if("participant"===t.type){const r=bt(e,"rectangle",{id:`${t.name}-top`,label:{text:l},subtype:"actor"});if(Tt(r,e),!r)throw"Top Node element not found!";n.push([r]);const o=bt(a,"rectangle",{id:`${t.name}-bottom`,label:{text:l},subtype:"actor"});i[t.name]={topId:`${t.name}-top`,bottomId:`${t.name}-bottom`,bindType:"rectangle"},Tt(o,a),n.push([o]);const d=c(t,e);if("line"!==d?.tagName)throw"Line not found";const u=Number(d.getAttribute("x1"));if(!r.height)throw"Top node element height is null";const h=r.y+r.height,p=o.y,g=Number(d.getAttribute("x2")),y=mt(d,u,h,g,p);s.push(y)}else if("actor"===t.type){const r=$t(e,l,{id:`${t.name}-top`});n.push(r);const o=$t(a,l,{id:`${t.name}-bottom`});n.push(o);const d=c(t,e);if("line"!==d?.tagName)throw"Line not found";const u=Number(d.getAttribute("x1")),h=Number(d.getAttribute("y1")),p=Number(d.getAttribute("x2")),g=o.find(t=>"ellipse"===t.type);if(g){const t=g.y,e=mt(d,u,h,p,t);s.push(e)}const y=r.find(t=>"ellipse"===t.type),f=o.find(t=>"ellipse"===t.type);y?.id&&f?.id&&(i[t.name]={topId:y.id,bottomId:f.id,bindType:"ellipse"})}}),{nodes:n,lines:s,actorMap:i}})(i,e),d=r.getMessages(),u=Yt(d,e,c),h=((t,e)=>{const r=Array.from(e.querySelectorAll(".note")).map(t=>t.parentElement),o=t.filter(t=>t.type===At),n=[];return r.forEach((t,e)=>{if(!t)return;const r=t.firstChild,s=o[e].message,i=bt(r,"rectangle",{label:{text:s},subtype:"note"}),a=r.getAttribute("fill"),l=r.getAttribute("stroke"),c=r.getAttribute("stroke-width"),d=r.getAttribute("stroke-dasharray");a&&"none"!==a&&(i.bgColor=J(a)),l&&"none"!==l&&(i.strokeColor=J(l)),c&&(i.strokeWidth=Number(c)),d&&d.trim()&&(i.strokeStyle="dashed"),n.push(i)}),n})(d,e),p=(t=>{const e=Array.from(t.querySelectorAll("[class*=activation]")),r=[];return e.forEach(t=>{const e=bt(t,"rectangle",{label:{text:""},subtype:"activation"});(()=>{const r=t.getAttribute("fill"),o=t.getAttribute("stroke"),n=t.getAttribute("stroke-width"),s=t.getAttribute("stroke-dasharray");r&&"none"!==r&&(e.bgColor=J(r)),o&&"none"!==o&&(e.strokeColor=J(o)),n&&(e.strokeWidth=Number(n)),s&&s.trim()&&(e.strokeStyle="dashed")})(),r.push(e)}),r})(e),g=((t,e)=>{const r=Array.from(e.querySelectorAll(".loopLine")),o=[],n=[],s=[];r.forEach(t=>{const e=Number(t.getAttribute("x1")),r=Number(t.getAttribute("y1")),n=Number(t.getAttribute("x2")),s=Number(t.getAttribute("y2")),i=mt(t,e,r,n,s);i.strokeStyle="dotted",i.strokeColor="#adb5bd",i.strokeWidth=2,o.push(i)});const i=Array.from(e.querySelectorAll(".loopText")),a=t.filter(t=>t.type===Lt).map(t=>t.message);i.forEach(t=>{const e=t.textContent||"",r=ft(t,e),o=e.match(/\[(.*?)\]/)?.[1]||"";a.includes(o)&&(r.x+=16),n.push(r)});const l=Array.from(e?.querySelectorAll(".labelBox")),c=Array.from(e?.querySelectorAll(".labelText"));return l.forEach((t,e)=>{const r=c[e]?.textContent||"",o=bt(t,"rectangle",{label:{text:r}});o.strokeColor="#adb5bd",o.bgColor="#e9ecef",o.width=void 0,s.push(o)}),{lines:o,texts:n,nodes:s}})(d,e);return o.push(s),o.push(...a),o.push(h),o.push(p),{type:"sequence",lines:l,arrows:u,nodes:o,loops:g,groups:n}},Xt=0,_t=1,qt=2,Mt=0,zt=1,Dt=t=>{let e;switch(t){case Xt:e="diamond_outline";break;case qt:e="diamond";break;case _t:e="triangle_outline";break;case"none":e=null;break;default:e="arrow"}return e},Wt=(t,e)=>{let r=0,o=0,n=t;for(;n&&n!==e;){const{transformX:t,transformY:e}=W(n);r+=t,o+=e,n=n.parentElement}return{tx:r,ty:o}},Ft=new Set(["triangle_outline","diamond","diamond_outline"]),Bt=(t,e=.5)=>{if(t.length<=2)return[...t];const r=[t[0]];for(let o=1;o<t.length-1;o++){const n=r[r.length-1],s=t[o],i=t[o+1],a=i.x-n.x,l=i.y-n.y,c=Math.hypot(a,l);if(!c)continue;const d=Math.abs(a*(s.y-n.y)-l*(s.x-n.x))/c,u=((s.x-n.x)*a+(s.y-n.y)*l)/(c*c);d<=e&&u>=-e&&u<=1+e||r.push(s)}return r.push(t[t.length-1]),r},jt=t=>{const e=B(K(t).map(t=>[t.x,t.y])).map(([t,e])=>({x:t,y:e})),r=j(t);return r&&e.length>=2&&(e[0]={x:r.startX,y:r.startY},e[e.length-1]={x:r.endX,y:r.endY}),Bt(e)},Kt=(t,e,r)=>{const o=t.x-e.x,n=t.y-e.y,s=Math.hypot(o,n);return s?{x:t.x+o/s*r,y:t.y+n/s*r}:t},Pt=t=>{const e=t.points?.map(([e,r])=>({x:t.startX+e,y:t.startY+r})).filter(t=>Number.isFinite(t.x)&&Number.isFinite(t.y));if(!e||e.length<2)return t;const r=[...e],o=!!t.startArrowhead&&Ft.has(t.startArrowhead),n=!!t.endArrowhead&&Ft.has(t.endArrowhead);if(!o&&!n)return t;if(o&&(r[0]=Kt(r[0],r[1],16)),n){const t=r.length-1;r[t]=Kt(r[t],r[t-1],16)}return((t,e)=>{const r=B(e.map(t=>[t.x,t.y])).map(([t,e])=>({x:t,y:e}));if(r.length<2)throw new Error("Arrow route must contain at least two points");const o=r[0],n=r[r.length-1];t.startX=o.x,t.startY=o.y,t.endX=n.x,t.endY=n.y,t.points=r.map(t=>[t.x-o.x,t.y-o.y])})(t,r),t},Ut=(t,e,r)=>{if(t.length<2)throw new Error(`Class diagram edge ${e?.id||"<unknown>"} is missing usable path points`);const o=t[0],n=t[t.length-1],s=gt(o.x,o.y,n.x,n.y,{id:e?.getAttribute("data-id")||e?.id||void 0,...r,points:t.map(t=>[t.x-o.x,t.y-o.y])});return e&&((t,e)=>{const r=J(t.getAttribute("stroke")||getComputedStyle(t).stroke||""),o=parseFloat(t.getAttribute("stroke-width")||getComputedStyle(t).strokeWidth||"1");tt(r)&&"none"!==r&&(e.strokeColor=r),Number.isFinite(o)&&o>0&&(e.strokeWidth=o)})(e,s),Pt(s)},Ht=(t,e)=>Ut((t=>{const e=[];return t.forEach(t=>{jt(t).forEach(t=>{const r=e[e.length-1];r&&r.x===t.x&&r.y===t.y||e.push(t)})}),Bt(e)})(t),t[0],e),Vt=(t,e)=>{const r=(t=>t.points?.map(([e,r])=>({x:t.startX+e,y:t.startY+r})).filter(t=>Number.isFinite(t.x)&&Number.isFinite(t.y))||[])(t);if(r.length<2)return null;const o="start"===e,n=o?r[0]:r[r.length-1],s=o?r[1]:r[r.length-2],i=s.x===n.x?o?-1:1:Math.sign(s.x-n.x),a=s.y===n.y?1:Math.sign(s.y-n.y);return{x:n.x+20*i,y:n.y+(a>=0?12:-28)}},Gt=(t,e)=>{let r=t;for(;r&&r!==e;){if(r.classList.contains("annotation-group"))return"header";if(r.classList.contains("label-group"))return"header";if(r.classList.contains("members-group"))return"members";if(r.classList.contains("methods-group"))return"methods";r=r.parentElement}return"other"},Jt=(t,e,r)=>{const o=[],n=[],s=[];return Object.values(t).forEach(t=>{const{domId:i,id:a}=t,l=y(),c=(t=>{const e={};return t?(t.forEach(t=>{Q(t).forEach(({property:t,value:r})=>{t&&r&&(e[t]=J(r))})}),e):e})(t.styles||t.cssStyles);let d;try{d=r?r(a):void 0}catch{d=void 0}const u=d&&e.querySelector(`#${d}`)||e.querySelector(`#${i}`)||e.querySelector(`[data-id='${a}']`)||(t=>{const r=new RegExp(`^classId-${t}(?:-|$)`);return Array.from(e.querySelectorAll("[id]")).filter(t=>r.test(t.id))[0]})(a);if(!u)throw Error(`DOM Node with id ${i} not found`);const h=u.querySelector("rect")||u,p=h.getBBox(),{tx:g,ty:f}=Wt(h,e),b={type:"rectangle",id:a,groupId:l,x:p.x+g,y:p.y+f,width:p.width,height:p.height,metadata:{classId:a}},m=h.getAttribute("fill"),x=h.getAttribute("stroke"),w=h.getAttribute("stroke-width"),S=h.getAttribute("stroke-dasharray"),A=getComputedStyle(h),k=J(m||c.fill||(m?A.fill:"")),E=J(x||c.stroke||(x?A.stroke:"")),v=w||c["stroke-width"]||(w?A.strokeWidth:""),C=S||c["stroke-dasharray"]||(S?"none"===A.strokeDasharray?"":A.strokeDasharray:""),I=t=>{if(!t)return!1;if(!tt(t))return!1;const e=t.toLowerCase();return!("none"===e||"transparent"===e||"rgba(0, 0, 0, 0)"===e||"black"===e||"#000"===e||"#000000"===e||"rgb(0, 0, 0)"===e||"rgba(0, 0, 0, 1)"===e)};I(k)?b.bgColor=k:b.bgColor=void 0,I(E)?b.strokeColor=E:b.strokeColor=void 0,b.strokeWidth=v?Number(v):void 0,C&&C.trim().length>0?b.strokeStyle="dashed":b.strokeStyle=void 0,o.push(b);[...Array.from(u.querySelectorAll("line")),...Array.from(u.querySelectorAll("g.divider path"))].forEach(t=>{const{tx:r,ty:o}=Wt(t,e);let s,i,c,d;if("line"===t.tagName.toLowerCase())s=Number(t.getAttribute("x1"))+r,i=Number(t.getAttribute("y1"))+o,c=Number(t.getAttribute("x2"))+r,d=Number(t.getAttribute("y2"))+o;else{const e=t.getBBox();s=e.x+r,c=e.x+e.width+r;const n=e.y+e.height/2+o;i=n,d=n}if(s===c&&i===d)return;const u=mt(t,s,i,c,d,{groupId:l,id:y()});b.strokeColor?u.strokeColor=b.strokeColor:u.strokeColor=void 0,void 0!==b.strokeWidth?u.strokeWidth=b.strokeWidth:u.strokeWidth=void 0,b.strokeStyle?u.strokeStyle=b.strokeStyle:u.strokeStyle=void 0,u.metadata={classId:a},n.push(u)});const O=Array.from(u.querySelectorAll("text, foreignObject")),L=[];O.forEach(t=>{const r="foreignobject"===t.tagName.toLowerCase(),o=r?[]:Array.from(t.querySelectorAll("tspan")),n=o.length?o.map(t=>t.textContent?.trim()).filter(Boolean).join("\n"):t.textContent?.trim()||"";if(!n)return;const s=t.getBBox(),{ty:i}=Wt(t,e);let a=parseFloat(getComputedStyle(t).fontSize||"");if(r&&(!Number.isFinite(a)||!a)){const e=t.querySelector("div, span, p");e&&(a=parseFloat(getComputedStyle(e).fontSize||""))}(!Number.isFinite(a)||a<=0)&&(a=Math.max(12,.6*s.height)),a*=.9;const l=ot(t,c.color);L.push({section:Gt(t,u),text:D(n),x:s.x,y:s.y+i,width:b&&b.width?Math.max(b.width-8,s.width):s.width,height:s.height,fontSize:a,color:l})});const N=L.filter(t=>"header"===t.section).sort((t,e)=>t.y-e.y||t.x-e.x);if(!b.label){const t=0===N.length&&1===L.length?L:N;t.length>0&&(b.label={text:t.map(t=>t.text).join("\n"),fontSize:Math.max(...t.map(t=>t.fontSize)),color:t.find(t=>t.color)?.color,verticalAlign:"top"})}L.filter(t=>N.length>0?"header"!==t.section:!(b.label&&1===L.length)).forEach(t=>{const e=yt((b?.x||0)+4,t.y,t.text,{width:t.width,height:t.height,fontSize:t.fontSize,color:t.color,id:y(),groupId:l,metadata:{classId:a}});s.push(e)})}),{nodes:o,lines:n,text:s}},Zt=(t,e,r,o)=>{const n=Array.from(r.querySelectorAll('.edgePaths path[data-edge="true"]:not([id^="edgeNote"]):not([id*="-cyclic-special-"])'));if(0===t.length)return{arrows:[],text:[]};const s=[],i=[];let a=0;return t.forEach(t=>{const{id1:l,id2:c,relation:d}=t,u=e.find(t=>t.id===l),h=e.find(t=>t.id===c);if(!u)throw new Error(`parseRelations: Cannot find node with id ${l}`);if(!h)throw new Error(`parseRelations: Cannot find node with id ${c}`);const p=(t=>{let e;switch(t){case Mt:e="solid";break;case zt:e="dotted";break;default:e="solid"}return e})(d.lineType),g=Dt(d.type1),y=Dt(d.type2);let f;if(l===c){const e=((t,e)=>[`${t}-cyclic-special-1`,`${t}-cyclic-special-mid`,`${t}-cyclic-special-2`].map(t=>e.querySelector(`path[id="${t}"][data-edge="true"]`)).filter(t=>null!==t))(l,r);if(!e.length)throw new Error(`parseRelations: Cannot find rendered SVG edge for relation ${l} -> ${c}`);f=Ht(e,{strokeStyle:p,startArrowhead:g,endArrowhead:y,label:t.title?{text:t.title}:void 0,start:{type:"rectangle",id:u.id},end:{type:"rectangle",id:h.id}})}else{const e=n[a];if(!e)throw new Error(`parseRelations: Cannot find rendered SVG edge for relation ${l} -> ${c}`);a+=1,f=((t,e)=>{const r=jt(t);return Ut([r[0],r[r.length-1]],t,e)})(e,{strokeStyle:p,startArrowhead:g,endArrowhead:y,label:t.title?{text:t.title}:void 0,start:{type:"rectangle",id:u.id},end:{type:"rectangle",id:h.id}})}s.push(f);const{relationTitle1:b,relationTitle2:m}=t,x=l===c,w=20,S=15,A=15;let k,E;if(b&&"none"!==b){if(x){const t=Vt(f,"start");t&&(k=t.x,E=t.y)}else switch(o){case"TB":k=f.startX-w,f.endX<f.startX&&(k-=A),E=f.startY+S;break;case"BT":k=f.startX+w,f.endX>f.startX&&(k+=A),E=f.startY-S;break;case"LR":k=f.startX+w,E=f.startY+S,f.endY>f.startY&&(E+=A);break;case"RL":k=f.startX-w,E=f.startY-S,f.startY>f.endY&&(E-=A);break;default:k=f.startX-w,E=f.startY+S}k??=f.startX-w,E??=f.startY+S;const t=yt(k,E,b,{fontSize:16});i.push(t)}if(m&&"none"!==m){if(x){const t=Vt(f,"end");t&&(k=t.x,E=t.y)}else switch(o){case"TB":k=f.endX+w,f.endX<f.startX&&(k+=A),E=f.endY-S;break;case"BT":k=f.endX-w,f.endX>f.startX&&(k-=A),E=f.endY+S;break;case"LR":k=f.endX-w,E=f.endY-S,f.endY>f.startY&&(E-=A);break;case"RL":k=f.endX+w,E=f.endY+S,f.startY>f.endY&&(E+=A);break;default:k=f.endX+w,E=f.endY-S}k??=f.endX+w,E??=f.endY+S;const t=yt(k,E,m,{fontSize:16});i.push(t)}}),{arrows:s,text:i}},Qt=(t,e,r)=>{const o=[],n=[];return t.forEach((t,s)=>{const{id:i,text:a,class:l}=t,c=e.querySelector(`#${i}`);if(!c)throw new Error(`Node with id ${i} not found!`);const{transformX:d,transformY:u}=W(c),h=c.firstChild,p=bt(h,"rectangle",{id:i,subtype:"note",label:{text:a}});if(Object.assign(p,{x:p.x+d,y:p.y+u}),o.push(p),l){const t=r.find(t=>t.id===l);if(!t)throw new Error(`class node with id ${l} not found!`);const o=e.querySelector(`path[id="edgeNote${s+1}"][data-edge="true"]`);if(o)return void n.push(((t,e)=>Ht([t],e))(o,{strokeStyle:"dotted",startArrowhead:null,endArrowhead:null,start:{id:p.id,type:"rectangle"},end:{id:t.id,type:"rectangle"}}));const i=p.x+(p.width||0)/2,a=p.y+(p.height||0),c=i,d=t.y,u=gt(i,a,c,d,{strokeStyle:"dotted",startArrowhead:null,endArrowhead:null,start:{id:p.id,type:"rectangle"},end:{id:t.id,type:"rectangle"}});n.push(u)}}),{notes:o,connectors:n}},te=(t,e)=>{let r=0,o=0,n=t;for(;n&&n!==e;){const{transformX:t,transformY:e}=W(n);r+=t,o+=e,n=n.parentElement}return{tx:r,ty:o}},ee=t=>{const e=t.querySelector("text, foreignObject, div, span, p")||t;let r=parseFloat(getComputedStyle(e).fontSize||"");return(!Number.isFinite(r)||r<=0)&&(r=Math.max(12,.75*t.getBBox().height)),r},re=(t,e,r)=>{const o=(t=>{const e=Array.from(t.querySelectorAll("tspan")),r=e.length?e.map(t=>t.textContent?.trim()).filter(Boolean).join("\n"):t.textContent?.trim()||"";return D(r)})(t);if(!o)return null;const n=t.getBBox(),{tx:s,ty:i}=te(t,e);return{className:t.getAttribute("class")||"",text:o,x:n.x+s,y:n.y+i,width:n.width,height:n.height,fontSize:ee(t),color:ot(t,r)}},oe=t=>{switch(t?.toLowerCase()){case"one":return"cardinality_one";case"many":return"cardinality_many";case"only_one":return"cardinality_exactly_one";case"one_or_more":return"cardinality_one_or_many";case"zero_or_one":return"cardinality_zero_or_one";case"zero_or_more":return"cardinality_zero_or_many";default:return null}},ne=t=>{switch(t){case"dotted":return"dotted";case"dashed":return"dashed";default:return"solid"}},se=(t,e)=>{const r=e.querySelector(`[id="${t.id}"]`);if(!r)throw new Error(`ER entity ${t.id} not found in rendered SVG`);const o=t.attributes.length?y():void 0,n=r.getBBox(),{tx:s,ty:i}=te(r,e),a=(t=>{const e={};return t?(t.forEach(t=>{Q(t).forEach(({property:t,value:r})=>{t&&r&&(e[t]=J(r))})}),e):e})([...t.cssStyles||[],...t.cssCompiledStyles||[]]),l=J(a.fill||""),c=J(a.stroke||""),d=(t=>{if(null==t||""===t)return;const e="number"==typeof t?t:parseFloat(J(t));return!Number.isFinite(e)||e<=0?void 0:e})(a["stroke-width"]),u=J(a["stroke-dasharray"]||""),h=Array.from(r.querySelectorAll("g.label")).map(t=>re(t,e,a.color)).filter(t=>null!==t),p=h.find(t=>t.className.includes("name"))||h[0],g=h.filter(t=>t!==p),f=p?.text||D(t.alias||t.label||""),b={type:"rectangle",id:t.id,groupId:o,x:n.x+s,y:n.y+i,width:n.width,height:n.height,label:{text:f,fontSize:t.attributes.length?18:p?.fontSize||16,color:p?.color,textAlign:"center",verticalAlign:t.attributes.length?"top":"middle"},metadata:{entityId:t.id,entityLabel:t.label,entityAlias:t.alias}};tt(l)&&"none"!==l&&(b.bgColor=l),tt(c)&&"none"!==c&&(b.strokeColor=c),d&&Number.isFinite(d)&&d>0&&(b.strokeWidth=d),u&&"none"!==u&&(b.strokeStyle="dashed");const m=Array.from(r.querySelectorAll(".divider path, path.divider, line.divider")).map(r=>((t,e,r,o,n,s,i)=>{const{tx:a,ty:l}=te(t,e);let c=0,d=0,u=0,h=0;if("line"===t.tagName.toLowerCase())c=Number(t.getAttribute("x1"))+a,d=Number(t.getAttribute("y1"))+l,u=Number(t.getAttribute("x2"))+a,h=Number(t.getAttribute("y2"))+l;else{const e=j(t);if(!e)return null;c=e.startX+a,d=e.startY+l,u=e.endX+a,h=e.endY+l}const p={type:"line",id:y(),groupId:r,startX:c,startY:d,endX:u,endY:h,metadata:{entityId:o}};return n&&tt(n)&&"none"!==n&&(p.strokeColor=n),void 0!==s&&(p.strokeWidth=s),i&&(p.strokeStyle=i),p})(r,e,o,t.id,b.strokeColor,b.strokeWidth,b.strokeStyle)).filter(t=>null!==t),x=g.map(e=>yt(e.x,e.y,e.text,{id:y(),groupId:o,width:e.width,height:e.height,fontSize:18,color:e.color,metadata:{entityId:t.id}}));return{container:b,lines:m,text:x}},ie=(t,e)=>{const r=((t,e)=>{const r=e.querySelector(`path[id="${t.id}"][data-edge="true"]`);return r?[r]:t.start!==t.end?[]:[`${t.start}-cyclic-special-1`,`${t.start}-cyclic-special-mid`,`${t.start}-cyclic-special-2`].map(t=>e.querySelector(`path[id="${t}"][data-edge="true"]`)).filter(t=>null!==t)})(t,e);if(!r.length)throw new Error(`ER relationship ${t.id} not found in rendered SVG`);const o=(t=>{const e=[];return t.forEach(t=>{K(t).forEach(t=>{const r=e[e.length-1];r&&r.x===t.x&&r.y===t.y||e.push(t)})}),e})(r);if(o.length<2)throw new Error(`ER relationship ${t.id} is missing usable path points`);const n=o[0],s=o[o.length-1],i=r[0],a=J(i.getAttribute("stroke")||getComputedStyle(i).stroke||""),l=Number(i.getAttribute("stroke-width")||getComputedStyle(i).strokeWidth||1),c=gt(n.x,n.y,s.x,s.y,{id:t.id,label:t.label?{text:D(t.label),fontSize:16,textAlign:"center"}:void 0,strokeStyle:ne(t.pattern),startArrowhead:oe(t.arrowTypeStart),endArrowhead:oe(t.arrowTypeEnd),start:{type:"rectangle",id:t.start},end:{type:"rectangle",id:t.end},points:o.map(t=>[t.x-n.x,t.y-n.y])});return tt(a)&&"none"!==a&&(c.strokeColor=a),Number.isFinite(l)&&l>0&&(c.strokeWidth=l),c},ae=t=>{const e=J(t||"");return!!e&&("none"!==e&&"transparent"!==e&&"rgba(0, 0, 0, 0)"!==e&&"rgba(0,0,0,0)"!==e&&tt(e))},le=(t,e,r)=>{switch(e){case i.FILL:case i.STROKE:ae(r)&&(t[e]=J(r));break;case i.STROKE_WIDTH:case i.STROKE_DASHARRAY:J(r)&&(t[e]=J(r))}},ce=(t,e,r)=>{e===s.COLOR&&ae(r)&&(t[s.COLOR]=J(r))},de=(t,e)=>{t&&Q(t).forEach(({property:t,value:r})=>{t===i.FILL&&ae(r)?e[s.COLOR]=J(r):ce(e,t,r)})},ue=(t,e)=>{let r=0,o=0,n=t;for(;n&&n!==e;){const{transformX:t,transformY:e}=W(n);r+=t,o+=e,n=n.parentElement}return{tx:r,ty:o}},he=(t,e)=>{const r=t.querySelector("line.divider");if(!r)return;const{tx:o,ty:n}=ue(r,e);return{startX:Number(r.getAttribute("x1"))+o,startY:Number(r.getAttribute("y1"))+n,endX:Number(r.getAttribute("x2"))+o,endY:Number(r.getAttribute("y2"))+n}},pe=t=>{const e=t.getBBox();return Math.abs(e.width*e.height)},ge=(t,e)=>{const r=t.getAttribute("style");if(!r)return;const o=Q(r).find(t=>t.property===e);return o?J(o.value):void 0},ye=(t,e)=>{const r=t.map(t=>({element:t,area:pe(t)})).filter(({area:t})=>Number.isFinite(t)&&t>0);if(0===r.length)return null;return r.sort((t,r)=>"largest"===e?r.area-t.area:t.area-r.area)[0].element},fe=(t,e)=>{const r=Array.from(t.querySelectorAll("circle, ellipse, path"));return((t,e)=>{if(!t)return;if(!e.has(i.FILL)&&!e.has(i.STROKE))return;const r=J(t.getAttribute("fill")||ge(t,i.FILL)||""),o=J(t.getAttribute("stroke")||ge(t,i.STROKE)||"");return ae(r)?r:ae(o)?o:void 0})(ye(r,"smallest"),e)},be=t=>(t=>{if(t.length<2)return t;const e=t.slice(1),r=e.filter(t=>t.trim().length>0).reduce((t,e)=>{const r=e.match(/^\s*/)?.[0].length??0;return Math.min(t,r)},Number.POSITIVE_INFINITY);return!Number.isFinite(r)||r<=0?t.map(t=>t.trimEnd()):[t[0].trimEnd(),...e.map(t=>t.replace(new RegExp(`^\\s{0,${r}}`),"").trimEnd())]})(Array.isArray(t.label)?t.label.map(t=>D(t)):D(t.label||"").split("\n")).join("\n"),me=t=>{if(!t.description)return[];return(Array.isArray(t.description)?t.description:[t.description]).map(t=>D(t)).filter(t=>t.length>0)},xe=(t,e,r)=>{const o=r(t);if(!o)throw new Error(`State node element not found for "${t.id}"`);const n=((t,e)=>{switch(e){case"roundedWithTitle":case"rectWithTitle":return t.querySelector("rect.outer")||t.querySelector("rect")||t;case"divider":return t.querySelector("rect.divider")||t.querySelector("rect")||t;case"stateStart":case"stateEnd":return ye(Array.from(t.querySelectorAll("circle, ellipse, path")),"largest")||t;default:return t.querySelector("rect, path, circle, ellipse, polygon")||t}})(o,t.shape),a={},l={},c=[t.labelStyle,...t.cssCompiledStyles||[],...t.cssStyles||[]],d=(t=>{const e=new Set;return t.filter(Boolean).forEach(t=>{Q(t||"").forEach(({property:t})=>{e.add(t)})}),e})(c);c.filter(Boolean).forEach(t=>{((t,e,r)=>{t&&Q(t).forEach(({property:t,value:o})=>{le(e,t,o),ce(r,t,o)})})(t,a,l)}),((t,e,r)=>{if(!t)return;[[i.FILL,t.getAttribute("fill")],[i.STROKE,t.getAttribute("stroke")],[i.STROKE_WIDTH,t.getAttribute("stroke-width")],[i.STROKE_DASHARRAY,t.getAttribute("stroke-dasharray")]].forEach(([t,o])=>{if(!r.has(t))return;if(e[t])return;const n=J(o||"");n&&le(e,t,n)})})(n,a,d),((t,e,r)=>{if(!t)return;const o=[t,...Array.from(t.querySelectorAll("text, foreignObject, div, span, p"))];for(const t of o){if(e[s.COLOR])break;if((r.has(s.COLOR)||r.has(i.FILL))&&(de(t.getAttribute("style"),e),e[s.COLOR]))break;const o=J(t.getAttribute("fill")||t.getAttribute("color")||"");(r.has(s.COLOR)||r.has(i.FILL))&&ae(o)&&(e[s.COLOR]=o)}})(o,l,d);const u=((t,e)=>{const r=t.getBBox(),{tx:o,ty:n}=ue(t,e);return{x:r.x+o,y:r.y+n,width:r.width,height:r.height}})(n,e);return{id:t.id,shape:t.shape,text:be(t),description:me(t),x:u.x,y:u.y,width:u.width,height:u.height,parentId:t.parentId,position:t.position,containerStyle:a,labelStyle:l,dividerLine:"rectWithTitle"===t.shape?he(o,e):void 0,endInnerColor:"stateEnd"===t.shape?fe(o,d):void 0,isRenderable:"noteGroup"!==t.shape}},we=(t,e)=>{const r=e.querySelector(`[id='${t.id}']`);if(!r)return null;const{tx:o,ty:n}=ue(r,e),s=P(r,{x:o,y:n},"MCL");if(s.reflectionPoints.length<2)return null;const a={};[t.style].filter(Boolean).forEach(t=>{Q(t||"").forEach(({property:t,value:e})=>{((t,e)=>{switch(t){case i.STROKE:ae(e)&&(a.strokeColor=J(e));break;case i.STROKE_WIDTH:{const t=parseFloat(J(e));Number.isFinite(t)&&t>0&&(a.strokeWidth=t);break}case i.STROKE_DASHARRAY:J(e)&&(a.strokeStyle="dashed")}})(t,e)})});const l="none"===t.arrowhead||t.classes?.includes("note-edge");return{id:t.id,start:t.start,end:t.end,text:D(t.label||""),...s,strokeColor:a.strokeColor,strokeWidth:a.strokeWidth,strokeStyle:l?"dashed":a.strokeStyle,isNoteEdge:l}},Se=(t,e)=>{const{nodes:r,edges:o}=t.getData(),n=(t=>{const e=new Set,r=t=>(t&&e.add(t),t),o=t=>{const o=t.find(t=>!e.has(t));return r(o||null)};return e=>{const n=[`[id='${e.domId}']`,`[id='${e.id}']`,`[data-id='${e.id}']`];for(const e of n){const o=t.querySelector(e);if(o)return r(o)}switch(e.shape){case"divider":return o(Array.from(t.querySelectorAll("g.statediagram-cluster-alt")));case"stateStart":return o(Array.from(t.querySelectorAll("g.node.default")).filter(t=>t.querySelector("circle.state-start")));case"stateEnd":return o(Array.from(t.querySelectorAll("g.node.default")).filter(t=>!t.querySelector("circle.state-start")));default:return null}}})(e);return{type:"state",nodes:r.map(t=>xe(t,e,n)),edges:o.map(t=>we(t,e)).filter(t=>null!==t)}};let Ae=Promise.resolve();let ke=null,Ee=0;const ve=t=>{const e=t.querySelector("svg");if(!e)throw new Error("SVG element not found");const r=e.getBoundingClientRect(),o=r.width,n=r.height;e.setAttribute("width",`${o}`),e.setAttribute("height",`${n}`);const s=unescape(encodeURIComponent(e.outerHTML));return{type:"graphImage",mimeType:"image/svg+xml",dataURL:`data:image/svg+xml;base64,${btoa(s)}`,width:o,height:n}},Ce=async(t,e=G)=>(t=>{const e=Ae.then(t,t);return Ae=e.then(()=>{},()=>{}),e})(async()=>{const r=e.themeVariables?.fontSize??G.themeVariables.fontSize,o={...G,...e,fontSize:r,themeVariables:{...G.themeVariables,...e.themeVariables,fontSize:r}},n=(t=>JSON.stringify(t))(o);n!==ke&&(H.default.initialize(o),ke=n);const s=await H.default.mermaidAPI.getDiagramFromText((t=>{let e=t;return e=e.replace(/style.*:\S*#.*;/g,t=>t.substring(0,t.length-1)),e=e.replace(/classDef.*:\S*#.*;/g,t=>t.substring(0,t.length-1)),e=e.replace(/#\w+;/g,t=>{const e=t.substring(1,t.length-1);return/^\+?\d+$/.test(e)?`fl°°${e}¶ß`:`fl°${e}¶ß`}),e})(t)),i="mermaid-to-excalidraw-"+Ee++,a=document.createElement("div");a.setAttribute("style","opacity: 0; position: fixed; z-index: -1; left: -99999px; top: -99999px;");const l=`${i}-container`;a.id=l,document.getElementById(l)?.remove(),document.body.appendChild(a);try{const{svg:e}=await H.default.render(i,t,a);let r;a.innerHTML=e;try{switch(s.type){case"flowchart-v2":case"graph":r=pt(s.db,a);break;case"sequence":r=Rt(s,a);break;case"class":case"classDiagram":r=((t,e)=>{const r=t.db,o=r.getDirection?.()||"TB",n=[],s=[],i=[],a=[],l=r.getNamespaces?.()||[],c=r.getClasses?.()||{},d=c instanceof Map?Object.fromEntries(c):c;if(d&&Object.keys(d).length){const t="function"==typeof r.lookUpDomId?r.lookUpDomId.bind(r):void 0,o=Jt(d,e,t);n.push(o.nodes),s.push(...o.lines),i.push(...o.text),a.push(...o.nodes)}const u=r.getRelations?.()||[],{arrows:h,text:p}=Zt(u,a,e,o),g=r.getNotes?.()||[],{notes:y,connectors:f}=Qt(g,e,a);return n.push(y),h.push(...f),i.push(...p),{type:"class",nodes:n,lines:s,arrows:h,text:i,namespaces:l}})(s,a);break;case"er":r=((t,e)=>{const r=t.getData(),o=r.nodes,n=r.edges,s=[],i=[],a=[];o.forEach(t=>{const r=se(t,e);s.push(r.container),i.push(...r.lines),a.push(...r.text)});const l=n.map(t=>ie(t,e));return{type:"erd",nodes:[s],lines:i,arrows:l,text:a}})(s.db,a);break;case"state":case"stateDiagram":r=Se(s.db,a);break;default:r=ve(a)}}catch(t){console.error("Error processing Mermaid diagram:",t),r=ve(a)}return r}finally{a.remove()}}),Ie=async(t,e)=>{const r=e||{},o=parseInt(r.themeVariables?.fontSize??"")||20,n=await Ce(t,{...r,themeVariables:{...r.themeVariables}});return U(n,{fontSize:o})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[676,4091,8319],{77481(e,t,s){s.d(t,{S:()=>l,X:()=>i});var n=s(96540),r=s(61443),a=s(74848);function i(e){const[t,s]=n.useState([]),i=(0,n.useRef)(-1),[l,o]=(0,n.useState)(-1),[c,u]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const d=()=>{i.current=-1,o(-1),u(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let i=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(i=`${t} (${n.label})`)}return(0,a.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,a.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(l===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(i.current=s,o(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",u(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=i.current,s=c;d(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:d,children:t.map((s,n)=>{const r=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:r,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function l(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},48890(e,t,s){s.d(t,{Kw:()=>n,Tt:()=>r});var n=s(80952),r=(s(82327),s(1766),s(24854),s(90008),s(90846),s(40975),s(44286),s(30766),s(14973),s(69687),s(1234),s(47507),s(87268),s(34678),s(24522));const a=`https://gcore.jsdelivr.net/npm/ace-builds@${n.version}/src-min-noconflict/`;n.config.set("basePath",a),n.config.set("modePath",a),n.config.set("themePath",a),n.config.set("workerPath",a)},84091(e,t,s){s.r(t),s.d(t,{default:()=>c});var n=s(96540),r=(s(80952),s(48890)),a=s(34843),i=s(82893),l=s(78247),o=s(74848);function c(e){const t=(0,n.useRef)(null),[s,c]=(0,a.fp)(i.AG.user_base_info),u=s.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,n.useEffect)(()=>{const s=r.Kw.edit(t.current,{value:l.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${u}`,mode:e.model??r.Tt.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return s.setOptions({}),s.container.addEventListener("wheel",function(e){e.preventDefault()}),s.focus(),s.on("change",function(t){e.on_change&&e.on_change()}),t.current=s,s.formatCode=()=>{const e=r.Kw.require("ace/ext/beautify"),s=t.current;s&&e.beautify(s.session)},l.xK.set_editor_temp(s,e.editor_id),()=>{l.xK.delete_editor_temp(e.editor_id),s.destroy()}},[]),(0,o.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}},60676(e,t,s){s.r(t),s.d(t,{default:()=>C});var n=s(96540),r=s(57952),a=s(85997),i=s(14284),l=s(52671),o=s(77481),c=s(70447),u=s(34843),d=s(82893),p=s(84091),h=s(78247),f=s(61443),x=s(23496),_=s(62042),m=s(22022),j=s(53459),v=s(7523),g=s(74848);function b(e,t="auto"){return"s"===t||"auto"===t&&e>=1e3?`${(e/1e3).toFixed(2)} s`:`${Math.round(e)} ms`}function S(e){const{running:t=!1,resetKey:s=0,format:r="auto",prefix:a="",onTick:i,className:l}=e,[o,c]=(0,n.useState)(0),u=(0,n.useRef)(0),d=(0,n.useRef)(null),p=(0,n.useRef)(t);p.current=t;const h=(0,n.useCallback)(()=>{null!==d.current&&(cancelAnimationFrame(d.current),d.current=null)},[]),f=(0,n.useCallback)(()=>{h();const e=()=>{const t=performance.now()-u.current;c(t),i?.(t),p.current&&(d.current=requestAnimationFrame(e))};e()},[i,h]);return(0,n.useEffect)(()=>{u.current=performance.now(),c(0),i?.(0),p.current&&f()},[s]),(0,n.useEffect)(()=>{t?f():h()},[t,f,h]),(0,n.useEffect)(()=>()=>h(),[h]),(0,g.jsxs)("span",{className:l,children:[a,b(o,r)]})}var q=s(87361),w=s(28319);function y(e){const[t,s]=(0,n.useState)("");return(0,g.jsxs)("div",{className:"db-query-preset-input",children:[(0,g.jsx)(f.Sm,{placeholder:e.placeholder,value:t,handleInputChange:s}),(0,g.jsx)("div",{className:"db-query-preset-input__actions",children:(0,g.jsx)(a.C3,{text:e.confirmText,clickFun:()=>e.onConfirm(t.trim())})})]})}function C(){const e=(0,l.Zp)(),{t}=(0,m.Bd)(),{initUserInfo:s}=(0,n.useContext)(v.F),[b]=(0,u.fp)(d.AG.sqlite_query_context),[C]=(0,u.fp)(d.AG.user_base_info),[,k]=(0,u.fp)(d.AG.prompt_card),N=(0,n.useMemo)(()=>b?.path??"",[b?.path]),E=(0,n.useMemo)(()=>b?.path?`${b?.name||"数据库"} | ${b.path}`:"未选择数据库",[b?.name,b?.path]),A=97,[K,F]=(0,n.useState)(""),[L,$]=(0,n.useState)("table"),[R,M]=(0,n.useState)(!1),[O,Q]=(0,n.useState)(""),[D,P]=(0,n.useState)(null),[T,G]=(0,n.useState)(!1),[I,J]=(0,n.useState)(0),[Z,W]=(0,n.useState)(!1),[B,H]=(0,n.useState)([]),[V,X]=(0,n.useState)(-1);(0,n.useEffect)(()=>{const e=C?.user_data?.sql_preset_list;e&&e.length?H([...e]):H([{index:0,note:t("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}])},[C?.user_data?.sql_preset_list]);const U=async e=>{const t=e.map((e,t)=>({...e,index:t})),n=await i.wm.post(x.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:t});return n?.code===j.m.Success&&(await s(),H(t),!0)},z=async(e,s)=>{const n=[...B,{note:s||t("SQL 预设"),sql:e,env:w.sqlEnvDefault}];await U(n)&&(k({open:!1}),(0,_.SK)(t("创建成功")),X(n.length-1))},Y=(e,t)=>{if(!e)return"";for(const s of e.split("\n")){const e=s.indexOf("=");if(!(e<0)&&s.slice(0,e).trim()===t)return s.slice(e+1).trim()}return""},[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)("");(0,n.useEffect)(()=>{h.xK.set_value_temp(K,A)},[K]),(0,n.useEffect)(()=>{F(""),Q(""),P(null),$("table"),G(!1),W(!1),J(0),te(""),ne(""),h.xK.set_value_temp("",A),N||Q("请先从文件右键打开一个数据库")},[N,b?.open]);const re=async()=>{const e=(h.xK.get_editor_value(A)??K).trim();if(!N)return Q("请先从文件右键打开一个数据库"),void P(null);if(!e)return Q("请输入 SQL 语句"),void P(null);M(!0),Q(""),W(!0),J(e=>e+1),G(!0);try{const s=(t=e,ee?t.split(ee).join(se):t),n=await i.$M.post("sqlite/query",{path:N,sql:s});P(n.data),$("table")}catch(e){Q(e?.message??`${e}`),P(null)}finally{G(!1),M(!1)}var t},ae=D?.columns?.length?D.columns:Object.keys(D?.rows?.[0]??{}),ie=(D?.rows??[]).map(e=>ae.map(t=>{return null==(s=e[t])?"":"object"==typeof s?JSON.stringify(s):`${s}`;var s}));return(0,g.jsxs)("div",{className:"db-query-page",children:[(0,g.jsx)(r.A,{ignore_tags:!0,left_children:[(0,g.jsx)(a.rA,{icon:"arrow_back",title:"返回",onClick:()=>e(-1)},"back"),(0,g.jsx)(a.rA,{icon:"play_arrow",title:"执行",onClick:re},"run"),(0,g.jsx)(a.rA,{icon:"table_chart",title:"表格视图",onClick:()=>$("table")},"table"),(0,g.jsx)(a.rA,{icon:"data_object",title:"原 JSON",onClick:()=>$("json")},"json"),(0,g.jsx)(a.rA,{icon:"settings",title:t("SQL预设设置"),onClick:()=>{e(q.o.sql_preset_setting_page)}},"preset-setting")],children:(0,g.jsx)(c.xP,{context:E,tip_context:"点击复制数据库信息"})}),(0,g.jsxs)("div",{className:"db-query-page__content",children:[(0,g.jsxs)(c.Zp,{title:"SQL 查询",titleCom:(0,g.jsxs)("div",{className:"db-query-page__preset-bar",children:[ee&&(0,g.jsx)(f.Sm,{placeholder:`${t("替换")}: ${ee}`,value:se,handleInputChange:ne,width:"12rem"}),B.length>0&&(0,g.jsx)(f.l6,{width:"16rem",tip:t("SQL预设"),value:V,onChange:e=>{const t=B[e];t&&(X(e),(e=>{h.xK.set_value_temp(e,A);const t=h.xK.get_editor(A);t&&t.setValue(e,-1),F(e)})(t.sql),te(Y(t.env??"","find")),ne(""),Q(""))},options:B.map((e,t)=>({value:t,title:`${e.note||e.sql.slice(0,24)}`}))}),(0,g.jsx)(a.C3,{text:t(V>=0?"更新保存":"创建新预选项"),clickFun:async()=>{const e=(h.xK.get_editor_value(A)??K).trim();if(!e)return void Q(t("sql_in"));const s=[...B];if(V>=0&&s[V]){s[V].sql=e,s[V].note||(s[V].note=t("SQL 预设"));await U(s)&&(0,_.SK)(t("更新成功"))}else k({open:!0,title:t("创建新预选项"),context_div:(0,g.jsx)(y,{placeholder:t("请输入备注"),confirmText:t("确认"),onConfirm:t=>z(e,t)}),cancel:()=>k({open:!1})})}})]}),rightBottomCom:(0,g.jsxs)("div",{className:"db-query-page__actions",children:[(0,g.jsx)(a.C3,{text:R?"查询中...":"执行查询",clickFun:re}),(0,g.jsx)(a.C3,{text:"清空",clickFun:()=>{h.xK.set_value_temp("",A);const e=h.xK.get_editor(A);e&&e.setValue("",-1),F("")}}),(0,g.jsx)(a.C3,{text:"table"===L?"表格视图":"切换到表格",clickFun:()=>$("table")}),(0,g.jsx)(a.C3,{text:"json"===L?"原 JSON":"切换到 JSON",clickFun:()=>$("json")})]}),children:[(0,g.jsx)("div",{className:"db-query-page__editor",children:(0,g.jsx)(p.default,{name:"sqlite.sql",editor_id:A,model:"ace/mode/sql",on_change:()=>{const e=h.xK.get_editor_value(A)??"";F(e)},options:{showPrintMargin:!1,highlightActiveLine:!0,wrap:!0}})}),O&&(0,g.jsx)("div",{className:"db-query-page__error",children:O})]}),(0,g.jsxs)(c.Zp,{title:"查询结果",titleCom:(0,g.jsxs)("span",{className:"db-query-page__result-meta",children:[D?`${D.row_count} 行`:"暂无结果",Z&&(0,g.jsx)("span",{className:"db-query-page__elapsed",children:(0,g.jsx)(S,{running:T,resetKey:I,prefix:`${t("耗时")}: `,format:"auto"})})]}),children:[D&&"table"===L&&(0,g.jsx)(o.X,{headers:ae,rows:ie}),D&&"json"===L&&(0,g.jsx)("pre",{className:"db-query-page__result-json",children:JSON.stringify(D.rows,null,2)}),!D&&!O&&(0,g.jsx)("div",{className:"db-query-page__hint",children:"先输入查询语句,再执行。支持 `select`、`with`、`pragma`、`explain`。"}),!D&&O&&(0,g.jsx)("div",{className:"db-query-page__hint",children:O})]})]})]})}},28319(e,t,s){s.r(t),s.d(t,{default:()=>q,defaultSqlPreset:()=>b,sqlEnvDefault:()=>S});var n=s(96540),r=s(22022),a=s(4412),i=s(85997),l=s(75725),o=s(77481),c=s(70447),u=s(61443),d=s(34843),p=s(82893),h=s(14284),f=s(23496),x=s(53459),_=s(62042),m=s(7523),j=s(78247),v=s(52671),g=s(74848);function b(e){return{index:0,note:e("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}}const S='# 可选:设置 SQL 中的"替换词"(在查询页选中该预设后,会显示输入框)\n# 例子:SQL 为 SELECT * FROM t WHERE id = 123456 ,请填写下面的 find=123456\n# 这样查询页输入新值即可把 SQL 中的 123456 替换掉后再查询\nfind=';function q(){const{t:e}=(0,r.Bd)(),{initUserInfo:t}=(0,n.useContext)(m.F),[,s]=(0,d.fp)(p.AG.editorSetting),[q]=(0,d.fp)(p.AG.user_base_info),w=(0,v.Zp)(),y=n.useRef(-1),[C,k]=(0,n.useState)([]);(0,n.useEffect)(()=>{const t=q?.user_data?.sql_preset_list;k(t?.length?[...t]:[b(e)])},[e,q?.user_data?.sql_preset_list]);const N=async()=>{const s=C.map((e,t)=>({...e,index:t})),n=await h.wm.post(f.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:s});n?.code===x.m.Success&&(await t(),(0,_.SK)(e("保存成功")))},E=(e,t)=>{y.current=e;const n=C[e][t]??"";j.xK.set_value_temp(n),s({model:"sql"===t?"ace/mode/sql":"ace/mode/ini",open:!0,fileName:"",save:async e=>{C[y.current][t]=e,k([...C]),j.xK.set_value_temp(""),N()}})},A=[e("编号"),e("备注"),e("SQL代码"),e("env编辑"),e("操作")];return(0,g.jsxs)("div",{children:[(0,g.jsx)(a.aZ,{position:"right",children:(0,g.jsx)(i.rA,{icon:"arrow_back",title:e("返回"),onClick:()=>w(-1)})}),(0,g.jsx)(l.jW,{isFull:!0,more:!0,children:(0,g.jsx)(l.NN,{children:(0,g.jsx)(l.xh,{children:(0,g.jsx)(l.fI,{children:(0,g.jsx)(l.VP,{widthPer:60,children:(0,g.jsx)(c.uF,{self_title:(0,g.jsx)("span",{className:"div-row",children:(0,g.jsx)("h2",{children:e("SQL 预设")})}),titleCom:(0,g.jsxs)("div",{className:"db-query-setting__toolbar",children:[(0,g.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>k([...C,{note:"",sql:"",env:S}])}),(0,g.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>N()})]}),children:(0,g.jsx)(o.X,{headers:A,rows:C.map((t,s)=>[(0,g.jsx)("div",{children:s+1}),(0,g.jsx)(u.Sm,{value:t.note,no_border:!0,placeholder:e("备注"),handleInputChange:e=>{t.note=e,k([...C])}}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"short_text",title:e("编辑SQL"),onClick:()=>E(s,"sql")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"settings",title:e("env编辑"),onClick:()=>E(s,"env")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>{C.splice(s,1),k([...C])}})})]),width:"8rem"})})})})})})})]})}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[676,4091,8319],{77481(e,t,s){s.d(t,{S:()=>l,X:()=>i});var n=s(96540),r=s(61443),a=s(74848);function i(e){const[t,s]=n.useState([]),i=(0,n.useRef)(-1),[l,o]=(0,n.useState)(-1),[c,u]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const d=()=>{i.current=-1,o(-1),u(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let i=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(i=`${t} (${n.label})`)}return(0,a.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,a.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(l===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(i.current=s,o(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",u(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=i.current,s=c;d(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:d,children:t.map((s,n)=>{const r=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:r,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function l(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},48890(e,t,s){s.d(t,{Kw:()=>n,Tt:()=>r});var n=s(80952),r=(s(82327),s(1766),s(24854),s(90008),s(90846),s(40975),s(44286),s(30766),s(14973),s(69687),s(1234),s(47507),s(87268),s(34678),s(24522));const a=`https://gcore.jsdelivr.net/npm/ace-builds@${n.version}/src-min-noconflict/`;n.config.set("basePath",a),n.config.set("modePath",a),n.config.set("themePath",a),n.config.set("workerPath",a)},84091(e,t,s){s.r(t),s.d(t,{default:()=>c});var n=s(96540),r=(s(80952),s(48890)),a=s(34843),i=s(82893),l=s(78247),o=s(74848);function c(e){const t=(0,n.useRef)(null),[s,c]=(0,a.fp)(i.AG.user_base_info),u=s.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,n.useEffect)(()=>{const s=r.Kw.edit(t.current,{value:l.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${u}`,mode:e.model??r.Tt.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return s.setOptions({}),s.container.addEventListener("wheel",function(e){e.preventDefault()}),s.focus(),s.on("change",function(t){e.on_change&&e.on_change()}),t.current=s,s.formatCode=()=>{const e=r.Kw.require("ace/ext/beautify"),s=t.current;s&&e.beautify(s.session)},l.xK.set_editor_temp(s,e.editor_id),()=>{l.xK.delete_editor_temp(e.editor_id),s.destroy()}},[]),(0,o.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}},60676(e,t,s){s.r(t),s.d(t,{default:()=>C});var n=s(96540),r=s(57952),a=s(85997),i=s(14284),l=s(61973),o=s(77481),c=s(70447),u=s(34843),d=s(82893),p=s(84091),h=s(78247),f=s(61443),x=s(23496),_=s(62042),m=s(22022),j=s(53459),v=s(7523),g=s(74848);function b(e,t="auto"){return"s"===t||"auto"===t&&e>=1e3?`${(e/1e3).toFixed(2)} s`:`${Math.round(e)} ms`}function S(e){const{running:t=!1,resetKey:s=0,format:r="auto",prefix:a="",onTick:i,className:l}=e,[o,c]=(0,n.useState)(0),u=(0,n.useRef)(0),d=(0,n.useRef)(null),p=(0,n.useRef)(t);p.current=t;const h=(0,n.useCallback)(()=>{null!==d.current&&(cancelAnimationFrame(d.current),d.current=null)},[]),f=(0,n.useCallback)(()=>{h();const e=()=>{const t=performance.now()-u.current;c(t),i?.(t),p.current&&(d.current=requestAnimationFrame(e))};e()},[i,h]);return(0,n.useEffect)(()=>{u.current=performance.now(),c(0),i?.(0),p.current&&f()},[s]),(0,n.useEffect)(()=>{t?f():h()},[t,f,h]),(0,n.useEffect)(()=>()=>h(),[h]),(0,g.jsxs)("span",{className:l,children:[a,b(o,r)]})}var q=s(87361),w=s(28319);function y(e){const[t,s]=(0,n.useState)("");return(0,g.jsxs)("div",{className:"db-query-preset-input",children:[(0,g.jsx)(f.Sm,{placeholder:e.placeholder,value:t,handleInputChange:s}),(0,g.jsx)("div",{className:"db-query-preset-input__actions",children:(0,g.jsx)(a.C3,{text:e.confirmText,clickFun:()=>e.onConfirm(t.trim())})})]})}function C(){const e=(0,l.Zp)(),{t}=(0,m.Bd)(),{initUserInfo:s}=(0,n.useContext)(v.F),[b]=(0,u.fp)(d.AG.sqlite_query_context),[C]=(0,u.fp)(d.AG.user_base_info),[,k]=(0,u.fp)(d.AG.prompt_card),N=(0,n.useMemo)(()=>b?.path??"",[b?.path]),E=(0,n.useMemo)(()=>b?.path?`${b?.name||"数据库"} | ${b.path}`:"未选择数据库",[b?.name,b?.path]),A=97,[K,F]=(0,n.useState)(""),[L,$]=(0,n.useState)("table"),[R,M]=(0,n.useState)(!1),[O,Q]=(0,n.useState)(""),[D,P]=(0,n.useState)(null),[T,G]=(0,n.useState)(!1),[I,J]=(0,n.useState)(0),[Z,W]=(0,n.useState)(!1),[B,H]=(0,n.useState)([]),[V,X]=(0,n.useState)(-1);(0,n.useEffect)(()=>{const e=C?.user_data?.sql_preset_list;e&&e.length?H([...e]):H([{index:0,note:t("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}])},[C?.user_data?.sql_preset_list]);const U=async e=>{const t=e.map((e,t)=>({...e,index:t})),n=await i.wm.post(x.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:t});return n?.code===j.m.Success&&(await s(),H(t),!0)},z=async(e,s)=>{const n=[...B,{note:s||t("SQL 预设"),sql:e,env:w.sqlEnvDefault}];await U(n)&&(k({open:!1}),(0,_.SK)(t("创建成功")),X(n.length-1))},Y=(e,t)=>{if(!e)return"";for(const s of e.split("\n")){const e=s.indexOf("=");if(!(e<0)&&s.slice(0,e).trim()===t)return s.slice(e+1).trim()}return""},[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)("");(0,n.useEffect)(()=>{h.xK.set_value_temp(K,A)},[K]),(0,n.useEffect)(()=>{F(""),Q(""),P(null),$("table"),G(!1),W(!1),J(0),te(""),ne(""),h.xK.set_value_temp("",A),N||Q("请先从文件右键打开一个数据库")},[N,b?.open]);const re=async()=>{const e=(h.xK.get_editor_value(A)??K).trim();if(!N)return Q("请先从文件右键打开一个数据库"),void P(null);if(!e)return Q("请输入 SQL 语句"),void P(null);M(!0),Q(""),W(!0),J(e=>e+1),G(!0);try{const s=(t=e,ee?t.split(ee).join(se):t),n=await i.$M.post("sqlite/query",{path:N,sql:s});P(n.data),$("table")}catch(e){Q(e?.message??`${e}`),P(null)}finally{G(!1),M(!1)}var t},ae=D?.columns?.length?D.columns:Object.keys(D?.rows?.[0]??{}),ie=(D?.rows??[]).map(e=>ae.map(t=>{return null==(s=e[t])?"":"object"==typeof s?JSON.stringify(s):`${s}`;var s}));return(0,g.jsxs)("div",{className:"db-query-page",children:[(0,g.jsx)(r.A,{ignore_tags:!0,left_children:[(0,g.jsx)(a.rA,{icon:"arrow_back",title:"返回",onClick:()=>e(-1)},"back"),(0,g.jsx)(a.rA,{icon:"play_arrow",title:"执行",onClick:re},"run"),(0,g.jsx)(a.rA,{icon:"table_chart",title:"表格视图",onClick:()=>$("table")},"table"),(0,g.jsx)(a.rA,{icon:"data_object",title:"原 JSON",onClick:()=>$("json")},"json"),(0,g.jsx)(a.rA,{icon:"settings",title:t("SQL预设设置"),onClick:()=>{e(q.o.sql_preset_setting_page)}},"preset-setting")],children:(0,g.jsx)(c.xP,{context:E,tip_context:"点击复制数据库信息"})}),(0,g.jsxs)("div",{className:"db-query-page__content",children:[(0,g.jsxs)(c.Zp,{title:"SQL 查询",titleCom:(0,g.jsxs)("div",{className:"db-query-page__preset-bar",children:[ee&&(0,g.jsx)(f.Sm,{placeholder:`${t("替换")}: ${ee}`,value:se,handleInputChange:ne,width:"12rem"}),B.length>0&&(0,g.jsx)(f.l6,{width:"16rem",tip:t("SQL预设"),value:V,onChange:e=>{const t=B[e];t&&(X(e),(e=>{h.xK.set_value_temp(e,A);const t=h.xK.get_editor(A);t&&t.setValue(e,-1),F(e)})(t.sql),te(Y(t.env??"","find")),ne(""),Q(""))},options:B.map((e,t)=>({value:t,title:`${e.note||e.sql.slice(0,24)}`}))}),(0,g.jsx)(a.C3,{text:t(V>=0?"更新保存":"创建新预选项"),clickFun:async()=>{const e=(h.xK.get_editor_value(A)??K).trim();if(!e)return void Q(t("sql_in"));const s=[...B];if(V>=0&&s[V]){s[V].sql=e,s[V].note||(s[V].note=t("SQL 预设"));await U(s)&&(0,_.SK)(t("更新成功"))}else k({open:!0,title:t("创建新预选项"),context_div:(0,g.jsx)(y,{placeholder:t("请输入备注"),confirmText:t("确认"),onConfirm:t=>z(e,t)}),cancel:()=>k({open:!1})})}})]}),rightBottomCom:(0,g.jsxs)("div",{className:"db-query-page__actions",children:[(0,g.jsx)(a.C3,{text:R?"查询中...":"执行查询",clickFun:re}),(0,g.jsx)(a.C3,{text:"清空",clickFun:()=>{h.xK.set_value_temp("",A);const e=h.xK.get_editor(A);e&&e.setValue("",-1),F("")}}),(0,g.jsx)(a.C3,{text:"table"===L?"表格视图":"切换到表格",clickFun:()=>$("table")}),(0,g.jsx)(a.C3,{text:"json"===L?"原 JSON":"切换到 JSON",clickFun:()=>$("json")})]}),children:[(0,g.jsx)("div",{className:"db-query-page__editor",children:(0,g.jsx)(p.default,{name:"sqlite.sql",editor_id:A,model:"ace/mode/sql",on_change:()=>{const e=h.xK.get_editor_value(A)??"";F(e)},options:{showPrintMargin:!1,highlightActiveLine:!0,wrap:!0}})}),O&&(0,g.jsx)("div",{className:"db-query-page__error",children:O})]}),(0,g.jsxs)(c.Zp,{title:"查询结果",titleCom:(0,g.jsxs)("span",{className:"db-query-page__result-meta",children:[D?`${D.row_count} 行`:"暂无结果",Z&&(0,g.jsx)("span",{className:"db-query-page__elapsed",children:(0,g.jsx)(S,{running:T,resetKey:I,prefix:`${t("耗时")}: `,format:"auto"})})]}),children:[D&&"table"===L&&(0,g.jsx)(o.X,{headers:ae,rows:ie}),D&&"json"===L&&(0,g.jsx)("pre",{className:"db-query-page__result-json",children:JSON.stringify(D.rows,null,2)}),!D&&!O&&(0,g.jsx)("div",{className:"db-query-page__hint",children:"先输入查询语句,再执行。支持 `select`、`with`、`pragma`、`explain`。"}),!D&&O&&(0,g.jsx)("div",{className:"db-query-page__hint",children:O})]})]})]})}},28319(e,t,s){s.r(t),s.d(t,{default:()=>q,defaultSqlPreset:()=>b});var n=s(96540),r=s(22022),a=s(4412),i=s(85997),l=s(75725),o=s(77481),c=s(70447),u=s(61443),d=s(34843),p=s(82893),h=s(14284),f=s(23496),x=s(53459),_=s(62042),m=s(7523),j=s(78247),v=s(61973),g=s(74848);function b(e){return{index:0,note:e("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}}const S='# 可选:设置 SQL 中的"替换词"(在查询页选中该预设后,会显示输入框)\n# 例子:SQL 为 SELECT * FROM t WHERE id = 123456 ,请填写下面的 find=123456\n# 这样查询页输入新值即可把 SQL 中的 123456 替换掉后再查询\nfind=';function q(){const{t:e}=(0,r.Bd)(),{initUserInfo:t}=(0,n.useContext)(m.F),[,s]=(0,d.fp)(p.AG.editorSetting),[q]=(0,d.fp)(p.AG.user_base_info),w=(0,v.Zp)(),y=n.useRef(-1),[C,k]=(0,n.useState)([]);(0,n.useEffect)(()=>{const t=q?.user_data?.sql_preset_list;k(t?.length?[...t]:[b(e)])},[e,q?.user_data?.sql_preset_list]);const N=async()=>{const s=C.map((e,t)=>({...e,index:t})),n=await h.wm.post(f.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:s});n?.code===x.m.Success&&(await t(),(0,_.SK)(e("保存成功")))},E=(e,t)=>{y.current=e;const n=C[e][t]??"";j.xK.set_value_temp(n),s({model:"sql"===t?"ace/mode/sql":"ace/mode/ini",open:!0,fileName:"",save:async e=>{C[y.current][t]=e,k([...C]),j.xK.set_value_temp(""),N()}})},A=[e("编号"),e("备注"),e("SQL代码"),e("env编辑"),e("操作")];return(0,g.jsxs)("div",{children:[(0,g.jsx)(a.aZ,{position:"right",children:(0,g.jsx)(i.rA,{icon:"arrow_back",title:e("返回"),onClick:()=>w(-1)})}),(0,g.jsx)(l.jW,{isFull:!0,more:!0,children:(0,g.jsx)(l.NN,{children:(0,g.jsx)(l.xh,{children:(0,g.jsx)(l.fI,{children:(0,g.jsx)(l.VP,{widthPer:60,children:(0,g.jsx)(c.uF,{self_title:(0,g.jsx)("span",{className:"div-row",children:(0,g.jsx)("h2",{children:e("SQL 预设")})}),titleCom:(0,g.jsxs)("div",{className:"db-query-setting__toolbar",children:[(0,g.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>k([...C,{note:"",sql:"",env:S}])}),(0,g.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>N()})]}),children:(0,g.jsx)(o.X,{headers:A,rows:C.map((t,s)=>[(0,g.jsx)("div",{children:s+1}),(0,g.jsx)(u.Sm,{value:t.note,no_border:!0,placeholder:e("备注"),handleInputChange:e=>{t.note=e,k([...C])}}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"short_text",title:e("编辑SQL"),onClick:()=>E(s,"sql")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"settings",title:e("env编辑"),onClick:()=>E(s,"env")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>{C.splice(s,1),k([...C])}})})]),width:"8rem"})})})})})})})]})}s.d(t,["sqlEnvDefault",0,S])}}]);