filecat 7.12.1 → 7.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/2300.3c83fc27783efb65df57.js +2 -0
- package/build/dist/2674.2713dbaf7b4dbb6baa4c.js +1 -0
- package/build/dist/2728.d0205a036e2caff34c1c.js +1 -0
- package/build/dist/3299.b85fad5623f990484bd9.js +1 -0
- package/build/dist/3528.55d2faabf2edbde62652.js +1 -0
- package/build/dist/4004.ca7e777145c700c5b186.js +1 -0
- package/build/dist/{4220.b65b40382726a69ba0bc.js → 4220.6e56dcffa8e57c91e363.js} +1 -1
- package/build/dist/4493.f527f1994d14470017f4.js +1 -0
- package/build/dist/5602.b92e2770ff00ee6da48a.js +2 -0
- package/build/dist/5602.b92e2770ff00ee6da48a.js.LICENSE.txt +28 -0
- package/build/dist/{5877.e2316c84a95490f77439.js → 5877.0d338155dc591229a758.js} +1 -1
- package/build/dist/6404.bcf224539211a7979990.js +1 -0
- package/build/dist/{7310.bf944d03f24fcf109680.js → 7310.258969acc0782007bdf5.js} +1 -1
- package/build/dist/735.38718e61fe313f131a3e.js +1 -0
- package/build/dist/{8090.8977224618a14ae42159.js → 8090.8b172ffd0f62ceebf881.js} +2 -2
- package/build/dist/8277.c76a3bbffade9d2d859b.js +1 -0
- package/build/dist/8302.c72a3767319d87419737.js +1 -0
- package/build/dist/8725.970abee75f92962aeab9.js +1 -0
- package/build/dist/9334.d3102e0ed30ae564f506.js +1 -0
- package/build/dist/{9546.2cecad04cf676a6616cd.js → 9546.ba8ea7791f14ee133338.js} +1 -1
- package/build/dist/index.html +1 -1
- package/build/dist/main.e03c0b1342da0ac83715.js +2 -0
- package/build/main.js +1 -1
- package/build/ripgrep/rg.exe +0 -0
- package/package.json +1 -1
- package/shell/config/webpack.web.config.js +5 -0
- package/build/dist/1417.d390b18dd58ff5c28160.js +0 -1
- package/build/dist/2300.c99b1dd4e752cdfd5e32.js +0 -2
- package/build/dist/2479.294792ef5d360ad64abc.js +0 -1
- package/build/dist/2674.46c009a7ec426b7d8828.js +0 -1
- package/build/dist/3299.5c01eebc0f62cdc7bb39.js +0 -1
- package/build/dist/3528.0f8f34028d92fa87c518.js +0 -1
- package/build/dist/4004.916c0413a6db61a54e11.js +0 -1
- package/build/dist/4193.58d3a34cac783ff289c6.js +0 -1
- package/build/dist/7943.acf25a5e98dd13290985.js +0 -1
- package/build/dist/8302.894efa465f6037f9f5a8.js +0 -1
- package/build/dist/9334.f04716a7e41f783abc47.js +0 -1
- package/build/dist/main.65dcea654963fc771a86.js +0 -2
- /package/build/dist/{2300.c99b1dd4e752cdfd5e32.js.LICENSE.txt → 2300.3c83fc27783efb65df57.js.LICENSE.txt} +0 -0
- /package/build/dist/{8090.8977224618a14ae42159.js.LICENSE.txt → 8090.8b172ffd0f62ceebf881.js.LICENSE.txt} +0 -0
- /package/build/dist/{main.65dcea654963fc771a86.js.LICENSE.txt → main.e03c0b1342da0ac83715.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
|
|
3
|
+
JSZip v3.10.2 - A JavaScript class for generating and reading zip files
|
|
4
|
+
<http://stuartk.com/jszip>
|
|
5
|
+
|
|
6
|
+
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
7
|
+
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
8
|
+
|
|
9
|
+
JSZip uses the library pako released under the MIT license :
|
|
10
|
+
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/*! *****************************************************************************
|
|
14
|
+
Copyright (c) Microsoft Corporation.
|
|
15
|
+
|
|
16
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
17
|
+
purpose with or without fee is hereby granted.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
20
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
22
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
23
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
24
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
25
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
26
|
+
***************************************************************************** */
|
|
27
|
+
|
|
28
|
+
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
|
|
@@ -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:()=>v});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 v(e){const[t,n]=(0,s.useState)([]),[v,j]=(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!==v?f[v]._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=>{j(v+1),n(e._children),f.push(e)};return(0,l.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==v&&(0,l.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{n(0===v?_:f[v-1]._children),j(v-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,type:"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],type:"color"===e.key?"color":void 0,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,v]=(0,s.useState)(""),[j,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(v(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=>{v(e)}})]})}),(0,p.jsx)(a.VP,{children:null!==j&&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),v=n(23430);function j(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(v.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,v]=(0,S.fp)(y.AG.confirm),[j,k]=(0,s.useState)(""),[b,I]=(0,s.useState)(""),N=async t=>{if(!b||!j)return void(0,d.zN)("密钥不能为空");let n="id_"+e;"pub"===t&&(n+=".pub"),v({open:!0,title:m("将覆盖密钥文件"),sub_title:`之前的密钥将作废。 将会作为 ${n} 文件保存到系统上的"${w}"目录下,此目录会作为openssh(git)所使用的默认目录。`,handle:async()=>{(await u.cD.post("save_openssh",{name:n,context:"pub"===t?j:b})).code===h.m.Success&&((0,d.SK)("完成"),v({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:()=>{j&&((0,C.lW)(j),(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:j})})}),(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,v]=(0,s.useState)("2000"),[j,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:j?(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=>v(e)}),j&&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("开放")})])}),j&&0===w.length&&(0,p.jsx)("p",{children:e("正在扫描...")}),!j&&N&&0===w.length&&(0,p.jsx)("p",{children:e("未发现开放端口")}),!j&&!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(v.oV.port_scan)&&s.push({index:1,name:t("端口扫描"),rto:"portscan/",component:(0,p.jsx)(N,{})}),n(v.oV.wol_proxy)&&s.push({index:1,name:t("网络唤醒"),rto:"netwol/",component:(0,p.jsx)(j,{})}),(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:()=>v});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 v(e){const[t,n]=(0,s.useState)([]),[v,j]=(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!==v?f[v]._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=>{j(v+1),n(e._children),f.push(e)};return(0,l.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==v&&(0,l.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{n(0===v?_:f[v-1]._children),j(v-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,type:"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],type:"color"===e.key?"color":void 0,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,v]=(0,s.useState)(""),[j,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(v(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=>{v(e)}})]})}),(0,p.jsx)(a.VP,{children:null!==j&&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),v=n(23430);function j(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(v.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,v]=(0,S.fp)(y.AG.confirm),[j,k]=(0,s.useState)(""),[b,I]=(0,s.useState)(""),N=async t=>{if(!b||!j)return void(0,d.zN)("密钥不能为空");let n="id_"+e;"pub"===t&&(n+=".pub"),v({open:!0,title:m("将覆盖密钥文件"),sub_title:`之前的密钥将作废。 将会作为 ${n} 文件保存到系统上的"${w}"目录下,此目录会作为openssh(git)所使用的默认目录。`,handle:async()=>{(await u.cD.post("save_openssh",{name:n,context:"pub"===t?j:b})).code===h.m.Success&&((0,d.SK)("完成"),v({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:()=>{j&&((0,C.lW)(j),(0,d.SK)("完成"))}}),rightBottomCom:"openssh_pem"===n&&(0,p.jsx)(c.C3,{text:m("ssh_dir"),clickFun:()=>{N("pub")}}),children:(0,p.jsx)(r.Z2,{style:{width:"100%",height:"270px"},onChange:e=>{k(e.target.value)},value:j})})}),(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)(r.Z2,{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,v]=(0,s.useState)("2000"),[j,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:j?(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=>v(e)}),j&&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("开放")})])}),j&&0===w.length&&(0,p.jsx)("p",{children:e("正在扫描...")}),!j&&N&&0===w.length&&(0,p.jsx)("p",{children:e("未发现开放端口")}),!j&&!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(v.oV.port_scan)&&s.push({index:1,name:t("端口扫描"),rto:"portscan/",component:(0,p.jsx)(N,{})}),n(v.oV.wol_proxy)&&s.push({index:1,name:t("网络唤醒"),rto:"netwol/",component:(0,p.jsx)(j,{})}),(0,p.jsx)(a.W1,{optionList:s,father_route:D.o.toolbox})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6404,8277],{35304(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>C});var a=n(96540),r=n(57889),l=(n(14284),n(62042)),o=n(22022),i=n(45602),c=(n(88781),n(86063));const d={classic:{backgroundColor:"#fafafa",lineColor:"#4d8f7f",lineWidth:2,root:{fillColor:"#4d8f7f",color:"#fff",borderRadius:6,paddingX:18,paddingY:8},second:{fillColor:"#fff",color:"#2f4f47",borderRadius:5,borderColor:"#4d8f7f",borderWidth:1,paddingX:14,paddingY:6},node:{fillColor:"#fff",color:"#3c3c3c",borderRadius:5,borderColor:"#a8d5c8",borderWidth:1,paddingX:12,paddingY:5}},dark:{backgroundColor:"#1f2226",lineColor:"#6b7c8c",lineWidth:1,root:{fillColor:"#3a4654",color:"#f2f4f6",borderRadius:6,paddingX:18,paddingY:8},second:{fillColor:"#2b323a",color:"#e6eaef",borderRadius:5,borderColor:"#4c5866",borderWidth:1,paddingX:14,paddingY:6},node:{fillColor:"#242a31",color:"#ccd3da",borderRadius:5,borderColor:"#3c454f",borderWidth:1,paddingX:12,paddingY:5}},simple:{backgroundColor:"#fff",lineColor:"#c8ccd0",lineWidth:1,root:{fillColor:"transparent",color:"#202124",borderRadius:0,borderWidth:0,paddingX:10,paddingY:4},second:{fillColor:"transparent",color:"#202124",borderRadius:0,borderWidth:0,paddingX:8,paddingY:3},node:{fillColor:"transparent",color:"#5f6368",borderRadius:0,borderWidth:0,paddingX:8,paddingY:3}},colorful:{backgroundColor:"#fffdf6",lineColor:"#f2a65a",lineWidth:2,root:{fillColor:"#f2854a",color:"#fff",borderRadius:24,paddingX:20,paddingY:9},second:{fillColor:"#ffd66b",color:"#6b4a12",borderRadius:16,borderWidth:0,paddingX:14,paddingY:6},node:{fillColor:"#a8d8ea",color:"#1e3f4d",borderRadius:12,borderWidth:0,paddingX:12,paddingY:5}}};var s=n(34843),u=n(82893),m=n(61443),p=n(74848);function f(e){const[t,n]=(0,a.useState)(e.initValue||""),r=t=>{n(t),e.onChange(t)};return e.multiline?(0,p.jsx)("div",{className:"prompt-input",children:(0,p.jsx)(m.Z2,{placeholder:e.placeholder||"",rows:e.rows??5,value:t,handleInputChange:r})}):(0,p.jsx)("div",{className:"prompt-input",children:(0,p.jsx)(m.Sm,{placeholder:e.placeholder||"",value:t,handleInputChange:r})})}var E,b=n(75725),_=n(85997);n(30576);E=i.default,Object.entries(d).forEach(([e,t])=>{E.defineTheme?.(e,t)});const h=[{cmd:"INSERT_CHILD_NODE",icon:"account_tree",label:"添加子节点"},{cmd:"INSERT_NODE",icon:"subdirectory_arrow_right",label:"添加同级节点"},{cmd:"INSERT_PARENT_NODE",icon:"arrow_upward",label:"插入父节点"},{cmd:"CUT_NODE",icon:"content_cut",label:"剪切"},{cmd:"PASTE_NODE",icon:"content_paste",label:"粘贴"},{cmd:"REMOVE_NODE",icon:"delete",label:"删除节点"},{cmd:"INSERT_GROUP",icon:"add_circle_outline",label:"插入",children:[{cmd:"SET_NODE_ICON",icon:"emoji_emotions",label:"插入图标"},{cmd:"REMOVE_NODE_ICON",icon:"format_clear",label:"删除图标"},{cmd:"SET_NODE_NOTE",icon:"sticky_note_2",label:"节点备注"},{cmd:"REMOVE_NODE_NOTE",icon:"speaker_notes_off",label:"删除备注"},{cmd:"SET_NODE_TAG",icon:"sell",label:"节点标签"},{cmd:"REMOVE_NODE_TAG",icon:"label_off",label:"删除标签"},{cmd:"SET_NODE_HYPERLINK",icon:"link",label:"插入超链接"},{cmd:"REMOVE_NODE_HYPERLINK",icon:"link_off",label:"删除超链接"}]},{cmd:"ADD_GENERALIZATION",icon:"call_merge",label:"添加概要"},{cmd:"REMOVE_GENERALIZATION",icon:"call_split",label:"删除概要"}],N=[{value:"logicalStructure",label:"逻辑结构图"},{value:"mindMap",label:"思维导图"},{value:"organizationStructure",label:"组织结构图"},{value:"catalogOrganization",label:"目录组织图"},{value:"timeline",label:"时间轴(左)"},{value:"timeline2",label:"时间轴(下)"},{value:"timeline3",label:"时间轴(上)"},{value:"verticalTimeline",label:"时间轴(竖)"},{value:"fishbone",label:"鱼骨图"},{value:"rightFishbone",label:"鱼骨图(右)"}],v=[{value:"curve",label:"曲线"},{value:"straight",label:"直线"},{value:"direct",label:"直连"}],g=[{value:"default",label:"默认主题"},{value:"classic",label:"经典"},{value:"dark",label:"暗色"},{value:"simple",label:"极简"},{value:"colorful",label:"缤纷"}],x=i.default.iconList||[];function C(e){const{t}=(0,o.Bd)(),[n,d]=(0,a.useState)(!0),[m,E]=(0,a.useState)(""),[C,y]=(0,a.useState)(100),[D,T]=(0,a.useState)("default"),[,w]=(0,s.fp)(u.AG.prompt_card),[j,R]=(0,a.useState)("mindMap"),[S,k]=(0,a.useState)(null),I=(0,a.useRef)(null),L=(0,a.useRef)(null),A=(0,a.useRef)(null),M=(0,a.useRef)(!1),Y=(0,a.useRef)({props:e});Y.current={props:e};const W=()=>{M.current||(M.current=!0,Y.current.props.on_dirty?.(!0))},P=async()=>{if(!A.current)return(0,l.zN)(t("编辑器尚未就绪")),!1;const e=await Y.current.props.on_save((()=>{const e=A.current;return e?JSON.stringify(e.getData(!0)):""})());return e&&(M.current=!1,Y.current.props.on_dirty?.(!1),Y.current.props.on_saved?.()),e};(0,a.useEffect)(()=>{e.register?.({save:P,is_dirty:()=>M.current})},[e.register]),(0,a.useEffect)(()=>{if(!I.current)return;if(!e.url&&void 0===e.data)return;let n=!1;const a=[];A.current?.destroy?.(),A.current=null,M.current=!1,d(!0),E("");const o=async e=>{if(n||!I.current)return;const r=e&&e.root?e:null,l=r?r.root:e??{data:{text:t("中心主题")}},o=new i.default({el:I.current,data:l,fit:!0,enableDblclickBackToRootNode:!0,enableShortcutOnlyWhenMouseInSvg:!0,autoMoveWhenMouseInEdgeOnDrag:!0,...c.k$});A.current=o,r&&o.setFullData(r),d(!1),T(o.getTheme?.()||"default"),R(o.getLayout?.()||"mindMap");window.requestAnimationFrame(()=>{n||(()=>{let e=!1;const t=window.setTimeout(()=>{n||(e=!0)},400);a.push(t),o.on("data_change",()=>{e&&(W(),y(O(o)))}),o.on("view_data_change",()=>{y(O(o))}),o.on("error",(e,t)=>{console.error("[mind]",e,t)}),y(O(o))})()})};return(async()=>{try{let t=null;if(void 0!==e.data)t=e.data;else{const a=await r.l.get(e.url);if(n)return;t=a}let a=null;if("string"==typeof t&&t.trim())try{a=JSON.parse(t)}catch{a=null}else t&&"object"==typeof t&&(a=t);a=(0,c.tW)(a),await o(a)}catch(e){n||(d(!1),E(t("加载思维导图失败")),(0,l.zN)(t("加载思维导图失败")))}})(),()=>{n=!0,a.forEach(e=>window.clearTimeout(e)),A.current?.destroy?.(),A.current=null}},[e.url,e.data]),(0,a.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key||83===e.keyCode)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),P())};return window.addEventListener("keydown",e,!0),document.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("keydown",e,!0)}},[]);const V=e=>{const t=A.current;if(!t)return;const n=Math.min(4,Math.max(.25,e));t.view.setScale(n),y(Math.round(100*n))},G={SET_NODE_NOTE:{title:"节点备注",placeholder:"请输入节点备注",get:e=>e.getData("note")||""},SET_NODE_TAG:{title:"节点标签",placeholder:"请输入节点标签,多个用逗号分隔",get:e=>(e.getData("tag")||[]).join(",")},SET_NODE_HYPERLINK:{title:"插入超链接",placeholder:"请输入链接地址",get:e=>e.getData("hyperlink")||""}};(0,a.useEffect)(()=>{if(!S)return;const e=()=>k(null),t=window.setTimeout(()=>{window.addEventListener("click",e),window.addEventListener("blur",e)},0);return()=>{window.clearTimeout(t),window.removeEventListener("click",e),window.removeEventListener("blur",e)}},[S]),(0,a.useEffect)(()=>{const e=L.current;if(!e)return;const t=e=>{const t=A.current?.renderer?.activeNodeList?.[0];t&&(e.preventDefault(),e.stopPropagation(),k({x:e.clientX,y:e.clientY,node:t}))};return e.addEventListener("contextmenu",t,!0),()=>e.removeEventListener("contextmenu",t,!0)},[]);const X=e=>e.map(e=>({v:e.cmd,r:(0,p.jsxs)("div",{className:"common-tag-center mind-menu-row",children:[(0,p.jsx)(_.In,{icon:e.icon,not_use_icon_style:!0}),(0,p.jsx)("span",{children:t(e.label)})]}),items:e.children?X(e.children):void 0})),H=e=>{const n=A.current,a=S;if(n&&a){if(k(null),"ADD_GENERALIZATION"===e||"REMOVE_GENERALIZATION"===e)return n.execCommand(e),void W();"SET_NODE_NOTE"!==e&&"SET_NODE_TAG"!==e&&"SET_NODE_HYPERLINK"!==e?"SET_NODE_ICON"!==e?e.startsWith("REMOVE_NODE_")?((e,t)=>{e&&("REMOVE_NODE_ICON"===t?A.current.execCommand("SET_NODE_ICON",e,[]):"REMOVE_NODE_NOTE"===t?A.current.execCommand("SET_NODE_NOTE",e,""):"REMOVE_NODE_TAG"===t?A.current.execCommand("SET_NODE_TAG",e,[]):"REMOVE_NODE_HYPERLINK"===t&&A.current.execCommand("SET_NODE_HYPERLINK",e,"",""),W())})(a.node,e):(n.execCommand(e,a.node),W()):(e=>{if(!e)return;const n=Array.isArray(e.getData("icon"))?e.getData("icon"):[];w({open:!0,title:t("插入图标"),context_div:(0,p.jsx)("div",{className:"prompt-icon-list",children:x.flatMap(t=>(t.list||[]).map((a,r)=>(0,p.jsx)("button",{type:"button",className:"prompt-icon-list__item",title:a.name,dangerouslySetInnerHTML:{__html:a.icon},onClick:()=>{A.current.execCommand("SET_NODE_ICON",e,[...n,`${t.type}_${a.name}`]),w({open:!1}),W()}},t.type+r)))}),cancel:()=>w({open:!1})})})(a.node):((e,n)=>{if(!e)return;const a=G[n],r=a.get(e);let l=r;w({open:!0,title:t(a.title),context_div:(0,p.jsx)(f,{initValue:r,placeholder:t(a.placeholder),multiline:!0,onChange:e=>l=e}),confirm:()=>{const t=l.trim();"SET_NODE_TAG"===n?A.current.execCommand(n,e,t.split(/[,,]/).map(e=>e.trim()).filter(Boolean)):"SET_NODE_HYPERLINK"===n?A.current.execCommand(n,e,t,t):A.current.execCommand(n,e,t),w({open:!1}),W()},cancel:()=>w({open:!1})})})(a.node,e)}};return(0,p.jsxs)("div",{className:"mind-wrap"+(e.fullscreen?" mind-wrap--full":""),children:[e.header,(0,p.jsxs)("div",{className:"mind-toolbar",children:[(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("添加子节点")+" (Tab)",onClick:()=>A.current?.execCommand?.("INSERT_CHILD_NODE"),children:(0,p.jsx)("span",{className:"material-icons",children:"account_tree"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("添加同级节点")+" (Enter)",onClick:()=>A.current?.execCommand?.("INSERT_NODE"),children:(0,p.jsx)("span",{className:"material-icons",children:"subdirectory_arrow_right"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("删除节点")+" (Delete)",onClick:()=>A.current?.execCommand?.("REMOVE_NODE"),children:(0,p.jsx)("span",{className:"material-icons",children:"delete"})}),(0,p.jsx)("span",{className:"mind-toolbar__sep"}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("撤销")+" (Ctrl+Z)",onClick:()=>A.current?.execCommand?.("BACK"),children:(0,p.jsx)("span",{className:"material-icons",children:"undo"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("重做")+" (Ctrl+Y)",onClick:()=>A.current?.execCommand?.("FORWARD"),children:(0,p.jsx)("span",{className:"material-icons",children:"redo"})}),(0,p.jsx)("span",{className:"mind-toolbar__sep"}),(0,p.jsxs)("span",{className:"mind-toolbar__zoom",children:[C,"%"]}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("缩小"),onClick:()=>V(O(A.current)/100-.2),children:(0,p.jsx)("span",{className:"material-icons",children:"remove"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("放大"),onClick:()=>V(O(A.current)/100+.2),children:(0,p.jsx)("span",{className:"material-icons",children:"add"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("适应窗口"),onClick:()=>{A.current?.view?.fit?.(),y(O(A.current))},children:(0,p.jsx)("span",{className:"material-icons",children:"fit_screen"})})]}),(0,p.jsxs)("div",{className:"mind-toolbar mind-toolbar--sub",children:[(0,p.jsx)("select",{className:"mind-select",title:t("结构"),value:j,onChange:e=>{const t=e.target.value;A.current?.setLayout?.(t),R(t),W()},children:N.map(e=>(0,p.jsx)("option",{value:e.value,children:t(e.label)},e.value))}),(0,p.jsxs)("select",{className:"mind-select",title:t("连线风格"),defaultValue:"",onChange:e=>{const t=e.target.value;if(t){const e=A.current?.getCustomThemeConfig?.()||{};A.current?.setThemeConfig?.({...e,lineStyle:t}),W()}e.target.value=""},children:[(0,p.jsx)("option",{value:"",children:t("连线风格")}),v.map(e=>(0,p.jsx)("option",{value:e.value,children:t(e.label)},e.value))]}),(0,p.jsx)("select",{className:"mind-select",title:t("主题"),value:D,onChange:e=>{const t=e.target.value;T(t),A.current?.setTheme?.(t),W()},children:g.map(e=>(0,p.jsx)("option",{value:e.value,children:t(e.label)},e.value))}),(0,p.jsx)("span",{className:"mind-toolbar__gap"})]}),(0,p.jsxs)("div",{className:"mind-canvas",ref:L,children:[(0,p.jsx)("div",{className:"mind-mount",ref:I}),n&&(0,p.jsx)("div",{className:"mind-mask",children:"Loading..."}),m&&(0,p.jsx)("div",{className:"mind-mask",children:m}),S&&(0,p.jsx)(b.rY,{click:()=>k(null),children:(0,p.jsx)(b.Pu,{x:S.x,y:S.y,items:X(h),click:e=>H(e)})})]})]})}function O(e){const t=e?.view?.getTransformData?.()?.state?.scale;return"number"==typeof t&&t>0?Math.round(100*t):100}},86063(e,t,n){"use strict";function a(e){return"smm-mind"===e}n.d(t,{Hn:()=>s,hj:()=>a,tW:()=>o});const r={mousewheelMoveStep:35,scaleRatio:.08};let l=null;function o(e){return e&&"object"==typeof e?e.data?.nodeData?i(e.data.nodeData):e.root&&"object"==typeof e.root?e.root.data?e:{...e,root:c(e.root)}:e.data&&"object"==typeof e.data?e:c(e):null}function i(e){return{data:{text:"string"==typeof e?.topic?e.topic:"string"==typeof e?.data?.text?e.data.text:""},children:Array.isArray(e?.children)?e.children.map(i):[]}}function c(e){return{data:{text:"string"==typeof e?.text?e.text:"",...e?.note?{note:e.note}:{}},children:Array.isArray(e?.children)?e.children.map(c):[]}}function d(e){e.stopPropagation()}async function s(e){const t=function(e){const t=e.trim();if(!t)return null;let n=null;try{n=JSON.parse(t)}catch{return null}return o(n)}(e),a=await(l||(l=Promise.all([Promise.all([n.e(8725),n.e(2728),n.e(2130),n.e(5602),n.e(8277)]).then(n.bind(n,45602)),n.e(8781).then(n.bind(n,88781))]).then(([e])=>e.default)),l);return{data:t,async mount(e,n){let l=!1;const o=await function(e,t){return new Promise(n=>{const a=()=>{t()?n(!1):e.isConnected&&e.clientWidth&&e.clientHeight?n(!0):window.setTimeout(a,16)};a()})}(e,()=>l);if(!o)return{destroy:()=>{},get_data:()=>null};const i=document.createElement("div");i.className="md-graph__mind-host",!1!==n?.release_wheel&&e.addEventListener("wheel",d,{capture:!0,passive:!0}),e.append(i);const c=new a({el:i,data:t?.root??t??{data:{text:""}},readonly:!n?.editable,fit:!0,...r});return t?.root&&c.setFullData(t),{destroy:()=>{l=!0,e.removeEventListener("wheel",d,{capture:!0}),c?.destroy?.()},get_data:()=>c?.getData?.(!1)}}}}n.d(t,["k$",0,r])},28277(){}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7310],{77310(e,t,r){r.r(t),r.d(t,{applyDagreLayoutResult:()=>C,getEdgesToRender:()=>b,measureDagreLayout:()=>v,prepareLayoutForDagre:()=>T,render:()=>I,runDagreLayoutCore:()=>K});var a=r(5691),n=r(24980),o=r(27838),i=r(96865),d=r(48159),s=(r(44505),r(69793),r(43287),r(12505),r(86535)),g=r(31293),l=r(86827),h=r(84193),p=r(697),c=(0,l.K)((e,t,r)=>Math.max(t,Math.min(r,e)),"clamp"),u=(0,l.K)((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),f=(0,l.K)(e=>"flowchart"===e||"flowchart-v2"===e||"stateDiagram"===e||"er"===e||"classDiagram"===e,"shouldMergeSelfLoopSegments"),y=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],m=(0,l.K)((e,t,r,a,n)=>{const o=[],i=new Set;if(r.forEach(({start:e,end:t})=>{e!==a&&i.add(e),t!==a&&i.add(t)}),i.forEach(t=>{const r=e.node(t);"number"==typeof r?.x&&"number"==typeof r?.y&&o.push(r)}),0===o.length&&r.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{"number"==typeof e?.x&&"number"==typeof e?.y&&o.push(e)})}),0===o.length)return u(n);const d=o.reduce((e,t)=>({x:e.x+t.x/o.length,y:e.y+t.y/o.length}),{x:0,y:0}),s=d.x-t.x,g=d.y-t.y;return Math.abs(s)>Math.abs(g)?s>0?"right":"left":Math.abs(g)>0?g>0?"bottom":"top":u(n)},"getSelfLoopSide"),L=(0,l.K)((e,t="top",r=0,a=0)=>{const n=e.x,o=e.y-r,i=e.width/2,d=e.height/2,s=Math.max(36,Math.min(100,.8*e.width)),g=c(Math.max(a,.35*e.width),36,s),l=c(.45*Math.min(e.width,e.height),24,48);switch(t){case"bottom":{const e=o+d;return[{x:n-g/2,y:e},{x:n-g/2,y:e+l},{x:n+g/2,y:e+l},{x:n+g/2,y:e}]}case"right":{const e=n+i;return[{x:e,y:o-g/2},{x:e+l,y:o-g/2},{x:e+l,y:o+g/2},{x:e,y:o+g/2}]}case"left":{const e=n-i;return[{x:e,y:o-g/2},{x:e-l,y:o-g/2},{x:e-l,y:o+g/2},{x:e,y:o+g/2}]}default:{const e=o-d;return[{x:n-g/2,y:e},{x:n-g/2,y:e-l},{x:n+g/2,y:e-l},{x:n+g/2,y:e}]}}},"getSelfLoopPoints"),w=(0,l.K)((e,t,r="top",a=0,n={})=>{const o=e.x,i=e.y-a,d=n.width??0,s=n.height??0;switch(r){case"bottom":return{x:o,y:Math.max(...t.map(e=>e.y))+s/2+4};case"right":return{x:Math.max(...t.map(e=>e.x))+d/2+4,y:i};case"left":return{x:Math.min(...t.map(e=>e.x))-d/2-4,y:i};default:return{x:o,y:Math.min(...t.map(e=>e.y))-s/2-4}}},"getSelfLoopLabelPosition"),b=(0,l.K)((e,t=0,{mergeSelfLoops:r=!0}={})=>{const a=new Map,n=[],o=e.graph()?.rankdir;return e.edges().forEach(t=>{const o=e.edge(t);if(r&&o.selfLoop){const e=o.selfLoop.id;a.has(e)||a.set(e,[]),a.get(e).push({edge:o,start:t.v,end:t.w})}else n.push({edge:o,start:t.v,end:t.w})}),a.forEach(r=>{if(3!==r.length)return void r.forEach(e=>n.push(e));r.sort((e,t)=>e.edge.selfLoop.order-t.edge.selfLoop.order);const[a,i,d]=r,s=a.edge.originalEdge??i.edge.originalEdge??d.edge.originalEdge??i.edge,g=e.node(s.start);if(!g)return void r.forEach(e=>n.push(e));const l={width:i.edge.width,height:i.edge.height},h=m(e,g,r,s.start,o),p=L(g,h,t,l.width??0),c=w(g,p,h,t,l),u={...i.edge,...s,id:s.id,points:p,start:s.start,end:s.end,x:c.x,y:c.y,width:l.width,height:l.height,labelStyle:i.edge.labelStyle,fromCluster:a.edge.fromCluster??i.edge.fromCluster??d.edge.fromCluster,toCluster:a.edge.toCluster??i.edge.toCluster??d.edge.toCluster};delete u.selfLoop,delete u.originalEdge,n.push({edge:u,start:u.start,end:u.end})}),n},"getEdgesToRender"),x=(0,l.K)(async({element:e,graph:t,diagramType:r,id:n,parentCluster:s,siteConfig:h})=>{const p=t.graph().rankdir;g.R.trace("Dir in recursive render - dir:",p);const{clusters:c,edgePaths:u,edgeLabels:y,nodes:m,rootGroups:L}=(0,a.B)(e,{edgePathsClass:"edgePaths"});t.nodes()?g.R.info("Recursive render XXX",t.nodes()):g.R.info("No nodes found for",t),t.edges().length>0&&g.R.info("Recursive edges",t.edge(t.edges()[0]));const w=f(r);await Promise.all(t.nodes().map(async function(e){const o=t.node(e);if(void 0!==s){const r=JSON.parse(JSON.stringify(s.clusterData));g.R.trace("Setting data for parent cluster XXX\n Node.id = ",e,"\n data=",r.height,"\nParent cluster",s.height),t.setNode(s.id,r),t.parent(e)||(g.R.trace("Setting parent",e,s.id),t.setParent(e,s.id,r))}if(g.R.info("(Insert) Node XXX"+e+": "+JSON.stringify(t.node(e))),o?.clusterNode){g.R.info("Cluster identified XBX",e,o.width,t.node(e));const{ranksep:a,nodesep:s}=t.graph();o.graph.setGraph({...o.graph.graph(),ranksep:a+25,nodesep:s});const l=await D({element:m,graph:o.graph,diagramType:r,id:n,parentCluster:t.node(e),siteConfig:h}),p=l.elem;(0,d.lC)(o,p),o.diff=l.diff||0,g.R.info("New compound node after recursive render XAX",e,"width",o.width,"height",o.height),(0,i.U7)(p,o)}else t.children(e).length>0?(g.R.trace("Cluster - the non recursive path XBX",e,o.id,o,o.width,"Graph:",t),g.R.trace((0,a.dc)(o.id,t)),a.ju.set(o.id,{id:(0,a.dc)(o.id,t),node:o})):(g.R.trace("Node - the non recursive path XAX",e,m,t.node(e),p),await(0,a.sv)(m,t.node(e),{config:h,dir:p}))}));const b=(0,l.K)(async()=>{const e=t.edges().map(async function(e){const r=t.edge(e.v,e.w,e.name);if(g.R.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),g.R.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),g.R.info("Fix",a.ju,"ids:",e.v,e.w,"Translating: ",a.ju.get(e.v),a.ju.get(e.w)),w&&r.selfLoop){if(1!==r.selfLoop.order)return;const e={...r.originalEdge,...r,id:r.selfLoop.id,startLabelLeft:r.originalEdge?.startLabelLeft??r.startLabelLeft,startLabelRight:r.originalEdge?.startLabelRight??r.startLabelRight,endLabelLeft:r.originalEdge?.endLabelLeft??r.endLabelLeft,endLabelRight:r.originalEdge?.endLabelRight??r.endLabelRight};return await(0,o.jP)(y,e),r.width=e.width,r.height=e.height,void(r.labelStyle=e.labelStyle)}await(0,o.jP)(y,r)});await Promise.all(e)},"processEdges");await b();const{subGraphTitleTotalMargin:x}=(0,i.Oi)(h);return{elem:L,graph:t,groups:{clusters:c,edgePaths:u,edgeLabels:y,nodes:m,rootGroups:L},diagramType:r,id:n,mergeSelfLoops:w,subGraphTitleTotalMargin:x}},"measureDagreGraph"),R=(0,l.K)(e=>{g.R.info("############################################# XXX"),g.R.info("### Layout ### XXX"),g.R.info("############################################# XXX"),(0,h.Zp)(e)},"runDagreGraphLayout"),E=(0,l.K)((e,t,r)=>{const a=e.node(t);if(!a)return;const n={...a};return a?.clusterNode?n.y=(a.y??0)+r:e.children(t).length>0?n.height=(a.height??0)+r:n.y=(a.y??0)+r/2,n},"normalizeDagreNode"),S=(0,l.K)((e,t)=>{y.forEach(r=>{void 0!==t[r]&&(e[r]=t[r])})},"applyDagreNodeLayout"),X=(0,l.K)((e,t,r,a)=>({...e,start:e.start??t,end:e.end??r,points:(e.points??[]).map(e=>({...e,y:"number"==typeof e.y?e.y+a:e.y}))}),"normalizeDagreEdge"),C=(0,l.K)((e,t)=>{const{graph:r,mergeSelfLoops:n,subGraphTitleTotalMargin:o=0}=t,i=new Map(e.nodes.map(e=>[e.id,e]));(0,a.sc)(r).forEach(e=>{const t=E(r,e,o);if(!t)return;S(r.node(e),t);const a=i.get(e);a&&S(a,t)});const d=o/2;return e.edges=b(r,d,{mergeSelfLoops:n}).map(({edge:e,start:t,end:r})=>X(e,t,r,d)),e},"applyDagreLayoutResult"),N=(0,l.K)(async({elem:e,graph:t,groups:{clusters:r,edgePaths:d},diagramType:s,id:l,mergeSelfLoops:h,subGraphTitleTotalMargin:p})=>{let c=0;await Promise.all((0,a.sc)(t).map(async function(e){const o=t.node(e);if(g.R.info("Position XBX => "+e+": ("+o.x,","+o.y,") width: ",o.width," height: ",o.height),o?.clusterNode)o.y+=p,g.R.info("A tainted cluster node XBX1",e,o.id,o.width,o.height,o.x,o.y,t.parent(e)),a.ju.get(o.id).node=o,(0,i.U_)(o);else if(t.children(e).length>0){g.R.info("A pure cluster node XBX1",e,o.id,o.x,o.y,o.width,o.height,t.parent(e)),o.height+=p,t.node(o.parentId);const i=o?.padding/2||0,d=o?.labelBBox?.height||0,s=d-i||0;g.R.debug("OffsetY",s,"labelHeight",d,"halfPadding",i),await(0,n.U)(r,o),a.ju.get(o.id).node=o}else{const e=t.node(o.parentId);o.y+=p/2,g.R.info("A regular node XBX1 - using the padding",o.id,"parent",o.parentId,o.width,o.height,o.x,o.y,"offsetY",o.offsetY,"parent",e,e?.offsetY,o),(0,i.U_)(o)}}));const u=p/2;return b(t,u,{mergeSelfLoops:h}).forEach(function({edge:e,start:r,end:n}){g.R.info("Edge "+r+" -> "+n+": "+JSON.stringify(e),e),e.points.forEach(e=>e.y+=u);const i=t.node(r),h=t.node(n),p=(0,o.Jo)(d,e,a.ju,s,i,h,l);(0,o.T_)(e,p)}),t.nodes().forEach(function(e){const r=t.node(e);g.R.info(e,r.type,r.diff),r.isGroup&&(c=r.diff)}),g.R.warn("Returning from recursive render XAX",e,c),{elem:e,diff:c}},"paintDagreLayoutCore"),D=(0,l.K)(async e=>{const t=await x(e);return R(t.graph),await N(t)},"renderDagreSubgraph"),T=(0,l.K)(e=>{const t=new p.T({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.nodeSpacing||e.config?.flowchart?.nodeSpacing,ranksep:e.config?.rankSpacing||e.rankSpacing||e.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return e.nodes.forEach(e=>{t.setNode(e.id,{...e}),e.parentId&&t.setParent(e.id,e.parentId)}),g.R.debug("Edges:",e.edges),e.edges.forEach(e=>{if(e.start===e.end){const r=e.start,a=r+"---"+r+"---1",n=r+"---"+r+"---2",o=t.node(r);t.setNode(a,{domId:a,id:a,parentId:o.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),t.setParent(a,o.parentId),t.setNode(n,{domId:n,id:n,parentId:o.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),t.setParent(n,o.parentId);const i=structuredClone(e),d=structuredClone(e),s=structuredClone(e),g=structuredClone(e);d.originalEdge=i,d.selfLoop={id:i.id,order:0},s.originalEdge=i,s.selfLoop={id:i.id,order:1},g.originalEdge=i,g.selfLoop={id:i.id,order:2},d.label="",d.arrowTypeEnd="none",d.endLabelLeft="",d.endLabelRight="",d.startLabelLeft="",d.id=r+"-cyclic-special-1",s.startLabelRight="",s.startLabelLeft="",s.endLabelLeft="",s.endLabelRight="",s.arrowTypeStart="none",s.arrowTypeEnd="none",s.id=r+"-cyclic-special-mid",g.label="",g.startLabelRight="",g.startLabelLeft="",g.arrowTypeStart="none",o.isGroup&&(d.fromCluster=r,g.toCluster=r),g.id=r+"-cyclic-special-2",g.arrowTypeStart="none",t.setEdge(r,a,d,r+"-cyclic-special-0"),t.setEdge(a,n,s,r+"-cyclic-special-1"),t.setEdge(n,r,g,r+"-cyclic-special-2")}else t.setEdge(e.start,e.end,{...e},e.id)}),(0,a.OS)(t),{graph:t}},"prepareLayoutForDagre"),v=(0,l.K)(async(e,{element:t,preparedLayout:r})=>{const a=r??T(e),n=(0,s.D7)(),o=await x({element:t,graph:a.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:n});return a.measuredLayout=o,o},"measureDagreLayout"),K=(0,l.K)((e,t)=>{const r=t.preparedLayout?.measuredLayout;if(!r)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return R(r.graph),C(e,r),r},"runDagreLayoutCore"),M=(0,l.K)((e,{measure:t})=>(0,a.sc)(t.graph).map(e=>t.graph.node(e)).filter(Boolean),"getDagrePaintNodes"),P=(0,l.K)((e,t,{measure:r})=>e?r.graph.node(e):void 0,"getDagreEdgeNode"),I=(0,a.xY)({prepareLayout:T,measureLayout:v,runLayoutCore:K,paintOptions:{clusterDb:a.ju,getNodes:M,getEdgeNode:P,skipNode:(0,l.K)((e,{measure:t})=>!t.graph.hasNode(e.id),"skipNode"),isCluster:(0,l.K)((e,{measure:t})=>t.graph.hasNode(e.id)&&(t.graph.children(e.id)??[]).length>0,"isCluster")}})}}]);
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7310],{77310(e,t,r){r.r(t),r.d(t,{applyDagreLayoutResult:()=>C,getEdgesToRender:()=>b,measureDagreLayout:()=>v,prepareLayoutForDagre:()=>T,render:()=>I,runDagreLayoutCore:()=>K});var a=r(5691),n=r(24980),o=r(27838),i=r(96865),d=r(48159),s=(r(44505),r(69793),r(43287),r(12505),r(86535)),g=r(31293),l=r(86827),h=r(44493),p=r(697),c=(0,l.K)((e,t,r)=>Math.max(t,Math.min(r,e)),"clamp"),u=(0,l.K)((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),f=(0,l.K)(e=>"flowchart"===e||"flowchart-v2"===e||"stateDiagram"===e||"er"===e||"classDiagram"===e,"shouldMergeSelfLoopSegments"),y=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],m=(0,l.K)((e,t,r,a,n)=>{const o=[],i=new Set;if(r.forEach(({start:e,end:t})=>{e!==a&&i.add(e),t!==a&&i.add(t)}),i.forEach(t=>{const r=e.node(t);"number"==typeof r?.x&&"number"==typeof r?.y&&o.push(r)}),0===o.length&&r.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{"number"==typeof e?.x&&"number"==typeof e?.y&&o.push(e)})}),0===o.length)return u(n);const d=o.reduce((e,t)=>({x:e.x+t.x/o.length,y:e.y+t.y/o.length}),{x:0,y:0}),s=d.x-t.x,g=d.y-t.y;return Math.abs(s)>Math.abs(g)?s>0?"right":"left":Math.abs(g)>0?g>0?"bottom":"top":u(n)},"getSelfLoopSide"),L=(0,l.K)((e,t="top",r=0,a=0)=>{const n=e.x,o=e.y-r,i=e.width/2,d=e.height/2,s=Math.max(36,Math.min(100,.8*e.width)),g=c(Math.max(a,.35*e.width),36,s),l=c(.45*Math.min(e.width,e.height),24,48);switch(t){case"bottom":{const e=o+d;return[{x:n-g/2,y:e},{x:n-g/2,y:e+l},{x:n+g/2,y:e+l},{x:n+g/2,y:e}]}case"right":{const e=n+i;return[{x:e,y:o-g/2},{x:e+l,y:o-g/2},{x:e+l,y:o+g/2},{x:e,y:o+g/2}]}case"left":{const e=n-i;return[{x:e,y:o-g/2},{x:e-l,y:o-g/2},{x:e-l,y:o+g/2},{x:e,y:o+g/2}]}default:{const e=o-d;return[{x:n-g/2,y:e},{x:n-g/2,y:e-l},{x:n+g/2,y:e-l},{x:n+g/2,y:e}]}}},"getSelfLoopPoints"),w=(0,l.K)((e,t,r="top",a=0,n={})=>{const o=e.x,i=e.y-a,d=n.width??0,s=n.height??0;switch(r){case"bottom":return{x:o,y:Math.max(...t.map(e=>e.y))+s/2+4};case"right":return{x:Math.max(...t.map(e=>e.x))+d/2+4,y:i};case"left":return{x:Math.min(...t.map(e=>e.x))-d/2-4,y:i};default:return{x:o,y:Math.min(...t.map(e=>e.y))-s/2-4}}},"getSelfLoopLabelPosition"),b=(0,l.K)((e,t=0,{mergeSelfLoops:r=!0}={})=>{const a=new Map,n=[],o=e.graph()?.rankdir;return e.edges().forEach(t=>{const o=e.edge(t);if(r&&o.selfLoop){const e=o.selfLoop.id;a.has(e)||a.set(e,[]),a.get(e).push({edge:o,start:t.v,end:t.w})}else n.push({edge:o,start:t.v,end:t.w})}),a.forEach(r=>{if(3!==r.length)return void r.forEach(e=>n.push(e));r.sort((e,t)=>e.edge.selfLoop.order-t.edge.selfLoop.order);const[a,i,d]=r,s=a.edge.originalEdge??i.edge.originalEdge??d.edge.originalEdge??i.edge,g=e.node(s.start);if(!g)return void r.forEach(e=>n.push(e));const l={width:i.edge.width,height:i.edge.height},h=m(e,g,r,s.start,o),p=L(g,h,t,l.width??0),c=w(g,p,h,t,l),u={...i.edge,...s,id:s.id,points:p,start:s.start,end:s.end,x:c.x,y:c.y,width:l.width,height:l.height,labelStyle:i.edge.labelStyle,fromCluster:a.edge.fromCluster??i.edge.fromCluster??d.edge.fromCluster,toCluster:a.edge.toCluster??i.edge.toCluster??d.edge.toCluster};delete u.selfLoop,delete u.originalEdge,n.push({edge:u,start:u.start,end:u.end})}),n},"getEdgesToRender"),x=(0,l.K)(async({element:e,graph:t,diagramType:r,id:n,parentCluster:s,siteConfig:h})=>{const p=t.graph().rankdir;g.R.trace("Dir in recursive render - dir:",p);const{clusters:c,edgePaths:u,edgeLabels:y,nodes:m,rootGroups:L}=(0,a.B)(e,{edgePathsClass:"edgePaths"});t.nodes()?g.R.info("Recursive render XXX",t.nodes()):g.R.info("No nodes found for",t),t.edges().length>0&&g.R.info("Recursive edges",t.edge(t.edges()[0]));const w=f(r);await Promise.all(t.nodes().map(async function(e){const o=t.node(e);if(void 0!==s){const r=JSON.parse(JSON.stringify(s.clusterData));g.R.trace("Setting data for parent cluster XXX\n Node.id = ",e,"\n data=",r.height,"\nParent cluster",s.height),t.setNode(s.id,r),t.parent(e)||(g.R.trace("Setting parent",e,s.id),t.setParent(e,s.id,r))}if(g.R.info("(Insert) Node XXX"+e+": "+JSON.stringify(t.node(e))),o?.clusterNode){g.R.info("Cluster identified XBX",e,o.width,t.node(e));const{ranksep:a,nodesep:s}=t.graph();o.graph.setGraph({...o.graph.graph(),ranksep:a+25,nodesep:s});const l=await D({element:m,graph:o.graph,diagramType:r,id:n,parentCluster:t.node(e),siteConfig:h}),p=l.elem;(0,d.lC)(o,p),o.diff=l.diff||0,g.R.info("New compound node after recursive render XAX",e,"width",o.width,"height",o.height),(0,i.U7)(p,o)}else t.children(e).length>0?(g.R.trace("Cluster - the non recursive path XBX",e,o.id,o,o.width,"Graph:",t),g.R.trace((0,a.dc)(o.id,t)),a.ju.set(o.id,{id:(0,a.dc)(o.id,t),node:o})):(g.R.trace("Node - the non recursive path XAX",e,m,t.node(e),p),await(0,a.sv)(m,t.node(e),{config:h,dir:p}))}));const b=(0,l.K)(async()=>{const e=t.edges().map(async function(e){const r=t.edge(e.v,e.w,e.name);if(g.R.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),g.R.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),g.R.info("Fix",a.ju,"ids:",e.v,e.w,"Translating: ",a.ju.get(e.v),a.ju.get(e.w)),w&&r.selfLoop){if(1!==r.selfLoop.order)return;const e={...r.originalEdge,...r,id:r.selfLoop.id,startLabelLeft:r.originalEdge?.startLabelLeft??r.startLabelLeft,startLabelRight:r.originalEdge?.startLabelRight??r.startLabelRight,endLabelLeft:r.originalEdge?.endLabelLeft??r.endLabelLeft,endLabelRight:r.originalEdge?.endLabelRight??r.endLabelRight};return await(0,o.jP)(y,e),r.width=e.width,r.height=e.height,void(r.labelStyle=e.labelStyle)}await(0,o.jP)(y,r)});await Promise.all(e)},"processEdges");await b();const{subGraphTitleTotalMargin:x}=(0,i.Oi)(h);return{elem:L,graph:t,groups:{clusters:c,edgePaths:u,edgeLabels:y,nodes:m,rootGroups:L},diagramType:r,id:n,mergeSelfLoops:w,subGraphTitleTotalMargin:x}},"measureDagreGraph"),R=(0,l.K)(e=>{g.R.info("############################################# XXX"),g.R.info("### Layout ### XXX"),g.R.info("############################################# XXX"),(0,h.Zp)(e)},"runDagreGraphLayout"),E=(0,l.K)((e,t,r)=>{const a=e.node(t);if(!a)return;const n={...a};return a?.clusterNode?n.y=(a.y??0)+r:e.children(t).length>0?n.height=(a.height??0)+r:n.y=(a.y??0)+r/2,n},"normalizeDagreNode"),S=(0,l.K)((e,t)=>{y.forEach(r=>{void 0!==t[r]&&(e[r]=t[r])})},"applyDagreNodeLayout"),X=(0,l.K)((e,t,r,a)=>({...e,start:e.start??t,end:e.end??r,points:(e.points??[]).map(e=>({...e,y:"number"==typeof e.y?e.y+a:e.y}))}),"normalizeDagreEdge"),C=(0,l.K)((e,t)=>{const{graph:r,mergeSelfLoops:n,subGraphTitleTotalMargin:o=0}=t,i=new Map(e.nodes.map(e=>[e.id,e]));(0,a.sc)(r).forEach(e=>{const t=E(r,e,o);if(!t)return;S(r.node(e),t);const a=i.get(e);a&&S(a,t)});const d=o/2;return e.edges=b(r,d,{mergeSelfLoops:n}).map(({edge:e,start:t,end:r})=>X(e,t,r,d)),e},"applyDagreLayoutResult"),N=(0,l.K)(async({elem:e,graph:t,groups:{clusters:r,edgePaths:d},diagramType:s,id:l,mergeSelfLoops:h,subGraphTitleTotalMargin:p})=>{let c=0;await Promise.all((0,a.sc)(t).map(async function(e){const o=t.node(e);if(g.R.info("Position XBX => "+e+": ("+o.x,","+o.y,") width: ",o.width," height: ",o.height),o?.clusterNode)o.y+=p,g.R.info("A tainted cluster node XBX1",e,o.id,o.width,o.height,o.x,o.y,t.parent(e)),a.ju.get(o.id).node=o,(0,i.U_)(o);else if(t.children(e).length>0){g.R.info("A pure cluster node XBX1",e,o.id,o.x,o.y,o.width,o.height,t.parent(e)),o.height+=p,t.node(o.parentId);const i=o?.padding/2||0,d=o?.labelBBox?.height||0,s=d-i||0;g.R.debug("OffsetY",s,"labelHeight",d,"halfPadding",i),await(0,n.U)(r,o),a.ju.get(o.id).node=o}else{const e=t.node(o.parentId);o.y+=p/2,g.R.info("A regular node XBX1 - using the padding",o.id,"parent",o.parentId,o.width,o.height,o.x,o.y,"offsetY",o.offsetY,"parent",e,e?.offsetY,o),(0,i.U_)(o)}}));const u=p/2;return b(t,u,{mergeSelfLoops:h}).forEach(function({edge:e,start:r,end:n}){g.R.info("Edge "+r+" -> "+n+": "+JSON.stringify(e),e),e.points.forEach(e=>e.y+=u);const i=t.node(r),h=t.node(n),p=(0,o.Jo)(d,e,a.ju,s,i,h,l);(0,o.T_)(e,p)}),t.nodes().forEach(function(e){const r=t.node(e);g.R.info(e,r.type,r.diff),r.isGroup&&(c=r.diff)}),g.R.warn("Returning from recursive render XAX",e,c),{elem:e,diff:c}},"paintDagreLayoutCore"),D=(0,l.K)(async e=>{const t=await x(e);return R(t.graph),await N(t)},"renderDagreSubgraph"),T=(0,l.K)(e=>{const t=new p.T({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.nodeSpacing||e.config?.flowchart?.nodeSpacing,ranksep:e.config?.rankSpacing||e.rankSpacing||e.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return e.nodes.forEach(e=>{t.setNode(e.id,{...e}),e.parentId&&t.setParent(e.id,e.parentId)}),g.R.debug("Edges:",e.edges),e.edges.forEach(e=>{if(e.start===e.end){const r=e.start,a=r+"---"+r+"---1",n=r+"---"+r+"---2",o=t.node(r);t.setNode(a,{domId:a,id:a,parentId:o.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),t.setParent(a,o.parentId),t.setNode(n,{domId:n,id:n,parentId:o.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),t.setParent(n,o.parentId);const i=structuredClone(e),d=structuredClone(e),s=structuredClone(e),g=structuredClone(e);d.originalEdge=i,d.selfLoop={id:i.id,order:0},s.originalEdge=i,s.selfLoop={id:i.id,order:1},g.originalEdge=i,g.selfLoop={id:i.id,order:2},d.label="",d.arrowTypeEnd="none",d.endLabelLeft="",d.endLabelRight="",d.startLabelLeft="",d.id=r+"-cyclic-special-1",s.startLabelRight="",s.startLabelLeft="",s.endLabelLeft="",s.endLabelRight="",s.arrowTypeStart="none",s.arrowTypeEnd="none",s.id=r+"-cyclic-special-mid",g.label="",g.startLabelRight="",g.startLabelLeft="",g.arrowTypeStart="none",o.isGroup&&(d.fromCluster=r,g.toCluster=r),g.id=r+"-cyclic-special-2",g.arrowTypeStart="none",t.setEdge(r,a,d,r+"-cyclic-special-0"),t.setEdge(a,n,s,r+"-cyclic-special-1"),t.setEdge(n,r,g,r+"-cyclic-special-2")}else t.setEdge(e.start,e.end,{...e},e.id)}),(0,a.OS)(t),{graph:t}},"prepareLayoutForDagre"),v=(0,l.K)(async(e,{element:t,preparedLayout:r})=>{const a=r??T(e),n=(0,s.D7)(),o=await x({element:t,graph:a.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:n});return a.measuredLayout=o,o},"measureDagreLayout"),K=(0,l.K)((e,t)=>{const r=t.preparedLayout?.measuredLayout;if(!r)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return R(r.graph),C(e,r),r},"runDagreLayoutCore"),M=(0,l.K)((e,{measure:t})=>(0,a.sc)(t.graph).map(e=>t.graph.node(e)).filter(Boolean),"getDagrePaintNodes"),P=(0,l.K)((e,t,{measure:r})=>e?r.graph.node(e):void 0,"getDagreEdgeNode"),I=(0,a.xY)({prepareLayout:T,measureLayout:v,runLayoutCore:K,paintOptions:{clusterDb:a.ju,getNodes:M,getEdgeNode:P,skipNode:(0,l.K)((e,{measure:t})=>!t.graph.hasNode(e.id),"skipNode"),isCluster:(0,l.K)((e,{measure:t})=>t.graph.hasNode(e.id)&&(t.graph.children(e.id)??[]).length>0,"isCluster")}})}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[735,6404,8277],{87943(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>p});var a=n(96540),r=n(34843),l=n(82893),o=n(14284),i=n(62042),c=n(53459),d=n(34289),s=n(22022),u=n(35304),m=n(74848);function p(){const[e,t]=(0,r.fp)(l.AG.mind_editor),[n,p]=(0,a.useState)(!1),{t:f}=(0,s.Bd)(),_=(0,a.useRef)(null),b=void 0!==e.code_source,E=()=>{n&&!window.confirm(f("有未保存的修改,确定要关闭吗?"))||(t({}),e?.close?.())};return(0,a.useEffect)(()=>{if(void 0===e.url&&void 0===e.code_source)return;const t=e=>{"Escape"===e.key&&(e.stopPropagation(),E())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e.url,e.code_source,n]),void 0!==e.url||b?(0,m.jsx)("div",{id:"mind-container",className:b?"mind-container--over":void 0,children:(0,m.jsx)("div",{className:"mind-context",children:(0,m.jsx)(u.default,{fullscreen:!0,reset_key:e.url??e.name,url:b?void 0:e.url,data:b?e.code_source:void 0,on_dirty:p,register:e=>{_.current=e},header:(0,m.jsxs)("div",{className:"mind-topbar",children:[(0,m.jsx)("span",{className:"material-icons mind-topbar__icon",children:"account_tree"}),(0,m.jsx)("span",{className:"mind-topbar__name",children:e.name}),(0,m.jsx)("span",{style:{flex:1}}),(0,m.jsx)("button",{type:"button",className:"mind-btn",title:f("保存")+" (Ctrl+S)",onClick:async()=>{await(_.current?.save())},children:(0,m.jsx)("span",{className:"material-icons",children:"save"})}),(0,m.jsx)("button",{type:"button",className:"mind-btn",title:f("关闭"),onClick:E,children:(0,m.jsx)("span",{className:"material-icons",children:"close"})})]}),on_save:async n=>{if(b)return e.on_save_code?.(n),(0,i.SK)(f("保存成功")),t({}),!0;return(await o.$M.post(`save/${encodeURIComponent((0,d.GG)("file",(0,d.vX)()))}${e.name}`,{context:n})).code===c.m.Success&&((0,i.SK)(f("保存成功")),!0)}})})}):null}},35304(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>C});var a=n(96540),r=n(57889),l=(n(14284),n(62042)),o=n(22022),i=n(45602),c=(n(88781),n(86063));const d={classic:{backgroundColor:"#fafafa",lineColor:"#4d8f7f",lineWidth:2,root:{fillColor:"#4d8f7f",color:"#fff",borderRadius:6,paddingX:18,paddingY:8},second:{fillColor:"#fff",color:"#2f4f47",borderRadius:5,borderColor:"#4d8f7f",borderWidth:1,paddingX:14,paddingY:6},node:{fillColor:"#fff",color:"#3c3c3c",borderRadius:5,borderColor:"#a8d5c8",borderWidth:1,paddingX:12,paddingY:5}},dark:{backgroundColor:"#1f2226",lineColor:"#6b7c8c",lineWidth:1,root:{fillColor:"#3a4654",color:"#f2f4f6",borderRadius:6,paddingX:18,paddingY:8},second:{fillColor:"#2b323a",color:"#e6eaef",borderRadius:5,borderColor:"#4c5866",borderWidth:1,paddingX:14,paddingY:6},node:{fillColor:"#242a31",color:"#ccd3da",borderRadius:5,borderColor:"#3c454f",borderWidth:1,paddingX:12,paddingY:5}},simple:{backgroundColor:"#fff",lineColor:"#c8ccd0",lineWidth:1,root:{fillColor:"transparent",color:"#202124",borderRadius:0,borderWidth:0,paddingX:10,paddingY:4},second:{fillColor:"transparent",color:"#202124",borderRadius:0,borderWidth:0,paddingX:8,paddingY:3},node:{fillColor:"transparent",color:"#5f6368",borderRadius:0,borderWidth:0,paddingX:8,paddingY:3}},colorful:{backgroundColor:"#fffdf6",lineColor:"#f2a65a",lineWidth:2,root:{fillColor:"#f2854a",color:"#fff",borderRadius:24,paddingX:20,paddingY:9},second:{fillColor:"#ffd66b",color:"#6b4a12",borderRadius:16,borderWidth:0,paddingX:14,paddingY:6},node:{fillColor:"#a8d8ea",color:"#1e3f4d",borderRadius:12,borderWidth:0,paddingX:12,paddingY:5}}};var s=n(34843),u=n(82893),m=n(61443),p=n(74848);function f(e){const[t,n]=(0,a.useState)(e.initValue||""),r=t=>{n(t),e.onChange(t)};return e.multiline?(0,p.jsx)("div",{className:"prompt-input",children:(0,p.jsx)(m.Z2,{placeholder:e.placeholder||"",rows:e.rows??5,value:t,handleInputChange:r})}):(0,p.jsx)("div",{className:"prompt-input",children:(0,p.jsx)(m.Sm,{placeholder:e.placeholder||"",value:t,handleInputChange:r})})}var _,b=n(75725),E=n(85997);n(30576);_=i.default,Object.entries(d).forEach(([e,t])=>{_.defineTheme?.(e,t)});const h=[{cmd:"INSERT_CHILD_NODE",icon:"account_tree",label:"添加子节点"},{cmd:"INSERT_NODE",icon:"subdirectory_arrow_right",label:"添加同级节点"},{cmd:"INSERT_PARENT_NODE",icon:"arrow_upward",label:"插入父节点"},{cmd:"CUT_NODE",icon:"content_cut",label:"剪切"},{cmd:"PASTE_NODE",icon:"content_paste",label:"粘贴"},{cmd:"REMOVE_NODE",icon:"delete",label:"删除节点"},{cmd:"INSERT_GROUP",icon:"add_circle_outline",label:"插入",children:[{cmd:"SET_NODE_ICON",icon:"emoji_emotions",label:"插入图标"},{cmd:"REMOVE_NODE_ICON",icon:"format_clear",label:"删除图标"},{cmd:"SET_NODE_NOTE",icon:"sticky_note_2",label:"节点备注"},{cmd:"REMOVE_NODE_NOTE",icon:"speaker_notes_off",label:"删除备注"},{cmd:"SET_NODE_TAG",icon:"sell",label:"节点标签"},{cmd:"REMOVE_NODE_TAG",icon:"label_off",label:"删除标签"},{cmd:"SET_NODE_HYPERLINK",icon:"link",label:"插入超链接"},{cmd:"REMOVE_NODE_HYPERLINK",icon:"link_off",label:"删除超链接"}]},{cmd:"ADD_GENERALIZATION",icon:"call_merge",label:"添加概要"},{cmd:"REMOVE_GENERALIZATION",icon:"call_split",label:"删除概要"}],N=[{value:"logicalStructure",label:"逻辑结构图"},{value:"mindMap",label:"思维导图"},{value:"organizationStructure",label:"组织结构图"},{value:"catalogOrganization",label:"目录组织图"},{value:"timeline",label:"时间轴(左)"},{value:"timeline2",label:"时间轴(下)"},{value:"timeline3",label:"时间轴(上)"},{value:"verticalTimeline",label:"时间轴(竖)"},{value:"fishbone",label:"鱼骨图"},{value:"rightFishbone",label:"鱼骨图(右)"}],v=[{value:"curve",label:"曲线"},{value:"straight",label:"直线"},{value:"direct",label:"直连"}],g=[{value:"default",label:"默认主题"},{value:"classic",label:"经典"},{value:"dark",label:"暗色"},{value:"simple",label:"极简"},{value:"colorful",label:"缤纷"}],x=i.default.iconList||[];function C(e){const{t}=(0,o.Bd)(),[n,d]=(0,a.useState)(!0),[m,_]=(0,a.useState)(""),[C,O]=(0,a.useState)(100),[j,w]=(0,a.useState)("default"),[,D]=(0,s.fp)(u.AG.prompt_card),[T,R]=(0,a.useState)("mindMap"),[S,k]=(0,a.useState)(null),I=(0,a.useRef)(null),L=(0,a.useRef)(null),A=(0,a.useRef)(null),M=(0,a.useRef)(!1),Y=(0,a.useRef)({props:e});Y.current={props:e};const W=()=>{M.current||(M.current=!0,Y.current.props.on_dirty?.(!0))},P=async()=>{if(!A.current)return(0,l.zN)(t("编辑器尚未就绪")),!1;const e=await Y.current.props.on_save((()=>{const e=A.current;return e?JSON.stringify(e.getData(!0)):""})());return e&&(M.current=!1,Y.current.props.on_dirty?.(!1),Y.current.props.on_saved?.()),e};(0,a.useEffect)(()=>{e.register?.({save:P,is_dirty:()=>M.current})},[e.register]),(0,a.useEffect)(()=>{if(!I.current)return;if(!e.url&&void 0===e.data)return;let n=!1;const a=[];A.current?.destroy?.(),A.current=null,M.current=!1,d(!0),_("");const o=async e=>{if(n||!I.current)return;const r=e&&e.root?e:null,l=r?r.root:e??{data:{text:t("中心主题")}},o=new i.default({el:I.current,data:l,fit:!0,enableDblclickBackToRootNode:!0,enableShortcutOnlyWhenMouseInSvg:!0,autoMoveWhenMouseInEdgeOnDrag:!0,...c.k$});A.current=o,r&&o.setFullData(r),d(!1),w(o.getTheme?.()||"default"),R(o.getLayout?.()||"mindMap");window.requestAnimationFrame(()=>{n||(()=>{let e=!1;const t=window.setTimeout(()=>{n||(e=!0)},400);a.push(t),o.on("data_change",()=>{e&&(W(),O(y(o)))}),o.on("view_data_change",()=>{O(y(o))}),o.on("error",(e,t)=>{console.error("[mind]",e,t)}),O(y(o))})()})};return(async()=>{try{let t=null;if(void 0!==e.data)t=e.data;else{const a=await r.l.get(e.url);if(n)return;t=a}let a=null;if("string"==typeof t&&t.trim())try{a=JSON.parse(t)}catch{a=null}else t&&"object"==typeof t&&(a=t);a=(0,c.tW)(a),await o(a)}catch(e){n||(d(!1),_(t("加载思维导图失败")),(0,l.zN)(t("加载思维导图失败")))}})(),()=>{n=!0,a.forEach(e=>window.clearTimeout(e)),A.current?.destroy?.(),A.current=null}},[e.url,e.data]),(0,a.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key||83===e.keyCode)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),P())};return window.addEventListener("keydown",e,!0),document.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("keydown",e,!0)}},[]);const G=e=>{const t=A.current;if(!t)return;const n=Math.min(4,Math.max(.25,e));t.view.setScale(n),O(Math.round(100*n))},V={SET_NODE_NOTE:{title:"节点备注",placeholder:"请输入节点备注",get:e=>e.getData("note")||""},SET_NODE_TAG:{title:"节点标签",placeholder:"请输入节点标签,多个用逗号分隔",get:e=>(e.getData("tag")||[]).join(",")},SET_NODE_HYPERLINK:{title:"插入超链接",placeholder:"请输入链接地址",get:e=>e.getData("hyperlink")||""}};(0,a.useEffect)(()=>{if(!S)return;const e=()=>k(null),t=window.setTimeout(()=>{window.addEventListener("click",e),window.addEventListener("blur",e)},0);return()=>{window.clearTimeout(t),window.removeEventListener("click",e),window.removeEventListener("blur",e)}},[S]),(0,a.useEffect)(()=>{const e=L.current;if(!e)return;const t=e=>{const t=A.current?.renderer?.activeNodeList?.[0];t&&(e.preventDefault(),e.stopPropagation(),k({x:e.clientX,y:e.clientY,node:t}))};return e.addEventListener("contextmenu",t,!0),()=>e.removeEventListener("contextmenu",t,!0)},[]);const X=e=>e.map(e=>({v:e.cmd,r:(0,p.jsxs)("div",{className:"common-tag-center mind-menu-row",children:[(0,p.jsx)(E.In,{icon:e.icon,not_use_icon_style:!0}),(0,p.jsx)("span",{children:t(e.label)})]}),items:e.children?X(e.children):void 0})),H=e=>{const n=A.current,a=S;if(n&&a){if(k(null),"ADD_GENERALIZATION"===e||"REMOVE_GENERALIZATION"===e)return n.execCommand(e),void W();"SET_NODE_NOTE"!==e&&"SET_NODE_TAG"!==e&&"SET_NODE_HYPERLINK"!==e?"SET_NODE_ICON"!==e?e.startsWith("REMOVE_NODE_")?((e,t)=>{e&&("REMOVE_NODE_ICON"===t?A.current.execCommand("SET_NODE_ICON",e,[]):"REMOVE_NODE_NOTE"===t?A.current.execCommand("SET_NODE_NOTE",e,""):"REMOVE_NODE_TAG"===t?A.current.execCommand("SET_NODE_TAG",e,[]):"REMOVE_NODE_HYPERLINK"===t&&A.current.execCommand("SET_NODE_HYPERLINK",e,"",""),W())})(a.node,e):(n.execCommand(e,a.node),W()):(e=>{if(!e)return;const n=Array.isArray(e.getData("icon"))?e.getData("icon"):[];D({open:!0,title:t("插入图标"),context_div:(0,p.jsx)("div",{className:"prompt-icon-list",children:x.flatMap(t=>(t.list||[]).map((a,r)=>(0,p.jsx)("button",{type:"button",className:"prompt-icon-list__item",title:a.name,dangerouslySetInnerHTML:{__html:a.icon},onClick:()=>{A.current.execCommand("SET_NODE_ICON",e,[...n,`${t.type}_${a.name}`]),D({open:!1}),W()}},t.type+r)))}),cancel:()=>D({open:!1})})})(a.node):((e,n)=>{if(!e)return;const a=V[n],r=a.get(e);let l=r;D({open:!0,title:t(a.title),context_div:(0,p.jsx)(f,{initValue:r,placeholder:t(a.placeholder),multiline:!0,onChange:e=>l=e}),confirm:()=>{const t=l.trim();"SET_NODE_TAG"===n?A.current.execCommand(n,e,t.split(/[,,]/).map(e=>e.trim()).filter(Boolean)):"SET_NODE_HYPERLINK"===n?A.current.execCommand(n,e,t,t):A.current.execCommand(n,e,t),D({open:!1}),W()},cancel:()=>D({open:!1})})})(a.node,e)}};return(0,p.jsxs)("div",{className:"mind-wrap"+(e.fullscreen?" mind-wrap--full":""),children:[e.header,(0,p.jsxs)("div",{className:"mind-toolbar",children:[(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("添加子节点")+" (Tab)",onClick:()=>A.current?.execCommand?.("INSERT_CHILD_NODE"),children:(0,p.jsx)("span",{className:"material-icons",children:"account_tree"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("添加同级节点")+" (Enter)",onClick:()=>A.current?.execCommand?.("INSERT_NODE"),children:(0,p.jsx)("span",{className:"material-icons",children:"subdirectory_arrow_right"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("删除节点")+" (Delete)",onClick:()=>A.current?.execCommand?.("REMOVE_NODE"),children:(0,p.jsx)("span",{className:"material-icons",children:"delete"})}),(0,p.jsx)("span",{className:"mind-toolbar__sep"}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("撤销")+" (Ctrl+Z)",onClick:()=>A.current?.execCommand?.("BACK"),children:(0,p.jsx)("span",{className:"material-icons",children:"undo"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("重做")+" (Ctrl+Y)",onClick:()=>A.current?.execCommand?.("FORWARD"),children:(0,p.jsx)("span",{className:"material-icons",children:"redo"})}),(0,p.jsx)("span",{className:"mind-toolbar__sep"}),(0,p.jsxs)("span",{className:"mind-toolbar__zoom",children:[C,"%"]}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("缩小"),onClick:()=>G(y(A.current)/100-.2),children:(0,p.jsx)("span",{className:"material-icons",children:"remove"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("放大"),onClick:()=>G(y(A.current)/100+.2),children:(0,p.jsx)("span",{className:"material-icons",children:"add"})}),(0,p.jsx)("button",{type:"button",className:"mind-btn",title:t("适应窗口"),onClick:()=>{A.current?.view?.fit?.(),O(y(A.current))},children:(0,p.jsx)("span",{className:"material-icons",children:"fit_screen"})})]}),(0,p.jsxs)("div",{className:"mind-toolbar mind-toolbar--sub",children:[(0,p.jsx)("select",{className:"mind-select",title:t("结构"),value:T,onChange:e=>{const t=e.target.value;A.current?.setLayout?.(t),R(t),W()},children:N.map(e=>(0,p.jsx)("option",{value:e.value,children:t(e.label)},e.value))}),(0,p.jsxs)("select",{className:"mind-select",title:t("连线风格"),defaultValue:"",onChange:e=>{const t=e.target.value;if(t){const e=A.current?.getCustomThemeConfig?.()||{};A.current?.setThemeConfig?.({...e,lineStyle:t}),W()}e.target.value=""},children:[(0,p.jsx)("option",{value:"",children:t("连线风格")}),v.map(e=>(0,p.jsx)("option",{value:e.value,children:t(e.label)},e.value))]}),(0,p.jsx)("select",{className:"mind-select",title:t("主题"),value:j,onChange:e=>{const t=e.target.value;w(t),A.current?.setTheme?.(t),W()},children:g.map(e=>(0,p.jsx)("option",{value:e.value,children:t(e.label)},e.value))}),(0,p.jsx)("span",{className:"mind-toolbar__gap"})]}),(0,p.jsxs)("div",{className:"mind-canvas",ref:L,children:[(0,p.jsx)("div",{className:"mind-mount",ref:I}),n&&(0,p.jsx)("div",{className:"mind-mask",children:"Loading..."}),m&&(0,p.jsx)("div",{className:"mind-mask",children:m}),S&&(0,p.jsx)(b.rY,{click:()=>k(null),children:(0,p.jsx)(b.Pu,{x:S.x,y:S.y,items:X(h),click:e=>H(e)})})]})]})}function y(e){const t=e?.view?.getTransformData?.()?.state?.scale;return"number"==typeof t&&t>0?Math.round(100*t):100}},86063(e,t,n){"use strict";function a(e){return"smm-mind"===e}n.d(t,{Hn:()=>s,hj:()=>a,tW:()=>o});const r={mousewheelMoveStep:35,scaleRatio:.08};let l=null;function o(e){return e&&"object"==typeof e?e.data?.nodeData?i(e.data.nodeData):e.root&&"object"==typeof e.root?e.root.data?e:{...e,root:c(e.root)}:e.data&&"object"==typeof e.data?e:c(e):null}function i(e){return{data:{text:"string"==typeof e?.topic?e.topic:"string"==typeof e?.data?.text?e.data.text:""},children:Array.isArray(e?.children)?e.children.map(i):[]}}function c(e){return{data:{text:"string"==typeof e?.text?e.text:"",...e?.note?{note:e.note}:{}},children:Array.isArray(e?.children)?e.children.map(c):[]}}function d(e){e.stopPropagation()}async function s(e){const t=function(e){const t=e.trim();if(!t)return null;let n=null;try{n=JSON.parse(t)}catch{return null}return o(n)}(e),a=await(l||(l=Promise.all([Promise.all([n.e(8725),n.e(2728),n.e(2130),n.e(5602),n.e(8277)]).then(n.bind(n,45602)),n.e(8781).then(n.bind(n,88781))]).then(([e])=>e.default)),l);return{data:t,async mount(e,n){let l=!1;const o=await function(e,t){return new Promise(n=>{const a=()=>{t()?n(!1):e.isConnected&&e.clientWidth&&e.clientHeight?n(!0):window.setTimeout(a,16)};a()})}(e,()=>l);if(!o)return{destroy:()=>{},get_data:()=>null};const i=document.createElement("div");i.className="md-graph__mind-host",!1!==n?.release_wheel&&e.addEventListener("wheel",d,{capture:!0,passive:!0}),e.append(i);const c=new a({el:i,data:t?.root??t??{data:{text:""}},readonly:!n?.editable,fit:!0,...r});return t?.root&&c.setFullData(t),{destroy:()=>{l=!0,e.removeEventListener("wheel",d,{capture:!0}),c?.destroy?.()},get_data:()=>c?.getData?.(!1)}}}}n.d(t,["k$",0,r])},28277(){}}]);
|