zen-gitsync 2.16.34 → 2.16.35
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/package.json +1 -1
- package/src/ui/public/assets/AgentView-BsN9y4Kg.css +1 -0
- package/src/ui/public/assets/AgentView-Bx7-GoVN.js +4 -0
- package/src/ui/public/assets/AppVersionBadge-CSPVpIfv.js +2 -0
- package/src/ui/public/assets/AppVersionBadge-Dj6H729N.css +1 -0
- package/src/ui/public/assets/BranchSelector-T_rJm-JY.css +1 -0
- package/src/ui/public/assets/BranchSelector-Y8ZDgSSC.js +1 -0
- package/src/ui/public/assets/CommitForm-Bfm3h-xP.js +6 -0
- package/src/ui/public/assets/CommitForm-CUvl0VcF.css +1 -0
- package/src/ui/public/assets/CommonDialog-Cyh3xu0p.css +1 -0
- package/src/ui/public/assets/CommonDialog-qme3em9i.js +1 -0
- package/src/ui/public/assets/EditorView-013TBMVC.js +1 -0
- package/src/ui/public/assets/EditorView-BgA-_8WV.css +1 -0
- package/src/ui/public/assets/FlowExecutionViewer-B5kh7VxS.css +1 -0
- package/src/ui/public/assets/FlowExecutionViewer-DKnli1z2.js +1 -0
- package/src/ui/public/assets/FlowOrchestrationWorkspace-BAQDU9Jd.css +1 -0
- package/src/ui/public/assets/FlowOrchestrationWorkspace-BZH01Rh6.js +21 -0
- package/src/ui/public/assets/LogList-5Br9Wb_B.js +7 -0
- package/src/ui/public/assets/LogList-r8sgFBhZ.css +1 -0
- package/src/ui/public/assets/MindmapView-77qraT9V.js +1 -0
- package/src/ui/public/assets/MindmapView-CS2t30Ko.css +1 -0
- package/src/ui/public/assets/MonitorView-BS65Jur8.js +1 -0
- package/src/ui/public/assets/MonitorView-DxFogQIt.css +1 -0
- package/src/ui/public/assets/ProjectStartupButton-B7zvqRj_.css +1 -0
- package/src/ui/public/assets/ProjectStartupButton-I69v-Nsd.js +1 -0
- package/src/ui/public/assets/RemoteRepoCard-BZuK45Ct.js +1 -0
- package/src/ui/public/assets/RemoteRepoCard-d0klonVb.css +1 -0
- package/src/ui/public/assets/SourceMapView-9F8fHJtK.js +3 -0
- package/src/ui/public/assets/SourceMapView-DG_a_076.css +1 -0
- package/src/ui/public/assets/{SvgIcon-CDNsk4-Q.css → SvgIcon-BQ6bR7l0.css} +1 -1
- package/src/ui/public/assets/SvgIcon-C6rY7Uo8.js +1 -0
- package/src/ui/public/assets/UserInputNode-2igLF_7v.js +1 -0
- package/src/ui/public/assets/UserInputNode-DDtvv9Iq.css +1 -0
- package/src/ui/public/assets/WorkbenchView-Bnz_19Gn.js +12 -0
- package/src/ui/public/assets/{WorkbenchView-Bp2YaSGS.css → WorkbenchView-CcYljxjT.css} +1 -1
- package/src/ui/public/assets/{_plugin-vue_export-helper-DkdPQgM8.js → _plugin-vue_export-helper-DidySQ8u.js} +1 -1
- package/src/ui/public/assets/{configStore-C2xoYf_U.js → configStore-CRJLI_GA.js} +1 -1
- package/src/ui/public/assets/element-plus-gSoHVQIp.js +27 -0
- package/src/ui/public/assets/{flow-mindmap-uF7lcnUF.js → flow-mindmap-DDBt2Quw.js} +13 -13
- package/src/ui/public/assets/{index-DkMUEB4_.css → index-BNYdpyC2.css} +1 -1
- package/src/ui/public/assets/index-DG6MOQX-.js +46 -0
- package/src/ui/public/assets/office-docx-CHpl_i5B.js +31 -0
- package/src/ui/public/assets/{office-excel-BhBLQBXN.js → office-excel-Dl4rqXiC.js} +1 -1
- package/src/ui/public/assets/office-pptx-DPjuekp6.js +60 -0
- package/src/ui/public/assets/socket-io-z4n873W1.js +1 -0
- package/src/ui/public/assets/{toolsStore-Dpb3rc-o.js → toolsStore-BlWdtCS3.js} +1 -1
- package/src/ui/public/assets/{vendor-BuJWEuf4.js → vendor-CRyxl6wl.js} +39 -46
- package/src/ui/public/assets/vue-flow-DTNU5FFo.js +39 -0
- package/src/ui/public/index.html +14 -14
- package/src/ui/public/assets/AgentView-8-xsOmE6.css +0 -1
- package/src/ui/public/assets/AgentView-D9y5maA3.js +0 -4
- package/src/ui/public/assets/AppVersionBadge-CS7Trvp-.css +0 -1
- package/src/ui/public/assets/AppVersionBadge-CsKq0HLG.js +0 -2
- package/src/ui/public/assets/BranchSelector-B0eLkAdv.css +0 -1
- package/src/ui/public/assets/BranchSelector-C09wdMBR.js +0 -1
- package/src/ui/public/assets/CommitForm-DdK8dymc.css +0 -1
- package/src/ui/public/assets/CommitForm-wTVAlj8K.js +0 -6
- package/src/ui/public/assets/CommonDialog-ChSKsEz2.css +0 -1
- package/src/ui/public/assets/CommonDialog-gF_3v5QY.js +0 -1
- package/src/ui/public/assets/EditorView-BYaXYY5H.js +0 -1
- package/src/ui/public/assets/EditorView-DZMLvQds.css +0 -1
- package/src/ui/public/assets/FlowExecutionViewer-DvSe3GqC.js +0 -1
- package/src/ui/public/assets/FlowExecutionViewer-jNHI5zdm.css +0 -1
- package/src/ui/public/assets/FlowOrchestrationWorkspace-CYGp-PqS.css +0 -1
- package/src/ui/public/assets/FlowOrchestrationWorkspace-FYLZxzMC.js +0 -21
- package/src/ui/public/assets/LogList-BB56Ma_-.js +0 -7
- package/src/ui/public/assets/LogList-BlJplIi1.css +0 -1
- package/src/ui/public/assets/MindmapView-B57NJ-tK.js +0 -2
- package/src/ui/public/assets/MindmapView-BQTqx842.css +0 -1
- package/src/ui/public/assets/MonitorView-DujOLv6G.js +0 -1
- package/src/ui/public/assets/MonitorView-TaS4kL0Y.css +0 -1
- package/src/ui/public/assets/ProjectStartupButton-B0vIxM8Y.js +0 -1
- package/src/ui/public/assets/ProjectStartupButton-QLPltCK5.css +0 -1
- package/src/ui/public/assets/RemoteRepoCard-BRGNlbeO.css +0 -1
- package/src/ui/public/assets/RemoteRepoCard-Tdhzf-Jb.js +0 -5
- package/src/ui/public/assets/SourceMapView-BNRjvgzH.css +0 -1
- package/src/ui/public/assets/SourceMapView-Bf7__bEW.js +0 -3
- package/src/ui/public/assets/SvgIcon-DV0F5fm7.js +0 -1
- package/src/ui/public/assets/UserInputNode-BVgQkB2l.css +0 -1
- package/src/ui/public/assets/UserInputNode-ZatmWGxI.js +0 -1
- package/src/ui/public/assets/WorkbenchView-DVjvpQMi.js +0 -28
- package/src/ui/public/assets/element-plus-BrZIKMTV.js +0 -47
- package/src/ui/public/assets/index-DDa4fUq_.js +0 -79
- package/src/ui/public/assets/office-docx-DZfJaVF6.js +0 -32
- package/src/ui/public/assets/office-pptx-C0yb5pVU.js +0 -74
- package/src/ui/public/assets/socket-io-Bcae2P7B.js +0 -1
- package/src/ui/public/assets/vue-flow-CrEicpfB.js +0 -39
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$n as e,Bn as t,Dn as n,En as r,Hn as i,Jn as a,Kn as o,Ln as s,Nn as c,Or as l,Sn as u,Tn as d,Ur as f,Vr as p,Wn as m,an as h,bn as g,dn as _,dr as v,fn as y,kn as b,mn as x,nr as S,or as C,pn as w,pr as T,qn as E,qr as D,rn as O,tr as k,un as A,vn as j,xn as M,yn as N,yr as P}from"./element-plus-BrZIKMTV.js";c(),C(),h(),l();var ee=Object.defineProperty,F=(e,t,n)=>t in e?ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t,n)=>F(e,typeof t==`symbol`?t:t+``,n),te=[`width`,`height`,`stroke-width`],ne={key:4,points:`6 9 12 15 18 9`},re={key:5,points:`9 6 15 12 9 18`},L=b({__name:`Icon`,props:{name:{},size:{},stroke:{}},setup(e){return(t,n)=>(m(),u(`svg`,{width:e.size??16,height:e.size??16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":e.stroke??1.8,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[e.name===`add`?(m(),u(x,{key:0},[n[0]||=N(`circle`,{cx:`12`,cy:`12`,r:`9`},null,-1),n[1]||=N(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`16`},null,-1),n[2]||=N(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`},null,-1)],64)):e.name===`minus`?(m(),u(x,{key:1},[n[3]||=N(`circle`,{cx:`12`,cy:`12`,r:`9`},null,-1),n[4]||=N(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`},null,-1)],64)):e.name===`delete`?(m(),u(x,{key:2},[n[5]||=d(`<polyline points="4 7 20 7"></polyline><path d="M9 7 V5 a1 1 0 0 1 1 -1 h4 a1 1 0 0 1 1 1 V7"></path><path d="M6 7 l1 12 a1 1 0 0 0 1 1 h8 a1 1 0 0 0 1 -1 l1 -12"></path><line x1="10" y1="11" x2="10" y2="18"></line><line x1="14" y1="11" x2="14" y2="18"></line>`,5)],64)):e.name===`edit`?(m(),u(x,{key:3},[n[6]||=N(`path`,{d:`M4 20 l4 -1 11 -11 -3 -3 -11 11 z`},null,-1),n[7]||=N(`line`,{x1:`14`,y1:`6`,x2:`18`,y2:`10`},null,-1)],64)):e.name===`collapse`?(m(),u(`polyline`,ne)):e.name===`expand`?(m(),u(`polyline`,re)):e.name===`collapse-all`?(m(),u(x,{key:6},[n[8]||=d(`<line x1="4" y1="4" x2="10" y2="10"></line><polyline points="6 10 10 10 10 6"></polyline><line x1="20" y1="4" x2="14" y2="10"></line><polyline points="14 6 14 10 18 10"></polyline><line x1="20" y1="20" x2="14" y2="14"></line><polyline points="14 18 14 14 18 14"></polyline><line x1="4" y1="20" x2="10" y2="14"></line><polyline points="6 14 10 14 10 18"></polyline>`,8)],64)):e.name===`expand-all`?(m(),u(x,{key:7},[n[9]||=d(`<line x1="10" y1="10" x2="4" y2="4"></line><polyline points="4 6 4 4 6 4"></polyline><line x1="14" y1="10" x2="20" y2="4"></line><polyline points="20 6 20 4 18 4"></polyline><line x1="14" y1="14" x2="20" y2="20"></line><polyline points="20 18 20 20 18 20"></polyline><line x1="10" y1="14" x2="4" y2="20"></line><polyline points="4 18 4 20 6 20"></polyline>`,8)],64)):e.name===`expand-level-1`?(m(),u(x,{key:8},[n[10]||=d(`<circle cx="12" cy="5" r="1.8" fill="currentColor" stroke="none"></circle><line x1="12" y1="7" x2="12" y2="11"></line><line x1="12" y1="11" x2="5" y2="17"></line><line x1="12" y1="11" x2="12" y2="17"></line><line x1="12" y1="11" x2="19" y2="17"></line><circle cx="5" cy="19" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="12" cy="19" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="19" cy="19" r="1.8" fill="currentColor" stroke="none"></circle>`,8)],64)):e.name===`expand-level-2`?(m(),u(x,{key:9},[n[11]||=d(`<circle cx="12" cy="3" r="1.4" fill="currentColor" stroke="none"></circle><line x1="12" y1="4.5" x2="12" y2="7"></line><line x1="12" y1="7" x2="5" y2="11"></line><line x1="12" y1="7" x2="12" y2="11"></line><line x1="12" y1="7" x2="19" y2="11"></line><line x1="5" y1="11" x2="3" y2="16"></line><line x1="5" y1="11" x2="7" y2="16"></line><line x1="12" y1="11" x2="10" y2="16"></line><line x1="12" y1="11" x2="14" y2="16"></line><line x1="19" y1="11" x2="17" y2="16"></line><line x1="19" y1="11" x2="21" y2="16"></line><circle cx="5" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="12" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="19" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="3" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="7" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="10" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="14" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="17" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="21" cy="18" r="1.4" fill="currentColor" stroke="none"></circle>`,20)],64)):e.name===`zoom-in`?(m(),u(x,{key:10},[n[12]||=N(`circle`,{cx:`11`,cy:`11`,r:`7`},null,-1),n[13]||=N(`line`,{x1:`11`,y1:`8`,x2:`11`,y2:`14`},null,-1),n[14]||=N(`line`,{x1:`8`,y1:`11`,x2:`14`,y2:`11`},null,-1),n[15]||=N(`line`,{x1:`16`,y1:`16`,x2:`21`,y2:`21`},null,-1)],64)):e.name===`zoom-out`?(m(),u(x,{key:11},[n[16]||=N(`circle`,{cx:`11`,cy:`11`,r:`7`},null,-1),n[17]||=N(`line`,{x1:`8`,y1:`11`,x2:`14`,y2:`11`},null,-1),n[18]||=N(`line`,{x1:`16`,y1:`16`,x2:`21`,y2:`21`},null,-1)],64)):e.name===`reset`?(m(),u(x,{key:12},[n[19]||=N(`polyline`,{points:`4 9 4 4 9 4`},null,-1),n[20]||=N(`polyline`,{points:`15 4 20 4 20 9`},null,-1),n[21]||=N(`polyline`,{points:`20 15 20 20 15 20`},null,-1),n[22]||=N(`polyline`,{points:`9 20 4 20 4 15`},null,-1)],64)):e.name===`database`?(m(),u(x,{key:13},[n[23]||=N(`ellipse`,{cx:`12`,cy:`6`,rx:`7`,ry:`2.5`},null,-1),n[24]||=N(`path`,{d:`M5 6 V18 C5 19.4 8 20.5 12 20.5 C16 20.5 19 19.4 19 18 V6`},null,-1),n[25]||=N(`path`,{d:`M5 12 C5 13.4 8 14.5 12 14.5 C16 14.5 19 13.4 19 12`},null,-1)],64)):e.name===`settings`?(m(),u(x,{key:14},[n[26]||=N(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`},null,-1),n[27]||=N(`circle`,{cx:`12`,cy:`12`,r:`3`},null,-1)],64)):e.name===`markdown`?(m(),u(x,{key:15},[n[28]||=N(`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`},null,-1),n[29]||=N(`path`,{d:`M6 15 V9 L9 12 L12 9 V15`},null,-1),n[30]||=N(`path`,{d:`M15 15 V9 L18 12 V9 M15 12 L18 15`},null,-1)],64)):e.name===`txt`?(m(),u(x,{key:16},[n[31]||=N(`rect`,{x:`5`,y:`3`,width:`14`,height:`18`,rx:`1.5`},null,-1),n[32]||=N(`line`,{x1:`8`,y1:`8`,x2:`16`,y2:`8`},null,-1),n[33]||=N(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`},null,-1),n[34]||=N(`line`,{x1:`8`,y1:`16`,x2:`13`,y2:`16`},null,-1)],64)):e.name===`eye`?(m(),u(x,{key:17},[n[35]||=N(`path`,{d:`M2 12 C4 6 8 3 12 3 C16 3 20 6 22 12 C20 18 16 21 12 21 C8 21 4 18 2 12 Z`},null,-1),n[36]||=N(`circle`,{cx:`12`,cy:`12`,r:`3.2`},null,-1)],64)):e.name===`eye-off`?(m(),u(x,{key:18},[n[37]||=N(`path`,{d:`M3 3 L21 21`},null,-1),n[38]||=N(`path`,{d:`M10.5 6.2 C11 6.1 11.5 6 12 6 C16 6 19.5 8.5 21 12 C20.4 13.2 19.6 14.3 18.7 15.2`},null,-1),n[39]||=N(`path`,{d:`M6.6 6.6 C4 8.2 2.7 10.2 2 12 C3 14.5 5.2 16.8 8 18.3 C9.2 19 10.6 19.4 12 19.4 C13.5 19.4 14.9 19 16.2 18.3`},null,-1),n[40]||=N(`path`,{d:`M9.5 9.5 C9.1 10.2 9 11.1 9 12 C9 13.7 9.8 15.2 11 16.1`},null,-1)],64)):e.name===`outline`?(m(),u(x,{key:19},[n[41]||=N(`rect`,{x:`4`,y:`3`,width:`16`,height:`18`,rx:`2`},null,-1),n[42]||=N(`line`,{x1:`8`,y1:`8`,x2:`16`,y2:`8`},null,-1),n[43]||=N(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`},null,-1),n[44]||=N(`line`,{x1:`8`,y1:`16`,x2:`13`,y2:`16`},null,-1)],64)):e.name===`logo`?(m(),u(x,{key:20},[n[45]||=d(`<circle cx="12" cy="12" r="2.2"></circle><circle cx="4" cy="5" r="1.6"></circle><circle cx="20" cy="5" r="1.6"></circle><circle cx="4" cy="19" r="1.6"></circle><circle cx="20" cy="19" r="1.6"></circle><line x1="10.5" y1="10.8" x2="5.2" y2="6.4"></line><line x1="13.5" y1="10.8" x2="18.8" y2="6.4"></line><line x1="10.5" y1="13.2" x2="5.2" y2="17.6"></line><line x1="13.5" y1="13.2" x2="18.8" y2="17.6"></line>`,9)],64)):e.name===`import`?(m(),u(x,{key:21},[n[46]||=N(`path`,{d:`M12 4 V15`},null,-1),n[47]||=N(`polyline`,{points:`7 10 12 15 17 10`},null,-1),n[48]||=N(`path`,{d:`M4 19 H20`},null,-1)],64)):e.name===`export`?(m(),u(x,{key:22},[n[49]||=N(`path`,{d:`M12 15 V4`},null,-1),n[50]||=N(`polyline`,{points:`7 9 12 4 17 9`},null,-1),n[51]||=N(`path`,{d:`M4 19 H20`},null,-1)],64)):e.name===`balance`?(m(),u(x,{key:23},[n[52]||=d(`<line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="18" x2="21" y2="18"></line><polyline points="9 4 5 6 9 8"></polyline><polyline points="15 4 19 6 15 8"></polyline><polyline points="9 10 5 12 9 14"></polyline><polyline points="15 10 19 12 15 14"></polyline><polyline points="9 16 5 18 9 20"></polyline><polyline points="15 16 19 18 15 20"></polyline>`,9)],64)):e.name===`mindmap`?(m(),u(x,{key:24},[n[53]||=d(`<circle cx="12" cy="12" r="2.4" fill="currentColor" stroke="none"></circle><line x1="13.4" y1="10.6" x2="18.5" y2="5.5"></line><line x1="13.4" y1="13.4" x2="18.5" y2="18.5"></line><line x1="10.6" y1="10.6" x2="5.5" y2="5.5"></line><line x1="10.6" y1="13.4" x2="5.5" y2="18.5"></line><circle cx="19.5" cy="4.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="19.5" cy="19.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="4.5" cy="4.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="4.5" cy="19.5" r="1.8" fill="currentColor" stroke="none"></circle>`,9)],64)):e.name===`tree`?(m(),u(x,{key:25},[n[54]||=d(`<circle cx="5" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="5" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="19" r="2" fill="currentColor" stroke="none"></circle><line x1="7" y1="12" x2="12" y2="12"></line><line x1="12" y1="12" x2="12" y2="5"></line><line x1="12" y1="12" x2="12" y2="19"></line><line x1="12" y1="5" x2="17" y2="5"></line><line x1="12" y1="19" x2="17" y2="19"></line>`,9)],64)):e.name===`org`?(m(),u(x,{key:26},[n[55]||=d(`<circle cx="12" cy="5" r="2" fill="currentColor" stroke="none"></circle><circle cx="6" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="12" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="19" r="2" fill="currentColor" stroke="none"></circle><line x1="12" y1="7" x2="12" y2="13"></line><line x1="6" y1="13" x2="18" y2="13"></line><line x1="6" y1="13" x2="6" y2="17"></line><line x1="12" y1="13" x2="12" y2="17"></line><line x1="18" y1="13" x2="18" y2="17"></line>`,9)],64)):e.name===`image`?(m(),u(x,{key:27},[n[56]||=N(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`},null,-1),n[57]||=N(`circle`,{cx:`9`,cy:`11`,r:`1.6`},null,-1),n[58]||=N(`polyline`,{points:`3 17 9 12 13 15 16 13 21 17`},null,-1)],64)):e.name===`x`?(m(),u(x,{key:28},[n[59]||=N(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`},null,-1),n[60]||=N(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`},null,-1)],64)):e.name===`link`?(m(),u(x,{key:29},[n[61]||=N(`path`,{d:`M10 13 a4 4 0 0 0 5.66 0 l3 -3 a4 4 0 1 0 -5.66 -5.66 l-1 1`},null,-1),n[62]||=N(`path`,{d:`M14 11 a4 4 0 0 0 -5.66 0 l-3 3 a4 4 0 1 0 5.66 5.66 l1 -1`},null,-1)],64)):e.name===`note`?(m(),u(x,{key:30},[n[63]||=N(`path`,{d:`M6 4 h9 l3 3 v13 a1 1 0 0 1 -1 1 h-11 a1 1 0 0 1 -1 -1 v-15 a1 1 0 0 1 1 -1 z`},null,-1),n[64]||=N(`line`,{x1:`8`,y1:`10`,x2:`16`,y2:`10`},null,-1),n[65]||=N(`line`,{x1:`8`,y1:`13`,x2:`16`,y2:`13`},null,-1),n[66]||=N(`line`,{x1:`8`,y1:`16`,x2:`13`,y2:`16`},null,-1)],64)):e.name===`search`?(m(),u(x,{key:31},[n[67]||=N(`circle`,{cx:`11`,cy:`11`,r:`7`},null,-1),n[68]||=N(`line`,{x1:`16`,y1:`16`,x2:`21`,y2:`21`},null,-1)],64)):e.name===`json`?(m(),u(x,{key:32},[n[69]||=N(`path`,{d:`M8 4 C6 4 6 6 6 7 C6 8 5 8 5 9 C5 10 6 10 6 11 C6 12 6 14 8 14`},null,-1),n[70]||=N(`path`,{d:`M16 4 C18 4 18 6 18 7 C18 8 19 8 19 9 C19 10 18 10 18 11 C18 12 18 14 16 14`},null,-1)],64)):e.name===`svg-export`?(m(),u(x,{key:33},[n[71]||=N(`path`,{d:`M6 3 h8 l4 4 v14 a1 1 0 0 1 -1 1 h-11 a1 1 0 0 1 -1 -1 v-15 a1 1 0 0 1 1 -1 z`},null,-1),n[72]||=N(`polyline`,{points:`14 3 14 7 18 7`},null,-1),n[73]||=N(`polyline`,{points:`8 14 6 16 8 18`},null,-1),n[74]||=N(`polyline`,{points:`14 14 16 16 14 18`},null,-1)],64)):e.name===`relation`?(m(),u(x,{key:34},[n[75]||=N(`circle`,{cx:`5`,cy:`19`,r:`2.5`},null,-1),n[76]||=N(`circle`,{cx:`19`,cy:`5`,r:`2.5`},null,-1),n[77]||=N(`path`,{d:`M7 17 C 10 12, 14 12, 17 7`,"stroke-dasharray":`3 2.2`},null,-1)],64)):M(``,!0)],8,te))}}),ie=`data:image/svg+xml,%3csvg%20t='1780822312364'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='7459'%20width='200'%20height='200'%3e%3cpath%20d='M329.16%20292.571h658.286V512H329.16zM329.16%200h658.286v219.429H329.16z'%20fill='%239AA1A2'%20p-id='7460'%3e%3c/path%3e%3cpath%20d='M44.927%20146.286a46.519%2046.519%200%200%201%2038.107-73.143h319.269v73.143H109.73V791.99l-48.713%205.705-24.43-651.41h8.339z'%20fill='%239AA1A2'%20p-id='7461'%3e%3c/path%3e%3cpath%20d='M363.83%20877.714H179.51c-78.775%200-142.921-66.12-142.921-147.31V112.787c0-21.943%2017.188-39.643%2038.473-39.643%2021.211%200%2033.5%2017.774%2033.5%2039.643v617.619c0%2037.522%2028.013%2076.58%2064.438%2076.58h190.903c21.211%200%2038.766%2013.97%2038.766%2035.84%200%2021.943-17.555%2034.89-38.766%2034.89z'%20fill='%239AA1A2'%20p-id='7462'%3e%3c/path%3e%3cpath%20d='M432.95%20438.857H179.51c-78.775%200-81.043-18.578-81.043-62.903l10.094-90.624c0%2020.48%2013.458%2080.677%2049.884%2080.677h210.139c21.211%200%20120.613%204.023%20120.613%2016.018%200%2011.922-35.036%2056.832-56.32%2056.832zM640.017%20749.714V640a54.857%2054.857%200%200%201%20109.714%200v109.714h109.715a54.857%2054.857%200%200%201%200%20109.715H749.73v109.714a54.857%2054.857%200%200%201-109.714%200V859.429H530.303a54.857%2054.857%200%200%201%200-109.715h109.714z'%20fill='%239AA1A2'%20p-id='7463'%3e%3c/path%3e%3c/svg%3e`,R=`data:image/svg+xml,%3csvg%20t='1780822464335'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='8457'%20width='200'%20height='200'%3e%3cpath%20d='M512%20804.571h512V1024H512V804.571zM0%200h658.286v219.429H0V0z'%20fill='%239AA1A2'%20p-id='8458'%3e%3c/path%3e%3cpath%20d='M619.813%20950.857h-184.32c-78.775%200-142.922-66.121-142.922-147.31V185.93c0-21.943%2017.189-39.643%2038.474-39.643%2021.211%200%2033.353%2017.773%2033.353%2039.643v617.618c0%2037.523%2034.743%2073.728%2071.095%2073.728h184.32c21.211%200%2038.473%2012.069%2038.473%2033.939%200%2021.943-17.189%2039.643-38.473%2039.643z'%20fill='%239AA1A2'%20p-id='8459'%3e%3c/path%3e%3cpath%20d='M676.571%20457.143V347.429a54.857%2054.857%200%200%201%20109.715%200v109.714H896a54.857%2054.857%200%200%201%200%20109.714H786.286v109.714a54.857%2054.857%200%200%201-109.715%200V566.857H566.857a54.857%2054.857%200%200%201%200-109.714h109.714z'%20fill='%239AA1A2'%20p-id='8460'%3e%3c/path%3e%3c/svg%3e`,z=[22,15,13,12],B=[700,600,500,400],ae=[46,36,30,26],V=[120,80,60,44],oe=[.8,.8,.8,.8],se=1,ce=z.length-1;function le(e,t){return Math.round(de(e,t)*oe[ue(e)])}function ue(e){return Math.min(ce,Math.max(0,e))}function de(e,t=14){return Math.round(z[ue(e)]*t/14*10)/10}function fe(e,t=14){return Math.round(ae[ue(e)]*t/14)}var pe=60,me=30,he=.75,ge=14,H=24;function _e(e){return Math.max(me,Math.round(pe*he**+e))}var ve=null;function ye(){if(ve)return ve;let e=typeof document<`u`?document.createElement(`canvas`).getContext(`2d`):null;return e?(ve=e,e):{font:``,measureText:()=>({width:0})}}var be=new Map;function xe(e,t,n){let r=`${n}|${t}|${e}`,i=be.get(r);if(i!==void 0)return i;let a=ye();a.font=`${n} ${t}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;let o=e.split(`
|
|
1
|
+
import{$n as e,Bn as t,Br as n,Dn as r,Dr as i,En as a,Gr as o,Hn as s,Hr as c,Jn as l,Kn as u,Ln as d,Nn as f,Sn as p,Tn as m,Wn as h,an as g,bn as _,dn as v,dr as y,fn as b,kn as x,mn as S,nr as C,or as w,pn as T,pr as E,qn as D,rn as O,tr as k,un as A,vn as j,xn as M,yn as N,yr as P}from"./element-plus-gSoHVQIp.js";f(),w(),g(),i();var ee=Object.defineProperty,F=(e,t,n)=>t in e?ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t,n)=>F(e,typeof t==`symbol`?t:t+``,n),te=[`width`,`height`,`stroke-width`],ne={key:4,points:`6 9 12 15 18 9`},re={key:5,points:`9 6 15 12 9 18`},L=x({__name:`Icon`,props:{name:{},size:{},stroke:{}},setup(e){return(t,n)=>(h(),p(`svg`,{width:e.size??16,height:e.size??16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":e.stroke??1.8,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[e.name===`add`?(h(),p(S,{key:0},[n[0]||=N(`circle`,{cx:`12`,cy:`12`,r:`9`},null,-1),n[1]||=N(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`16`},null,-1),n[2]||=N(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`},null,-1)],64)):e.name===`minus`?(h(),p(S,{key:1},[n[3]||=N(`circle`,{cx:`12`,cy:`12`,r:`9`},null,-1),n[4]||=N(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`},null,-1)],64)):e.name===`delete`?(h(),p(S,{key:2},[n[5]||=m(`<polyline points="4 7 20 7"></polyline><path d="M9 7 V5 a1 1 0 0 1 1 -1 h4 a1 1 0 0 1 1 1 V7"></path><path d="M6 7 l1 12 a1 1 0 0 0 1 1 h8 a1 1 0 0 0 1 -1 l1 -12"></path><line x1="10" y1="11" x2="10" y2="18"></line><line x1="14" y1="11" x2="14" y2="18"></line>`,5)],64)):e.name===`edit`?(h(),p(S,{key:3},[n[6]||=N(`path`,{d:`M4 20 l4 -1 11 -11 -3 -3 -11 11 z`},null,-1),n[7]||=N(`line`,{x1:`14`,y1:`6`,x2:`18`,y2:`10`},null,-1)],64)):e.name===`collapse`?(h(),p(`polyline`,ne)):e.name===`expand`?(h(),p(`polyline`,re)):e.name===`collapse-all`?(h(),p(S,{key:6},[n[8]||=m(`<line x1="4" y1="4" x2="10" y2="10"></line><polyline points="6 10 10 10 10 6"></polyline><line x1="20" y1="4" x2="14" y2="10"></line><polyline points="14 6 14 10 18 10"></polyline><line x1="20" y1="20" x2="14" y2="14"></line><polyline points="14 18 14 14 18 14"></polyline><line x1="4" y1="20" x2="10" y2="14"></line><polyline points="6 14 10 14 10 18"></polyline>`,8)],64)):e.name===`expand-all`?(h(),p(S,{key:7},[n[9]||=m(`<line x1="10" y1="10" x2="4" y2="4"></line><polyline points="4 6 4 4 6 4"></polyline><line x1="14" y1="10" x2="20" y2="4"></line><polyline points="20 6 20 4 18 4"></polyline><line x1="14" y1="14" x2="20" y2="20"></line><polyline points="20 18 20 20 18 20"></polyline><line x1="10" y1="14" x2="4" y2="20"></line><polyline points="4 18 4 20 6 20"></polyline>`,8)],64)):e.name===`expand-level-1`?(h(),p(S,{key:8},[n[10]||=m(`<circle cx="12" cy="5" r="1.8" fill="currentColor" stroke="none"></circle><line x1="12" y1="7" x2="12" y2="11"></line><line x1="12" y1="11" x2="5" y2="17"></line><line x1="12" y1="11" x2="12" y2="17"></line><line x1="12" y1="11" x2="19" y2="17"></line><circle cx="5" cy="19" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="12" cy="19" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="19" cy="19" r="1.8" fill="currentColor" stroke="none"></circle>`,8)],64)):e.name===`expand-level-2`?(h(),p(S,{key:9},[n[11]||=m(`<circle cx="12" cy="3" r="1.4" fill="currentColor" stroke="none"></circle><line x1="12" y1="4.5" x2="12" y2="7"></line><line x1="12" y1="7" x2="5" y2="11"></line><line x1="12" y1="7" x2="12" y2="11"></line><line x1="12" y1="7" x2="19" y2="11"></line><line x1="5" y1="11" x2="3" y2="16"></line><line x1="5" y1="11" x2="7" y2="16"></line><line x1="12" y1="11" x2="10" y2="16"></line><line x1="12" y1="11" x2="14" y2="16"></line><line x1="19" y1="11" x2="17" y2="16"></line><line x1="19" y1="11" x2="21" y2="16"></line><circle cx="5" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="12" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="19" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="3" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="7" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="10" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="14" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="17" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="21" cy="18" r="1.4" fill="currentColor" stroke="none"></circle>`,20)],64)):e.name===`zoom-in`?(h(),p(S,{key:10},[n[12]||=N(`circle`,{cx:`11`,cy:`11`,r:`7`},null,-1),n[13]||=N(`line`,{x1:`11`,y1:`8`,x2:`11`,y2:`14`},null,-1),n[14]||=N(`line`,{x1:`8`,y1:`11`,x2:`14`,y2:`11`},null,-1),n[15]||=N(`line`,{x1:`16`,y1:`16`,x2:`21`,y2:`21`},null,-1)],64)):e.name===`zoom-out`?(h(),p(S,{key:11},[n[16]||=N(`circle`,{cx:`11`,cy:`11`,r:`7`},null,-1),n[17]||=N(`line`,{x1:`8`,y1:`11`,x2:`14`,y2:`11`},null,-1),n[18]||=N(`line`,{x1:`16`,y1:`16`,x2:`21`,y2:`21`},null,-1)],64)):e.name===`reset`?(h(),p(S,{key:12},[n[19]||=N(`polyline`,{points:`4 9 4 4 9 4`},null,-1),n[20]||=N(`polyline`,{points:`15 4 20 4 20 9`},null,-1),n[21]||=N(`polyline`,{points:`20 15 20 20 15 20`},null,-1),n[22]||=N(`polyline`,{points:`9 20 4 20 4 15`},null,-1)],64)):e.name===`database`?(h(),p(S,{key:13},[n[23]||=N(`ellipse`,{cx:`12`,cy:`6`,rx:`7`,ry:`2.5`},null,-1),n[24]||=N(`path`,{d:`M5 6 V18 C5 19.4 8 20.5 12 20.5 C16 20.5 19 19.4 19 18 V6`},null,-1),n[25]||=N(`path`,{d:`M5 12 C5 13.4 8 14.5 12 14.5 C16 14.5 19 13.4 19 12`},null,-1)],64)):e.name===`settings`?(h(),p(S,{key:14},[n[26]||=N(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`},null,-1),n[27]||=N(`circle`,{cx:`12`,cy:`12`,r:`3`},null,-1)],64)):e.name===`markdown`?(h(),p(S,{key:15},[n[28]||=N(`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`},null,-1),n[29]||=N(`path`,{d:`M6 15 V9 L9 12 L12 9 V15`},null,-1),n[30]||=N(`path`,{d:`M15 15 V9 L18 12 V9 M15 12 L18 15`},null,-1)],64)):e.name===`txt`?(h(),p(S,{key:16},[n[31]||=N(`rect`,{x:`5`,y:`3`,width:`14`,height:`18`,rx:`1.5`},null,-1),n[32]||=N(`line`,{x1:`8`,y1:`8`,x2:`16`,y2:`8`},null,-1),n[33]||=N(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`},null,-1),n[34]||=N(`line`,{x1:`8`,y1:`16`,x2:`13`,y2:`16`},null,-1)],64)):e.name===`eye`?(h(),p(S,{key:17},[n[35]||=N(`path`,{d:`M2 12 C4 6 8 3 12 3 C16 3 20 6 22 12 C20 18 16 21 12 21 C8 21 4 18 2 12 Z`},null,-1),n[36]||=N(`circle`,{cx:`12`,cy:`12`,r:`3.2`},null,-1)],64)):e.name===`eye-off`?(h(),p(S,{key:18},[n[37]||=N(`path`,{d:`M3 3 L21 21`},null,-1),n[38]||=N(`path`,{d:`M10.5 6.2 C11 6.1 11.5 6 12 6 C16 6 19.5 8.5 21 12 C20.4 13.2 19.6 14.3 18.7 15.2`},null,-1),n[39]||=N(`path`,{d:`M6.6 6.6 C4 8.2 2.7 10.2 2 12 C3 14.5 5.2 16.8 8 18.3 C9.2 19 10.6 19.4 12 19.4 C13.5 19.4 14.9 19 16.2 18.3`},null,-1),n[40]||=N(`path`,{d:`M9.5 9.5 C9.1 10.2 9 11.1 9 12 C9 13.7 9.8 15.2 11 16.1`},null,-1)],64)):e.name===`outline`?(h(),p(S,{key:19},[n[41]||=N(`rect`,{x:`4`,y:`3`,width:`16`,height:`18`,rx:`2`},null,-1),n[42]||=N(`line`,{x1:`8`,y1:`8`,x2:`16`,y2:`8`},null,-1),n[43]||=N(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`},null,-1),n[44]||=N(`line`,{x1:`8`,y1:`16`,x2:`13`,y2:`16`},null,-1)],64)):e.name===`logo`?(h(),p(S,{key:20},[n[45]||=m(`<circle cx="12" cy="12" r="2.2"></circle><circle cx="4" cy="5" r="1.6"></circle><circle cx="20" cy="5" r="1.6"></circle><circle cx="4" cy="19" r="1.6"></circle><circle cx="20" cy="19" r="1.6"></circle><line x1="10.5" y1="10.8" x2="5.2" y2="6.4"></line><line x1="13.5" y1="10.8" x2="18.8" y2="6.4"></line><line x1="10.5" y1="13.2" x2="5.2" y2="17.6"></line><line x1="13.5" y1="13.2" x2="18.8" y2="17.6"></line>`,9)],64)):e.name===`import`?(h(),p(S,{key:21},[n[46]||=N(`path`,{d:`M12 4 V15`},null,-1),n[47]||=N(`polyline`,{points:`7 10 12 15 17 10`},null,-1),n[48]||=N(`path`,{d:`M4 19 H20`},null,-1)],64)):e.name===`export`?(h(),p(S,{key:22},[n[49]||=N(`path`,{d:`M12 15 V4`},null,-1),n[50]||=N(`polyline`,{points:`7 9 12 4 17 9`},null,-1),n[51]||=N(`path`,{d:`M4 19 H20`},null,-1)],64)):e.name===`balance`?(h(),p(S,{key:23},[n[52]||=m(`<line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="18" x2="21" y2="18"></line><polyline points="9 4 5 6 9 8"></polyline><polyline points="15 4 19 6 15 8"></polyline><polyline points="9 10 5 12 9 14"></polyline><polyline points="15 10 19 12 15 14"></polyline><polyline points="9 16 5 18 9 20"></polyline><polyline points="15 16 19 18 15 20"></polyline>`,9)],64)):e.name===`mindmap`?(h(),p(S,{key:24},[n[53]||=m(`<circle cx="12" cy="12" r="2.4" fill="currentColor" stroke="none"></circle><line x1="13.4" y1="10.6" x2="18.5" y2="5.5"></line><line x1="13.4" y1="13.4" x2="18.5" y2="18.5"></line><line x1="10.6" y1="10.6" x2="5.5" y2="5.5"></line><line x1="10.6" y1="13.4" x2="5.5" y2="18.5"></line><circle cx="19.5" cy="4.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="19.5" cy="19.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="4.5" cy="4.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="4.5" cy="19.5" r="1.8" fill="currentColor" stroke="none"></circle>`,9)],64)):e.name===`tree`?(h(),p(S,{key:25},[n[54]||=m(`<circle cx="5" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="5" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="19" r="2" fill="currentColor" stroke="none"></circle><line x1="7" y1="12" x2="12" y2="12"></line><line x1="12" y1="12" x2="12" y2="5"></line><line x1="12" y1="12" x2="12" y2="19"></line><line x1="12" y1="5" x2="17" y2="5"></line><line x1="12" y1="19" x2="17" y2="19"></line>`,9)],64)):e.name===`org`?(h(),p(S,{key:26},[n[55]||=m(`<circle cx="12" cy="5" r="2" fill="currentColor" stroke="none"></circle><circle cx="6" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="12" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="19" r="2" fill="currentColor" stroke="none"></circle><line x1="12" y1="7" x2="12" y2="13"></line><line x1="6" y1="13" x2="18" y2="13"></line><line x1="6" y1="13" x2="6" y2="17"></line><line x1="12" y1="13" x2="12" y2="17"></line><line x1="18" y1="13" x2="18" y2="17"></line>`,9)],64)):e.name===`image`?(h(),p(S,{key:27},[n[56]||=N(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`},null,-1),n[57]||=N(`circle`,{cx:`9`,cy:`11`,r:`1.6`},null,-1),n[58]||=N(`polyline`,{points:`3 17 9 12 13 15 16 13 21 17`},null,-1)],64)):e.name===`x`?(h(),p(S,{key:28},[n[59]||=N(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`},null,-1),n[60]||=N(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`},null,-1)],64)):e.name===`link`?(h(),p(S,{key:29},[n[61]||=N(`path`,{d:`M10 13 a4 4 0 0 0 5.66 0 l3 -3 a4 4 0 1 0 -5.66 -5.66 l-1 1`},null,-1),n[62]||=N(`path`,{d:`M14 11 a4 4 0 0 0 -5.66 0 l-3 3 a4 4 0 1 0 5.66 5.66 l1 -1`},null,-1)],64)):e.name===`note`?(h(),p(S,{key:30},[n[63]||=N(`path`,{d:`M6 4 h9 l3 3 v13 a1 1 0 0 1 -1 1 h-11 a1 1 0 0 1 -1 -1 v-15 a1 1 0 0 1 1 -1 z`},null,-1),n[64]||=N(`line`,{x1:`8`,y1:`10`,x2:`16`,y2:`10`},null,-1),n[65]||=N(`line`,{x1:`8`,y1:`13`,x2:`16`,y2:`13`},null,-1),n[66]||=N(`line`,{x1:`8`,y1:`16`,x2:`13`,y2:`16`},null,-1)],64)):e.name===`search`?(h(),p(S,{key:31},[n[67]||=N(`circle`,{cx:`11`,cy:`11`,r:`7`},null,-1),n[68]||=N(`line`,{x1:`16`,y1:`16`,x2:`21`,y2:`21`},null,-1)],64)):e.name===`json`?(h(),p(S,{key:32},[n[69]||=N(`path`,{d:`M8 4 C6 4 6 6 6 7 C6 8 5 8 5 9 C5 10 6 10 6 11 C6 12 6 14 8 14`},null,-1),n[70]||=N(`path`,{d:`M16 4 C18 4 18 6 18 7 C18 8 19 8 19 9 C19 10 18 10 18 11 C18 12 18 14 16 14`},null,-1)],64)):e.name===`svg-export`?(h(),p(S,{key:33},[n[71]||=N(`path`,{d:`M6 3 h8 l4 4 v14 a1 1 0 0 1 -1 1 h-11 a1 1 0 0 1 -1 -1 v-15 a1 1 0 0 1 1 -1 z`},null,-1),n[72]||=N(`polyline`,{points:`14 3 14 7 18 7`},null,-1),n[73]||=N(`polyline`,{points:`8 14 6 16 8 18`},null,-1),n[74]||=N(`polyline`,{points:`14 14 16 16 14 18`},null,-1)],64)):e.name===`relation`?(h(),p(S,{key:34},[n[75]||=N(`circle`,{cx:`5`,cy:`19`,r:`2.5`},null,-1),n[76]||=N(`circle`,{cx:`19`,cy:`5`,r:`2.5`},null,-1),n[77]||=N(`path`,{d:`M7 17 C 10 12, 14 12, 17 7`,"stroke-dasharray":`3 2.2`},null,-1)],64)):M(``,!0)],8,te))}}),ie=`data:image/svg+xml,%3csvg%20t='1780822312364'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='7459'%20width='200'%20height='200'%3e%3cpath%20d='M329.16%20292.571h658.286V512H329.16zM329.16%200h658.286v219.429H329.16z'%20fill='%239AA1A2'%20p-id='7460'%3e%3c/path%3e%3cpath%20d='M44.927%20146.286a46.519%2046.519%200%200%201%2038.107-73.143h319.269v73.143H109.73V791.99l-48.713%205.705-24.43-651.41h8.339z'%20fill='%239AA1A2'%20p-id='7461'%3e%3c/path%3e%3cpath%20d='M363.83%20877.714H179.51c-78.775%200-142.921-66.12-142.921-147.31V112.787c0-21.943%2017.188-39.643%2038.473-39.643%2021.211%200%2033.5%2017.774%2033.5%2039.643v617.619c0%2037.522%2028.013%2076.58%2064.438%2076.58h190.903c21.211%200%2038.766%2013.97%2038.766%2035.84%200%2021.943-17.555%2034.89-38.766%2034.89z'%20fill='%239AA1A2'%20p-id='7462'%3e%3c/path%3e%3cpath%20d='M432.95%20438.857H179.51c-78.775%200-81.043-18.578-81.043-62.903l10.094-90.624c0%2020.48%2013.458%2080.677%2049.884%2080.677h210.139c21.211%200%20120.613%204.023%20120.613%2016.018%200%2011.922-35.036%2056.832-56.32%2056.832zM640.017%20749.714V640a54.857%2054.857%200%200%201%20109.714%200v109.714h109.715a54.857%2054.857%200%200%201%200%20109.715H749.73v109.714a54.857%2054.857%200%200%201-109.714%200V859.429H530.303a54.857%2054.857%200%200%201%200-109.715h109.714z'%20fill='%239AA1A2'%20p-id='7463'%3e%3c/path%3e%3c/svg%3e`,R=`data:image/svg+xml,%3csvg%20t='1780822464335'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='8457'%20width='200'%20height='200'%3e%3cpath%20d='M512%20804.571h512V1024H512V804.571zM0%200h658.286v219.429H0V0z'%20fill='%239AA1A2'%20p-id='8458'%3e%3c/path%3e%3cpath%20d='M619.813%20950.857h-184.32c-78.775%200-142.922-66.121-142.922-147.31V185.93c0-21.943%2017.189-39.643%2038.474-39.643%2021.211%200%2033.353%2017.773%2033.353%2039.643v617.618c0%2037.523%2034.743%2073.728%2071.095%2073.728h184.32c21.211%200%2038.473%2012.069%2038.473%2033.939%200%2021.943-17.189%2039.643-38.473%2039.643z'%20fill='%239AA1A2'%20p-id='8459'%3e%3c/path%3e%3cpath%20d='M676.571%20457.143V347.429a54.857%2054.857%200%200%201%20109.715%200v109.714H896a54.857%2054.857%200%200%201%200%20109.714H786.286v109.714a54.857%2054.857%200%200%201-109.715%200V566.857H566.857a54.857%2054.857%200%200%201%200-109.714h109.714z'%20fill='%239AA1A2'%20p-id='8460'%3e%3c/path%3e%3c/svg%3e`,z=[22,15,13,12],B=[700,600,500,400],ae=[46,36,30,26],V=[120,80,60,44],oe=[.8,.8,.8,.8],se=1,ce=z.length-1;function le(e,t){return Math.round(de(e,t)*oe[ue(e)])}function ue(e){return Math.min(ce,Math.max(0,e))}function de(e,t=14){return Math.round(z[ue(e)]*t/14*10)/10}function fe(e,t=14){return Math.round(ae[ue(e)]*t/14)}var pe=60,me=30,he=.75,ge=14,H=24;function _e(e){return Math.max(me,Math.round(pe*he**+e))}var ve=null;function ye(){if(ve)return ve;let e=typeof document<`u`?document.createElement(`canvas`).getContext(`2d`):null;return e?(ve=e,e):{font:``,measureText:()=>({width:0})}}var be=new Map;function xe(e,t,n){let r=`${n}|${t}|${e}`,i=be.get(r);if(i!==void 0)return i;let a=ye();a.font=`${n} ${t}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;let o=e.split(`
|
|
2
2
|
`),s=0;for(let e of o){let t=a.measureText(e).width;t>s&&(s=t)}return be.set(r,s),s}var Se=24,Ce=400,we=8,U=16,Te=4,Ee=200;function De(e,t,n){return Math.min(n,Math.max(t,e))}function Oe(e,t,n,r,i){let a=ue(t),o=de(t,n),s=Math.min(xe(e.text||``,o,B[a]),Ee),c=le(t,n),l=Math.ceil(s+c*2+se*2),u=(e.text||``).split(`
|
|
3
3
|
`),d=0;for(let e of u){let t=xe(e,o,B[a]);d+=Math.max(1,Math.ceil(t/Ee))}d=Math.max(1,d);let f=e.richContent&&(e.richContent.kind===`code`||e.richContent.kind===`table`)?Math.ceil(o*1.2)+6+Math.ceil(o*1.2*(d-1)):fe(t,n)+Math.ceil(o*1.2*(d-1)),p=0;if(e.link&&(p+=U),e.note&&(p+=U),p>0){let t=+!!e.link+ +!!e.note;p+=Te*t}let m=0;e.markers&&e.markers.length>0&&(m=e.markers.length*14+(e.markers.length-1)*2+Te);let h=e.tags&&e.tags.length>0?18:0,g=l+p+m,_=(()=>{let t=Math.round(V[a]*n/14);if(e.richContent&&(e.richContent.kind===`code`||e.richContent.kind===`table`)){let n=i?.[e.id];return Math.max(t,n??240)}return t})(),v=!!(e.richContent&&(e.richContent.kind===`code`||e.richContent.kind===`table`)),y=r?.[e.id],b=v?Math.max(24,y??Math.max(70,Math.ceil(o*5))):0,x=b>0?10:0;if(!e.image)return{w:Math.max(_,g),h:Math.ceil(f+x+b+(h>0?4+h:0))};let S=De(e.image.width,Se,Ce);return{w:Math.max(_,g,Math.ceil(S+c*2)),h:Math.ceil(e.image.height+we+f+x+b+(h>0?4+h:0))}}function ke(e,t={}){let n=t.mode??`mindmap`,r=t.preservePositions===!0,i=t.baseFontSize??14,a=t.branchGap??0,o=Ne(e,0,null,1,`right`,i,t.richHeights,t.richWidths);return Pe(o,a),Ae(o,n,r,a),o.x=0,o.y=0,Fe(o,r)}function Ae(e,t,n=!1,r=0){if(t===`mindmap`){let t=e.children;if(t.length!==0)if(t.length===1)t[0]._dir=`right`,t[0].side=1,t[0]._dirRight=1;else{let e=t.reduce((e,t)=>e+t._subtreeH,0),n=1,r=Math.abs(t[0]._subtreeH-(e-t[0]._subtreeH)),i=0;for(let a=0;a<t.length-1;a++){i+=t[a]._subtreeH;let o=Math.abs(i-(e-i));o<r&&(r=o,n=a+1)}for(let e=0;e<n;e++)t[e]._dir=`right`,t[e].side=1,t[e]._dirRight=1;for(let e=n;e<t.length;e++)t[e]._dir=`left`,t[e].side=-1,t[e]._dirRight=-1}let i=e.children.filter(e=>e.side===1),a=e.children.filter(e=>e.side===-1),o=(e,t)=>{let n=t===`right`?1:-1;e._dir=t,e.side=n,e._dirRight=n;for(let n of e.children)o(n,t)};for(let e of i)o(e,`right`);for(let e of a)o(e,`left`);i.length>0&&je({...e,children:i},`right`,pe,!0,n,r),a.length>0&&je({...e,children:a},`left`,pe,!0,n,r)}else if(t===`tree`){let t=e=>{e.side=1,e._dir=`right`;for(let n of e.children)t(n)};for(let t of e.children)t._dir=`right`;je(e,`right`,pe,!0,n,r),t(e)}else{for(let t of e.children)t._dir=`down`;Me(e,pe,n,r)}}function je(e,t,n,r,i=!1,a=0){if(e.children.length===0)return;let o=r?ge+a:ge,s=e.children.reduce((e,t,n)=>e+t._subtreeH+(n>0?o:0),0),c=t===`right`?1:-1,l=r?c:1,u=e.y-l*s/2,d=_e(e.depth);e.children.forEach(r=>{i||(r.x=e.x+c*(e.width/2+d+r.width/2),r.y=u+l*r._subtreeH/2),r._dir=t,u+=l*(r._subtreeH+o),je(r,t,n,!1,i,0)})}function Me(e,t,n=!1,r=0){if(e.children.length===0)return;let i=e.depth===0?ge+r:ge,a=e.children.reduce((e,t,n)=>e+t._subtreeW+(n>0?i*2:0),0),o=e.x-a/2,s=_e(e.depth);e.children.forEach(r=>{n||(r.x=o+r._subtreeW/2,r.y=e.y+e.height/2+s+r.height/2),r._dir=`down`,o+=r._subtreeW+i*2,Me(r,t,n,0)})}function Ne(e,t,n,r,i,a,o,s){let c=Oe(e,t,a,o,s),l={id:e.id,text:e.text,depth:t,x:e._x??0,y:e._y??0,width:c.w,height:c.h,fontSize:de(t,a),isRoot:t===0,collapsed:e.collapsed,side:r,_dir:i,_dirRight:r,_subtreeH:c.h,_subtreeW:c.w,image:e.image?{...e.image}:void 0,link:e.link?{url:e.link.url}:void 0,note:e.note?{text:e.note.text}:void 0,richContent:e.richContent?{kind:e.richContent.kind,raw:e.richContent.raw,lang:e.richContent.lang}:void 0,markers:e.markers?[...e.markers]:void 0,tags:e.tags?[...e.tags]:void 0,children:[],parent:n};if(e.collapsed)return l;let u=e.children.length,d=Math.ceil(u/2);return l.children=e.children.map((e,n)=>{let c=t===0?n<d?1:-1:r;return Ne(e,t+1,l,c,i,a,o,s)}),l}function Pe(e,t=0){let n=[e];for(let e=0;e<n.length;e++){let t=n[e];for(let e of t.children)n.push(e)}for(let e=n.length-1;e>=0;e--){let r=n[e];if(r.collapsed||r.children.length===0){r._subtreeH=r.height,r._subtreeW=r.width;continue}let i=r.depth===0?ge+t:ge,a=0,o=0;for(let e of r.children)a+=e._subtreeH,o+=e._subtreeW;r.children.length>1&&(a+=i*(r.children.length-1),o+=i*2*(r.children.length-1)),r._subtreeH=Math.max(r.height,a),r._subtreeW=Math.max(r.width,o)}}function Fe(e,t=!1){let n=[e],r=1/0,i=-1/0,a=1/0,o=-1/0;for(;n.length;){let e=n.pop(),t=e.width/2,s=e.height/2;e.x-t<r&&(r=e.x-t),e.x+t>i&&(i=e.x+t),e.y-s<a&&(a=e.y-s),e.y+s>o&&(o=e.y+s),n.push(...e.children)}if(t)return{root:e,width:i-r+H*2,height:o-a+H*2,vbX:r-H,vbY:a-H,vbW:i-r+H*2,vbH:o-a+H*2};let s=H-a,c=[e];for(;c.length;){let e=c.pop();e.y+=s,c.push(...e.children)}return a+=s,o+=s,{root:e,width:i-r+H*2,height:o+H,vbX:r-H,vbY:0,vbW:i-r+H*2,vbH:o+H}}var Ie=[{id:`default`,name:`默认`,colors:[`#f87171`,`#fb923c`,`#fbbf24`,`#a3e635`,`#34d399`,`#22d3ee`,`#818cf8`,`#c084fc`]},{id:`classic`,name:`经典`,colors:[`#ef4444`,`#f59e0b`,`#10b981`,`#3b82f6`,`#6366f1`,`#8b5cf6`,`#ec4899`,`#14b8a6`]},{id:`vivid`,name:`活力`,colors:[`#dc2626`,`#ea580c`,`#ca8a04`,`#16a34a`,`#0891b2`,`#2563eb`,`#7c3aed`,`#db2777`]},{id:`dev`,name:`代码`,colors:[`#f472b6`,`#a78bfa`,`#60a5fa`,`#38bdf8`,`#22d3ee`,`#34d399`,`#facc15`,`#fb923c`]},{id:`mint`,name:`薄荷`,colors:[`#5eead4`,`#67e8f9`,`#93c5fd`,`#c4b5fd`,`#fbcfe8`,`#fde68a`,`#a7f3d0`,`#bae6fd`]}];function Le(e,t=[]){return[...Ie,...t].find(t=>t.id===e)??Ie[0]}function Re(e,t=8){let n=[],r=new Set,i=/#[0-9a-fA-F]{3,8}\b|rgba?\([^)]+\)|[A-Za-z][A-Za-z0-9_-]{2,30}/g,a;for(;(a=i.exec(e))!==null;){let e=a[0],i=null;if(i=e.startsWith(`#`)?ze(e):e.startsWith(`rgb`)?Be(e):W[e.toLowerCase()]??null,!i)continue;let o=i.toLowerCase();if(!r.has(o)&&(r.add(o),n.push(o),n.length>=t))break}return n}function ze(e){let t=e.startsWith(`#`)?e.slice(1):e;if(!/^[0-9a-fA-F]+$/.test(t))return null;let n;if(t.length===3)n=t.split(``).map(e=>e+e).join(``);else if(t.length===4)n=t.slice(0,3).split(``).map(e=>e+e).join(``);else if(t.length===6)n=t;else if(t.length===8)n=t.slice(0,6);else return null;return`#`+n.toLowerCase()}function Be(e){let t=e.match(/^rgba?\(\s*([^)]+?)\s*\)$/i);if(!t)return null;let n=t[1].split(/\s*,\s*/);if(n.length<3)return null;let r=[];for(let e=0;e<3;e++){let t=n[e];if(t.endsWith(`%`)){let e=parseFloat(t);if(!isFinite(e))return null;r.push(Math.round(e/100*255))}else{let e=parseInt(t,10);if(!isFinite(e)||e<0||e>255)return null;r.push(e)}}return`#`+r.map(e=>e.toString(16).padStart(2,`0`)).join(``).toLowerCase()}var W={black:`#000000`,white:`#ffffff`,red:`#ff0000`,green:`#008000`,blue:`#0000ff`,yellow:`#ffff00`,cyan:`#00ffff`,magenta:`#ff00ff`,gray:`#808080`,grey:`#808080`,silver:`#c0c0c0`,maroon:`#800000`,olive:`#808000`,lime:`#00ff00`,aqua:`#00ffff`,teal:`#008080`,navy:`#000080`,fuchsia:`#ff00ff`,purple:`#800080`,orange:`#ffa500`,pink:`#ffc0cb`,brown:`#a52a2a`,gold:`#ffd700`,coral:`#ff7f50`,tomato:`#ff6347`,salmon:`#fa8072`,khaki:`#f0e68c`,violet:`#ee82ee`,indigo:`#4b0082`,turquoise:`#40e0d0`,chocolate:`#d2691e`,crimson:`#dc143c`,darkred:`#8b0000`,darkblue:`#00008b`,darkgreen:`#006400`,darkgray:`#a9a9a9`,darkgrey:`#a9a9a9`,lightgray:`#d3d3d3`,lightgrey:`#d3d3d3`,lightblue:`#add8e6`,lightgreen:`#90ee90`,lightyellow:`#ffffe0`,lightpink:`#ffb6c1`,skyblue:`#87ceeb`,forestgreen:`#228b22`,royalblue:`#4169e1`,steelblue:`#4682b4`,hotpink:`#ff69b4`,deeppink:`#ff1493`,orangered:`#ff4500`,goldenrod:`#daa520`,mediumpurple:`#9370db`};function Ve(){return`n_`+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function He(e){return JSON.parse(JSON.stringify(e))}function G(e,t){if(e.id===t)return e;for(let n of e.children){let e=G(n,t);if(e)return e}return null}function Ue(e,t,n=null){if(e.id===t)return n;for(let n of e.children){let r=Ue(n,t,e);if(r!==null)return r}return null}function We(e,t){let n=e.children.findIndex(e=>e.id===t);if(n>=0)return e.children.splice(n,1),!0;for(let n of e.children)if(We(n,t))return!0;return!1}function Ge(e,t,n){let r=G(e,t);return!r||r.text===n?!1:(r.text=n,!0)}function Ke(e,t,n,r){if(!Ue(e,t)||t===n||G(G(e,t),n))return!1;let i=Ue(e,t),a=i.children.findIndex(e=>e.id===t);if(a<0)return!1;let[o]=i.children.splice(a,1);if(r===`child`){let t=G(e,n);return t?(t.children.push(o),!0):(i.children.splice(a,0,o),!1)}let s=Ue(e,n);if(!s)return i.children.splice(a,0,o),!1;let c=s.children.findIndex(e=>e.id===n);return c<0?(i.children.splice(a,0,o),!1):(r===`after`&&(c+=1),s.children.splice(c,0,o),!0)}function qe(e){let t=/^新节点(?:\s+(\d+))?$/,n=0,r=!1;for(let i of e.children){let e=i.text.match(t);if(e)if(e[1]){let t=parseInt(e[1],10);t>n&&(n=t)}else r=!0}return n===0&&!r?tt:n>0?`新节点 ${n+1}`:`新节点 2`}function Je(e,t,n){let r=G(e,t);if(!r)return null;let i={id:Ve(),text:n??qe(r),children:[]};return r.children.push(i),i}function Ye(e,t,n){let r=Ue(e,t);if(!r)return null;let i=r.children.findIndex(e=>e.id===t);if(i<0)return null;let a={id:Ve(),text:n??qe(r),children:[]};return r.children.splice(i+1,0,a),a}function Xe(e,t,n){let r=Ue(e,t);if(!r)return null;let i=r.children.findIndex(e=>e.id===t);if(i<0)return null;let a={id:Ve(),text:n,children:[]};return r.children.splice(i,0,a),a}function Ze(e,t){let n=Ue(e,t);if(!n)return null;let r=n.children.findIndex(e=>e.id===t);if(r<0)return null;let i=n.children[r],a=He(i);return Qe(a),n.children.splice(r+1,0,a),a}function Qe(e){e.id=Ve();for(let t of e.children)Qe(t)}function $e(e,t){let n=G(e,t);if(!n||n.id===e.id)return null;let r=He(n);return Qe(r),r}function et(e){return e.children.reduce((e,t)=>e+1+et(t),0)}var tt=`新节点`;function nt(e){return e.relations||=[],e.relations}function rt(e,t){return e.relations?.find(e=>e.id===t)??null}function it(e,t,n){if(t===n||!G(e,t)||!G(e,n))return null;let r=nt(e);if(r.some(e=>e.fromId===t&&e.toId===n))return null;let i={id:Ve(),fromId:t,toId:n};return r.push(i),i}function at(e,t){let n=e.relations;if(!n)return!1;let r=n.findIndex(e=>e.id===t);return r<0?!1:(n.splice(r,1),!0)}function ot(e,t,n){let r=rt(e,t);return r?(Object.assign(r,n),!0):!1}function st(e,t,n,r){var i;let a=rt(e,t);if(!a||!G(e,r)||r===(n===`from`?a.toId:a.fromId))return!1;let o=n===`from`?r:a.fromId,s=n===`to`?r:a.toId;return(i=e.relations)!=null&&i.some(e=>e.id!==t&&e.fromId===o&&e.toId===s)?!1:(n===`from`?(a.fromId=r,delete a.fromT):(a.toId=r,delete a.toT),delete a.c1,delete a.c2,!0)}function ct(e,t){let n=e.relations;if(!n||n.length===0)return 0;let r=n.length;return e.relations=n.filter(e=>e.fromId!==t&&e.toId!==t),r-e.relations.length}function lt(e,t=`导入的导图`){let n=e.split(/\r?\n/),r={id:Ve(),text:t,children:[]},i=[r],a=[-1/0],o=[],s=/^(#{1,6})\s+(.+?)\s*#*\s*$/,c=/^!\[([^\]]*)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,l=/^\[([^\]]+)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,u=/^(`{3,}|~{3,})\s*(\S+)?\s*$/,d=!1,f=[],p=null;function m(e){f.push(e)}function h(){if(p&&f.length>0){for(;f.length>0&&f[0].trim()===``;)f.shift();for(;f.length>0&&f[f.length-1].trim()===``;)f.pop();let e=f.join(`
|
|
4
4
|
`);e&&(p.note={text:e})}d=!1,f=[]}for(let e of n){if(d){let t=e.match(u);if(t&&t[1][0]==="`"){h();continue}m(e);continue}let t=e.match(s);if(t){let e=t[1].length,n=t[2].trim();o.push({level:e,text:n,body:``}),p=o[o.length-1];continue}let n=e.match(u);if(n&&n[2]===`note`){d=!0,f=[];continue}let r=e.match(c);if(r&&p){let e=r[2];p.image={src:e,naturalW:160,naturalH:120,width:160,height:120};continue}let i=e.match(l);if(i&&p){p.link={url:i[2]},p.text=i[1];continue}if(e.trim().length>0&&p){let t=e.trim();p.body=p.body?p.body+`
|
|
@@ -11,8 +11,8 @@ import{$n as e,Bn as t,Dn as n,En as r,Hn as i,Jn as a,Kn as o,Ln as s,Nn as c,O
|
|
|
11
11
|
`)[0]?.slice(0,80)||`(空代码块)`,raw:s.join(`
|
|
12
12
|
`),lang:o});continue}let u=e.match(i);if(u){n.push({kind:`heading`,level:u[1].length,text:u[2].trim(),raw:e}),r++;continue}if(/^\s*\|/.test(e)){let e=[],i=r,a=!1;for(;i<t.length&&/^\s*\|/.test(t[i]);)e.push(t[i]),o.test(t[i])&&(a=!0),i++;if(a&&e.length>=2){n.push({kind:`table`,text:e[0].replace(/^\s*\|/,``).replace(/\|\s*$/,``).split(`|`)[0]?.trim()||`表格`,raw:e.join(`
|
|
13
13
|
`)}),r=i;continue}}let d=e.match(s),f=e.match(c);if(d||f){let e=r;for(;e<t.length;){let r=t[e].match(s),i=t[e].match(c);if(!(r||i))break;let a=t[e].replace(/^\s*[-*+]\s+/,``).replace(/^\s*\d+\.\s+/,``).trim();a.length>0&&n.push({kind:`list`,text:a.slice(0,80)||`(列表项)`,raw:t[e]}),e++}r=e;continue}if(e.trim()===``){r++;continue}let p=[e],m=r+1;for(;m<t.length;){let e=t[m];if(e.trim()===``||i.test(e)||a.test(e)||s.test(e)||c.test(e)||/^\s*\|/.test(e))break;p.push(e),m++}let h=p.join(` `).trim();n.push({kind:`paragraph`,text:h.slice(0,80)||`(空段落)`,raw:p.join(`
|
|
14
|
-
`)}),r=m}return n}function ft(e,t=`导入的导图`){let n=dt(e||``),r={id:Ve(),text:t,children:[]},i=[r],a=[0],o=!1;function s(e){if(e.kind===`heading`){let t=e.level;for(;i.length>1&&a[a.length-1]>=t;)i.pop(),a.pop();if(!o&&t===1){o=!0,r.text=e.text,a[0]=1;return}let n={id:Ve(),text:e.text,children:[]};i[i.length-1].children.push(n),i.push(n),a.push(t);return}let t={id:Ve(),text:e.text,children:[],richContent:{kind:e.kind,raw:e.raw,lang:e.lang}};i[i.length-1].children.push(t)}for(let e of n)s(e);return r}function pt(e){let t=e.minScale??.2,n=e.maxScale??1/0,r=e.step??1.2,i=T(1),a=T(0),o=T(0),s=T(!1),c=T(!1),l=v({x:0,y:0,ox:0,oy:0}),u=T(!1),d=v({x:0,y:0}),f=v({x:0,y:0,width:0,height:0}),p=T(0),m=null;function h(e){m=e}function g(r){r.preventDefault();let s=e.getContainer();if(!s)return;let c=-r.deltaY*.001,l=Math.min(n,Math.max(t,i.value*(1+c))),u=s.getBoundingClientRect(),d=r.clientX-u.left,f=r.clientY-u.top,p=(d-a.value)/i.value,m=(f-o.value)/i.value;i.value=l,a.value=d-p*l,o.value=f-m*l}function _(){i.value=Math.min(n,i.value*r)}function y(){i.value=Math.max(t,i.value/r)}function b(e){var t;e.target.closest(`.zm-node, .zm-toolbar, button, input, textarea`)||(s.value=!0,c.value=!1,l.x=e.clientX,l.y=e.clientY,l.ox=a.value,l.oy=o.value,window.addEventListener(`mousemove`,x),window.addEventListener(`mouseup`,S),(t=e.preventDefault)==null||t.call(e))}function x(e){if(!s.value)return;let t=e.clientX-l.x,n=e.clientY-l.y;(Math.abs(t)>3||Math.abs(n)>3)&&(c.value=!0),a.value=l.ox+t,o.value=l.oy+n}function S(){s.value=!1,window.removeEventListener(`mousemove`,x),window.removeEventListener(`mouseup`,S)}function C(e,t,n){u.value=!0,d.x=e,d.y=t,f.x=e,f.y=t,f.width=0,f.height=0,f.shiftKey=!!(n!=null&&n.shift),p.value++,window.addEventListener(`mousemove`,D),window.addEventListener(`mouseup`,E)}function w(e,t){if(!u.value)return;let n=Math.min(d.x,e),r=Math.min(d.y,t),i=Math.max(d.x,e),a=Math.max(d.y,t);f.x=n,f.y=r,f.width=i-n,f.height=a-r,p.value++}function E(){u.value=!1,window.removeEventListener(`mousemove`,D),window.removeEventListener(`mouseup`,E),m&&m()}function D(t){if(!u.value)return;let n=e.getContainer();if(!n)return;let r=n.getBoundingClientRect();w((t.clientX-r.left-a.value)/i.value,(t.clientY-r.top-o.value)/i.value)}function O(t,n,r,s=60){let c=e.getContainer();if(!c)return;let l=c.getBoundingClientRect(),u=(l.width-s*2)/t,d=(l.height-s*2)/n,f=Math.min(1,Math.max(.3,Math.min(u,d)));i.value=f,a.value=l.width/2,o.value=l.height/2-r*f}function k(){let t=e.getContainer();if(!t)return;let n=t.getBoundingClientRect(),r=n.width/2,s=n.height/2,c=(r-a.value)/i.value,l=(s-o.value)/i.value;i.value=1,a.value=r-c,o.value=s-l}function A(t,r,s,c,l=80){let u=e.getContainer();if(!u)return;let d=u.getBoundingClientRect(),f=i.value;(s*f<40||c*f<40)&&(f=Math.min(n,Math.max(1,60/Math.min(s,c)))),i.value=f,a.value=d.width/2-t*f,o.value=d.height/2-r*f}return{scale:i,offsetX:a,offsetY:o,isPanning:s,panMoved:c,onWheel:g,zoomIn:_,zoomOut:y,zoomTo100:k,startPan:b,startMarquee:C,updateMarquee:w,isMarquee:u,marquee:f,marqueeVersion:p,setOnMarqueeEnd:h,resetView:O,centerOn:A}}var mt=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);function ht(e){return mt?e.metaKey:e.ctrlKey}function gt(e){function n(){let t=e.getSelectedId();if(t)return t;if(e.defaultTargetId)return e.defaultTargetId();let n=e.getSelectedIds();return n.length>0?n[0]:null}function r(t){let r=t.target;if(r&&(r.tagName===`INPUT`||r.tagName===`TEXTAREA`||r.isContentEditable)||e.isReadonly()||e.isEditing())return;let i=e.getSelectedId(),a=n();if(a){if(ht(t)&&!t.shiftKey){if(t.key===`d`||t.key===`D`){let n=e.defaultTargetId?.call(e);i&&i!==n&&(t.preventDefault(),e.onDuplicate(i));return}if(t.key===`c`||t.key===`C`){let n=e.getSelectedIds();n.length>0&&(t.preventDefault(),e.onCopy(n));return}if(t.key===`x`||t.key===`X`){let n=e.getSelectedIds();n.length>0&&(t.preventDefault(),e.onCut(n));return}if(t.key===`v`||t.key===`V`){if(!e.hasClipboard())return;t.preventDefault();let n=e.getSelectedIds();e.onPaste(n.length>0?n[0]:null);return}if(t.key===`z`||t.key===`Z`){t.preventDefault(),e.onUndo();return}if(t.key===`y`||t.key===`Y`){t.preventDefault(),e.onRedo();return}if(t.key===`Home`){t.preventDefault(),e.onSelectRoot();return}}if(ht(t)&&t.shiftKey&&(t.key===`Z`||t.key===`z`)){t.preventDefault(),e.onRedo();return}if(t.key===`Tab`)t.preventDefault(),e.onAddChild(a);else if(t.key===`Enter`)if(t.preventDefault(),t.shiftKey){let t=e.defaultTargetId?.call(e);i&&i!==t&&e.onAddSiblingBefore(i)}else e.onAddSibling(a);else if((t.key===`Delete`||t.key===`Backspace`)&&i&&i!==e.defaultTargetId?.call(e))t.preventDefault(),e.onRemove(i);else if(t.key===`F2`&&i)t.preventDefault(),e.onStartEdit(i);else if(t.key===` `&&i)t.preventDefault(),e.onStartEdit(i);else if(t.key===`Escape`)t.preventDefault(),e.onClearSelection();else if(t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey){if(t.key===`ArrowUp`){t.preventDefault(),e.onMoveSibling(-1);return}else if(t.key===`ArrowDown`){t.preventDefault(),e.onMoveSibling(1);return}}else t.key===`ArrowDown`?(t.preventDefault(),e.onNavigate(0,1)):t.key===`ArrowUp`?(t.preventDefault(),e.onNavigate(0,-1)):t.key===`ArrowRight`?(t.preventDefault(),e.onNavigate(1,0)):t.key===`ArrowLeft`&&(t.preventDefault(),e.onNavigate(-1,0))}}i(()=>{window.addEventListener(`keydown`,r)}),t(()=>{window.removeEventListener(`keydown`,r)})}function _t(e=100){let t=T([]),n=-1;function r(){return n>0}function i(){return n<t.value.length-1}function a(r){let i=JSON.stringify(r);for(n<t.value.length-1&&(t.value=t.value.slice(0,n+1)),t.value.push(i),n=t.value.length-1;t.value.length>e;)t.value.shift(),n--}function o(){return r()?(n--,JSON.parse(t.value[n])):null}function s(){return i()?(n++,JSON.parse(t.value[n])):null}function c(){t.value=[],n=-1}return{canUndo:r,canRedo:i,record:a,undo:o,redo:s,reset:c}}var vt={1:`#ef4444`,2:`#f97316`,3:`#f59e0b`,4:`#eab308`,5:`#84cc16`,6:`#22c55e`,7:`#14b8a6`,8:`#3b82f6`,9:`#6366f1`},yt={label:`优先级`,markers:Array.from({length:9},(e,t)=>{let n=t+1,r=vt[n];return{id:`priority-${n}`,label:`优先级 ${n}`,svg:`<circle cx="12" cy="12" r="10" fill="${r}"/><text x="12" y="16" text-anchor="middle" font-size="12" font-weight="700" fill="#fff" font-family="sans-serif">${n}</text>`}})};function bt(e){if(e===0)return`<circle cx="12" cy="12" r="10" fill="none" stroke="#94a3b8" stroke-width="2"/>`;if(e===100)return`<circle cx="12" cy="12" r="10" fill="#22c55e"/>`;let t=e/100*2*Math.PI,n=12+10*Math.sin(t),r=12-10*Math.cos(t);return`<circle cx="12" cy="12" r="10" fill="none" stroke="#e2e8f0" stroke-width="2"/><path d="M 12 12 L 12 2 A 10 10 0 ${+(e>50)} 1 ${n.toFixed(2)} ${r.toFixed(2)} Z" fill="#3b82f6"/><circle cx="12" cy="12" r="10" fill="none" stroke="#cbd5e1" stroke-width="1"/>`}var xt=[yt,{label:`进度`,markers:[0,25,50,75,100].map(e=>({id:`progress-${e}`,label:`进度 ${e}%`,svg:bt(e)}))},{label:`旗帜`,markers:[{id:`flag-red`,label:`红旗`,color:`#ef4444`},{id:`flag-orange`,label:`橙旗`,color:`#f97316`},{id:`flag-yellow`,label:`黄旗`,color:`#eab308`},{id:`flag-green`,label:`绿旗`,color:`#22c55e`},{id:`flag-blue`,label:`蓝旗`,color:`#3b82f6`},{id:`flag-gray`,label:`灰旗`,color:`#94a3b8`}].map(e=>({id:e.id,label:e.label,svg:`<path d="M6 3 V21" stroke="#475569" stroke-width="2" stroke-linecap="round"/><path d="M6 4 H18 L15 7 L18 10 H6 Z" fill="${e.color}" stroke="${e.color}" stroke-width="1" stroke-linejoin="round"/>`}))},{label:`星标`,markers:[{id:`star`,label:`星标`,svg:`<path d="M12 2 L14.5 8.5 L21 9 L16 13.5 L17.5 20 L12 16.5 L6.5 20 L8 13.5 L3 9 L9.5 8.5 Z" fill="#f59e0b" stroke="#f59e0b" stroke-width="1" stroke-linejoin="round"/>`},{id:`star-half`,label:`半星`,svg:`<path d="M12 2 L14.5 8.5 L21 9 L16 13.5 L17.5 20 L12 16.5 L6.5 20 L8 13.5 L3 9 L9.5 8.5 Z" fill="#e2e8f0" stroke="#f59e0b" stroke-width="1.5" stroke-linejoin="round"/><path d="M12 2 L12 16.5 L6.5 20 L8 13.5 L3 9 L9.5 8.5 Z" fill="#f59e0b" stroke="none"/>`}]},{label:`其他`,markers:[{id:`smile`,label:`微笑`,svg:`<circle cx="12" cy="12" r="10" fill="#fef3c7" stroke="#f59e0b" stroke-width="1.5"/><circle cx="9" cy="10" r="1.2" fill="#92400e"/><circle cx="15" cy="10" r="1.2" fill="#92400e"/><path d="M8 14 Q12 17 16 14" stroke="#92400e" stroke-width="1.5" fill="none" stroke-linecap="round"/>`},{id:`people`,label:`人员`,svg:`<circle cx="9" cy="8" r="2.5" fill="#3b82f6"/><circle cx="16" cy="8" r="2.5" fill="#3b82f6"/><path d="M4 19 C4 15 6 13 9 13 C12 13 14 15 14 19" fill="#3b82f6"/><path d="M14 19 C14 15.5 15.5 13.5 17.5 13.5 C19.5 13.5 21 15.5 21 19" fill="#3b82f6"/>`},{id:`arrow-up`,label:`上箭头`,svg:`<circle cx="12" cy="12" r="10" fill="#dbeafe" stroke="#3b82f6" stroke-width="1.5"/><path d="M12 17 V7 M8 11 L12 7 L16 11" stroke="#3b82f6" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`},{id:`arrow-down`,label:`下箭头`,svg:`<circle cx="12" cy="12" r="10" fill="#dbeafe" stroke="#3b82f6" stroke-width="1.5"/><path d="M12 7 V17 M8 13 L12 17 L16 13" stroke="#3b82f6" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`},{id:`arrow-right`,label:`右箭头`,svg:`<circle cx="12" cy="12" r="10" fill="#dbeafe" stroke="#3b82f6" stroke-width="1.5"/><path d="M7 12 H17 M13 8 L17 12 L13 16" stroke="#3b82f6" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`},{id:`arrow-left`,label:`左箭头`,svg:`<circle cx="12" cy="12" r="10" fill="#dbeafe" stroke="#3b82f6" stroke-width="1.5"/><path d="M17 12 H7 M11 8 L7 12 L11 16" stroke="#3b82f6" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`}]}],St={};for(let e of xt)for(let t of e.markers)St[t.id]=t;function Ct(e){return St[e]?.svg??``}function wt(e){return St[e]?.label??e}function Tt(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;let n=Math.abs(t)%360;return{background:`hsl(${n}, 85%, 92%)`,borderColor:`hsl(${n}, 60%, 70%)`,color:`hsl(${n}, 55%, 30%)`}}var Et={key:5,class:`zm-marker-picker`},Dt={class:`zm-marker-group-label`},Ot={class:`zm-marker-grid`},kt=[`title`,`onClick`,`innerHTML`],At=b({__name:`NodeContextMenu`,props:{x:{},y:{},container:{},hasImage:{type:Boolean,default:!1},hasLink:{type:Boolean,default:!1},hasNote:{type:Boolean,default:!1},hasCode:{type:Boolean,default:!1},hasTable:{type:Boolean,default:!1},nodeMarkers:{default:()=>[]},nodeTags:{default:()=>[]}},emits:[`pickImage`,`setLink`,`removeLink`,`editNote`,`removeNote`,`removeImage`,`addCode`,`editCode`,`removeCode`,`addTable`,`editTable`,`removeTable`,`toggleMarker`,`clearMarkers`,`addTag`,`removeTags`,`addRelation`,`close`],setup(e,{emit:r}){let i=e,a=r,s=j(()=>{let e=i.x+2,t=i.y+2;if(i.container){let n=i.container.getBoundingClientRect(),r=4+(3+ +!!i.hasImage+ +!!i.hasLink+ +!!i.hasNote+1+ +!!i.hasCode+1+ +!!i.hasTable+1+ +(i.nodeTags.length>0)+1)*28;e+180>n.right&&(e=Math.max(n.left+4,i.x-180-2)),t+r>n.bottom&&(t=Math.max(n.top+4,i.y-r-2)),e<n.left+2&&(e=n.left+2),t<n.top+2&&(t=n.top+2)}return{left:e,top:t}}),c=j(()=>i.hasImage),l=j(()=>i.hasLink),d=j(()=>i.hasNote),h=j(()=>i.nodeMarkers.length>0),g=j(()=>i.nodeTags.length>0),_=T(!1);function v(){_.value=!_.value}function y(e){return i.nodeMarkers.includes(e)}function b(e){a(`toggleMarker`,e)}function S(e){let t=e.target;t&&t.closest(`.zm-node-menu`)||a(`close`)}function C(e){e.key===`Escape`&&a(`close`)}function E(){a(`close`)}window.addEventListener(`mousedown`,S,!0),window.addEventListener(`keydown`,C,!0),window.addEventListener(`wheel`,E,!0),window.addEventListener(`scroll`,E,!0),t(()=>{window.removeEventListener(`mousedown`,S,!0),window.removeEventListener(`keydown`,C,!0),window.removeEventListener(`wheel`,E,!0),window.removeEventListener(`scroll`,E,!0)});function O(e){e(),a(`close`)}return(t,r)=>(m(),u(`div`,{class:`zm-node-menu`,style:f({left:s.value.left+`px`,top:s.value.top+`px`}),onContextmenu:r[14]||=w(()=>{},[`prevent`])},[N(`button`,{class:`zm-node-menu-item`,onClick:r[0]||=w(e=>O(()=>a(`pickImage`)),[`stop`])},[n(L,{name:`image`,size:13}),N(`span`,null,D(c.value?`替换图片`:`添加图片`),1)]),c.value?(m(),u(`button`,{key:0,class:`zm-node-menu-item`,onClick:r[1]||=w(e=>O(()=>a(`removeImage`)),[`stop`])},[n(L,{name:`x`,size:13}),r[15]||=N(`span`,null,`移除图片`,-1)])):M(``,!0),N(`button`,{class:`zm-node-menu-item`,onClick:r[2]||=w(e=>O(()=>a(`setLink`)),[`stop`])},[n(L,{name:`link`,size:13}),N(`span`,null,D(l.value?`编辑链接`:`添加链接`),1)]),l.value?(m(),u(`button`,{key:1,class:`zm-node-menu-item`,onClick:r[3]||=w(e=>O(()=>a(`removeLink`)),[`stop`])},[n(L,{name:`x`,size:13}),r[16]||=N(`span`,null,`移除链接`,-1)])):M(``,!0),N(`button`,{class:`zm-node-menu-item`,onClick:r[4]||=w(e=>O(()=>a(`addCode`)),[`stop`])},[r[17]||=N(`span`,{class:`zm-node-menu-icon zm-node-menu-icon-code`,"aria-hidden":`true`},`{ }`,-1),N(`span`,null,D(e.hasCode?`编辑代码块`:`添加代码块`),1)]),e.hasCode?(m(),u(`button`,{key:2,class:`zm-node-menu-item`,onClick:r[5]||=w(e=>O(()=>a(`removeCode`)),[`stop`])},[n(L,{name:`x`,size:13}),r[18]||=N(`span`,null,`移除代码块`,-1)])):M(``,!0),N(`button`,{class:`zm-node-menu-item`,onClick:r[6]||=w(e=>O(()=>a(`addTable`)),[`stop`])},[r[19]||=N(`span`,{class:`zm-node-menu-icon zm-node-menu-icon-table`,"aria-hidden":`true`},`▦`,-1),N(`span`,null,D(e.hasTable?`编辑表格`:`添加表格`),1)]),e.hasTable?(m(),u(`button`,{key:3,class:`zm-node-menu-item`,onClick:r[7]||=w(e=>O(()=>a(`removeTable`)),[`stop`])},[n(L,{name:`x`,size:13}),r[20]||=N(`span`,null,`移除表格`,-1)])):M(``,!0),N(`button`,{class:`zm-node-menu-item`,onClick:r[8]||=w(e=>O(()=>a(`editNote`)),[`stop`])},[n(L,{name:`note`,size:13}),N(`span`,null,D(d.value?`编辑笔记`:`添加笔记`),1)]),d.value?(m(),u(`button`,{key:4,class:`zm-node-menu-item`,onClick:r[9]||=w(e=>O(()=>a(`removeNote`)),[`stop`])},[n(L,{name:`x`,size:13}),r[21]||=N(`span`,null,`移除笔记`,-1)])):M(``,!0),r[27]||=N(`div`,{class:`zm-node-menu-divider`},null,-1),N(`button`,{class:`zm-node-menu-item`,onClick:w(v,[`stop`])},[r[22]||=N(`span`,{class:`zm-node-menu-icon`,"aria-hidden":`true`},`⚑`,-1),r[23]||=N(`span`,null,`标记图标`,-1),N(`span`,{class:p([`zm-node-menu-arrow`,{"is-open":_.value}])},`›`,2)]),_.value?(m(),u(`div`,Et,[(m(!0),u(x,null,o(P(xt),e=>(m(),u(`div`,{key:e.label,class:`zm-marker-group`},[N(`div`,Dt,D(e.label),1),N(`div`,Ot,[(m(!0),u(x,null,o(e.markers,e=>(m(),u(`button`,{key:e.id,class:p([`zm-marker-cell`,{"is-active":y(e.id)}]),title:e.label,onClick:w(t=>b(e.id),[`stop`]),innerHTML:`<svg viewBox="0 0 24 24" width="20" height="20">`+P(Ct)(e.id)+`</svg>`},null,10,kt))),128))])]))),128)),h.value?(m(),u(`button`,{key:0,class:`zm-marker-clear`,onClick:r[10]||=w(e=>a(`clearMarkers`),[`stop`])},` 清除所有标记 `)):M(``,!0)])):M(``,!0),N(`button`,{class:`zm-node-menu-item`,onClick:r[11]||=w(e=>O(()=>a(`addTag`)),[`stop`])},[r[24]||=N(`span`,{class:`zm-node-menu-icon`,"aria-hidden":`true`},`#`,-1),N(`span`,null,D(g.value?`编辑标签`:`添加标签`),1)]),g.value?(m(),u(`button`,{key:6,class:`zm-node-menu-item`,onClick:r[12]||=w(e=>O(()=>a(`removeTags`)),[`stop`])},[n(L,{name:`x`,size:13}),r[25]||=N(`span`,null,`移除标签`,-1)])):M(``,!0),r[28]||=N(`div`,{class:`zm-node-menu-divider`},null,-1),N(`button`,{class:`zm-node-menu-item`,onClick:r[13]||=w(e=>O(()=>a(`addRelation`)),[`stop`])},[n(L,{name:`relation`,size:13}),r[26]||=N(`span`,null,`添加联系`,-1)])],36))}}),jt=b({__name:`CanvasContextMenu`,props:{x:{},y:{},container:{}},emits:[`openSettings`,`openData`,`openImport`,`exportPng`,`exportSvg`,`close`],setup(e,{emit:r}){let i=e,a=r,o=j(()=>{let e=i.x+2,t=i.y+2;if(i.container){let n=i.container.getBoundingClientRect();e+160>n.right&&(e=Math.max(n.left+4,i.x-160-2)),t+121>n.bottom&&(t=Math.max(n.top+4,i.y-121-2)),e<n.left+2&&(e=n.left+2),t<n.top+2&&(t=n.top+2)}return{left:e,top:t}}),s=T(null),c=T(null),l=T(null),d=j(()=>{let e=s.value===`import`?c.value:s.value===`export`?l.value:null;if(!e)return{left:`-9999px`,top:`-9999px`,display:`none`};let t=e.getBoundingClientRect(),n=window.innerWidth,r=window.innerHeight,i=t.right;i+176>n-4&&(i=Math.max(4,t.left-176));let a=t.top-4;return a+88>r-4&&(a=Math.max(4,r-88-4)),{left:i+`px`,top:a+`px`,display:`block`}}),h=null,g=null;function _(e){g&&=(clearTimeout(g),null),h=setTimeout(()=>{s.value=e},60)}function v(){h&&=(clearTimeout(h),null),g=setTimeout(()=>{s.value=null},120)}t(()=>{h&&clearTimeout(h),g&&clearTimeout(g)});function y(e){let t=e.target;t&&t.closest(`.zm-canvas-menu`)||a(`close`)}function b(e){e.key===`Escape`&&a(`close`)}function x(){a(`close`)}window.addEventListener(`mousedown`,y,!0),window.addEventListener(`keydown`,b,!0),window.addEventListener(`wheel`,x,!0),window.addEventListener(`scroll`,x,!0),t(()=>{window.removeEventListener(`mousedown`,y,!0),window.removeEventListener(`keydown`,b,!0),window.removeEventListener(`wheel`,x,!0),window.removeEventListener(`scroll`,x,!0)});function S(e){e(),a(`close`)}return(e,t)=>(m(),u(`div`,{class:`zm-canvas-menu`,style:f({left:o.value.left+`px`,top:o.value.top+`px`}),onContextmenu:t[11]||=w(()=>{},[`prevent`])},[N(`button`,{class:`zm-canvas-menu-item`,onClick:t[0]||=w(e=>S(()=>a(`openData`)),[`stop`])},[n(L,{name:`database`,size:13,stroke:1.6}),t[12]||=N(`span`,null,`查看数据`,-1)]),N(`div`,{ref_key:`importItemRef`,ref:c,class:p([`zm-canvas-menu-item zm-canvas-menu-item-has-submenu`,{"is-open":s.value===`import`}]),onMouseenter:t[5]||=e=>_(`import`),onMouseleave:v},[n(L,{name:`import`,size:13,stroke:1.6}),t[16]||=N(`span`,null,`导入`,-1),t[17]||=N(`svg`,{class:`zm-canvas-menu-caret`,width:`8`,height:`8`,viewBox:`0 0 8 8`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[N(`polyline`,{points:`2.5 1.8 5.2 4 2.5 6.2`})],-1),s.value===`import`?(m(),u(`div`,{key:0,class:`zm-canvas-submenu`,style:f(d.value),onMouseenter:t[4]||=e=>_(`import`),onMouseleave:v},[N(`button`,{class:`zm-canvas-menu-item`,onClick:t[1]||=w(e=>S(()=>a(`openImport`,`markdown`)),[`stop`])},[n(L,{name:`markdown`,size:13,stroke:1.6}),t[13]||=N(`span`,null,`Markdown 导入`,-1)]),N(`button`,{class:`zm-canvas-menu-item`,onClick:t[2]||=w(e=>S(()=>a(`openImport`,`json`)),[`stop`])},[n(L,{name:`json`,size:13,stroke:1.6}),t[14]||=N(`span`,null,`JSON 文件导入`,-1)]),N(`button`,{class:`zm-canvas-menu-item`,onClick:t[3]||=w(e=>S(()=>a(`openImport`,`txt`)),[`stop`])},[n(L,{name:`txt`,size:13,stroke:1.6}),t[15]||=N(`span`,null,`TXT 文件导入`,-1)])],36)):M(``,!0)],34),N(`button`,{class:`zm-canvas-menu-item`,onClick:t[6]||=w(e=>S(()=>a(`openSettings`)),[`stop`])},[n(L,{name:`settings`,size:13,stroke:1.6}),t[18]||=N(`span`,null,`设置`,-1)]),t[23]||=N(`div`,{class:`zm-canvas-menu-divider`},null,-1),N(`div`,{ref_key:`exportItemRef`,ref:l,class:p([`zm-canvas-menu-item zm-canvas-menu-item-has-submenu`,{"is-open":s.value===`export`}]),onMouseenter:t[10]||=e=>_(`export`),onMouseleave:v},[n(L,{name:`export`,size:13,stroke:1.6}),t[21]||=N(`span`,null,`导出`,-1),t[22]||=N(`svg`,{class:`zm-canvas-menu-caret`,width:`8`,height:`8`,viewBox:`0 0 8 8`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[N(`polyline`,{points:`2.5 1.8 5.2 4 2.5 6.2`})],-1),s.value===`export`?(m(),u(`div`,{key:0,class:`zm-canvas-submenu`,style:f(d.value),onMouseenter:t[9]||=e=>_(`export`),onMouseleave:v},[N(`button`,{class:`zm-canvas-menu-item`,onClick:t[7]||=w(e=>S(()=>a(`exportPng`)),[`stop`])},[n(L,{name:`image`,size:13,stroke:1.6}),t[19]||=N(`span`,null,`导出 PNG`,-1)]),N(`button`,{class:`zm-canvas-menu-item`,onClick:t[8]||=w(e=>S(()=>a(`exportSvg`)),[`stop`])},[n(L,{name:`svg-export`,size:13,stroke:1.6}),t[20]||=N(`span`,null,`导出 SVG`,-1)])],36)):M(``,!0)],34)],36))}}),Mt=[`aria-hidden`],Nt=[`aria-hidden`],Pt={key:0,class:`zm-drawer-header`},Ft={key:0,class:`zm-drawer-title`},It={class:`zm-drawer-body`},Lt=[`aria-hidden`],Rt={key:0,class:`zm-drawer-header`},zt={key:0,class:`zm-drawer-title`},Bt={class:`zm-drawer-body`},Vt=b({__name:`Drawer`,props:{side:{default:`left`},width:{default:320},open:{type:Boolean,default:!0},title:{default:``},scope:{default:`page`},closable:{type:Boolean,default:!0},closeOnBackdrop:{type:Boolean,default:!0}},emits:[`update:open`],setup(e,{emit:t}){let r=t;function i(){r(`update:open`,!1)}function a(){r(`update:open`,!1)}return(t,r)=>e.scope===`canvas`?(m(),u(x,{key:0},[n(O,{name:`zm-fade`},{default:k(()=>[e.open?(m(),u(`div`,{key:0,class:`zm-drawer-canvas-backdrop`,"aria-hidden":!e.open,onClick:r[0]||=t=>e.closeOnBackdrop&&a()},null,8,Mt)):M(``,!0)]),_:1}),n(O,{name:e.side===`left`?`zm-slide-left`:`zm-slide-right`},{default:k(()=>[e.open?(m(),u(`aside`,{key:0,class:p([`zm-drawer zm-drawer--canvas`,[`zm-drawer--`+e.side]]),style:f({width:e.width+`px`}),"aria-hidden":!e.open},[e.title||t.$slots.header?(m(),u(`div`,Pt,[e.title?(m(),u(`h3`,Ft,D(e.title),1)):M(``,!0),E(t.$slots,`header`),e.closable?(m(),u(`button`,{key:1,class:`zm-drawer-close`,title:`关闭`,onClick:i},[...r[1]||=[N(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[N(`path`,{d:`M6 6 L18 18 M18 6 L6 18`})],-1)]])):M(``,!0)])):M(``,!0),N(`div`,It,[E(t.$slots,`default`)])],14,Nt)):M(``,!0)]),_:3},8,[`name`])],64)):(m(),g(O,{key:1,name:`zm-drawer`},{default:k(()=>[e.open?(m(),u(`aside`,{key:0,class:p([`zm-drawer`,[`zm-drawer--`+e.side,{"is-open":e.open}]]),style:f({width:e.width+`px`}),"aria-hidden":!e.open},[e.title||t.$slots.header?(m(),u(`div`,Rt,[e.title?(m(),u(`h3`,zt,D(e.title),1)):M(``,!0),E(t.$slots,`header`),e.closable?(m(),u(`button`,{key:1,class:`zm-drawer-close`,title:`关闭`,onClick:i},[...r[2]||=[N(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[N(`path`,{d:`M6 6 L18 18 M18 6 L6 18`})],-1)]])):M(``,!0)])):M(``,!0),N(`div`,Bt,[E(t.$slots,`default`)])],14,Lt)):M(``,!0)]),_:3}))}}),Ht={class:`zm-outline-root`},Ut={class:`zm-outline-search`},Wt={key:0,class:`zm-outline-search-count`},Gt={key:1,class:`zm-outline-search-count zm-outline-search-empty`},Kt={class:`zm-outline-actions`},qt={width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Jt={key:0,x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`},Yt={key:1,d:`M5 12 L10 17 L19 7`},Xt={class:`zm-outline`},Zt=[`data-outline-id`,`onClick`,`onDblclick`,`onDragstart`,`onDragover`,`onDragleave`,`onDrop`],Qt=[`title`,`onClick`],$t={width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"stroke-linejoin":`round`},en={key:0,points:`6 9 12 15 18 9`},tn={key:1,points:`9 6 15 12 9 18`},nn={key:1,class:`zm-outline-dot`},rn={key:2,class:`zm-outline-index`},an={key:4,class:`zm-outline-text`},on=[`onClick`],sn=[`onClick`],cn=[`src`],ln=[`onClick`],un=[`src`],dn=[`title`,`onClick`],fn={width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},pn={key:0,x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`},mn={key:1,d:`M5 12 L10 17 L19 7`},hn=b({__name:`Outline`,props:{data:{},selectedId:{default:null},collapsedIds:{default:()=>new Set},readonly:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1}},emits:[`select`,`toggleCollapse`,`edit`,`addChild`,`addSibling`,`move`],setup(e,{emit:n}){let r=e,a=n,c=T(``),l=T(null),d=T(-1),h=j(()=>{let e=c.value.trim().toLowerCase();if(!e)return new Set;let t=new Set,n=r=>{var i;(r.text.toLowerCase().includes(e)||(i=r.note)!=null&&i.text&&r.note.text.toLowerCase().includes(e))&&t.add(r.id);for(let e of r.children)n(e)};return n(r.data),t}),g=j(()=>{if(h.value.size===0)return new Set;let e=new Set,t=n=>{let r=h.value.has(n.id);for(let e of n.children)t(e)&&(r=!0);return r&&e.add(n.id),r};return t(r.data),e}),_=j(()=>{let e=[],t=n=>{h.value.has(n.id)&&e.push(n.id);for(let e of n.children)t(e)};return t(r.data),e}),v=j(()=>c.value.trim().length>0),y=j(()=>{let e=[],t=g.value,n=(i,a,o)=>{if(v.value&&!t.has(i.id))return;let s=i.children.length>0,c=v.value?!1:r.collapsedIds.has(i.id);e.push({id:i.id,text:i.text||`(无标题)`,depth:a,siblingIndex:o,hasChildren:s,collapsed:c,node:i}),s&&!c&&i.children.forEach((e,t)=>n(e,a+1,t))};return n(r.data,0,0),e});function b(){d.value=_.value.length>0?0:-1}function C(){let e=_.value;e.length!==0&&(d.value=(d.value+1)%e.length,k(d.value))}function E(){let e=_.value;e.length!==0&&(d.value=(d.value-1+e.length)%e.length,k(d.value))}function O(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?E():C()):e.key===`Escape`&&(e.preventDefault(),c.value=``,d.value=-1)}function k(e){let t=_.value[e];if(!t)return;let n=y.value.find(e=>e.id===t);n&&a(`select`,n.node),s(()=>{document.querySelector(`[data-outline-id="${t}"]`)?.scrollIntoView({block:`nearest`,behavior:`smooth`})})}function ee(){c.value=``,d.value=-1}i(()=>{s(()=>l.value?.focus())});let F=T(null),I=T(``),te=null;function ne(e){r.readonly||(F.value=e.id,I.value=e.text,s(()=>{te=document.querySelector(`.zm-outline-input`),te?.focus(),te?.select()}))}function re(){F.value!=null&&(a(`edit`,{id:F.value,text:I.value.trim()||`(无标题)`}),L())}function L(){F.value=null,I.value=``,te=null}function z(e){e.key===`Enter`?(e.preventDefault(),re()):e.key===`Escape`&&(e.preventDefault(),L())}t(L);let B=T(null),ae=T(null),V=T(null);function oe(e,t){if(r.readonly){e.preventDefault();return}B.value={id:t.id,text:t.text},e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.id))}function se(){B.value=null,ae.value=null,V.value=null}function ce(e,t){if(!B.value)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`);let n=de(e);ae.value=t.id,V.value=n}function le(e){ae.value===e.id&&(ae.value=null,V.value=null)}function ue(e,t){e.preventDefault();let n=B.value;if(!n)return;let r=de(e);n.id!==t.id&&a(`move`,{srcId:n.id,targetId:t.id,position:r}),se()}function de(e,t){let n=e.currentTarget.getBoundingClientRect(),r=e.clientY-n.top,i=n.height;return r<i*.3?`before`:r>i*.7?`after`:`child`}let fe=T(null),pe=null;async function me(e){try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);t.value=e,document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand(`copy`)}finally{document.body.removeChild(t)}return n}}async function he(e,t,n){e.stopPropagation(),await me(t)&&(fe.value=n,pe&&clearTimeout(pe),pe=setTimeout(()=>fe.value=null,1200))}let ge=j(()=>{let e=[],t=(n,r)=>{let i=` `.repeat(r),a=r===0?``:`- `;e.push(i+a+(n.text||``));for(let e of n.children)t(e,r+1)};return t(r.data,0),e.join(`
|
|
15
|
-
`)}),H=T(!1),_e=null;async function ve(){await me(ge.value)&&(H.value=!0,_e&&clearTimeout(_e),_e=setTimeout(()=>H.value=!1,1200))}return(t,n)=>(m(),u(`div`,Ht,[N(`div`,Ut,[n[3]||=N(`svg`,{class:`zm-outline-search-icon`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[N(`circle`,{cx:`11`,cy:`11`,r:`7`}),N(`line`,{x1:`20`,y1:`20`,x2:`16`,y2:`16`})],-1),S(N(`input`,{ref_key:`searchInputRef`,ref:l,"onUpdate:modelValue":n[0]||=e=>c.value=e,type:`text`,class:`zm-outline-search-input`,placeholder:`搜索节点… (Enter 下一个, Shift+Enter 上一个)`,onInput:b,onKeydown:O},null,544),[[A,c.value]]),_.value.length>0?(m(),u(`span`,Wt,D(d.value+1)+`/`+D(_.value.length),1)):v.value?(m(),u(`span`,Gt,`无结果`)):M(``,!0),c.value?(m(),u(`button`,{key:2,class:`zm-outline-search-clear`,title:`清除搜索`,onClick:ee},`×`)):M(``,!0)]),N(`div`,Kt,[N(`button`,{class:p([`zm-outline-action-btn`,{"is-success":H.value}]),title:`复制完整大纲为纯文本`,onClick:ve},[(m(),u(`svg`,qt,[H.value?(m(),u(`path`,Yt)):(m(),u(`rect`,Jt)),n[4]||=N(`path`,{d:`M5 15 H4 a2 2 0 0 1 -2 -2 V4 a2 2 0 0 1 2 -2 h9 a2 2 0 0 1 2 2 v1`},null,-1)])),N(`span`,null,D(H.value?`已复制`:`复制大纲`),1)],2)]),N(`ul`,Xt,[(m(!0),u(x,null,o(y.value,t=>(m(),u(`li`,{key:t.id,"data-outline-id":t.id,class:p([`zm-outline-row`,{"is-selected":t.id===e.selectedId,"is-root":t.depth===0,"is-editing":F.value===t.id,"is-search-hit":h.value.has(t.id),"is-search-current":_.value[d.value]===t.id,"is-drag-over-before":ae.value===t.id&&V.value===`before`,"is-drag-over-after":ae.value===t.id&&V.value===`after`,"is-drag-over-child":ae.value===t.id&&V.value===`child`}]),style:f({paddingLeft:12+t.depth*16+`px`}),draggable:`true`,onClick:e=>a(`select`,t.node),onDblclick:e=>ne(t),onDragstart:e=>oe(e,t),onDragend:se,onDragover:e=>ce(e,t),onDragleave:()=>le(t),onDrop:e=>ue(e,t)},[t.hasChildren?(m(),u(`button`,{key:0,class:`zm-outline-toggle`,title:t.collapsed?`展开`:`折叠`,onClick:w(e=>a(`toggleCollapse`,t.id),[`stop`])},[(m(),u(`svg`,$t,[t.collapsed?(m(),u(`polyline`,tn)):(m(),u(`polyline`,en))]))],8,Qt)):(m(),u(`span`,nn)),r.showIndex?(m(),u(`span`,rn,D(t.siblingIndex+1)+`.`,1)):M(``,!0),F.value===t.id?S((m(),u(`input`,{key:3,"onUpdate:modelValue":n[1]||=e=>I.value=e,class:`zm-outline-input`,onBlur:re,onKeydown:z,onClick:n[2]||=w(()=>{},[`stop`])},null,544)),[[A,I.value]]):(m(),u(`span`,an,D(t.text),1)),r.readonly?M(``,!0):(m(),u(`button`,{key:5,class:`zm-outline-row-action`,title:`编辑文字`,onClick:w(e=>ne(t),[`stop`])},[...n[5]||=[N(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[N(`path`,{d:`M4 20 l4 -1 11 -11 -3 -3 -11 11 z`}),N(`line`,{x1:`14`,y1:`6`,x2:`18`,y2:`10`})],-1)]],8,on)),r.readonly?M(``,!0):(m(),u(`button`,{key:6,class:`zm-outline-row-action`,title:`添加同级`,onClick:w(e=>a(`addSibling`,t.id),[`stop`])},[N(`img`,{src:P(ie),width:`14`,height:`14`,alt:`添加同级`,draggable:`false`},null,8,cn)],8,sn)),r.readonly?M(``,!0):(m(),u(`button`,{key:7,class:`zm-outline-row-action`,title:`添加子节点`,onClick:w(e=>a(`addChild`,t.id),[`stop`])},[N(`img`,{src:P(R),width:`14`,height:`14`,alt:`添加子节点`,draggable:`false`},null,8,un)],8,ln)),N(`button`,{class:p([`zm-outline-row-copy`,{"is-success":fe.value===t.id}]),title:fe.value===t.id?`已复制`:`复制节点文本`,onClick:e=>he(e,t.text,t.id)},[(m(),u(`svg`,fn,[fe.value===t.id?(m(),u(`path`,mn)):(m(),u(`rect`,pn)),n[6]||=N(`path`,{d:`M5 15 H4 a2 2 0 0 1 -2 -2 V4 a2 2 0 0 1 2 -2 h9 a2 2 0 0 1 2 2 v1`},null,-1)]))],10,dn)],46,Zt))),128))])]))}}),gn={key:0,class:`zm-jtv-root`},K={key:0,class:`zm-jtv-key`},q={key:1,class:`zm-jtv-colon`},_n={key:2,class:`zm-jtv-key zm-jtv-bracket`},vn={key:3,class:`zm-jtv-size`},yn={key:4,class:`zm-jtv-bracket`},J={key:5,class:`zm-jtv-brace`},bn={key:0,class:`zm-jtv-children`},xn={class:`zm-jtv-key`},Sn={key:0,class:`zm-jtv-key`},Cn=[`src`,`alt`],wn=[`href`],Tn=b({__name:`JsonTreeViewer`,props:{value:{},keyName:{default:``},isRoot:{type:Boolean,default:!0},path:{default:``},depth:{default:0},query:{default:``},collapsedPaths:{default:()=>new Set}},setup(e){let t=e,i=j(()=>t.value===null?`null`:Array.isArray(t.value)?`array`:typeof t.value),s=j(()=>i.value===`object`),c=j(()=>i.value===`array`);j(()=>!s.value&&!c.value);let l=j(()=>{if(c.value)return`Array(${t.value.length})`;if(s.value){let e=t.value,n=Object.keys(e);return`Object(${n.length} ${n.length===1?`key`:`keys`})`}return``}),d=j(()=>c.value?t.value.map((e,t)=>({key:String(t),value:e})):s.value?Object.entries(t.value).map(([e,t])=>({key:e,value:t})):[]),h=j(()=>t.isRoot?`<root>`:t.path),g=j(()=>t.collapsedPaths.has(h.value));function v(e,n,r){e!==`<root>`&&(r<2||typeof n!=`object`||!n||t.collapsedPaths.has(e)||t.collapsedPaths.add(e))}t.isRoot||v(h.value,t.value,t.depth);function y(){g.value?t.collapsedPaths.delete(h.value):t.collapsedPaths.add(h.value)}function b(e){return h.value===``?e:`${h.value}.${e}`}function C(e){if(!t.query)return!0;let n=t.query.toLowerCase();return typeof e==`string`?e.toLowerCase().includes(n):e===null?`null`.includes(n):String(e).toLowerCase().includes(n)}function T(e){return t.query?e.toLowerCase().includes(t.query.toLowerCase()):!0}function E(e,n){return!t.query||T(e)?!0:typeof n!=`object`||!n?C(n):!0}function O(e){return e===null?`null`:typeof e==`string`?e.length>80?`"${e.slice(0,80)}..."`:`"${e}"`:typeof e==`boolean`?e?`true`:`false`:typeof e==`number`?String(e):typeof e>`u`?`undefined`:JSON.stringify(e)}function k(e){if(typeof e!=`string`)return!1;let t=e.trim();return!!(t.startsWith(`data:image/`)||/^https?:\/\/.+\.(png|jpe?g|gif|webp|svg|bmp|ico)(\?.*)?$/i.test(t)||/^https?:\/\/.+/i.test(t)&&/\/[^/]+\.(png|jpe?g|gif|webp|svg|bmp|ico)(\?.*)?$/i.test(t))}function A(e){if(!t.query)return null;let n=e.toLowerCase().indexOf(t.query.toLowerCase());return n<0?null:{before:e.slice(0,n),match:e.slice(n,n+t.query.length),after:e.slice(n+t.query.length)}}return(t,h)=>{let v=a(`JsonTreeViewer`,!0);return e.isRoot?(m(),u(`div`,gn,[(m(!0),u(x,null,o(d.value,t=>S((m(),u(`div`,{key:t.key,class:`zm-jtv-row`},[n(v,{"key-name":t.key,value:t.value,path:b(t.key),depth:e.depth+1,query:e.query,"collapsed-paths":e.collapsedPaths,"is-root":!1},null,8,[`key-name`,`value`,`path`,`depth`,`query`,`collapsed-paths`])])),[[_,E(t.key,t.value)]])),128))])):s.value||c.value?(m(),u(`div`,{key:1,class:p([`zm-jtv-branch`,{"is-collapsed":g.value}])},[N(`div`,{class:`zm-jtv-header`,style:f({paddingLeft:6+e.depth*12+`px`}),onClick:y},[N(`span`,{class:p([`zm-jtv-toggle`,{"is-leaf":!1}])},D(g.value?`▶`:`▼`),1),c.value?M(``,!0):(m(),u(`span`,K,D(e.keyName),1)),c.value?M(``,!0):(m(),u(`span`,q,`:`)),c.value?(m(),u(`span`,_n,`[`)):M(``,!0),g.value?(m(),u(`span`,vn,D(l.value),1)):M(``,!0),g.value&&c.value?(m(),u(`span`,yn,`]`)):M(``,!0),g.value&&s.value?(m(),u(`span`,J,`}`)):M(``,!0)],4),g.value?M(``,!0):(m(),u(`div`,bn,[(m(!0),u(x,null,o(d.value,t=>S((m(),u(`div`,{key:t.key,class:`zm-jtv-row`},[n(v,{"key-name":t.key,value:t.value,path:b(t.key),depth:e.depth+1,query:e.query,"collapsed-paths":e.collapsedPaths,"is-root":!1},null,8,[`key-name`,`value`,`path`,`depth`,`query`,`collapsed-paths`])])),[[_,E(t.key,t.value)]])),128))])),!g.value&&c.value?(m(),u(`div`,{key:1,class:`zm-jtv-footer`,style:f({paddingLeft:6+e.depth*12+`px`})},`]`,4)):M(``,!0),!g.value&&s.value&&!c.value?(m(),u(`div`,{key:2,class:`zm-jtv-footer`,style:f({paddingLeft:6+e.depth*12+`px`})},`}`,4)):M(``,!0)],2)):(m(),u(`div`,{key:2,class:`zm-jtv-leaf`,style:f({paddingLeft:6+e.depth*12+`px`})},[h[2]||=N(`span`,{class:`zm-jtv-toggle is-leaf`},`·`,-1),N(`span`,xn,D(e.keyName),1),h[3]||=N(`span`,{class:`zm-jtv-colon`},`:`,-1),T(e.keyName)&&A(e.keyName)?(m(),u(`span`,Sn,[N(`span`,null,D(A(e.keyName)?.before),1),N(`mark`,null,D(A(e.keyName)?.match),1),N(`span`,null,D(A(e.keyName)?.after),1)])):M(``,!0),N(`span`,{class:p([`zm-jtv-value`,`zm-jtv-${i.value}`])},[A(O(e.value))?(m(),u(x,{key:0},[N(`span`,null,D(A(O(e.value))?.before),1),N(`mark`,null,D(A(O(e.value))?.match),1),N(`span`,null,D(A(O(e.value))?.after),1)],64)):(m(),u(x,{key:1},[r(D(O(e.value)),1)],64))],2),k(e.value)?(m(),u(`span`,{key:1,class:`zm-jtv-thumb-wrap`,onClick:h[1]||=w(()=>{},[`stop`])},[N(`img`,{class:`zm-jtv-thumb`,src:String(e.value),alt:e.keyName,loading:`lazy`,referrerpolicy:`no-referrer`},null,8,Cn),N(`a`,{class:`zm-jtv-thumb-link`,href:String(e.value),target:`_blank`,rel:`noopener noreferrer`,onClick:h[0]||=w(()=>{},[`stop`])},`open`,8,wn)])):M(``,!0)],4))}}}),En={class:`zm-data-panel`},Dn={class:`zm-data-header`},On={class:`zm-data-title`},kn={class:`zm-data-title-meta`},An={class:`zm-data-toolbar`},jn=[`title`],Mn={key:0,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Nn={key:1,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.4`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Pn={key:0,class:`zm-data-paste`},Fn={class:`zm-data-tabs`},In=[`placeholder`],Ln={key:0,class:`zm-data-error`},Rn={class:`zm-data-paste-actions`},zn=[`disabled`],Y={class:`zm-data-tree`},Bn=b({__name:`DataPanel`,props:{data:{},pendingMode:{default:null}},emits:[`import`,`consumed-mode`],setup(t,{emit:i}){let a=t,o=i,s=j(()=>JSON.stringify(a.data,null,2)),c=T(``),l=T(null),f=T(!1),h=T(`json`),g=T(`idle`),_=T(new Set),v=T(``);e(()=>a.pendingMode,e=>{e&&(f.value=!0,h.value=e,o(`consumed-mode`))},{immediate:!0});async function y(){try{await navigator.clipboard.writeText(s.value),g.value=`copied`,setTimeout(()=>g.value=`idle`,1500)}catch{let e=document.createElement(`textarea`);e.value=s.value,document.body.appendChild(e),e.select();try{document.execCommand(`copy`),g.value=`copied`,setTimeout(()=>g.value=`idle`,1500)}finally{document.body.removeChild(e)}}}function b(){let e=new Blob([s.value],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${a.data.text||`mindmap`}.json`,n.click(),URL.revokeObjectURL(t)}function x(){l.value=null;let e=c.value.trim();if(e){if(h.value===`markdown`||h.value===`txt`){try{o(`import`,lt(e)),c.value=``,f.value=!1}catch(e){l.value=(h.value===`txt`?`TXT 解析失败:`:`Markdown 解析失败:`)+e.message}return}try{let t=JSON.parse(e);if(!t.id||!Array.isArray(t.children)){l.value=`JSON 缺少 id 或 children 字段`;return}o(`import`,t),c.value=``,f.value=!1}catch(e){l.value=`JSON 解析失败:`+e.message}}}function C(e){return 1+e.children.reduce((e,t)=>e+C(t),0)}let w=j(()=>C(a.data)),E=j(()=>s.value.length);function O(){let e=document.createElement(`input`);e.type=`file`,e.accept=`application/json`,e.onchange=()=>{let t=e.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>{typeof n.result==`string`&&(c.value=n.result,x())},n.readAsText(t)},e.click()}return(e,i)=>(m(),u(`div`,En,[N(`div`,Dn,[N(`div`,On,[i[8]||=N(`span`,{class:`zm-data-title-text`},`数据 JSON`,-1),N(`span`,kn,D(w.value)+` 节点 · `+D(E.value)+` chars`,1)])]),N(`div`,An,[N(`button`,{class:p([`zm-data-btn is-icon`,{"is-success":g.value===`copied`}]),title:g.value===`copied`?`已复制`:`复制 JSON 到剪贴板`,onClick:y},[g.value===`idle`?(m(),u(`svg`,Mn,[...i[9]||=[N(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`},null,-1),N(`path`,{d:`M5 15 H4 a2 2 0 0 1 -2 -2 V4 a2 2 0 0 1 2 -2 h9 a2 2 0 0 1 2 2 v1`},null,-1)]])):(m(),u(`svg`,Nn,[...i[10]||=[N(`polyline`,{points:`5 12 10 17 19 7`},null,-1)]])),i[11]||=N(`span`,{class:`zm-data-btn-label`},`复制`,-1)],10,jn),N(`button`,{class:`zm-data-btn is-icon`,title:`导出为 JSON 文件`,onClick:b},[...i[12]||=[d(`<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4 V15"></path><polyline points="7 9 12 4 17 9"></polyline><path d="M4 19 H20"></path></svg><span class="zm-data-btn-label">导出</span>`,2)]]),N(`button`,{class:`zm-data-btn is-icon`,title:`从 JSON 文件导入`,onClick:O},[...i[13]||=[d(`<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 15 V4"></path><polyline points="7 9 12 4 17 9"></polyline><path d="M4 19 H20"></path></svg><span class="zm-data-btn-label">导入</span>`,2)]]),N(`button`,{class:p([`zm-data-btn is-icon`,{"is-active":f.value}]),title:`粘贴 JSON 或 Markdown 替换当前数据`,onClick:i[0]||=e=>f.value=!f.value},[...i[14]||=[d(`<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 4 H15 V8 H9 Z"></path><path d="M9 8 H4 V20 H9"></path><path d="M15 8 H20 V20 H15"></path></svg><span class="zm-data-btn-label">粘贴</span>`,2)]],2),i[16]||=N(`div`,{class:`zm-data-toolbar-spacer`},null,-1),N(`div`,{class:p([`zm-data-search`,{"is-active":v.value.length>0}])},[i[15]||=N(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[N(`circle`,{cx:`11`,cy:`11`,r:`7`}),N(`line`,{x1:`20`,y1:`20`,x2:`16`,y2:`16`})],-1),S(N(`input`,{"onUpdate:modelValue":i[1]||=e=>v.value=e,type:`text`,placeholder:`过滤 (键 / 值)`,spellcheck:`false`},null,512),[[A,v.value]]),v.value?(m(),u(`button`,{key:0,class:`zm-data-search-clear`,title:`清空过滤`,onClick:i[2]||=e=>v.value=``},`×`)):M(``,!0)],2)]),f.value?(m(),u(`div`,Pn,[N(`div`,Fn,[N(`button`,{class:p([`zm-data-tab`,{"is-active":h.value===`json`}]),onClick:i[3]||=e=>h.value=`json`},`JSON`,2),N(`button`,{class:p([`zm-data-tab`,{"is-active":h.value===`markdown`}]),onClick:i[4]||=e=>h.value=`markdown`},`Markdown`,2)]),S(N(`textarea`,{"onUpdate:modelValue":i[5]||=e=>c.value=e,placeholder:h.value===`json`?`paste a JSON tree to replace current data`:`paste markdown - # / ## / ### become nodes`,spellcheck:`false`},null,8,In),[[A,c.value]]),l.value?(m(),u(`div`,Ln,D(l.value),1)):M(``,!0),N(`div`,Rn,[N(`button`,{class:`zm-data-btn is-primary`,disabled:!c.value,onClick:x},`应用`,8,zn),N(`button`,{class:`zm-data-btn`,onClick:i[6]||=e=>{c.value=``,l.value=null}},`清空`),N(`button`,{class:`zm-data-btn`,onClick:i[7]||=e=>f.value=!1},`关闭`)])])):M(``,!0),N(`div`,Y,[n(Tn,{value:t.data,query:v.value,"collapsed-paths":_.value},null,8,[`value`,`query`,`collapsed-paths`])]),i[17]||=N(`div`,{class:`zm-data-footer`},[N(`span`,{class:`zm-data-footer-hint`},[r(` 图片支持 `),N(`code`,null,`data:image/...`),r(` / `),N(`code`,null,`https://...`),r(` / `),N(`code`,null,`/imgs/foo.png`),r(` (同源)。本地 `),N(`code`,null,`file://`),r(` 路径被浏览器拒绝。 `)])],-1)]))}}),Vn={class:`zm-md-panel`},Hn={key:0,class:`zm-md-error`},Un={class:`zm-md-split`},Wn={class:`zm-md-edit`},Gn={class:`zm-md-preview`},Kn={class:`zm-md-preview-body`},qn={class:`zm-md-footer`},Jn=[`disabled`],Yn=`# flow-mindmap 思维导图
|
|
14
|
+
`)}),r=m}return n}function ft(e,t=`导入的导图`){let n=dt(e||``),r={id:Ve(),text:t,children:[]},i=[r],a=[0],o=!1;function s(e){if(e.kind===`heading`){let t=e.level;for(;i.length>1&&a[a.length-1]>=t;)i.pop(),a.pop();if(!o&&t===1){o=!0,r.text=e.text,a[0]=1;return}let n={id:Ve(),text:e.text,children:[]};i[i.length-1].children.push(n),i.push(n),a.push(t);return}let t={id:Ve(),text:e.text,children:[],richContent:{kind:e.kind,raw:e.raw,lang:e.lang}};i[i.length-1].children.push(t)}for(let e of n)s(e);return r}function pt(e){let t=e.minScale??.2,n=e.maxScale??1/0,r=e.step??1.2,i=E(1),a=E(0),o=E(0),s=E(!1),c=E(!1),l=y({x:0,y:0,ox:0,oy:0}),u=E(!1),d=y({x:0,y:0}),f=y({x:0,y:0,width:0,height:0}),p=E(0),m=null;function h(e){m=e}function g(r){r.preventDefault();let s=e.getContainer();if(!s)return;let c=-r.deltaY*.001,l=Math.min(n,Math.max(t,i.value*(1+c))),u=s.getBoundingClientRect(),d=r.clientX-u.left,f=r.clientY-u.top,p=(d-a.value)/i.value,m=(f-o.value)/i.value;i.value=l,a.value=d-p*l,o.value=f-m*l}function _(){i.value=Math.min(n,i.value*r)}function v(){i.value=Math.max(t,i.value/r)}function b(e){var t;e.target.closest(`.zm-node, .zm-toolbar, button, input, textarea`)||(s.value=!0,c.value=!1,l.x=e.clientX,l.y=e.clientY,l.ox=a.value,l.oy=o.value,window.addEventListener(`mousemove`,x),window.addEventListener(`mouseup`,S),(t=e.preventDefault)==null||t.call(e))}function x(e){if(!s.value)return;let t=e.clientX-l.x,n=e.clientY-l.y;(Math.abs(t)>3||Math.abs(n)>3)&&(c.value=!0),a.value=l.ox+t,o.value=l.oy+n}function S(){s.value=!1,window.removeEventListener(`mousemove`,x),window.removeEventListener(`mouseup`,S)}function C(e,t,n){u.value=!0,d.x=e,d.y=t,f.x=e,f.y=t,f.width=0,f.height=0,f.shiftKey=!!(n!=null&&n.shift),p.value++,window.addEventListener(`mousemove`,D),window.addEventListener(`mouseup`,T)}function w(e,t){if(!u.value)return;let n=Math.min(d.x,e),r=Math.min(d.y,t),i=Math.max(d.x,e),a=Math.max(d.y,t);f.x=n,f.y=r,f.width=i-n,f.height=a-r,p.value++}function T(){u.value=!1,window.removeEventListener(`mousemove`,D),window.removeEventListener(`mouseup`,T),m&&m()}function D(t){if(!u.value)return;let n=e.getContainer();if(!n)return;let r=n.getBoundingClientRect();w((t.clientX-r.left-a.value)/i.value,(t.clientY-r.top-o.value)/i.value)}function O(t,n,r,s=60){let c=e.getContainer();if(!c)return;let l=c.getBoundingClientRect(),u=(l.width-s*2)/t,d=(l.height-s*2)/n,f=Math.min(1,Math.max(.3,Math.min(u,d)));i.value=f,a.value=l.width/2,o.value=l.height/2-r*f}function k(){let t=e.getContainer();if(!t)return;let n=t.getBoundingClientRect(),r=n.width/2,s=n.height/2,c=(r-a.value)/i.value,l=(s-o.value)/i.value;i.value=1,a.value=r-c,o.value=s-l}function A(t,r,s,c,l=80){let u=e.getContainer();if(!u)return;let d=u.getBoundingClientRect(),f=i.value;(s*f<40||c*f<40)&&(f=Math.min(n,Math.max(1,60/Math.min(s,c)))),i.value=f,a.value=d.width/2-t*f,o.value=d.height/2-r*f}return{scale:i,offsetX:a,offsetY:o,isPanning:s,panMoved:c,onWheel:g,zoomIn:_,zoomOut:v,zoomTo100:k,startPan:b,startMarquee:C,updateMarquee:w,isMarquee:u,marquee:f,marqueeVersion:p,setOnMarqueeEnd:h,resetView:O,centerOn:A}}var mt=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);function ht(e){return mt?e.metaKey:e.ctrlKey}function gt(e){function n(){let t=e.getSelectedId();if(t)return t;if(e.defaultTargetId)return e.defaultTargetId();let n=e.getSelectedIds();return n.length>0?n[0]:null}function r(t){let r=t.target;if(r&&(r.tagName===`INPUT`||r.tagName===`TEXTAREA`||r.isContentEditable)||e.isReadonly()||e.isEditing())return;let i=e.getSelectedId(),a=n();if(a){if(ht(t)&&!t.shiftKey){if(t.key===`d`||t.key===`D`){let n=e.defaultTargetId?.call(e);i&&i!==n&&(t.preventDefault(),e.onDuplicate(i));return}if(t.key===`c`||t.key===`C`){let n=e.getSelectedIds();n.length>0&&(t.preventDefault(),e.onCopy(n));return}if(t.key===`x`||t.key===`X`){let n=e.getSelectedIds();n.length>0&&(t.preventDefault(),e.onCut(n));return}if(t.key===`v`||t.key===`V`){if(!e.hasClipboard())return;t.preventDefault();let n=e.getSelectedIds();e.onPaste(n.length>0?n[0]:null);return}if(t.key===`z`||t.key===`Z`){t.preventDefault(),e.onUndo();return}if(t.key===`y`||t.key===`Y`){t.preventDefault(),e.onRedo();return}if(t.key===`Home`){t.preventDefault(),e.onSelectRoot();return}}if(ht(t)&&t.shiftKey&&(t.key===`Z`||t.key===`z`)){t.preventDefault(),e.onRedo();return}if(t.key===`Tab`)t.preventDefault(),e.onAddChild(a);else if(t.key===`Enter`)if(t.preventDefault(),t.shiftKey){let t=e.defaultTargetId?.call(e);i&&i!==t&&e.onAddSiblingBefore(i)}else e.onAddSibling(a);else if((t.key===`Delete`||t.key===`Backspace`)&&i&&i!==e.defaultTargetId?.call(e))t.preventDefault(),e.onRemove(i);else if(t.key===`F2`&&i)t.preventDefault(),e.onStartEdit(i);else if(t.key===` `&&i)t.preventDefault(),e.onStartEdit(i);else if(t.key===`Escape`)t.preventDefault(),e.onClearSelection();else if(t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey){if(t.key===`ArrowUp`){t.preventDefault(),e.onMoveSibling(-1);return}else if(t.key===`ArrowDown`){t.preventDefault(),e.onMoveSibling(1);return}}else t.key===`ArrowDown`?(t.preventDefault(),e.onNavigate(0,1)):t.key===`ArrowUp`?(t.preventDefault(),e.onNavigate(0,-1)):t.key===`ArrowRight`?(t.preventDefault(),e.onNavigate(1,0)):t.key===`ArrowLeft`&&(t.preventDefault(),e.onNavigate(-1,0))}}s(()=>{window.addEventListener(`keydown`,r)}),t(()=>{window.removeEventListener(`keydown`,r)})}function _t(e=100){let t=E([]),n=-1;function r(){return n>0}function i(){return n<t.value.length-1}function a(r){let i=JSON.stringify(r);for(n<t.value.length-1&&(t.value=t.value.slice(0,n+1)),t.value.push(i),n=t.value.length-1;t.value.length>e;)t.value.shift(),n--}function o(){return r()?(n--,JSON.parse(t.value[n])):null}function s(){return i()?(n++,JSON.parse(t.value[n])):null}function c(){t.value=[],n=-1}return{canUndo:r,canRedo:i,record:a,undo:o,redo:s,reset:c}}var vt={1:`#ef4444`,2:`#f97316`,3:`#f59e0b`,4:`#eab308`,5:`#84cc16`,6:`#22c55e`,7:`#14b8a6`,8:`#3b82f6`,9:`#6366f1`},yt={label:`优先级`,markers:Array.from({length:9},(e,t)=>{let n=t+1,r=vt[n];return{id:`priority-${n}`,label:`优先级 ${n}`,svg:`<circle cx="12" cy="12" r="10" fill="${r}"/><text x="12" y="16" text-anchor="middle" font-size="12" font-weight="700" fill="#fff" font-family="sans-serif">${n}</text>`}})};function bt(e){if(e===0)return`<circle cx="12" cy="12" r="10" fill="none" stroke="#94a3b8" stroke-width="2"/>`;if(e===100)return`<circle cx="12" cy="12" r="10" fill="#22c55e"/>`;let t=e/100*2*Math.PI,n=12+10*Math.sin(t),r=12-10*Math.cos(t);return`<circle cx="12" cy="12" r="10" fill="none" stroke="#e2e8f0" stroke-width="2"/><path d="M 12 12 L 12 2 A 10 10 0 ${+(e>50)} 1 ${n.toFixed(2)} ${r.toFixed(2)} Z" fill="#3b82f6"/><circle cx="12" cy="12" r="10" fill="none" stroke="#cbd5e1" stroke-width="1"/>`}var xt=[yt,{label:`进度`,markers:[0,25,50,75,100].map(e=>({id:`progress-${e}`,label:`进度 ${e}%`,svg:bt(e)}))},{label:`旗帜`,markers:[{id:`flag-red`,label:`红旗`,color:`#ef4444`},{id:`flag-orange`,label:`橙旗`,color:`#f97316`},{id:`flag-yellow`,label:`黄旗`,color:`#eab308`},{id:`flag-green`,label:`绿旗`,color:`#22c55e`},{id:`flag-blue`,label:`蓝旗`,color:`#3b82f6`},{id:`flag-gray`,label:`灰旗`,color:`#94a3b8`}].map(e=>({id:e.id,label:e.label,svg:`<path d="M6 3 V21" stroke="#475569" stroke-width="2" stroke-linecap="round"/><path d="M6 4 H18 L15 7 L18 10 H6 Z" fill="${e.color}" stroke="${e.color}" stroke-width="1" stroke-linejoin="round"/>`}))},{label:`星标`,markers:[{id:`star`,label:`星标`,svg:`<path d="M12 2 L14.5 8.5 L21 9 L16 13.5 L17.5 20 L12 16.5 L6.5 20 L8 13.5 L3 9 L9.5 8.5 Z" fill="#f59e0b" stroke="#f59e0b" stroke-width="1" stroke-linejoin="round"/>`},{id:`star-half`,label:`半星`,svg:`<path d="M12 2 L14.5 8.5 L21 9 L16 13.5 L17.5 20 L12 16.5 L6.5 20 L8 13.5 L3 9 L9.5 8.5 Z" fill="#e2e8f0" stroke="#f59e0b" stroke-width="1.5" stroke-linejoin="round"/><path d="M12 2 L12 16.5 L6.5 20 L8 13.5 L3 9 L9.5 8.5 Z" fill="#f59e0b" stroke="none"/>`}]},{label:`其他`,markers:[{id:`smile`,label:`微笑`,svg:`<circle cx="12" cy="12" r="10" fill="#fef3c7" stroke="#f59e0b" stroke-width="1.5"/><circle cx="9" cy="10" r="1.2" fill="#92400e"/><circle cx="15" cy="10" r="1.2" fill="#92400e"/><path d="M8 14 Q12 17 16 14" stroke="#92400e" stroke-width="1.5" fill="none" stroke-linecap="round"/>`},{id:`people`,label:`人员`,svg:`<circle cx="9" cy="8" r="2.5" fill="#3b82f6"/><circle cx="16" cy="8" r="2.5" fill="#3b82f6"/><path d="M4 19 C4 15 6 13 9 13 C12 13 14 15 14 19" fill="#3b82f6"/><path d="M14 19 C14 15.5 15.5 13.5 17.5 13.5 C19.5 13.5 21 15.5 21 19" fill="#3b82f6"/>`},{id:`arrow-up`,label:`上箭头`,svg:`<circle cx="12" cy="12" r="10" fill="#dbeafe" stroke="#3b82f6" stroke-width="1.5"/><path d="M12 17 V7 M8 11 L12 7 L16 11" stroke="#3b82f6" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`},{id:`arrow-down`,label:`下箭头`,svg:`<circle cx="12" cy="12" r="10" fill="#dbeafe" stroke="#3b82f6" stroke-width="1.5"/><path d="M12 7 V17 M8 13 L12 17 L16 13" stroke="#3b82f6" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`},{id:`arrow-right`,label:`右箭头`,svg:`<circle cx="12" cy="12" r="10" fill="#dbeafe" stroke="#3b82f6" stroke-width="1.5"/><path d="M7 12 H17 M13 8 L17 12 L13 16" stroke="#3b82f6" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`},{id:`arrow-left`,label:`左箭头`,svg:`<circle cx="12" cy="12" r="10" fill="#dbeafe" stroke="#3b82f6" stroke-width="1.5"/><path d="M17 12 H7 M11 8 L7 12 L11 16" stroke="#3b82f6" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`}]}],St={};for(let e of xt)for(let t of e.markers)St[t.id]=t;function Ct(e){return St[e]?.svg??``}function wt(e){return St[e]?.label??e}function Tt(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;let n=Math.abs(t)%360;return{background:`hsl(${n}, 85%, 92%)`,borderColor:`hsl(${n}, 60%, 70%)`,color:`hsl(${n}, 55%, 30%)`}}var Et={key:5,class:`zm-marker-picker`},Dt={class:`zm-marker-group-label`},Ot={class:`zm-marker-grid`},kt=[`title`,`onClick`,`innerHTML`],At=x({__name:`NodeContextMenu`,props:{x:{},y:{},container:{},hasImage:{type:Boolean,default:!1},hasLink:{type:Boolean,default:!1},hasNote:{type:Boolean,default:!1},hasCode:{type:Boolean,default:!1},hasTable:{type:Boolean,default:!1},nodeMarkers:{default:()=>[]},nodeTags:{default:()=>[]}},emits:[`pickImage`,`setLink`,`removeLink`,`editNote`,`removeNote`,`removeImage`,`addCode`,`editCode`,`removeCode`,`addTable`,`editTable`,`removeTable`,`toggleMarker`,`clearMarkers`,`addTag`,`removeTags`,`addRelation`,`close`],setup(e,{emit:i}){let a=e,s=i,l=j(()=>{let e=a.x+2,t=a.y+2;if(a.container){let n=a.container.getBoundingClientRect(),r=4+(3+ +!!a.hasImage+ +!!a.hasLink+ +!!a.hasNote+1+ +!!a.hasCode+1+ +!!a.hasTable+1+ +(a.nodeTags.length>0)+1)*28;e+180>n.right&&(e=Math.max(n.left+4,a.x-180-2)),t+r>n.bottom&&(t=Math.max(n.top+4,a.y-r-2)),e<n.left+2&&(e=n.left+2),t<n.top+2&&(t=n.top+2)}return{left:e,top:t}}),d=j(()=>a.hasImage),f=j(()=>a.hasLink),m=j(()=>a.hasNote),g=j(()=>a.nodeMarkers.length>0),_=j(()=>a.nodeTags.length>0),v=E(!1);function y(){v.value=!v.value}function b(e){return a.nodeMarkers.includes(e)}function x(e){s(`toggleMarker`,e)}function C(e){let t=e.target;t&&t.closest(`.zm-node-menu`)||s(`close`)}function w(e){e.key===`Escape`&&s(`close`)}function D(){s(`close`)}window.addEventListener(`mousedown`,C,!0),window.addEventListener(`keydown`,w,!0),window.addEventListener(`wheel`,D,!0),window.addEventListener(`scroll`,D,!0),t(()=>{window.removeEventListener(`mousedown`,C,!0),window.removeEventListener(`keydown`,w,!0),window.removeEventListener(`wheel`,D,!0),window.removeEventListener(`scroll`,D,!0)});function O(e){e(),s(`close`)}return(t,i)=>(h(),p(`div`,{class:`zm-node-menu`,style:c({left:l.value.left+`px`,top:l.value.top+`px`}),onContextmenu:i[14]||=T(()=>{},[`prevent`])},[N(`button`,{class:`zm-node-menu-item`,onClick:i[0]||=T(e=>O(()=>s(`pickImage`)),[`stop`])},[r(L,{name:`image`,size:13}),N(`span`,null,o(d.value?`替换图片`:`添加图片`),1)]),d.value?(h(),p(`button`,{key:0,class:`zm-node-menu-item`,onClick:i[1]||=T(e=>O(()=>s(`removeImage`)),[`stop`])},[r(L,{name:`x`,size:13}),i[15]||=N(`span`,null,`移除图片`,-1)])):M(``,!0),N(`button`,{class:`zm-node-menu-item`,onClick:i[2]||=T(e=>O(()=>s(`setLink`)),[`stop`])},[r(L,{name:`link`,size:13}),N(`span`,null,o(f.value?`编辑链接`:`添加链接`),1)]),f.value?(h(),p(`button`,{key:1,class:`zm-node-menu-item`,onClick:i[3]||=T(e=>O(()=>s(`removeLink`)),[`stop`])},[r(L,{name:`x`,size:13}),i[16]||=N(`span`,null,`移除链接`,-1)])):M(``,!0),N(`button`,{class:`zm-node-menu-item`,onClick:i[4]||=T(e=>O(()=>s(`addCode`)),[`stop`])},[i[17]||=N(`span`,{class:`zm-node-menu-icon zm-node-menu-icon-code`,"aria-hidden":`true`},`{ }`,-1),N(`span`,null,o(e.hasCode?`编辑代码块`:`添加代码块`),1)]),e.hasCode?(h(),p(`button`,{key:2,class:`zm-node-menu-item`,onClick:i[5]||=T(e=>O(()=>s(`removeCode`)),[`stop`])},[r(L,{name:`x`,size:13}),i[18]||=N(`span`,null,`移除代码块`,-1)])):M(``,!0),N(`button`,{class:`zm-node-menu-item`,onClick:i[6]||=T(e=>O(()=>s(`addTable`)),[`stop`])},[i[19]||=N(`span`,{class:`zm-node-menu-icon zm-node-menu-icon-table`,"aria-hidden":`true`},`▦`,-1),N(`span`,null,o(e.hasTable?`编辑表格`:`添加表格`),1)]),e.hasTable?(h(),p(`button`,{key:3,class:`zm-node-menu-item`,onClick:i[7]||=T(e=>O(()=>s(`removeTable`)),[`stop`])},[r(L,{name:`x`,size:13}),i[20]||=N(`span`,null,`移除表格`,-1)])):M(``,!0),N(`button`,{class:`zm-node-menu-item`,onClick:i[8]||=T(e=>O(()=>s(`editNote`)),[`stop`])},[r(L,{name:`note`,size:13}),N(`span`,null,o(m.value?`编辑笔记`:`添加笔记`),1)]),m.value?(h(),p(`button`,{key:4,class:`zm-node-menu-item`,onClick:i[9]||=T(e=>O(()=>s(`removeNote`)),[`stop`])},[r(L,{name:`x`,size:13}),i[21]||=N(`span`,null,`移除笔记`,-1)])):M(``,!0),i[27]||=N(`div`,{class:`zm-node-menu-divider`},null,-1),N(`button`,{class:`zm-node-menu-item`,onClick:T(y,[`stop`])},[i[22]||=N(`span`,{class:`zm-node-menu-icon`,"aria-hidden":`true`},`⚑`,-1),i[23]||=N(`span`,null,`标记图标`,-1),N(`span`,{class:n([`zm-node-menu-arrow`,{"is-open":v.value}])},`›`,2)]),v.value?(h(),p(`div`,Et,[(h(!0),p(S,null,u(P(xt),e=>(h(),p(`div`,{key:e.label,class:`zm-marker-group`},[N(`div`,Dt,o(e.label),1),N(`div`,Ot,[(h(!0),p(S,null,u(e.markers,e=>(h(),p(`button`,{key:e.id,class:n([`zm-marker-cell`,{"is-active":b(e.id)}]),title:e.label,onClick:T(t=>x(e.id),[`stop`]),innerHTML:`<svg viewBox="0 0 24 24" width="20" height="20">`+P(Ct)(e.id)+`</svg>`},null,10,kt))),128))])]))),128)),g.value?(h(),p(`button`,{key:0,class:`zm-marker-clear`,onClick:i[10]||=T(e=>s(`clearMarkers`),[`stop`])},` 清除所有标记 `)):M(``,!0)])):M(``,!0),N(`button`,{class:`zm-node-menu-item`,onClick:i[11]||=T(e=>O(()=>s(`addTag`)),[`stop`])},[i[24]||=N(`span`,{class:`zm-node-menu-icon`,"aria-hidden":`true`},`#`,-1),N(`span`,null,o(_.value?`编辑标签`:`添加标签`),1)]),_.value?(h(),p(`button`,{key:6,class:`zm-node-menu-item`,onClick:i[12]||=T(e=>O(()=>s(`removeTags`)),[`stop`])},[r(L,{name:`x`,size:13}),i[25]||=N(`span`,null,`移除标签`,-1)])):M(``,!0),i[28]||=N(`div`,{class:`zm-node-menu-divider`},null,-1),N(`button`,{class:`zm-node-menu-item`,onClick:i[13]||=T(e=>O(()=>s(`addRelation`)),[`stop`])},[r(L,{name:`relation`,size:13}),i[26]||=N(`span`,null,`添加联系`,-1)])],36))}}),jt=x({__name:`CanvasContextMenu`,props:{x:{},y:{},container:{}},emits:[`openSettings`,`openData`,`openImport`,`exportPng`,`exportSvg`,`close`],setup(e,{emit:i}){let a=e,o=i,s=j(()=>{let e=a.x+2,t=a.y+2;if(a.container){let n=a.container.getBoundingClientRect();e+160>n.right&&(e=Math.max(n.left+4,a.x-160-2)),t+121>n.bottom&&(t=Math.max(n.top+4,a.y-121-2)),e<n.left+2&&(e=n.left+2),t<n.top+2&&(t=n.top+2)}return{left:e,top:t}}),l=E(null),u=E(null),d=E(null),f=j(()=>{let e=l.value===`import`?u.value:l.value===`export`?d.value:null;if(!e)return{left:`-9999px`,top:`-9999px`,display:`none`};let t=e.getBoundingClientRect(),n=window.innerWidth,r=window.innerHeight,i=t.right;i+176>n-4&&(i=Math.max(4,t.left-176));let a=t.top-4;return a+88>r-4&&(a=Math.max(4,r-88-4)),{left:i+`px`,top:a+`px`,display:`block`}}),m=null,g=null;function _(e){g&&=(clearTimeout(g),null),m=setTimeout(()=>{l.value=e},60)}function v(){m&&=(clearTimeout(m),null),g=setTimeout(()=>{l.value=null},120)}t(()=>{m&&clearTimeout(m),g&&clearTimeout(g)});function y(e){let t=e.target;t&&t.closest(`.zm-canvas-menu`)||o(`close`)}function b(e){e.key===`Escape`&&o(`close`)}function x(){o(`close`)}window.addEventListener(`mousedown`,y,!0),window.addEventListener(`keydown`,b,!0),window.addEventListener(`wheel`,x,!0),window.addEventListener(`scroll`,x,!0),t(()=>{window.removeEventListener(`mousedown`,y,!0),window.removeEventListener(`keydown`,b,!0),window.removeEventListener(`wheel`,x,!0),window.removeEventListener(`scroll`,x,!0)});function S(e){e(),o(`close`)}return(e,t)=>(h(),p(`div`,{class:`zm-canvas-menu`,style:c({left:s.value.left+`px`,top:s.value.top+`px`}),onContextmenu:t[11]||=T(()=>{},[`prevent`])},[N(`button`,{class:`zm-canvas-menu-item`,onClick:t[0]||=T(e=>S(()=>o(`openData`)),[`stop`])},[r(L,{name:`database`,size:13,stroke:1.6}),t[12]||=N(`span`,null,`查看数据`,-1)]),N(`div`,{ref_key:`importItemRef`,ref:u,class:n([`zm-canvas-menu-item zm-canvas-menu-item-has-submenu`,{"is-open":l.value===`import`}]),onMouseenter:t[5]||=e=>_(`import`),onMouseleave:v},[r(L,{name:`import`,size:13,stroke:1.6}),t[16]||=N(`span`,null,`导入`,-1),t[17]||=N(`svg`,{class:`zm-canvas-menu-caret`,width:`8`,height:`8`,viewBox:`0 0 8 8`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[N(`polyline`,{points:`2.5 1.8 5.2 4 2.5 6.2`})],-1),l.value===`import`?(h(),p(`div`,{key:0,class:`zm-canvas-submenu`,style:c(f.value),onMouseenter:t[4]||=e=>_(`import`),onMouseleave:v},[N(`button`,{class:`zm-canvas-menu-item`,onClick:t[1]||=T(e=>S(()=>o(`openImport`,`markdown`)),[`stop`])},[r(L,{name:`markdown`,size:13,stroke:1.6}),t[13]||=N(`span`,null,`Markdown 导入`,-1)]),N(`button`,{class:`zm-canvas-menu-item`,onClick:t[2]||=T(e=>S(()=>o(`openImport`,`json`)),[`stop`])},[r(L,{name:`json`,size:13,stroke:1.6}),t[14]||=N(`span`,null,`JSON 文件导入`,-1)]),N(`button`,{class:`zm-canvas-menu-item`,onClick:t[3]||=T(e=>S(()=>o(`openImport`,`txt`)),[`stop`])},[r(L,{name:`txt`,size:13,stroke:1.6}),t[15]||=N(`span`,null,`TXT 文件导入`,-1)])],36)):M(``,!0)],34),N(`button`,{class:`zm-canvas-menu-item`,onClick:t[6]||=T(e=>S(()=>o(`openSettings`)),[`stop`])},[r(L,{name:`settings`,size:13,stroke:1.6}),t[18]||=N(`span`,null,`设置`,-1)]),t[23]||=N(`div`,{class:`zm-canvas-menu-divider`},null,-1),N(`div`,{ref_key:`exportItemRef`,ref:d,class:n([`zm-canvas-menu-item zm-canvas-menu-item-has-submenu`,{"is-open":l.value===`export`}]),onMouseenter:t[10]||=e=>_(`export`),onMouseleave:v},[r(L,{name:`export`,size:13,stroke:1.6}),t[21]||=N(`span`,null,`导出`,-1),t[22]||=N(`svg`,{class:`zm-canvas-menu-caret`,width:`8`,height:`8`,viewBox:`0 0 8 8`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[N(`polyline`,{points:`2.5 1.8 5.2 4 2.5 6.2`})],-1),l.value===`export`?(h(),p(`div`,{key:0,class:`zm-canvas-submenu`,style:c(f.value),onMouseenter:t[9]||=e=>_(`export`),onMouseleave:v},[N(`button`,{class:`zm-canvas-menu-item`,onClick:t[7]||=T(e=>S(()=>o(`exportPng`)),[`stop`])},[r(L,{name:`image`,size:13,stroke:1.6}),t[19]||=N(`span`,null,`导出 PNG`,-1)]),N(`button`,{class:`zm-canvas-menu-item`,onClick:t[8]||=T(e=>S(()=>o(`exportSvg`)),[`stop`])},[r(L,{name:`svg-export`,size:13,stroke:1.6}),t[20]||=N(`span`,null,`导出 SVG`,-1)])],36)):M(``,!0)],34)],36))}}),Mt=[`aria-hidden`],Nt=[`aria-hidden`],Pt={key:0,class:`zm-drawer-header`},Ft={key:0,class:`zm-drawer-title`},It={class:`zm-drawer-body`},Lt=[`aria-hidden`],Rt={key:0,class:`zm-drawer-header`},zt={key:0,class:`zm-drawer-title`},Bt={class:`zm-drawer-body`},Vt=x({__name:`Drawer`,props:{side:{default:`left`},width:{default:320},open:{type:Boolean,default:!0},title:{default:``},scope:{default:`page`},closable:{type:Boolean,default:!0},closeOnBackdrop:{type:Boolean,default:!0}},emits:[`update:open`],setup(e,{emit:t}){let i=t;function a(){i(`update:open`,!1)}function s(){i(`update:open`,!1)}return(t,i)=>e.scope===`canvas`?(h(),p(S,{key:0},[r(O,{name:`zm-fade`},{default:k(()=>[e.open?(h(),p(`div`,{key:0,class:`zm-drawer-canvas-backdrop`,"aria-hidden":!e.open,onClick:i[0]||=t=>e.closeOnBackdrop&&s()},null,8,Mt)):M(``,!0)]),_:1}),r(O,{name:e.side===`left`?`zm-slide-left`:`zm-slide-right`},{default:k(()=>[e.open?(h(),p(`aside`,{key:0,class:n([`zm-drawer zm-drawer--canvas`,[`zm-drawer--`+e.side]]),style:c({width:e.width+`px`}),"aria-hidden":!e.open},[e.title||t.$slots.header?(h(),p(`div`,Pt,[e.title?(h(),p(`h3`,Ft,o(e.title),1)):M(``,!0),D(t.$slots,`header`),e.closable?(h(),p(`button`,{key:1,class:`zm-drawer-close`,title:`关闭`,onClick:a},[...i[1]||=[N(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[N(`path`,{d:`M6 6 L18 18 M18 6 L6 18`})],-1)]])):M(``,!0)])):M(``,!0),N(`div`,It,[D(t.$slots,`default`)])],14,Nt)):M(``,!0)]),_:3},8,[`name`])],64)):(h(),_(O,{key:1,name:`zm-drawer`},{default:k(()=>[e.open?(h(),p(`aside`,{key:0,class:n([`zm-drawer`,[`zm-drawer--`+e.side,{"is-open":e.open}]]),style:c({width:e.width+`px`}),"aria-hidden":!e.open},[e.title||t.$slots.header?(h(),p(`div`,Rt,[e.title?(h(),p(`h3`,zt,o(e.title),1)):M(``,!0),D(t.$slots,`header`),e.closable?(h(),p(`button`,{key:1,class:`zm-drawer-close`,title:`关闭`,onClick:a},[...i[2]||=[N(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[N(`path`,{d:`M6 6 L18 18 M18 6 L6 18`})],-1)]])):M(``,!0)])):M(``,!0),N(`div`,Bt,[D(t.$slots,`default`)])],14,Lt)):M(``,!0)]),_:3}))}}),Ht={class:`zm-outline-root`},Ut={class:`zm-outline-search`},Wt={key:0,class:`zm-outline-search-count`},Gt={key:1,class:`zm-outline-search-count zm-outline-search-empty`},Kt={class:`zm-outline-actions`},qt={width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Jt={key:0,x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`},Yt={key:1,d:`M5 12 L10 17 L19 7`},Xt={class:`zm-outline`},Zt=[`data-outline-id`,`onClick`,`onDblclick`,`onDragstart`,`onDragover`,`onDragleave`,`onDrop`],Qt=[`title`,`onClick`],$t={width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"stroke-linejoin":`round`},en={key:0,points:`6 9 12 15 18 9`},tn={key:1,points:`9 6 15 12 9 18`},nn={key:1,class:`zm-outline-dot`},rn={key:2,class:`zm-outline-index`},an={key:4,class:`zm-outline-text`},on=[`onClick`],sn=[`onClick`],cn=[`src`],ln=[`onClick`],un=[`src`],dn=[`title`,`onClick`],fn={width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},pn={key:0,x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`},mn={key:1,d:`M5 12 L10 17 L19 7`},hn=x({__name:`Outline`,props:{data:{},selectedId:{default:null},collapsedIds:{default:()=>new Set},readonly:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1}},emits:[`select`,`toggleCollapse`,`edit`,`addChild`,`addSibling`,`move`],setup(e,{emit:r}){let i=e,a=r,l=E(``),f=E(null),m=E(-1),g=j(()=>{let e=l.value.trim().toLowerCase();if(!e)return new Set;let t=new Set,n=r=>{var i;(r.text.toLowerCase().includes(e)||(i=r.note)!=null&&i.text&&r.note.text.toLowerCase().includes(e))&&t.add(r.id);for(let e of r.children)n(e)};return n(i.data),t}),_=j(()=>{if(g.value.size===0)return new Set;let e=new Set,t=n=>{let r=g.value.has(n.id);for(let e of n.children)t(e)&&(r=!0);return r&&e.add(n.id),r};return t(i.data),e}),v=j(()=>{let e=[],t=n=>{g.value.has(n.id)&&e.push(n.id);for(let e of n.children)t(e)};return t(i.data),e}),y=j(()=>l.value.trim().length>0),b=j(()=>{let e=[],t=_.value,n=(r,a,o)=>{if(y.value&&!t.has(r.id))return;let s=r.children.length>0,c=y.value?!1:i.collapsedIds.has(r.id);e.push({id:r.id,text:r.text||`(无标题)`,depth:a,siblingIndex:o,hasChildren:s,collapsed:c,node:r}),s&&!c&&r.children.forEach((e,t)=>n(e,a+1,t))};return n(i.data,0,0),e});function x(){m.value=v.value.length>0?0:-1}function w(){let e=v.value;e.length!==0&&(m.value=(m.value+1)%e.length,k(m.value))}function D(){let e=v.value;e.length!==0&&(m.value=(m.value-1+e.length)%e.length,k(m.value))}function O(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?D():w()):e.key===`Escape`&&(e.preventDefault(),l.value=``,m.value=-1)}function k(e){let t=v.value[e];if(!t)return;let n=b.value.find(e=>e.id===t);n&&a(`select`,n.node),d(()=>{document.querySelector(`[data-outline-id="${t}"]`)?.scrollIntoView({block:`nearest`,behavior:`smooth`})})}function ee(){l.value=``,m.value=-1}s(()=>{d(()=>f.value?.focus())});let F=E(null),I=E(``),te=null;function ne(e){i.readonly||(F.value=e.id,I.value=e.text,d(()=>{te=document.querySelector(`.zm-outline-input`),te?.focus(),te?.select()}))}function re(){F.value!=null&&(a(`edit`,{id:F.value,text:I.value.trim()||`(无标题)`}),L())}function L(){F.value=null,I.value=``,te=null}function z(e){e.key===`Enter`?(e.preventDefault(),re()):e.key===`Escape`&&(e.preventDefault(),L())}t(L);let B=E(null),ae=E(null),V=E(null);function oe(e,t){if(i.readonly){e.preventDefault();return}B.value={id:t.id,text:t.text},e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.id))}function se(){B.value=null,ae.value=null,V.value=null}function ce(e,t){if(!B.value)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`);let n=de(e);ae.value=t.id,V.value=n}function le(e){ae.value===e.id&&(ae.value=null,V.value=null)}function ue(e,t){e.preventDefault();let n=B.value;if(!n)return;let r=de(e);n.id!==t.id&&a(`move`,{srcId:n.id,targetId:t.id,position:r}),se()}function de(e,t){let n=e.currentTarget.getBoundingClientRect(),r=e.clientY-n.top,i=n.height;return r<i*.3?`before`:r>i*.7?`after`:`child`}let fe=E(null),pe=null;async function me(e){try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);t.value=e,document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand(`copy`)}finally{document.body.removeChild(t)}return n}}async function he(e,t,n){e.stopPropagation(),await me(t)&&(fe.value=n,pe&&clearTimeout(pe),pe=setTimeout(()=>fe.value=null,1200))}let ge=j(()=>{let e=[],t=(n,r)=>{let i=` `.repeat(r),a=r===0?``:`- `;e.push(i+a+(n.text||``));for(let e of n.children)t(e,r+1)};return t(i.data,0),e.join(`
|
|
15
|
+
`)}),H=E(!1),_e=null;async function ve(){await me(ge.value)&&(H.value=!0,_e&&clearTimeout(_e),_e=setTimeout(()=>H.value=!1,1200))}return(t,r)=>(h(),p(`div`,Ht,[N(`div`,Ut,[r[3]||=N(`svg`,{class:`zm-outline-search-icon`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[N(`circle`,{cx:`11`,cy:`11`,r:`7`}),N(`line`,{x1:`20`,y1:`20`,x2:`16`,y2:`16`})],-1),C(N(`input`,{ref_key:`searchInputRef`,ref:f,"onUpdate:modelValue":r[0]||=e=>l.value=e,type:`text`,class:`zm-outline-search-input`,placeholder:`搜索节点… (Enter 下一个, Shift+Enter 上一个)`,onInput:x,onKeydown:O},null,544),[[A,l.value]]),v.value.length>0?(h(),p(`span`,Wt,o(m.value+1)+`/`+o(v.value.length),1)):y.value?(h(),p(`span`,Gt,`无结果`)):M(``,!0),l.value?(h(),p(`button`,{key:2,class:`zm-outline-search-clear`,title:`清除搜索`,onClick:ee},`×`)):M(``,!0)]),N(`div`,Kt,[N(`button`,{class:n([`zm-outline-action-btn`,{"is-success":H.value}]),title:`复制完整大纲为纯文本`,onClick:ve},[(h(),p(`svg`,qt,[H.value?(h(),p(`path`,Yt)):(h(),p(`rect`,Jt)),r[4]||=N(`path`,{d:`M5 15 H4 a2 2 0 0 1 -2 -2 V4 a2 2 0 0 1 2 -2 h9 a2 2 0 0 1 2 2 v1`},null,-1)])),N(`span`,null,o(H.value?`已复制`:`复制大纲`),1)],2)]),N(`ul`,Xt,[(h(!0),p(S,null,u(b.value,t=>(h(),p(`li`,{key:t.id,"data-outline-id":t.id,class:n([`zm-outline-row`,{"is-selected":t.id===e.selectedId,"is-root":t.depth===0,"is-editing":F.value===t.id,"is-search-hit":g.value.has(t.id),"is-search-current":v.value[m.value]===t.id,"is-drag-over-before":ae.value===t.id&&V.value===`before`,"is-drag-over-after":ae.value===t.id&&V.value===`after`,"is-drag-over-child":ae.value===t.id&&V.value===`child`}]),style:c({paddingLeft:12+t.depth*16+`px`}),draggable:`true`,onClick:e=>a(`select`,t.node),onDblclick:e=>ne(t),onDragstart:e=>oe(e,t),onDragend:se,onDragover:e=>ce(e,t),onDragleave:()=>le(t),onDrop:e=>ue(e,t)},[t.hasChildren?(h(),p(`button`,{key:0,class:`zm-outline-toggle`,title:t.collapsed?`展开`:`折叠`,onClick:T(e=>a(`toggleCollapse`,t.id),[`stop`])},[(h(),p(`svg`,$t,[t.collapsed?(h(),p(`polyline`,tn)):(h(),p(`polyline`,en))]))],8,Qt)):(h(),p(`span`,nn)),i.showIndex?(h(),p(`span`,rn,o(t.siblingIndex+1)+`.`,1)):M(``,!0),F.value===t.id?C((h(),p(`input`,{key:3,"onUpdate:modelValue":r[1]||=e=>I.value=e,class:`zm-outline-input`,onBlur:re,onKeydown:z,onClick:r[2]||=T(()=>{},[`stop`])},null,544)),[[A,I.value]]):(h(),p(`span`,an,o(t.text),1)),i.readonly?M(``,!0):(h(),p(`button`,{key:5,class:`zm-outline-row-action`,title:`编辑文字`,onClick:T(e=>ne(t),[`stop`])},[...r[5]||=[N(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[N(`path`,{d:`M4 20 l4 -1 11 -11 -3 -3 -11 11 z`}),N(`line`,{x1:`14`,y1:`6`,x2:`18`,y2:`10`})],-1)]],8,on)),i.readonly?M(``,!0):(h(),p(`button`,{key:6,class:`zm-outline-row-action`,title:`添加同级`,onClick:T(e=>a(`addSibling`,t.id),[`stop`])},[N(`img`,{src:P(ie),width:`14`,height:`14`,alt:`添加同级`,draggable:`false`},null,8,cn)],8,sn)),i.readonly?M(``,!0):(h(),p(`button`,{key:7,class:`zm-outline-row-action`,title:`添加子节点`,onClick:T(e=>a(`addChild`,t.id),[`stop`])},[N(`img`,{src:P(R),width:`14`,height:`14`,alt:`添加子节点`,draggable:`false`},null,8,un)],8,ln)),N(`button`,{class:n([`zm-outline-row-copy`,{"is-success":fe.value===t.id}]),title:fe.value===t.id?`已复制`:`复制节点文本`,onClick:e=>he(e,t.text,t.id)},[(h(),p(`svg`,fn,[fe.value===t.id?(h(),p(`path`,mn)):(h(),p(`rect`,pn)),r[6]||=N(`path`,{d:`M5 15 H4 a2 2 0 0 1 -2 -2 V4 a2 2 0 0 1 2 -2 h9 a2 2 0 0 1 2 2 v1`},null,-1)]))],10,dn)],46,Zt))),128))])]))}}),gn={key:0,class:`zm-jtv-root`},K={key:0,class:`zm-jtv-key`},q={key:1,class:`zm-jtv-colon`},_n={key:2,class:`zm-jtv-key zm-jtv-bracket`},vn={key:3,class:`zm-jtv-size`},yn={key:4,class:`zm-jtv-bracket`},J={key:5,class:`zm-jtv-brace`},bn={key:0,class:`zm-jtv-children`},xn={class:`zm-jtv-key`},Sn={key:0,class:`zm-jtv-key`},Cn=[`src`,`alt`],wn=[`href`],Tn=x({__name:`JsonTreeViewer`,props:{value:{},keyName:{default:``},isRoot:{type:Boolean,default:!0},path:{default:``},depth:{default:0},query:{default:``},collapsedPaths:{default:()=>new Set}},setup(e){let t=e,i=j(()=>t.value===null?`null`:Array.isArray(t.value)?`array`:typeof t.value),s=j(()=>i.value===`object`),d=j(()=>i.value===`array`);j(()=>!s.value&&!d.value);let f=j(()=>{if(d.value)return`Array(${t.value.length})`;if(s.value){let e=t.value,n=Object.keys(e);return`Object(${n.length} ${n.length===1?`key`:`keys`})`}return``}),m=j(()=>d.value?t.value.map((e,t)=>({key:String(t),value:e})):s.value?Object.entries(t.value).map(([e,t])=>({key:e,value:t})):[]),g=j(()=>t.isRoot?`<root>`:t.path),_=j(()=>t.collapsedPaths.has(g.value));function y(e,n,r){e!==`<root>`&&(r<2||typeof n!=`object`||!n||t.collapsedPaths.has(e)||t.collapsedPaths.add(e))}t.isRoot||y(g.value,t.value,t.depth);function b(){_.value?t.collapsedPaths.delete(g.value):t.collapsedPaths.add(g.value)}function x(e){return g.value===``?e:`${g.value}.${e}`}function w(e){if(!t.query)return!0;let n=t.query.toLowerCase();return typeof e==`string`?e.toLowerCase().includes(n):e===null?`null`.includes(n):String(e).toLowerCase().includes(n)}function E(e){return t.query?e.toLowerCase().includes(t.query.toLowerCase()):!0}function D(e,n){return!t.query||E(e)?!0:typeof n!=`object`||!n?w(n):!0}function O(e){return e===null?`null`:typeof e==`string`?e.length>80?`"${e.slice(0,80)}..."`:`"${e}"`:typeof e==`boolean`?e?`true`:`false`:typeof e==`number`?String(e):typeof e>`u`?`undefined`:JSON.stringify(e)}function k(e){if(typeof e!=`string`)return!1;let t=e.trim();return!!(t.startsWith(`data:image/`)||/^https?:\/\/.+\.(png|jpe?g|gif|webp|svg|bmp|ico)(\?.*)?$/i.test(t)||/^https?:\/\/.+/i.test(t)&&/\/[^/]+\.(png|jpe?g|gif|webp|svg|bmp|ico)(\?.*)?$/i.test(t))}function A(e){if(!t.query)return null;let n=e.toLowerCase().indexOf(t.query.toLowerCase());return n<0?null:{before:e.slice(0,n),match:e.slice(n,n+t.query.length),after:e.slice(n+t.query.length)}}return(t,g)=>{let y=l(`JsonTreeViewer`,!0);return e.isRoot?(h(),p(`div`,gn,[(h(!0),p(S,null,u(m.value,t=>C((h(),p(`div`,{key:t.key,class:`zm-jtv-row`},[r(y,{"key-name":t.key,value:t.value,path:x(t.key),depth:e.depth+1,query:e.query,"collapsed-paths":e.collapsedPaths,"is-root":!1},null,8,[`key-name`,`value`,`path`,`depth`,`query`,`collapsed-paths`])])),[[v,D(t.key,t.value)]])),128))])):s.value||d.value?(h(),p(`div`,{key:1,class:n([`zm-jtv-branch`,{"is-collapsed":_.value}])},[N(`div`,{class:`zm-jtv-header`,style:c({paddingLeft:6+e.depth*12+`px`}),onClick:b},[N(`span`,{class:n([`zm-jtv-toggle`,{"is-leaf":!1}])},o(_.value?`▶`:`▼`),1),d.value?M(``,!0):(h(),p(`span`,K,o(e.keyName),1)),d.value?M(``,!0):(h(),p(`span`,q,`:`)),d.value?(h(),p(`span`,_n,`[`)):M(``,!0),_.value?(h(),p(`span`,vn,o(f.value),1)):M(``,!0),_.value&&d.value?(h(),p(`span`,yn,`]`)):M(``,!0),_.value&&s.value?(h(),p(`span`,J,`}`)):M(``,!0)],4),_.value?M(``,!0):(h(),p(`div`,bn,[(h(!0),p(S,null,u(m.value,t=>C((h(),p(`div`,{key:t.key,class:`zm-jtv-row`},[r(y,{"key-name":t.key,value:t.value,path:x(t.key),depth:e.depth+1,query:e.query,"collapsed-paths":e.collapsedPaths,"is-root":!1},null,8,[`key-name`,`value`,`path`,`depth`,`query`,`collapsed-paths`])])),[[v,D(t.key,t.value)]])),128))])),!_.value&&d.value?(h(),p(`div`,{key:1,class:`zm-jtv-footer`,style:c({paddingLeft:6+e.depth*12+`px`})},`]`,4)):M(``,!0),!_.value&&s.value&&!d.value?(h(),p(`div`,{key:2,class:`zm-jtv-footer`,style:c({paddingLeft:6+e.depth*12+`px`})},`}`,4)):M(``,!0)],2)):(h(),p(`div`,{key:2,class:`zm-jtv-leaf`,style:c({paddingLeft:6+e.depth*12+`px`})},[g[2]||=N(`span`,{class:`zm-jtv-toggle is-leaf`},`·`,-1),N(`span`,xn,o(e.keyName),1),g[3]||=N(`span`,{class:`zm-jtv-colon`},`:`,-1),E(e.keyName)&&A(e.keyName)?(h(),p(`span`,Sn,[N(`span`,null,o(A(e.keyName)?.before),1),N(`mark`,null,o(A(e.keyName)?.match),1),N(`span`,null,o(A(e.keyName)?.after),1)])):M(``,!0),N(`span`,{class:n([`zm-jtv-value`,`zm-jtv-${i.value}`])},[A(O(e.value))?(h(),p(S,{key:0},[N(`span`,null,o(A(O(e.value))?.before),1),N(`mark`,null,o(A(O(e.value))?.match),1),N(`span`,null,o(A(O(e.value))?.after),1)],64)):(h(),p(S,{key:1},[a(o(O(e.value)),1)],64))],2),k(e.value)?(h(),p(`span`,{key:1,class:`zm-jtv-thumb-wrap`,onClick:g[1]||=T(()=>{},[`stop`])},[N(`img`,{class:`zm-jtv-thumb`,src:String(e.value),alt:e.keyName,loading:`lazy`,referrerpolicy:`no-referrer`},null,8,Cn),N(`a`,{class:`zm-jtv-thumb-link`,href:String(e.value),target:`_blank`,rel:`noopener noreferrer`,onClick:g[0]||=T(()=>{},[`stop`])},`open`,8,wn)])):M(``,!0)],4))}}}),En={class:`zm-data-panel`},Dn={class:`zm-data-header`},On={class:`zm-data-title`},kn={class:`zm-data-title-meta`},An={class:`zm-data-toolbar`},jn=[`title`],Mn={key:0,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Nn={key:1,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.4`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Pn={key:0,class:`zm-data-paste`},Fn={class:`zm-data-tabs`},In=[`placeholder`],Ln={key:0,class:`zm-data-error`},Rn={class:`zm-data-paste-actions`},zn=[`disabled`],Y={class:`zm-data-tree`},Bn=x({__name:`DataPanel`,props:{data:{},pendingMode:{default:null}},emits:[`import`,`consumed-mode`],setup(t,{emit:i}){let s=t,c=i,l=j(()=>JSON.stringify(s.data,null,2)),u=E(``),d=E(null),f=E(!1),g=E(`json`),_=E(`idle`),v=E(new Set),y=E(``);e(()=>s.pendingMode,e=>{e&&(f.value=!0,g.value=e,c(`consumed-mode`))},{immediate:!0});async function b(){try{await navigator.clipboard.writeText(l.value),_.value=`copied`,setTimeout(()=>_.value=`idle`,1500)}catch{let e=document.createElement(`textarea`);e.value=l.value,document.body.appendChild(e),e.select();try{document.execCommand(`copy`),_.value=`copied`,setTimeout(()=>_.value=`idle`,1500)}finally{document.body.removeChild(e)}}}function x(){let e=new Blob([l.value],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${s.data.text||`mindmap`}.json`,n.click(),URL.revokeObjectURL(t)}function S(){d.value=null;let e=u.value.trim();if(e){if(g.value===`markdown`||g.value===`txt`){try{c(`import`,lt(e)),u.value=``,f.value=!1}catch(e){d.value=(g.value===`txt`?`TXT 解析失败:`:`Markdown 解析失败:`)+e.message}return}try{let t=JSON.parse(e);if(!t.id||!Array.isArray(t.children)){d.value=`JSON 缺少 id 或 children 字段`;return}c(`import`,t),u.value=``,f.value=!1}catch(e){d.value=`JSON 解析失败:`+e.message}}}function w(e){return 1+e.children.reduce((e,t)=>e+w(t),0)}let T=j(()=>w(s.data)),D=j(()=>l.value.length);function O(){let e=document.createElement(`input`);e.type=`file`,e.accept=`application/json`,e.onchange=()=>{let t=e.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>{typeof n.result==`string`&&(u.value=n.result,S())},n.readAsText(t)},e.click()}return(e,i)=>(h(),p(`div`,En,[N(`div`,Dn,[N(`div`,On,[i[8]||=N(`span`,{class:`zm-data-title-text`},`数据 JSON`,-1),N(`span`,kn,o(T.value)+` 节点 · `+o(D.value)+` chars`,1)])]),N(`div`,An,[N(`button`,{class:n([`zm-data-btn is-icon`,{"is-success":_.value===`copied`}]),title:_.value===`copied`?`已复制`:`复制 JSON 到剪贴板`,onClick:b},[_.value===`idle`?(h(),p(`svg`,Mn,[...i[9]||=[N(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`},null,-1),N(`path`,{d:`M5 15 H4 a2 2 0 0 1 -2 -2 V4 a2 2 0 0 1 2 -2 h9 a2 2 0 0 1 2 2 v1`},null,-1)]])):(h(),p(`svg`,Nn,[...i[10]||=[N(`polyline`,{points:`5 12 10 17 19 7`},null,-1)]])),i[11]||=N(`span`,{class:`zm-data-btn-label`},`复制`,-1)],10,jn),N(`button`,{class:`zm-data-btn is-icon`,title:`导出为 JSON 文件`,onClick:x},[...i[12]||=[m(`<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4 V15"></path><polyline points="7 9 12 4 17 9"></polyline><path d="M4 19 H20"></path></svg><span class="zm-data-btn-label">导出</span>`,2)]]),N(`button`,{class:`zm-data-btn is-icon`,title:`从 JSON 文件导入`,onClick:O},[...i[13]||=[m(`<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 15 V4"></path><polyline points="7 9 12 4 17 9"></polyline><path d="M4 19 H20"></path></svg><span class="zm-data-btn-label">导入</span>`,2)]]),N(`button`,{class:n([`zm-data-btn is-icon`,{"is-active":f.value}]),title:`粘贴 JSON 或 Markdown 替换当前数据`,onClick:i[0]||=e=>f.value=!f.value},[...i[14]||=[m(`<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 4 H15 V8 H9 Z"></path><path d="M9 8 H4 V20 H9"></path><path d="M15 8 H20 V20 H15"></path></svg><span class="zm-data-btn-label">粘贴</span>`,2)]],2),i[16]||=N(`div`,{class:`zm-data-toolbar-spacer`},null,-1),N(`div`,{class:n([`zm-data-search`,{"is-active":y.value.length>0}])},[i[15]||=N(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[N(`circle`,{cx:`11`,cy:`11`,r:`7`}),N(`line`,{x1:`20`,y1:`20`,x2:`16`,y2:`16`})],-1),C(N(`input`,{"onUpdate:modelValue":i[1]||=e=>y.value=e,type:`text`,placeholder:`过滤 (键 / 值)`,spellcheck:`false`},null,512),[[A,y.value]]),y.value?(h(),p(`button`,{key:0,class:`zm-data-search-clear`,title:`清空过滤`,onClick:i[2]||=e=>y.value=``},`×`)):M(``,!0)],2)]),f.value?(h(),p(`div`,Pn,[N(`div`,Fn,[N(`button`,{class:n([`zm-data-tab`,{"is-active":g.value===`json`}]),onClick:i[3]||=e=>g.value=`json`},`JSON`,2),N(`button`,{class:n([`zm-data-tab`,{"is-active":g.value===`markdown`}]),onClick:i[4]||=e=>g.value=`markdown`},`Markdown`,2)]),C(N(`textarea`,{"onUpdate:modelValue":i[5]||=e=>u.value=e,placeholder:g.value===`json`?`paste a JSON tree to replace current data`:`paste markdown - # / ## / ### become nodes`,spellcheck:`false`},null,8,In),[[A,u.value]]),d.value?(h(),p(`div`,Ln,o(d.value),1)):M(``,!0),N(`div`,Rn,[N(`button`,{class:`zm-data-btn is-primary`,disabled:!u.value,onClick:S},`应用`,8,zn),N(`button`,{class:`zm-data-btn`,onClick:i[6]||=e=>{u.value=``,d.value=null}},`清空`),N(`button`,{class:`zm-data-btn`,onClick:i[7]||=e=>f.value=!1},`关闭`)])])):M(``,!0),N(`div`,Y,[r(Tn,{value:t.data,query:y.value,"collapsed-paths":v.value},null,8,[`value`,`query`,`collapsed-paths`])]),i[17]||=N(`div`,{class:`zm-data-footer`},[N(`span`,{class:`zm-data-footer-hint`},[a(` 图片支持 `),N(`code`,null,`data:image/...`),a(` / `),N(`code`,null,`https://...`),a(` / `),N(`code`,null,`/imgs/foo.png`),a(` (同源)。本地 `),N(`code`,null,`file://`),a(` 路径被浏览器拒绝。 `)])],-1)]))}}),Vn={class:`zm-md-panel`},Hn={key:0,class:`zm-md-error`},Un={class:`zm-md-split`},Wn={class:`zm-md-edit`},Gn={class:`zm-md-preview`},Kn={class:`zm-md-preview-body`},qn={class:`zm-md-footer`},Jn=[`disabled`],Yn=`# flow-mindmap 思维导图
|
|
16
16
|
|
|
17
17
|
[GitHub 仓库](https://github.com/xz333221/flow-mindmap)
|
|
18
18
|
|
|
@@ -51,10 +51,10 @@ import{$n as e,Bn as t,Dn as n,En as r,Hn as i,Jn as a,Kn as o,Ln as s,Nn as c,O
|
|
|
51
51
|
|
|
52
52
|
## 开源协议
|
|
53
53
|
[Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
|
54
|
-
`,Xn=
|
|
55
|
-
`)),
|
|
56
|
-
`);return}i(`update:settings`,{customPalettes:
|
|
57
|
-
`)}function C(e){let t=n.settings.customPalettes.filter(t=>t.id!==e.id),r=n.settings.branchPaletteId===e.id?`default`:n.settings.branchPaletteId;i(`update:settings`,{customPalettes:t,...r===n.settings.branchPaletteId?{}:{branchPaletteId:r}}),delete _[e.id]}let w=[`#f87171`,`#fb923c`,`#fbbf24`,`#a3e635`,`#34d399`,`#22d3ee`,`#818cf8`,`#c084fc`,`#1e2937`,`#f8fafc`,`#94a3b8`],T=[`#f8fafc`,`#ffffff`,`#e2e8f0`,`#1e2937`,`#0f172a`,`#fef3c7`,`#dbeafe`,`#dcfce7`,`#fce7f3`,`#f1f5f9`],E=[0,1,2,3],O=[`#f87171`,`#fb923c`,`#34d399`,`#818cf8`];function k(e,t,n,r){if(t<=1)return n;let i=e/(t-1);return n+(r-n)*i}function A(e,t,n,r){let i=t*r**+e;return Math.max(n,i)}let ee=j(()=>{let e=n.settings.lineWidthStart,t=n.settings.lineWidthEnd,r=n.settings.taperedEdge,i=E.length,a=g.value.find(e=>e.id===n.settings.branchPaletteId),o=a&&a.colors.length?a.colors:O;return E.map((a,s)=>{let c=10+s*60/(i-1);return{x1:8,y1:c,x2:192,y2:c,w:r?A(a,e,t,n.settings.lineWidthTaper):k(a,i,e,t),color:n.settings.rainbowBranch?o[s%o.length]:`#94a3b8`}})});return(t,n)=>(m(),u(`div`,Zn,[N(`section`,Qn,[n[52]||=N(`h4`,{class:`zm-settings-section-title`},`画布`,-1),N(`div`,$n,[n[27]||=N(`span`,{class:`zm-settings-label`},`画布背景色`,-1),N(`div`,er,[N(`label`,tr,[N(`input`,{type:`color`,class:`zm-color-input`,value:e.settings.canvasBg||`#f8fafc`,onInput:n[0]||=e=>a(`canvasBg`,e.target.value)},null,40,nr),N(`span`,rr,D(e.settings.canvasBg||`默认`),1)])])]),N(`div`,ir,[(m(),u(x,null,o(T,t=>N(`button`,{key:`cbg-`+t,class:p([`zm-swatch`,{"is-active":(e.settings.canvasBg||`#f8fafc`)===t}]),style:f({background:t}),title:t,onClick:e=>a(`canvasBg`,t)},null,14,ar)),64)),N(`button`,{class:`zm-swatch is-reset`,title:`恢复默认`,onClick:n[1]||=e=>a(`canvasBg`,void 0)},`∅`)]),n[53]||=N(`div`,{class:`zm-settings-divider`},null,-1),N(`div`,or,[n[28]||=N(`span`,{class:`zm-settings-label`},`线条粗端 (根部)`,-1),N(`input`,{class:`zm-settings-number`,type:`number`,step:`0.2`,value:e.settings.lineWidthStart,onChange:n[2]||=e=>a(`lineWidthStart`,parseFloat(e.target.value)||0)},null,40,sr)]),N(`div`,cr,[n[29]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`0.4`,max:`20`,step:`0.2`,value:e.settings.lineWidthStart,onInput:n[3]||=e=>a(`lineWidthStart`,parseFloat(e.target.value))},null,40,lr)]),N(`div`,ur,[n[30]||=N(`span`,{class:`zm-settings-label`},`线条细端 (子端)`,-1),N(`input`,{class:`zm-settings-number`,type:`number`,step:`0.2`,value:e.settings.lineWidthEnd,onChange:n[4]||=e=>a(`lineWidthEnd`,parseFloat(e.target.value)||0)},null,40,dr)]),N(`div`,fr,[n[31]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`0.1`,max:`6`,step:`0.1`,value:e.settings.lineWidthEnd,onInput:n[5]||=e=>a(`lineWidthEnd`,parseFloat(e.target.value))},null,40,pr)]),n[54]||=N(`div`,{class:`zm-settings-divider`},null,-1),N(`div`,mr,[n[32]||=N(`span`,{class:`zm-settings-label`},`根节点线条`,-1),N(`div`,hr,[(m(!0),u(x,null,o(P(c),t=>(m(),u(`button`,{key:t.value,class:p([`zm-line-style-btn`,{"is-on":e.settings.rootLineStyle===t.value}]),title:t.label,onClick:e=>a(`rootLineStyle`,t.value)},[(m(),u(`svg`,{viewBox:t.viewBox,width:`28`,height:`14`,preserveAspectRatio:`none`},[t.value===`arc`?(m(),u(`path`,_r)):t.value===`rounded-elbow`?(m(),u(`path`,vr)):t.value===`elbow`?(m(),u(`path`,yr)):t.value===`curve`?(m(),u(`path`,br)):(m(),u(`line`,xr))],8,X)),N(`span`,Sr,D(t.label),1)],10,gr))),128))])]),N(`div`,Cr,[n[33]||=N(`span`,{class:`zm-settings-label`},`非根节点线条`,-1),N(`div`,wr,[(m(),u(x,null,o(s,t=>N(`button`,{key:t.value,class:p([`zm-line-style-btn`,{"is-on":e.settings.lineStyle===t.value}]),title:t.label,onClick:e=>a(`lineStyle`,t.value)},[(m(),u(`svg`,{viewBox:t.viewBox,width:`28`,height:`14`,preserveAspectRatio:`none`},[t.value===`arc`?(m(),u(`path`,Dr)):t.value===`rounded-elbow`?(m(),u(`path`,Or)):t.value===`elbow`?(m(),u(`path`,kr)):t.value===`curve`?(m(),u(`path`,Ar)):(m(),u(`line`,jr))],8,Er)),N(`span`,Mr,D(t.label),1)],10,Tr)),64))])]),e.settings.lineStyle===`rounded-elbow`||e.settings.rootLineStyle===`rounded-elbow`?(m(),u(`div`,Nr,[N(`span`,Pr,[n[34]||=r(`圆角大小 `,-1),N(`span`,Fr,D(e.settings.elbowRadius)+`px`,1)]),N(`input`,{class:`zm-settings-number`,type:`number`,step:`1`,min:`2`,max:`40`,value:e.settings.elbowRadius,onChange:n[6]||=e=>a(`elbowRadius`,parseFloat(e.target.value)||20)},null,40,Ir)])):M(``,!0),e.settings.lineStyle===`rounded-elbow`||e.settings.rootLineStyle===`rounded-elbow`?(m(),u(`div`,Lr,[n[35]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`2`,max:`40`,step:`1`,value:e.settings.elbowRadius,onInput:n[7]||=e=>a(`elbowRadius`,parseFloat(e.target.value))},null,40,Rr)])):M(``,!0),N(`div`,zr,[n[37]||=N(`span`,{class:`zm-settings-label`},`线条起点`,-1),N(`div`,Br,[(m(),u(x,null,o(l,t=>N(`button`,{key:t.value,class:p([`zm-line-style-btn`,{"is-on":e.settings.lineOrigin===t.value}]),title:t.label,onClick:e=>a(`lineOrigin`,t.value)},[(m(),u(`svg`,Hr,[n[36]||=N(`rect`,{x:`8`,y:`6`,width:`12`,height:`6`,rx:`2`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,opacity:`0.5`},null,-1),t.value===`edge`?(m(),u(`path`,Ur)):t.value===`center`?(m(),u(`path`,Wr)):t.value===`proportional`?(m(),u(`path`,Gr)):(m(),u(`path`,Kr))])),N(`span`,qr,D(t.label),1)],10,Vr)),64))])]),N(`div`,Jr,[n[39]||=N(`span`,{class:`zm-settings-label`},`一级分支彩虹色`,-1),N(`button`,{class:p([`zm-toggle`,{"is-on":e.settings.rainbowBranch}]),onClick:n[8]||=t=>a(`rainbowBranch`,!e.settings.rainbowBranch)},[...n[38]||=[N(`span`,{class:`zm-toggle-knob`},null,-1)]],2)]),e.settings.rainbowBranch?(m(),u(`div`,Yr,[n[40]||=N(`div`,{class:`zm-settings-field`},[N(`span`,{class:`zm-settings-label`},`配色方案`)],-1),N(`div`,Xr,[(m(!0),u(x,null,o(g.value,t=>(m(),u(`button`,{key:t.id,class:p([`zm-palette-option`,{"is-active":e.settings.branchPaletteId===t.id}]),onClick:e=>a(`branchPaletteId`,t.id)},[N(`span`,Qr,D(t.name),1),N(`span`,$r,[(m(!0),u(x,null,o(t.colors,(e,t)=>(m(),u(`span`,{key:t,class:`zm-palette-option-swatch`,style:f({background:e})},null,4))),128))])],10,Zr))),128))]),e.settings.customPalettes.find(t=>t.id===e.settings.branchPaletteId)?(m(),u(`div`,ei,[N(`textarea`,{class:`zm-palette-textarea`,rows:`3`,spellcheck:`false`,placeholder:`一行一个 hex,例如 #f87171`,value:y(e.settings.customPalettes.find(t=>t.id===e.settings.branchPaletteId)),onInput:n[9]||=t=>_[e.settings.customPalettes.find(t=>t.id===e.settings.branchPaletteId).id]=t.target.value},null,40,ti),N(`div`,ni,[N(`button`,{type:`button`,class:`zm-data-btn is-primary`,onClick:n[10]||=t=>b(e.settings.customPalettes.find(t=>t.id===e.settings.branchPaletteId))},`保存`),N(`button`,{type:`button`,class:`zm-data-btn`,onClick:n[11]||=t=>C(e.settings.customPalettes.find(t=>t.id===e.settings.branchPaletteId))},`删除`)])])):M(``,!0),N(`button`,{type:`button`,class:`zm-palette-add`,onClick:S},`+ 新建配色`)])):M(``,!0),n[55]||=N(`div`,{class:`zm-settings-divider`},null,-1),N(`div`,ri,[n[42]||=N(`span`,{class:`zm-settings-label`},`每条连线独立渐变`,-1),N(`button`,{class:p([`zm-toggle`,{"is-on":e.settings.taperedEdge}]),onClick:n[12]||=t=>a(`taperedEdge`,!e.settings.taperedEdge)},[...n[41]||=[N(`span`,{class:`zm-toggle-knob`},null,-1)]],2)]),e.settings.taperedEdge?(m(),u(`div`,ii,[N(`span`,ai,[n[43]||=r(`层级衰减 `,-1),N(`span`,oi,D(Math.round(e.settings.lineWidthTaper*100))+`%`,1)]),N(`input`,{class:`zm-settings-number`,type:`number`,step:`0.05`,min:`0.1`,max:`1`,value:e.settings.lineWidthTaper,onChange:n[13]||=e=>a(`lineWidthTaper`,parseFloat(e.target.value)||.67)},null,40,si)])):M(``,!0),e.settings.taperedEdge?(m(),u(`div`,ci,[n[44]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`0.1`,max:`1`,step:`0.01`,value:e.settings.lineWidthTaper,onInput:n[14]||=e=>a(`lineWidthTaper`,parseFloat(e.target.value))},null,40,li)])):M(``,!0),e.settings.taperedEdge?(m(),u(`div`,ui,[n[46]||=N(`span`,{class:`zm-settings-label`},`非根节点相同粗细`,-1),N(`button`,{class:p([`zm-toggle`,{"is-on":e.settings.uniformLineWidth}]),onClick:n[15]||=t=>a(`uniformLineWidth`,!e.settings.uniformLineWidth)},[...n[45]||=[N(`span`,{class:`zm-toggle-knob`},null,-1)]],2)])):M(``,!0),N(`div`,di,[N(`span`,fi,[n[47]||=r(`一级分支间距 `,-1),N(`span`,pi,D(e.settings.branchGap)+`px`,1)]),N(`input`,{class:`zm-settings-number`,type:`number`,step:`2`,min:`0`,max:`80`,value:e.settings.branchGap,onChange:n[16]||=e=>a(`branchGap`,parseFloat(e.target.value)||0)},null,40,mi)]),N(`div`,hi,[n[48]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`0`,max:`80`,step:`2`,value:e.settings.branchGap,onInput:n[17]||=e=>a(`branchGap`,parseFloat(e.target.value))},null,40,gi)]),N(`div`,_i,[n[50]||=N(`span`,{class:`zm-settings-label`},`显示节点序号`,-1),N(`button`,{class:p([`zm-toggle`,{"is-on":e.settings.showOrderBadge}]),onClick:n[18]||=t=>a(`showOrderBadge`,!e.settings.showOrderBadge)},[...n[49]||=[N(`span`,{class:`zm-toggle-knob`},null,-1)]],2)]),N(`div`,vi,[(m(),u(`svg`,yi,[(m(!0),u(x,null,o(ee.value,(t,n)=>(m(),u(`line`,{key:n,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:e.settings.rainbowBranch?t.color:`#94a3b8`,"stroke-width":t.w,"stroke-linecap":`butt`},null,8,bi))),128))])),n[51]||=N(`div`,{class:`zm-settings-preview-labels`},[N(`span`,null,`根`),N(`span`,null,`1级`),N(`span`,null,`2级`),N(`span`,null,`3级`)],-1)])]),e.hasSelection?(m(),u(`section`,xi,[N(`h4`,Si,[n[56]||=r(` 节点 `,-1),e.selectedNodeText?(m(),u(`span`,Ci,`"`+D(e.selectedNodeText)+`"`,1)):M(``,!0)]),N(`div`,wi,[n[57]||=N(`span`,{class:`zm-settings-label`},`背景颜色`,-1),N(`span`,Ti,D(e.nodeStyle?.bg||`默认`),1)]),N(`div`,Ei,[(m(),u(x,null,o(w,t=>N(`button`,{key:`bg-`+t,class:p([`zm-swatch`,{"is-active":e.nodeStyle?.bg===t}]),style:f({background:t}),title:t,onClick:e=>h({bg:t})},null,14,Di)),64)),N(`label`,Oi,[N(`input`,{type:`color`,value:e.nodeStyle?.bg||`#ffffff`,onInput:n[19]||=e=>h({bg:e.target.value})},null,40,ki)]),N(`button`,{class:`zm-swatch is-reset`,title:`清除`,onClick:n[20]||=e=>h({bg:void 0})},`∅`)]),N(`div`,Ai,[n[58]||=N(`span`,{class:`zm-settings-label`},`文字颜色`,-1),N(`span`,ji,D(e.nodeStyle?.textColor||`默认`),1)]),N(`div`,Mi,[(m(),u(x,null,o(w,t=>N(`button`,{key:`fg-`+t,class:p([`zm-swatch`,{"is-active":e.nodeStyle?.textColor===t}]),style:f({background:t}),title:t,onClick:e=>h({textColor:t})},null,14,Ni)),64)),N(`label`,Pi,[N(`input`,{type:`color`,value:e.nodeStyle?.textColor||`#1e2937`,onInput:n[21]||=e=>h({textColor:e.target.value})},null,40,Fi)]),N(`button`,{class:`zm-swatch is-reset`,title:`清除`,onClick:n[22]||=e=>h({textColor:void 0})},`∅`)]),n[62]||=N(`div`,{class:`zm-settings-divider`},null,-1),N(`div`,Ii,[n[59]||=N(`span`,{class:`zm-settings-label`},`字重`,-1),N(`select`,{class:`zm-select`,value:e.nodeStyle?.fontWeight??400,onChange:n[23]||=e=>h({fontWeight:parseInt(e.target.value)})},[(m(),u(x,null,o(d,e=>N(`option`,{key:e.value,value:e.value},D(e.label),9,Ri)),64))],40,Li)]),N(`div`,zi,[n[60]||=N(`span`,{class:`zm-settings-label`},`文字大小`,-1),N(`input`,{class:`zm-settings-number`,type:`number`,step:`1`,min:`8`,max:`48`,value:e.nodeStyle?.fontSize??14,onChange:n[24]||=e=>h({fontSize:parseInt(e.target.value)||14})},null,40,Bi)]),N(`div`,Vi,[n[61]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`8`,max:`48`,step:`1`,value:e.nodeStyle?.fontSize??14,onInput:n[25]||=e=>h({fontSize:parseInt(e.target.value)})},null,40,Hi)]),n[63]||=N(`p`,{class:`zm-settings-hint`},`仅作用于当前节点,不影响子节点。`,-1)])):M(``,!0),N(`section`,Ui,[N(`button`,{class:`zm-settings-reset`,onClick:n[26]||=e=>i(`reset`)},`恢复默认设置`)])]))}}),[[`__scopeId`,`data-v-d9ae9516`]]),Gi=20;function Ki(e,t){e.style.height=`auto`;let n=t.minRows*Gi,r=t.maxRows>0?t.maxRows*Gi:1/0,i=Math.max(n,Math.min(r,e.scrollHeight));e.style.height=i+`px`,e.style.overflowY=e.scrollHeight>r?`auto`:`hidden`}function qi(n,r={}){let a={minRows:r.minRows??3,maxRows:r.maxRows??12};function o(){let e=n.value;e&&Ki(e,a)}function c(){o()}i(async()=>{await s();let e=n.value;e&&(e.addEventListener(`input`,c),o())}),e(()=>n.value?.value,()=>o()),t(()=>{let e=n.value;e&&e.removeEventListener(`input`,c)})}function Ji(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function Yi(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t],r=typeof n;(r===`object`||r===`function`)&&!Object.isFrozen(n)&&Yi(n)}),e}var Xi=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Zi(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Qi(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var $i=`</span>`,ea=e=>!!e.scope,ta=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},na=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=Zi(e)}openNode(e){if(!ea(e))return;let t=ta(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){ea(e)&&(this.buffer+=$i)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},ra=(e={})=>{let t={children:[]};return Object.assign(t,e),t},ia=class e{constructor(){this.rootNode=ra(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=ra({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},aa=class extends ia{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new na(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function oa(e){return e?typeof e==`string`?e:e.source:null}function sa(e){return ua(`(?=`,e,`)`)}function ca(e){return ua(`(?:`,e,`)*`)}function la(e){return ua(`(?:`,e,`)?`)}function ua(...e){return e.map(e=>oa(e)).join(``)}function da(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function fa(...e){return`(`+(da(e).capture?``:`?:`)+e.map(e=>oa(e)).join(`|`)+`)`}function pa(e){return RegExp(e.toString()+`|`).exec(``).length-1}function ma(e,t){let n=e&&e.exec(t);return n&&n.index===0}var ha=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function ga(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=oa(e),i=``;for(;r.length>0;){let e=ha.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var _a=/\b\B/,va=`[a-zA-Z]\\w*`,ya=`[a-zA-Z_]\\w*`,ba=`\\b\\d+(\\.\\d+)?`,xa=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,Sa=`\\b(0b[01]+)`,Ca=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,wa=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=ua(t,/.*\b/,e.binary,/\b.*/)),Qi({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},Ta={begin:`\\\\[\\s\\S]`,relevance:0},Ea={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[Ta]},Da={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[Ta]},Oa={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},ka=function(e,t,n={}){let r=Qi({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=fa(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:ua(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},Aa=ka(`//`,`$`),ja=ka(`/\\*`,`\\*/`),Ma=ka(`#`,`$`),Na=Object.freeze({__proto__:null,APOS_STRING_MODE:Ea,BACKSLASH_ESCAPE:Ta,BINARY_NUMBER_MODE:{scope:`number`,begin:Sa,relevance:0},BINARY_NUMBER_RE:Sa,COMMENT:ka,C_BLOCK_COMMENT_MODE:ja,C_LINE_COMMENT_MODE:Aa,C_NUMBER_MODE:{scope:`number`,begin:xa,relevance:0},C_NUMBER_RE:xa,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:Ma,IDENT_RE:va,MATCH_NOTHING_RE:_a,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:ba,relevance:0},NUMBER_RE:ba,PHRASAL_WORDS_MODE:Oa,QUOTE_STRING_MODE:Da,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ta,{begin:/\[/,end:/\]/,relevance:0,contains:[Ta]}]},RE_STARTERS_RE:Ca,SHEBANG:wa,TITLE_MODE:{scope:`title`,begin:va,relevance:0},UNDERSCORE_IDENT_RE:ya,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:ya,relevance:0}});function Pa(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function Fa(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Ia(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=Pa,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function La(e,t){Array.isArray(e.illegal)&&(e.illegal=fa(...e.illegal))}function Ra(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function za(e,t){e.relevance===void 0&&(e.relevance=1)}var Ba=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=ua(n.beforeMatch,sa(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},Va=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],Ha=`keyword`;function Ua(e,t,n=Ha){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,Ua(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,Wa(n[0],n[1])]})}}function Wa(e,t){return t?Number(t):+!Ga(e)}function Ga(e){return Va.includes(e.toLowerCase())}var Ka={},qa=e=>{console.error(e)},Ja=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Ya=(e,t)=>{Ka[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Ka[`${e}/${t}`]=!0)},Xa=Error();function Za(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=pa(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function Qa(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw qa(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),Xa;if(typeof e.beginScope!=`object`||e.beginScope===null)throw qa(`beginScope must be object`),Xa;Za(e,e.begin,{key:`beginScope`}),e.begin=ga(e.begin,{joinWith:``})}}function $a(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw qa(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),Xa;if(typeof e.endScope!=`object`||e.endScope===null)throw qa(`endScope must be object`),Xa;Za(e,e.end,{key:`endScope`}),e.end=ga(e.end,{joinWith:``})}}function eo(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function to(e){eo(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),Qa(e),$a(e)}function no(e){function t(t,n){return new RegExp(oa(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=pa(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(ga(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function a(n,r){let o=n;if(n.isCompiled)return o;[Fa,Ra,to,Ba].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[Ia,La,za].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=Ua(n.keywords,e.case_insensitive),o.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,o.beginRe=t(o.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(o.endRe=t(o.end)),o.terminatorEnd=oa(o.end)||``,n.endsWithParent&&r.terminatorEnd&&(o.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(o.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return io(e===`self`?n:e)})),n.contains.forEach(function(e){a(e,o)}),n.starts&&a(n.starts,r),o.matcher=i(o),o}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Qi(e.classNameAliases||{}),a(e)}function ro(e){return e?e.endsWithParent||ro(e.starts):!1}function io(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Qi(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:ro(e)?Qi(e,{starts:e.starts?Qi(e.starts):null}):Object.isFrozen(e)?Qi(e):e}var ao=`11.11.1`,oo=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},so=Zi,co=Qi,lo=Symbol(`nomatch`),uo=7,fo=function(e){let t=Object.create(null),n=Object.create(null),r=[],i=!0,a=`Could not find the language '{}', did you forget to load/include a language module?`,o={disableAutodetect:!0,name:`Plain text`,contains:[]},s={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:aa};function c(e){return s.noHighlightRe.test(e)}function l(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=s.languageDetectRe.exec(t);if(n){let t=w(n[1]);return t||(Ja(a.replace(`{}`,n[1])),Ja(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>c(e)||w(e))}function u(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(Ya(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),Ya(`10.7.0`,`Please use highlight(code, options) instead.
|
|
54
|
+
`,Xn=x({__name:`MarkdownPanel`,props:{data:{}},emits:[`import`],setup(t,{emit:n}){let i=t,a=n,s=E(ut(i.data)),c=E(null),l=E(null),u=j(()=>{try{let e=lt(s.value||``);return c.value=null,e}catch(e){return c.value=e.message,{id:`preview_fallback`,text:s.value||`(空)`,children:[]}}}),f=j(()=>He(u.value)),m=null;e(s,()=>{m&&clearTimeout(m),m=setTimeout(()=>l.value?.resetView(),250)});function g(){try{let e=lt(s.value||``);c.value=null,a(`import`,e)}catch(e){c.value=e.message}}function _(){s.value=ut(i.data),c.value=null,d(()=>l.value?.resetView())}function v(){s.value=``,c.value=null,d(()=>l.value?.resetView())}function y(){let e=document.createElement(`input`);e.type=`file`,e.accept=`.md,text/markdown,text/plain`,e.onchange=()=>{let t=e.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>{typeof n.result==`string`&&(s.value=n.result,c.value=null,d(()=>l.value?.resetView()))},n.readAsText(t)},e.click()}function b(){let e=new Blob([s.value],{type:`text/markdown;charset=utf-8`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${(i.data.text||`mindmap`).trim()||`mindmap`}.md`,n.click(),URL.revokeObjectURL(t)}function x(){s.value=Yn,c.value=null,d(()=>l.value?.resetView())}return(e,t)=>(h(),p(`div`,Vn,[N(`div`,{class:`zm-md-toolbar`},[N(`button`,{class:`zm-md-btn`,title:`从 .md 文件加载`,onClick:y},[...t[1]||=[N(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[N(`path`,{d:`M12 4 V15`}),N(`polyline`,{points:`7 9 12 4 17 9`}),N(`path`,{d:`M4 19 H20`})],-1),N(`span`,null,`加载 .md`,-1)]]),N(`button`,{class:`zm-md-btn`,title:`把当前导图导出为 .md`,onClick:b},[...t[2]||=[N(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[N(`path`,{d:`M12 15 V4`}),N(`polyline`,{points:`7 9 12 4 17 9`}),N(`path`,{d:`M4 19 H20`})],-1),N(`span`,null,`导出 .md`,-1)]]),t[3]||=N(`span`,{class:`zm-md-spacer`},null,-1),N(`button`,{class:`zm-md-btn`,title:`用示例内容填充`,onClick:x},`示例`),N(`button`,{class:`zm-md-btn`,title:`覆盖为当前导图`,onClick:_},`同步`),N(`button`,{class:`zm-md-btn`,title:`清空`,onClick:v},`清空`)]),c.value?(h(),p(`div`,Hn,o(c.value),1)):M(``,!0),N(`div`,Un,[N(`div`,Wn,[t[4]||=N(`div`,{class:`zm-md-pane-header`},[N(`span`,null,`Markdown`),N(`span`,{class:`zm-md-hint`},`# 根 · ## 一级 · ### 二级 …`)],-1),C(N(`textarea`,{"onUpdate:modelValue":t[0]||=e=>s.value=e,class:`zm-md-textarea`,spellcheck:`false`,placeholder:`# 标题…`},null,512),[[A,s.value]])]),N(`div`,Gn,[t[5]||=N(`div`,{class:`zm-md-pane-header`},[N(`span`,null,`导图预览`),N(`span`,{class:`zm-md-hint`},`只读`)],-1),N(`div`,Kn,[r(Pd,{ref_key:`previewRef`,ref:l,data:f.value,readonly:``,"preview-mode":``},null,8,[`data`])])])]),N(`div`,qn,[N(`button`,{class:`zm-md-btn is-primary`,disabled:!s.value.trim(),onClick:g},`应用到导图`,8,Jn)])]))}}),Zn={class:`zm-settings-panel`},Qn={class:`zm-settings-section`},$n={class:`zm-settings-field`},er={class:`zm-settings-control`},tr={class:`zm-color-input-wrap`},nr=[`value`],rr={class:`zm-color-input-text`},ir={class:`zm-swatch-row zm-swatch-row--compact`},ar=[`title`,`onClick`],or={class:`zm-settings-field`},sr=[`value`],cr={class:`zm-slider`},lr=[`value`],ur={class:`zm-settings-field`},dr=[`value`],fr={class:`zm-slider`},pr=[`value`],mr={class:`zm-settings-field zm-line-style-field`},hr={class:`zm-line-style-group`},gr=[`title`,`onClick`],X=[`viewBox`],_r={key:0,d:`M 0 12 Q 14 2, 28 12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`},vr={key:1,d:`M 0 10 L 12 10 Q 16 10 16 6 L 16 4 L 28 4`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},yr={key:2,d:`M 0 10 L 16 10 L 16 4 L 28 4`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},br={key:3,d:`M 0 12 C 8 0, 20 0, 28 12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`},xr={key:4,x1:`0`,y1:`12`,x2:`28`,y2:`12`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`},Sr={class:`zm-line-style-label`},Cr={class:`zm-settings-field zm-line-style-field`},wr={class:`zm-line-style-group`},Tr=[`title`,`onClick`],Er=[`viewBox`],Dr={key:0,d:`M 0 12 Q 14 2, 28 12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`},Or={key:1,d:`M 0 10 L 12 10 Q 16 10 16 6 L 16 4 L 28 4`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},kr={key:2,d:`M 0 10 L 16 10 L 16 4 L 28 4`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Ar={key:3,d:`M 0 12 C 8 0, 20 0, 28 12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`},jr={key:4,x1:`0`,y1:`12`,x2:`28`,y2:`12`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`},Mr={class:`zm-line-style-label`},Nr={key:0,class:`zm-settings-field`},Pr={class:`zm-settings-label`},Fr={class:`zm-settings-sub`},Ir=[`value`],Lr={key:1,class:`zm-slider`},Rr=[`value`],zr={class:`zm-settings-field zm-line-style-field`},Br={class:`zm-line-style-group`},Vr=[`title`,`onClick`],Hr={viewBox:`0 0 28 18`,width:`28`,height:`18`,preserveAspectRatio:`none`},Ur={key:0,d:`M 8 9 L 0 9 M 20 9 L 28 9`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},Wr={key:1,d:`M 14 9 L 0 9 M 14 9 L 28 9`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},Gr={key:2,d:`M 8 7 L 0 4 M 8 9 L 0 9 M 8 11 L 0 14 M 20 7 L 28 4 M 20 9 L 28 9 M 20 11 L 28 14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`},Kr={key:3,d:`M 11 6 L 8 0 M 8 8 L 0 7 M 8 11 L 0 14 M 17 6 L 20 0 M 20 8 L 28 7 M 20 11 L 28 14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`},qr={class:`zm-line-style-label`},Jr={class:`zm-settings-field`},Yr={key:2,class:`zm-palette-picker`},Xr={class:`zm-palette-list`},Zr=[`onClick`],Qr={class:`zm-palette-option-name`},$r={class:`zm-palette-option-swatches`},ei={key:0,class:`zm-palette-custom-editor`},ti=[`value`],ni={class:`zm-palette-custom-actions`},ri={class:`zm-settings-field`},ii={key:3,class:`zm-settings-field`},ai={class:`zm-settings-label`},oi={class:`zm-settings-sub`},si=[`value`],ci={key:4,class:`zm-slider`},li=[`value`],ui={key:5,class:`zm-settings-field`},di={class:`zm-settings-field`},fi={class:`zm-settings-label`},pi={class:`zm-settings-sub`},mi=[`value`],hi={class:`zm-slider`},gi=[`value`],_i={class:`zm-settings-field`},vi={class:`zm-settings-preview`},yi={viewBox:`0 0 200 70`,width:`100%`,height:`70`,preserveAspectRatio:`none`},bi=[`x1`,`y1`,`x2`,`y2`,`stroke`,`stroke-width`],xi={key:0,class:`zm-settings-section`},Si={class:`zm-settings-section-title`},Ci={key:0,class:`zm-settings-section-sub`},wi={class:`zm-settings-field`},Ti={class:`zm-settings-value-tag`},Ei={class:`zm-swatch-row`},Di=[`title`,`onClick`],Oi={class:`zm-swatch zm-swatch--custom`,title:`自定义颜色`},ki=[`value`],Ai={class:`zm-settings-field`},ji={class:`zm-settings-value-tag`},Mi={class:`zm-swatch-row`},Ni=[`title`,`onClick`],Pi={class:`zm-swatch zm-swatch--custom`,title:`自定义颜色`},Fi=[`value`],Ii={class:`zm-settings-field`},Li=[`value`],Ri=[`value`],zi={class:`zm-settings-field`},Bi=[`value`],Vi={class:`zm-slider`},Hi=[`value`],Ui={class:`zm-settings-section zm-settings-section--actions`},Wi=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})(x({__name:`SettingsPanel`,props:{settings:{},hasSelection:{type:Boolean},selectedNodeText:{},nodeStyle:{}},emits:[`update:settings`,`update:nodeStyle`,`reset`],setup(e,{emit:t}){let r=e,i=t;function s(e,t){i(`update:settings`,{[e]:t})}let l=[{value:`arc`,label:`圆弧`,viewBox:`0 0 28 14`},{value:`rounded-elbow`,label:`圆角折线`,viewBox:`0 0 28 14`},{value:`elbow`,label:`折线`,viewBox:`0 0 28 14`},{value:`straight`,label:`直线`,viewBox:`0 0 28 14`},{value:`curve`,label:`S曲线`,viewBox:`0 0 28 14`}],d=l,f=[{value:`edge`,label:`左右中点`},{value:`center`,label:`节点正中心`},{value:`proportional`,label:`按比例计算`},{value:`xmind`,label:`分散排布`}],m=[{value:100,label:`100`},{value:200,label:`200`},{value:300,label:`300`},{value:400,label:`400 (常规)`},{value:500,label:`500`},{value:600,label:`600 (半粗)`},{value:700,label:`700 (粗体)`},{value:800,label:`800`},{value:900,label:`900`}];function g(e){i(`update:nodeStyle`,e)}let _=j(()=>[...Ie,...r.settings.customPalettes]),v=y({});function b(e){return v[e.id]===void 0&&(v[e.id]=e.colors.join(`
|
|
55
|
+
`)),v[e.id]}function x(e){let t=Re(v[e.id]??``);if(t.length===0){v[e.id]=e.colors.join(`
|
|
56
|
+
`);return}i(`update:settings`,{customPalettes:r.settings.customPalettes.map(n=>n.id===e.id?{...n,colors:t}:n)})}function C(){let e=_.value.find(e=>e.id===r.settings.branchPaletteId),t=e?[...e.colors]:[...Ie[0].colors],n=`custom-`,a=n+(r.settings.customPalettes.length+1);for(;Ie.some(e=>e.id===a)||r.settings.customPalettes.some(e=>e.id===a);)a=n+Math.random().toString(36).slice(2,7);let o={id:a,name:`我的配色 ${r.settings.customPalettes.length+1}`,colors:t};i(`update:settings`,{customPalettes:[...r.settings.customPalettes,o],branchPaletteId:a}),v[a]=t.join(`
|
|
57
|
+
`)}function w(e){let t=r.settings.customPalettes.filter(t=>t.id!==e.id),n=r.settings.branchPaletteId===e.id?`default`:r.settings.branchPaletteId;i(`update:settings`,{customPalettes:t,...n===r.settings.branchPaletteId?{}:{branchPaletteId:n}}),delete v[e.id]}let T=[`#f87171`,`#fb923c`,`#fbbf24`,`#a3e635`,`#34d399`,`#22d3ee`,`#818cf8`,`#c084fc`,`#1e2937`,`#f8fafc`,`#94a3b8`],E=[`#f8fafc`,`#ffffff`,`#e2e8f0`,`#1e2937`,`#0f172a`,`#fef3c7`,`#dbeafe`,`#dcfce7`,`#fce7f3`,`#f1f5f9`],D=[0,1,2,3],O=[`#f87171`,`#fb923c`,`#34d399`,`#818cf8`];function k(e,t,n,r){if(t<=1)return n;let i=e/(t-1);return n+(r-n)*i}function A(e,t,n,r){let i=t*r**+e;return Math.max(n,i)}let ee=j(()=>{let e=r.settings.lineWidthStart,t=r.settings.lineWidthEnd,n=r.settings.taperedEdge,i=D.length,a=_.value.find(e=>e.id===r.settings.branchPaletteId),o=a&&a.colors.length?a.colors:O;return D.map((a,s)=>{let c=10+s*60/(i-1);return{x1:8,y1:c,x2:192,y2:c,w:n?A(a,e,t,r.settings.lineWidthTaper):k(a,i,e,t),color:r.settings.rainbowBranch?o[s%o.length]:`#94a3b8`}})});return(t,r)=>(h(),p(`div`,Zn,[N(`section`,Qn,[r[52]||=N(`h4`,{class:`zm-settings-section-title`},`画布`,-1),N(`div`,$n,[r[27]||=N(`span`,{class:`zm-settings-label`},`画布背景色`,-1),N(`div`,er,[N(`label`,tr,[N(`input`,{type:`color`,class:`zm-color-input`,value:e.settings.canvasBg||`#f8fafc`,onInput:r[0]||=e=>s(`canvasBg`,e.target.value)},null,40,nr),N(`span`,rr,o(e.settings.canvasBg||`默认`),1)])])]),N(`div`,ir,[(h(),p(S,null,u(E,t=>N(`button`,{key:`cbg-`+t,class:n([`zm-swatch`,{"is-active":(e.settings.canvasBg||`#f8fafc`)===t}]),style:c({background:t}),title:t,onClick:e=>s(`canvasBg`,t)},null,14,ar)),64)),N(`button`,{class:`zm-swatch is-reset`,title:`恢复默认`,onClick:r[1]||=e=>s(`canvasBg`,void 0)},`∅`)]),r[53]||=N(`div`,{class:`zm-settings-divider`},null,-1),N(`div`,or,[r[28]||=N(`span`,{class:`zm-settings-label`},`线条粗端 (根部)`,-1),N(`input`,{class:`zm-settings-number`,type:`number`,step:`0.2`,value:e.settings.lineWidthStart,onChange:r[2]||=e=>s(`lineWidthStart`,parseFloat(e.target.value)||0)},null,40,sr)]),N(`div`,cr,[r[29]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`0.4`,max:`20`,step:`0.2`,value:e.settings.lineWidthStart,onInput:r[3]||=e=>s(`lineWidthStart`,parseFloat(e.target.value))},null,40,lr)]),N(`div`,ur,[r[30]||=N(`span`,{class:`zm-settings-label`},`线条细端 (子端)`,-1),N(`input`,{class:`zm-settings-number`,type:`number`,step:`0.2`,value:e.settings.lineWidthEnd,onChange:r[4]||=e=>s(`lineWidthEnd`,parseFloat(e.target.value)||0)},null,40,dr)]),N(`div`,fr,[r[31]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`0.1`,max:`6`,step:`0.1`,value:e.settings.lineWidthEnd,onInput:r[5]||=e=>s(`lineWidthEnd`,parseFloat(e.target.value))},null,40,pr)]),r[54]||=N(`div`,{class:`zm-settings-divider`},null,-1),N(`div`,mr,[r[32]||=N(`span`,{class:`zm-settings-label`},`根节点线条`,-1),N(`div`,hr,[(h(!0),p(S,null,u(P(d),t=>(h(),p(`button`,{key:t.value,class:n([`zm-line-style-btn`,{"is-on":e.settings.rootLineStyle===t.value}]),title:t.label,onClick:e=>s(`rootLineStyle`,t.value)},[(h(),p(`svg`,{viewBox:t.viewBox,width:`28`,height:`14`,preserveAspectRatio:`none`},[t.value===`arc`?(h(),p(`path`,_r)):t.value===`rounded-elbow`?(h(),p(`path`,vr)):t.value===`elbow`?(h(),p(`path`,yr)):t.value===`curve`?(h(),p(`path`,br)):(h(),p(`line`,xr))],8,X)),N(`span`,Sr,o(t.label),1)],10,gr))),128))])]),N(`div`,Cr,[r[33]||=N(`span`,{class:`zm-settings-label`},`非根节点线条`,-1),N(`div`,wr,[(h(),p(S,null,u(l,t=>N(`button`,{key:t.value,class:n([`zm-line-style-btn`,{"is-on":e.settings.lineStyle===t.value}]),title:t.label,onClick:e=>s(`lineStyle`,t.value)},[(h(),p(`svg`,{viewBox:t.viewBox,width:`28`,height:`14`,preserveAspectRatio:`none`},[t.value===`arc`?(h(),p(`path`,Dr)):t.value===`rounded-elbow`?(h(),p(`path`,Or)):t.value===`elbow`?(h(),p(`path`,kr)):t.value===`curve`?(h(),p(`path`,Ar)):(h(),p(`line`,jr))],8,Er)),N(`span`,Mr,o(t.label),1)],10,Tr)),64))])]),e.settings.lineStyle===`rounded-elbow`||e.settings.rootLineStyle===`rounded-elbow`?(h(),p(`div`,Nr,[N(`span`,Pr,[r[34]||=a(`圆角大小 `,-1),N(`span`,Fr,o(e.settings.elbowRadius)+`px`,1)]),N(`input`,{class:`zm-settings-number`,type:`number`,step:`1`,min:`2`,max:`40`,value:e.settings.elbowRadius,onChange:r[6]||=e=>s(`elbowRadius`,parseFloat(e.target.value)||20)},null,40,Ir)])):M(``,!0),e.settings.lineStyle===`rounded-elbow`||e.settings.rootLineStyle===`rounded-elbow`?(h(),p(`div`,Lr,[r[35]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`2`,max:`40`,step:`1`,value:e.settings.elbowRadius,onInput:r[7]||=e=>s(`elbowRadius`,parseFloat(e.target.value))},null,40,Rr)])):M(``,!0),N(`div`,zr,[r[37]||=N(`span`,{class:`zm-settings-label`},`线条起点`,-1),N(`div`,Br,[(h(),p(S,null,u(f,t=>N(`button`,{key:t.value,class:n([`zm-line-style-btn`,{"is-on":e.settings.lineOrigin===t.value}]),title:t.label,onClick:e=>s(`lineOrigin`,t.value)},[(h(),p(`svg`,Hr,[r[36]||=N(`rect`,{x:`8`,y:`6`,width:`12`,height:`6`,rx:`2`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,opacity:`0.5`},null,-1),t.value===`edge`?(h(),p(`path`,Ur)):t.value===`center`?(h(),p(`path`,Wr)):t.value===`proportional`?(h(),p(`path`,Gr)):(h(),p(`path`,Kr))])),N(`span`,qr,o(t.label),1)],10,Vr)),64))])]),N(`div`,Jr,[r[39]||=N(`span`,{class:`zm-settings-label`},`一级分支彩虹色`,-1),N(`button`,{class:n([`zm-toggle`,{"is-on":e.settings.rainbowBranch}]),onClick:r[8]||=t=>s(`rainbowBranch`,!e.settings.rainbowBranch)},[...r[38]||=[N(`span`,{class:`zm-toggle-knob`},null,-1)]],2)]),e.settings.rainbowBranch?(h(),p(`div`,Yr,[r[40]||=N(`div`,{class:`zm-settings-field`},[N(`span`,{class:`zm-settings-label`},`配色方案`)],-1),N(`div`,Xr,[(h(!0),p(S,null,u(_.value,t=>(h(),p(`button`,{key:t.id,class:n([`zm-palette-option`,{"is-active":e.settings.branchPaletteId===t.id}]),onClick:e=>s(`branchPaletteId`,t.id)},[N(`span`,Qr,o(t.name),1),N(`span`,$r,[(h(!0),p(S,null,u(t.colors,(e,t)=>(h(),p(`span`,{key:t,class:`zm-palette-option-swatch`,style:c({background:e})},null,4))),128))])],10,Zr))),128))]),e.settings.customPalettes.find(t=>t.id===e.settings.branchPaletteId)?(h(),p(`div`,ei,[N(`textarea`,{class:`zm-palette-textarea`,rows:`3`,spellcheck:`false`,placeholder:`一行一个 hex,例如 #f87171`,value:b(e.settings.customPalettes.find(t=>t.id===e.settings.branchPaletteId)),onInput:r[9]||=t=>v[e.settings.customPalettes.find(t=>t.id===e.settings.branchPaletteId).id]=t.target.value},null,40,ti),N(`div`,ni,[N(`button`,{type:`button`,class:`zm-data-btn is-primary`,onClick:r[10]||=t=>x(e.settings.customPalettes.find(t=>t.id===e.settings.branchPaletteId))},`保存`),N(`button`,{type:`button`,class:`zm-data-btn`,onClick:r[11]||=t=>w(e.settings.customPalettes.find(t=>t.id===e.settings.branchPaletteId))},`删除`)])])):M(``,!0),N(`button`,{type:`button`,class:`zm-palette-add`,onClick:C},`+ 新建配色`)])):M(``,!0),r[55]||=N(`div`,{class:`zm-settings-divider`},null,-1),N(`div`,ri,[r[42]||=N(`span`,{class:`zm-settings-label`},`每条连线独立渐变`,-1),N(`button`,{class:n([`zm-toggle`,{"is-on":e.settings.taperedEdge}]),onClick:r[12]||=t=>s(`taperedEdge`,!e.settings.taperedEdge)},[...r[41]||=[N(`span`,{class:`zm-toggle-knob`},null,-1)]],2)]),e.settings.taperedEdge?(h(),p(`div`,ii,[N(`span`,ai,[r[43]||=a(`层级衰减 `,-1),N(`span`,oi,o(Math.round(e.settings.lineWidthTaper*100))+`%`,1)]),N(`input`,{class:`zm-settings-number`,type:`number`,step:`0.05`,min:`0.1`,max:`1`,value:e.settings.lineWidthTaper,onChange:r[13]||=e=>s(`lineWidthTaper`,parseFloat(e.target.value)||.67)},null,40,si)])):M(``,!0),e.settings.taperedEdge?(h(),p(`div`,ci,[r[44]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`0.1`,max:`1`,step:`0.01`,value:e.settings.lineWidthTaper,onInput:r[14]||=e=>s(`lineWidthTaper`,parseFloat(e.target.value))},null,40,li)])):M(``,!0),e.settings.taperedEdge?(h(),p(`div`,ui,[r[46]||=N(`span`,{class:`zm-settings-label`},`非根节点相同粗细`,-1),N(`button`,{class:n([`zm-toggle`,{"is-on":e.settings.uniformLineWidth}]),onClick:r[15]||=t=>s(`uniformLineWidth`,!e.settings.uniformLineWidth)},[...r[45]||=[N(`span`,{class:`zm-toggle-knob`},null,-1)]],2)])):M(``,!0),N(`div`,di,[N(`span`,fi,[r[47]||=a(`一级分支间距 `,-1),N(`span`,pi,o(e.settings.branchGap)+`px`,1)]),N(`input`,{class:`zm-settings-number`,type:`number`,step:`2`,min:`0`,max:`80`,value:e.settings.branchGap,onChange:r[16]||=e=>s(`branchGap`,parseFloat(e.target.value)||0)},null,40,mi)]),N(`div`,hi,[r[48]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`0`,max:`80`,step:`2`,value:e.settings.branchGap,onInput:r[17]||=e=>s(`branchGap`,parseFloat(e.target.value))},null,40,gi)]),N(`div`,_i,[r[50]||=N(`span`,{class:`zm-settings-label`},`显示节点序号`,-1),N(`button`,{class:n([`zm-toggle`,{"is-on":e.settings.showOrderBadge}]),onClick:r[18]||=t=>s(`showOrderBadge`,!e.settings.showOrderBadge)},[...r[49]||=[N(`span`,{class:`zm-toggle-knob`},null,-1)]],2)]),N(`div`,vi,[(h(),p(`svg`,yi,[(h(!0),p(S,null,u(ee.value,(t,n)=>(h(),p(`line`,{key:n,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:e.settings.rainbowBranch?t.color:`#94a3b8`,"stroke-width":t.w,"stroke-linecap":`butt`},null,8,bi))),128))])),r[51]||=N(`div`,{class:`zm-settings-preview-labels`},[N(`span`,null,`根`),N(`span`,null,`1级`),N(`span`,null,`2级`),N(`span`,null,`3级`)],-1)])]),e.hasSelection?(h(),p(`section`,xi,[N(`h4`,Si,[r[56]||=a(` 节点 `,-1),e.selectedNodeText?(h(),p(`span`,Ci,`"`+o(e.selectedNodeText)+`"`,1)):M(``,!0)]),N(`div`,wi,[r[57]||=N(`span`,{class:`zm-settings-label`},`背景颜色`,-1),N(`span`,Ti,o(e.nodeStyle?.bg||`默认`),1)]),N(`div`,Ei,[(h(),p(S,null,u(T,t=>N(`button`,{key:`bg-`+t,class:n([`zm-swatch`,{"is-active":e.nodeStyle?.bg===t}]),style:c({background:t}),title:t,onClick:e=>g({bg:t})},null,14,Di)),64)),N(`label`,Oi,[N(`input`,{type:`color`,value:e.nodeStyle?.bg||`#ffffff`,onInput:r[19]||=e=>g({bg:e.target.value})},null,40,ki)]),N(`button`,{class:`zm-swatch is-reset`,title:`清除`,onClick:r[20]||=e=>g({bg:void 0})},`∅`)]),N(`div`,Ai,[r[58]||=N(`span`,{class:`zm-settings-label`},`文字颜色`,-1),N(`span`,ji,o(e.nodeStyle?.textColor||`默认`),1)]),N(`div`,Mi,[(h(),p(S,null,u(T,t=>N(`button`,{key:`fg-`+t,class:n([`zm-swatch`,{"is-active":e.nodeStyle?.textColor===t}]),style:c({background:t}),title:t,onClick:e=>g({textColor:t})},null,14,Ni)),64)),N(`label`,Pi,[N(`input`,{type:`color`,value:e.nodeStyle?.textColor||`#1e2937`,onInput:r[21]||=e=>g({textColor:e.target.value})},null,40,Fi)]),N(`button`,{class:`zm-swatch is-reset`,title:`清除`,onClick:r[22]||=e=>g({textColor:void 0})},`∅`)]),r[62]||=N(`div`,{class:`zm-settings-divider`},null,-1),N(`div`,Ii,[r[59]||=N(`span`,{class:`zm-settings-label`},`字重`,-1),N(`select`,{class:`zm-select`,value:e.nodeStyle?.fontWeight??400,onChange:r[23]||=e=>g({fontWeight:parseInt(e.target.value)})},[(h(),p(S,null,u(m,e=>N(`option`,{key:e.value,value:e.value},o(e.label),9,Ri)),64))],40,Li)]),N(`div`,zi,[r[60]||=N(`span`,{class:`zm-settings-label`},`文字大小`,-1),N(`input`,{class:`zm-settings-number`,type:`number`,step:`1`,min:`8`,max:`48`,value:e.nodeStyle?.fontSize??14,onChange:r[24]||=e=>g({fontSize:parseInt(e.target.value)||14})},null,40,Bi)]),N(`div`,Vi,[r[61]||=N(`div`,{class:`zm-slider-track`},null,-1),N(`input`,{type:`range`,min:`8`,max:`48`,step:`1`,value:e.nodeStyle?.fontSize??14,onInput:r[25]||=e=>g({fontSize:parseInt(e.target.value)})},null,40,Hi)]),r[63]||=N(`p`,{class:`zm-settings-hint`},`仅作用于当前节点,不影响子节点。`,-1)])):M(``,!0),N(`section`,Ui,[N(`button`,{class:`zm-settings-reset`,onClick:r[26]||=e=>i(`reset`)},`恢复默认设置`)])]))}}),[[`__scopeId`,`data-v-d9ae9516`]]),Gi=20;function Ki(e,t){e.style.height=`auto`;let n=t.minRows*Gi,r=t.maxRows>0?t.maxRows*Gi:1/0,i=Math.max(n,Math.min(r,e.scrollHeight));e.style.height=i+`px`,e.style.overflowY=e.scrollHeight>r?`auto`:`hidden`}function qi(n,r={}){let i={minRows:r.minRows??3,maxRows:r.maxRows??12};function a(){let e=n.value;e&&Ki(e,i)}function o(){a()}s(async()=>{await d();let e=n.value;e&&(e.addEventListener(`input`,o),a())}),e(()=>n.value?.value,()=>a()),t(()=>{let e=n.value;e&&e.removeEventListener(`input`,o)})}function Ji(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function Yi(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t],r=typeof n;(r===`object`||r===`function`)&&!Object.isFrozen(n)&&Yi(n)}),e}var Xi=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Zi(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Qi(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var $i=`</span>`,ea=e=>!!e.scope,ta=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},na=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=Zi(e)}openNode(e){if(!ea(e))return;let t=ta(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){ea(e)&&(this.buffer+=$i)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},ra=(e={})=>{let t={children:[]};return Object.assign(t,e),t},ia=class e{constructor(){this.rootNode=ra(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=ra({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},aa=class extends ia{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new na(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function oa(e){return e?typeof e==`string`?e:e.source:null}function sa(e){return ua(`(?=`,e,`)`)}function ca(e){return ua(`(?:`,e,`)*`)}function la(e){return ua(`(?:`,e,`)?`)}function ua(...e){return e.map(e=>oa(e)).join(``)}function da(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function fa(...e){return`(`+(da(e).capture?``:`?:`)+e.map(e=>oa(e)).join(`|`)+`)`}function pa(e){return RegExp(e.toString()+`|`).exec(``).length-1}function ma(e,t){let n=e&&e.exec(t);return n&&n.index===0}var ha=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function ga(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=oa(e),i=``;for(;r.length>0;){let e=ha.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var _a=/\b\B/,va=`[a-zA-Z]\\w*`,ya=`[a-zA-Z_]\\w*`,ba=`\\b\\d+(\\.\\d+)?`,xa=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,Sa=`\\b(0b[01]+)`,Ca=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,wa=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=ua(t,/.*\b/,e.binary,/\b.*/)),Qi({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},Ta={begin:`\\\\[\\s\\S]`,relevance:0},Ea={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[Ta]},Da={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[Ta]},Oa={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},ka=function(e,t,n={}){let r=Qi({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=fa(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:ua(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},Aa=ka(`//`,`$`),ja=ka(`/\\*`,`\\*/`),Ma=ka(`#`,`$`),Na=Object.freeze({__proto__:null,APOS_STRING_MODE:Ea,BACKSLASH_ESCAPE:Ta,BINARY_NUMBER_MODE:{scope:`number`,begin:Sa,relevance:0},BINARY_NUMBER_RE:Sa,COMMENT:ka,C_BLOCK_COMMENT_MODE:ja,C_LINE_COMMENT_MODE:Aa,C_NUMBER_MODE:{scope:`number`,begin:xa,relevance:0},C_NUMBER_RE:xa,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:Ma,IDENT_RE:va,MATCH_NOTHING_RE:_a,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:ba,relevance:0},NUMBER_RE:ba,PHRASAL_WORDS_MODE:Oa,QUOTE_STRING_MODE:Da,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ta,{begin:/\[/,end:/\]/,relevance:0,contains:[Ta]}]},RE_STARTERS_RE:Ca,SHEBANG:wa,TITLE_MODE:{scope:`title`,begin:va,relevance:0},UNDERSCORE_IDENT_RE:ya,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:ya,relevance:0}});function Pa(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function Fa(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Ia(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=Pa,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function La(e,t){Array.isArray(e.illegal)&&(e.illegal=fa(...e.illegal))}function Ra(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function za(e,t){e.relevance===void 0&&(e.relevance=1)}var Ba=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=ua(n.beforeMatch,sa(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},Va=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],Ha=`keyword`;function Ua(e,t,n=Ha){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,Ua(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,Wa(n[0],n[1])]})}}function Wa(e,t){return t?Number(t):+!Ga(e)}function Ga(e){return Va.includes(e.toLowerCase())}var Ka={},qa=e=>{console.error(e)},Ja=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Ya=(e,t)=>{Ka[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Ka[`${e}/${t}`]=!0)},Xa=Error();function Za(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=pa(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function Qa(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw qa(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),Xa;if(typeof e.beginScope!=`object`||e.beginScope===null)throw qa(`beginScope must be object`),Xa;Za(e,e.begin,{key:`beginScope`}),e.begin=ga(e.begin,{joinWith:``})}}function $a(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw qa(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),Xa;if(typeof e.endScope!=`object`||e.endScope===null)throw qa(`endScope must be object`),Xa;Za(e,e.end,{key:`endScope`}),e.end=ga(e.end,{joinWith:``})}}function eo(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function to(e){eo(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),Qa(e),$a(e)}function no(e){function t(t,n){return new RegExp(oa(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=pa(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(ga(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function a(n,r){let o=n;if(n.isCompiled)return o;[Fa,Ra,to,Ba].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[Ia,La,za].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=Ua(n.keywords,e.case_insensitive),o.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,o.beginRe=t(o.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(o.endRe=t(o.end)),o.terminatorEnd=oa(o.end)||``,n.endsWithParent&&r.terminatorEnd&&(o.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(o.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return io(e===`self`?n:e)})),n.contains.forEach(function(e){a(e,o)}),n.starts&&a(n.starts,r),o.matcher=i(o),o}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Qi(e.classNameAliases||{}),a(e)}function ro(e){return e?e.endsWithParent||ro(e.starts):!1}function io(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Qi(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:ro(e)?Qi(e,{starts:e.starts?Qi(e.starts):null}):Object.isFrozen(e)?Qi(e):e}var ao=`11.11.1`,oo=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},so=Zi,co=Qi,lo=Symbol(`nomatch`),uo=7,fo=function(e){let t=Object.create(null),n=Object.create(null),r=[],i=!0,a=`Could not find the language '{}', did you forget to load/include a language module?`,o={disableAutodetect:!0,name:`Plain text`,contains:[]},s={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:aa};function c(e){return s.noHighlightRe.test(e)}function l(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=s.languageDetectRe.exec(t);if(n){let t=w(n[1]);return t||(Ja(a.replace(`{}`,n[1])),Ja(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>c(e)||w(e))}function u(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(Ya(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),Ya(`10.7.0`,`Please use highlight(code, options) instead.
|
|
58
58
|
https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};A(`before:highlight`,a);let o=a.result?a.result:d(a.language,a.code,n);return o.code=a.code,A(`after:highlight`,o),o}function d(e,n,r,o){let c=Object.create(null);function l(e,t){return e.keywords[t]}function u(){if(!k.keywords){j.addText(M);return}let e=0;k.keywordPatternRe.lastIndex=0;let t=k.keywordPatternRe.exec(M),n=``;for(;t;){n+=M.substring(e,t.index);let r=E.case_insensitive?t[0].toLowerCase():t[0],i=l(k,r);if(i){let[e,a]=i;if(j.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=uo&&(N+=a),e.startsWith(`_`))n+=t[0];else{let n=E.classNameAliases[e]||e;h(t[0],n)}}else n+=t[0];e=k.keywordPatternRe.lastIndex,t=k.keywordPatternRe.exec(M)}n+=M.substring(e),j.addText(n)}function f(){if(M===``)return;let e=null;if(typeof k.subLanguage==`string`){if(!t[k.subLanguage]){j.addText(M);return}e=d(k.subLanguage,M,!0,A[k.subLanguage]),A[k.subLanguage]=e._top}else e=p(M,k.subLanguage.length?k.subLanguage:null);k.relevance>0&&(N+=e.relevance),j.__addSublanguage(e._emitter,e.language)}function m(){k.subLanguage==null?u():f(),M=``}function h(e,t){e!==``&&(j.startScope(t),j.addText(e),j.endScope())}function g(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=E.classNameAliases[e[n]]||e[n],i=t[n];r?h(i,r):(M=i,u(),M=``),n++}}function _(e,t){return e.scope&&typeof e.scope==`string`&&j.openNode(E.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(h(M,E.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),M=``):e.beginScope._multi&&(g(e.beginScope,t),M=``)),k=Object.create(e,{parent:{value:k}}),k}function v(e,t,n){let r=ma(e.endRe,n);if(r){if(e[`on:end`]){let n=new Xi(e);e[`on:end`](t,n),n.isMatchIgnored&&(r=!1)}if(r){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return v(e.parent,t,n)}function y(e){return k.matcher.regexIndex===0?(M+=e[0],1):(F=!0,0)}function b(e){let t=e[0],n=e.rule,r=new Xi(n),i=[n.__beforeBegin,n[`on:begin`]];for(let n of i)if(n&&(n(e,r),r.isMatchIgnored))return y(t);return n.skip?M+=t:(n.excludeBegin&&(M+=t),m(),!n.returnBegin&&!n.excludeBegin&&(M=t)),_(n,e),n.returnBegin?0:t.length}function x(e){let t=e[0],r=n.substring(e.index),i=v(k,e,r);if(!i)return lo;let a=k;k.endScope&&k.endScope._wrap?(m(),h(t,k.endScope._wrap)):k.endScope&&k.endScope._multi?(m(),g(k.endScope,e)):a.skip?M+=t:(a.returnEnd||a.excludeEnd||(M+=t),m(),a.excludeEnd&&(M=t));do k.scope&&j.closeNode(),!k.skip&&!k.subLanguage&&(N+=k.relevance),k=k.parent;while(k!==i.parent);return i.starts&&_(i.starts,e),a.returnEnd?0:t.length}function S(){let e=[];for(let t=k;t!==E;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>j.openNode(e))}let C={};function T(t,a){let o=a&&a[0];if(M+=t,o==null)return m(),0;if(C.type===`begin`&&a.type===`end`&&C.index===a.index&&o===``){if(M+=n.slice(a.index,a.index+1),!i){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=C.rule,t}return 1}if(C=a,a.type===`begin`)return b(a);if(a.type===`illegal`&&!r){let e=Error(`Illegal lexeme "`+o+`" for mode "`+(k.scope||`<unnamed>`)+`"`);throw e.mode=k,e}else if(a.type===`end`){let e=x(a);if(e!==lo)return e}if(a.type===`illegal`&&o===``)return M+=`
|
|
59
59
|
`,1;if(ee>1e5&&ee>a.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return M+=o,o.length}let E=w(e);if(!E)throw qa(a.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let D=no(E),O=``,k=o||D,A={},j=new s.__emitter(s);S();let M=``,N=0,P=0,ee=0,F=!1;try{if(E.__emitTokens)E.__emitTokens(n,j);else{for(k.matcher.considerAll();;){ee++,F?F=!1:k.matcher.considerAll(),k.matcher.lastIndex=P;let e=k.matcher.exec(n);if(!e)break;let t=T(n.substring(P,e.index),e);P=e.index+t}T(n.substring(P))}return j.finalize(),O=j.toHTML(),{language:e,value:O,relevance:N,illegal:!1,_emitter:j,_top:k}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:so(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:P,context:n.slice(P-100,P+100),mode:t.mode,resultSoFar:O},_emitter:j};if(i)return{language:e,value:so(n),illegal:!1,relevance:0,errorRaised:t,_emitter:j,_top:k};throw t}}function f(e){let t={value:so(e),illegal:!1,relevance:0,_top:o,_emitter:new s.__emitter(s)};return t._emitter.addText(e),t}function p(e,n){n=n||s.languages||Object.keys(t);let r=f(e),i=n.filter(w).filter(E).map(t=>d(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(w(e.language).supersetOf===t.language)return 1;if(w(t.language).supersetOf===e.language)return-1}return 0}),c=a;return c.secondBest=o,c}function m(e,t,r){let i=t&&n[t]||r;e.classList.add(`hljs`),e.classList.add(`language-${i}`)}function h(e){let t=null,n=l(e);if(c(n))return;if(A(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(s.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),s.throwUnescapedHTML))throw new oo(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?u(r,{language:n,ignoreIllegals:!0}):p(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,m(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),A(`after:highlightElement`,{el:e,result:i,text:r})}function g(e){s=co(s,e)}let _=()=>{b(),Ya(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function v(){b(),Ya(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let y=!1;function b(){function e(){b()}if(document.readyState===`loading`){y||window.addEventListener(`DOMContentLoaded`,e,!1),y=!0;return}document.querySelectorAll(s.cssSelector).forEach(h)}function x(n,r){let a=null;try{a=r(e)}catch(e){if(qa(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),i)qa(e);else throw e;a=o}a.name||=n,t[n]=a,a.rawDefinition=r.bind(null,e),a.aliases&&T(a.aliases,{languageName:n})}function S(e){delete t[e];for(let t of Object.keys(n))n[t]===e&&delete n[t]}function C(){return Object.keys(t)}function w(e){return e=(e||``).toLowerCase(),t[e]||t[n[e]]}function T(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{n[e.toLowerCase()]=t})}function E(e){let t=w(e);return t&&!t.disableAutodetect}function D(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function O(e){D(e),r.push(e)}function k(e){let t=r.indexOf(e);t!==-1&&r.splice(t,1)}function A(e,t){let n=e;r.forEach(function(e){e[n]&&e[n](t)})}function j(e){return Ya(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),Ya(`10.7.0`,`Please use highlightElement now.`),h(e)}Object.assign(e,{highlight:u,highlightAuto:p,highlightAll:b,highlightElement:h,highlightBlock:j,configure:g,initHighlighting:_,initHighlightingOnLoad:v,registerLanguage:x,unregisterLanguage:S,listLanguages:C,getLanguage:w,registerAliases:T,autoDetection:E,inherit:co,addPlugin:O,removePlugin:k}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=ao,e.regex={concat:ua,lookahead:sa,either:fa,optional:la,anyNumberOfTimes:ca};for(let e in Na)typeof Na[e]==`object`&&Yi(Na[e]);return Object.assign(e,Na),e},po=fo({});po.newInstance=()=>fo({});var mo=po;po.HighlightJS=po,po.default=po;var ho=Ji(mo);function go(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:[`self`,{begin:/:-/,contains:[n]}]};Object.assign(n,{className:`variable`,variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,`(?![\\w\\d])(?![$])`)},r]});let i={className:`subst`,begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:`comment`}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:`string`})]}},s={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let c={match:/\\"/},l={className:`string`,begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:`number`},e.NUMBER_MODE,n]},f=e.SHEBANG({binary:`(${[`fish`,`bash`,`zsh`,`sh`,`csh`,`ksh`,`tcsh`,`dash`,`scsh`].join(`|`)})`,relevance:10}),p={className:`function`,begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=[`if`,`then`,`else`,`elif`,`fi`,`time`,`for`,`while`,`until`,`in`,`do`,`done`,`case`,`esac`,`coproc`,`function`,`select`],h=[`true`,`false`],g={match:/(\/[a-z._-]+)+/},_=[`break`,`cd`,`continue`,`eval`,`exec`,`exit`,`export`,`getopts`,`hash`,`pwd`,`readonly`,`return`,`shift`,`test`,`times`,`trap`,`umask`,`unset`],v=[`alias`,`bind`,`builtin`,`caller`,`command`,`declare`,`echo`,`enable`,`help`,`let`,`local`,`logout`,`mapfile`,`printf`,`read`,`readarray`,`source`,`sudo`,`type`,`typeset`,`ulimit`,`unalias`],y=`autoload.bg.bindkey.bye.cap.chdir.clone.comparguments.compcall.compctl.compdescribe.compfiles.compgroups.compquote.comptags.comptry.compvalues.dirs.disable.disown.echotc.echoti.emulate.fc.fg.float.functions.getcap.getln.history.integer.jobs.kill.limit.log.noglob.popd.print.pushd.pushln.rehash.sched.setcap.setopt.stat.suspend.ttyctl.unfunction.unhash.unlimit.unsetopt.vared.wait.whence.where.which.zcompile.zformat.zftp.zle.zmodload.zparseopts.zprof.zpty.zregexparse.zsocket.zstyle.ztcp`.split(`.`),b=`chcon.chgrp.chown.chmod.cp.dd.df.dir.dircolors.ln.ls.mkdir.mkfifo.mknod.mktemp.mv.realpath.rm.rmdir.shred.sync.touch.truncate.vdir.b2sum.base32.base64.cat.cksum.comm.csplit.cut.expand.fmt.fold.head.join.md5sum.nl.numfmt.od.paste.ptx.pr.sha1sum.sha224sum.sha256sum.sha384sum.sha512sum.shuf.sort.split.sum.tac.tail.tr.tsort.unexpand.uniq.wc.arch.basename.chroot.date.dirname.du.echo.env.expr.factor.groups.hostid.id.link.logname.nice.nohup.nproc.pathchk.pinky.printenv.printf.pwd.readlink.runcon.seq.sleep.stat.stdbuf.stty.tee.test.timeout.tty.uname.unlink.uptime.users.who.whoami.yes`.split(`.`);return{name:`Bash`,aliases:[`sh`,`zsh`],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:h,built_in:[..._,...v,`set`,`shopt`,...y,...b]},contains:[f,e.SHEBANG(),p,d,a,o,g,s,c,l,u,n]}}var _o=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),vo=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),yo=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),bo=[...vo,...yo],xo=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),So=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),Co=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),wo=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function To(e){let t=e.regex,n=_o(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i=/@-?\w[\w]*(-\w+)*/,a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:`CSS`,case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:`from to`},classNameAliases:{keyframePosition:`selector-tag`},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:`selector-id`,begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:`selector-class`,begin:`\\.[a-zA-Z-][a-zA-Z0-9_-]*`,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,variants:[{begin:`:(`+So.join(`|`)+`)`},{begin:`:(:)?(`+Co.join(`|`)+`)`}]},n.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+wo.join(`|`)+`)\\b`},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:`url data-uri`},contains:[...a,{className:`string`,begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:`[{;]`,relevance:0,illegal:/:/,contains:[{className:`keyword`,begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:xo.join(` `)},contains:[{begin:/[a-z-]+(?=:)/,className:`attribute`},...a,n.CSS_NUMBER_MODE]}]},{className:`selector-tag`,begin:`\\b(`+bo.join(`|`)+`)\\b`}]}}function Eo(e){let t={keyword:[`break`,`case`,`chan`,`const`,`continue`,`default`,`defer`,`else`,`fallthrough`,`for`,`func`,`go`,`goto`,`if`,`import`,`interface`,`map`,`package`,`range`,`return`,`select`,`struct`,`switch`,`type`,`var`],type:[`bool`,`byte`,`complex64`,`complex128`,`error`,`float32`,`float64`,`int8`,`int16`,`int32`,`int64`,`string`,`uint8`,`uint16`,`uint32`,`uint64`,`int`,`uint`,`uintptr`,`rune`],literal:[`true`,`false`,`iota`,`nil`],built_in:[`append`,`cap`,`close`,`complex`,`copy`,`imag`,`len`,`make`,`new`,`panic`,`print`,`println`,`real`,`recover`,`delete`]};return{name:`Go`,aliases:[`golang`],keywords:t,illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`string`,variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:`number`,variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:`function`,beginKeywords:`func`,end:`\\s*(\\{|$)`,excludeEnd:!0,contains:[e.TITLE_MODE,{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}var Do=`[0-9](_*[0-9])*`,Oo=`\\.(${Do})`,ko=`[0-9a-fA-F](_*[0-9a-fA-F])*`,Ao={className:`number`,variants:[{begin:`(\\b(${Do})((${Oo})|\\.)?|(${Oo}))[eE][+-]?(${Do})[fFdD]?\\b`},{begin:`\\b(${Do})((${Oo})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Oo})[fFdD]?\\b`},{begin:`\\b(${Do})[fFdD]\\b`},{begin:`\\b0[xX]((${ko})\\.?|(${ko})?\\.(${ko}))[pP][+-]?(${Do})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${ko})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function jo(e,t,n){return n===-1?``:e.replace(t,r=>jo(e,t,n-1))}function Mo(e){let t=e.regex,n=`[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*`,r=n+jo(`(?:<[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~(?:\\s*,\\s*[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~)*>)?`,/~~~/g,2),i={keyword:`synchronized.abstract.private.var.static.if.const .for.while.strictfp.finally.protected.import.native.final.void.enum.else.break.transient.catch.instanceof.volatile.case.assert.package.default.public.try.switch.continue.throws.protected.public.private.module.requires.exports.do.sealed.yield.permits.goto.when`.split(`.`),literal:[`false`,`true`,`null`],type:[`char`,`boolean`,`long`,`float`,`int`,`byte`,`short`,`double`],built_in:[`super`,`this`]},a={className:`meta`,begin:`@[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*`,contains:[{begin:/\(/,end:/\)/,contains:[`self`]}]},o={className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:`Java`,aliases:[`jsp`],keywords:i,illegal:/<\/|#/,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:`doctag`,begin:`@[A-Za-z]+`}]}),{begin:/import java\.[a-z]+\./,keywords:`import`,relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:`string`,contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:`keyword`,3:`title.class`}},{match:/non-sealed/,scope:`keyword`},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:`type`,3:`variable`,5:`operator`}},{begin:[/record/,/\s+/,n],className:{1:`keyword`,3:`title.class`},contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`new throw return else`,relevance:0},{begin:[`(?:`+r+`\\s+)`,e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:`title.function`},keywords:i,contains:[{className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[a,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Ao,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Ao,a]}}var No=`[A-Za-z$_][0-9A-Za-z$_]*`,Po=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),Fo=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],Io=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),Lo=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Ro=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],zo=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],Bo=[].concat(Ro,Io,Lo);function Vo(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=No,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:No,keyword:Po,literal:Fo,built_in:Bo,"variable.language":zo},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:`[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...Io,...Lo]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...Ro,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$[A-Za-z$_][0-9A-Za-z$_]*`,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function Ho(e){let t={className:`attr`,begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:`punctuation`,relevance:0},r=[`true`,`false`,`null`],i={scope:`literal`,beginKeywords:r.join(` `)};return{name:`JSON`,aliases:[`jsonc`],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:`\\S`}}function Uo(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={begin:`^[-\\*]{3,}`,end:`$`},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,r,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Wo(e){let t=e.regex,n=RegExp(`[\\p{XID_Start}_]\\p{XID_Continue}*`,`u`),r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}function Go(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={className:`title.function.invoke`,relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o=`abstract.as.async.await.become.box.break.const.continue.crate.do.dyn.else.enum.extern.false.final.fn.for.if.impl.in.let.loop.macro.match.mod.move.mut.override.priv.pub.ref.return.self.Self.static.struct.super.trait.true.try.type.typeof.union.unsafe.unsized.use.virtual.where.while.yield`.split(`.`),s=[`true`,`false`,`Some`,`None`,`Ok`,`Err`],c=`drop .Copy.Send.Sized.Sync.Drop.Fn.FnMut.FnOnce.ToOwned.Clone.Debug.PartialEq.PartialOrd.Eq.Ord.AsRef.AsMut.Into.From.Default.Iterator.Extend.IntoIterator.DoubleEndedIterator.ExactSizeIterator.SliceConcatExt.ToString.assert!.assert_eq!.bitflags!.bytes!.cfg!.col!.concat!.concat_idents!.debug_assert!.debug_assert_eq!.env!.eprintln!.panic!.file!.format!.format_args!.include_bytes!.include_str!.line!.local_data_key!.module_path!.option_env!.print!.println!.select!.stringify!.try!.unimplemented!.unreachable!.vec!.write!.writeln!.macro_rules!.assert_ne!.debug_assert_ne!`.split(`.`),l=[`i8`,`i16`,`i32`,`i64`,`i128`,`isize`,`u8`,`u16`,`u32`,`u64`,`u128`,`usize`,`f32`,`f64`,`str`,`char`,`bool`,`Box`,`Option`,`Result`,`String`,`Vec`];return{name:`Rust`,aliases:[`rs`],keywords:{$pattern:e.IDENT_RE+`!?`,type:l,keyword:o,literal:s,built_in:c},illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:`symbol`,begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:`string`,variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:`char.escape`,match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:`number`,variants:[{begin:`\\b0b([01_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b0o([0-7_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b0x([A-Fa-f0-9_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)([ui](8|16|32|64|128|size)|f(32|64))?`}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:`keyword`,3:`title.function`}},{className:`meta`,begin:`#!?\\[`,end:`\\]`,contains:[{className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:`keyword`,3:`keyword`,4:`variable`}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:`keyword`,3:`variable`,5:`keyword`}},{begin:[/type/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:e.IDENT_RE+`::`,keywords:{keyword:`Self`,built_in:c,type:l}},{className:`punctuation`,begin:`->`},a]}}function Ko(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t||=[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}var qo=`[A-Za-z$_][0-9A-Za-z$_]*`,Jo=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),Yo=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],Xo=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),Zo=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Qo=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],$o=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],es=[].concat(Qo,Xo,Zo);function ts(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=qo,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:qo,keyword:Jo,literal:Yo,built_in:es,"variable.language":$o},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:`[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...Xo,...Zo]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...Qo,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$[A-Za-z$_][0-9A-Za-z$_]*`,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function ns(e){let t=e.regex,n=ts(e),r=qo,i=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},o={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},c={$pattern:qo,keyword:Jo.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:Yo,built_in:es.concat(i),"variable.language":$o},l={className:`meta`,begin:`@[A-Za-z$_][0-9A-Za-z$_]*`},u=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(l);let d=n.contains.find(e=>e.scope===`attr`),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([l,a,o,f]),u(n,`shebang`,e.SHEBANG()),u(n,`use_strict`,s);let p=n.contains.find(e=>e.label===`func.def`);return p.relevance=0,Object.assign(n,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),n}function rs(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function is(e){let t=`true false yes no null`,n={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},a={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),s={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},c={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},l={begin:/\{/,end:/\}/,contains:[c],illegal:`\\n`,relevance:0},u={begin:`\\[`,end:`\\]`,contains:[c],illegal:`\\n`,relevance:0},d=[n,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!<[\\w#;/?:@&=+$,.~*'()[\\]]+>`},{className:`type`,begin:`![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},s,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},l,u,i,a],f=[...d];return f.pop(),f.push(o),c.contains=f,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:d}}var as={bash:go,sh:go,shell:go,css:To,go:Eo,golang:Eo,java:Mo,javascript:Vo,js:Vo,json:Ho,markdown:Uo,md:Uo,python:Wo,py:Wo,rust:Go,rs:Go,sql:Ko,typescript:ns,ts:ns,xml:rs,html:rs,yaml:is,yml:is};for(let[e,t]of Object.entries(as))ho.registerLanguage(e,t);function os(e){let t=e.split(`
|
|
60
60
|
`);return/^(`{3,}|~{3,})/.test(t[0]??``)&&t.shift(),/^(`{3,}|~{3,})\s*$/.test(t[t.length-1]??``)&&t.pop(),t.join(`
|
|
@@ -125,15 +125,15 @@ ${e}</tr>
|
|
|
125
125
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Tc(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Ec(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Tc(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Ec(e);if(i===null)return Tc(n);e=i;let a=`<img src="${e}" alt="${Tc(n)}"`;return t&&(a+=` title="${Tc(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Tc(e.text)}},Lc=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Rc=class e{constructor(e){I(this,`options`),I(this,`renderer`),I(this,`textRenderer`),this.options=e||fs,this.options.renderer=this.options.renderer||new Ic,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Lc}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){var t;this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if((t=this.options.extensions?.renderers)!=null&&t[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);break;case`hr`:n+=this.renderer.hr(a);break;case`heading`:n+=this.renderer.heading(a);break;case`code`:n+=this.renderer.code(a);break;case`table`:n+=this.renderer.table(a);break;case`blockquote`:n+=this.renderer.blockquote(a);break;case`list`:n+=this.renderer.list(a);break;case`checkbox`:n+=this.renderer.checkbox(a);break;case`html`:n+=this.renderer.html(a);break;case`def`:n+=this.renderer.def(a);break;case`paragraph`:n+=this.renderer.paragraph(a);break;case`text`:n+=this.renderer.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){var n;this.renderer.parser=this;let r=``;for(let i=0;i<e.length;i++){let a=e[i];if((n=this.options.extensions?.renderers)!=null&&n[a.type]){let e=this.options.extensions.renderers[a.type].call({parser:this},a);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(a.type)){r+=e||``;continue}}let o=a;switch(o.type){case`escape`:r+=t.text(o);break;case`html`:r+=t.html(o);break;case`link`:r+=t.link(o);break;case`image`:r+=t.image(o);break;case`checkbox`:r+=t.checkbox(o);break;case`strong`:r+=t.strong(o);break;case`em`:r+=t.em(o);break;case`codespan`:r+=t.codespan(o);break;case`br`:r+=t.br(o);break;case`del`:r+=t.del(o);break;case`text`:r+=t.text(o);break;default:{let e=`Token with "`+o.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return r}},zc,Bc=(zc=class{constructor(e){I(this,`options`),I(this,`block`),this.options=e||fs}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Fc.lex:Fc.lexInline}provideParser(e=this.block){return e?Rc.parse:Rc.parseInline}},I(zc,`passThroughHooks`,new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`])),I(zc,`passThroughHooksRespectAsync`,new Set([`preprocess`,`postprocess`,`processAllTokens`])),zc),Vc=class{constructor(...e){I(this,`defaults`,ds()),I(this,`options`,this.setOptions),I(this,`parse`,this.parseMarkdown(!0)),I(this,`parseInline`,this.parseMarkdown(!1)),I(this,`Parser`,Rc),I(this,`Renderer`,Ic),I(this,`TextRenderer`,Lc),I(this,`Lexer`,Fc),I(this,`Tokenizer`,Pc),I(this,`Hooks`,Bc),this.use(...e)}walkTokens(e,t){var n;let r=[];for(let i of e)switch(r=r.concat(t.call(this,i)),i.type){case`table`:{let e=i;for(let n of e.header)r=r.concat(this.walkTokens(n.tokens,t));for(let n of e.rows)for(let e of n)r=r.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=i;r=r.concat(this.walkTokens(e.items,t));break}default:{let e=i;(n=this.defaults.extensions?.childTokens)!=null&&n[e.type]?this.defaults.extensions.childTokens[e.type].forEach(n=>{let i=e[n].flat(1/0);r=r.concat(this.walkTokens(i,t))}):e.tokens&&(r=r.concat(this.walkTokens(e.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Ic(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Pc(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Bc;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Bc.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Bc.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Fc.lex(e,t??this.defaults)}parser(e,t){return Rc.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Fc.lex:Fc.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Rc.parse:Rc.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Fc.lex:Fc.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Rc.parse:Rc.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
126
126
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Tc(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Hc=new Vc;function Q(e,t){return Hc.parse(e,t)}Q.options=Q.setOptions=function(e){return Hc.setOptions(e),Q.defaults=Hc.defaults,ps(Q.defaults),Q},Q.getDefaults=ds,Q.defaults=fs,Q.use=function(...e){return Hc.use(...e),Q.defaults=Hc.defaults,ps(Q.defaults),Q},Q.walkTokens=function(e,t){return Hc.walkTokens(e,t)},Q.parseInline=Hc.parseInline,Q.Parser=Rc,Q.parser=Rc.parse,Q.Renderer=Ic,Q.TextRenderer=Lc,Q.Lexer=Fc,Q.lexer=Fc.lex,Q.Tokenizer=Pc,Q.Hooks=Bc,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,Rc.parse,Fc.lex;function Uc(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Wc(e){if(Array.isArray(e))return e}function Gc(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Kc(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
127
127
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qc(e,t){return Wc(e)||Gc(e,t)||Jc(e,t)||Kc()}function Jc(e,t){if(e){if(typeof e==`string`)return Uc(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Uc(e,t):void 0}}var Yc=Object.entries,Xc=Object.setPrototypeOf,Zc=Object.isFrozen,Qc=Object.getPrototypeOf,$c=Object.getOwnPropertyDescriptor,el=Object.freeze,tl=Object.seal,nl=Object.create,rl=typeof Reflect<`u`&&Reflect,il=rl.apply,al=rl.construct;el||=function(e){return e},tl||=function(e){return e},il||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},al||=function(e){return new e(...[...arguments].slice(1))};var ol=El(Array.prototype.forEach),sl=El(Array.prototype.lastIndexOf),cl=El(Array.prototype.pop),ll=El(Array.prototype.push),ul=El(Array.prototype.splice),dl=Array.isArray,fl=El(String.prototype.toLowerCase),pl=El(String.prototype.toString),ml=El(String.prototype.match),hl=El(String.prototype.replace),gl=El(String.prototype.indexOf),_l=El(String.prototype.trim),vl=El(Number.prototype.toString),yl=El(Boolean.prototype.toString),bl=typeof BigInt>`u`?null:El(BigInt.prototype.toString),xl=typeof Symbol>`u`?null:El(Symbol.prototype.toString),Sl=El(Object.prototype.hasOwnProperty),Cl=El(Object.prototype.toString),wl=El(RegExp.prototype.test),Tl=Dl(TypeError);function El(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return il(e,t,n)}}function Dl(e){return function(){return al(e,[...arguments])}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fl;if(Xc&&Xc(e,null),!dl(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Zc(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Ol(e){for(let t=0;t<e.length;t++)Sl(e,t)||(e[t]=null);return e}function kl(e){let t=nl(null);for(let r of Yc(e)){var n=qc(r,2);let i=n[0],a=n[1];Sl(e,i)&&(dl(a)?t[i]=Ol(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=kl(a):t[i]=a)}return t}function Al(e){switch(typeof e){case`string`:return e;case`number`:return vl(e);case`boolean`:return yl(e);case`bigint`:return bl?bl(e):`0`;case`symbol`:return xl?xl(e):`Symbol()`;case`undefined`:return Cl(e);case`function`:case`object`:{if(e===null)return Cl(e);let t=e,n=jl(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Cl(e)}return Cl(e)}default:return Cl(e)}}function jl(e,t){for(;e!==null;){let n=$c(e,t);if(n){if(n.get)return El(n.get);if(typeof n.value==`function`)return El(n.value)}e=Qc(e)}function n(){return null}return n}function Ml(e){try{return wl(e,``),!0}catch{return!1}}var Nl=el(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Pl=el(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Fl=el([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Il=el([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Ll=el(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Rl=el([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),zl=el([`#text`]),Bl=el(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Vl=el(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Hl=el(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Ul=el([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Wl=tl(/{{[\w\W]*|^[\w\W]*}}/g),Gl=tl(/<%[\w\W]*|^[\w\W]*%>/g),Kl=tl(/\${[\w\W]*/g),ql=tl(/^data-[\-\w.\u00B7-\uFFFF]+$/),Jl=tl(/^aria-[\-\w]+$/),Yl=tl(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Xl=tl(/^(?:\w+script|data):/i),Zl=tl(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ql=tl(/^html$/i),$l=tl(/^[a-z][.\w]*(-[.\w]+)+$/i),eu={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},tu=function(){return typeof window>`u`?null:window},nu=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},ru=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function iu(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tu(),t=e=>iu(e);if(t.version=`3.4.8`,t.removed=[],!e||!e.document||e.document.nodeType!==eu.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=jl(d,`cloneNode`),p=jl(d,`remove`),m=jl(d,`nextSibling`),h=jl(d,`childNodes`),g=jl(d,`parentNode`),_=jl(d,`shadowRoot`),v=jl(d,`attributes`),y=o&&o.prototype?jl(o.prototype,`nodeType`):null,b=o&&o.prototype?jl(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C=0,w=function(e){if(C>0)throw Tl(`The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`);C++;try{return x.createHTML(e)}finally{C--}},T=n,E=T.implementation,D=T.createNodeIterator,O=T.createDocumentFragment,k=T.getElementsByTagName,A=r.importNode,j=ru();t.isSupported=typeof Yc==`function`&&typeof g==`function`&&E&&E.createHTMLDocument!==void 0;let M=Wl,N=Gl,P=Kl,ee=ql,F=Jl,I=Xl,te=Zl,ne=$l,re=Yl,L=null,ie=$({},[...Nl,...Pl,...Fl,...Ll,...zl]),R=null,z=$({},[...Bl,...Vl,...Hl,...Ul]),B=Object.seal(nl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ae=null,V=null,oe=Object.seal(nl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),se=!0,ce=!0,le=!1,ue=!0,de=!1,fe=!0,pe=!1,me=!1,he=!1,ge=!1,H=!1,_e=!1,ve=!0,ye=!1,be=`user-content-`,xe=!0,Se=!1,Ce={},we=null,U=$({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),Te=null,Ee=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),De=null,Oe=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),ke=`http://www.w3.org/1998/Math/MathML`,Ae=`http://www.w3.org/2000/svg`,je=`http://www.w3.org/1999/xhtml`,Me=je,Ne=!1,Pe=null,Fe=$({},[ke,Ae,je],pl),Ie=$({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Le=$({},[`annotation-xml`]),Re=$({},[`title`,`style`,`font`,`a`,`script`]),ze=null,Be=[`application/xhtml+xml`,`text/html`],W=null,Ve=null,He=n.createElement(`form`),G=function(e){return e instanceof RegExp||e instanceof Function},Ue=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ve&&Ve===e)return;(!e||typeof e!=`object`)&&(e={}),e=kl(e),ze=Be.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,W=ze===`application/xhtml+xml`?pl:fl,L=Sl(e,`ALLOWED_TAGS`)&&dl(e.ALLOWED_TAGS)?$({},e.ALLOWED_TAGS,W):ie,R=Sl(e,`ALLOWED_ATTR`)&&dl(e.ALLOWED_ATTR)?$({},e.ALLOWED_ATTR,W):z,Pe=Sl(e,`ALLOWED_NAMESPACES`)&&dl(e.ALLOWED_NAMESPACES)?$({},e.ALLOWED_NAMESPACES,pl):Fe,De=Sl(e,`ADD_URI_SAFE_ATTR`)&&dl(e.ADD_URI_SAFE_ATTR)?$(kl(Oe),e.ADD_URI_SAFE_ATTR,W):Oe,Te=Sl(e,`ADD_DATA_URI_TAGS`)&&dl(e.ADD_DATA_URI_TAGS)?$(kl(Ee),e.ADD_DATA_URI_TAGS,W):Ee,we=Sl(e,`FORBID_CONTENTS`)&&dl(e.FORBID_CONTENTS)?$({},e.FORBID_CONTENTS,W):U,ae=Sl(e,`FORBID_TAGS`)&&dl(e.FORBID_TAGS)?$({},e.FORBID_TAGS,W):kl({}),V=Sl(e,`FORBID_ATTR`)&&dl(e.FORBID_ATTR)?$({},e.FORBID_ATTR,W):kl({}),Ce=Sl(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?kl(e.USE_PROFILES):e.USE_PROFILES:!1,se=e.ALLOW_ARIA_ATTR!==!1,ce=e.ALLOW_DATA_ATTR!==!1,le=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ue=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=e.SAFE_FOR_TEMPLATES||!1,fe=e.SAFE_FOR_XML!==!1,pe=e.WHOLE_DOCUMENT||!1,ge=e.RETURN_DOM||!1,H=e.RETURN_DOM_FRAGMENT||!1,_e=e.RETURN_TRUSTED_TYPE||!1,he=e.FORCE_BODY||!1,ve=e.SANITIZE_DOM!==!1,ye=e.SANITIZE_NAMED_PROPS||!1,xe=e.KEEP_CONTENT!==!1,Se=e.IN_PLACE||!1,re=Ml(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Yl,Me=typeof e.NAMESPACE==`string`?e.NAMESPACE:je,Ie=Sl(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?kl(e.MATHML_TEXT_INTEGRATION_POINTS):$({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Le=Sl(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?kl(e.HTML_INTEGRATION_POINTS):$({},[`annotation-xml`]);let t=Sl(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?kl(e.CUSTOM_ELEMENT_HANDLING):nl(null);if(B=nl(null),Sl(t,`tagNameCheck`)&&G(t.tagNameCheck)&&(B.tagNameCheck=t.tagNameCheck),Sl(t,`attributeNameCheck`)&&G(t.attributeNameCheck)&&(B.attributeNameCheck=t.attributeNameCheck),Sl(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(B.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),de&&(ce=!1),H&&(ge=!0),Ce&&(L=$({},zl),R=nl(null),Ce.html===!0&&($(L,Nl),$(R,Bl)),Ce.svg===!0&&($(L,Pl),$(R,Vl),$(R,Ul)),Ce.svgFilters===!0&&($(L,Fl),$(R,Vl),$(R,Ul)),Ce.mathMl===!0&&($(L,Ll),$(R,Hl),$(R,Ul))),oe.tagCheck=null,oe.attributeCheck=null,Sl(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?oe.tagCheck=e.ADD_TAGS:dl(e.ADD_TAGS)&&(L===ie&&(L=kl(L)),$(L,e.ADD_TAGS,W))),Sl(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?oe.attributeCheck=e.ADD_ATTR:dl(e.ADD_ATTR)&&(R===z&&(R=kl(R)),$(R,e.ADD_ATTR,W))),Sl(e,`ADD_URI_SAFE_ATTR`)&&dl(e.ADD_URI_SAFE_ATTR)&&$(De,e.ADD_URI_SAFE_ATTR,W),Sl(e,`FORBID_CONTENTS`)&&dl(e.FORBID_CONTENTS)&&(we===U&&(we=kl(we)),$(we,e.FORBID_CONTENTS,W)),Sl(e,`ADD_FORBID_CONTENTS`)&&dl(e.ADD_FORBID_CONTENTS)&&(we===U&&(we=kl(we)),$(we,e.ADD_FORBID_CONTENTS,W)),xe&&(L[`#text`]=!0),pe&&$(L,[`html`,`head`,`body`]),L.table&&($(L,[`tbody`]),delete ae.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Tl(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Tl(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=w(``)}catch(e){throw x=t,e}}else x===void 0&&e.TRUSTED_TYPES_POLICY!==null&&(x=nu(u,i)),x&&typeof S==`string`&&(S=w(``));(j.uponSanitizeElement.length>0||j.uponSanitizeAttribute.length>0)&&L===ie&&(L=kl(L)),j.uponSanitizeAttribute.length>0&&R===z&&(R=kl(R)),el&&el(e),Ve=e},We=$({},[...Pl,...Fl,...Il]),Ge=$({},[...Ll,...Rl]),Ke=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Me,tagName:`template`});let n=fl(e.tagName),r=fl(t.tagName);return Pe[e.namespaceURI]?e.namespaceURI===Ae?t.namespaceURI===je?n===`svg`:t.namespaceURI===ke?n===`svg`&&(r===`annotation-xml`||Ie[r]):!!We[n]:e.namespaceURI===ke?t.namespaceURI===je?n===`math`:t.namespaceURI===Ae?n===`math`&&Le[r]:!!Ge[n]:e.namespaceURI===je?t.namespaceURI===Ae&&!Le[r]||t.namespaceURI===ke&&!Ie[r]?!1:!Ge[n]&&(Re[n]||!We[n]):!!(ze===`application/xhtml+xml`&&Pe[e.namespaceURI]):!1},qe=function(e){ll(t.removed,{element:e});try{g(e).removeChild(e)}catch{p(e)}},Je=function(e,n){try{ll(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{ll(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(ge||H)try{qe(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Ye=function(e){let t=null,r=null;if(he)e=`<remove></remove>`+e;else{let t=ml(e,/^[\r\n\t ]+/);r=t&&t[0]}ze===`application/xhtml+xml`&&Me===je&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?w(e):e;if(Me===je)try{t=new l().parseFromString(i,ze)}catch{}if(!t||!t.documentElement){t=E.createDocument(Me,`template`,null);try{t.documentElement.innerHTML=Ne?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Me===je?k.call(t,pe?`html`:`body`)[0]:pe?t.documentElement:a},Xe=function(e){return D.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ze=function(e){e.normalize();let t=D.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;){let e=n.data;ol([M,N,P],t=>{e=hl(e,t,` `)}),n.data=e,n=t.nextNode()}let r=e.querySelectorAll?.call(e,`template`)??[];ol(Array.from(r),e=>{$e(e.content)&&Ze(e.content)})},Qe=function(e){let t=b?b(e):null;return typeof t!=`string`||W(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},$e=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===eu.documentFragment}catch{return!1}},et=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function tt(e,n,r){ol(e,e=>{e.call(t,n,r,Ve)})}let nt=function(e){let n=null;if(tt(j.beforeSanitizeElements,e,null),Qe(e))return qe(e),!0;let r=W(b?b(e):e.nodeName);if(tt(j.uponSanitizeElement,e,{tagName:r,allowedTags:L}),fe&&e.hasChildNodes()&&!et(e.firstElementChild)&&wl(/<[/\w!]/g,e.innerHTML)&&wl(/<[/\w!]/g,e.textContent)||fe&&e.namespaceURI===je&&r===`style`&&et(e.firstElementChild)||e.nodeType===eu.progressingInstruction||fe&&e.nodeType===eu.comment&&wl(/<[/\w]/g,e.data))return qe(e),!0;if(ae[r]||!(oe.tagCheck instanceof Function&&oe.tagCheck(r))&&!L[r]){if(!ae[r]&&at(r)&&(B.tagNameCheck instanceof RegExp&&wl(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r)))return!1;if(xe&&!we[r]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=f(n[i],!0);t.insertBefore(r,m(e))}}}return qe(e),!0}return(y?y(e):e.nodeType)===eu.element&&!Ke(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&wl(/<\/no(script|embed|frames)/i,e.innerHTML)?(qe(e),!0):(de&&e.nodeType===eu.text&&(n=e.textContent,ol([M,N,P],e=>{n=hl(n,e,` `)}),e.textContent!==n&&(ll(t.removed,{element:e.cloneNode()}),e.textContent=n)),tt(j.afterSanitizeElements,e,null),!1)},rt=function(e,t,r){if(V[t]||ve&&(t===`id`||t===`name`)&&(r in n||r in He))return!1;let i=R[t]||oe.attributeCheck instanceof Function&&oe.attributeCheck(t,e);if(!(ce&&!V[t]&&wl(ee,t))&&!(se&&wl(F,t))){if(!i||V[t]){if(!(at(e)&&(B.tagNameCheck instanceof RegExp&&wl(B.tagNameCheck,e)||B.tagNameCheck instanceof Function&&B.tagNameCheck(e))&&(B.attributeNameCheck instanceof RegExp&&wl(B.attributeNameCheck,t)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(t,e))||t===`is`&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&wl(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r))))return!1}else if(!De[t]&&!wl(re,hl(r,te,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&gl(r,`data:`)===0&&Te[e])&&!(le&&!wl(I,hl(r,te,``)))&&r)return!1}return!0},it=$({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),at=function(e){return!it[fl(e)]&&wl(ne,e)},ot=function(e){tt(j.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||Qe(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},i=n.length;for(;i--;){let a=n[i],o=a.name,s=a.namespaceURI,c=a.value,l=W(o),d=c,f=o===`value`?d:_l(d);if(r.attrName=l,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,tt(j.uponSanitizeAttribute,e,r),f=r.attrValue,ye&&(l===`id`||l===`name`)&&gl(f,be)!==0&&(Je(o,e),f=be+f),fe&&wl(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){Je(o,e);continue}if(l===`attributename`&&ml(f,`href`)){Je(o,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Je(o,e);continue}if(!ue&&wl(/\/>/i,f)){Je(o,e);continue}de&&ol([M,N,P],e=>{f=hl(f,e,` `)});let p=W(e.nodeName);if(!rt(p,l,f)){Je(o,e);continue}if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!s)switch(u.getAttributeType(p,l)){case`TrustedHTML`:f=w(f);break;case`TrustedScriptURL`:f=x.createScriptURL(f);break}if(f!==d)try{s?e.setAttributeNS(s,o,f):e.setAttribute(o,f),Qe(e)?qe(e):cl(t.removed)}catch{Je(o,e)}}tt(j.afterSanitizeAttributes,e,null)},st=function(e){let t=null,n=Xe(e);for(tt(j.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(tt(j.uponSanitizeShadowNode,t,null),nt(t),ot(t),$e(t.content)&&st(t.content),(y?y(t):t.nodeType)===eu.element){let e=_?_(t):t.shadowRoot;$e(e)&&(ct(e),st(e))}tt(j.afterSanitizeShadowDOM,e,null)},ct=function(e){let t=y?y(e):e.nodeType;if(t===eu.element){let t=_?_(e):e.shadowRoot;$e(t)&&(ct(t),st(t))}let n=h?h(e):e.childNodes;if(!n)return;let r=[];ol(n,e=>{ll(r,e)});for(let e of r)ct(e);if(t===eu.element){let t=b?b(e):null;if(typeof t==`string`&&W(t)===`template`){let t=e.content;$e(t)&&ct(t)}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Ne=!e,Ne&&(e=`<!-->`),typeof e!=`string`&&!et(e)&&(e=Al(e),typeof e!=`string`))throw Tl(`dirty is not a string, aborting`);if(!t.isSupported)return e;if(me||Ue(n),t.removed=[],typeof e==`string`&&(Se=!1),Se){let t=b?b(e):e.nodeName;if(typeof t==`string`){let e=W(t);if(!L[e]||ae[e])throw Tl(`root node is forbidden and cannot be sanitized in-place`)}if(Qe(e))throw Tl(`root node is clobbered and cannot be sanitized in-place`);ct(e)}else if(et(e))i=Ye(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===eu.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),ct(a);else{if(!ge&&!de&&!pe&&e.indexOf(`<`)===-1)return x&&_e?w(e):e;if(i=Ye(e),!i)return ge?null:_e?S:``}i&&he&&qe(i.firstChild);let c=Xe(Se?e:i);for(;o=c.nextNode();)nt(o),ot(o),$e(o.content)&&st(o.content);if(Se)return de&&Ze(e),e;if(ge){if(de&&Ze(i),H)for(s=O.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(R.shadowroot||R.shadowrootmode)&&(s=A.call(r,s,!0)),s}let l=pe?i.outerHTML:i.innerHTML;return pe&&L[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&wl(Ql,i.ownerDocument.doctype.name)&&(l=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
128
|
-
`+l),de&&ol([M,N,P],e=>{l=hl(l,e,` `)}),x&&_e?w(l):l},t.setConfig=function(){Ue(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),me=!0},t.clearConfig=function(){Ve=null,me=!1},t.isValidAttribute=function(e,t,n){return Ve||Ue({}),rt(W(e),W(t),n)},t.addHook=function(e,t){typeof t==`function`&&ll(j[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=sl(j[e],t);return n===-1?void 0:ul(j[e],n,1)[0]}return cl(j[e])},t.removeHooks=function(e){j[e]=[]},t.removeAllHooks=function(){j=ru()},t}var au=iu(),ou=new Vc({gfm:!0,breaks:!0,pedantic:!1,renderer:(()=>{let e=new Ic;return e.code=({text:e,lang:t})=>{let n=(t??``).toLowerCase(),r=cs(e,n);return`<pre><code${n?` class="language-${n}"`:``}>${r}</code></pre>`},e})()}),su=`p.br.strong.em.del.s.u.a.ul.ol.li.h1.h2.h3.h4.h5.h6.blockquote.code.pre.hr.table.thead.tbody.tr.th.td.img.span.input`.split(`.`),cu=[`href`,`title`,`target`,`rel`,`src`,`alt`,`class`,`checked`,`type`,`disabled`],lu=/^(?:(?:https?|mailto|tel|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i;function uu(e){if(!e)return``;let t=ou.parse(e,{async:!1});return au.sanitize(t,{ALLOWED_TAGS:su,ALLOWED_ATTR:cu,ALLOWED_URI_REGEXP:lu})}var du={class:`zm-note-panel`},fu={key:0,class:`zm-note-empty`},pu={class:`zm-note-header`},mu={class:`zm-note-title-row`},hu={class:`zm-note-name`},gu={class:`zm-note-meta`},_u={class:`zm-note-scroll`},vu={class:`zm-note-section`},yu={class:`zm-note-section-head`},bu={class:`zm-note-split`},xu=[`disabled`],Su={key:0,class:`zm-note-preview`},Cu=[`innerHTML`],wu={key:1,class:`zm-note-preview-hint`},Tu={key:0,class:`zm-note-section-actions`},Eu={key:0,class:`zm-note-add-row`},Du={key:1,class:`zm-note-section`},Ou=[`disabled`],ku=[`href`,`title`],Au={key:2,class:`zm-note-section`},ju=[`disabled`],Mu=[`src`,`alt`],Nu={key:3,class:`zm-note-section`},Pu={class:`zm-note-section-head`},Fu={key:0,class:`zm-note-section-tag`},Iu=[`disabled`],Lu={key:0,class:`zm-note-code`},Ru=[`innerHTML`],zu={key:4,class:`zm-note-section`},Bu=[`disabled`],Vu={key:0,class:`zm-note-table`},Hu=
|
|
128
|
+
`+l),de&&ol([M,N,P],e=>{l=hl(l,e,` `)}),x&&_e?w(l):l},t.setConfig=function(){Ue(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),me=!0},t.clearConfig=function(){Ve=null,me=!1},t.isValidAttribute=function(e,t,n){return Ve||Ue({}),rt(W(e),W(t),n)},t.addHook=function(e,t){typeof t==`function`&&ll(j[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=sl(j[e],t);return n===-1?void 0:ul(j[e],n,1)[0]}return cl(j[e])},t.removeHooks=function(e){j[e]=[]},t.removeAllHooks=function(){j=ru()},t}var au=iu(),ou=new Vc({gfm:!0,breaks:!0,pedantic:!1,renderer:(()=>{let e=new Ic;return e.code=({text:e,lang:t})=>{let n=(t??``).toLowerCase(),r=cs(e,n);return`<pre><code${n?` class="language-${n}"`:``}>${r}</code></pre>`},e})()}),su=`p.br.strong.em.del.s.u.a.ul.ol.li.h1.h2.h3.h4.h5.h6.blockquote.code.pre.hr.table.thead.tbody.tr.th.td.img.span.input`.split(`.`),cu=[`href`,`title`,`target`,`rel`,`src`,`alt`,`class`,`checked`,`type`,`disabled`],lu=/^(?:(?:https?|mailto|tel|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i;function uu(e){if(!e)return``;let t=ou.parse(e,{async:!1});return au.sanitize(t,{ALLOWED_TAGS:su,ALLOWED_ATTR:cu,ALLOWED_URI_REGEXP:lu})}var du={class:`zm-note-panel`},fu={key:0,class:`zm-note-empty`},pu={class:`zm-note-header`},mu={class:`zm-note-title-row`},hu={class:`zm-note-name`},gu={class:`zm-note-meta`},_u={class:`zm-note-scroll`},vu={class:`zm-note-section`},yu={class:`zm-note-section-head`},bu={class:`zm-note-split`},xu=[`disabled`],Su={key:0,class:`zm-note-preview`},Cu=[`innerHTML`],wu={key:1,class:`zm-note-preview-hint`},Tu={key:0,class:`zm-note-section-actions`},Eu={key:0,class:`zm-note-add-row`},Du={key:1,class:`zm-note-section`},Ou=[`disabled`],ku=[`href`,`title`],Au={key:2,class:`zm-note-section`},ju=[`disabled`],Mu=[`src`,`alt`],Nu={key:3,class:`zm-note-section`},Pu={class:`zm-note-section-head`},Fu={key:0,class:`zm-note-section-tag`},Iu=[`disabled`],Lu={key:0,class:`zm-note-code`},Ru=[`innerHTML`],zu={key:4,class:`zm-note-section`},Bu=[`disabled`],Vu={key:0,class:`zm-note-table`},Hu=x({__name:`NotePanel`,props:{selectedNode:{},readonly:{type:Boolean},focusTick:{}},emits:[`apply`,`remove`,`set-link`,`set-image`,`set-rich`],setup(t,{emit:n}){let r=t,i=n,a=E(``),s=E(null);qi(s,{minRows:4,maxRows:10});let c=j(()=>!a.value||a.value.trim()===``),l=j(()=>uu(a.value)),f=E(!0);function m(){f.value=!f.value}e(()=>[r.selectedNode?.id,r.selectedNode?.note?.text],()=>{a.value=r.selectedNode?.note?.text??``},{immediate:!0}),e(()=>r.focusTick,async()=>{if(r.readonly)return;await d();let e=document.querySelector(`.zm-note-panel textarea.zm-note-textarea`);if(e){e.focus();let t=e.value.length;e.setSelectionRange(t,t)}});function g(){if(r.readonly)return;let e=a.value;e!==(r.selectedNode?.note?.text??``)&&i(`apply`,e)}function _(e){r.readonly||(e.key===`Escape`?(e.preventDefault(),a.value=r.selectedNode?.note?.text??``,e.target.blur()):e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),g(),e.target.blur()))}function v(){r.readonly||confirm(`移除该节点的笔记?`)&&(a.value=``,i(`remove`))}let y=j(()=>{var e;return!!((e=r.selectedNode?.link)!=null&&e.url)}),x=j(()=>{var e;return!!((e=r.selectedNode?.image)!=null&&e.src)}),w=j(()=>r.selectedNode?.richContent?.kind),D=j(()=>w.value===`code`),O=j(()=>w.value===`table`),k=E(!1),ee=E(!1),F=E(!1),I=E(!1);e(()=>r.selectedNode?.id,()=>{k.value=!1,ee.value=!1,F.value=!1,I.value=!1});let te=E(``);e(()=>[r.selectedNode?.id,r.selectedNode?.link?.url],()=>{te.value=r.selectedNode?.link?.url??``},{immediate:!0});function ne(){if(r.readonly)return;let e=te.value.trim();e!==(r.selectedNode?.link?.url??``)&&i(`set-link`,e)}let re=E(``);e(()=>[r.selectedNode?.id,r.selectedNode?.image?.src],()=>{re.value=r.selectedNode?.image?.src??``},{immediate:!0});function L(){if(r.readonly)return;let e=re.value.trim();e!==(r.selectedNode?.image?.src??``)&&i(`set-image`,e)}function ie(e){let t=e.target;t.style.display=`none`}function R(e){let t=e.target;t.style.display=``}let z=E(``),B=E(null);qi(B,{minRows:4,maxRows:18}),e(()=>[r.selectedNode?.id,r.selectedNode?.richContent?.raw],()=>{z.value=r.selectedNode?.richContent?.raw??``},{immediate:!0});let ae=j(()=>cs(os(z.value),ss(z.value)));function V(){if(r.readonly)return;let e=z.value;if(e===(r.selectedNode?.richContent?.raw??``))return;let t=ss(e)||void 0;i(`set-rich`,e?{kind:`code`,raw:e,lang:t}:null)}let oe=E(``),se=E(null);qi(se,{minRows:4,maxRows:14}),e(()=>[r.selectedNode?.id,r.selectedNode?.richContent?.raw],()=>{oe.value=r.selectedNode?.richContent?.raw??``},{immediate:!0});function ce(){if(r.readonly)return;let e=oe.value;e!==(r.selectedNode?.richContent?.raw??``)&&i(`set-rich`,e?{kind:`table`,raw:e}:null)}let le=j(()=>ls(oe.value)),ue=j(()=>{let e=[];return c.value||e.push(`${a.value.length} 字`),y.value&&e.push(`1 链接`),x.value&&e.push(`1 图片`),D.value&&e.push(`代码块`),O.value&&e.push(`表格`),e.length===0?`节点没有额外内容`:e.join(` · `)});return(e,n)=>(h(),p(`div`,du,[t.selectedNode?(h(),p(S,{key:1},[N(`div`,pu,[N(`div`,mu,[n[12]||=N(`span`,{class:`zm-note-label`},`节点`,-1),N(`span`,hu,o(t.selectedNode.text||`(无标题)`),1)]),N(`div`,gu,o(ue.value),1)]),N(`div`,_u,[N(`section`,vu,[N(`header`,yu,[n[13]||=N(`span`,{class:`zm-note-section-title`},`笔记`,-1),n[14]||=N(`span`,{class:`zm-note-section-hint`},`Ctrl+Enter 提交, Esc 取消`,-1),t.readonly?M(``,!0):(h(),p(`button`,{key:0,type:`button`,class:`zm-note-preview-toggle`,onClick:m},o(f.value?`隐藏预览`:`显示预览`),1))]),N(`div`,bu,[C(N(`textarea`,{ref_key:`noteRef`,ref:s,"onUpdate:modelValue":n[0]||=e=>a.value=e,class:`zm-note-textarea`,placeholder:`写点什么吧… 支持 Markdown`,spellcheck:`false`,disabled:t.readonly,onBlur:g,onKeydown:_},null,40,xu),[[A,a.value]]),f.value?(h(),p(`div`,Su,[c.value?(h(),p(`div`,wu,` 渲染后的 Markdown 仅在此面板显示,不会撑大节点框。 `)):(h(),p(`div`,{key:0,class:`zm-note-preview-body`,innerHTML:l.value},null,8,Cu))])):M(``,!0)]),!t.readonly&&!c.value?(h(),p(`div`,Tu,[N(`button`,{class:`zm-note-action-btn is-danger`,onClick:v},`移除笔记`)])):M(``,!0)]),t.readonly?M(``,!0):(h(),p(`div`,Eu,[!y.value&&!k.value?(h(),p(`button`,{key:0,class:`zm-note-add-chip`,onClick:n[1]||=e=>k.value=!0},`+ 链接`)):M(``,!0),!x.value&&!ee.value?(h(),p(`button`,{key:1,class:`zm-note-add-chip`,onClick:n[2]||=e=>ee.value=!0},`+ 图片`)):M(``,!0),!D.value&&!F.value?(h(),p(`button`,{key:2,class:`zm-note-add-chip`,onClick:n[3]||=e=>F.value=!0},`+ 代码块`)):M(``,!0),!O.value&&!I.value?(h(),p(`button`,{key:3,class:`zm-note-add-chip`,onClick:n[4]||=e=>I.value=!0},`+ 表格`)):M(``,!0)])),y.value||k.value?(h(),p(`section`,Du,[n[15]||=N(`header`,{class:`zm-note-section-head`},[N(`span`,{class:`zm-note-section-title`},`链接`)],-1),C(N(`input`,{"onUpdate:modelValue":n[5]||=e=>te.value=e,class:`zm-note-input`,type:`url`,placeholder:`https://…`,disabled:t.readonly,onBlur:ne,onKeydown:n[6]||=b(T(e=>e.target.blur(),[`prevent`]),[`enter`])},null,40,Ou),[[A,te.value]]),y.value?(h(),p(`a`,{key:0,class:`zm-note-link-chip`,href:t.selectedNode.link?.url,target:`_blank`,rel:`noopener noreferrer`,title:t.selectedNode.link?.url},o(t.selectedNode.link?.url),9,ku)):M(``,!0)])):M(``,!0),x.value||ee.value?(h(),p(`section`,Au,[n[16]||=N(`header`,{class:`zm-note-section-head`},[N(`span`,{class:`zm-note-section-title`},`图片`)],-1),C(N(`input`,{"onUpdate:modelValue":n[7]||=e=>re.value=e,class:`zm-note-input`,type:`url`,placeholder:`data:image/… 或 https://…`,disabled:t.readonly,onBlur:L,onKeydown:n[8]||=b(T(e=>e.target.blur(),[`prevent`]),[`enter`])},null,40,ju),[[A,re.value]]),x.value?(h(),p(`img`,{key:0,class:`zm-note-image`,src:t.selectedNode.image?.src,alt:t.selectedNode.text,onError:ie,onLoad:R},null,40,Mu)):M(``,!0)])):M(``,!0),D.value||F.value?(h(),p(`section`,Nu,[N(`header`,Pu,[n[17]||=N(`span`,{class:`zm-note-section-title`},`代码块`,-1),P(ss)(z.value)?(h(),p(`span`,Fu,o(P(ss)(z.value)),1)):M(``,!0)]),C(N(`textarea`,{ref_key:`codeRef`,ref:B,"onUpdate:modelValue":n[9]||=e=>z.value=e,class:`zm-note-input zm-note-input-code`,placeholder:"```ts\nconsole.log(123)\n```",spellcheck:`false`,disabled:t.readonly,onBlur:V},null,40,Iu),[[A,z.value]]),z.value.trim()?(h(),p(`pre`,Lu,[N(`code`,{innerHTML:ae.value},null,8,Ru)])):M(``,!0)])):M(``,!0),O.value||I.value?(h(),p(`section`,zu,[n[18]||=N(`header`,{class:`zm-note-section-head`},[N(`span`,{class:`zm-note-section-title`},`表格`)],-1),C(N(`textarea`,{ref_key:`tableRef`,ref:se,"onUpdate:modelValue":n[10]||=e=>oe.value=e,class:`zm-note-input zm-note-input-code`,placeholder:`| 列1 | 列2 |
|
|
129
129
|
| --- | --- |
|
|
130
|
-
| a | b |`,spellcheck:`false`,disabled:t.readonly,onBlur:ce},null,40,Bu),[[A,oe.value]]),le.value.length?(
|
|
130
|
+
| a | b |`,spellcheck:`false`,disabled:t.readonly,onBlur:ce},null,40,Bu),[[A,oe.value]]),le.value.length?(h(),p(`table`,Vu,[N(`tbody`,null,[(h(!0),p(S,null,u(le.value,(e,t)=>(h(),p(`tr`,{key:t},[t===0?(h(!0),p(S,{key:0},u(e,(e,t)=>(h(),p(`th`,{key:`h${t}`},o(e),1))),128)):(h(!0),p(S,{key:1},u(e,(e,t)=>(h(),p(`td`,{key:`c${t}`},o(e),1))),128))]))),128))])])):M(``,!0)])):M(``,!0)])],64)):(h(),p(`div`,fu,[...n[11]||=[N(`p`,null,`请先在画布上选中一个节点。`,-1),N(`p`,{class:`zm-note-hint`},` 选中节点后,会在这里展示并可编辑节点的笔记、链接、图片、代码块、表格。 `,-1)]]))]))}}),Uu=[`viewBox`,`width`,`height`],Wu={class:`zm-edges`},Gu=[`d`,`fill`],Ku={class:`zm-relations`},qu=[`d`,`onClick`,`onDblclick`],Ju=[`d`],Yu=[`d`],Xu=[`d`],Zu=[`x`,`y`,`onClick`,`onDblclick`],Qu=[`x1`,`y1`,`x2`,`y2`],$u=[`x1`,`y1`,`x2`,`y2`],ed=[`cx`,`cy`,`r`,`onPointerdown`],td=[`cx`,`cy`,`r`,`onPointerdown`],nd=[`x`,`y`,`width`,`height`,`onPointerdown`],rd=[`x`,`y`,`width`,`height`,`onPointerdown`],id=[`cx`,`cy`,`r`,`onPointerdown`],ad=[`cx`,`cy`,`r`,`onPointerdown`],od=[`x`,`y`,`width`,`height`,`onPointerdown`],sd=[`x`,`y`,`width`,`height`,`onPointerdown`],cd=[`data-node-id`,`onClick`,`onPointerdown`,`onDblclick`,`onContextmenu`,`onMouseenter`,`onMouseleave`],ld=[`src`,`width`,`height`,`alt`],ud=[`onDblclick`],dd={key:0,class:`zm-rich-code`},fd=[`innerHTML`],pd={key:1,class:`zm-rich-table`},md={key:2,class:`zm-text`},hd={key:0,class:`zm-node-markers`},gd=[`title`,`innerHTML`],_d={class:`zm-text-label`},vd=[`href`,`title`],yd=[`title`,`onClick`],bd={key:4,class:`zm-node-tags`},xd=[`title`],Sd=[`title`,`onClick`],Cd=[`onClick`],wd=[`onMousedown`],Td=[`onClick`],Ed=[`onKeydown`],Dd=[`title`],Od=[`src`],kd=[`src`],Ad=24,jd=400,Md=160,Nd=4,Pd=x({__name:`MindMap`,props:{data:{},theme:{},previewMode:{type:Boolean,default:!1},markdown:{},lineColors:{},hideCanvasActions:{type:Boolean,default:!1},builtInDrawers:{type:Boolean,default:!0}},emits:[`change`,`select`,`edit-note`,`markdownChange`,`canvas-toggle-preview`,`canvas-outline`,`canvas-settings`,`canvas-data`,`canvas-import`],setup(i,{expose:a,emit:l}){let f=i,m=l,g=E(null),v=E(null),x=E(``),w=E(new Set),D=j(()=>w.value.values().next().value??null),O=E(new Set),ee=E(!1),F=E(null),I=E(0),te=E(0),ne=j(()=>{let e=F.value;if(!e||!e.currentTargetId||!e.dropPosition||e.dropPosition===`child`)return null;let t=Un.value.find(t=>t.id===e.currentTargetId);if(!t)return null;let n=t.width/2,r=t.height/2;if(t._dir===`down`){let i=e.dropPosition===`before`?t.x-n:t.x+n;return{x1:i,y1:t.y-r,x2:i,y2:t.y+r,horizontal:!1}}let i=e.dropPosition===`before`?t.y-r:t.y+r;return{x1:t.x-n,y1:i,x2:t.x+n,y2:i,horizontal:!0}}),re=E(null),z=E(null),B=E(null),ae=E(``),V=E(He(f.data)),oe=E({}),se=E({}),ce=E(f.markdown!==void 0),le=!1;e(()=>f.markdown,e=>{if(e===void 0){ce.value=!1;return}ce.value=!0;let t=lt(e||``);le=!0,V.value=He(t),w.value=new Set,O.value=new Set,q(),d(()=>{le=!1,mi()})}),e(V,()=>{ce.value&&!le&&m(`markdownChange`,ut(V.value))},{deep:!0});let ue=j(()=>J.showOrderBadge===!0),de=E(new Map),fe=de.value;function pe(e,t){let n={};t.bg&&(n.bg=t.bg),t.textColor&&(n.textColor=t.textColor),t.borderColor&&(n.borderColor=t.borderColor),t.fontWeight&&(n.fontWeight=t.fontWeight),t.fontSize&&(n.fontSize=t.fontSize),Object.keys(n).length===0?fe.delete(e):fe.set(e,n),de.value=new Map(fe)}function me(e){return fe.get(e)??{}}function he(e,t){let n=G(V.value,e);n&&(n.image={src:t.src,naturalW:t.naturalW,naturalH:t.naturalH,width:_e(t.width,Ad,jd),height:_e(t.height,Ad,jd)},K(),q(),m(`change`,V.value))}function ge(e){let t=G(V.value,e);!t||!t.image||(delete t.image,K(),q(),m(`change`,V.value))}function H(e,t){let n=t.trim();if(!G(V.value,e))return;if(!n){ge(e);return}let r=new Image;r.onload=()=>{let t=G(V.value,e);if(!t)return;let i=r.naturalWidth&&r.naturalHeight?r.naturalWidth/r.naturalHeight:1,a=_e(r.naturalWidth||Md,Ad,jd),o=Math.round(a/i);t.image={src:n,naturalW:r.naturalWidth||a,naturalH:r.naturalHeight||o,width:a,height:o},K(),q(),m(`change`,V.value)},r.onerror=()=>{},r.src=n}function _e(e,t,n){return Math.min(n,Math.max(t,e))}function ve(e,t){let n=new FileReader;n.onload=()=>{if(typeof n.result!=`string`)return;let e=n.result,r=new window.Image;r.onload=()=>{let n=r.naturalWidth||Md,i=r.naturalHeight||Md,a=_e(n,Ad,Md);t({src:e,naturalW:n,naturalH:i,width:a,height:_e(Math.round(i*a/n),Ad,jd)})},r.onerror=()=>{t({src:e,naturalW:Md,naturalH:Md,width:Md,height:Md})},r.src=e},n.readAsDataURL(e)}function ye(e){let t=document.createElement(`input`);t.type=`file`,t.accept=`image/*`,t.style.display=`none`,t.onchange=()=>{let n=t.files?.[0];n&&(ve(n,t=>he(e,t)),document.body.removeChild(t))},document.body.appendChild(t),t.click()}function be(e,t){let n=t.trim(),r=G(V.value,e);r&&(n?r.link={url:n}:delete r.link,K(),q(),m(`change`,V.value))}function xe(e){be(e,``)}function Se(e,t){let n=G(V.value,e);n&&(t?n.note={text:t}:delete n.note,K(),q(),m(`change`,V.value))}function Ce(e){Se(e,``)}function we(e,t){let n=G(V.value,e);n&&(t?n.richContent=t:delete n.richContent,K(),q(),m(`change`,V.value))}let U=E(null),Te=E(null),Ee=j(()=>[`zm-canvas-fab`,`zm-canvas-fab-preview`,!f.hideCanvasActions&&(!f.previewMode||ee.value)?`is-visible`:``].filter(Boolean).join(` `)),De=j(()=>[`zm-canvas-fab`,`zm-canvas-fab-outline`,!f.hideCanvasActions&&(!f.previewMode||ee.value)?`is-visible`:``].filter(Boolean).join(` `));function Oe(e,t){f.previewMode||(e.preventDefault(),e.stopPropagation(),Te.value=null,w.value=new Set([t.id]),X(),U.value={nodeId:t.id,x:e.clientX,y:e.clientY})}function Ae(){U.value=null}function je(e){let t=e.target;if(!(t!=null&&t.closest(`.zm-toolbar, button, input, textarea, .zm-canvas-fab-preview, .zm-canvas-fab-outline`))){if(ai&&Y.panMoved.value){ai=!1,e.preventDefault();return}e.preventDefault(),U.value&&=null,Te.value={x:e.clientX,y:e.clientY}}}function Me(){Te.value=null}function Ne(){Me(),f.builtInDrawers&&(ft(),Ve.value=!0),m(`canvas-settings`)}function Pe(){Me(),f.builtInDrawers&&(ft(),ze.value=!0),m(`canvas-data`)}function Fe(e){Me(),f.builtInDrawers&&(ft(),nt.value=e,ze.value=!0),m(`canvas-import`,e)}let Re=E(!1),ze=E(!1),Be=E(!1),W=E(!1),Ve=E(!1),qe=E(0),nt=E(null),dt=E(new Set);function ft(){ze.value=!1,Be.value=!1,W.value=!1,Ve.value=!1}let mt=j(()=>{let e=D.value;return e?G(V.value,e)??null:null}),ht=j(()=>mt.value?me(mt.value.id):{});function vt(e){e.autoBalanceOnChange!==void 0&&(J.autoBalanceOnChange=e.autoBalanceOnChange),e.lineWidthStart!==void 0&&(J.lineWidthStart=Math.max(.5,Math.min(20,e.lineWidthStart))),e.lineWidthEnd!==void 0&&(J.lineWidthEnd=Math.max(.1,Math.min(10,e.lineWidthEnd))),e.rainbowBranch!==void 0&&(J.rainbowBranch=e.rainbowBranch),e.branchPaletteId!==void 0&&(J.branchPaletteId=e.branchPaletteId),e.customPalettes!==void 0&&(J.customPalettes=e.customPalettes),e.lineStyle!==void 0&&(J.lineStyle=e.lineStyle),e.rootLineStyle!==void 0&&(J.rootLineStyle=e.rootLineStyle),e.lineOrigin!==void 0&&(J.lineOrigin=e.lineOrigin),e.taperedEdge!==void 0&&(J.taperedEdge=e.taperedEdge),e.lineWidthTaper!==void 0&&(J.lineWidthTaper=Math.max(.1,Math.min(1,e.lineWidthTaper))),e.uniformLineWidth!==void 0&&(J.uniformLineWidth=e.uniformLineWidth),e.elbowRadius!==void 0&&(J.elbowRadius=Math.max(2,Math.min(40,e.elbowRadius))),e.showOrderBadge!==void 0&&(J.showOrderBadge=e.showOrderBadge),e.canvasBg!==void 0&&(J.canvasBg=e.canvasBg),e.branchGap!==void 0&&(J.branchGap=Math.max(0,Math.min(80,e.branchGap)))}function yt(e){mt.value&&pe(mt.value.id,e)}function bt(){let e={autoBalanceOnChange:!0,lineWidthStart:16,lineWidthEnd:.6,rainbowBranch:!0,branchPaletteId:`default`,customPalettes:[],lineStyle:`rounded-elbow`,rootLineStyle:`arc`,lineOrigin:`xmind`,layoutMode:`mindmap`,taperedEdge:!0,lineWidthTaper:.3,uniformLineWidth:!0,elbowRadius:20,showOrderBadge:!1,canvasBg:void 0,branchGap:20};J.autoBalanceOnChange=e.autoBalanceOnChange,J.lineWidthStart=e.lineWidthStart,J.lineWidthEnd=e.lineWidthEnd,J.rainbowBranch=e.rainbowBranch,J.branchPaletteId=e.branchPaletteId,J.customPalettes=e.customPalettes,J.lineStyle=e.lineStyle,J.rootLineStyle=e.rootLineStyle,J.lineOrigin=e.lineOrigin,J.layoutMode=e.layoutMode,J.taperedEdge=e.taperedEdge,J.lineWidthTaper=e.lineWidthTaper,J.uniformLineWidth=e.uniformLineWidth,J.elbowRadius=e.elbowRadius,J.showOrderBadge=e.showOrderBadge,J.canvasBg=e.canvasBg,J.branchGap=e.branchGap}function xt(){nt.value=null}function St(e){let t=D.value;t&&Se(t,e)}function Et(){let e=D.value;e&&Ce(e)}function Dt(e){let t=D.value;t&&be(t,e)}function Ot(e){let t=D.value;t&&H(t,e)}function kt(e){let t=D.value;t&&we(t,e)}function Mt(e){let t=document.querySelector(`[data-node-id="${e.id}"]`);t&&t.click()}function Nt(e){wr(e.id,e.text)}function Pt(e){ir(e)}function Ft(e){ar(e)}function It(e){Tr(e.srcId,e.targetId,e.position)}function Lt(e){let t=new Set(dt.value);t.has(e)?t.delete(e):t.add(e),dt.value=t}function Rt(){f.builtInDrawers&&(Re.value=!Re.value),m(`canvas-outline`)}function zt(){let e=U.value?.nodeId;e&&ye(e)}function Bt(){let e=U.value?.nodeId;if(!e)return;let t=G(V.value,e)?.link?.url??``,n=window.prompt(`输入链接 URL(留空取消)`,t);n!==null&&be(e,n)}function Ht(){let e=U.value?.nodeId;e&&xe(e)}function Ut(){let e=U.value?.nodeId;e&&Zt(e)}function Wt(){let e=U.value?.nodeId;e&&Ce(e)}function Gt(){let e=U.value?.nodeId;e&&ge(e)}function Kt(){let e=U.value?.nodeId;if(!e)return;let t=G(V.value,e)?.richContent,n=t?.kind===`code`?os(t.raw):``,r=t?.kind===`code`&&t.lang||``,i=r?"```"+r+`
|
|
131
131
|
`:"```\n",a=window.prompt("输入代码块内容(用 ```lang 包裹;留空取消)",n?i+n+(n.endsWith("```")?``:"\n```"):i+"// 你的代码\n```");if(a===null)return;let o=a.trim();if(!o){we(e,null);return}let s=/^```([^\s`]*)/.exec(o);we(e,{kind:`code`,raw:o,lang:s?s[1]:void 0})}function qt(){let e=U.value?.nodeId;e&&we(e,null)}function Jt(){let e=U.value?.nodeId;if(!e)return;let t=G(V.value,e)?.richContent,n=t?.kind===`table`?t.raw:``,r=window.prompt(`输入 markdown 表格(每行以 | 分隔;留空取消)`,n||`| 列1 | 列2 | 列3 |
|
|
132
132
|
| --- | --- | --- |
|
|
133
|
-
| a | b | c |`);if(r===null)return;let i=r.trim();if(!i){we(e,null);return}we(e,{kind:`table`,raw:i})}function Yt(){let e=U.value?.nodeId;e&&we(e,null)}function Xt(){let e=U.value?.nodeId;e&&Xr(e)}function Zt(e){l.previewMode||(C.value=new Set([e]),X(),l.builtInDrawers&&(ft(),W.value=!0,qe.value++),d(`edit-note`,e))}function Qt(e,t=60){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n||`点击编辑笔记`:n.slice(0,t)+`…`}function $t(e){if(l.previewMode||_.value)return;let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))return;let n=E.value;if(!n)return;let r=e.clipboardData?.items;if(!r)return;for(let t=0;t<r.length;t++){let i=r[t];if(i.kind===`file`&&i.type.startsWith(`image/`)){let t=i.getAsFile();if(!t)continue;e.preventDefault();let r=G(V.value,n);if(r!=null&&r.image&&!window.confirm(`该节点已有图片,要用剪贴板里的图片替换吗?`))return;ve(t,e=>he(n,e));return}}if(re.value&&re.value.nodes.length>0)return;let i=null;for(let t=0;t<r.length;t++){let n=r[t];if(n.kind===`string`&&n.type===`text/plain`){i=e.clipboardData?.getData(`text/plain`)??null;break}}if(!i)return;let a=i.split(/\r?\n/).map(e=>e.replace(/^\s*[-*+]\s+/,``).trim()).filter(e=>e.length>0);if(a.length!==0){e.preventDefault(),K();for(let e of a)Je(V.value,n,e);q(),d(`change`,V.value)}}i(()=>{window.addEventListener(`paste`,$t),window.addEventListener(`keydown`,en),q()}),t(()=>{window.removeEventListener(`paste`,$t),window.removeEventListener(`keydown`,en)});function en(e){if((e.metaKey||e.ctrlKey)&&(e.key===`f`||e.key===`F`)){let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))return;e.preventDefault(),d(`canvas-outline`);return}if((e.key===`Delete`||e.key===`Backspace`)&&Fr.value){let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable)||l.previewMode)return;e.preventDefault(),Jr(Fr.value)}}let tn=T(null),nn=j(()=>tn.value?.nodeId??null);function rn(e,t){if(!t.image)return;e.preventDefault(),e.stopPropagation();let n=t.image.naturalW||t.image.width,r=t.image.naturalH||t.image.height,i=r>0?r/n:1;tn.value={nodeId:t.id,startX:e.clientX,startY:e.clientY,startW:t.image.width,startH:t.image.height,naturalW:n,naturalH:r,ratio:i,pendingW:t.image.width,pendingH:t.image.height},window.addEventListener(`mousemove`,an),window.addEventListener(`mouseup`,on)}function an(e){let t=tn.value;if(!t)return;let n=Y.scale.value||1,r=e.clientX-t.startX,i=_e(t.startW+r/n,Ad,jd),a=_e(i*t.ratio,Ad,jd);t.pendingW=i,t.pendingH=a;let o=h.value?.querySelector(`[data-node-id="${t.nodeId}"] .zm-node-img`);o&&(o.style.width=`${i}px`,o.style.height=`${a}px`);let s=h.value?.querySelector(`[data-node-id="${t.nodeId}"]`);s&&(s.style.minWidth=`${Math.max(80,Math.ceil(i+28))}px`,s.style.height=`${Math.ceil(a+8+30)}px`)}function on(){let e=tn.value;if(window.removeEventListener(`mousemove`,an),window.removeEventListener(`mouseup`,on),tn.value=null,!e)return;let t=G(V.value,e.nodeId);!t||!t.image||(he(e.nodeId,{src:t.image.src,naturalW:t.image.naturalW,naturalH:t.image.naturalH,width:e.pendingW,height:e.pendingH}),C.value=new Set([e.nodeId]),X(),cn=!0)}let sn=T(null),cn=!1,ln=!1;function un(e){sn.value=e}function dn(e){sn.value===e&&(sn.value=null),z.value&&=null}function fn(e,t){if(!t.text||t.text.length<14)return;let n=e.currentTarget.getBoundingClientRect(),r=h.value?.getBoundingClientRect();if(!r)return;let i=n.top-r.top>60,a=n.left-r.left+n.width/2,o=r.width-240/2-10,s=Math.max(130,Math.min(a,o)),c=i?n.top-r.top-8:n.bottom-r.top+8;z.value={text:t.text,x:s,y:c,above:i}}let pn=T(0),mn=T(!1),gn=_t(100);function K(){gn.record({data:V.value,selectedIds:[...C.value]})}function q(){O.value=new Set(O.value),pn.value++,s().then(()=>s()).then(()=>_n()).then(()=>{pn.value++})}function _n(){let e=document.querySelectorAll(`.zm-rich`),t={},n={};e.forEach(e=>{let r=e,i=null;for(;r&&!i;)i=r.getAttribute(`data-node-id`),r=r.parentElement;if(!i)return;let a=e.offsetHeight,o=e.scrollWidth,s=Math.round(a*2)/2,c=Math.round(o*2)/2;t[i]=s,n[i]=c,oe.value[i],se.value[i]}),oe.value=t,se.value=n}let vn=j(()=>({rootBg:l.theme?.rootBg??`#1f2937`,rootText:l.theme?.rootText??`#ffffff`,branchBg:l.theme?.branchBg??`#ffffff`,branchText:l.theme?.branchText??`#1f2937`,lineColor:l.theme?.lineColor??`#94a3b8`,bgColor:l.theme?.bgColor??`#f8fafc`,fontSize:l.theme?.fontSize??14,lineWidthStart:l.theme?.lineWidthStart??2.2,lineWidthEnd:l.theme?.lineWidthEnd??.8,rainbowBranch:l.theme?.rainbowBranch??!1})),yn=j(()=>J.canvasBg||vn.value.bgColor),J=v({autoBalanceOnChange:!0,lineWidthStart:16,lineWidthEnd:3.6,rainbowBranch:!0,branchPaletteId:`default`,customPalettes:[],lineStyle:`rounded-elbow`,rootLineStyle:`arc`,lineOrigin:`xmind`,layoutMode:`mindmap`,taperedEdge:!0,lineWidthTaper:.3,uniformLineWidth:!0,elbowRadius:20,showOrderBadge:!1,canvasBg:void 0,branchGap:20});function bn(e){return e?J.rootLineStyle:J.lineStyle}function xn(e){return J.taperedEdge?J.uniformLineWidth&&e>0?J.lineWidthEnd:Cn(e):wn(e)}function Sn(e){return J.taperedEdge?J.lineWidthEnd:wn(e)}function Cn(e){let t=J.lineWidthTaper,n=J.lineWidthStart*t**+e;return Math.max(J.lineWidthEnd,n)}function wn(e){if(e<=0)return J.lineWidthStart;if(e>=3)return J.lineWidthEnd;let t=e/3;return J.lineWidthStart+(J.lineWidthEnd-J.lineWidthStart)*t}function Tn(e,t,n,r){let i=1-e;return{x:i*i*i*t.x+3*i*i*e*n.x1+3*i*e*e*n.x2+e*e*e*r.x,y:i*i*i*t.y+3*i*i*e*n.y1+3*i*e*e*n.y2+e*e*e*r.y}}function En(e,t,n,r){let i=1-e;return{x:i*i*t.x+2*i*e*n.x+e*e*r.x,y:i*i*t.y+2*i*e*n.y+e*e*r.y}}function Dn(e,t,n,r,i=32,a=`curve`,o=`right`){if(a===`curve`){let a;if(o===`right`||o===`left`){let n=Math.abs(t.x-e.x)*.45,r=o===`right`?1:-1;a={x1:e.x+r*n,y1:e.y,x2:t.x-r*n,y2:t.y}}else{let n=Math.abs(t.y-e.y)*.45;a={x1:e.x,y1:e.y+n,x2:t.x,y2:t.y-n}}let s=n=>{let r=1-n;return{dx:-3*r*r*e.x+3*(r*r-2*r*n)*a.x1+3*(2*r*n-n*n)*a.x2+3*n*n*t.x,dy:-3*r*r*e.y+3*(r*r-2*r*n)*a.y1+3*(2*r*n-n*n)*a.y2+3*n*n*t.y}},c=[],l=[];for(let o=0;o<=i;o++){let u=o/i,d=o===0?e:o===i?t:Tn(u,e,a,t),f=s(u),p=Math.hypot(f.dx,f.dy);p<1e-6&&(p=1);let m=-f.dy/p,h=f.dx/p,g=(n+(r-n)*u)/2;c.push({x:d.x+m*g,y:d.y+h*g}),l.push({x:d.x-m*g,y:d.y-h*g})}let u=`M ${c[0].x.toFixed(2)} ${c[0].y.toFixed(2)}`;for(let e=1;e<=i;e++)u+=` L ${c[e].x.toFixed(2)} ${c[e].y.toFixed(2)}`;for(let e=i;e>=0;e--)u+=` L ${l[e].x.toFixed(2)} ${l[e].y.toFixed(2)}`;return u+=` Z`,u}if(a===`arc`){let a;a=o===`right`||o===`left`?{x:(e.x+t.x)/2,y:t.y}:{x:t.x,y:(e.y+t.y)/2};let s=n=>{let r=1-n;return{dx:2*r*(a.x-e.x)+2*n*(t.x-a.x),dy:2*r*(a.y-e.y)+2*n*(t.y-a.y)}},c=[],l=[];for(let o=0;o<=i;o++){let u=o/i,d=o===0?e:o===i?t:En(u,e,a,t),f=s(u),p=Math.hypot(f.dx,f.dy);p<1e-6&&(p=1);let m=-f.dy/p,h=f.dx/p,g=(n+(r-n)*u)/2;c.push({x:d.x+m*g,y:d.y+h*g}),l.push({x:d.x-m*g,y:d.y-h*g})}let u=n/2,d=r/2,f=`M ${c[0].x.toFixed(2)} ${c[0].y.toFixed(2)}`;for(let e=1;e<=i;e++)f+=` L ${c[e].x.toFixed(2)} ${c[e].y.toFixed(2)}`;f+=` A ${d.toFixed(2)} ${d.toFixed(2)} 0 0 0 ${l[i].x.toFixed(2)} ${l[i].y.toFixed(2)}`;for(let e=i-1;e>=0;e--)f+=` L ${l[e].x.toFixed(2)} ${l[e].y.toFixed(2)}`;return f+=` A ${u.toFixed(2)} ${u.toFixed(2)} 0 0 0 ${c[0].x.toFixed(2)} ${c[0].y.toFixed(2)}`,f+=` Z`,f}if(a===`elbow`){let i=[];if(o===`down`){let n=(e.y+t.y)/2;i.push(e,{x:e.x,y:n},{x:t.x,y:n},t)}else{let n=(e.x+t.x)/2;i.push(e,{x:n,y:e.y},{x:n,y:t.y},t)}let a=[],s=0;for(let e=0;e<i.length-1;e++){let t=Math.hypot(i[e+1].x-i[e].x,i[e+1].y-i[e].y);a.push(t),s+=t}let c=[n/2],l=0;for(let e=0;e<a.length-1;e++){l+=a[e];let t=s>0?l/s:0;c.push((n+(r-n)*t)/2)}c.push(r/2);let u=[];for(let e=0;e<i.length-1;e++){let t=i[e+1].x-i[e].x,n=i[e+1].y-i[e].y,r=Math.hypot(t,n);r<1e-6&&(r=1),u.push({x:-n/r,y:t/r})}let d=[],f=[];d.push({x:i[0].x+u[0].x*c[0],y:i[0].y+u[0].y*c[0]}),f.push({x:i[0].x-u[0].x*c[0],y:i[0].y-u[0].y*c[0]});for(let e=1;e<i.length-1;e++){let t=u[e-1],n=u[e],r=c[e],a=t.x+n.x,o=t.y+n.y,s=a*a+o*o;if(s<1e-6)d.push({x:i[e].x+t.x*r,y:i[e].y+t.y*r}),f.push({x:i[e].x-t.x*r,y:i[e].y-t.y*r});else{let t=2*r/s;d.push({x:i[e].x+a*t,y:i[e].y+o*t}),f.push({x:i[e].x-a*t,y:i[e].y-o*t})}}let p=u[u.length-1],m=c[c.length-1];d.push({x:i[i.length-1].x+p.x*m,y:i[i.length-1].y+p.y*m}),f.push({x:i[i.length-1].x-p.x*m,y:i[i.length-1].y-p.y*m});let h=`M ${d[0].x.toFixed(2)} ${d[0].y.toFixed(2)}`;for(let e=1;e<d.length;e++)h+=` L ${d[e].x.toFixed(2)} ${d[e].y.toFixed(2)}`;for(let e=f.length-1;e>=0;e--)h+=` L ${f[e].x.toFixed(2)} ${f[e].y.toFixed(2)}`;return h+=` Z`,h}if(a===`rounded-elbow`&&!(o===`down`?Math.abs(e.x-t.x)<.5:Math.abs(e.y-t.y)<.5)){let i=function(e,t,n){let r={x:e.pos.x-t*e.d1.x,y:e.pos.y-t*e.d1.y},i={x:e.pos.x+t*e.d2.x,y:e.pos.y+t*e.d2.y},a={x:e.pos.x+t*(e.d2.x-e.d1.x),y:e.pos.y+t*(e.d2.y-e.d1.y)},o=Math.atan2(r.y-a.y,r.x-a.x),s=Math.atan2(i.y-a.y,i.x-a.x)-o;for(;s>Math.PI;)s-=2*Math.PI;for(;s<-Math.PI;)s+=2*Math.PI;let c=[];for(let e=1;e<n;e++){let r=e/n,i=o+s*r;c.push({x:a.x+t*Math.cos(i),y:a.y+t*Math.sin(i)})}return c},a=[],s;if(o===`down`){let n=(e.y+t.y)/2,r=Math.sign(n-e.y)||1,i=Math.sign(t.x-e.x)||1,a=Math.sign(t.y-n)||1;s=[{pos:{x:e.x,y:n},d1:{x:0,y:r},d2:{x:i,y:0}},{pos:{x:t.x,y:n},d1:{x:i,y:0},d2:{x:0,y:a}}]}else{let n=(e.x+t.x)/2,r=Math.sign(n-e.x)||1,i=Math.sign(t.y-e.y)||1,a=Math.sign(t.x-n)||1;s=[{pos:{x:n,y:e.y},d1:{x:r,y:0},d2:{x:0,y:i}},{pos:{x:n,y:t.y},d1:{x:0,y:i},d2:{x:a,y:0}}]}let c=Math.hypot(s[1].pos.x-s[0].pos.x,s[1].pos.y-s[0].pos.y),l=Math.hypot(t.x-s[1].pos.x,t.y-s[1].pos.y),u=Math.min(c,l,J.elbowRadius)*.5,d=Math.max(2,u);a.push(e),a.push(s[0].pos),a.push({x:s[1].pos.x-d*s[1].d1.x,y:s[1].pos.y-d*s[1].d1.y});for(let e of i(s[1],d,12))a.push(e);a.push(t);let f=[],p=0;for(let e=0;e<a.length-1;e++){let t=Math.hypot(a[e+1].x-a[e].x,a[e+1].y-a[e].y);f.push(t),p+=t}let m=[];for(let e=0;e<a.length-1;e++){let t=a[e+1].x-a[e].x,n=a[e+1].y-a[e].y,r=Math.hypot(t,n);r<1e-6&&(r=1),m.push({x:-n/r,y:t/r})}let h=[],g=0;for(let e=0;e<a.length;e++){e>0&&(g+=f[e-1]);let t=p>0?g/p:0;h.push((n+(r-n)*t)/2)}let _=[],v=[];for(let e=0;e<a.length;e++){let t=h[e];if(e===0){let n=m[0];_.push({x:a[e].x+n.x*t,y:a[e].y+n.y*t}),v.push({x:a[e].x-n.x*t,y:a[e].y-n.y*t})}else if(e===a.length-1){let n=m[m.length-1];_.push({x:a[e].x+n.x*t,y:a[e].y+n.y*t}),v.push({x:a[e].x-n.x*t,y:a[e].y-n.y*t})}else{let n=m[e-1],r=m[e],i=n.x+r.x,o=n.y+r.y,s=i*i+o*o;if(s<1e-6)_.push({x:a[e].x+n.x*t,y:a[e].y+n.y*t}),v.push({x:a[e].x-n.x*t,y:a[e].y-n.y*t});else{let n=2*t/s;_.push({x:a[e].x+i*n,y:a[e].y+o*n}),v.push({x:a[e].x-i*n,y:a[e].y-o*n})}}}let y=`M ${_[0].x.toFixed(2)} ${_[0].y.toFixed(2)}`;for(let e=1;e<_.length;e++)y+=` L ${_[e].x.toFixed(2)} ${_[e].y.toFixed(2)}`;y+=` L ${v[_.length-1].x.toFixed(2)} ${v[_.length-1].y.toFixed(2)}`;for(let e=v.length-2;e>=0;e--)y+=` L ${v[e].x.toFixed(2)} ${v[e].y.toFixed(2)}`;return y+=` Z`,y}{let i=t.x-e.x,a=t.y-e.y,o=Math.hypot(i,a);o<1e-6&&(o=1);let s=-a/o,c=i/o,l=n/2,u=r/2,d={x:e.x+s*l,y:e.y+c*l},f={x:e.x-s*l,y:e.y-c*l},p={x:t.x-s*u,y:t.y-c*u},m={x:t.x+s*u,y:t.y+c*u};return`M ${d.x.toFixed(2)} ${d.y.toFixed(2)} L ${m.x.toFixed(2)} ${m.y.toFixed(2)} L ${p.x.toFixed(2)} ${p.y.toFixed(2)} L ${f.x.toFixed(2)} ${f.y.toFixed(2)} Z`}}let On=j(()=>Vn.value.root.children),kn=Ie[0].colors,An=j(()=>Le(J.branchPaletteId,J.customPalettes)),jn=j(()=>{let e=new Map;if(!J.rainbowBranch)return e;let t=l.lineColors,n=t&&t.length>0?t:An.value.colors.length>0?An.value.colors:kn;for(let t=0;t<On.value.length;t++){let r=On.value[t];e.set(r.id,n[t%n.length])}let r=(t,n)=>{e.set(t.id,n);for(let e of t.children)r(e,n)};for(let e=0;e<On.value.length;e++){let t=On.value[e];r(t,n[e%n.length])}return e});function Mn(e,t){return J.rainbowBranch?jn.value.get(t.id)??vn.value.lineColor:vn.value.lineColor}function Nn(e){let t=me(e.id);if(t.bg)return t.bg;if(e.isRoot)return vn.value.rootBg;if(e.depth>=3)return`transparent`;let n=e.depth===1?.15:.08;if(J.rainbowBranch){let t=jn.value.get(e.id);if(t)return Rn(t,n)}return Rn(vn.value.rootBg,n)}function Pn(e){let t=me(e.id);if(t.textColor)return t.textColor;if(e.isRoot)return vn.value.rootText;if(J.rainbowBranch){let t=jn.value.get(e.id);if(t)return zn(t,.55)}return vn.value.branchText}function Fn(e){let t=me(e.id);return t.borderColor?t.borderColor:`transparent`}function In(e){let t=me(e.id);return t.fontWeight?t.fontWeight:e.isRoot?700:e.depth<=1?600:e.depth===2?500:400}function Ln(e){return me(e.id).fontSize??e.fontSize??vn.value.fontSize}function Rn(e,t){let n=e.replace(`#`,``),r=n.length===6?n:n.split(``).map(e=>e+e).join(``);return`rgba(${parseInt(r.slice(0,2),16)}, ${parseInt(r.slice(2,4),16)}, ${parseInt(r.slice(4,6),16)}, ${t})`}function zn(e,t){let n=e.replace(`#`,``),r=n.length===6?n:n.split(``).map(e=>e+e).join(``);return`rgb(${Math.round(parseInt(r.slice(0,2),16)*(1-t))}, ${Math.round(parseInt(r.slice(2,4),16)*(1-t))}, ${Math.round(parseInt(r.slice(4,6),16)*(1-t))})`}let Y=pt({getContainer:()=>h.value});Y.setOnMarqueeEnd(ci),gt({isEditing:()=>_.value!==null,isReadonly:()=>l.previewMode,getSelectedId:()=>E.value,getSelectedIds:()=>[...C.value],defaultTargetId:()=>V.value.id,onAddChild:ir,onAddSibling:ar,onAddSiblingBefore:or,onRemove:vr,onStartEdit:qn,onClearSelection:()=>{if(Ir.value){Ir.value=null;return}if(Fr.value){Fr.value=null;return}C.value=new Set,X()},onDuplicate:sr,onCopy:fr,onCut:pr,onPaste:mr,hasClipboard:()=>!!re.value&&re.value.nodes.length>0,onUndo:hr,onRedo:gr,onNavigate:_r,onMoveSibling:Er,onSelectRoot:()=>{C.value=new Set([V.value.id]),X()}});let Vn=j(()=>{let e=He(V.value);return Kn(e),ke(e,{mode:J.layoutMode,baseFontSize:vn.value.fontSize,richHeights:oe.value,richWidths:se.value,branchGap:J.branchGap})}),Hn=T([]),Un=j(()=>(pn.value,Hn.value));e(Vn,e=>{let t=[],n=e=>{t.push(e);for(let t of e.children)n(t)};n(e.root),Hn.value=t},{immediate:!0});let Wn=j(()=>{let e=[];for(let t of Un.value)for(let n of t.children)e.push({from:t,to:n,key:`${t.id}->${n.id}`});return e}),Gn=j(()=>`${Vn.value.vbX} ${Vn.value.vbY} ${Vn.value.vbW} ${Vn.value.vbH}`);function Kn(e){if(O.value.has(e.id)){e.children=[],e.collapsed=!0;return}e.collapsed=!1;for(let t of e.children)Kn(t)}function qn(e){let t=G(V.value,e);t&&(_.value=e,b.value=t.text,C.value=new Set([e]),X(),s(()=>{let e=document.querySelector(`.zm-input`);e?.focus(),e?.select(),Zn(e)}))}function Jn(){if(!_.value)return;let e=G(V.value,_.value);e&&e.text!==(b.value.trim()||` `)&&(e.text=b.value.trim()||` `,K(),d(`change`,V.value)),_.value=null}function Yn(){_.value=null}function Zn(e){e&&(e.style.height=`auto`,e.style.height=e.scrollHeight+`px`)}function Qn(e){Zn(e.target)}function $n(e){if(l.previewMode)return;let t=G(V.value,e);t!=null&&t.richContent&&(B.value=e,ae.value=t.richContent.raw,s(()=>{document.querySelector(`.zm-node .zm-rich textarea`)?.focus()}))}function er(){if(!B.value)return;let e=B.value,t=G(V.value,e),n=ae.value;t&&t.richContent&&t.richContent.raw!==n&&(t.richContent.kind===`code`?we(e,{kind:`code`,raw:n,lang:ss(n)||void 0}):we(e,{kind:`table`,raw:n})),B.value=null}function tr(){B.value=null}function nr(e){e.key===`Escape`?(e.preventDefault(),tr()):e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),er())}function rr(e){let t=e.metaKey||e.ctrlKey;t&&(e.key===`z`||e.key===`Z`)&&!e.shiftKey?(e.preventDefault(),hr()):(t&&e.shiftKey&&(e.key===`z`||e.key===`Z`)||t&&(e.key===`y`||e.key===`Y`)&&!e.shiftKey)&&(e.preventDefault(),gr())}function ir(e){let t=Je(V.value,e,tt);t&&(K(),q(),d(`change`,V.value),s(()=>qn(t.id)))}function ar(e){if(e===V.value.id){ir(e);return}let t=Ye(V.value,e,tt);t&&(K(),q(),d(`change`,V.value),s(()=>qn(t.id)))}function or(e){if(e===V.value.id){ir(e);return}let t=Xe(V.value,e,tt);t&&(K(),q(),d(`change`,V.value),s(()=>qn(t.id)))}function sr(e){if(e===V.value.id)return;let t=Ze(V.value,e);t&&(K(),C.value=new Set([t.id]),X(),d(`change`,V.value),q())}function cr(e){let t=[],n=new Set;for(let r of e)r!==V.value.id&&(n.has(r)||G(V.value,r)&&(n.add(r),t.push(r)));return t}function lr(e){let t=new Set(e),n=[],r=e=>{t.has(e.id)&&n.push(e.id);for(let t of e.children)r(t)};return r(V.value),n}function ur(e){var t;try{(t=navigator.clipboard)==null||t.writeText(e)}catch{}}function dr(e){let t=[],n=(e,r)=>{let i=` `.repeat(r),a=r===0?``:`- `;t.push(i+a+(e.text||``));for(let t of e.children)n(t,r+1)};return n(e,0),t.join(`
|
|
133
|
+
| a | b | c |`);if(r===null)return;let i=r.trim();if(!i){we(e,null);return}we(e,{kind:`table`,raw:i})}function Yt(){let e=U.value?.nodeId;e&&we(e,null)}function Xt(){let e=U.value?.nodeId;e&&Xr(e)}function Zt(e){f.previewMode||(w.value=new Set([e]),X(),f.builtInDrawers&&(ft(),W.value=!0,qe.value++),m(`edit-note`,e))}function Qt(e,t=60){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n||`点击编辑笔记`:n.slice(0,t)+`…`}function $t(e){if(f.previewMode||v.value)return;let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))return;let n=D.value;if(!n)return;let r=e.clipboardData?.items;if(!r)return;for(let t=0;t<r.length;t++){let i=r[t];if(i.kind===`file`&&i.type.startsWith(`image/`)){let t=i.getAsFile();if(!t)continue;e.preventDefault();let r=G(V.value,n);if(r!=null&&r.image&&!window.confirm(`该节点已有图片,要用剪贴板里的图片替换吗?`))return;ve(t,e=>he(n,e));return}}if(re.value&&re.value.nodes.length>0)return;let i=null;for(let t=0;t<r.length;t++){let n=r[t];if(n.kind===`string`&&n.type===`text/plain`){i=e.clipboardData?.getData(`text/plain`)??null;break}}if(!i)return;let a=i.split(/\r?\n/).map(e=>e.replace(/^\s*[-*+]\s+/,``).trim()).filter(e=>e.length>0);if(a.length!==0){e.preventDefault(),K();for(let e of a)Je(V.value,n,e);q(),m(`change`,V.value)}}s(()=>{window.addEventListener(`paste`,$t),window.addEventListener(`keydown`,en),q()}),t(()=>{window.removeEventListener(`paste`,$t),window.removeEventListener(`keydown`,en)});function en(e){if((e.metaKey||e.ctrlKey)&&(e.key===`f`||e.key===`F`)){let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))return;e.preventDefault(),m(`canvas-outline`);return}if((e.key===`Delete`||e.key===`Backspace`)&&Fr.value){let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable)||f.previewMode)return;e.preventDefault(),Jr(Fr.value)}}let tn=E(null),nn=j(()=>tn.value?.nodeId??null);function rn(e,t){if(!t.image)return;e.preventDefault(),e.stopPropagation();let n=t.image.naturalW||t.image.width,r=t.image.naturalH||t.image.height,i=r>0?r/n:1;tn.value={nodeId:t.id,startX:e.clientX,startY:e.clientY,startW:t.image.width,startH:t.image.height,naturalW:n,naturalH:r,ratio:i,pendingW:t.image.width,pendingH:t.image.height},window.addEventListener(`mousemove`,an),window.addEventListener(`mouseup`,on)}function an(e){let t=tn.value;if(!t)return;let n=Y.scale.value||1,r=e.clientX-t.startX,i=_e(t.startW+r/n,Ad,jd),a=_e(i*t.ratio,Ad,jd);t.pendingW=i,t.pendingH=a;let o=g.value?.querySelector(`[data-node-id="${t.nodeId}"] .zm-node-img`);o&&(o.style.width=`${i}px`,o.style.height=`${a}px`);let s=g.value?.querySelector(`[data-node-id="${t.nodeId}"]`);s&&(s.style.minWidth=`${Math.max(80,Math.ceil(i+28))}px`,s.style.height=`${Math.ceil(a+8+30)}px`)}function on(){let e=tn.value;if(window.removeEventListener(`mousemove`,an),window.removeEventListener(`mouseup`,on),tn.value=null,!e)return;let t=G(V.value,e.nodeId);!t||!t.image||(he(e.nodeId,{src:t.image.src,naturalW:t.image.naturalW,naturalH:t.image.naturalH,width:e.pendingW,height:e.pendingH}),w.value=new Set([e.nodeId]),X(),cn=!0)}let sn=E(null),cn=!1,ln=!1;function un(e){sn.value=e}function dn(e){sn.value===e&&(sn.value=null),z.value&&=null}function fn(e,t){if(!t.text||t.text.length<14)return;let n=e.currentTarget.getBoundingClientRect(),r=g.value?.getBoundingClientRect();if(!r)return;let i=n.top-r.top>60,a=n.left-r.left+n.width/2,o=r.width-240/2-10,s=Math.max(130,Math.min(a,o)),c=i?n.top-r.top-8:n.bottom-r.top+8;z.value={text:t.text,x:s,y:c,above:i}}let pn=E(0),mn=E(!1),gn=_t(100);function K(){gn.record({data:V.value,selectedIds:[...w.value]})}function q(){O.value=new Set(O.value),pn.value++,d().then(()=>d()).then(()=>_n()).then(()=>{pn.value++})}function _n(){let e=document.querySelectorAll(`.zm-rich`),t={},n={};e.forEach(e=>{let r=e,i=null;for(;r&&!i;)i=r.getAttribute(`data-node-id`),r=r.parentElement;if(!i)return;let a=e.offsetHeight,o=e.scrollWidth,s=Math.round(a*2)/2,c=Math.round(o*2)/2;t[i]=s,n[i]=c,oe.value[i],se.value[i]}),oe.value=t,se.value=n}let vn=j(()=>({rootBg:f.theme?.rootBg??`#1f2937`,rootText:f.theme?.rootText??`#ffffff`,branchBg:f.theme?.branchBg??`#ffffff`,branchText:f.theme?.branchText??`#1f2937`,lineColor:f.theme?.lineColor??`#94a3b8`,bgColor:f.theme?.bgColor??`#f8fafc`,fontSize:f.theme?.fontSize??14,lineWidthStart:f.theme?.lineWidthStart??2.2,lineWidthEnd:f.theme?.lineWidthEnd??.8,rainbowBranch:f.theme?.rainbowBranch??!1})),yn=j(()=>J.canvasBg||vn.value.bgColor),J=y({autoBalanceOnChange:!0,lineWidthStart:16,lineWidthEnd:3.6,rainbowBranch:!0,branchPaletteId:`default`,customPalettes:[],lineStyle:`rounded-elbow`,rootLineStyle:`arc`,lineOrigin:`xmind`,layoutMode:`mindmap`,taperedEdge:!0,lineWidthTaper:.3,uniformLineWidth:!0,elbowRadius:20,showOrderBadge:!1,canvasBg:void 0,branchGap:20});function bn(e){return e?J.rootLineStyle:J.lineStyle}function xn(e){return J.taperedEdge?J.uniformLineWidth&&e>0?J.lineWidthEnd:Cn(e):wn(e)}function Sn(e){return J.taperedEdge?J.lineWidthEnd:wn(e)}function Cn(e){let t=J.lineWidthTaper,n=J.lineWidthStart*t**+e;return Math.max(J.lineWidthEnd,n)}function wn(e){if(e<=0)return J.lineWidthStart;if(e>=3)return J.lineWidthEnd;let t=e/3;return J.lineWidthStart+(J.lineWidthEnd-J.lineWidthStart)*t}function Tn(e,t,n,r){let i=1-e;return{x:i*i*i*t.x+3*i*i*e*n.x1+3*i*e*e*n.x2+e*e*e*r.x,y:i*i*i*t.y+3*i*i*e*n.y1+3*i*e*e*n.y2+e*e*e*r.y}}function En(e,t,n,r){let i=1-e;return{x:i*i*t.x+2*i*e*n.x+e*e*r.x,y:i*i*t.y+2*i*e*n.y+e*e*r.y}}function Dn(e,t,n,r,i=32,a=`curve`,o=`right`){if(a===`curve`){let a;if(o===`right`||o===`left`){let n=Math.abs(t.x-e.x)*.45,r=o===`right`?1:-1;a={x1:e.x+r*n,y1:e.y,x2:t.x-r*n,y2:t.y}}else{let n=Math.abs(t.y-e.y)*.45;a={x1:e.x,y1:e.y+n,x2:t.x,y2:t.y-n}}let s=n=>{let r=1-n;return{dx:-3*r*r*e.x+3*(r*r-2*r*n)*a.x1+3*(2*r*n-n*n)*a.x2+3*n*n*t.x,dy:-3*r*r*e.y+3*(r*r-2*r*n)*a.y1+3*(2*r*n-n*n)*a.y2+3*n*n*t.y}},c=[],l=[];for(let o=0;o<=i;o++){let u=o/i,d=o===0?e:o===i?t:Tn(u,e,a,t),f=s(u),p=Math.hypot(f.dx,f.dy);p<1e-6&&(p=1);let m=-f.dy/p,h=f.dx/p,g=(n+(r-n)*u)/2;c.push({x:d.x+m*g,y:d.y+h*g}),l.push({x:d.x-m*g,y:d.y-h*g})}let u=`M ${c[0].x.toFixed(2)} ${c[0].y.toFixed(2)}`;for(let e=1;e<=i;e++)u+=` L ${c[e].x.toFixed(2)} ${c[e].y.toFixed(2)}`;for(let e=i;e>=0;e--)u+=` L ${l[e].x.toFixed(2)} ${l[e].y.toFixed(2)}`;return u+=` Z`,u}if(a===`arc`){let a;a=o===`right`||o===`left`?{x:(e.x+t.x)/2,y:t.y}:{x:t.x,y:(e.y+t.y)/2};let s=n=>{let r=1-n;return{dx:2*r*(a.x-e.x)+2*n*(t.x-a.x),dy:2*r*(a.y-e.y)+2*n*(t.y-a.y)}},c=[],l=[];for(let o=0;o<=i;o++){let u=o/i,d=o===0?e:o===i?t:En(u,e,a,t),f=s(u),p=Math.hypot(f.dx,f.dy);p<1e-6&&(p=1);let m=-f.dy/p,h=f.dx/p,g=(n+(r-n)*u)/2;c.push({x:d.x+m*g,y:d.y+h*g}),l.push({x:d.x-m*g,y:d.y-h*g})}let u=n/2,d=r/2,f=`M ${c[0].x.toFixed(2)} ${c[0].y.toFixed(2)}`;for(let e=1;e<=i;e++)f+=` L ${c[e].x.toFixed(2)} ${c[e].y.toFixed(2)}`;f+=` A ${d.toFixed(2)} ${d.toFixed(2)} 0 0 0 ${l[i].x.toFixed(2)} ${l[i].y.toFixed(2)}`;for(let e=i-1;e>=0;e--)f+=` L ${l[e].x.toFixed(2)} ${l[e].y.toFixed(2)}`;return f+=` A ${u.toFixed(2)} ${u.toFixed(2)} 0 0 0 ${c[0].x.toFixed(2)} ${c[0].y.toFixed(2)}`,f+=` Z`,f}if(a===`elbow`){let i=[];if(o===`down`){let n=(e.y+t.y)/2;i.push(e,{x:e.x,y:n},{x:t.x,y:n},t)}else{let n=(e.x+t.x)/2;i.push(e,{x:n,y:e.y},{x:n,y:t.y},t)}let a=[],s=0;for(let e=0;e<i.length-1;e++){let t=Math.hypot(i[e+1].x-i[e].x,i[e+1].y-i[e].y);a.push(t),s+=t}let c=[n/2],l=0;for(let e=0;e<a.length-1;e++){l+=a[e];let t=s>0?l/s:0;c.push((n+(r-n)*t)/2)}c.push(r/2);let u=[];for(let e=0;e<i.length-1;e++){let t=i[e+1].x-i[e].x,n=i[e+1].y-i[e].y,r=Math.hypot(t,n);r<1e-6&&(r=1),u.push({x:-n/r,y:t/r})}let d=[],f=[];d.push({x:i[0].x+u[0].x*c[0],y:i[0].y+u[0].y*c[0]}),f.push({x:i[0].x-u[0].x*c[0],y:i[0].y-u[0].y*c[0]});for(let e=1;e<i.length-1;e++){let t=u[e-1],n=u[e],r=c[e],a=t.x+n.x,o=t.y+n.y,s=a*a+o*o;if(s<1e-6)d.push({x:i[e].x+t.x*r,y:i[e].y+t.y*r}),f.push({x:i[e].x-t.x*r,y:i[e].y-t.y*r});else{let t=2*r/s;d.push({x:i[e].x+a*t,y:i[e].y+o*t}),f.push({x:i[e].x-a*t,y:i[e].y-o*t})}}let p=u[u.length-1],m=c[c.length-1];d.push({x:i[i.length-1].x+p.x*m,y:i[i.length-1].y+p.y*m}),f.push({x:i[i.length-1].x-p.x*m,y:i[i.length-1].y-p.y*m});let h=`M ${d[0].x.toFixed(2)} ${d[0].y.toFixed(2)}`;for(let e=1;e<d.length;e++)h+=` L ${d[e].x.toFixed(2)} ${d[e].y.toFixed(2)}`;for(let e=f.length-1;e>=0;e--)h+=` L ${f[e].x.toFixed(2)} ${f[e].y.toFixed(2)}`;return h+=` Z`,h}if(a===`rounded-elbow`&&!(o===`down`?Math.abs(e.x-t.x)<.5:Math.abs(e.y-t.y)<.5)){let i=function(e,t,n){let r={x:e.pos.x-t*e.d1.x,y:e.pos.y-t*e.d1.y},i={x:e.pos.x+t*e.d2.x,y:e.pos.y+t*e.d2.y},a={x:e.pos.x+t*(e.d2.x-e.d1.x),y:e.pos.y+t*(e.d2.y-e.d1.y)},o=Math.atan2(r.y-a.y,r.x-a.x),s=Math.atan2(i.y-a.y,i.x-a.x)-o;for(;s>Math.PI;)s-=2*Math.PI;for(;s<-Math.PI;)s+=2*Math.PI;let c=[];for(let e=1;e<n;e++){let r=e/n,i=o+s*r;c.push({x:a.x+t*Math.cos(i),y:a.y+t*Math.sin(i)})}return c},a=[],s;if(o===`down`){let n=(e.y+t.y)/2,r=Math.sign(n-e.y)||1,i=Math.sign(t.x-e.x)||1,a=Math.sign(t.y-n)||1;s=[{pos:{x:e.x,y:n},d1:{x:0,y:r},d2:{x:i,y:0}},{pos:{x:t.x,y:n},d1:{x:i,y:0},d2:{x:0,y:a}}]}else{let n=(e.x+t.x)/2,r=Math.sign(n-e.x)||1,i=Math.sign(t.y-e.y)||1,a=Math.sign(t.x-n)||1;s=[{pos:{x:n,y:e.y},d1:{x:r,y:0},d2:{x:0,y:i}},{pos:{x:n,y:t.y},d1:{x:0,y:i},d2:{x:a,y:0}}]}let c=Math.hypot(s[1].pos.x-s[0].pos.x,s[1].pos.y-s[0].pos.y),l=Math.hypot(t.x-s[1].pos.x,t.y-s[1].pos.y),u=Math.min(c,l,J.elbowRadius)*.5,d=Math.max(2,u);a.push(e),a.push(s[0].pos),a.push({x:s[1].pos.x-d*s[1].d1.x,y:s[1].pos.y-d*s[1].d1.y});for(let e of i(s[1],d,12))a.push(e);a.push(t);let f=[],p=0;for(let e=0;e<a.length-1;e++){let t=Math.hypot(a[e+1].x-a[e].x,a[e+1].y-a[e].y);f.push(t),p+=t}let m=[];for(let e=0;e<a.length-1;e++){let t=a[e+1].x-a[e].x,n=a[e+1].y-a[e].y,r=Math.hypot(t,n);r<1e-6&&(r=1),m.push({x:-n/r,y:t/r})}let h=[],g=0;for(let e=0;e<a.length;e++){e>0&&(g+=f[e-1]);let t=p>0?g/p:0;h.push((n+(r-n)*t)/2)}let _=[],v=[];for(let e=0;e<a.length;e++){let t=h[e];if(e===0){let n=m[0];_.push({x:a[e].x+n.x*t,y:a[e].y+n.y*t}),v.push({x:a[e].x-n.x*t,y:a[e].y-n.y*t})}else if(e===a.length-1){let n=m[m.length-1];_.push({x:a[e].x+n.x*t,y:a[e].y+n.y*t}),v.push({x:a[e].x-n.x*t,y:a[e].y-n.y*t})}else{let n=m[e-1],r=m[e],i=n.x+r.x,o=n.y+r.y,s=i*i+o*o;if(s<1e-6)_.push({x:a[e].x+n.x*t,y:a[e].y+n.y*t}),v.push({x:a[e].x-n.x*t,y:a[e].y-n.y*t});else{let n=2*t/s;_.push({x:a[e].x+i*n,y:a[e].y+o*n}),v.push({x:a[e].x-i*n,y:a[e].y-o*n})}}}let y=`M ${_[0].x.toFixed(2)} ${_[0].y.toFixed(2)}`;for(let e=1;e<_.length;e++)y+=` L ${_[e].x.toFixed(2)} ${_[e].y.toFixed(2)}`;y+=` L ${v[_.length-1].x.toFixed(2)} ${v[_.length-1].y.toFixed(2)}`;for(let e=v.length-2;e>=0;e--)y+=` L ${v[e].x.toFixed(2)} ${v[e].y.toFixed(2)}`;return y+=` Z`,y}{let i=t.x-e.x,a=t.y-e.y,o=Math.hypot(i,a);o<1e-6&&(o=1);let s=-a/o,c=i/o,l=n/2,u=r/2,d={x:e.x+s*l,y:e.y+c*l},f={x:e.x-s*l,y:e.y-c*l},p={x:t.x-s*u,y:t.y-c*u},m={x:t.x+s*u,y:t.y+c*u};return`M ${d.x.toFixed(2)} ${d.y.toFixed(2)} L ${m.x.toFixed(2)} ${m.y.toFixed(2)} L ${p.x.toFixed(2)} ${p.y.toFixed(2)} L ${f.x.toFixed(2)} ${f.y.toFixed(2)} Z`}}let On=j(()=>Vn.value.root.children),kn=Ie[0].colors,An=j(()=>Le(J.branchPaletteId,J.customPalettes)),jn=j(()=>{let e=new Map;if(!J.rainbowBranch)return e;let t=f.lineColors,n=t&&t.length>0?t:An.value.colors.length>0?An.value.colors:kn;for(let t=0;t<On.value.length;t++){let r=On.value[t];e.set(r.id,n[t%n.length])}let r=(t,n)=>{e.set(t.id,n);for(let e of t.children)r(e,n)};for(let e=0;e<On.value.length;e++){let t=On.value[e];r(t,n[e%n.length])}return e});function Mn(e,t){return J.rainbowBranch?jn.value.get(t.id)??vn.value.lineColor:vn.value.lineColor}function Nn(e){let t=me(e.id);if(t.bg)return t.bg;if(e.isRoot)return vn.value.rootBg;if(e.depth>=3)return`transparent`;let n=e.depth===1?.15:.08;if(J.rainbowBranch){let t=jn.value.get(e.id);if(t)return Rn(t,n)}return Rn(vn.value.rootBg,n)}function Pn(e){let t=me(e.id);if(t.textColor)return t.textColor;if(e.isRoot)return vn.value.rootText;if(J.rainbowBranch){let t=jn.value.get(e.id);if(t)return zn(t,.55)}return vn.value.branchText}function Fn(e){let t=me(e.id);return t.borderColor?t.borderColor:`transparent`}function In(e){let t=me(e.id);return t.fontWeight?t.fontWeight:e.isRoot?700:e.depth<=1?600:e.depth===2?500:400}function Ln(e){return me(e.id).fontSize??e.fontSize??vn.value.fontSize}function Rn(e,t){let n=e.replace(`#`,``),r=n.length===6?n:n.split(``).map(e=>e+e).join(``);return`rgba(${parseInt(r.slice(0,2),16)}, ${parseInt(r.slice(2,4),16)}, ${parseInt(r.slice(4,6),16)}, ${t})`}function zn(e,t){let n=e.replace(`#`,``),r=n.length===6?n:n.split(``).map(e=>e+e).join(``);return`rgb(${Math.round(parseInt(r.slice(0,2),16)*(1-t))}, ${Math.round(parseInt(r.slice(2,4),16)*(1-t))}, ${Math.round(parseInt(r.slice(4,6),16)*(1-t))})`}let Y=pt({getContainer:()=>g.value});Y.setOnMarqueeEnd(ci),gt({isEditing:()=>v.value!==null,isReadonly:()=>f.previewMode,getSelectedId:()=>D.value,getSelectedIds:()=>[...w.value],defaultTargetId:()=>V.value.id,onAddChild:ir,onAddSibling:ar,onAddSiblingBefore:or,onRemove:vr,onStartEdit:qn,onClearSelection:()=>{if(Ir.value){Ir.value=null;return}if(Fr.value){Fr.value=null;return}w.value=new Set,X()},onDuplicate:sr,onCopy:fr,onCut:pr,onPaste:mr,hasClipboard:()=>!!re.value&&re.value.nodes.length>0,onUndo:hr,onRedo:gr,onNavigate:_r,onMoveSibling:Er,onSelectRoot:()=>{w.value=new Set([V.value.id]),X()}});let Vn=j(()=>{let e=He(V.value);return Kn(e),ke(e,{mode:J.layoutMode,baseFontSize:vn.value.fontSize,richHeights:oe.value,richWidths:se.value,branchGap:J.branchGap})}),Hn=E([]),Un=j(()=>(pn.value,Hn.value));e(Vn,e=>{let t=[],n=e=>{t.push(e);for(let t of e.children)n(t)};n(e.root),Hn.value=t},{immediate:!0});let Wn=j(()=>{let e=[];for(let t of Un.value)for(let n of t.children)e.push({from:t,to:n,key:`${t.id}->${n.id}`});return e}),Gn=j(()=>`${Vn.value.vbX} ${Vn.value.vbY} ${Vn.value.vbW} ${Vn.value.vbH}`);function Kn(e){if(O.value.has(e.id)){e.children=[],e.collapsed=!0;return}e.collapsed=!1;for(let t of e.children)Kn(t)}function qn(e){let t=G(V.value,e);t&&(v.value=e,x.value=t.text,w.value=new Set([e]),X(),d(()=>{let e=document.querySelector(`.zm-input`);e?.focus(),e?.select(),Zn(e)}))}function Jn(){if(!v.value)return;let e=G(V.value,v.value);e&&e.text!==(x.value.trim()||` `)&&(e.text=x.value.trim()||` `,K(),m(`change`,V.value)),v.value=null}function Yn(){v.value=null}function Zn(e){e&&(e.style.height=`auto`,e.style.height=e.scrollHeight+`px`)}function Qn(e){Zn(e.target)}function $n(e){if(f.previewMode)return;let t=G(V.value,e);t!=null&&t.richContent&&(B.value=e,ae.value=t.richContent.raw,d(()=>{document.querySelector(`.zm-node .zm-rich textarea`)?.focus()}))}function er(){if(!B.value)return;let e=B.value,t=G(V.value,e),n=ae.value;t&&t.richContent&&t.richContent.raw!==n&&(t.richContent.kind===`code`?we(e,{kind:`code`,raw:n,lang:ss(n)||void 0}):we(e,{kind:`table`,raw:n})),B.value=null}function tr(){B.value=null}function nr(e){e.key===`Escape`?(e.preventDefault(),tr()):e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),er())}function rr(e){let t=e.metaKey||e.ctrlKey;t&&(e.key===`z`||e.key===`Z`)&&!e.shiftKey?(e.preventDefault(),hr()):(t&&e.shiftKey&&(e.key===`z`||e.key===`Z`)||t&&(e.key===`y`||e.key===`Y`)&&!e.shiftKey)&&(e.preventDefault(),gr())}function ir(e){let t=Je(V.value,e,tt);t&&(K(),q(),m(`change`,V.value),d(()=>qn(t.id)))}function ar(e){if(e===V.value.id){ir(e);return}let t=Ye(V.value,e,tt);t&&(K(),q(),m(`change`,V.value),d(()=>qn(t.id)))}function or(e){if(e===V.value.id){ir(e);return}let t=Xe(V.value,e,tt);t&&(K(),q(),m(`change`,V.value),d(()=>qn(t.id)))}function sr(e){if(e===V.value.id)return;let t=Ze(V.value,e);t&&(K(),w.value=new Set([t.id]),X(),m(`change`,V.value),q())}function cr(e){let t=[],n=new Set;for(let r of e)r!==V.value.id&&(n.has(r)||G(V.value,r)&&(n.add(r),t.push(r)));return t}function lr(e){let t=new Set(e),n=[],r=e=>{t.has(e.id)&&n.push(e.id);for(let t of e.children)r(t)};return r(V.value),n}function ur(e){var t;try{(t=navigator.clipboard)==null||t.writeText(e)}catch{}}function dr(e){let t=[],n=(e,r)=>{let i=` `.repeat(r),a=r===0?``:`- `;t.push(i+a+(e.text||``));for(let t of e.children)n(t,r+1)};return n(e,0),t.join(`
|
|
134
134
|
`)}function fr(e){if(e.includes(V.value.id)){re.value=null,ur(dr(V.value)),q();return}let t=lr(cr(e));if(t.length===0)return;let n=[];for(let e of t){let t=$e(V.value,e);t&&n.push(t)}n.length!==0&&(re.value={nodes:n,originalIds:new Set(t)},ur(n.map(e=>e.text).join(`
|
|
135
|
-
`)),q())}function pr(e){let t=lr(cr(e));if(t.length===0)return;let n=[];for(let e of t){let t=$e(V.value,e);t&&n.push(t)}if(n.length===0)return;K();let r=[];for(let e of t){let t=G(V.value,e);t&&r.push(...ii(t))}for(let e of t)We(V.value,e);for(let e of r)ct(V.value,e);
|
|
136
|
-
`)),q(),d(`change`,V.value)}function mr(e){let t=re.value;if(!t||t.nodes.length===0)return;let n=e??V.value.id,r=G(V.value,n);if(r){for(let e of t.originalIds){let t=G(V.value,e);if(t&&G(t,n))return}K();for(let e of t.nodes){let t=He(e);Qe(t),r.children.push(t)}re.value=null,q(),d(`change`,V.value)}}function hr(){let e=gn.undo();e&&(V.value=e.data,C.value=new Set(e.selectedIds??[]),X(),q(),d(`change`,V.value))}function gr(){let e=gn.redo();e&&(V.value=e.data,C.value=new Set(e.selectedIds??[]),X(),q(),d(`change`,V.value))}function X(){let e=[];for(let t of C.value){let n=G(V.value,t);n&&e.push(n)}if(l.builtInDrawers&&!l.previewMode&&e.length>0){let t=e[0];!W.value&&vi(t.id)&&(ft(),W.value=!0)}else l.builtInDrawers&&e.length===0&&(W.value=!1);d(`select`,e.length>0?e:null)}function _r(e,t){let n=E.value??V.value.id,r=G(V.value,n);if(!r)return;let i=null;if(t===1){let e=Ue(V.value,r.id);if(e){let t=e.children.findIndex(e=>e.id===r.id);t>=0&&t<e.children.length-1&&(i=e.children[t+1].id)}}else if(t===-1){let e=Ue(V.value,r.id);if(e){let t=e.children.findIndex(e=>e.id===r.id);t>0&&(i=e.children[t-1].id)}}else if(e===1){let e=Ue(V.value,r.id);e&&(i=e.id)}else e===-1&&r.children.length>0&&(i=r.children[0].id);i&&(C.value=new Set([i]),X())}function vr(e){var t;if(e===V.value.id)return;let n=G(V.value,e),r=n?ii(n):[e];if(We(V.value,e)){for(let e of r)ct(V.value,e);if((t=Ir.value)!=null&&t.fromId&&r.includes(Ir.value.fromId)&&(Ir.value=null),K(),C.value.has(e)){let t=new Set(C.value);t.delete(e),C.value=t,X()}q(),d(`change`,V.value)}}function yr(e){O.value.has(e)?O.value.delete(e):O.value.add(e),q()}function br(e){let t=[{n:V.value,depth:1}];for(;t.length;){let{n,depth:r}=t.pop();e(n,r);for(let e=n.children.length-1;e>=0;e--)t.push({n:n.children[e],depth:r+1})}}function xr(){O.value=new Set,br(e=>{e.children.length>0&&O.value.add(e.id)}),q()}function Sr(e){O.value=new Set,br((t,n)=>{n>e&&t.children.length>0&&O.value.add(t.id)}),q()}function Cr(){O.value=new Set,q()}function wr(e,t){Ge(V.value,e,t)&&(K(),q(),d(`change`,V.value))}function Tr(e,t,n){return Ke(V.value,e,t,n)?(K(),q(),d(`change`,V.value),!0):!1}function Er(e){let t=E.value;if(!t)return;let n=V.value;if(t===n.id)return;let r=Ue(n,t);if(!r)return;let i=r.children.findIndex(e=>e.id===t);if(i<0)return;let a=e,o=Un.value.find(e=>e.id===t);if(o&&Nr(o)&&(a=-e),a<0){if(i===0)return;let e=r.children[i-1].id;Ke(n,t,e,`before`)}else{if(i>=r.children.length-1)return;let e=r.children[i+1].id;Ke(n,t,e,`after`)}K(),q(),d(`change`,n)}function Dr(e,t){if(ln){ln=!1;return}if(e.stopPropagation(),Ir.value){let e=Ir.value;e.fromId?e.fromId!==t.id&&(qr(e.fromId,t.id),Ir.value=null):(e.fromId=t.id,C.value=new Set([t.id]),X());return}if(Fr.value=null,e.shiftKey){let e=new Set(C.value);e.has(t.id)?e.delete(t.id):e.add(t.id),C.value=e}else C.value=new Set([t.id]);X()}function Or(e,t,n){let r=null;for(let i of Un.value){if(i.id===n)continue;let a=i.width/2,o=i.height/2;e>=i.x-a&&e<=i.x+a&&t>=i.y-o&&t<=i.y+o&&(r=i)}return r}let kr=null;function Ar(e,t){if(l.previewMode||e.button!==0)return;ln=!1;let n=e.target;if(n!=null&&n.closest(`.zm-img-resize-handle`))return;if(Fr.value){let t=Gr.value.find(e=>e.rel.id===Fr.value);if(t){let n=h.value.getBoundingClientRect(),r=Y.scale.value,i=e=>n.left+e.x*r+Y.offsetX.value,a=e=>n.top+e.y*r+Y.offsetY.value,o=Math.hypot(e.clientX-i(t.from),e.clientY-a(t.from)),s=Math.hypot(e.clientX-i(t.to),e.clientY-a(t.to));if(Math.min(o,s)<=20){e.stopPropagation(),e.preventDefault(),ln=!0,$r(e,t.rel.id,o<=s?`from`:`to`);return}}}if(t.isRoot)return;e.stopPropagation();let r=h.value.getBoundingClientRect(),i=t.x*Y.scale.value+Y.offsetX.value,a=t.y*Y.scale.value+Y.offsetY.value,o=e.clientX-r.left-i,s=e.clientY-r.top-a;kr={srcId:t.id,srcText:t.text,pointerOffsetX:o,pointerOffsetY:s,startX:e.clientX,startY:e.clientY},window.addEventListener(`pointermove`,jr),window.addEventListener(`pointerup`,Pr),window.addEventListener(`pointercancel`,Pr)}function jr(e){if(kr){let t=e.clientX-kr.startX,n=e.clientY-kr.startY;if(Math.abs(t)<=Nd&&Math.abs(n)<=Nd)return;F.value={srcId:kr.srcId,srcText:kr.srcText,pointerOffsetX:kr.pointerOffsetX,pointerOffsetY:kr.pointerOffsetY,currentTargetId:null,dropPosition:null},document.body.classList.add(`is-dragging`),kr=null}let t=F.value;if(!t)return;let n=h.value.getBoundingClientRect();I.value=e.clientX-n.left-t.pointerOffsetX,te.value=e.clientY-n.top-t.pointerOffsetY;let r=(e.clientX-n.left-Y.offsetX.value)/Y.scale.value,i=(e.clientY-n.top-Y.offsetY.value)/Y.scale.value,a=Or(r,i,t.srcId);t.currentTargetId=a?.id??null,a?t.dropPosition=Mr(r,i,a):t.dropPosition=null}function Mr(e,t,n){if(n.isRoot)return`child`;let r=n.width/2,i=n.height/2;if(n._dir===`down`){let t=e-n.x;return t<-r*.3?`before`:t>r*.3?`after`:`child`}let a=t-n.y;return a<-i*.3?`before`:a>i*.3?`after`:`child`}function Nr(e){var t;return!!((t=e.parent)!=null&&t.isRoot)&&e._dir===`left`}function Pr(e){if(window.removeEventListener(`pointermove`,jr),window.removeEventListener(`pointerup`,Pr),window.removeEventListener(`pointercancel`,Pr),kr){kr=null;return}let t=F.value;if(t){if(t.currentTargetId&&t.dropPosition){let e=t.dropPosition;if(e!==`child`){let n=Un.value.find(e=>e.id===t.currentTargetId);n&&Nr(n)&&(e=e===`before`?`after`:`before`)}Tr(t.srcId,t.currentTargetId,e),C.value=new Set([t.srcId]),X()}F.value=null,I.value=0,te.value=0,document.body.classList.remove(`is-dragging`)}}let Fr=T(null),Ir=T(null),Lr=T(null),Rr=T(null),zr=T(``);function Br(e,t){let n=e.width/2,r=e.height/2,i=(t%4+4)%4;return i<1?{x:e.x-n+2*n*i,y:e.y-r}:i<2?{x:e.x+n,y:e.y-r+2*r*(i-1)}:i<3?{x:e.x+n-2*n*(i-2),y:e.y+r}:{x:e.x-n,y:e.y+r-2*r*(i-3)}}function Vr(e,t){let n=t.x-e.x,r=t.y-e.y,i=e.width/2,a=e.height/2;if(Math.abs(n)<1e-6&&Math.abs(r)<1e-6)return{x:e.x+i,y:e.y};let o=Math.abs(n)>1e-6?i/Math.abs(n):1/0,s=Math.abs(r)>1e-6?a/Math.abs(r):1/0,c=Math.min(o,s);return{x:e.x+n*c,y:e.y+r*c}}function Hr(e,t){let n=e.width/2||1,r=e.height/2||1,i=t.x-e.x,a=t.y-e.y;return Math.abs(i)/n>Math.abs(a)/r?i>0?1+_e((a+r)/(2*r),0,1):3+_e((r-a)/(2*r),0,1):a<0?_e((i+n)/(2*n),0,1):2+_e((n-i)/(2*n),0,1)}function Ur(e,t,n,r){let i=t===`from`?n:r,a=t===`from`?r:n,o=Lr.value;if(o&&o.id===e.id&&o.end===t)return Vr(i,{x:o.wx,y:o.wy});let s=t===`from`?e.fromT:e.toT;return s===void 0?Vr(i,{x:a.x,y:a.y}):Br(i,s)}function Wr(e,t){let n=Math.hypot(t.x,t.y);if(n<1e-6)return null;let r=t.x/n,i=t.y/n,a=e.x-r*9,o=e.y-i*9,s=-i*(7/2),c=7/2*r;return`M ${e.x.toFixed(2)} ${e.y.toFixed(2)} L ${(a+s).toFixed(2)} ${(o+c).toFixed(2)} L ${(a-s).toFixed(2)} ${(o-c).toFixed(2)} Z`}let Gr=j(()=>{let e=V.value.relations;if(!e||e.length===0)return[];let t=[];for(let n of e){let e=Un.value.find(e=>e.id===n.fromId),r=Un.value.find(e=>e.id===n.toId);if(!e||!r)continue;let i=Ur(n,`from`,e,r),a=Ur(n,`to`,e,r),o=Lr.value,s=n.c1,c=n.c2;if(o&&o.id===n.id&&o.end===`c1`&&(s={x:o.wx,y:o.wy}),o&&o.id===n.id&&o.end===`c2`&&(c={x:o.wx,y:o.wy}),!s||!c){let e=a.x-i.x,t=a.y-i.y,n=Math.hypot(e,t)||1,r=-t/n,o=e/n;o>0&&(r=-r,o=-o);let l=_e(n*.18,24,160),u={x:(i.x+a.x)/2+r*l,y:(i.y+a.y)/2+o*l};s||=u,c||=u}let l=`M ${i.x.toFixed(2)} ${i.y.toFixed(2)} C ${s.x.toFixed(2)} ${s.y.toFixed(2)} ${c.x.toFixed(2)} ${c.y.toFixed(2)} ${a.x.toFixed(2)} ${a.y.toFixed(2)}`,u=Tn(.5,i,{x1:s.x,y1:s.y,x2:c.x,y2:c.y},a),d=n.arrow??`end`,f=d===`none`?null:Wr(a,{x:a.x-c.x,y:a.y-c.y}),p=d===`both`?Wr(i,{x:i.x-s.x,y:i.y-s.y}):null;t.push({rel:n,from:i,to:a,c1:s,c2:c,d:l,labelPos:u,arrowEnd:f,arrowStart:p})}return t}),Kr=j(()=>Gr.value.find(e=>e.rel.id===Rr.value)??null);function qr(e,t){let n=it(V.value,e,t);return n?(K(),q(),d(`change`,V.value),Fr.value=n.id,C.value=new Set,X(),n.id):null}function Jr(e){at(V.value,e)&&(K(),Fr.value===e&&(Fr.value=null),Rr.value===e&&(Rr.value=null),q(),d(`change`,V.value))}function Yr(e,t){ot(V.value,e,t)&&(K(),q(),d(`change`,V.value))}function Xr(e){l.previewMode||(Ir.value={fromId:e},e&&(C.value=new Set([e]),X()))}function Zr(){if(Ir.value){Ir.value=null;return}Xr(E.value)}function Qr(e,t){e.stopPropagation(),Fr.value=t,C.value=new Set,X()}function $r(e,t,n){if(l.previewMode)return;e.stopPropagation(),e.preventDefault();let r=h.value.getBoundingClientRect();Lr.value={id:t,end:n,wx:(e.clientX-r.left-Y.offsetX.value)/Y.scale.value,wy:(e.clientY-r.top-Y.offsetY.value)/Y.scale.value,hoverNodeId:null},window.addEventListener(`pointermove`,ei),window.addEventListener(`pointerup`,ti),window.addEventListener(`pointercancel`,ti)}function ei(e){let t=Lr.value;if(!t)return;let n=h.value.getBoundingClientRect();if(t.wx=(e.clientX-n.left-Y.offsetX.value)/Y.scale.value,t.wy=(e.clientY-n.top-Y.offsetY.value)/Y.scale.value,t.end===`from`||t.end===`to`){let e=rt(V.value,t.id),n=e?t.end===`from`?e.fromId:e.toId:null;t.hoverNodeId=Or(t.wx,t.wy,n)?.id??null}}function ti(){window.removeEventListener(`pointermove`,ei),window.removeEventListener(`pointerup`,ti),window.removeEventListener(`pointercancel`,ti);let e=Lr.value;if(Lr.value=null,!e)return;let t=rt(V.value,e.id);if(t){if(e.end===`c1`||e.end===`c2`)t[e.end]={x:Math.round(e.wx*2)/2,y:Math.round(e.wy*2)/2};else{let n=e.end===`from`?t.fromId:t.toId;if(!(e.hoverNodeId&&e.hoverNodeId!==n&&st(V.value,e.id,e.end,e.hoverNodeId))){let r=Un.value.find(e=>e.id===n);if(r){let n=Hr(r,Vr(r,{x:e.wx,y:e.wy}));e.end===`from`?t.fromT=n:t.toT=n}}}K(),q(),d(`change`,V.value),cn=!0}}function ni(e){if(l.previewMode)return;let t=rt(V.value,e);t&&(Rr.value=e,zr.value=t.label??``,Fr.value=e,s(()=>{let e=document.querySelector(`.zm-relation-label-input`);e?.focus(),e?.select()}))}function ri(){let e=Rr.value;if(!e)return;Rr.value=null;let t=rt(V.value,e);if(!t)return;let n=zr.value.trim();(t.label??``)!==n&&Yr(e,{label:n||void 0})}function ii(e){let t=[],n=e=>{t.push(e.id);for(let t of e.children)n(t)};return n(e),t}let ai=!1;function oi(e){let t=e.target;if(!t||t.closest(`.zm-node, .zm-toolbar, button, input, textarea, .zm-relations`))return;if(e.button===2){ai=!0,Y.startPan(e);return}if(ai=!1,e.button!==0)return;let n=h.value.getBoundingClientRect(),r=(e.clientX-n.left-Y.offsetX.value)/Y.scale.value,i=(e.clientY-n.top-Y.offsetY.value)/Y.scale.value;Y.startMarquee(r,i,{shift:e.shiftKey})}function si(e){if(cn){cn=!1;return}let t=e.target;if(!t||t.closest(`.zm-node`)||t.closest(`.zm-relations`)||t.closest(`.zm-toolbar`))return;let n=Y.marquee;if(!(n.width>=4||n.height>=4)){if(Ir.value){Ir.value=null;return}if(Fr.value){Fr.value=null;return}C.value.size>0&&(C.value=new Set,X())}}function ci(){let e=Y.marquee;if(e.width<4&&e.height<4)return;let t=e.x,n=e.y,r=e.x+e.width,i=e.y+e.height,a=[];for(let e of Un.value){let o=e.width/2,s=e.height/2,c=e.x-o,l=e.x+o,u=e.y-s,d=e.y+s;c<=r&&l>=t&&u<=i&&d>=n&&a.push(e.id)}C.value=e.shiftKey?new Set([...C.value,...a]):new Set(a),X()}function li(e){return O.value.has(e)}function ui(e){let t=G(V.value,e.id);return!!t&&t.children.length>0}function di(e){let t=G(V.value,e);return t?et(t):0}function fi(e){if(!G(V.value,e))return 0;let t=[V.value];for(;t.length;){let n=t.pop(),r=n.children.findIndex(t=>t.id===e);if(r>=0)return r;for(let e of n.children)t.push(e)}return 0}function pi(e,t,n,r){let i=r?._dir??e._dir;if(t===`out`&&e.isRoot&&J.lineOrigin===`center`)return{x:e.x,y:e.y};if(t===`out`&&e.isRoot&&J.lineOrigin===`xmind`&&r){if(i===`down`)return{x:e.x,y:e.y};let t=n===void 0?e.side:n,a=e.children.filter(e=>e.side===t).sort((e,t)=>e.y-t.y),o=a.length,s=Math.max(0,a.findIndex(e=>e.id===r.id)),c=0;return o===2?c=.7:o>=3&&(c=s===0||s===o-1?.17:.45),{x:e.x+t*(e.width/2)*c,y:e.y}}if(t===`out`&&e.isRoot&&J.lineOrigin===`proportional`&&r){let t=r.x-e.x,n=r.y-e.y,i=e.width/2,a=e.height/2,o=t===0?1/0:i/Math.abs(t),s=n===0?1/0:a/Math.abs(n),c=Math.min(o,s);return Number.isFinite(c)?{x:e.x+t*c,y:e.y+n*c}:{x:e.x,y:e.y}}if(i===`down`)return t===`out`?{x:e.x,y:e.y+e.height/2}:{x:e.x,y:e.y-e.height/2};let a;a=t===`in`?-e.side:n===void 0?e.side:n;let o=t===`in`?e._richInsetX??0:0;return{x:e.x+a*(e.width/2-o),y:e.y}}function mi(){let e=Vn.value;Y.resetView(e.width,e.height,e.root.y)}function hi(){mn.value=!0,K(),q(),s(()=>mi())}function gi(e){J.layoutMode!==e&&(J.layoutMode=e,q(),s(()=>mi()))}function _i(){return JSON.stringify(V.value,null,2)}function vi(e){let t=G(V.value,e);return t?!!(t.note&&t.note.text||t.link&&t.link.url||t.image&&t.image.src||t.richContent&&t.richContent.raw||t.markers&&t.markers.length>0||t.tags&&t.tags.length>0):!1}function yi(e){try{let t=JSON.parse(e);return!t.id||!Array.isArray(t.children)?!1:(gn.reset(),V.value=He(t),C.value=new Set,O.value=new Set,q(),s(()=>mi()),d(`change`,V.value),!0)}catch{return!1}}let bi=T(``),xi=T([]),Si=T(-1);function Ci(e){bi.value=e;let t=e.trim();if(!t){xi.value=[],Si.value=-1;return}let n=t.toLowerCase(),r=[],i=e=>{var t;(e.text.toLowerCase().includes(n)||(t=e.note)!=null&&t.text&&e.note.text.toLowerCase().includes(n))&&r.push(e.id);for(let t of e.children)i(t)};i(V.value),xi.value=r,Si.value=r.length>0?0:-1,r.length>0&&(Di(r),s(()=>Oi(0)))}function wi(e){return xi.value.includes(e)}function Ti(e){return Si.value>=0&&xi.value[Si.value]===e}function Ei(e){return bi.value.trim().length>0&&xi.value.length>0&&!xi.value.includes(e)}function Di(e){if(e.length===0)return;let t=new Set(e),n=new Set,r=e=>{let i=t.has(e.id);for(let t of e.children)r(t)&&(i=!0);return i&&e.children.length>0&&O.value.has(e.id)&&n.add(e.id),i};if(r(V.value),n.size>0){for(let e of n)O.value.delete(e);q()}}function Oi(e){let t=xi.value[e];if(!t)return;let n=Un.value.find(e=>e.id===t);n&&(C.value=new Set([t]),X(),Y.centerOn(n.x,n.y,n.width,n.height))}function ki(e,t){let n=G(V.value,e);n&&(n.markers||=[],!n.markers.includes(t)&&(n.markers.push(t),K(),q(),d(`change`,V.value)))}function Ai(e,t){let n=G(V.value,e);if(!n||!n.markers)return;let r=n.markers.indexOf(t);r<0||(n.markers.splice(r,1),n.markers.length===0&&delete n.markers,K(),q(),d(`change`,V.value))}function ji(e,t){let n=G(V.value,e);if(!n)return!1;n.markers||=[];let r=n.markers.indexOf(t);return r>=0?(n.markers.splice(r,1),n.markers.length===0&&delete n.markers,K(),q(),d(`change`,V.value),!1):(n.markers.push(t),K(),q(),d(`change`,V.value),!0)}function Mi(e){let t=G(V.value,e);return t!=null&&t.markers?[...t.markers]:[]}function Ni(e){let t=U.value?.nodeId;t&&ji(t,e)}function Pi(){let e=U.value?.nodeId;if(!e)return;let t=G(V.value,e);!t||!t.markers||(delete t.markers,K(),q(),d(`change`,V.value),Ae())}function Fi(e,t){let n=G(V.value,e);n&&(t.length===0?n.tags&&delete n.tags:n.tags=[...t],K(),q(),d(`change`,V.value))}function Ii(e){let t=G(V.value,e);return t!=null&&t.tags?[...t.tags]:[]}function Li(){let e=U.value?.nodeId;if(!e)return;let t=(G(V.value,e)?.tags)?.join(`, `)??``,n=window.prompt(`输入标签(多个用逗号分隔)`,t);n!==null&&(Fi(e,n.split(/[,,]/).map(e=>e.trim()).filter(e=>e.length>0)),Ae())}function Ri(){let e=U.value?.nodeId;e&&(Fi(e,[]),Ae())}function zi(){let e=Vn.value,t=`http://www.w3.org/2000/svg`,n=document.createElementNS(t,`svg`);n.setAttribute(`xmlns`,t),n.setAttribute(`viewBox`,`${e.vbX} ${e.vbY} ${e.vbW} ${e.vbH}`),n.setAttribute(`width`,String(e.vbW)),n.setAttribute(`height`,String(e.vbH));let r=document.createElementNS(t,`rect`);r.setAttribute(`x`,String(e.vbX)),r.setAttribute(`y`,String(e.vbY)),r.setAttribute(`width`,String(e.vbW)),r.setAttribute(`height`,String(e.vbH)),r.setAttribute(`fill`,yn.value),n.appendChild(r);for(let e of Wn.value){let r=document.createElementNS(t,`path`);r.setAttribute(`d`,Dn(pi(e.from,`out`,e.to.side,e.to),pi(e.to,`in`),xn(e.from.depth),Sn(e.to.depth),32,bn(e.from.isRoot),e.to._dir)),r.setAttribute(`fill`,Mn(e.from,e.to)),r.setAttribute(`stroke`,`none`),n.appendChild(r)}let i=`-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif`;function a(e,t){let n=0;for(let r of e)/[\u4e00-\u9fff\u3000-\u30ff\uff00-\uffef]/.test(r)?n+=t:n+=t*.55;return n}for(let e of Gr.value){let r=document.createElementNS(t,`path`);r.setAttribute(`d`,e.d),r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,e.rel.color??`#94a3b8`),r.setAttribute(`stroke-width`,`1.5`),r.setAttribute(`stroke-dasharray`,`6 4`),r.setAttribute(`stroke-linecap`,`round`),n.appendChild(r);let a=e.rel.color??`#94a3b8`;for(let r of[e.arrowEnd,e.arrowStart]){if(!r)continue;let e=document.createElementNS(t,`path`);e.setAttribute(`d`,r),e.setAttribute(`fill`,a),e.setAttribute(`stroke`,`none`),n.appendChild(e)}if(e.rel.label){let r=document.createElementNS(t,`text`);r.setAttribute(`x`,String(e.labelPos.x)),r.setAttribute(`y`,String(e.labelPos.y-6)),r.setAttribute(`text-anchor`,`middle`),r.setAttribute(`font-size`,`12`),r.setAttribute(`font-family`,i),r.setAttribute(`fill`,`#64748b`),r.setAttribute(`stroke`,yn.value),r.setAttribute(`stroke-width`,`3`),r.setAttribute(`paint-order`,`stroke`),r.textContent=e.rel.label,n.appendChild(r)}}for(let e of Un.value){let r=e.x-e.width/2,o=e.y-e.height/2,s=document.createElementNS(t,`rect`);s.setAttribute(`x`,String(r)),s.setAttribute(`y`,String(o)),s.setAttribute(`width`,String(e.width)),s.setAttribute(`height`,String(e.height)),s.setAttribute(`rx`,`8`),s.setAttribute(`fill`,Nn(e));let c=Fn(e);c!==`transparent`&&(s.setAttribute(`stroke`,c),s.setAttribute(`stroke-width`,`1`)),n.appendChild(s);let l=!!(e.tags&&e.tags.length>0),u=!!(e.markers&&e.markers.length>0),d=!!e.image,f=!!(e.richContent&&(e.richContent.kind===`code`||e.richContent.kind===`table`)),p=0,m=0;if(f){let r=e.richContent,s=e.fontSize*.78*.92;if(r.kind===`code`){let c=os(r.raw),l=ss(r.raw),u=c.split(`
|
|
135
|
+
`)),q())}function pr(e){let t=lr(cr(e));if(t.length===0)return;let n=[];for(let e of t){let t=$e(V.value,e);t&&n.push(t)}if(n.length===0)return;K();let r=[];for(let e of t){let t=G(V.value,e);t&&r.push(...ii(t))}for(let e of t)We(V.value,e);for(let e of r)ct(V.value,e);w.value=new Set,X(),re.value={nodes:n,originalIds:new Set(t)},ur(n.map(e=>e.text).join(`
|
|
136
|
+
`)),q(),m(`change`,V.value)}function mr(e){let t=re.value;if(!t||t.nodes.length===0)return;let n=e??V.value.id,r=G(V.value,n);if(r){for(let e of t.originalIds){let t=G(V.value,e);if(t&&G(t,n))return}K();for(let e of t.nodes){let t=He(e);Qe(t),r.children.push(t)}re.value=null,q(),m(`change`,V.value)}}function hr(){let e=gn.undo();e&&(V.value=e.data,w.value=new Set(e.selectedIds??[]),X(),q(),m(`change`,V.value))}function gr(){let e=gn.redo();e&&(V.value=e.data,w.value=new Set(e.selectedIds??[]),X(),q(),m(`change`,V.value))}function X(){let e=[];for(let t of w.value){let n=G(V.value,t);n&&e.push(n)}if(f.builtInDrawers&&!f.previewMode&&e.length>0){let t=e[0];!W.value&&vi(t.id)&&(ft(),W.value=!0)}else f.builtInDrawers&&e.length===0&&(W.value=!1);m(`select`,e.length>0?e:null)}function _r(e,t){let n=D.value??V.value.id,r=G(V.value,n);if(!r)return;let i=null;if(t===1){let e=Ue(V.value,r.id);if(e){let t=e.children.findIndex(e=>e.id===r.id);t>=0&&t<e.children.length-1&&(i=e.children[t+1].id)}}else if(t===-1){let e=Ue(V.value,r.id);if(e){let t=e.children.findIndex(e=>e.id===r.id);t>0&&(i=e.children[t-1].id)}}else if(e===1){let e=Ue(V.value,r.id);e&&(i=e.id)}else e===-1&&r.children.length>0&&(i=r.children[0].id);i&&(w.value=new Set([i]),X())}function vr(e){var t;if(e===V.value.id)return;let n=G(V.value,e),r=n?ii(n):[e];if(We(V.value,e)){for(let e of r)ct(V.value,e);if((t=Ir.value)!=null&&t.fromId&&r.includes(Ir.value.fromId)&&(Ir.value=null),K(),w.value.has(e)){let t=new Set(w.value);t.delete(e),w.value=t,X()}q(),m(`change`,V.value)}}function yr(e){O.value.has(e)?O.value.delete(e):O.value.add(e),q()}function br(e){let t=[{n:V.value,depth:1}];for(;t.length;){let{n,depth:r}=t.pop();e(n,r);for(let e=n.children.length-1;e>=0;e--)t.push({n:n.children[e],depth:r+1})}}function xr(){O.value=new Set,br(e=>{e.children.length>0&&O.value.add(e.id)}),q()}function Sr(e){O.value=new Set,br((t,n)=>{n>e&&t.children.length>0&&O.value.add(t.id)}),q()}function Cr(){O.value=new Set,q()}function wr(e,t){Ge(V.value,e,t)&&(K(),q(),m(`change`,V.value))}function Tr(e,t,n){return Ke(V.value,e,t,n)?(K(),q(),m(`change`,V.value),!0):!1}function Er(e){let t=D.value;if(!t)return;let n=V.value;if(t===n.id)return;let r=Ue(n,t);if(!r)return;let i=r.children.findIndex(e=>e.id===t);if(i<0)return;let a=e,o=Un.value.find(e=>e.id===t);if(o&&Nr(o)&&(a=-e),a<0){if(i===0)return;let e=r.children[i-1].id;Ke(n,t,e,`before`)}else{if(i>=r.children.length-1)return;let e=r.children[i+1].id;Ke(n,t,e,`after`)}K(),q(),m(`change`,n)}function Dr(e,t){if(ln){ln=!1;return}if(e.stopPropagation(),Ir.value){let e=Ir.value;e.fromId?e.fromId!==t.id&&(qr(e.fromId,t.id),Ir.value=null):(e.fromId=t.id,w.value=new Set([t.id]),X());return}if(Fr.value=null,e.shiftKey){let e=new Set(w.value);e.has(t.id)?e.delete(t.id):e.add(t.id),w.value=e}else w.value=new Set([t.id]);X()}function Or(e,t,n){let r=null;for(let i of Un.value){if(i.id===n)continue;let a=i.width/2,o=i.height/2;e>=i.x-a&&e<=i.x+a&&t>=i.y-o&&t<=i.y+o&&(r=i)}return r}let kr=null;function Ar(e,t){if(f.previewMode||e.button!==0)return;ln=!1;let n=e.target;if(n!=null&&n.closest(`.zm-img-resize-handle`))return;if(Fr.value){let t=Gr.value.find(e=>e.rel.id===Fr.value);if(t){let n=g.value.getBoundingClientRect(),r=Y.scale.value,i=e=>n.left+e.x*r+Y.offsetX.value,a=e=>n.top+e.y*r+Y.offsetY.value,o=Math.hypot(e.clientX-i(t.from),e.clientY-a(t.from)),s=Math.hypot(e.clientX-i(t.to),e.clientY-a(t.to));if(Math.min(o,s)<=20){e.stopPropagation(),e.preventDefault(),ln=!0,$r(e,t.rel.id,o<=s?`from`:`to`);return}}}if(t.isRoot)return;e.stopPropagation();let r=g.value.getBoundingClientRect(),i=t.x*Y.scale.value+Y.offsetX.value,a=t.y*Y.scale.value+Y.offsetY.value,o=e.clientX-r.left-i,s=e.clientY-r.top-a;kr={srcId:t.id,srcText:t.text,pointerOffsetX:o,pointerOffsetY:s,startX:e.clientX,startY:e.clientY},window.addEventListener(`pointermove`,jr),window.addEventListener(`pointerup`,Pr),window.addEventListener(`pointercancel`,Pr)}function jr(e){if(kr){let t=e.clientX-kr.startX,n=e.clientY-kr.startY;if(Math.abs(t)<=Nd&&Math.abs(n)<=Nd)return;F.value={srcId:kr.srcId,srcText:kr.srcText,pointerOffsetX:kr.pointerOffsetX,pointerOffsetY:kr.pointerOffsetY,currentTargetId:null,dropPosition:null},document.body.classList.add(`is-dragging`),kr=null}let t=F.value;if(!t)return;let n=g.value.getBoundingClientRect();I.value=e.clientX-n.left-t.pointerOffsetX,te.value=e.clientY-n.top-t.pointerOffsetY;let r=(e.clientX-n.left-Y.offsetX.value)/Y.scale.value,i=(e.clientY-n.top-Y.offsetY.value)/Y.scale.value,a=Or(r,i,t.srcId);t.currentTargetId=a?.id??null,a?t.dropPosition=Mr(r,i,a):t.dropPosition=null}function Mr(e,t,n){if(n.isRoot)return`child`;let r=n.width/2,i=n.height/2;if(n._dir===`down`){let t=e-n.x;return t<-r*.3?`before`:t>r*.3?`after`:`child`}let a=t-n.y;return a<-i*.3?`before`:a>i*.3?`after`:`child`}function Nr(e){var t;return!!((t=e.parent)!=null&&t.isRoot)&&e._dir===`left`}function Pr(e){if(window.removeEventListener(`pointermove`,jr),window.removeEventListener(`pointerup`,Pr),window.removeEventListener(`pointercancel`,Pr),kr){kr=null;return}let t=F.value;if(t){if(t.currentTargetId&&t.dropPosition){let e=t.dropPosition;if(e!==`child`){let n=Un.value.find(e=>e.id===t.currentTargetId);n&&Nr(n)&&(e=e===`before`?`after`:`before`)}Tr(t.srcId,t.currentTargetId,e),w.value=new Set([t.srcId]),X()}F.value=null,I.value=0,te.value=0,document.body.classList.remove(`is-dragging`)}}let Fr=E(null),Ir=E(null),Lr=E(null),Rr=E(null),zr=E(``);function Br(e,t){let n=e.width/2,r=e.height/2,i=(t%4+4)%4;return i<1?{x:e.x-n+2*n*i,y:e.y-r}:i<2?{x:e.x+n,y:e.y-r+2*r*(i-1)}:i<3?{x:e.x+n-2*n*(i-2),y:e.y+r}:{x:e.x-n,y:e.y+r-2*r*(i-3)}}function Vr(e,t){let n=t.x-e.x,r=t.y-e.y,i=e.width/2,a=e.height/2;if(Math.abs(n)<1e-6&&Math.abs(r)<1e-6)return{x:e.x+i,y:e.y};let o=Math.abs(n)>1e-6?i/Math.abs(n):1/0,s=Math.abs(r)>1e-6?a/Math.abs(r):1/0,c=Math.min(o,s);return{x:e.x+n*c,y:e.y+r*c}}function Hr(e,t){let n=e.width/2||1,r=e.height/2||1,i=t.x-e.x,a=t.y-e.y;return Math.abs(i)/n>Math.abs(a)/r?i>0?1+_e((a+r)/(2*r),0,1):3+_e((r-a)/(2*r),0,1):a<0?_e((i+n)/(2*n),0,1):2+_e((n-i)/(2*n),0,1)}function Ur(e,t,n,r){let i=t===`from`?n:r,a=t===`from`?r:n,o=Lr.value;if(o&&o.id===e.id&&o.end===t)return Vr(i,{x:o.wx,y:o.wy});let s=t===`from`?e.fromT:e.toT;return s===void 0?Vr(i,{x:a.x,y:a.y}):Br(i,s)}function Wr(e,t){let n=Math.hypot(t.x,t.y);if(n<1e-6)return null;let r=t.x/n,i=t.y/n,a=e.x-r*9,o=e.y-i*9,s=-i*(7/2),c=7/2*r;return`M ${e.x.toFixed(2)} ${e.y.toFixed(2)} L ${(a+s).toFixed(2)} ${(o+c).toFixed(2)} L ${(a-s).toFixed(2)} ${(o-c).toFixed(2)} Z`}let Gr=j(()=>{let e=V.value.relations;if(!e||e.length===0)return[];let t=[];for(let n of e){let e=Un.value.find(e=>e.id===n.fromId),r=Un.value.find(e=>e.id===n.toId);if(!e||!r)continue;let i=Ur(n,`from`,e,r),a=Ur(n,`to`,e,r),o=Lr.value,s=n.c1,c=n.c2;if(o&&o.id===n.id&&o.end===`c1`&&(s={x:o.wx,y:o.wy}),o&&o.id===n.id&&o.end===`c2`&&(c={x:o.wx,y:o.wy}),!s||!c){let e=a.x-i.x,t=a.y-i.y,n=Math.hypot(e,t)||1,r=-t/n,o=e/n;o>0&&(r=-r,o=-o);let l=_e(n*.18,24,160),u={x:(i.x+a.x)/2+r*l,y:(i.y+a.y)/2+o*l};s||=u,c||=u}let l=`M ${i.x.toFixed(2)} ${i.y.toFixed(2)} C ${s.x.toFixed(2)} ${s.y.toFixed(2)} ${c.x.toFixed(2)} ${c.y.toFixed(2)} ${a.x.toFixed(2)} ${a.y.toFixed(2)}`,u=Tn(.5,i,{x1:s.x,y1:s.y,x2:c.x,y2:c.y},a),d=n.arrow??`end`,f=d===`none`?null:Wr(a,{x:a.x-c.x,y:a.y-c.y}),p=d===`both`?Wr(i,{x:i.x-s.x,y:i.y-s.y}):null;t.push({rel:n,from:i,to:a,c1:s,c2:c,d:l,labelPos:u,arrowEnd:f,arrowStart:p})}return t}),Kr=j(()=>Gr.value.find(e=>e.rel.id===Rr.value)??null);function qr(e,t){let n=it(V.value,e,t);return n?(K(),q(),m(`change`,V.value),Fr.value=n.id,w.value=new Set,X(),n.id):null}function Jr(e){at(V.value,e)&&(K(),Fr.value===e&&(Fr.value=null),Rr.value===e&&(Rr.value=null),q(),m(`change`,V.value))}function Yr(e,t){ot(V.value,e,t)&&(K(),q(),m(`change`,V.value))}function Xr(e){f.previewMode||(Ir.value={fromId:e},e&&(w.value=new Set([e]),X()))}function Zr(){if(Ir.value){Ir.value=null;return}Xr(D.value)}function Qr(e,t){e.stopPropagation(),Fr.value=t,w.value=new Set,X()}function $r(e,t,n){if(f.previewMode)return;e.stopPropagation(),e.preventDefault();let r=g.value.getBoundingClientRect();Lr.value={id:t,end:n,wx:(e.clientX-r.left-Y.offsetX.value)/Y.scale.value,wy:(e.clientY-r.top-Y.offsetY.value)/Y.scale.value,hoverNodeId:null},window.addEventListener(`pointermove`,ei),window.addEventListener(`pointerup`,ti),window.addEventListener(`pointercancel`,ti)}function ei(e){let t=Lr.value;if(!t)return;let n=g.value.getBoundingClientRect();if(t.wx=(e.clientX-n.left-Y.offsetX.value)/Y.scale.value,t.wy=(e.clientY-n.top-Y.offsetY.value)/Y.scale.value,t.end===`from`||t.end===`to`){let e=rt(V.value,t.id),n=e?t.end===`from`?e.fromId:e.toId:null;t.hoverNodeId=Or(t.wx,t.wy,n)?.id??null}}function ti(){window.removeEventListener(`pointermove`,ei),window.removeEventListener(`pointerup`,ti),window.removeEventListener(`pointercancel`,ti);let e=Lr.value;if(Lr.value=null,!e)return;let t=rt(V.value,e.id);if(t){if(e.end===`c1`||e.end===`c2`)t[e.end]={x:Math.round(e.wx*2)/2,y:Math.round(e.wy*2)/2};else{let n=e.end===`from`?t.fromId:t.toId;if(!(e.hoverNodeId&&e.hoverNodeId!==n&&st(V.value,e.id,e.end,e.hoverNodeId))){let r=Un.value.find(e=>e.id===n);if(r){let n=Hr(r,Vr(r,{x:e.wx,y:e.wy}));e.end===`from`?t.fromT=n:t.toT=n}}}K(),q(),m(`change`,V.value),cn=!0}}function ni(e){if(f.previewMode)return;let t=rt(V.value,e);t&&(Rr.value=e,zr.value=t.label??``,Fr.value=e,d(()=>{let e=document.querySelector(`.zm-relation-label-input`);e?.focus(),e?.select()}))}function ri(){let e=Rr.value;if(!e)return;Rr.value=null;let t=rt(V.value,e);if(!t)return;let n=zr.value.trim();(t.label??``)!==n&&Yr(e,{label:n||void 0})}function ii(e){let t=[],n=e=>{t.push(e.id);for(let t of e.children)n(t)};return n(e),t}let ai=!1;function oi(e){let t=e.target;if(!t||t.closest(`.zm-node, .zm-toolbar, button, input, textarea, .zm-relations`))return;if(e.button===2){ai=!0,Y.startPan(e);return}if(ai=!1,e.button!==0)return;let n=g.value.getBoundingClientRect(),r=(e.clientX-n.left-Y.offsetX.value)/Y.scale.value,i=(e.clientY-n.top-Y.offsetY.value)/Y.scale.value;Y.startMarquee(r,i,{shift:e.shiftKey})}function si(e){if(cn){cn=!1;return}let t=e.target;if(!t||t.closest(`.zm-node`)||t.closest(`.zm-relations`)||t.closest(`.zm-toolbar`))return;let n=Y.marquee;if(!(n.width>=4||n.height>=4)){if(Ir.value){Ir.value=null;return}if(Fr.value){Fr.value=null;return}w.value.size>0&&(w.value=new Set,X())}}function ci(){let e=Y.marquee;if(e.width<4&&e.height<4)return;let t=e.x,n=e.y,r=e.x+e.width,i=e.y+e.height,a=[];for(let e of Un.value){let o=e.width/2,s=e.height/2,c=e.x-o,l=e.x+o,u=e.y-s,d=e.y+s;c<=r&&l>=t&&u<=i&&d>=n&&a.push(e.id)}w.value=e.shiftKey?new Set([...w.value,...a]):new Set(a),X()}function li(e){return O.value.has(e)}function ui(e){let t=G(V.value,e.id);return!!t&&t.children.length>0}function di(e){let t=G(V.value,e);return t?et(t):0}function fi(e){if(!G(V.value,e))return 0;let t=[V.value];for(;t.length;){let n=t.pop(),r=n.children.findIndex(t=>t.id===e);if(r>=0)return r;for(let e of n.children)t.push(e)}return 0}function pi(e,t,n,r){let i=r?._dir??e._dir;if(t===`out`&&e.isRoot&&J.lineOrigin===`center`)return{x:e.x,y:e.y};if(t===`out`&&e.isRoot&&J.lineOrigin===`xmind`&&r){if(i===`down`)return{x:e.x,y:e.y};let t=n===void 0?e.side:n,a=e.children.filter(e=>e.side===t).sort((e,t)=>e.y-t.y),o=a.length,s=Math.max(0,a.findIndex(e=>e.id===r.id)),c=0;return o===2?c=.7:o>=3&&(c=s===0||s===o-1?.17:.45),{x:e.x+t*(e.width/2)*c,y:e.y}}if(t===`out`&&e.isRoot&&J.lineOrigin===`proportional`&&r){let t=r.x-e.x,n=r.y-e.y,i=e.width/2,a=e.height/2,o=t===0?1/0:i/Math.abs(t),s=n===0?1/0:a/Math.abs(n),c=Math.min(o,s);return Number.isFinite(c)?{x:e.x+t*c,y:e.y+n*c}:{x:e.x,y:e.y}}if(i===`down`)return t===`out`?{x:e.x,y:e.y+e.height/2}:{x:e.x,y:e.y-e.height/2};let a;a=t===`in`?-e.side:n===void 0?e.side:n;let o=t===`in`?e._richInsetX??0:0;return{x:e.x+a*(e.width/2-o),y:e.y}}function mi(){let e=Vn.value;Y.resetView(e.width,e.height,e.root.y)}function hi(){mn.value=!0,K(),q(),d(()=>mi())}function gi(e){J.layoutMode!==e&&(J.layoutMode=e,q(),d(()=>mi()))}function _i(){return JSON.stringify(V.value,null,2)}function vi(e){let t=G(V.value,e);return t?!!(t.note&&t.note.text||t.link&&t.link.url||t.image&&t.image.src||t.richContent&&t.richContent.raw||t.markers&&t.markers.length>0||t.tags&&t.tags.length>0):!1}function yi(e){try{let t=JSON.parse(e);return!t.id||!Array.isArray(t.children)?!1:(gn.reset(),V.value=He(t),w.value=new Set,O.value=new Set,q(),d(()=>mi()),m(`change`,V.value),!0)}catch{return!1}}let bi=E(``),xi=E([]),Si=E(-1);function Ci(e){bi.value=e;let t=e.trim();if(!t){xi.value=[],Si.value=-1;return}let n=t.toLowerCase(),r=[],i=e=>{var t;(e.text.toLowerCase().includes(n)||(t=e.note)!=null&&t.text&&e.note.text.toLowerCase().includes(n))&&r.push(e.id);for(let t of e.children)i(t)};i(V.value),xi.value=r,Si.value=r.length>0?0:-1,r.length>0&&(Di(r),d(()=>Oi(0)))}function wi(e){return xi.value.includes(e)}function Ti(e){return Si.value>=0&&xi.value[Si.value]===e}function Ei(e){return bi.value.trim().length>0&&xi.value.length>0&&!xi.value.includes(e)}function Di(e){if(e.length===0)return;let t=new Set(e),n=new Set,r=e=>{let i=t.has(e.id);for(let t of e.children)r(t)&&(i=!0);return i&&e.children.length>0&&O.value.has(e.id)&&n.add(e.id),i};if(r(V.value),n.size>0){for(let e of n)O.value.delete(e);q()}}function Oi(e){let t=xi.value[e];if(!t)return;let n=Un.value.find(e=>e.id===t);n&&(w.value=new Set([t]),X(),Y.centerOn(n.x,n.y,n.width,n.height))}function ki(e,t){let n=G(V.value,e);n&&(n.markers||=[],!n.markers.includes(t)&&(n.markers.push(t),K(),q(),m(`change`,V.value)))}function Ai(e,t){let n=G(V.value,e);if(!n||!n.markers)return;let r=n.markers.indexOf(t);r<0||(n.markers.splice(r,1),n.markers.length===0&&delete n.markers,K(),q(),m(`change`,V.value))}function ji(e,t){let n=G(V.value,e);if(!n)return!1;n.markers||=[];let r=n.markers.indexOf(t);return r>=0?(n.markers.splice(r,1),n.markers.length===0&&delete n.markers,K(),q(),m(`change`,V.value),!1):(n.markers.push(t),K(),q(),m(`change`,V.value),!0)}function Mi(e){let t=G(V.value,e);return t!=null&&t.markers?[...t.markers]:[]}function Ni(e){let t=U.value?.nodeId;t&&ji(t,e)}function Pi(){let e=U.value?.nodeId;if(!e)return;let t=G(V.value,e);!t||!t.markers||(delete t.markers,K(),q(),m(`change`,V.value),Ae())}function Fi(e,t){let n=G(V.value,e);n&&(t.length===0?n.tags&&delete n.tags:n.tags=[...t],K(),q(),m(`change`,V.value))}function Ii(e){let t=G(V.value,e);return t!=null&&t.tags?[...t.tags]:[]}function Li(){let e=U.value?.nodeId;if(!e)return;let t=(G(V.value,e)?.tags)?.join(`, `)??``,n=window.prompt(`输入标签(多个用逗号分隔)`,t);n!==null&&(Fi(e,n.split(/[,,]/).map(e=>e.trim()).filter(e=>e.length>0)),Ae())}function Ri(){let e=U.value?.nodeId;e&&(Fi(e,[]),Ae())}function zi(){let e=Vn.value,t=`http://www.w3.org/2000/svg`,n=document.createElementNS(t,`svg`);n.setAttribute(`xmlns`,t),n.setAttribute(`viewBox`,`${e.vbX} ${e.vbY} ${e.vbW} ${e.vbH}`),n.setAttribute(`width`,String(e.vbW)),n.setAttribute(`height`,String(e.vbH));let r=document.createElementNS(t,`rect`);r.setAttribute(`x`,String(e.vbX)),r.setAttribute(`y`,String(e.vbY)),r.setAttribute(`width`,String(e.vbW)),r.setAttribute(`height`,String(e.vbH)),r.setAttribute(`fill`,yn.value),n.appendChild(r);for(let e of Wn.value){let r=document.createElementNS(t,`path`);r.setAttribute(`d`,Dn(pi(e.from,`out`,e.to.side,e.to),pi(e.to,`in`),xn(e.from.depth),Sn(e.to.depth),32,bn(e.from.isRoot),e.to._dir)),r.setAttribute(`fill`,Mn(e.from,e.to)),r.setAttribute(`stroke`,`none`),n.appendChild(r)}let i=`-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif`;function a(e,t){let n=0;for(let r of e)/[\u4e00-\u9fff\u3000-\u30ff\uff00-\uffef]/.test(r)?n+=t:n+=t*.55;return n}for(let e of Gr.value){let r=document.createElementNS(t,`path`);r.setAttribute(`d`,e.d),r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,e.rel.color??`#94a3b8`),r.setAttribute(`stroke-width`,`1.5`),r.setAttribute(`stroke-dasharray`,`6 4`),r.setAttribute(`stroke-linecap`,`round`),n.appendChild(r);let a=e.rel.color??`#94a3b8`;for(let r of[e.arrowEnd,e.arrowStart]){if(!r)continue;let e=document.createElementNS(t,`path`);e.setAttribute(`d`,r),e.setAttribute(`fill`,a),e.setAttribute(`stroke`,`none`),n.appendChild(e)}if(e.rel.label){let r=document.createElementNS(t,`text`);r.setAttribute(`x`,String(e.labelPos.x)),r.setAttribute(`y`,String(e.labelPos.y-6)),r.setAttribute(`text-anchor`,`middle`),r.setAttribute(`font-size`,`12`),r.setAttribute(`font-family`,i),r.setAttribute(`fill`,`#64748b`),r.setAttribute(`stroke`,yn.value),r.setAttribute(`stroke-width`,`3`),r.setAttribute(`paint-order`,`stroke`),r.textContent=e.rel.label,n.appendChild(r)}}for(let e of Un.value){let r=e.x-e.width/2,o=e.y-e.height/2,s=document.createElementNS(t,`rect`);s.setAttribute(`x`,String(r)),s.setAttribute(`y`,String(o)),s.setAttribute(`width`,String(e.width)),s.setAttribute(`height`,String(e.height)),s.setAttribute(`rx`,`8`),s.setAttribute(`fill`,Nn(e));let c=Fn(e);c!==`transparent`&&(s.setAttribute(`stroke`,c),s.setAttribute(`stroke-width`,`1`)),n.appendChild(s);let l=!!(e.tags&&e.tags.length>0),u=!!(e.markers&&e.markers.length>0),d=!!e.image,f=!!(e.richContent&&(e.richContent.kind===`code`||e.richContent.kind===`table`)),p=0,m=0;if(f){let r=e.richContent,s=e.fontSize*.78*.92;if(r.kind===`code`){let c=os(r.raw),l=ss(r.raw),u=c.split(`
|
|
137
137
|
`),f=s*1.35,h=0;for(let e of u)h=Math.max(h,a(e,s));m=Math.min(h+12+4,e.width-4),p=u.length*f+8+2;let g=e.x-m/2,_=o+4;d&&(_=o+e.image.height+6);let v=document.createElementNS(t,`rect`);if(v.setAttribute(`x`,String(g)),v.setAttribute(`y`,String(_)),v.setAttribute(`width`,String(m)),v.setAttribute(`height`,String(p-2)),v.setAttribute(`rx`,`6`),v.setAttribute(`fill`,`rgba(255,255,255,0.55)`),v.setAttribute(`stroke`,Fn(e)),v.setAttribute(`stroke-width`,`1`),n.appendChild(v),l){let r=document.createElementNS(t,`text`);r.setAttribute(`x`,String(g+m-6)),r.setAttribute(`y`,String(_+4+4)),r.setAttribute(`text-anchor`,`end`),r.setAttribute(`fill`,Pn(e)),r.setAttribute(`font-size`,String(s*.8)),r.setAttribute(`font-family`,i),r.setAttribute(`opacity`,`0.5`),r.textContent=l,n.appendChild(r)}for(let r=0;r<u.length;r++){let i=document.createElementNS(t,`text`);i.setAttribute(`x`,String(g+6)),i.setAttribute(`y`,String(_+4+(r+.5)*f+2)),i.setAttribute(`dominant-baseline`,`central`),i.setAttribute(`fill`,Pn(e)),i.setAttribute(`font-size`,String(s)),i.setAttribute(`font-family`,`'JetBrains Mono','Fira Code',Consolas,monospace`);let a=u[r],o=Math.floor((m-12)/(s*.6));a.length>o&&(a=a.substring(0,o-1)+`…`),i.textContent=a,n.appendChild(i)}}else if(r.kind===`table`){let c=ls(r.raw);if(c.length>0){let r=s*1.35,l=c[0].length,u=[];for(let e=0;e<l;e++){let t=0;for(let n of c)e<n.length&&(t=Math.max(t,a(n[e],s)));u.push(t+12)}m=Math.min(u.reduce((e,t)=>e+t,0),e.width-4);let f=m/u.reduce((e,t)=>e+t,0);for(let e=0;e<l;e++)u[e]*=f;p=c.length*(r+6)+2;let h=e.x-m/2,g=o+4;d&&(g=o+e.image.height+6);let _=document.createElementNS(t,`rect`);_.setAttribute(`x`,String(h)),_.setAttribute(`y`,String(g)),_.setAttribute(`width`,String(m)),_.setAttribute(`height`,String(p-2)),_.setAttribute(`rx`,`6`),_.setAttribute(`fill`,`rgba(255,255,255,0.55)`),_.setAttribute(`stroke`,Fn(e)),_.setAttribute(`stroke-width`,`1`),n.appendChild(_);let v=h,y=g;for(let a=0;a<c.length;a++){let o=c[a],d=r+6;v=h;for(let f=0;f<l;f++){let p=u[f],m=o[f]||``;if(f<l-1){let r=document.createElementNS(t,`line`);r.setAttribute(`x1`,String(v+p)),r.setAttribute(`y1`,String(y)),r.setAttribute(`x2`,String(v+p)),r.setAttribute(`y2`,String(y+d)),r.setAttribute(`stroke`,Fn(e)),r.setAttribute(`stroke-width`,`1`),n.appendChild(r)}if(a<c.length-1){let r=document.createElementNS(t,`line`);r.setAttribute(`x1`,String(v)),r.setAttribute(`y1`,String(y+d)),r.setAttribute(`x2`,String(v+p)),r.setAttribute(`y2`,String(y+d)),r.setAttribute(`stroke`,Fn(e)),r.setAttribute(`stroke-width`,`1`),n.appendChild(r)}if(a===0){let e=document.createElementNS(t,`rect`);e.setAttribute(`x`,String(v)),e.setAttribute(`y`,String(y)),e.setAttribute(`width`,String(p)),e.setAttribute(`height`,String(d)),e.setAttribute(`fill`,`rgba(255,255,255,0.4)`),n.appendChild(e)}let h=document.createElementNS(t,`text`);h.setAttribute(`x`,String(v+6)),h.setAttribute(`y`,String(y+3+r/2+2)),h.setAttribute(`dominant-baseline`,`central`),h.setAttribute(`fill`,Pn(e)),h.setAttribute(`font-size`,String(s)),h.setAttribute(`font-family`,i),a===0&&h.setAttribute(`font-weight`,`600`);let g=m,_=Math.floor((p-12)/(s*.55));g.length>_&&_>2&&(g=g.substring(0,_-1)+`…`),h.textContent=g,n.appendChild(h),v+=p}y+=d}}}}let h=0;if(d){let r=e.image,i=o+4,a=e.x-r.width/2,s=document.createElementNS(t,`image`);s.setAttribute(`x`,String(a)),s.setAttribute(`y`,String(i)),s.setAttribute(`width`,String(r.width)),s.setAttribute(`height`,String(r.height)),s.setAttribute(`href`,r.src),s.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,r.src),s.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),n.appendChild(s),h=r.height+6}let g=e.y,_=h+p;_>0?g=o+_+(e.height-_)/2:l&&(g=e.y-8);let v=u?e.markers.length:0,y=v>0?v*14+(v-1)*2+4:0,b=a(e.text,e.fontSize),x=y+b,S=e.x-x/2;if(u){let r=S;for(let i of e.markers){let a=Ct(i);if(a){let i=document.createElementNS(t,`svg`);i.setAttribute(`x`,String(r)),i.setAttribute(`y`,String(g-14/2)),i.setAttribute(`width`,`14`),i.setAttribute(`height`,`14`),i.setAttribute(`viewBox`,`0 0 24 24`),i.setAttribute(`color`,Pn(e));let o=new DOMParser().parseFromString(`<svg xmlns="${t}">${a}</svg>`,`image/svg+xml`);if(!o.querySelector(`parsererror`))for(;o.documentElement.firstChild;)i.appendChild(o.documentElement.firstChild);n.appendChild(i)}r+=16}}let C=u?S+y+b/2:e.x,w=document.createElementNS(t,`text`);if(w.setAttribute(`x`,String(C)),w.setAttribute(`y`,String(g)),w.setAttribute(`text-anchor`,`middle`),w.setAttribute(`dominant-baseline`,`central`),w.setAttribute(`fill`,Pn(e)),w.setAttribute(`font-size`,String(Ln(e))),w.setAttribute(`font-weight`,String(In(e))),w.setAttribute(`font-family`,i),w.textContent=e.text,n.appendChild(w),l){let r=e.y+10,o=e.tags.map(e=>a(e,10)+12),s=o.reduce((e,t)=>e+t+3,-3),c=e.x-s/2;for(let a=0;a<e.tags.length;a++){let s=e.tags[a],l=Tt(s),u=o[a],d=document.createElementNS(t,`rect`);d.setAttribute(`x`,String(c)),d.setAttribute(`y`,String(r-16/2)),d.setAttribute(`width`,String(u)),d.setAttribute(`height`,`16`),d.setAttribute(`rx`,`8`),d.setAttribute(`fill`,l.background),d.setAttribute(`stroke`,l.borderColor),d.setAttribute(`stroke-width`,`1`),n.appendChild(d);let f=document.createElementNS(t,`text`);f.setAttribute(`x`,String(c+u/2)),f.setAttribute(`y`,String(r)),f.setAttribute(`text-anchor`,`middle`),f.setAttribute(`dominant-baseline`,`central`),f.setAttribute(`fill`,l.color),f.setAttribute(`font-size`,`10`),f.setAttribute(`font-family`,i),f.textContent=s,n.appendChild(f),c+=u+3}}}return n}function Bi(){let e=zi(),t=new XMLSerializer().serializeToString(e);t.startsWith(`<?xml`)||(t=`<?xml version="1.0" encoding="UTF-8"?>
|
|
138
138
|
`+t);let n=new Blob([t],{type:`image/svg+xml;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${V.value.text||`mindmap`}.svg`,i.click(),URL.revokeObjectURL(r)}function Vi(e=2){let t=zi(),n=Vn.value,r=new XMLSerializer().serializeToString(t);r.startsWith(`<?xml`)||(r=`<?xml version="1.0" encoding="UTF-8"?>
|
|
139
|
-
`+r);let i=new Blob([r],{type:`image/svg+xml;charset=utf-8`}),a=URL.createObjectURL(i),o=new window.Image;o.onload=()=>{let t=document.createElement(`canvas`);t.width=Math.ceil(n.vbW*e),t.height=Math.ceil(n.vbH*e);let r=t.getContext(`2d`);if(!r){URL.revokeObjectURL(a);return}r.fillStyle=yn.value,r.fillRect(0,0,t.width,t.height),r.drawImage(o,0,0,t.width,t.height),URL.revokeObjectURL(a);try{t.toBlob(e=>{if(!e){Bi();return}let t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${V.value.text||`mindmap`}.png`,n.click(),URL.revokeObjectURL(t)},`image/png`)}catch(e){console.warn(`PNG export failed, falling back to SVG:`,e),Bi()}},o.onerror=()=>{URL.revokeObjectURL(a),Bi()},o.src=a}return a({addChild:e=>ir(e),addSibling:e=>ar(e),removeNode:e=>vr(e),duplicateNode:e=>sr(e),setNodeText:(e,t)=>wr(e,t),moveNode:(e,t,n)=>Tr(e,t,n),lineWidthForDepth:xn,endWidthForDepth:Sn,getData:()=>V.value,nodeHasContent:e=>vi(e),getSelectedIds:()=>[...C.value],copyNodes:e=>fr(e),cutNodes:e=>pr(e),pasteNodes:e=>mr(e),setData:e=>{gn.reset(),V.value=He(e),C.value=new Set,O.value=new Set,q(),K(),s(()=>mi())},resetView:()=>mi(),exportData:_i,importData:yi,getMarkdown:()=>ut(V.value),setMarkdown:(e,t=!0)=>{let n=lt(e||``);t&&(ce.value=!0),le=!t,gn.reset(),V.value=He(n),C.value=new Set,O.value=new Set,q(),K(),s(()=>{le=!1,mi()}),d(`change`,V.value)},setBalanced:e=>{mn.value=e},isBalanced:()=>mn.value,balance:()=>hi(),applyNodeStyle:(e,t)=>pe(e,t),getNodeStyle:e=>me(e),applyNodeImage:(e,t)=>he(e,t),applyNodeImageByUrl:(e,t)=>H(e,t),removeNodeImage:e=>ge(e),applyNodeLink:(e,t)=>be(e,t),removeNodeLink:e=>xe(e),applyNodeNote:(e,t)=>Se(e,t),removeNodeNote:e=>Ce(e),applyNodeRichContent:(e,t)=>we(e,t),addNodeMarker:(e,t)=>ki(e,t),removeNodeMarker:(e,t)=>Ai(e,t),toggleNodeMarker:(e,t)=>ji(e,t),getNodeMarkers:e=>Mi(e),setNodeTags:(e,t)=>Fi(e,t),getNodeTags:e=>Ii(e),exportPNG:e=>Vi(e),exportSVG:()=>Bi(),searchNodes:e=>(Ci(e),[...xi.value]),undo:()=>hr(),redo:()=>gr(),canUndo:()=>gn.canUndo(),canRedo:()=>gn.canRedo(),applySettings:e=>{e.autoBalanceOnChange!==void 0&&(J.autoBalanceOnChange=e.autoBalanceOnChange),e.lineWidthStart!==void 0&&(J.lineWidthStart=Math.max(.5,Math.min(20,e.lineWidthStart))),e.lineWidthEnd!==void 0&&(J.lineWidthEnd=Math.max(.3,Math.min(10,e.lineWidthEnd))),e.rainbowBranch!==void 0&&(J.rainbowBranch=e.rainbowBranch),e.branchPaletteId!==void 0&&(J.branchPaletteId=e.branchPaletteId),e.customPalettes!==void 0&&(J.customPalettes=e.customPalettes),e.lineStyle!==void 0&&(J.lineStyle=e.lineStyle),e.rootLineStyle!==void 0&&(J.rootLineStyle=e.rootLineStyle),e.lineOrigin!==void 0&&(J.lineOrigin=e.lineOrigin),e.taperedEdge!==void 0&&(J.taperedEdge=e.taperedEdge),e.lineWidthTaper!==void 0&&(J.lineWidthTaper=Math.max(.1,Math.min(1,e.lineWidthTaper))),e.uniformLineWidth!==void 0&&(J.uniformLineWidth=e.uniformLineWidth),e.elbowRadius!==void 0&&(J.elbowRadius=Math.max(2,Math.min(40,e.elbowRadius))),e.showOrderBadge!==void 0&&(J.showOrderBadge=e.showOrderBadge),e.canvasBg!==void 0&&(J.canvasBg=e.canvasBg),e.branchGap!==void 0&&(J.branchGap=Math.max(0,Math.min(80,e.branchGap))),e.layoutMode!==void 0&&J.layoutMode!==e.layoutMode&&(J.layoutMode=e.layoutMode,q(),s(()=>mi()))},getSettings:()=>({autoBalanceOnChange:J.autoBalanceOnChange,lineWidthStart:J.lineWidthStart,lineWidthEnd:J.lineWidthEnd,rainbowBranch:J.rainbowBranch,branchPaletteId:J.branchPaletteId,customPalettes:J.customPalettes,lineStyle:J.lineStyle,rootLineStyle:J.rootLineStyle,lineOrigin:J.lineOrigin,layoutMode:J.layoutMode,taperedEdge:J.taperedEdge,lineWidthTaper:J.lineWidthTaper,uniformLineWidth:J.uniformLineWidth,elbowRadius:J.elbowRadius,showOrderBadge:J.showOrderBadge,canvasBg:J.canvasBg,branchGap:J.branchGap}),setBranchPalette:e=>{e&&[...Ie,...J.customPalettes].find(t=>t.id===e)&&(J.branchPaletteId=e)},getBranchPalette:()=>J.branchPaletteId,getBranchPalettes:()=>[...Ie,...J.customPalettes],getSearchResults:()=>[...xi.value],getSearchIndex:()=>Si.value,addRelation:(e,t)=>qr(e,t),removeRelation:e=>Jr(e),updateRelation:(e,t)=>Yr(e,t),getRelations:()=>He(V.value.relations??[])}),e(()=>l.data,e=>{V.value=He(e),q()},{deep:!1}),i(()=>{K(),s(()=>mi())}),(e,t)=>{var i,a,s;return m(),u(`div`,{class:`zm-mindmap`,style:f({background:yn.value,fontSize:vn.value.fontSize+`px`})},[N(`div`,{ref_key:`wrapperRef`,ref:h,class:p([`zm-canvas`,{"is-relation-mode":!!Ir.value}]),onMousedown:oi,onContextmenu:je,onWheel:t[30]||=(...e)=>P(Y).onWheel&&P(Y).onWheel(...e),onMouseenter:t[31]||=e=>ee.value=!0,onMouseleave:t[32]||=e=>ee.value=!1,onClick:si},[N(`div`,{class:`zm-svg-layer`,style:f({left:Vn.value.vbX*P(Y).scale.value+P(Y).offsetX.value+`px`,top:Vn.value.vbY*P(Y).scale.value+P(Y).offsetY.value+`px`,width:Vn.value.vbW*P(Y).scale.value+`px`,height:Vn.value.vbH*P(Y).scale.value+`px`})},[(m(),u(`svg`,{class:`zm-svg`,viewBox:Gn.value,preserveAspectRatio:`xMinYMin meet`,width:Vn.value.vbW*P(Y).scale.value,height:Vn.value.vbH*P(Y).scale.value},[N(`g`,Wu,[(m(!0),u(x,null,o(Wn.value,e=>(m(),u(`path`,{key:e.key,d:Dn(pi(e.from,`out`,e.to.side,e.to),pi(e.to,`in`),xn(e.from.depth),Sn(e.to.depth),32,bn(e.from.isRoot),e.to._dir),fill:Mn(e.from,e.to),stroke:`none`},null,8,Gu))),128))]),N(`g`,Ku,[(m(!0),u(x,null,o(Gr.value,e=>(m(),u(x,{key:e.rel.id},[N(`path`,{class:`zm-relation-hit`,d:e.d,onClick:t=>Qr(t,e.rel.id),onDblclick:t=>{t.stopPropagation(),ni(e.rel.id)}},null,40,qu),N(`path`,{class:p([`zm-relation-path`,{"is-selected":Fr.value===e.rel.id}]),d:e.d},null,10,Ju),e.arrowEnd?(m(),u(`path`,{key:0,class:p([`zm-relation-arrow`,{"is-selected":Fr.value===e.rel.id}]),d:e.arrowEnd},null,10,Yu)):M(``,!0),e.arrowStart?(m(),u(`path`,{key:1,class:p([`zm-relation-arrow`,{"is-selected":Fr.value===e.rel.id}]),d:e.arrowStart},null,10,Xu)):M(``,!0),e.rel.label&&Rr.value!==e.rel.id?(m(),u(`text`,{key:2,class:`zm-relation-label`,x:e.labelPos.x,y:e.labelPos.y-6,"text-anchor":`middle`,onClick:t=>Qr(t,e.rel.id),onDblclick:t=>{t.stopPropagation(),ni(e.rel.id)}},D(e.rel.label),41,Zu)):M(``,!0),Fr.value===e.rel.id&&!l.previewMode?(m(),u(x,{key:3},[N(`line`,{class:`zm-relation-guide`,x1:e.from.x,y1:e.from.y,x2:e.c1.x,y2:e.c1.y},null,8,Qu),N(`line`,{class:`zm-relation-guide`,x1:e.to.x,y1:e.to.y,x2:e.c2.x,y2:e.c2.y},null,8,$u),N(`circle`,{class:`zm-relation-handle-hit`,cx:e.from.x,cy:e.from.y,r:14/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`from`)},null,40,ed),N(`circle`,{class:`zm-relation-handle-hit`,cx:e.to.x,cy:e.to.y,r:14/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`to`)},null,40,td),N(`rect`,{class:`zm-relation-handle-hit`,x:e.c1.x-12/P(Y).scale.value,y:e.c1.y-12/P(Y).scale.value,width:24/P(Y).scale.value,height:24/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`c1`)},null,40,nd),N(`rect`,{class:`zm-relation-handle-hit`,x:e.c2.x-12/P(Y).scale.value,y:e.c2.y-12/P(Y).scale.value,width:24/P(Y).scale.value,height:24/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`c2`)},null,40,rd),N(`circle`,{class:`zm-relation-handle zm-relation-handle-endpoint`,cx:e.from.x,cy:e.from.y,r:6/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`from`)},null,40,id),N(`circle`,{class:`zm-relation-handle zm-relation-handle-endpoint`,cx:e.to.x,cy:e.to.y,r:6/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`to`)},null,40,ad),N(`rect`,{class:`zm-relation-handle zm-relation-handle-ctrl`,x:e.c1.x-5/P(Y).scale.value,y:e.c1.y-5/P(Y).scale.value,width:10/P(Y).scale.value,height:10/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`c1`)},null,40,od),N(`rect`,{class:`zm-relation-handle zm-relation-handle-ctrl`,x:e.c2.x-5/P(Y).scale.value,y:e.c2.y-5/P(Y).scale.value,width:10/P(Y).scale.value,height:10/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`c2`)},null,40,sd)],64)):M(``,!0)],64))),128))])],8,Uu))],4),P(Y).isMarquee.value?(m(),u(`div`,{key:0,class:`zm-marquee`,style:f({left:P(Y).marquee.x*P(Y).scale.value+P(Y).offsetX.value+`px`,top:P(Y).marquee.y*P(Y).scale.value+P(Y).offsetY.value+`px`,width:P(Y).marquee.width*P(Y).scale.value+`px`,height:P(Y).marquee.height*P(Y).scale.value+`px`})},null,4)):M(``,!0),F.value?(m(),u(`div`,{key:1,class:`zm-drag-ghost`,style:f({left:I.value+`px`,top:te.value+`px`,transform:`scale(${P(Y).scale.value})`,transformOrigin:`top left`})},D(F.value.srcText),5)):M(``,!0),N(`div`,{class:`zm-world`,style:f({transform:`translate(${P(Y).offsetX.value}px, ${P(Y).offsetY.value}px) scale(${P(Y).scale.value})`})},[ne.value?(m(),u(`div`,{key:0,class:`zm-drop-indicator`,style:f({left:ne.value.x1+`px`,top:ne.value.y1+`px`,width:ne.value.horizontal?ne.value.x2-ne.value.x1+`px`:`3px`,height:ne.value.horizontal?`3px`:ne.value.y2-ne.value.y1+`px`,transform:ne.value.horizontal?`translateY(-1.5px)`:`translateX(-1.5px)`})},null,4)):M(``,!0),(m(!0),u(x,null,o(Un.value,e=>(m(),u(`div`,{key:e.id,class:p([`zm-node`,{"is-root":e.isRoot,"is-selected":E.value===e.id,"is-selected-secondary":E.value!==e.id&&C.value.has(e.id),"is-editing":_.value===e.id,"has-image":!!e.image,"is-resizing":nn.value===e.id,"is-dragging-source":F.value?.srcId===e.id,"is-drop-target":F.value?.currentTargetId===e.id&&F.value?.dropPosition===`child`,"is-drop-target-before":F.value?.currentTargetId===e.id&&F.value?.dropPosition===`before`,"is-drop-target-after":F.value?.currentTargetId===e.id&&F.value?.dropPosition===`after`,"is-search-hit":wi(e.id),"is-search-current":Ti(e.id),"is-search-dimmed":Ei(e.id),"is-relation-source":Ir.value?.fromId===e.id,"is-relation-target":Lr.value!==null&&(Lr.value.end===`from`||Lr.value.end===`to`)&&Lr.value.hoverNodeId===e.id}]),"data-node-id":e.id,style:f({left:e.x+`px`,top:e.y+`px`,width:e.width+`px`,minWidth:e.width+`px`,height:e.height+`px`,fontSize:Ln(e)+`px`,background:Nn(e),color:Pn(e),borderColor:Fn(e),fontWeight:In(e),transform:`translate(-50%, -50%)`}),onClick:t=>Dr(t,e),onPointerdown:t=>Ar(t,e),onDblclick:t=>{t.stopPropagation(),r.previewMode||qn(e.id)},onContextmenu:t=>Oe(t,e),onMouseenter:t=>{un(e.id),fn(t,e)},onMouseleave:t=>dn(e.id)},[e.image?(m(),u(`img`,{key:0,class:`zm-node-img`,src:e.image.src,width:e.image.width,height:e.image.height,alt:e.text,draggable:`false`},null,8,ld)):M(``,!0),e.richContent&&(e.richContent.kind===`code`||e.richContent.kind===`table`)&&_.value!==e.id?(m(),u(`div`,{key:1,class:p([`zm-rich zm-rich-above`,{"zm-rich-no-overflow":e.richContent.kind===`table`||e.richContent.kind===`code`}]),onClick:t[1]||=w(()=>{},[`stop`]),onDblclick:w(t=>$n(e.id),[`stop`]),onMousedown:t[2]||=w(()=>{},[`stop`])},[B.value===e.id?S((m(),u(`textarea`,{key:0,"onUpdate:modelValue":t[0]||=e=>ae.value=e,class:`zm-rich-edit`,spellcheck:`false`,onBlur:er,onKeydown:nr},null,544)),[[A,ae.value]]):(m(),u(x,{key:1},[e.richContent.kind===`code`?(m(),u(`pre`,dd,[N(`code`,{innerHTML:P(cs)(P(os)(e.richContent.raw),P(ss)(e.richContent.raw))},null,8,fd)])):e.richContent.kind===`table`?(m(),u(`table`,pd,[N(`tbody`,null,[(m(!0),u(x,null,o(P(ls)(e.richContent.raw),(e,t)=>(m(),u(`tr`,{key:t},[t===0?(m(!0),u(x,{key:0},o(e,(e,t)=>(m(),u(`th`,{key:`h${t}`},D(e),1))),128)):(m(!0),u(x,{key:1},o(e,(e,t)=>(m(),u(`td`,{key:`c${t}`},D(e),1))),128))]))),128))])])):M(``,!0)],64))],42,ud)):M(``,!0),_.value===e.id?S((m(),u(`textarea`,{key:3,class:`zm-input`,"onUpdate:modelValue":t[6]||=e=>b.value=e,autofocus:``,rows:`1`,onBlur:t[7]||=e=>Jn(),onKeydown:[t[8]||=y(w(e=>Jn(),[`exact`,`prevent`]),[`enter`]),t[9]||=y(w(e=>Jn(),[`prevent`]),[`tab`]),y(Yn,[`esc`]),rr],onInput:Qn,onMousedown:t[10]||=w(()=>{},[`stop`]),onClick:t[11]||=w(()=>{},[`stop`])},null,544)),[[A,b.value]]):(m(),u(`span`,md,[e.markers&&e.markers.length>0?(m(),u(`span`,hd,[(m(!0),u(x,null,o(e.markers,e=>(m(),u(`span`,{key:e,class:`zm-node-marker`,title:P(wt)(e),innerHTML:`<svg viewBox="0 0 24 24" width="14" height="14">`+P(Ct)(e)+`</svg>`},null,8,gd))),128))])):M(``,!0),N(`span`,_d,D(e.text),1),e.link&&_.value!==e.id?(m(),u(`a`,{key:1,class:`zm-node-link`,href:e.link.url,target:`_blank`,rel:`noopener noreferrer`,title:`打开链接:${e.link.url}`,onClick:t[3]||=w(()=>{},[`stop`]),onMousedown:t[4]||=w(()=>{},[`stop`])},[n(L,{name:`link`,size:11,stroke:2})],40,vd)):M(``,!0),e.note&&_.value!==e.id?(m(),u(`button`,{key:2,class:`zm-node-note-btn`,type:`button`,title:Qt(e.note.text),onClick:w(t=>Zt(e.id),[`stop`]),onMousedown:t[5]||=w(()=>{},[`stop`])},[n(L,{name:`note`,size:11,stroke:2})],40,yd)):M(``,!0)])),e.tags&&e.tags.length>0&&_.value!==e.id?(m(),u(`div`,bd,[(m(!0),u(x,null,o(e.tags,e=>(m(),u(`span`,{key:e,class:`zm-node-tag`,style:f(P(Tt)(e))},D(e),5))),128))])):M(``,!0),ue.value?(m(),u(`span`,{key:5,class:`zm-order-badge`,title:`数据顺序:第 ${fi(e.id)+1} 个`},D(fi(e.id)+1),9,xd)):M(``,!0),li(e.id)&&di(e.id)>0?(m(),u(`span`,{key:6,class:p([`zm-collapse-badge`,{"is-on-left":e.side===-1}]),style:f({background:jn.value.get(e.id)??`#64748b`}),title:`展开 ${di(e.id)} 个子节点`,onMousedown:t[12]||=w(()=>{},[`stop`]),onClick:w(t=>yr(e.id),[`stop`])},D(di(e.id)),47,Sd)):M(``,!0),ui(e)&&!li(e.id)?(m(),u(`button`,{key:7,class:p([`zm-btn zm-collapse`,{"is-on-left":e.side===-1}]),style:f({"--zm-collapse-color":jn.value.get(e.id)??`#64748b`}),title:`折叠`,onMousedown:t[13]||=w(()=>{},[`stop`]),onClick:w(t=>yr(e.id),[`stop`])},[...t[40]||=[N(`span`,{class:`zm-collapse-bar`},null,-1)]],46,Cd)):M(``,!0),e.image&&E.value===e.id&&_.value!==e.id?(m(),u(`span`,{key:8,class:`zm-img-resize-handle`,title:`拖动调整图片大小`,onMousedown:w(t=>rn(t,e),[`stop`])},null,40,wd)):M(``,!0),e.image&&E.value===e.id&&_.value!==e.id?(m(),u(`button`,{key:9,class:`zm-img-remove-btn`,title:`移除图片`,onMousedown:t[14]||=w(()=>{},[`stop`]),onClick:w(t=>ge(e.id),[`stop`])},[n(L,{name:`x`,size:10,stroke:2.2})],40,Td)):M(``,!0)],46,cd))),128)),Kr.value?S((m(),u(`input`,{key:1,"onUpdate:modelValue":t[15]||=e=>zr.value=e,class:`zm-relation-label-input`,placeholder:`联系`,style:f({left:Kr.value.labelPos.x+`px`,top:Kr.value.labelPos.y+`px`}),onBlur:ri,onKeydown:[y(w(ri,[`prevent`]),[`enter`]),t[16]||=y(e=>Rr.value=null,[`esc`])],onMousedown:t[17]||=w(()=>{},[`stop`]),onClick:t[18]||=w(()=>{},[`stop`])},null,44,Ed)),[[A,zr.value]]):M(``,!0)],4),z.value?(m(),u(`div`,{key:2,class:p([`zm-tooltip`,{"is-below":!z.value.above}]),style:f({left:z.value.x+`px`,top:z.value.y+`px`})},D(z.value.text),7)):M(``,!0),U.value?(m(),g(At,{key:3,x:U.value.x,y:U.value.y,container:h.value,"has-image":!!((i=P(G)(V.value,U.value.nodeId))!=null&&i.image),"has-link":!!((a=P(G)(V.value,U.value.nodeId))!=null&&a.link),"has-note":!!((s=P(G)(V.value,U.value.nodeId))!=null&&s.note),"has-code":P(G)(V.value,U.value.nodeId)?.richContent?.kind===`code`,"has-table":P(G)(V.value,U.value.nodeId)?.richContent?.kind===`table`,"node-markers":P(G)(V.value,U.value.nodeId)?.markers??[],"node-tags":P(G)(V.value,U.value.nodeId)?.tags??[],onPickImage:zt,onRemoveImage:Gt,onSetLink:Bt,onRemoveLink:Ht,onEditNote:Ut,onRemoveNote:Wt,onAddCode:Kt,onEditCode:Kt,onRemoveCode:qt,onAddTable:Jt,onEditTable:Jt,onRemoveTable:Yt,onToggleMarker:Ni,onClearMarkers:Pi,onAddTag:Li,onRemoveTags:Ri,onAddRelation:Xt,onClose:Ae},null,8,[`x`,`y`,`container`,`has-image`,`has-link`,`has-note`,`has-code`,`has-table`,`node-markers`,`node-tags`])):M(``,!0),Te.value?(m(),g(jt,{key:4,x:Te.value.x,y:Te.value.y,container:h.value,onOpenSettings:Ne,onOpenData:Pe,onOpenImport:Fe,onExportPng:Vi,onExportSvg:Bi,onClose:Me},null,8,[`x`,`y`,`container`])):M(``,!0),N(`button`,{class:p(Ee.value),title:l.previewMode?`退出预览模式`:`进入预览模式`,onClick:t[19]||=e=>d(`canvas-toggle-preview`)},[n(L,{name:l.previewMode?`eye-off`:`eye`,size:16},null,8,[`name`])],10,Dd),N(`button`,{class:p(De.value),title:`显示大纲视图`,onClick:Rt},[n(L,{name:`outline`,size:16})],2),N(`div`,{class:p([`zm-toolbar`,{"is-preview-only":l.previewMode,"is-hovered":ee.value}])},[N(`span`,{class:`zm-tb-tip zm-tb-zoom`,title:`点击重置为 100%`,onClick:t[20]||=e=>P(Y).zoomTo100()},D(Math.round(P(Y).scale.value*100))+`%`,1),N(`button`,{class:`zm-tb-btn`,title:`放大`,onClick:t[21]||=(...e)=>P(Y).zoomIn&&P(Y).zoomIn(...e)},[n(L,{name:`zoom-in`})]),N(`button`,{class:`zm-tb-btn`,title:`缩小`,onClick:t[22]||=(...e)=>P(Y).zoomOut&&P(Y).zoomOut(...e)},[n(L,{name:`zoom-out`})]),N(`button`,{class:`zm-tb-btn`,title:`重置视图`,onClick:mi},[n(L,{name:`reset`})]),t[43]||=N(`span`,{class:`zm-tb-divider`},null,-1),N(`button`,{class:`zm-tb-btn`,title:`全部收起`,onClick:xr},[n(L,{name:`collapse-all`})]),N(`button`,{class:`zm-tb-btn`,title:`展开一级`,onClick:t[23]||=e=>Sr(1)},[n(L,{name:`expand-level-1`})]),N(`button`,{class:`zm-tb-btn`,title:`展开二级`,onClick:t[24]||=e=>Sr(2)},[n(L,{name:`expand-level-2`})]),N(`button`,{class:`zm-tb-btn`,title:`全部展开`,onClick:Cr},[n(L,{name:`expand-all`})]),l.previewMode?M(``,!0):(m(),u(x,{key:0},[t[41]||=N(`span`,{class:`zm-tb-divider`},null,-1),N(`button`,{class:`zm-tb-btn`,title:`添加子节点 (Tab)`,onClick:t[25]||=e=>E.value&&ir(E.value)},[N(`img`,{src:P(R),width:`14`,height:`14`,alt:`添加子节点`,draggable:`false`},null,8,Od)]),N(`button`,{class:`zm-tb-btn`,title:`添加同级 (Enter)`,onClick:t[26]||=e=>E.value&&ar(E.value)},[N(`img`,{src:P(ie),width:`14`,height:`14`,alt:`添加同级`,draggable:`false`},null,8,kd)]),N(`button`,{class:p([`zm-tb-btn`,{active:!!Ir.value}]),title:`联系(依次点选两个节点,Esc 取消)`,onClick:Zr},[n(L,{name:`relation`})],2),t[42]||=N(`span`,{class:`zm-tb-divider`},null,-1),N(`button`,{class:p([`zm-tb-btn`,{active:J.layoutMode===`mindmap`}]),title:`思维导图布局 (中心辐射)`,onClick:t[27]||=e=>gi(`mindmap`)},[n(L,{name:`mindmap`})],2),N(`button`,{class:p([`zm-tb-btn`,{active:J.layoutMode===`tree`}]),title:`树形布局 (向右展开)`,onClick:t[28]||=e=>gi(`tree`)},[n(L,{name:`tree`})],2),N(`button`,{class:p([`zm-tb-btn`,{active:J.layoutMode===`org`}]),title:`组织结构布局 (向下展开)`,onClick:t[29]||=e=>gi(`org`)},[n(L,{name:`org`})],2)],64))],2)],34),l.builtInDrawers?(m(),u(x,{key:0},[n(Vt,{side:`left`,scope:`canvas`,width:300,open:Re.value&&!r.previewMode,title:`大纲`,"onUpdate:open":t[33]||=e=>Re.value=e},{default:k(()=>[n(hn,{data:V.value,"selected-id":E.value,"collapsed-ids":dt.value,"show-index":ue.value,onSelect:Mt,onToggleCollapse:Lt,onEdit:Nt,onAddChild:Pt,onAddSibling:Ft,onMove:It},null,8,[`data`,`selected-id`,`collapsed-ids`,`show-index`])]),_:1},8,[`open`]),n(Vt,{side:`right`,scope:`canvas`,width:360,open:ze.value&&!r.previewMode,title:`数据`,"onUpdate:open":t[35]||=e=>ze.value=e},{default:k(()=>[n(Bn,{data:V.value,"pending-mode":nt.value,onImport:t[34]||=e=>V.value=e,onConsumedMode:xt},null,8,[`data`,`pending-mode`])]),_:1},8,[`open`]),n(Vt,{side:`right`,scope:`canvas`,width:420,open:Be.value&&!r.previewMode,title:`Markdown`,"onUpdate:open":t[37]||=e=>Be.value=e},{default:k(()=>[n(Xn,{data:V.value,onImport:t[36]||=e=>V.value=e},null,8,[`data`])]),_:1},8,[`open`]),n(Vt,{side:`right`,scope:`canvas`,width:360,open:W.value&&!r.previewMode,title:`节点内容`,"onUpdate:open":t[38]||=e=>W.value=e},{default:k(()=>[n(Hu,{"selected-node":mt.value,"focus-tick":qe.value,onApply:St,onRemove:Et,onSetLink:Dt,onSetImage:Ot,onSetRich:kt},null,8,[`selected-node`,`focus-tick`])]),_:1},8,[`open`]),n(Vt,{side:`right`,scope:`canvas`,width:340,open:Ve.value&&!r.previewMode,title:`设置`,"onUpdate:open":t[39]||=e=>Ve.value=e},{default:k(()=>[n(Wi,{settings:J,"has-selection":E.value!==null,"selected-node-text":mt.value?.text,"node-style":ht.value,"onUpdate:settings":vt,"onUpdate:nodeStyle":yt,onReset:bt},null,8,[`settings`,`has-selection`,`selected-node-text`,`node-style`])]),_:1},8,[`open`])],64)):M(``,!0)],4)}}});export{lt as n,Pd as r,ft as t};
|
|
139
|
+
`+r);let i=new Blob([r],{type:`image/svg+xml;charset=utf-8`}),a=URL.createObjectURL(i),o=new window.Image;o.onload=()=>{let t=document.createElement(`canvas`);t.width=Math.ceil(n.vbW*e),t.height=Math.ceil(n.vbH*e);let r=t.getContext(`2d`);if(!r){URL.revokeObjectURL(a);return}r.fillStyle=yn.value,r.fillRect(0,0,t.width,t.height),r.drawImage(o,0,0,t.width,t.height),URL.revokeObjectURL(a);try{t.toBlob(e=>{if(!e){Bi();return}let t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${V.value.text||`mindmap`}.png`,n.click(),URL.revokeObjectURL(t)},`image/png`)}catch(e){console.warn(`PNG export failed, falling back to SVG:`,e),Bi()}},o.onerror=()=>{URL.revokeObjectURL(a),Bi()},o.src=a}return a({addChild:e=>ir(e),addSibling:e=>ar(e),removeNode:e=>vr(e),duplicateNode:e=>sr(e),setNodeText:(e,t)=>wr(e,t),moveNode:(e,t,n)=>Tr(e,t,n),lineWidthForDepth:xn,endWidthForDepth:Sn,getData:()=>V.value,nodeHasContent:e=>vi(e),getSelectedIds:()=>[...w.value],copyNodes:e=>fr(e),cutNodes:e=>pr(e),pasteNodes:e=>mr(e),setData:e=>{gn.reset(),V.value=He(e),w.value=new Set,O.value=new Set,q(),K(),d(()=>mi())},resetView:()=>mi(),exportData:_i,importData:yi,getMarkdown:()=>ut(V.value),setMarkdown:(e,t=!0)=>{let n=lt(e||``);t&&(ce.value=!0),le=!t,gn.reset(),V.value=He(n),w.value=new Set,O.value=new Set,q(),K(),d(()=>{le=!1,mi()}),m(`change`,V.value)},setBalanced:e=>{mn.value=e},isBalanced:()=>mn.value,balance:()=>hi(),applyNodeStyle:(e,t)=>pe(e,t),getNodeStyle:e=>me(e),applyNodeImage:(e,t)=>he(e,t),applyNodeImageByUrl:(e,t)=>H(e,t),removeNodeImage:e=>ge(e),applyNodeLink:(e,t)=>be(e,t),removeNodeLink:e=>xe(e),applyNodeNote:(e,t)=>Se(e,t),removeNodeNote:e=>Ce(e),applyNodeRichContent:(e,t)=>we(e,t),addNodeMarker:(e,t)=>ki(e,t),removeNodeMarker:(e,t)=>Ai(e,t),toggleNodeMarker:(e,t)=>ji(e,t),getNodeMarkers:e=>Mi(e),setNodeTags:(e,t)=>Fi(e,t),getNodeTags:e=>Ii(e),exportPNG:e=>Vi(e),exportSVG:()=>Bi(),searchNodes:e=>(Ci(e),[...xi.value]),undo:()=>hr(),redo:()=>gr(),canUndo:()=>gn.canUndo(),canRedo:()=>gn.canRedo(),applySettings:e=>{e.autoBalanceOnChange!==void 0&&(J.autoBalanceOnChange=e.autoBalanceOnChange),e.lineWidthStart!==void 0&&(J.lineWidthStart=Math.max(.5,Math.min(20,e.lineWidthStart))),e.lineWidthEnd!==void 0&&(J.lineWidthEnd=Math.max(.3,Math.min(10,e.lineWidthEnd))),e.rainbowBranch!==void 0&&(J.rainbowBranch=e.rainbowBranch),e.branchPaletteId!==void 0&&(J.branchPaletteId=e.branchPaletteId),e.customPalettes!==void 0&&(J.customPalettes=e.customPalettes),e.lineStyle!==void 0&&(J.lineStyle=e.lineStyle),e.rootLineStyle!==void 0&&(J.rootLineStyle=e.rootLineStyle),e.lineOrigin!==void 0&&(J.lineOrigin=e.lineOrigin),e.taperedEdge!==void 0&&(J.taperedEdge=e.taperedEdge),e.lineWidthTaper!==void 0&&(J.lineWidthTaper=Math.max(.1,Math.min(1,e.lineWidthTaper))),e.uniformLineWidth!==void 0&&(J.uniformLineWidth=e.uniformLineWidth),e.elbowRadius!==void 0&&(J.elbowRadius=Math.max(2,Math.min(40,e.elbowRadius))),e.showOrderBadge!==void 0&&(J.showOrderBadge=e.showOrderBadge),e.canvasBg!==void 0&&(J.canvasBg=e.canvasBg),e.branchGap!==void 0&&(J.branchGap=Math.max(0,Math.min(80,e.branchGap))),e.layoutMode!==void 0&&J.layoutMode!==e.layoutMode&&(J.layoutMode=e.layoutMode,q(),d(()=>mi()))},getSettings:()=>({autoBalanceOnChange:J.autoBalanceOnChange,lineWidthStart:J.lineWidthStart,lineWidthEnd:J.lineWidthEnd,rainbowBranch:J.rainbowBranch,branchPaletteId:J.branchPaletteId,customPalettes:J.customPalettes,lineStyle:J.lineStyle,rootLineStyle:J.rootLineStyle,lineOrigin:J.lineOrigin,layoutMode:J.layoutMode,taperedEdge:J.taperedEdge,lineWidthTaper:J.lineWidthTaper,uniformLineWidth:J.uniformLineWidth,elbowRadius:J.elbowRadius,showOrderBadge:J.showOrderBadge,canvasBg:J.canvasBg,branchGap:J.branchGap}),setBranchPalette:e=>{e&&[...Ie,...J.customPalettes].find(t=>t.id===e)&&(J.branchPaletteId=e)},getBranchPalette:()=>J.branchPaletteId,getBranchPalettes:()=>[...Ie,...J.customPalettes],getSearchResults:()=>[...xi.value],getSearchIndex:()=>Si.value,addRelation:(e,t)=>qr(e,t),removeRelation:e=>Jr(e),updateRelation:(e,t)=>Yr(e,t),getRelations:()=>He(V.value.relations??[])}),e(()=>f.data,e=>{V.value=He(e),q()},{deep:!1}),s(()=>{K(),d(()=>mi())}),(e,t)=>{var a,s,l;return h(),p(`div`,{class:`zm-mindmap`,style:c({background:yn.value,fontSize:vn.value.fontSize+`px`})},[N(`div`,{ref_key:`wrapperRef`,ref:g,class:n([`zm-canvas`,{"is-relation-mode":!!Ir.value}]),onMousedown:oi,onContextmenu:je,onWheel:t[30]||=(...e)=>P(Y).onWheel&&P(Y).onWheel(...e),onMouseenter:t[31]||=e=>ee.value=!0,onMouseleave:t[32]||=e=>ee.value=!1,onClick:si},[N(`div`,{class:`zm-svg-layer`,style:c({left:Vn.value.vbX*P(Y).scale.value+P(Y).offsetX.value+`px`,top:Vn.value.vbY*P(Y).scale.value+P(Y).offsetY.value+`px`,width:Vn.value.vbW*P(Y).scale.value+`px`,height:Vn.value.vbH*P(Y).scale.value+`px`})},[(h(),p(`svg`,{class:`zm-svg`,viewBox:Gn.value,preserveAspectRatio:`xMinYMin meet`,width:Vn.value.vbW*P(Y).scale.value,height:Vn.value.vbH*P(Y).scale.value},[N(`g`,Wu,[(h(!0),p(S,null,u(Wn.value,e=>(h(),p(`path`,{key:e.key,d:Dn(pi(e.from,`out`,e.to.side,e.to),pi(e.to,`in`),xn(e.from.depth),Sn(e.to.depth),32,bn(e.from.isRoot),e.to._dir),fill:Mn(e.from,e.to),stroke:`none`},null,8,Gu))),128))]),N(`g`,Ku,[(h(!0),p(S,null,u(Gr.value,e=>(h(),p(S,{key:e.rel.id},[N(`path`,{class:`zm-relation-hit`,d:e.d,onClick:t=>Qr(t,e.rel.id),onDblclick:t=>{t.stopPropagation(),ni(e.rel.id)}},null,40,qu),N(`path`,{class:n([`zm-relation-path`,{"is-selected":Fr.value===e.rel.id}]),d:e.d},null,10,Ju),e.arrowEnd?(h(),p(`path`,{key:0,class:n([`zm-relation-arrow`,{"is-selected":Fr.value===e.rel.id}]),d:e.arrowEnd},null,10,Yu)):M(``,!0),e.arrowStart?(h(),p(`path`,{key:1,class:n([`zm-relation-arrow`,{"is-selected":Fr.value===e.rel.id}]),d:e.arrowStart},null,10,Xu)):M(``,!0),e.rel.label&&Rr.value!==e.rel.id?(h(),p(`text`,{key:2,class:`zm-relation-label`,x:e.labelPos.x,y:e.labelPos.y-6,"text-anchor":`middle`,onClick:t=>Qr(t,e.rel.id),onDblclick:t=>{t.stopPropagation(),ni(e.rel.id)}},o(e.rel.label),41,Zu)):M(``,!0),Fr.value===e.rel.id&&!f.previewMode?(h(),p(S,{key:3},[N(`line`,{class:`zm-relation-guide`,x1:e.from.x,y1:e.from.y,x2:e.c1.x,y2:e.c1.y},null,8,Qu),N(`line`,{class:`zm-relation-guide`,x1:e.to.x,y1:e.to.y,x2:e.c2.x,y2:e.c2.y},null,8,$u),N(`circle`,{class:`zm-relation-handle-hit`,cx:e.from.x,cy:e.from.y,r:14/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`from`)},null,40,ed),N(`circle`,{class:`zm-relation-handle-hit`,cx:e.to.x,cy:e.to.y,r:14/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`to`)},null,40,td),N(`rect`,{class:`zm-relation-handle-hit`,x:e.c1.x-12/P(Y).scale.value,y:e.c1.y-12/P(Y).scale.value,width:24/P(Y).scale.value,height:24/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`c1`)},null,40,nd),N(`rect`,{class:`zm-relation-handle-hit`,x:e.c2.x-12/P(Y).scale.value,y:e.c2.y-12/P(Y).scale.value,width:24/P(Y).scale.value,height:24/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`c2`)},null,40,rd),N(`circle`,{class:`zm-relation-handle zm-relation-handle-endpoint`,cx:e.from.x,cy:e.from.y,r:6/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`from`)},null,40,id),N(`circle`,{class:`zm-relation-handle zm-relation-handle-endpoint`,cx:e.to.x,cy:e.to.y,r:6/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`to`)},null,40,ad),N(`rect`,{class:`zm-relation-handle zm-relation-handle-ctrl`,x:e.c1.x-5/P(Y).scale.value,y:e.c1.y-5/P(Y).scale.value,width:10/P(Y).scale.value,height:10/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`c1`)},null,40,od),N(`rect`,{class:`zm-relation-handle zm-relation-handle-ctrl`,x:e.c2.x-5/P(Y).scale.value,y:e.c2.y-5/P(Y).scale.value,width:10/P(Y).scale.value,height:10/P(Y).scale.value,onPointerdown:t=>$r(t,e.rel.id,`c2`)},null,40,sd)],64)):M(``,!0)],64))),128))])],8,Uu))],4),P(Y).isMarquee.value?(h(),p(`div`,{key:0,class:`zm-marquee`,style:c({left:P(Y).marquee.x*P(Y).scale.value+P(Y).offsetX.value+`px`,top:P(Y).marquee.y*P(Y).scale.value+P(Y).offsetY.value+`px`,width:P(Y).marquee.width*P(Y).scale.value+`px`,height:P(Y).marquee.height*P(Y).scale.value+`px`})},null,4)):M(``,!0),F.value?(h(),p(`div`,{key:1,class:`zm-drag-ghost`,style:c({left:I.value+`px`,top:te.value+`px`,transform:`scale(${P(Y).scale.value})`,transformOrigin:`top left`})},o(F.value.srcText),5)):M(``,!0),N(`div`,{class:`zm-world`,style:c({transform:`translate(${P(Y).offsetX.value}px, ${P(Y).offsetY.value}px) scale(${P(Y).scale.value})`})},[ne.value?(h(),p(`div`,{key:0,class:`zm-drop-indicator`,style:c({left:ne.value.x1+`px`,top:ne.value.y1+`px`,width:ne.value.horizontal?ne.value.x2-ne.value.x1+`px`:`3px`,height:ne.value.horizontal?`3px`:ne.value.y2-ne.value.y1+`px`,transform:ne.value.horizontal?`translateY(-1.5px)`:`translateX(-1.5px)`})},null,4)):M(``,!0),(h(!0),p(S,null,u(Un.value,e=>(h(),p(`div`,{key:e.id,class:n([`zm-node`,{"is-root":e.isRoot,"is-selected":D.value===e.id,"is-selected-secondary":D.value!==e.id&&w.value.has(e.id),"is-editing":v.value===e.id,"has-image":!!e.image,"is-resizing":nn.value===e.id,"is-dragging-source":F.value?.srcId===e.id,"is-drop-target":F.value?.currentTargetId===e.id&&F.value?.dropPosition===`child`,"is-drop-target-before":F.value?.currentTargetId===e.id&&F.value?.dropPosition===`before`,"is-drop-target-after":F.value?.currentTargetId===e.id&&F.value?.dropPosition===`after`,"is-search-hit":wi(e.id),"is-search-current":Ti(e.id),"is-search-dimmed":Ei(e.id),"is-relation-source":Ir.value?.fromId===e.id,"is-relation-target":Lr.value!==null&&(Lr.value.end===`from`||Lr.value.end===`to`)&&Lr.value.hoverNodeId===e.id}]),"data-node-id":e.id,style:c({left:e.x+`px`,top:e.y+`px`,width:e.width+`px`,minWidth:e.width+`px`,height:e.height+`px`,fontSize:Ln(e)+`px`,background:Nn(e),color:Pn(e),borderColor:Fn(e),fontWeight:In(e),transform:`translate(-50%, -50%)`}),onClick:t=>Dr(t,e),onPointerdown:t=>Ar(t,e),onDblclick:t=>{t.stopPropagation(),i.previewMode||qn(e.id)},onContextmenu:t=>Oe(t,e),onMouseenter:t=>{un(e.id),fn(t,e)},onMouseleave:t=>dn(e.id)},[e.image?(h(),p(`img`,{key:0,class:`zm-node-img`,src:e.image.src,width:e.image.width,height:e.image.height,alt:e.text,draggable:`false`},null,8,ld)):M(``,!0),e.richContent&&(e.richContent.kind===`code`||e.richContent.kind===`table`)&&v.value!==e.id?(h(),p(`div`,{key:1,class:n([`zm-rich zm-rich-above`,{"zm-rich-no-overflow":e.richContent.kind===`table`||e.richContent.kind===`code`}]),onClick:t[1]||=T(()=>{},[`stop`]),onDblclick:T(t=>$n(e.id),[`stop`]),onMousedown:t[2]||=T(()=>{},[`stop`])},[B.value===e.id?C((h(),p(`textarea`,{key:0,"onUpdate:modelValue":t[0]||=e=>ae.value=e,class:`zm-rich-edit`,spellcheck:`false`,onBlur:er,onKeydown:nr},null,544)),[[A,ae.value]]):(h(),p(S,{key:1},[e.richContent.kind===`code`?(h(),p(`pre`,dd,[N(`code`,{innerHTML:P(cs)(P(os)(e.richContent.raw),P(ss)(e.richContent.raw))},null,8,fd)])):e.richContent.kind===`table`?(h(),p(`table`,pd,[N(`tbody`,null,[(h(!0),p(S,null,u(P(ls)(e.richContent.raw),(e,t)=>(h(),p(`tr`,{key:t},[t===0?(h(!0),p(S,{key:0},u(e,(e,t)=>(h(),p(`th`,{key:`h${t}`},o(e),1))),128)):(h(!0),p(S,{key:1},u(e,(e,t)=>(h(),p(`td`,{key:`c${t}`},o(e),1))),128))]))),128))])])):M(``,!0)],64))],42,ud)):M(``,!0),v.value===e.id?C((h(),p(`textarea`,{key:3,class:`zm-input`,"onUpdate:modelValue":t[6]||=e=>x.value=e,autofocus:``,rows:`1`,onBlur:t[7]||=e=>Jn(),onKeydown:[t[8]||=b(T(e=>Jn(),[`exact`,`prevent`]),[`enter`]),t[9]||=b(T(e=>Jn(),[`prevent`]),[`tab`]),b(Yn,[`esc`]),rr],onInput:Qn,onMousedown:t[10]||=T(()=>{},[`stop`]),onClick:t[11]||=T(()=>{},[`stop`])},null,544)),[[A,x.value]]):(h(),p(`span`,md,[e.markers&&e.markers.length>0?(h(),p(`span`,hd,[(h(!0),p(S,null,u(e.markers,e=>(h(),p(`span`,{key:e,class:`zm-node-marker`,title:P(wt)(e),innerHTML:`<svg viewBox="0 0 24 24" width="14" height="14">`+P(Ct)(e)+`</svg>`},null,8,gd))),128))])):M(``,!0),N(`span`,_d,o(e.text),1),e.link&&v.value!==e.id?(h(),p(`a`,{key:1,class:`zm-node-link`,href:e.link.url,target:`_blank`,rel:`noopener noreferrer`,title:`打开链接:${e.link.url}`,onClick:t[3]||=T(()=>{},[`stop`]),onMousedown:t[4]||=T(()=>{},[`stop`])},[r(L,{name:`link`,size:11,stroke:2})],40,vd)):M(``,!0),e.note&&v.value!==e.id?(h(),p(`button`,{key:2,class:`zm-node-note-btn`,type:`button`,title:Qt(e.note.text),onClick:T(t=>Zt(e.id),[`stop`]),onMousedown:t[5]||=T(()=>{},[`stop`])},[r(L,{name:`note`,size:11,stroke:2})],40,yd)):M(``,!0)])),e.tags&&e.tags.length>0&&v.value!==e.id?(h(),p(`div`,bd,[(h(!0),p(S,null,u(e.tags,e=>(h(),p(`span`,{key:e,class:`zm-node-tag`,style:c(P(Tt)(e))},o(e),5))),128))])):M(``,!0),ue.value?(h(),p(`span`,{key:5,class:`zm-order-badge`,title:`数据顺序:第 ${fi(e.id)+1} 个`},o(fi(e.id)+1),9,xd)):M(``,!0),li(e.id)&&di(e.id)>0?(h(),p(`span`,{key:6,class:n([`zm-collapse-badge`,{"is-on-left":e.side===-1}]),style:c({background:jn.value.get(e.id)??`#64748b`}),title:`展开 ${di(e.id)} 个子节点`,onMousedown:t[12]||=T(()=>{},[`stop`]),onClick:T(t=>yr(e.id),[`stop`])},o(di(e.id)),47,Sd)):M(``,!0),ui(e)&&!li(e.id)?(h(),p(`button`,{key:7,class:n([`zm-btn zm-collapse`,{"is-on-left":e.side===-1}]),style:c({"--zm-collapse-color":jn.value.get(e.id)??`#64748b`}),title:`折叠`,onMousedown:t[13]||=T(()=>{},[`stop`]),onClick:T(t=>yr(e.id),[`stop`])},[...t[40]||=[N(`span`,{class:`zm-collapse-bar`},null,-1)]],46,Cd)):M(``,!0),e.image&&D.value===e.id&&v.value!==e.id?(h(),p(`span`,{key:8,class:`zm-img-resize-handle`,title:`拖动调整图片大小`,onMousedown:T(t=>rn(t,e),[`stop`])},null,40,wd)):M(``,!0),e.image&&D.value===e.id&&v.value!==e.id?(h(),p(`button`,{key:9,class:`zm-img-remove-btn`,title:`移除图片`,onMousedown:t[14]||=T(()=>{},[`stop`]),onClick:T(t=>ge(e.id),[`stop`])},[r(L,{name:`x`,size:10,stroke:2.2})],40,Td)):M(``,!0)],46,cd))),128)),Kr.value?C((h(),p(`input`,{key:1,"onUpdate:modelValue":t[15]||=e=>zr.value=e,class:`zm-relation-label-input`,placeholder:`联系`,style:c({left:Kr.value.labelPos.x+`px`,top:Kr.value.labelPos.y+`px`}),onBlur:ri,onKeydown:[b(T(ri,[`prevent`]),[`enter`]),t[16]||=b(e=>Rr.value=null,[`esc`])],onMousedown:t[17]||=T(()=>{},[`stop`]),onClick:t[18]||=T(()=>{},[`stop`])},null,44,Ed)),[[A,zr.value]]):M(``,!0)],4),z.value?(h(),p(`div`,{key:2,class:n([`zm-tooltip`,{"is-below":!z.value.above}]),style:c({left:z.value.x+`px`,top:z.value.y+`px`})},o(z.value.text),7)):M(``,!0),U.value?(h(),_(At,{key:3,x:U.value.x,y:U.value.y,container:g.value,"has-image":!!((a=P(G)(V.value,U.value.nodeId))!=null&&a.image),"has-link":!!((s=P(G)(V.value,U.value.nodeId))!=null&&s.link),"has-note":!!((l=P(G)(V.value,U.value.nodeId))!=null&&l.note),"has-code":P(G)(V.value,U.value.nodeId)?.richContent?.kind===`code`,"has-table":P(G)(V.value,U.value.nodeId)?.richContent?.kind===`table`,"node-markers":P(G)(V.value,U.value.nodeId)?.markers??[],"node-tags":P(G)(V.value,U.value.nodeId)?.tags??[],onPickImage:zt,onRemoveImage:Gt,onSetLink:Bt,onRemoveLink:Ht,onEditNote:Ut,onRemoveNote:Wt,onAddCode:Kt,onEditCode:Kt,onRemoveCode:qt,onAddTable:Jt,onEditTable:Jt,onRemoveTable:Yt,onToggleMarker:Ni,onClearMarkers:Pi,onAddTag:Li,onRemoveTags:Ri,onAddRelation:Xt,onClose:Ae},null,8,[`x`,`y`,`container`,`has-image`,`has-link`,`has-note`,`has-code`,`has-table`,`node-markers`,`node-tags`])):M(``,!0),Te.value?(h(),_(jt,{key:4,x:Te.value.x,y:Te.value.y,container:g.value,onOpenSettings:Ne,onOpenData:Pe,onOpenImport:Fe,onExportPng:Vi,onExportSvg:Bi,onClose:Me},null,8,[`x`,`y`,`container`])):M(``,!0),N(`button`,{class:n(Ee.value),title:f.previewMode?`退出预览模式`:`进入预览模式`,onClick:t[19]||=e=>m(`canvas-toggle-preview`)},[r(L,{name:f.previewMode?`eye-off`:`eye`,size:16},null,8,[`name`])],10,Dd),N(`button`,{class:n(De.value),title:`显示大纲视图`,onClick:Rt},[r(L,{name:`outline`,size:16})],2),N(`div`,{class:n([`zm-toolbar`,{"is-preview-only":f.previewMode,"is-hovered":ee.value}])},[N(`span`,{class:`zm-tb-tip zm-tb-zoom`,title:`点击重置为 100%`,onClick:t[20]||=e=>P(Y).zoomTo100()},o(Math.round(P(Y).scale.value*100))+`%`,1),N(`button`,{class:`zm-tb-btn`,title:`放大`,onClick:t[21]||=(...e)=>P(Y).zoomIn&&P(Y).zoomIn(...e)},[r(L,{name:`zoom-in`})]),N(`button`,{class:`zm-tb-btn`,title:`缩小`,onClick:t[22]||=(...e)=>P(Y).zoomOut&&P(Y).zoomOut(...e)},[r(L,{name:`zoom-out`})]),N(`button`,{class:`zm-tb-btn`,title:`重置视图`,onClick:mi},[r(L,{name:`reset`})]),t[43]||=N(`span`,{class:`zm-tb-divider`},null,-1),N(`button`,{class:`zm-tb-btn`,title:`全部收起`,onClick:xr},[r(L,{name:`collapse-all`})]),N(`button`,{class:`zm-tb-btn`,title:`展开一级`,onClick:t[23]||=e=>Sr(1)},[r(L,{name:`expand-level-1`})]),N(`button`,{class:`zm-tb-btn`,title:`展开二级`,onClick:t[24]||=e=>Sr(2)},[r(L,{name:`expand-level-2`})]),N(`button`,{class:`zm-tb-btn`,title:`全部展开`,onClick:Cr},[r(L,{name:`expand-all`})]),f.previewMode?M(``,!0):(h(),p(S,{key:0},[t[41]||=N(`span`,{class:`zm-tb-divider`},null,-1),N(`button`,{class:`zm-tb-btn`,title:`添加子节点 (Tab)`,onClick:t[25]||=e=>D.value&&ir(D.value)},[N(`img`,{src:P(R),width:`14`,height:`14`,alt:`添加子节点`,draggable:`false`},null,8,Od)]),N(`button`,{class:`zm-tb-btn`,title:`添加同级 (Enter)`,onClick:t[26]||=e=>D.value&&ar(D.value)},[N(`img`,{src:P(ie),width:`14`,height:`14`,alt:`添加同级`,draggable:`false`},null,8,kd)]),N(`button`,{class:n([`zm-tb-btn`,{active:!!Ir.value}]),title:`联系(依次点选两个节点,Esc 取消)`,onClick:Zr},[r(L,{name:`relation`})],2),t[42]||=N(`span`,{class:`zm-tb-divider`},null,-1),N(`button`,{class:n([`zm-tb-btn`,{active:J.layoutMode===`mindmap`}]),title:`思维导图布局 (中心辐射)`,onClick:t[27]||=e=>gi(`mindmap`)},[r(L,{name:`mindmap`})],2),N(`button`,{class:n([`zm-tb-btn`,{active:J.layoutMode===`tree`}]),title:`树形布局 (向右展开)`,onClick:t[28]||=e=>gi(`tree`)},[r(L,{name:`tree`})],2),N(`button`,{class:n([`zm-tb-btn`,{active:J.layoutMode===`org`}]),title:`组织结构布局 (向下展开)`,onClick:t[29]||=e=>gi(`org`)},[r(L,{name:`org`})],2)],64))],2)],34),f.builtInDrawers?(h(),p(S,{key:0},[r(Vt,{side:`left`,scope:`canvas`,width:300,open:Re.value&&!i.previewMode,title:`大纲`,"onUpdate:open":t[33]||=e=>Re.value=e},{default:k(()=>[r(hn,{data:V.value,"selected-id":D.value,"collapsed-ids":dt.value,"show-index":ue.value,onSelect:Mt,onToggleCollapse:Lt,onEdit:Nt,onAddChild:Pt,onAddSibling:Ft,onMove:It},null,8,[`data`,`selected-id`,`collapsed-ids`,`show-index`])]),_:1},8,[`open`]),r(Vt,{side:`right`,scope:`canvas`,width:360,open:ze.value&&!i.previewMode,title:`数据`,"onUpdate:open":t[35]||=e=>ze.value=e},{default:k(()=>[r(Bn,{data:V.value,"pending-mode":nt.value,onImport:t[34]||=e=>V.value=e,onConsumedMode:xt},null,8,[`data`,`pending-mode`])]),_:1},8,[`open`]),r(Vt,{side:`right`,scope:`canvas`,width:420,open:Be.value&&!i.previewMode,title:`Markdown`,"onUpdate:open":t[37]||=e=>Be.value=e},{default:k(()=>[r(Xn,{data:V.value,onImport:t[36]||=e=>V.value=e},null,8,[`data`])]),_:1},8,[`open`]),r(Vt,{side:`right`,scope:`canvas`,width:360,open:W.value&&!i.previewMode,title:`节点内容`,"onUpdate:open":t[38]||=e=>W.value=e},{default:k(()=>[r(Hu,{"selected-node":mt.value,"focus-tick":qe.value,onApply:St,onRemove:Et,onSetLink:Dt,onSetImage:Ot,onSetRich:kt},null,8,[`selected-node`,`focus-tick`])]),_:1},8,[`open`]),r(Vt,{side:`right`,scope:`canvas`,width:340,open:Ve.value&&!i.previewMode,title:`设置`,"onUpdate:open":t[39]||=e=>Ve.value=e},{default:k(()=>[r(Wi,{settings:J,"has-selection":D.value!==null,"selected-node-text":mt.value?.text,"node-style":ht.value,"onUpdate:settings":vt,"onUpdate:nodeStyle":yt,onReset:bt},null,8,[`settings`,`has-selection`,`selected-node-text`,`node-style`])]),_:1},8,[`open`])],64)):M(``,!0)],4)}}});export{lt as n,Pd as r,ft as t};
|