flow-mindmap 0.1.1-beta.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/layout.d.ts +7 -1
- package/dist/entry.d.ts +4 -4
- package/dist/flow-mindmap.js +1254 -1078
- package/dist/flow-mindmap.umd.cjs +16 -5
- package/dist/style.css +1 -1
- package/dist/tree.d.ts +28 -0
- package/dist/types.d.ts +28 -0
- package/package.json +1 -1
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
(function(T,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(T=typeof globalThis<"u"?globalThis:T||self,e(T.FlowMind={},T.Vue))})(this,function(T,e){"use strict";const Rt=["width","height","stroke-width"],Tt={key:4,points:"6 9 12 15 18 9"},At={key:5,points:"9 6 15 12 9 18"},R=e.defineComponent({__name:"Icon",props:{name:{},size:{},stroke:{}},setup(o){return(d,l)=>(e.openBlock(),e.createElementBlock("svg",{width:o.size??16,height:o.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":o.stroke??1.8,"stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[o.name==="add"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[0]||(l[0]=e.createElementVNode("circle",{cx:"12",cy:"12",r:"9"},null,-1)),l[1]||(l[1]=e.createElementVNode("line",{x1:"12",y1:"8",x2:"12",y2:"16"},null,-1)),l[2]||(l[2]=e.createElementVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"},null,-1))],64)):o.name==="minus"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l[3]||(l[3]=e.createElementVNode("circle",{cx:"12",cy:"12",r:"9"},null,-1)),l[4]||(l[4]=e.createElementVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"},null,-1))],64)):o.name==="delete"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[l[5]||(l[5]=e.createStaticVNode('<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)):o.name==="edit"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[l[6]||(l[6]=e.createElementVNode("path",{d:"M4 20 l4 -1 11 -11 -3 -3 -11 11 z"},null,-1)),l[7]||(l[7]=e.createElementVNode("line",{x1:"14",y1:"6",x2:"18",y2:"10"},null,-1))],64)):o.name==="collapse"?(e.openBlock(),e.createElementBlock("polyline",Tt)):o.name==="expand"?(e.openBlock(),e.createElementBlock("polyline",At)):o.name==="zoom-in"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:6},[l[8]||(l[8]=e.createElementVNode("circle",{cx:"11",cy:"11",r:"7"},null,-1)),l[9]||(l[9]=e.createElementVNode("line",{x1:"11",y1:"8",x2:"11",y2:"14"},null,-1)),l[10]||(l[10]=e.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"},null,-1)),l[11]||(l[11]=e.createElementVNode("line",{x1:"16",y1:"16",x2:"21",y2:"21"},null,-1))],64)):o.name==="zoom-out"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:7},[l[12]||(l[12]=e.createElementVNode("circle",{cx:"11",cy:"11",r:"7"},null,-1)),l[13]||(l[13]=e.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"},null,-1)),l[14]||(l[14]=e.createElementVNode("line",{x1:"16",y1:"16",x2:"21",y2:"21"},null,-1))],64)):o.name==="reset"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:8},[l[15]||(l[15]=e.createElementVNode("circle",{cx:"12",cy:"12",r:"9"},null,-1)),l[16]||(l[16]=e.createElementVNode("circle",{cx:"12",cy:"12",r:"4"},null,-1)),l[17]||(l[17]=e.createElementVNode("circle",{cx:"12",cy:"12",r:"0.8",fill:"currentColor"},null,-1))],64)):o.name==="logo"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:9},[l[18]||(l[18]=e.createStaticVNode('<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)):o.name==="import"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:10},[l[19]||(l[19]=e.createElementVNode("path",{d:"M12 4 V15"},null,-1)),l[20]||(l[20]=e.createElementVNode("polyline",{points:"7 10 12 15 17 10"},null,-1)),l[21]||(l[21]=e.createElementVNode("path",{d:"M4 19 H20"},null,-1))],64)):o.name==="export"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:11},[l[22]||(l[22]=e.createElementVNode("path",{d:"M12 15 V4"},null,-1)),l[23]||(l[23]=e.createElementVNode("polyline",{points:"7 9 12 4 17 9"},null,-1)),l[24]||(l[24]=e.createElementVNode("path",{d:"M4 19 H20"},null,-1))],64)):o.name==="balance"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:12},[l[25]||(l[25]=e.createStaticVNode('<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)):o.name==="mindmap"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:13},[l[26]||(l[26]=e.createStaticVNode('<circle cx="12" cy="12" r="2.2" fill="currentColor" stroke="none"></circle><line x1="13" y1="11" x2="19" y2="6"></line><line x1="13" y1="13" x2="19" y2="18"></line><line x1="11" y1="11" x2="5" y2="6"></line><line x1="11" y1="13" x2="5" y2="18"></line>',5))],64)):o.name==="tree"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:14},[l[27]||(l[27]=e.createStaticVNode('<circle cx="6" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="6" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="18" r="2" fill="currentColor" stroke="none"></circle><line x1="8" y1="12" x2="16" y2="6"></line><line x1="8" y1="12" x2="16" y2="12"></line><line x1="8" y1="12" x2="16" y2="18"></line>',7))],64)):o.name==="org"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:15},[l[28]||(l[28]=e.createStaticVNode('<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)):o.name==="image"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:16},[l[29]||(l[29]=e.createElementVNode("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"},null,-1)),l[30]||(l[30]=e.createElementVNode("circle",{cx:"9",cy:"11",r:"1.6"},null,-1)),l[31]||(l[31]=e.createElementVNode("polyline",{points:"3 17 9 12 13 15 16 13 21 17"},null,-1))],64)):o.name==="x"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:17},[l[32]||(l[32]=e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)),l[33]||(l[33]=e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"},null,-1))],64)):o.name==="link"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:18},[l[34]||(l[34]=e.createElementVNode("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)),l[35]||(l[35]=e.createElementVNode("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)):o.name==="note"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:19},[l[36]||(l[36]=e.createElementVNode("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)),l[37]||(l[37]=e.createElementVNode("line",{x1:"8",y1:"10",x2:"16",y2:"10"},null,-1)),l[38]||(l[38]=e.createElementVNode("line",{x1:"8",y1:"13",x2:"16",y2:"13"},null,-1)),l[39]||(l[39]=e.createElementVNode("line",{x1:"8",y1:"16",x2:"13",y2:"16"},null,-1))],64)):e.createCommentVNode("",!0)],8,Rt))}}),Lt="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",Dt="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",Je=[18,15,13,12],Ht=[700,600,500,400],Pt=[52,40,32,28],Ft=[120,80,60,44],Ot=[.8,.8,.8,.8],Xt=Je.length-1;function qt(o,d){return Math.round(Le(o,d)*Ot[ve(o)])}function ve(o){return Math.min(Xt,Math.max(0,o))}function Le(o,d=14){return Math.round(Je[ve(o)]*d/14*10)/10}function Kt(o,d=14){return Math.round(Pt[ve(o)]*d/14)}const Ce=60,ue=14,U=24;let De=null;function Ut(){if(De)return De;const o=typeof document<"u"?document.createElement("canvas").getContext("2d"):null;return o?(De=o,o):{font:"",measureText:()=>({width:0})}}const Ze=new Map;function Yt(o,d,l){const i=`${l}|${d}|${o}`,c=Ze.get(i);if(c!==void 0)return c;const u=Ut();u.font=`${l} ${d}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;const f=u.measureText(o).width;return Ze.set(i,f),f}const jt=24,Gt=400,Jt=8,Qe=16,Zt=4,Qt=200;function _t(o,d,l){return Math.min(l,Math.max(d,o))}function en(o,d,l){const i=ve(d),c=Le(d,l),u=Math.min(Yt(o.text||"",c,Ht[i]),Qt),f=qt(d,l),p=Math.ceil(u+f*2),y=Kt(d,l);let g=0;if(o.link&&(g+=Qe),o.note&&(g+=Qe),g>0){const P=(o.link?1:0)+(o.note?1:0);g+=Zt*P}const s=p+g,k=Math.round(Ft[i]*l/14);if(!o.image)return{w:Math.max(k,s),h:y};const N=_t(o.image.width,jt,Gt),w=Math.max(k,s,Math.ceil(N+f*2)),z=Math.ceil(o.image.height+Jt+y);return{w,h:z}}function tn(o,d={}){const l=d.mode??"mindmap",i=d.preservePositions===!0,c=d.baseFontSize??14,u=et(o,0,null,1,"right",c);return on(u),nn(u,l,i),u.x=0,u.y=0,ln(u,i)}function nn(o,d,l=!1){if(d==="mindmap"){const i=o.children;if(i.length!==0)if(i.length===1)i[0]._dir="right",i[0].side=1,i[0]._dirRight=1;else{const p=i.reduce((k,N)=>k+N._subtreeH,0);let y=1,g=Math.abs(i[0]._subtreeH-(p-i[0]._subtreeH)),s=0;for(let k=0;k<i.length-1;k++){s+=i[k]._subtreeH;const N=Math.abs(s-(p-s));N<g&&(g=N,y=k+1)}for(let k=0;k<y;k++)i[k]._dir="right",i[k].side=1,i[k]._dirRight=1;for(let k=y;k<i.length;k++)i[k]._dir="left",i[k].side=-1,i[k]._dirRight=-1}const c=o.children.filter(p=>p.side===1),u=o.children.filter(p=>p.side===-1),f=(p,y)=>{const g=y==="right"?1:-1;p._dir=y,p.side=g,p._dirRight=g;for(const s of p.children)f(s,y)};for(const p of c)f(p,"right");for(const p of u)f(p,"left");if(c.length>0){const p={...o,children:c};Se(p,"right",Ce,!0,l)}if(u.length>0){const p={...o,children:u};Se(p,"left",Ce,!0,l)}}else if(d==="tree"){const i=c=>{c.side=1,c._dir="right";for(const u of c.children)i(u)};for(const c of o.children)c._dir="right";Se(o,"right",Ce,!0,l),i(o)}else{for(const i of o.children)i._dir="down";_e(o,Ce,l)}}function Se(o,d,l,i,c=!1){if(o.children.length===0)return;const u=o.children.reduce((g,s,k)=>g+s._subtreeH+(k>0?ue:0),0),f=d==="right"?1:-1,p=i?f:1;let y=o.y-p*u/2;o.children.forEach(g=>{c||(g.x=o.x+f*(o.width/2+l+g.width/2),g.y=y+p*g._subtreeH/2),g._dir=d,y+=p*(g._subtreeH+ue),Se(g,d,l,!1,c)})}function _e(o,d,l=!1){if(o.children.length===0)return;const i=o.children.reduce((u,f,p)=>u+f._subtreeW+(p>0?ue*2:0),0);let c=o.x-i/2;o.children.forEach(u=>{l||(u.x=c+u._subtreeW/2,u.y=o.y+o.height/2+d+u.height/2),u._dir="down",c+=u._subtreeW+ue*2,_e(u,d,l)})}function et(o,d,l,i,c,u){const f=en(o,d,u),p={id:o.id,text:o.text,depth:d,x:o._x??0,y:o._y??0,width:f.w,height:f.h,fontSize:Le(d,u),isRoot:d===0,collapsed:o.collapsed,side:i,_dir:c,_dirRight:i,_subtreeH:f.h,_subtreeW:f.w,image:o.image?{...o.image}:void 0,link:o.link?{url:o.link.url}:void 0,note:o.note?{text:o.note.text}:void 0,children:[],parent:l};if(o.collapsed)return p;const y=o.children.length,g=Math.ceil(y/2);return p.children=o.children.map((s,k)=>{const N=d===0?k<g?1:-1:i;return et(s,d+1,p,N,c,u)}),p}function on(o){const d=[o];for(let l=0;l<d.length;l++){const i=d[l];for(const c of i.children)d.push(c)}for(let l=d.length-1;l>=0;l--){const i=d[l];if(i.collapsed||i.children.length===0){i._subtreeH=i.height,i._subtreeW=i.width;continue}let c=0,u=0;for(const f of i.children)c+=f._subtreeH,u+=f._subtreeW;i.children.length>1&&(c+=ue*(i.children.length-1),u+=ue*2*(i.children.length-1)),i._subtreeH=Math.max(i.height,c),i._subtreeW=Math.max(i.width,u)}}function ln(o,d=!1){const l=[o];let i=1/0,c=-1/0,u=1/0,f=-1/0;for(;l.length;){const g=l.pop(),s=g.width/2,k=g.height/2;g.x-s<i&&(i=g.x-s),g.x+s>c&&(c=g.x+s),g.y-k<u&&(u=g.y-k),g.y+k>f&&(f=g.y+k),l.push(...g.children)}if(d)return{root:o,width:c-i+U*2,height:f-u+U*2,vbX:i-U,vbY:u-U,vbW:c-i+U*2,vbH:f-u+U*2};const p=U-u,y=[o];for(;y.length;){const g=y.pop();g.y+=p,y.push(...g.children)}return u+=p,f+=p,{root:o,width:c-i+U*2,height:f+U,vbX:i-U,vbY:0,vbW:c-i+U*2,vbH:f+U}}const ke=[{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 rn(o,d=[]){return[...ke,...d].find(i=>i.id===o)??ke[0]}function oe(){return"n_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function _(o){return JSON.parse(JSON.stringify(o))}function S(o,d){if(o.id===d)return o;for(const l of o.children){const i=S(l,d);if(i)return i}return null}function Y(o,d,l=null){if(o.id===d)return l;for(const i of o.children){const c=Y(i,d,o);if(c!==null)return c}return null}function He(o,d){const l=o.children.findIndex(i=>i.id===d);if(l>=0)return o.children.splice(l,1),!0;for(const i of o.children)if(He(i,d))return!0;return!1}function an(o,d,l){const i=S(o,d);return!i||i.text===l?!1:(i.text=l,!0)}function cn(o,d,l,i){if(!Y(o,d)||d===l||S(S(o,d),l))return!1;const c=Y(o,d),u=c.children.findIndex(g=>g.id===d);if(u<0)return!1;const[f]=c.children.splice(u,1);if(i==="child"){const g=S(o,l);return g?(g.children.push(f),!0):(c.children.splice(u,0,f),!1)}const p=Y(o,l);if(!p)return c.children.splice(u,0,f),!1;let y=p.children.findIndex(g=>g.id===l);return y<0?(c.children.splice(u,0,f),!1):(i==="after"&&(y+=1),p.children.splice(y,0,f),!0)}function tt(o){const d=/^新节点(?:\s+(\d+))?$/;let l=0,i=!1;for(const c of o.children){const u=c.text.match(d);if(u)if(u[1]){const f=parseInt(u[1],10);f>l&&(l=f)}else i=!0}return l===0&&!i?Ve:l>0?`新节点 ${l+1}`:"新节点 2"}function nt(o,d,l){const i=S(o,d);if(!i)return null;const c={id:oe(),text:l??tt(i),children:[]};return i.children.push(c),c}function ot(o,d,l){const i=Y(o,d);if(!i)return null;const c=i.children.findIndex(f=>f.id===d);if(c<0)return null;const u={id:oe(),text:l??tt(i),children:[]};return i.children.splice(c+1,0,u),u}function sn(o,d,l){const i=Y(o,d);if(!i)return null;const c=i.children.findIndex(f=>f.id===d);if(c<0)return null;const u={id:oe(),text:l,children:[]};return i.children.splice(c,0,u),u}function dn(o,d){const l=Y(o,d);if(!l)return null;const i=l.children.findIndex(f=>f.id===d);if(i<0)return null;const c=l.children[i],u=_(c);return it(u),l.children.splice(i+1,0,u),u}function it(o){o.id=oe();for(const d of o.children)it(d)}const Ve="新节点";function Pe(o,d="导入的导图"){const l=o.split(/\r?\n/),i={id:oe(),text:d,children:[]},c=[i],u=[-1/0],f=[],p=/^(#{1,6})\s+(.+?)\s*#*\s*$/,y=/^!\[([^\]]*)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,g=/^\[([^\]]+)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,s=/^(`{3,}|~{3,})\s*(\S+)?\s*$/;let k=!1,N=[],w=null;function z(b){N.push(b)}function P(){if(w&&N.length>0){for(;N.length>0&&N[0].trim()==="";)N.shift();for(;N.length>0&&N[N.length-1].trim()==="";)N.pop();const b=N.join(`
|
|
2
|
-
`);b&&(w.note={text:b})}
|
|
3
|
-
`;
|
|
4
|
-
`),
|
|
5
|
-
`),o.note&&(l+="```note\n"+o.note.text+"\n```\n");for(const i of o.children)l+=ze(i,d+1);return l}function un(o){const d=o.minScale??.2,l=o.maxScale??3,i=o.step??1.2,c=e.ref(1),u=e.ref(0),f=e.ref(0),p=e.ref(!1),y=e.reactive({x:0,y:0,ox:0,oy:0}),g=e.ref(!1),s=e.reactive({x:0,y:0}),k=e.reactive({x:0,y:0,width:0,height:0}),N=e.ref(0);let w=null;function z(v){w=v}function P(v){v.preventDefault();const C=o.getContainer();if(!C)return;const O=-v.deltaY*.001,q=Math.min(l,Math.max(d,c.value*(1+O))),j=C.getBoundingClientRect(),G=v.clientX-j.left,me=v.clientY-j.top,be=(G-u.value)/c.value,he=(me-f.value)/c.value;c.value=q,u.value=G-be*q,f.value=me-he*q}function ie(){c.value=Math.min(l,c.value*i)}function ee(){c.value=Math.max(d,c.value/i)}function b(v){var O;v.target.closest(".zm-node, .zm-toolbar, button, input, textarea")||(p.value=!0,y.x=v.clientX,y.y=v.clientY,y.ox=u.value,y.oy=f.value,window.addEventListener("mousemove",F),window.addEventListener("mouseup",L),(O=v.preventDefault)==null||O.call(v))}function F(v){p.value&&(u.value=y.ox+(v.clientX-y.x),f.value=y.oy+(v.clientY-y.y))}function L(){p.value=!1,window.removeEventListener("mousemove",F),window.removeEventListener("mouseup",L)}function $(v,C){g.value=!0,s.x=v,s.y=C,k.x=v,k.y=C,k.width=0,k.height=0,N.value++,window.addEventListener("mousemove",Q),window.addEventListener("mouseup",D)}function Z(v,C){if(!g.value)return;const O=Math.min(s.x,v),q=Math.min(s.y,C),j=Math.max(s.x,v),G=Math.max(s.y,C);k.x=O,k.y=q,k.width=j-O,k.height=G-q,N.value++}function D(){g.value=!1,window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",D),w&&w()}function Q(v){if(!g.value)return;const C=o.getContainer();if(!C)return;const O=C.getBoundingClientRect(),q=(v.clientX-O.left-u.value)/c.value,j=(v.clientY-O.top-f.value)/c.value;Z(q,j)}function ae(v,C,O,q=60){const j=o.getContainer();if(!j)return;const G=j.getBoundingClientRect(),me=(G.width-q*2)/v,be=(G.height-q*2)/C,he=Math.min(1,Math.max(.3,Math.min(me,be)));c.value=he,u.value=G.width/2,f.value=G.height/2-O*he}return{scale:c,offsetX:u,offsetY:f,isPanning:p,onWheel:P,zoomIn:ie,zoomOut:ee,startPan:b,startMarquee:$,updateMarquee:Z,isMarquee:g,marquee:k,marqueeVersion:N,setOnMarqueeEnd:z,resetView:ae}}const fn=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function lt(o){return fn?o.metaKey:o.ctrlKey}function mn(o){function d(){const i=o.getSelectedId();return i||(o.defaultTargetId?o.defaultTargetId():o.getRootId())}function l(i){const c=i.target;if(c&&(c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)||o.isReadonly()||o.isEditing())return;const u=o.getSelectedId(),f=d();if(f){if(lt(i)&&!i.shiftKey){if(i.key==="d"||i.key==="D"){u&&u!==o.getRootId()&&(i.preventDefault(),o.onDuplicate(u));return}if(i.key==="z"||i.key==="Z"){i.preventDefault(),o.onUndo();return}if(i.key==="y"||i.key==="Y"){i.preventDefault(),o.onRedo();return}if(i.key==="Home"){i.preventDefault(),o.onSelectRoot();return}}if(lt(i)&&i.shiftKey&&(i.key==="Z"||i.key==="z")){i.preventDefault(),o.onRedo();return}i.key==="Tab"?(i.preventDefault(),o.onAddChild(f)):i.key==="Enter"?(i.preventDefault(),i.shiftKey?u&&u!==o.getRootId()&&o.onAddSiblingBefore(u):o.onAddSibling(f)):(i.key==="Delete"||i.key==="Backspace")&&u&&u!==o.getRootId()?(i.preventDefault(),o.onRemove(u)):i.key==="F2"&&u?(i.preventDefault(),o.onStartEdit(u)):i.key==="Escape"?(i.preventDefault(),o.onClearSelection()):i.key==="ArrowDown"?(i.preventDefault(),o.onNavigate(0,1)):i.key==="ArrowUp"?(i.preventDefault(),o.onNavigate(0,-1)):i.key==="ArrowRight"?(i.preventDefault(),o.onNavigate(1,0)):i.key==="ArrowLeft"&&(i.preventDefault(),o.onNavigate(-1,0))}}e.onMounted(()=>{window.addEventListener("keydown",l)}),e.onBeforeUnmount(()=>{window.removeEventListener("keydown",l)})}function hn(o=100){const d=e.ref([]);let l=-1;function i(){return l>0}function c(){return l<d.value.length-1}function u(g){const s=JSON.stringify(g);for(l<d.value.length-1&&(d.value=d.value.slice(0,l+1)),d.value.push(s),l=d.value.length-1;d.value.length>o;)d.value.shift(),l--}function f(){return i()?(l--,JSON.parse(d.value[l])):null}function p(){return c()?(l++,JSON.parse(d.value[l])):null}function y(){d.value=[],l=-1}return{canUndo:i,canRedo:c,record:u,undo:f,redo:p,reset:y}}const gn=["disabled"],yn=["disabled"],xn=["disabled"],pn=["disabled"],kn=["disabled"],wn=["disabled"],bn=e.defineComponent({__name:"NodeContextMenu",props:{x:{},y:{},container:{},hasImage:{type:Boolean,default:!1},hasLink:{type:Boolean,default:!1},hasNote:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1}},emits:["pickImage","setLink","removeLink","editNote","removeNote","removeImage","close"],setup(o,{emit:d}){const l=o,i=d,c=e.computed(()=>{let N=l.x+2,w=l.y+2;if(l.container){const z=l.container.getBoundingClientRect(),P=180,ie=u.value?f.value?184:160:136;N+P>z.right&&(N=Math.max(z.left+4,l.x-P-2)),w+ie>z.bottom&&(w=Math.max(z.top+4,l.y-ie-2)),N<z.left+2&&(N=z.left+2),w<z.top+2&&(w=z.top+2)}return{left:N,top:w}}),u=e.computed(()=>l.hasImage),f=e.computed(()=>l.hasLink),p=e.computed(()=>l.hasNote);function y(N){const w=N.target;w&&w.closest(".zm-node-menu")||i("close")}function g(N){N.key==="Escape"&&i("close")}function s(){i("close")}window.addEventListener("mousedown",y,!0),window.addEventListener("keydown",g,!0),window.addEventListener("wheel",s,!0),window.addEventListener("scroll",s,!0),e.onBeforeUnmount(()=>{window.removeEventListener("mousedown",y,!0),window.removeEventListener("keydown",g,!0),window.removeEventListener("wheel",s,!0),window.removeEventListener("scroll",s,!0)});function k(N){l.readonly||(N(),i("close"))}return(N,w)=>(e.openBlock(),e.createElementBlock("div",{class:"zm-node-menu",style:e.normalizeStyle({left:c.value.left+"px",top:c.value.top+"px"}),onContextmenu:w[6]||(w[6]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("button",{class:"zm-node-menu-item",disabled:o.readonly,onClick:w[0]||(w[0]=e.withModifiers(z=>k(()=>i("pickImage")),["stop"]))},[e.createVNode(R,{name:"image",size:13}),e.createElementVNode("span",null,e.toDisplayString(u.value?"替换图片":"添加图片"),1)],8,gn),u.value?(e.openBlock(),e.createElementBlock("button",{key:0,class:"zm-node-menu-item",disabled:o.readonly,onClick:w[1]||(w[1]=e.withModifiers(z=>k(()=>i("removeImage")),["stop"]))},[e.createVNode(R,{name:"x",size:13}),w[7]||(w[7]=e.createElementVNode("span",null,"移除图片",-1))],8,yn)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"zm-node-menu-item",disabled:o.readonly,onClick:w[2]||(w[2]=e.withModifiers(z=>k(()=>i("setLink")),["stop"]))},[e.createVNode(R,{name:"link",size:13}),e.createElementVNode("span",null,e.toDisplayString(f.value?"编辑链接":"添加链接"),1)],8,xn),f.value?(e.openBlock(),e.createElementBlock("button",{key:1,class:"zm-node-menu-item",disabled:o.readonly,onClick:w[3]||(w[3]=e.withModifiers(z=>k(()=>i("removeLink")),["stop"]))},[e.createVNode(R,{name:"x",size:13}),w[8]||(w[8]=e.createElementVNode("span",null,"移除链接",-1))],8,pn)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"zm-node-menu-item",disabled:o.readonly,onClick:w[4]||(w[4]=e.withModifiers(z=>k(()=>i("editNote")),["stop"]))},[e.createVNode(R,{name:"note",size:13}),e.createElementVNode("span",null,e.toDisplayString(p.value?"编辑笔记":"添加笔记"),1)],8,kn),p.value?(e.openBlock(),e.createElementBlock("button",{key:2,class:"zm-node-menu-item",disabled:o.readonly,onClick:w[5]||(w[5]=e.withModifiers(z=>k(()=>i("removeNote")),["stop"]))},[e.createVNode(R,{name:"x",size:13}),w[9]||(w[9]=e.createElementVNode("span",null,"移除笔记",-1))],8,wn)):e.createCommentVNode("",!0)],36))}}),En=["viewBox","width","height"],Nn={class:"zm-edges"},Mn=["d","fill"],Bn=["data-node-id","onClick","onDblclick","onContextmenu","onMouseenter","onMouseleave"],vn=["src","width","height","alt"],Cn={key:1,class:"zm-text"},Sn={class:"zm-text-label"},Vn=["href","title"],zn=["title","onClick"],In=["title"],Wn=["title","onClick"],$n=["onClick"],Rn=["onMousedown"],Tn=["onClick"],An={key:0,class:"zm-toolbar"},Ln=["src"],Dn=["src"],Hn={class:"zm-tb-tip"},fe=24,we=400,re=160,rt=e.defineComponent({__name:"MindMap",props:{data:{},readonly:{type:Boolean,default:!1},theme:{},previewMode:{type:Boolean,default:!1},markdown:{},lineColors:{}},emits:["change","select","edit-note","markdownChange"],setup(o,{expose:d,emit:l}){const i=o,c=l,u=e.ref(null),f=e.ref(null),p=e.ref(""),y=e.ref(null),g=e.ref(new Set),s=e.ref(_(i.data)),k=e.ref(i.markdown!==void 0);let N=!1;e.watch(()=>i.markdown,t=>{if(t===void 0){k.value=!1;return}k.value=!0;const n=Pe(t||"");N=!0,s.value=_(n),y.value=null,g.value=new Set,W(),e.nextTick(()=>{N=!1,te()})}),e.watch(s,()=>{k.value&&!N&&c("markdownChange",ze(s.value))},{deep:!0});const w=e.computed(()=>E.showOrderBadge===!0),z=e.ref(new Map),P=z.value;function ie(t,n){const a={};n.bg&&(a.bg=n.bg),n.textColor&&(a.textColor=n.textColor),n.borderColor&&(a.borderColor=n.borderColor),n.fontWeight&&(a.fontWeight=n.fontWeight),Object.keys(a).length===0?P.delete(t):P.set(t,a),z.value=new Map(P)}function ee(t){return P.get(t)??{}}function b(t,n){const a=S(s.value,t);a&&(a.image={src:n.src,naturalW:n.naturalW,naturalH:n.naturalH,width:L(n.width,fe,we),height:L(n.height,fe,we)},H(),W(),c("change",s.value))}function F(t){const n=S(s.value,t);!n||!n.image||(delete n.image,H(),W(),c("change",s.value))}function L(t,n,a){return Math.min(a,Math.max(n,t))}function $(t,n){const a=new FileReader;a.onload=()=>{if(typeof a.result!="string")return;const h=a.result,m=new window.Image;m.onload=()=>{const r=m.naturalWidth||re,x=m.naturalHeight||re,V=L(r,fe,re),A=L(Math.round(x*V/r),fe,we);n({src:h,naturalW:r,naturalH:x,width:V,height:A})},m.onerror=()=>{n({src:h,naturalW:re,naturalH:re,width:re,height:re})},m.src=h},a.readAsDataURL(t)}function Z(t){const n=document.createElement("input");n.type="file",n.accept="image/*",n.style.display="none",n.onchange=()=>{var h;const a=(h=n.files)==null?void 0:h[0];a&&($(a,m=>b(t,m)),document.body.removeChild(n))},document.body.appendChild(n),n.click()}function D(t,n){const a=n.trim(),h=S(s.value,t);h&&(a?h.link={url:a}:delete h.link,H(),W(),c("change",s.value))}function Q(t){D(t,"")}function ae(t,n){const a=S(s.value,t);a&&(n?a.note={text:n}:delete a.note,H(),W(),c("change",s.value))}function v(t){ae(t,"")}const C=e.ref(null);function O(t,n){i.readonly||(t.preventDefault(),t.stopPropagation(),y.value=n.id,c("select",S(s.value,n.id)),C.value={nodeId:n.id,x:t.clientX,y:t.clientY})}function q(){C.value=null}function j(){var n;const t=(n=C.value)==null?void 0:n.nodeId;t&&Z(t)}function G(){var h,m,r;const t=(h=C.value)==null?void 0:h.nodeId;if(!t)return;const n=((r=(m=S(s.value,t))==null?void 0:m.link)==null?void 0:r.url)??"",a=window.prompt("输入链接 URL(留空取消)",n);a!==null&&D(t,a)}function me(){var n;const t=(n=C.value)==null?void 0:n.nodeId;t&&Q(t)}function be(){var n;const t=(n=C.value)==null?void 0:n.nodeId;t&&at(t)}function he(){var n;const t=(n=C.value)==null?void 0:n.nodeId;t&&v(t)}function Fn(){var n;const t=(n=C.value)==null?void 0:n.nodeId;t&&F(t)}function at(t){i.readonly||c("edit-note",t)}function On(t,n=60){const a=t.replace(/\s+/g," ").trim();return a.length<=n?a||"点击编辑笔记":a.slice(0,n)+"…"}function ct(t){var m;if(i.readonly||f.value)return;const n=t.target;if(n&&(n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.isContentEditable))return;const a=y.value;if(!a)return;const h=(m=t.clipboardData)==null?void 0:m.items;if(h)for(let r=0;r<h.length;r++){const x=h[r];if(x.kind==="file"&&x.type.startsWith("image/")){const V=x.getAsFile();if(!V)continue;t.preventDefault();const A=S(s.value,a);if(A!=null&&A.image&&!window.confirm("该节点已有图片,要用剪贴板里的图片替换吗?"))return;$(V,X=>b(a,X));return}}}e.onMounted(()=>{window.addEventListener("paste",ct)}),e.onBeforeUnmount(()=>{window.removeEventListener("paste",ct)});const Ee=e.ref(null),Xn=e.computed(()=>{var t;return((t=Ee.value)==null?void 0:t.nodeId)??null});function qn(t,n){if(!n.image)return;t.preventDefault(),t.stopPropagation();const a=n.image.naturalW||n.image.width,h=n.image.naturalH||n.image.height,m=h>0?h/a:1;Ee.value={nodeId:n.id,startX:t.clientX,startY:t.clientY,startW:n.image.width,startH:n.image.height,naturalW:a,naturalH:h,ratio:m,pendingW:n.image.width,pendingH:n.image.height},window.addEventListener("mousemove",st),window.addEventListener("mouseup",dt)}function st(t){var A,X;const n=Ee.value;if(!n)return;const a=M.scale.value||1,h=t.clientX-n.startX,m=L(n.startW+h/a,fe,we),r=L(m*n.ratio,fe,we);n.pendingW=m,n.pendingH=r;const x=(A=u.value)==null?void 0:A.querySelector(`[data-node-id="${n.nodeId}"] .zm-node-img`);x&&(x.style.width=`${m}px`,x.style.height=`${r}px`);const V=(X=u.value)==null?void 0:X.querySelector(`[data-node-id="${n.nodeId}"]`);V&&(V.style.minWidth=`${Math.max(80,Math.ceil(m+28))}px`,V.style.height=`${Math.ceil(r+8+30)}px`)}function dt(){const t=Ee.value;if(window.removeEventListener("mousemove",st),window.removeEventListener("mouseup",dt),Ee.value=null,!t)return;const n=S(s.value,t.nodeId);!n||!n.image||(b(t.nodeId,{src:n.image.src,naturalW:n.image.naturalW,naturalH:n.image.naturalH,width:t.pendingW,height:t.pendingH}),y.value=t.nodeId,c("select",n),Oe=!0)}const Fe=e.ref(null);let Oe=!1;function Kn(t){Fe.value=t}function Un(t){Fe.value===t&&(Fe.value=null)}const ut=e.ref(0),Xe=e.ref(!1),le=hn(100);function H(){le.record({data:s.value})}function W(){g.value=new Set(g.value),ut.value++}const J=e.computed(()=>{var t,n,a,h,m,r,x,V,A,X;return{rootBg:((t=i.theme)==null?void 0:t.rootBg)??"#1f2937",rootText:((n=i.theme)==null?void 0:n.rootText)??"#ffffff",branchBg:((a=i.theme)==null?void 0:a.branchBg)??"#ffffff",branchText:((h=i.theme)==null?void 0:h.branchText)??"#1f2937",lineColor:((m=i.theme)==null?void 0:m.lineColor)??"#94a3b8",bgColor:((r=i.theme)==null?void 0:r.bgColor)??"#f8fafc",fontSize:((x=i.theme)==null?void 0:x.fontSize)??14,lineWidthStart:((V=i.theme)==null?void 0:V.lineWidthStart)??2.2,lineWidthEnd:((A=i.theme)==null?void 0:A.lineWidthEnd)??.8,rainbowBranch:((X=i.theme)==null?void 0:X.rainbowBranch)??!1}}),E=e.reactive({autoBalanceOnChange:!0,lineWidthStart:12,lineWidthEnd:3.6,rainbowBranch:!0,branchPaletteId:"default",customPalettes:[],lineStyle:"curve",layoutMode:"mindmap",taperedEdge:!0,showOrderBadge:!1});function ft(t){return E.taperedEdge?Yn(t):ht(t)}function mt(t){return E.taperedEdge?E.lineWidthEnd:ht(t)}function Yn(t){return t<=0?E.lineWidthStart:t===1?Math.max(1.5,E.lineWidthStart*.67):t===2?Math.max(.8,E.lineWidthStart*.42):E.lineWidthEnd}function ht(t){if(t<=0)return E.lineWidthStart;if(t>=3)return E.lineWidthEnd;const n=t/3;return E.lineWidthStart+(E.lineWidthEnd-E.lineWidthStart)*n}function jn(t,n,a,h){const m=1-t,r=m*m*m*n.x+3*m*m*t*a.x1+3*m*t*t*a.x2+t*t*t*h.x,x=m*m*m*n.y+3*m*m*t*a.y1+3*m*t*t*a.y2+t*t*t*h.y;return{x:r,y:x}}function Gn(t,n,a,h,m=32,r="curve",x="right"){if(r==="curve"){let de;if(x==="right"||x==="left"){const I=Math.abs(n.x-t.x)*.45,ne=x==="right"?1:-1;de={x1:t.x+ne*I,y1:t.y,x2:n.x-ne*I,y2:n.y}}else{const I=Math.abs(n.y-t.y)*.45;de={x1:t.x,y1:t.y+I,x2:n.x,y2:n.y-I}}const ko=B=>{const I=1-B,ne=-3*I*I*t.x+3*(I*I-2*I*B)*de.x1+3*(2*I*B-B*B)*de.x2+3*B*B*n.x,pe=-3*I*I*t.y+3*(I*I-2*I*B)*de.y1+3*(2*I*B-B*B)*de.y2+3*B*B*n.y;return{dx:ne,dy:pe}},Be=[],Ge=[];for(let B=0;B<=m;B++){const I=B/m,ne=B===0?t:B===m?n:jn(I,t,de,n),pe=ko(I);let Te=Math.hypot(pe.dx,pe.dy);Te<1e-6&&(Te=1);const Wt=-pe.dy/Te,$t=pe.dx/Te,Ae=(a+(h-a)*I)/2;Be.push({x:ne.x+Wt*Ae,y:ne.y+$t*Ae}),Ge.push({x:ne.x-Wt*Ae,y:ne.y-$t*Ae})}let Re=`M ${Be[0].x.toFixed(2)} ${Be[0].y.toFixed(2)}`;for(let B=1;B<=m;B++)Re+=` L ${Be[B].x.toFixed(2)} ${Be[B].y.toFixed(2)}`;for(let B=m;B>=0;B--)Re+=` L ${Ge[B].x.toFixed(2)} ${Ge[B].y.toFixed(2)}`;return Re+=" Z",Re}const V=n.x-t.x,A=n.y-t.y;let X=Math.hypot(V,A);X<1e-6&&(X=1);const se=-A/X,ye=V/X,xe=a/2,Me=h/2,St={x:t.x+se*xe,y:t.y+ye*xe},Vt={x:t.x-se*xe,y:t.y-ye*xe},zt={x:n.x-se*Me,y:n.y-ye*Me},It={x:n.x+se*Me,y:n.y+ye*Me};return`M ${St.x.toFixed(2)} ${St.y.toFixed(2)} L ${It.x.toFixed(2)} ${It.y.toFixed(2)} L ${zt.x.toFixed(2)} ${zt.y.toFixed(2)} L ${Vt.x.toFixed(2)} ${Vt.y.toFixed(2)} Z`}const Ie=e.computed(()=>K.value.root.children),Jn=ke[0].colors,gt=e.computed(()=>rn(E.branchPaletteId,E.customPalettes)),ce=e.computed(()=>{const t=new Map;if(!E.rainbowBranch)return t;const n=i.lineColors,a=n&&n.length>0?n:gt.value.colors.length>0?gt.value.colors:Jn;for(let m=0;m<Ie.value.length;m++){const r=Ie.value[m];t.set(r.id,a[m%a.length])}const h=(m,r)=>{t.set(m.id,r);for(const x of m.children)h(x,r)};for(let m=0;m<Ie.value.length;m++){const r=Ie.value[m];h(r,a[m%a.length])}return t});function Zn(t,n){return E.rainbowBranch?ce.value.get(n.id)??J.value.lineColor:J.value.lineColor}function Qn(t){const n=ee(t.id);if(n.bg)return n.bg;if(t.isRoot)return J.value.rootBg;if(E.rainbowBranch){const a=ce.value.get(t.id);if(a)return no(a,.18)}return J.value.branchBg}function _n(t){const n=ee(t.id);if(n.textColor)return n.textColor;if(t.isRoot)return J.value.rootText;if(E.rainbowBranch){const a=ce.value.get(t.id);if(a)return yt(a,.55)}return J.value.branchText}function eo(t){const n=ee(t.id);if(n.borderColor)return n.borderColor;if(t.isRoot)return J.value.rootBg;if(E.rainbowBranch){const a=ce.value.get(t.id);if(a)return yt(a,.3)}return J.value.lineColor}function to(t){return ee(t.id).fontWeight??(t.isRoot?600:400)}function no(t,n){const a=t.replace("#",""),h=a.length===6?a:a.split("").map(V=>V+V).join(""),m=parseInt(h.slice(0,2),16),r=parseInt(h.slice(2,4),16),x=parseInt(h.slice(4,6),16);return`rgba(${m}, ${r}, ${x}, ${n})`}function yt(t,n){const a=t.replace("#",""),h=a.length===6?a:a.split("").map(V=>V+V).join(""),m=Math.round(parseInt(h.slice(0,2),16)*(1-n)),r=Math.round(parseInt(h.slice(2,4),16)*(1-n)),x=Math.round(parseInt(h.slice(4,6),16)*(1-n));return`rgb(${m}, ${r}, ${x})`}const M=un({getContainer:()=>u.value});M.setOnMarqueeEnd(ho),mn({isEditing:()=>f.value!==null,isReadonly:()=>i.readonly,getSelectedId:()=>y.value,getRootId:()=>s.value.id,defaultTargetId:()=>s.value.id,onAddChild:ge,onAddSibling:$e,onAddSiblingBefore:kt,onRemove:bt,onStartEdit:Ne,onClearSelection:()=>{y.value=null,c("select",null)},onDuplicate:wt,onUndo:Ke,onRedo:Ue,onNavigate:ao,onSelectRoot:()=>{y.value=s.value.id;const t=S(s.value,s.value.id);t&&c("select",t)}});const K=e.computed(()=>{const t=_(s.value);return pt(t),tn(t,{mode:E.layoutMode,baseFontSize:J.value.fontSize})}),xt=e.ref([]),qe=e.computed(()=>(ut.value,xt.value));e.watch(K,t=>{const n=[],a=h=>{n.push(h);for(const m of h.children)a(m)};a(t.root),xt.value=n},{immediate:!0});const oo=e.computed(()=>{const t=[];for(const n of qe.value)for(const a of n.children)t.push({from:n,to:a,key:`${n.id}->${a.id}`});return t}),io=e.computed(()=>`${K.value.vbX} ${K.value.vbY} ${K.value.vbW} ${K.value.vbH}`);function pt(t){if(g.value.has(t.id)){t.children=[],t.collapsed=!0;return}t.collapsed=!1;for(const n of t.children)pt(n)}function Ne(t){const n=S(s.value,t);n&&(f.value=t,p.value=n.text,e.nextTick(()=>{const a=document.querySelector(".zm-input");a==null||a.focus(),a==null||a.select()}))}function We(t={}){if(!f.value)return;const n=S(s.value,f.value);n&&n.text!==(p.value.trim()||" ")&&(n.text=p.value.trim()||" ",H(),c("change",s.value));const a=f.value;f.value=null,t.addChild?e.nextTick(()=>ge(a)):t.addSibling==="after"?e.nextTick(()=>$e(a)):t.addSibling==="before"&&e.nextTick(()=>kt(a))}function lo(){f.value=null}function ro(t){const n=t.metaKey||t.ctrlKey;n&&(t.key==="z"||t.key==="Z")&&!t.shiftKey?(t.preventDefault(),Ke()):(n&&t.shiftKey&&(t.key==="z"||t.key==="Z")||n&&(t.key==="y"||t.key==="Y")&&!t.shiftKey)&&(t.preventDefault(),Ue())}function ge(t){const n=nt(s.value,t,Ve);n&&(H(),W(),c("change",s.value),e.nextTick(()=>Ne(n.id)))}function $e(t){if(t===s.value.id){ge(t);return}const n=ot(s.value,t,Ve);n&&(H(),W(),c("change",s.value),e.nextTick(()=>Ne(n.id)))}function kt(t){if(t===s.value.id){ge(t);return}const n=sn(s.value,t,Ve);n&&(H(),W(),c("change",s.value),e.nextTick(()=>Ne(n.id)))}function wt(t){if(t===s.value.id)return;const n=dn(s.value,t);n&&(H(),y.value=n.id,c("change",s.value),W())}function Ke(){const t=le.undo();t&&(s.value=t.data,y.value=null,c("select",null),W(),c("change",s.value))}function Ue(){const t=le.redo();t&&(s.value=t.data,y.value=null,c("select",null),W(),c("change",s.value))}function ao(t,n){const a=y.value??s.value.id,h=S(s.value,a);if(!h)return;let m=null;if(n===1){const r=Y(s.value,h.id);if(r){const x=r.children.findIndex(V=>V.id===h.id);x>=0&&x<r.children.length-1&&(m=r.children[x+1].id)}}else if(n===-1){const r=Y(s.value,h.id);if(r){const x=r.children.findIndex(V=>V.id===h.id);x>0&&(m=r.children[x-1].id)}}else if(t===1){const r=Y(s.value,h.id);r&&(m=r.id)}else t===-1&&h.children.length>0&&(m=h.children[0].id);if(m){y.value=m;const r=S(s.value,m);r&&c("select",r)}}function bt(t){t!==s.value.id&&He(s.value,t)&&(H(),y.value===t&&(y.value=null),W(),c("change",s.value))}function Et(t){g.value.has(t)?g.value.delete(t):g.value.add(t),W()}function co(t,n){an(s.value,t,n)&&(H(),W(),c("change",s.value))}function so(t,n,a){return cn(s.value,t,n,a)?(H(),W(),c("change",s.value),!0):!1}function uo(t,n){t.stopPropagation(),y.value=n.id;const a=S(s.value,n.id);c("select",a)}function fo(t){const n=t.target;if(!n||n.closest(".zm-node, .zm-toolbar, button, input, textarea"))return;if(t.button===2){M.startPan(t);return}if(t.button!==0)return;const a=u.value.getBoundingClientRect(),h=(t.clientX-a.left-M.offsetX.value)/M.scale.value,m=(t.clientY-a.top-M.offsetY.value)/M.scale.value;M.startMarquee(h,m)}function mo(t){if(Oe){Oe=!1;return}const n=t.target;if(!n||n.closest(".zm-node"))return;const a=M.marquee;a.width>=4||a.height>=4||y.value!==null&&(y.value=null,c("select",null))}function ho(){const t=M.marquee;if(t.width<4&&t.height<4)return;const n=t.x,a=t.y,h=t.x+t.width,m=t.y+t.height,r=[];for(const x of qe.value){const V=x.width/2,A=x.height/2,X=x.x-V,se=x.x+V,ye=x.y-A,xe=x.y+A;X<=h&&se>=n&&ye<=m&&xe>=a&&r.push(x.id)}if(r.length>0){y.value=r[0];const x=S(s.value,r[0]);x&&c("select",x)}}function Nt(t){return g.value.has(t)}function go(t){const n=S(s.value,t.id);return!!n&&n.children.length>0}function Ye(t){const n=S(s.value,t);return n?n.children.length:0}function Mt(t){if(!S(s.value,t))return 0;const h=[s.value];for(;h.length;){const m=h.pop(),r=m.children.findIndex(x=>x.id===t);if(r>=0)return r;for(const x of m.children)h.push(x)}return 0}function Bt(t,n,a,h){if(((h==null?void 0:h._dir)??t._dir)==="down")return n==="out"?{x:t.x,y:t.y+t.height/2}:{x:t.x,y:t.y-t.height/2};let r;return n==="in"?r=-t.side:a!==void 0?r=a:r=t.side,{x:t.x+r*(t.width/2),y:t.y}}function te(){const t=K.value;M.resetView(t.width,t.height,t.root.y)}function yo(){Xe.value=!0,H(),W(),e.nextTick(()=>te())}function je(t){E.layoutMode!==t&&(E.layoutMode=t,W(),e.nextTick(()=>te()))}function vt(){return JSON.stringify(s.value,null,2)}function Ct(t){try{const n=JSON.parse(t);return!n.id||!Array.isArray(n.children)?!1:(le.reset(),s.value=_(n),y.value=null,g.value=new Set,W(),e.nextTick(()=>te()),c("change",s.value),!0)}catch{return!1}}function xo(){const t=document.createElement("input");t.type="file",t.accept="application/json",t.onchange=()=>{var h;const n=(h=t.files)==null?void 0:h[0];if(!n)return;const a=new FileReader;a.onload=()=>{typeof a.result=="string"&&(Ct(a.result)||alert("导入失败:JSON 格式无效"))},a.readAsText(n)},t.click()}function po(){const t=new Blob([vt()],{type:"application/json"}),n=URL.createObjectURL(t),a=document.createElement("a");a.href=n,a.download=`${s.value.text||"mindmap"}.json`,a.click(),URL.revokeObjectURL(n)}return d({addChild:t=>ge(t),addSibling:t=>$e(t),removeNode:t=>bt(t),duplicateNode:t=>wt(t),setNodeText:(t,n)=>co(t,n),moveNode:(t,n,a)=>so(t,n,a),lineWidthForDepth:ft,endWidthForDepth:mt,getData:()=>s.value,setData:t=>{le.reset(),s.value=_(t),y.value=null,g.value=new Set,W(),H(),e.nextTick(()=>te())},resetView:()=>te(),exportData:vt,importData:Ct,getMarkdown:()=>ze(s.value),setMarkdown:(t,n=!0)=>{const a=Pe(t||"");n&&(k.value=!0),N=!n,le.reset(),s.value=_(a),y.value=null,g.value=new Set,W(),H(),e.nextTick(()=>{N=!1,te()}),c("change",s.value)},setBalanced:t=>{Xe.value=t},isBalanced:()=>Xe.value,balance:()=>yo(),applyNodeStyle:(t,n)=>ie(t,n),getNodeStyle:t=>ee(t),applyNodeLink:(t,n)=>D(t,n),removeNodeLink:t=>Q(t),applyNodeNote:(t,n)=>ae(t,n),removeNodeNote:t=>v(t),undo:()=>Ke(),redo:()=>Ue(),canUndo:()=>le.canUndo(),canRedo:()=>le.canRedo(),applySettings:t=>{t.autoBalanceOnChange!==void 0&&(E.autoBalanceOnChange=t.autoBalanceOnChange),t.lineWidthStart!==void 0&&(E.lineWidthStart=Math.max(.5,Math.min(20,t.lineWidthStart))),t.lineWidthEnd!==void 0&&(E.lineWidthEnd=Math.max(.3,Math.min(10,t.lineWidthEnd))),t.rainbowBranch!==void 0&&(E.rainbowBranch=t.rainbowBranch),t.branchPaletteId!==void 0&&(E.branchPaletteId=t.branchPaletteId),t.customPalettes!==void 0&&(E.customPalettes=t.customPalettes),t.lineStyle!==void 0&&(E.lineStyle=t.lineStyle),t.taperedEdge!==void 0&&(E.taperedEdge=t.taperedEdge),t.showOrderBadge!==void 0&&(E.showOrderBadge=t.showOrderBadge)},getSettings:()=>({autoBalanceOnChange:E.autoBalanceOnChange,lineWidthStart:E.lineWidthStart,lineWidthEnd:E.lineWidthEnd,rainbowBranch:E.rainbowBranch,branchPaletteId:E.branchPaletteId,customPalettes:E.customPalettes,lineStyle:E.lineStyle,layoutMode:E.layoutMode,taperedEdge:E.taperedEdge,showOrderBadge:E.showOrderBadge}),setBranchPalette:t=>{if(!t)return;[...ke,...E.customPalettes].find(a=>a.id===t)&&(E.branchPaletteId=t)},getBranchPalette:()=>E.branchPaletteId,getBranchPalettes:()=>[...ke,...E.customPalettes]}),e.watch(()=>i.data,t=>{s.value=_(t),W()},{deep:!1}),e.onMounted(()=>{H(),e.nextTick(()=>te())}),(t,n)=>{var a,h,m;return e.openBlock(),e.createElementBlock("div",{class:"zm-mindmap",style:e.normalizeStyle({background:J.value.bgColor,fontSize:J.value.fontSize+"px"})},[e.createElementVNode("div",{ref_key:"wrapperRef",ref:u,class:"zm-canvas",onMousedown:fo,onContextmenu:n[13]||(n[13]=e.withModifiers(()=>{},["prevent"])),onWheel:n[14]||(n[14]=(...r)=>e.unref(M).onWheel&&e.unref(M).onWheel(...r)),onClick:mo},[e.createElementVNode("div",{class:"zm-svg-layer",style:e.normalizeStyle({left:K.value.vbX*e.unref(M).scale.value+e.unref(M).offsetX.value+"px",top:K.value.vbY*e.unref(M).scale.value+e.unref(M).offsetY.value+"px",width:K.value.vbW*e.unref(M).scale.value+"px",height:K.value.vbH*e.unref(M).scale.value+"px"})},[(e.openBlock(),e.createElementBlock("svg",{class:"zm-svg",viewBox:io.value,preserveAspectRatio:"xMinYMin meet",width:K.value.vbW*e.unref(M).scale.value,height:K.value.vbH*e.unref(M).scale.value},[e.createElementVNode("g",Nn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(oo.value,r=>(e.openBlock(),e.createElementBlock("path",{key:r.key,d:Gn(Bt(r.from,"out",r.to.side,r.to),Bt(r.to,"in"),ft(r.from.depth),mt(r.to.depth),32,E.lineStyle,r.to._dir),fill:Zn(r.from,r.to),stroke:"none"},null,8,Mn))),128))])],8,En))],4),e.unref(M).isMarquee.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"zm-marquee",style:e.normalizeStyle({left:e.unref(M).marquee.x*e.unref(M).scale.value+e.unref(M).offsetX.value+"px",top:e.unref(M).marquee.y*e.unref(M).scale.value+e.unref(M).offsetY.value+"px",width:e.unref(M).marquee.width*e.unref(M).scale.value+"px",height:e.unref(M).marquee.height*e.unref(M).scale.value+"px"})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"zm-world",style:e.normalizeStyle({transform:`translate(${e.unref(M).offsetX.value}px, ${e.unref(M).offsetY.value}px) scale(${e.unref(M).scale.value})`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(qe.value,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:e.normalizeClass(["zm-node",{"is-root":r.isRoot,"is-selected":y.value===r.id,"is-editing":f.value===r.id,"has-image":!!r.image,"is-resizing":Xn.value===r.id}]),"data-node-id":r.id,style:e.normalizeStyle({left:r.x+"px",top:r.y+"px",minWidth:r.width+"px",height:r.height+"px",fontSize:r.fontSize+"px",background:Qn(r),color:_n(r),borderColor:eo(r),fontWeight:to(r),transform:"translate(-50%, -50%)"}),onClick:x=>uo(x,r),onDblclick:x=>{x.stopPropagation(),o.readonly||Ne(r.id)},onContextmenu:x=>O(x,r),onMouseenter:x=>Kn(r.id),onMouseleave:x=>Un(r.id)},[r.image?(e.openBlock(),e.createElementBlock("img",{key:0,class:"zm-node-img",src:r.image.src,width:r.image.width,height:r.image.height,alt:r.text,draggable:"false"},null,8,vn)):e.createCommentVNode("",!0),f.value!==r.id?(e.openBlock(),e.createElementBlock("span",Cn,[e.createElementVNode("span",Sn,e.toDisplayString(r.text),1),r.link&&!f.value?(e.openBlock(),e.createElementBlock("a",{key:0,class:"zm-node-link",href:r.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开链接:${r.link.url}`,onClick:n[0]||(n[0]=e.withModifiers(()=>{},["stop"])),onMousedown:n[1]||(n[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(R,{name:"link",size:11,stroke:2})],40,Vn)):e.createCommentVNode("",!0),r.note&&!f.value?(e.openBlock(),e.createElementBlock("button",{key:1,class:"zm-node-note-btn",type:"button",title:On(r.note.text),onClick:e.withModifiers(x=>at(r.id),["stop"]),onMousedown:n[2]||(n[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(R,{name:"note",size:11,stroke:2})],40,zn)):e.createCommentVNode("",!0)])):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:2,class:"zm-input","onUpdate:modelValue":n[3]||(n[3]=x=>p.value=x),autofocus:"",onBlur:n[4]||(n[4]=x=>We()),onKeydown:[n[5]||(n[5]=e.withKeys(e.withModifiers(x=>We({addSibling:"after"}),["exact"]),["enter"])),n[6]||(n[6]=e.withKeys(e.withModifiers(x=>We({addSibling:"before"}),["shift","prevent","exact"]),["enter"])),n[7]||(n[7]=e.withKeys(e.withModifiers(x=>We({addChild:!0}),["prevent"]),["tab"])),e.withKeys(lo,["esc"]),ro],onMousedown:n[8]||(n[8]=e.withModifiers(()=>{},["stop"])),onClick:n[9]||(n[9]=e.withModifiers(()=>{},["stop"]))},null,544)),[[e.vModelText,p.value]]),w.value?(e.openBlock(),e.createElementBlock("span",{key:3,class:"zm-order-badge",title:`数据顺序:第 ${Mt(r.id)+1} 个`},e.toDisplayString(Mt(r.id)+1),9,In)):e.createCommentVNode("",!0),Nt(r.id)&&!r.isRoot&&Ye(r.id)>0?(e.openBlock(),e.createElementBlock("span",{key:4,class:e.normalizeClass(["zm-collapse-badge",{"is-on-left":r.side===-1}]),style:e.normalizeStyle({background:ce.value.get(r.id)??"#64748b"}),title:`展开 ${Ye(r.id)} 个子节点`,onMousedown:n[10]||(n[10]=e.withModifiers(()=>{},["stop"])),onClick:e.withModifiers(x=>Et(r.id),["stop"])},e.toDisplayString(Ye(r.id)),47,Wn)):e.createCommentVNode("",!0),!o.readonly&&!r.isRoot&&go(r)&&!Nt(r.id)?(e.openBlock(),e.createElementBlock("button",{key:5,class:e.normalizeClass(["zm-btn zm-collapse",{"is-on-left":r.side===-1}]),style:e.normalizeStyle({color:ce.value.get(r.id)??"#64748b",borderColor:ce.value.get(r.id)??"#64748b"}),title:"折叠",onMousedown:n[11]||(n[11]=e.withModifiers(()=>{},["stop"])),onClick:e.withModifiers(x=>Et(r.id),["stop"])},[e.createVNode(R,{name:"minus",size:10,stroke:2.4})],46,$n)):e.createCommentVNode("",!0),r.image&&y.value===r.id&&f.value!==r.id?(e.openBlock(),e.createElementBlock("span",{key:6,class:"zm-img-resize-handle",title:"拖动调整图片大小",onMousedown:e.withModifiers(x=>qn(x,r),["stop"])},null,40,Rn)):e.createCommentVNode("",!0),r.image&&y.value===r.id&&f.value!==r.id?(e.openBlock(),e.createElementBlock("button",{key:7,class:"zm-img-remove-btn",title:"移除图片",onMousedown:n[12]||(n[12]=e.withModifiers(()=>{},["stop"])),onClick:e.withModifiers(x=>F(r.id),["stop"])},[e.createVNode(R,{name:"x",size:9,stroke:2.2})],40,Tn)):e.createCommentVNode("",!0)],46,Bn))),128))],4),C.value?(e.openBlock(),e.createBlock(bn,{key:1,x:C.value.x,y:C.value.y,container:u.value,"has-image":!!((a=e.unref(S)(s.value,C.value.nodeId))!=null&&a.image),"has-link":!!((h=e.unref(S)(s.value,C.value.nodeId))!=null&&h.link),"has-note":!!((m=e.unref(S)(s.value,C.value.nodeId))!=null&&m.note),readonly:i.readonly,onPickImage:j,onRemoveImage:Fn,onSetLink:G,onRemoveLink:me,onEditNote:be,onRemoveNote:he,onClose:q},null,8,["x","y","container","has-image","has-link","has-note","readonly"])):e.createCommentVNode("",!0)],544),i.previewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",An,[e.createElementVNode("button",{class:"zm-tb-btn",title:"放大",onClick:n[15]||(n[15]=(...r)=>e.unref(M).zoomIn&&e.unref(M).zoomIn(...r))},[e.createVNode(R,{name:"zoom-in"})]),e.createElementVNode("button",{class:"zm-tb-btn",title:"缩小",onClick:n[16]||(n[16]=(...r)=>e.unref(M).zoomOut&&e.unref(M).zoomOut(...r))},[e.createVNode(R,{name:"zoom-out"})]),e.createElementVNode("button",{class:"zm-tb-btn",title:"重置视图",onClick:te},[e.createVNode(R,{name:"reset"})]),n[22]||(n[22]=e.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),o.readonly?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"zm-tb-btn",title:"添加子节点 (Tab)",onClick:n[17]||(n[17]=r=>y.value&&ge(y.value))},[e.createElementVNode("img",{src:e.unref(Dt),width:"14",height:"14",alt:"添加子节点",draggable:"false"},null,8,Ln)])),o.readonly?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:1,class:"zm-tb-btn",title:"添加同级 (Enter)",onClick:n[18]||(n[18]=r=>y.value&&$e(y.value))},[e.createElementVNode("img",{src:e.unref(Lt),width:"14",height:"14",alt:"添加同级",draggable:"false"},null,8,Dn)])),n[23]||(n[23]=e.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),e.createElementVNode("button",{class:e.normalizeClass(["zm-tb-btn",{active:E.layoutMode==="mindmap"}]),title:"思维导图布局 (中心辐射)",onClick:n[19]||(n[19]=r=>je("mindmap"))},[e.createVNode(R,{name:"mindmap"})],2),e.createElementVNode("button",{class:e.normalizeClass(["zm-tb-btn",{active:E.layoutMode==="tree"}]),title:"树形布局 (向右展开)",onClick:n[20]||(n[20]=r=>je("tree"))},[e.createVNode(R,{name:"tree"})],2),e.createElementVNode("button",{class:e.normalizeClass(["zm-tb-btn",{active:E.layoutMode==="org"}]),title:"组织结构布局 (向下展开)",onClick:n[21]||(n[21]=r=>je("org"))},[e.createVNode(R,{name:"org"})],2),n[24]||(n[24]=e.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),o.readonly?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:2,class:"zm-tb-btn",title:"导入 JSON",onClick:xo},[e.createVNode(R,{name:"import"})])),e.createElementVNode("button",{class:"zm-tb-btn",title:"导出 JSON",onClick:po},[e.createVNode(R,{name:"export"})]),e.createElementVNode("span",Hn,e.toDisplayString(Math.round(e.unref(M).scale.value*100))+"%",1)]))],4)}}}),Pn={install(o){o.component("FlowMindMap",rt)}};T.MindMap=rt,T.addChild=nt,T.addSibling=ot,T.clone=_,T.default=Pn,T.findNode=S,T.findParent=Y,T.markdownToMindMap=Pe,T.mindMapToMarkdown=ze,T.removeNode=He,T.uid=oe,Object.defineProperties(T,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(T,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(T=typeof globalThis<"u"?globalThis:T||self,e(T.FlowMind={},T.Vue))})(this,function(T,e){"use strict";const Rt=["width","height","stroke-width"],Lt={key:4,points:"6 9 12 15 18 9"},Tt={key:5,points:"9 6 15 12 9 18"},H=e.defineComponent({__name:"Icon",props:{name:{},size:{},stroke:{}},setup(i){return(s,l)=>(e.openBlock(),e.createElementBlock("svg",{width:i.size??16,height:i.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":i.stroke??1.8,"stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[i.name==="add"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[0]||(l[0]=e.createElementVNode("circle",{cx:"12",cy:"12",r:"9"},null,-1)),l[1]||(l[1]=e.createElementVNode("line",{x1:"12",y1:"8",x2:"12",y2:"16"},null,-1)),l[2]||(l[2]=e.createElementVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"},null,-1))],64)):i.name==="minus"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l[3]||(l[3]=e.createElementVNode("circle",{cx:"12",cy:"12",r:"9"},null,-1)),l[4]||(l[4]=e.createElementVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"},null,-1))],64)):i.name==="delete"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[l[5]||(l[5]=e.createStaticVNode('<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)):i.name==="edit"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[l[6]||(l[6]=e.createElementVNode("path",{d:"M4 20 l4 -1 11 -11 -3 -3 -11 11 z"},null,-1)),l[7]||(l[7]=e.createElementVNode("line",{x1:"14",y1:"6",x2:"18",y2:"10"},null,-1))],64)):i.name==="collapse"?(e.openBlock(),e.createElementBlock("polyline",Lt)):i.name==="expand"?(e.openBlock(),e.createElementBlock("polyline",Tt)):i.name==="zoom-in"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:6},[l[8]||(l[8]=e.createElementVNode("circle",{cx:"11",cy:"11",r:"7"},null,-1)),l[9]||(l[9]=e.createElementVNode("line",{x1:"11",y1:"8",x2:"11",y2:"14"},null,-1)),l[10]||(l[10]=e.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"},null,-1)),l[11]||(l[11]=e.createElementVNode("line",{x1:"16",y1:"16",x2:"21",y2:"21"},null,-1))],64)):i.name==="zoom-out"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:7},[l[12]||(l[12]=e.createElementVNode("circle",{cx:"11",cy:"11",r:"7"},null,-1)),l[13]||(l[13]=e.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"},null,-1)),l[14]||(l[14]=e.createElementVNode("line",{x1:"16",y1:"16",x2:"21",y2:"21"},null,-1))],64)):i.name==="reset"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:8},[l[15]||(l[15]=e.createElementVNode("circle",{cx:"12",cy:"12",r:"9"},null,-1)),l[16]||(l[16]=e.createElementVNode("circle",{cx:"12",cy:"12",r:"4"},null,-1)),l[17]||(l[17]=e.createElementVNode("circle",{cx:"12",cy:"12",r:"0.8",fill:"currentColor"},null,-1))],64)):i.name==="logo"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:9},[l[18]||(l[18]=e.createStaticVNode('<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)):i.name==="import"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:10},[l[19]||(l[19]=e.createElementVNode("path",{d:"M12 4 V15"},null,-1)),l[20]||(l[20]=e.createElementVNode("polyline",{points:"7 10 12 15 17 10"},null,-1)),l[21]||(l[21]=e.createElementVNode("path",{d:"M4 19 H20"},null,-1))],64)):i.name==="export"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:11},[l[22]||(l[22]=e.createElementVNode("path",{d:"M12 15 V4"},null,-1)),l[23]||(l[23]=e.createElementVNode("polyline",{points:"7 9 12 4 17 9"},null,-1)),l[24]||(l[24]=e.createElementVNode("path",{d:"M4 19 H20"},null,-1))],64)):i.name==="balance"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:12},[l[25]||(l[25]=e.createStaticVNode('<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)):i.name==="mindmap"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:13},[l[26]||(l[26]=e.createStaticVNode('<circle cx="12" cy="12" r="2.2" fill="currentColor" stroke="none"></circle><line x1="13" y1="11" x2="19" y2="6"></line><line x1="13" y1="13" x2="19" y2="18"></line><line x1="11" y1="11" x2="5" y2="6"></line><line x1="11" y1="13" x2="5" y2="18"></line>',5))],64)):i.name==="tree"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:14},[l[27]||(l[27]=e.createStaticVNode('<circle cx="6" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="6" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="18" r="2" fill="currentColor" stroke="none"></circle><line x1="8" y1="12" x2="16" y2="6"></line><line x1="8" y1="12" x2="16" y2="12"></line><line x1="8" y1="12" x2="16" y2="18"></line>',7))],64)):i.name==="org"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:15},[l[28]||(l[28]=e.createStaticVNode('<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)):i.name==="image"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:16},[l[29]||(l[29]=e.createElementVNode("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"},null,-1)),l[30]||(l[30]=e.createElementVNode("circle",{cx:"9",cy:"11",r:"1.6"},null,-1)),l[31]||(l[31]=e.createElementVNode("polyline",{points:"3 17 9 12 13 15 16 13 21 17"},null,-1))],64)):i.name==="x"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:17},[l[32]||(l[32]=e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)),l[33]||(l[33]=e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"},null,-1))],64)):i.name==="link"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:18},[l[34]||(l[34]=e.createElementVNode("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)),l[35]||(l[35]=e.createElementVNode("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)):i.name==="note"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:19},[l[36]||(l[36]=e.createElementVNode("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)),l[37]||(l[37]=e.createElementVNode("line",{x1:"8",y1:"10",x2:"16",y2:"10"},null,-1)),l[38]||(l[38]=e.createElementVNode("line",{x1:"8",y1:"13",x2:"16",y2:"13"},null,-1)),l[39]||(l[39]=e.createElementVNode("line",{x1:"8",y1:"16",x2:"13",y2:"16"},null,-1))],64)):e.createCommentVNode("",!0)],8,Rt))}}),Dt="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",At="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",Je=[18,15,13,12],Ht=[700,600,500,400],Ft=[52,40,32,28],Pt=[120,80,60,44],Ot=[.8,.8,.8,.8],Xt=Je.length-1;function qt(i,s){return Math.round(De(i,s)*Ot[Ce(i)])}function Ce(i){return Math.min(Xt,Math.max(0,i))}function De(i,s=14){return Math.round(Je[Ce(i)]*s/14*10)/10}function Kt(i,s=14){return Math.round(Ft[Ce(i)]*s/14)}const Se=60,ue=14,G=24;let Ae=null;function Ut(){if(Ae)return Ae;const i=typeof document<"u"?document.createElement("canvas").getContext("2d"):null;return i?(Ae=i,i):{font:"",measureText:()=>({width:0})}}const Ze=new Map;function jt(i,s,l){const o=`${l}|${s}|${i}`,a=Ze.get(o);if(a!==void 0)return a;const u=Ut();u.font=`${l} ${s}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;const f=u.measureText(i).width;return Ze.set(o,f),f}const Yt=24,Gt=400,Jt=8,Qe=16,Zt=4,Qt=200;function _t(i,s,l){return Math.min(l,Math.max(s,i))}function en(i,s,l){const o=Ce(s),a=De(s,l),u=Math.min(jt(i.text||"",a,Ht[o]),Qt),f=qt(s,l),k=Math.ceil(u+f*2),m=Kt(s,l);let g=0;if(i.link&&(g+=Qe),i.note&&(g+=Qe),g>0){const F=(i.link?1:0)+(i.note?1:0);g+=Zt*F}const d=k+g,x=Math.round(Pt[o]*l/14),E=i.richContent?Math.min(160,Math.ceil(a*6.5)):0,w=E>0?6:0;if(!i.image)return{w:Math.max(x,d),h:m+w+E};const W=_t(i.image.width,Yt,Gt),P=Math.max(x,d,Math.ceil(W+f*2)),K=Math.ceil(i.image.height+Jt+m+w+E);return{w:P,h:K}}function tn(i,s={}){const l=s.mode??"mindmap",o=s.preservePositions===!0,a=s.baseFontSize??14,u=et(i,0,null,1,"right",a);return on(u),nn(u,l,o),u.x=0,u.y=0,ln(u,o)}function nn(i,s,l=!1){if(s==="mindmap"){const o=i.children;if(o.length!==0)if(o.length===1)o[0]._dir="right",o[0].side=1,o[0]._dirRight=1;else{const k=o.reduce((x,E)=>x+E._subtreeH,0);let m=1,g=Math.abs(o[0]._subtreeH-(k-o[0]._subtreeH)),d=0;for(let x=0;x<o.length-1;x++){d+=o[x]._subtreeH;const E=Math.abs(d-(k-d));E<g&&(g=E,m=x+1)}for(let x=0;x<m;x++)o[x]._dir="right",o[x].side=1,o[x]._dirRight=1;for(let x=m;x<o.length;x++)o[x]._dir="left",o[x].side=-1,o[x]._dirRight=-1}const a=i.children.filter(k=>k.side===1),u=i.children.filter(k=>k.side===-1),f=(k,m)=>{const g=m==="right"?1:-1;k._dir=m,k.side=g,k._dirRight=g;for(const d of k.children)f(d,m)};for(const k of a)f(k,"right");for(const k of u)f(k,"left");if(a.length>0){const k={...i,children:a};ve(k,"right",Se,!0,l)}if(u.length>0){const k={...i,children:u};ve(k,"left",Se,!0,l)}}else if(s==="tree"){const o=a=>{a.side=1,a._dir="right";for(const u of a.children)o(u)};for(const a of i.children)a._dir="right";ve(i,"right",Se,!0,l),o(i)}else{for(const o of i.children)o._dir="down";_e(i,Se,l)}}function ve(i,s,l,o,a=!1){if(i.children.length===0)return;const u=i.children.reduce((g,d,x)=>g+d._subtreeH+(x>0?ue:0),0),f=s==="right"?1:-1,k=o?f:1;let m=i.y-k*u/2;i.children.forEach(g=>{a||(g.x=i.x+f*(i.width/2+l+g.width/2),g.y=m+k*g._subtreeH/2),g._dir=s,m+=k*(g._subtreeH+ue),ve(g,s,l,!1,a)})}function _e(i,s,l=!1){if(i.children.length===0)return;const o=i.children.reduce((u,f,k)=>u+f._subtreeW+(k>0?ue*2:0),0);let a=i.x-o/2;i.children.forEach(u=>{l||(u.x=a+u._subtreeW/2,u.y=i.y+i.height/2+s+u.height/2),u._dir="down",a+=u._subtreeW+ue*2,_e(u,s,l)})}function et(i,s,l,o,a,u){const f=en(i,s,u),k={id:i.id,text:i.text,depth:s,x:i._x??0,y:i._y??0,width:f.w,height:f.h,fontSize:De(s,u),isRoot:s===0,collapsed:i.collapsed,side:o,_dir:a,_dirRight:o,_subtreeH:f.h,_subtreeW:f.w,image:i.image?{...i.image}:void 0,link:i.link?{url:i.link.url}:void 0,note:i.note?{text:i.note.text}:void 0,richContent:i.richContent?{kind:i.richContent.kind,raw:i.richContent.raw,lang:i.richContent.lang}:void 0,children:[],parent:l};if(i.collapsed)return k;const m=i.children.length,g=Math.ceil(m/2);return k.children=i.children.map((d,x)=>{const E=s===0?x<g?1:-1:o;return et(d,s+1,k,E,a,u)}),k}function on(i){const s=[i];for(let l=0;l<s.length;l++){const o=s[l];for(const a of o.children)s.push(a)}for(let l=s.length-1;l>=0;l--){const o=s[l];if(o.collapsed||o.children.length===0){o._subtreeH=o.height,o._subtreeW=o.width;continue}let a=0,u=0;for(const f of o.children)a+=f._subtreeH,u+=f._subtreeW;o.children.length>1&&(a+=ue*(o.children.length-1),u+=ue*2*(o.children.length-1)),o._subtreeH=Math.max(o.height,a),o._subtreeW=Math.max(o.width,u)}}function ln(i,s=!1){const l=[i];let o=1/0,a=-1/0,u=1/0,f=-1/0;for(;l.length;){const g=l.pop(),d=g.width/2,x=g.height/2;g.x-d<o&&(o=g.x-d),g.x+d>a&&(a=g.x+d),g.y-x<u&&(u=g.y-x),g.y+x>f&&(f=g.y+x),l.push(...g.children)}if(s)return{root:i,width:a-o+G*2,height:f-u+G*2,vbX:o-G,vbY:u-G,vbW:a-o+G*2,vbH:f-u+G*2};const k=G-u,m=[i];for(;m.length;){const g=m.pop();g.y+=k,m.push(...g.children)}return u+=k,f+=k,{root:i,width:a-o+G*2,height:f+G,vbX:o-G,vbY:0,vbW:a-o+G*2,vbH:f+G}}const ke=[{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 rn(i,s=[]){return[...ke,...s].find(o=>o.id===i)??ke[0]}function J(){return"n_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function ne(i){return JSON.parse(JSON.stringify(i))}function $(i,s){if(i.id===s)return i;for(const l of i.children){const o=$(l,s);if(o)return o}return null}function Z(i,s,l=null){if(i.id===s)return l;for(const o of i.children){const a=Z(o,s,i);if(a!==null)return a}return null}function He(i,s){const l=i.children.findIndex(o=>o.id===s);if(l>=0)return i.children.splice(l,1),!0;for(const o of i.children)if(He(o,s))return!0;return!1}function an(i,s,l){const o=$(i,s);return!o||o.text===l?!1:(o.text=l,!0)}function cn(i,s,l,o){if(!Z(i,s)||s===l||$($(i,s),l))return!1;const a=Z(i,s),u=a.children.findIndex(g=>g.id===s);if(u<0)return!1;const[f]=a.children.splice(u,1);if(o==="child"){const g=$(i,l);return g?(g.children.push(f),!0):(a.children.splice(u,0,f),!1)}const k=Z(i,l);if(!k)return a.children.splice(u,0,f),!1;let m=k.children.findIndex(g=>g.id===l);return m<0?(a.children.splice(u,0,f),!1):(o==="after"&&(m+=1),k.children.splice(m,0,f),!0)}function tt(i){const s=/^新节点(?:\s+(\d+))?$/;let l=0,o=!1;for(const a of i.children){const u=a.text.match(s);if(u)if(u[1]){const f=parseInt(u[1],10);f>l&&(l=f)}else o=!0}return l===0&&!o?Ve:l>0?`新节点 ${l+1}`:"新节点 2"}function nt(i,s,l){const o=$(i,s);if(!o)return null;const a={id:J(),text:l??tt(o),children:[]};return o.children.push(a),a}function ot(i,s,l){const o=Z(i,s);if(!o)return null;const a=o.children.findIndex(f=>f.id===s);if(a<0)return null;const u={id:J(),text:l??tt(o),children:[]};return o.children.splice(a+1,0,u),u}function sn(i,s,l){const o=Z(i,s);if(!o)return null;const a=o.children.findIndex(f=>f.id===s);if(a<0)return null;const u={id:J(),text:l,children:[]};return o.children.splice(a,0,u),u}function dn(i,s){const l=Z(i,s);if(!l)return null;const o=l.children.findIndex(f=>f.id===s);if(o<0)return null;const a=l.children[o],u=ne(a);return it(u),l.children.splice(o+1,0,u),u}function it(i){i.id=J();for(const s of i.children)it(s)}const Ve="新节点";function Fe(i,s="导入的导图"){const l=i.split(/\r?\n/),o={id:J(),text:s,children:[]},a=[o],u=[-1/0],f=[],k=/^(#{1,6})\s+(.+?)\s*#*\s*$/,m=/^!\[([^\]]*)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,g=/^\[([^\]]+)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,d=/^(`{3,}|~{3,})\s*(\S+)?\s*$/;let x=!1,E=[],w=null;function W(b){E.push(b)}function P(){if(w&&E.length>0){for(;E.length>0&&E[0].trim()==="";)E.shift();for(;E.length>0&&E[E.length-1].trim()==="";)E.pop();const b=E.join(`
|
|
2
|
+
`);b&&(w.note={text:b})}x=!1,E=[]}for(const b of l){if(x){const D=b.match(d);if(D&&D[1][0]==="`"){P();continue}W(b);continue}const B=b.match(k);if(B){const D=B[1].length,te=B[2].trim();f.push({level:D,text:te,body:""}),w=f[f.length-1];continue}const I=b.match(d);if(I&&I[2]==="note"){x=!0,E=[];continue}const V=b.match(m);if(V&&w){const D=V[2],te=160,ae=120;w.image={src:D,naturalW:te,naturalH:ae,width:te,height:ae};continue}const q=b.match(g);if(q&&w){w.link={url:q[2]},w.text=q[1];continue}b.trim().length>0&&w&&(w.body=w.body?w.body+" "+b.trim():b.trim())}x&&P();function K(b){for(;a.length>1;){const q=a.length-1,D=u[q];if(D!==void 0&&D<b.level)break;a.pop(),u.pop()}const B=a[a.length-1],I=b.text,V={id:J(),text:I,children:[]};b.image&&(V.image={...b.image}),b.link&&(V.link={url:b.link.url}),b.note&&(V.note={text:b.note.text}),b.body&&F(b,f,f.indexOf(b))&&V.children.push({id:J(),text:b.body,children:[]}),B.children.push(V),a.push(V),u.push(b.level)}function F(b,B,I){for(let V=I+1;V<B.length;V++){if(B[V].level<=b.level)return!0;if(B[V].level>b.level)return!1}return!0}for(const b of f)K(b);if(f.length>0&&f[0].level===1){const b=o.children[0];b&&(o.text=b.text,o.id=b.id,b.image&&(o.image={...b.image}),b.link&&(o.link={url:b.link.url}),b.note&&(o.note={text:b.note.text}),o.children=b.children)}return o}function ze(i,s=1){let l="#".repeat(s)+" "+(i.text||"")+`
|
|
3
|
+
`;i.link&&(l+=`[${i.text||"link"}](${i.link.url})
|
|
4
|
+
`),i.image&&(l+=`
|
|
5
|
+
`),i.note&&(l+="```note\n"+i.note.text+"\n```\n"),i.richContent&&(l+=i.richContent.raw+`
|
|
6
|
+
`);for(const o of i.children)l+=ze(o,s+1);return l}function un(i){var g,d;const s=i.split(/\r?\n/),l=[];let o=0;const a=/^(#{1,6})\s+(.+?)\s*#*\s*$/,u=/^(`{3,}|~{3,})\s*(\S+)?\s*$/,f=/^\s*\|?\s*(:?-+:?\s*\|\s*)+(:?-+:?)(\s*\|)?\s*$/,k=/^(\s*)[-*+]\s+(.*)$/,m=/^(\s*)\d+\.\s+(.*)$/;for(;o<s.length;){const x=s[o],E=x.match(u);if(E){const B=E[1][0],I=E[2]||"",V=[x];for(o++;o<s.length;){const D=s[o].match(u);if(D&&D[1][0]===B){V.push(s[o]),o++;break}V.push(s[o]),o++}const q=V.slice(1,-1).join(`
|
|
7
|
+
`).trim();l.push({kind:"code",text:((g=q.split(`
|
|
8
|
+
`)[0])==null?void 0:g.slice(0,80))||"(空代码块)",raw:V.join(`
|
|
9
|
+
`),lang:I});continue}const w=x.match(a);if(w){l.push({kind:"heading",level:w[1].length,text:w[2].trim(),raw:x}),o++;continue}if(/^\s*\|/.test(x)){const B=[];let I=o,V=!1;for(;I<s.length&&/^\s*\|/.test(s[I]);)B.push(s[I]),f.test(s[I])&&(V=!0),I++;if(V&&B.length>=2){l.push({kind:"table",text:((d=B[0].replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|")[0])==null?void 0:d.trim())||"表格",raw:B.join(`
|
|
10
|
+
`)}),o=I;continue}}const W=x.match(k),P=x.match(m);if(W||P){let B=o;for(;B<s.length;){const I=s[B].match(k),V=s[B].match(m);if(!(I||V))break;const q=s[B].replace(/^\s*[-*+]\s+/,"").replace(/^\s*\d+\.\s+/,"").trim();q.length>0&&l.push({kind:"list",text:q.slice(0,80)||"(列表项)",raw:s[B]}),B++}o=B;continue}if(x.trim()===""){o++;continue}const K=[x];let F=o+1;for(;F<s.length;){const B=s[F];if(B.trim()===""||a.test(B)||u.test(B)||k.test(B)||m.test(B)||/^\s*\|/.test(B))break;K.push(B),F++}const b=K.join(" ").trim();l.push({kind:"paragraph",text:b.slice(0,80)||"(空段落)",raw:K.join(`
|
|
11
|
+
`)}),o=F}return l}function fn(i,s="导入的导图"){const l=un(i||""),o={id:J(),text:s,children:[]},a=[o],u=[0];let f=!1;function k(m){if(m.kind==="heading"){const d=m.level;for(;a.length>1&&u[u.length-1]>=d;)a.pop(),u.pop();if(!f&&d===1){f=!0,o.text=m.text,u[0]=1;return}const x={id:J(),text:m.text,children:[]};a[a.length-1].children.push(x),a.push(x),u.push(d);return}const g={id:J(),text:m.text,children:[],richContent:{kind:m.kind,raw:m.raw,lang:m.lang}};a[a.length-1].children.push(g)}for(const m of l)k(m);return o}function mn(i){return i.richContent?i.richContent.raw+`
|
|
12
|
+
`:""}function hn(i){const s=i.minScale??.2,l=i.maxScale??3,o=i.step??1.2,a=e.ref(1),u=e.ref(0),f=e.ref(0),k=e.ref(!1),m=e.reactive({x:0,y:0,ox:0,oy:0}),g=e.ref(!1),d=e.reactive({x:0,y:0}),x=e.reactive({x:0,y:0,width:0,height:0}),E=e.ref(0);let w=null;function W(v){w=v}function P(v){v.preventDefault();const z=i.getContainer();if(!z)return;const U=-v.deltaY*.001,j=Math.min(l,Math.max(s,a.value*(1+U))),Q=z.getBoundingClientRect(),_=v.clientX-Q.left,me=v.clientY-Q.top,be=(_-u.value)/a.value,he=(me-f.value)/a.value;a.value=j,u.value=_-be*j,f.value=me-he*j}function K(){a.value=Math.min(l,a.value*o)}function F(){a.value=Math.max(s,a.value/o)}function b(v){var U;v.target.closest(".zm-node, .zm-toolbar, button, input, textarea")||(k.value=!0,m.x=v.clientX,m.y=v.clientY,m.ox=u.value,m.oy=f.value,window.addEventListener("mousemove",B),window.addEventListener("mouseup",I),(U=v.preventDefault)==null||U.call(v))}function B(v){k.value&&(u.value=m.ox+(v.clientX-m.x),f.value=m.oy+(v.clientY-m.y))}function I(){k.value=!1,window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",I)}function V(v,z){g.value=!0,d.x=v,d.y=z,x.x=v,x.y=z,x.width=0,x.height=0,E.value++,window.addEventListener("mousemove",te),window.addEventListener("mouseup",D)}function q(v,z){if(!g.value)return;const U=Math.min(d.x,v),j=Math.min(d.y,z),Q=Math.max(d.x,v),_=Math.max(d.y,z);x.x=U,x.y=j,x.width=Q-U,x.height=_-j,E.value++}function D(){g.value=!1,window.removeEventListener("mousemove",te),window.removeEventListener("mouseup",D),w&&w()}function te(v){if(!g.value)return;const z=i.getContainer();if(!z)return;const U=z.getBoundingClientRect(),j=(v.clientX-U.left-u.value)/a.value,Q=(v.clientY-U.top-f.value)/a.value;q(j,Q)}function ae(v,z,U,j=60){const Q=i.getContainer();if(!Q)return;const _=Q.getBoundingClientRect(),me=(_.width-j*2)/v,be=(_.height-j*2)/z,he=Math.min(1,Math.max(.3,Math.min(me,be)));a.value=he,u.value=_.width/2,f.value=_.height/2-U*he}return{scale:a,offsetX:u,offsetY:f,isPanning:k,onWheel:P,zoomIn:K,zoomOut:F,startPan:b,startMarquee:V,updateMarquee:q,isMarquee:g,marquee:x,marqueeVersion:E,setOnMarqueeEnd:W,resetView:ae}}const gn=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function lt(i){return gn?i.metaKey:i.ctrlKey}function yn(i){function s(){const o=i.getSelectedId();return o||(i.defaultTargetId?i.defaultTargetId():i.getRootId())}function l(o){const a=o.target;if(a&&(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable)||i.isReadonly()||i.isEditing())return;const u=i.getSelectedId(),f=s();if(f){if(lt(o)&&!o.shiftKey){if(o.key==="d"||o.key==="D"){u&&u!==i.getRootId()&&(o.preventDefault(),i.onDuplicate(u));return}if(o.key==="z"||o.key==="Z"){o.preventDefault(),i.onUndo();return}if(o.key==="y"||o.key==="Y"){o.preventDefault(),i.onRedo();return}if(o.key==="Home"){o.preventDefault(),i.onSelectRoot();return}}if(lt(o)&&o.shiftKey&&(o.key==="Z"||o.key==="z")){o.preventDefault(),i.onRedo();return}o.key==="Tab"?(o.preventDefault(),i.onAddChild(f)):o.key==="Enter"?(o.preventDefault(),o.shiftKey?u&&u!==i.getRootId()&&i.onAddSiblingBefore(u):i.onAddSibling(f)):(o.key==="Delete"||o.key==="Backspace")&&u&&u!==i.getRootId()?(o.preventDefault(),i.onRemove(u)):o.key==="F2"&&u?(o.preventDefault(),i.onStartEdit(u)):o.key==="Escape"?(o.preventDefault(),i.onClearSelection()):o.key==="ArrowDown"?(o.preventDefault(),i.onNavigate(0,1)):o.key==="ArrowUp"?(o.preventDefault(),i.onNavigate(0,-1)):o.key==="ArrowRight"?(o.preventDefault(),i.onNavigate(1,0)):o.key==="ArrowLeft"&&(o.preventDefault(),i.onNavigate(-1,0))}}e.onMounted(()=>{window.addEventListener("keydown",l)}),e.onBeforeUnmount(()=>{window.removeEventListener("keydown",l)})}function pn(i=100){const s=e.ref([]);let l=-1;function o(){return l>0}function a(){return l<s.value.length-1}function u(g){const d=JSON.stringify(g);for(l<s.value.length-1&&(s.value=s.value.slice(0,l+1)),s.value.push(d),l=s.value.length-1;s.value.length>i;)s.value.shift(),l--}function f(){return o()?(l--,JSON.parse(s.value[l])):null}function k(){return a()?(l++,JSON.parse(s.value[l])):null}function m(){s.value=[],l=-1}return{canUndo:o,canRedo:a,record:u,undo:f,redo:k,reset:m}}const xn=["disabled"],kn=["disabled"],wn=["disabled"],bn=["disabled"],En=["disabled"],Nn=["disabled"],Mn=e.defineComponent({__name:"NodeContextMenu",props:{x:{},y:{},container:{},hasImage:{type:Boolean,default:!1},hasLink:{type:Boolean,default:!1},hasNote:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1}},emits:["pickImage","setLink","removeLink","editNote","removeNote","removeImage","close"],setup(i,{emit:s}){const l=i,o=s,a=e.computed(()=>{let E=l.x+2,w=l.y+2;if(l.container){const W=l.container.getBoundingClientRect(),P=180,K=u.value?f.value?184:160:136;E+P>W.right&&(E=Math.max(W.left+4,l.x-P-2)),w+K>W.bottom&&(w=Math.max(W.top+4,l.y-K-2)),E<W.left+2&&(E=W.left+2),w<W.top+2&&(w=W.top+2)}return{left:E,top:w}}),u=e.computed(()=>l.hasImage),f=e.computed(()=>l.hasLink),k=e.computed(()=>l.hasNote);function m(E){const w=E.target;w&&w.closest(".zm-node-menu")||o("close")}function g(E){E.key==="Escape"&&o("close")}function d(){o("close")}window.addEventListener("mousedown",m,!0),window.addEventListener("keydown",g,!0),window.addEventListener("wheel",d,!0),window.addEventListener("scroll",d,!0),e.onBeforeUnmount(()=>{window.removeEventListener("mousedown",m,!0),window.removeEventListener("keydown",g,!0),window.removeEventListener("wheel",d,!0),window.removeEventListener("scroll",d,!0)});function x(E){l.readonly||(E(),o("close"))}return(E,w)=>(e.openBlock(),e.createElementBlock("div",{class:"zm-node-menu",style:e.normalizeStyle({left:a.value.left+"px",top:a.value.top+"px"}),onContextmenu:w[6]||(w[6]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("button",{class:"zm-node-menu-item",disabled:i.readonly,onClick:w[0]||(w[0]=e.withModifiers(W=>x(()=>o("pickImage")),["stop"]))},[e.createVNode(H,{name:"image",size:13}),e.createElementVNode("span",null,e.toDisplayString(u.value?"替换图片":"添加图片"),1)],8,xn),u.value?(e.openBlock(),e.createElementBlock("button",{key:0,class:"zm-node-menu-item",disabled:i.readonly,onClick:w[1]||(w[1]=e.withModifiers(W=>x(()=>o("removeImage")),["stop"]))},[e.createVNode(H,{name:"x",size:13}),w[7]||(w[7]=e.createElementVNode("span",null,"移除图片",-1))],8,kn)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"zm-node-menu-item",disabled:i.readonly,onClick:w[2]||(w[2]=e.withModifiers(W=>x(()=>o("setLink")),["stop"]))},[e.createVNode(H,{name:"link",size:13}),e.createElementVNode("span",null,e.toDisplayString(f.value?"编辑链接":"添加链接"),1)],8,wn),f.value?(e.openBlock(),e.createElementBlock("button",{key:1,class:"zm-node-menu-item",disabled:i.readonly,onClick:w[3]||(w[3]=e.withModifiers(W=>x(()=>o("removeLink")),["stop"]))},[e.createVNode(H,{name:"x",size:13}),w[8]||(w[8]=e.createElementVNode("span",null,"移除链接",-1))],8,bn)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"zm-node-menu-item",disabled:i.readonly,onClick:w[4]||(w[4]=e.withModifiers(W=>x(()=>o("editNote")),["stop"]))},[e.createVNode(H,{name:"note",size:13}),e.createElementVNode("span",null,e.toDisplayString(k.value?"编辑笔记":"添加笔记"),1)],8,En),k.value?(e.openBlock(),e.createElementBlock("button",{key:2,class:"zm-node-menu-item",disabled:i.readonly,onClick:w[5]||(w[5]=e.withModifiers(W=>x(()=>o("removeNote")),["stop"]))},[e.createVNode(H,{name:"x",size:13}),w[9]||(w[9]=e.createElementVNode("span",null,"移除笔记",-1))],8,Nn)):e.createCommentVNode("",!0)],36))}}),Bn=["viewBox","width","height"],Cn={class:"zm-edges"},Sn=["d","fill"],vn=["data-node-id","onClick","onDblclick","onContextmenu","onMouseenter","onMouseleave"],Vn=["src","width","height","alt"],zn={key:1,class:"zm-text"},$n={class:"zm-text-label"},In=["href","title"],Wn=["title","onClick"],Rn={key:0,class:"zm-rich-code"},Ln={key:1,class:"zm-rich-list"},Tn={key:2,class:"zm-rich-table"},Dn={key:3,class:"zm-rich-paragraph"},An=["title"],Hn=["title","onClick"],Fn=["onClick"],Pn=["onMousedown"],On=["onClick"],Xn={key:0,class:"zm-toolbar"},qn=["src"],Kn=["src"],Un={class:"zm-tb-tip"},fe=24,we=400,re=160,rt=e.defineComponent({__name:"MindMap",props:{data:{},readonly:{type:Boolean,default:!1},theme:{},previewMode:{type:Boolean,default:!1},markdown:{},lineColors:{}},emits:["change","select","edit-note","markdownChange"],setup(i,{expose:s,emit:l}){const o=i,a=l,u=e.ref(null),f=e.ref(null),k=e.ref(""),m=e.ref(null),g=e.ref(new Set),d=e.ref(ne(o.data)),x=e.ref(o.markdown!==void 0);let E=!1;e.watch(()=>o.markdown,t=>{if(t===void 0){x.value=!1;return}x.value=!0;const n=Fe(t||"");E=!0,d.value=ne(n),m.value=null,g.value=new Set,L(),e.nextTick(()=>{E=!1,oe()})}),e.watch(d,()=>{x.value&&!E&&a("markdownChange",ze(d.value))},{deep:!0});const w=e.computed(()=>N.showOrderBadge===!0),W=e.ref(new Map),P=W.value;function K(t,n){const c={};n.bg&&(c.bg=n.bg),n.textColor&&(c.textColor=n.textColor),n.borderColor&&(c.borderColor=n.borderColor),n.fontWeight&&(c.fontWeight=n.fontWeight),Object.keys(c).length===0?P.delete(t):P.set(t,c),W.value=new Map(P)}function F(t){return P.get(t)??{}}function b(t,n){const c=$(d.value,t);c&&(c.image={src:n.src,naturalW:n.naturalW,naturalH:n.naturalH,width:I(n.width,fe,we),height:I(n.height,fe,we)},O(),L(),a("change",d.value))}function B(t){const n=$(d.value,t);!n||!n.image||(delete n.image,O(),L(),a("change",d.value))}function I(t,n,c){return Math.min(c,Math.max(n,t))}function V(t,n){const c=new FileReader;c.onload=()=>{if(typeof c.result!="string")return;const y=c.result,h=new window.Image;h.onload=()=>{const r=h.naturalWidth||re,p=h.naturalHeight||re,C=I(r,fe,re),A=I(Math.round(p*C/r),fe,we);n({src:y,naturalW:r,naturalH:p,width:C,height:A})},h.onerror=()=>{n({src:y,naturalW:re,naturalH:re,width:re,height:re})},h.src=y},c.readAsDataURL(t)}function q(t){const n=document.createElement("input");n.type="file",n.accept="image/*",n.style.display="none",n.onchange=()=>{var y;const c=(y=n.files)==null?void 0:y[0];c&&(V(c,h=>b(t,h)),document.body.removeChild(n))},document.body.appendChild(n),n.click()}function D(t,n){const c=n.trim(),y=$(d.value,t);y&&(c?y.link={url:c}:delete y.link,O(),L(),a("change",d.value))}function te(t){D(t,"")}function ae(t,n){const c=$(d.value,t);c&&(n?c.note={text:n}:delete c.note,O(),L(),a("change",d.value))}function v(t){ae(t,"")}const z=e.ref(null);function U(t,n){o.readonly||(t.preventDefault(),t.stopPropagation(),m.value=n.id,a("select",$(d.value,n.id)),z.value={nodeId:n.id,x:t.clientX,y:t.clientY})}function j(){z.value=null}function Q(){var n;const t=(n=z.value)==null?void 0:n.nodeId;t&&q(t)}function _(){var y,h,r;const t=(y=z.value)==null?void 0:y.nodeId;if(!t)return;const n=((r=(h=$(d.value,t))==null?void 0:h.link)==null?void 0:r.url)??"",c=window.prompt("输入链接 URL(留空取消)",n);c!==null&&D(t,c)}function me(){var n;const t=(n=z.value)==null?void 0:n.nodeId;t&&te(t)}function be(){var n;const t=(n=z.value)==null?void 0:n.nodeId;t&&at(t)}function he(){var n;const t=(n=z.value)==null?void 0:n.nodeId;t&&v(t)}function Yn(){var n;const t=(n=z.value)==null?void 0:n.nodeId;t&&B(t)}function at(t){o.readonly||a("edit-note",t)}function Gn(t,n=60){const c=t.replace(/\s+/g," ").trim();return c.length<=n?c||"点击编辑笔记":c.slice(0,n)+"…"}function ct(t){var h;if(o.readonly||f.value)return;const n=t.target;if(n&&(n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.isContentEditable))return;const c=m.value;if(!c)return;const y=(h=t.clipboardData)==null?void 0:h.items;if(y)for(let r=0;r<y.length;r++){const p=y[r];if(p.kind==="file"&&p.type.startsWith("image/")){const C=p.getAsFile();if(!C)continue;t.preventDefault();const A=$(d.value,c);if(A!=null&&A.image&&!window.confirm("该节点已有图片,要用剪贴板里的图片替换吗?"))return;V(C,X=>b(c,X));return}}}e.onMounted(()=>{window.addEventListener("paste",ct)}),e.onBeforeUnmount(()=>{window.removeEventListener("paste",ct)});const Ee=e.ref(null),Jn=e.computed(()=>{var t;return((t=Ee.value)==null?void 0:t.nodeId)??null});function Zn(t,n){if(!n.image)return;t.preventDefault(),t.stopPropagation();const c=n.image.naturalW||n.image.width,y=n.image.naturalH||n.image.height,h=y>0?y/c:1;Ee.value={nodeId:n.id,startX:t.clientX,startY:t.clientY,startW:n.image.width,startH:n.image.height,naturalW:c,naturalH:y,ratio:h,pendingW:n.image.width,pendingH:n.image.height},window.addEventListener("mousemove",st),window.addEventListener("mouseup",dt)}function st(t){var A,X;const n=Ee.value;if(!n)return;const c=M.scale.value||1,y=t.clientX-n.startX,h=I(n.startW+y/c,fe,we),r=I(h*n.ratio,fe,we);n.pendingW=h,n.pendingH=r;const p=(A=u.value)==null?void 0:A.querySelector(`[data-node-id="${n.nodeId}"] .zm-node-img`);p&&(p.style.width=`${h}px`,p.style.height=`${r}px`);const C=(X=u.value)==null?void 0:X.querySelector(`[data-node-id="${n.nodeId}"]`);C&&(C.style.minWidth=`${Math.max(80,Math.ceil(h+28))}px`,C.style.height=`${Math.ceil(r+8+30)}px`)}function dt(){const t=Ee.value;if(window.removeEventListener("mousemove",st),window.removeEventListener("mouseup",dt),Ee.value=null,!t)return;const n=$(d.value,t.nodeId);!n||!n.image||(b(t.nodeId,{src:n.image.src,naturalW:n.image.naturalW,naturalH:n.image.naturalH,width:t.pendingW,height:t.pendingH}),m.value=t.nodeId,a("select",n),Oe=!0)}const Pe=e.ref(null);let Oe=!1;function Qn(t){Pe.value=t}function _n(t){Pe.value===t&&(Pe.value=null)}const ut=e.ref(0),Xe=e.ref(!1),le=pn(100);function O(){le.record({data:d.value})}function L(){g.value=new Set(g.value),ut.value++}const ee=e.computed(()=>{var t,n,c,y,h,r,p,C,A,X;return{rootBg:((t=o.theme)==null?void 0:t.rootBg)??"#1f2937",rootText:((n=o.theme)==null?void 0:n.rootText)??"#ffffff",branchBg:((c=o.theme)==null?void 0:c.branchBg)??"#ffffff",branchText:((y=o.theme)==null?void 0:y.branchText)??"#1f2937",lineColor:((h=o.theme)==null?void 0:h.lineColor)??"#94a3b8",bgColor:((r=o.theme)==null?void 0:r.bgColor)??"#f8fafc",fontSize:((p=o.theme)==null?void 0:p.fontSize)??14,lineWidthStart:((C=o.theme)==null?void 0:C.lineWidthStart)??2.2,lineWidthEnd:((A=o.theme)==null?void 0:A.lineWidthEnd)??.8,rainbowBranch:((X=o.theme)==null?void 0:X.rainbowBranch)??!1}}),N=e.reactive({autoBalanceOnChange:!0,lineWidthStart:12,lineWidthEnd:3.6,rainbowBranch:!0,branchPaletteId:"default",customPalettes:[],lineStyle:"curve",layoutMode:"mindmap",taperedEdge:!0,showOrderBadge:!1});function ft(t){return N.taperedEdge?eo(t):ht(t)}function mt(t){return N.taperedEdge?N.lineWidthEnd:ht(t)}function eo(t){return t<=0?N.lineWidthStart:t===1?Math.max(1.5,N.lineWidthStart*.67):t===2?Math.max(.8,N.lineWidthStart*.42):N.lineWidthEnd}function ht(t){if(t<=0)return N.lineWidthStart;if(t>=3)return N.lineWidthEnd;const n=t/3;return N.lineWidthStart+(N.lineWidthEnd-N.lineWidthStart)*n}function to(t,n,c,y){const h=1-t,r=h*h*h*n.x+3*h*h*t*c.x1+3*h*t*t*c.x2+t*t*t*y.x,p=h*h*h*n.y+3*h*h*t*c.y1+3*h*t*t*c.y2+t*t*t*y.y;return{x:r,y:p}}function no(t,n,c,y,h=32,r="curve",p="right"){if(r==="curve"){let de;if(p==="right"||p==="left"){const R=Math.abs(n.x-t.x)*.45,ie=p==="right"?1:-1;de={x1:t.x+ie*R,y1:t.y,x2:n.x-ie*R,y2:n.y}}else{const R=Math.abs(n.y-t.y)*.45;de={x1:t.x,y1:t.y+R,x2:n.x,y2:n.y-R}}const zo=S=>{const R=1-S,ie=-3*R*R*t.x+3*(R*R-2*R*S)*de.x1+3*(2*R*S-S*S)*de.x2+3*S*S*n.x,xe=-3*R*R*t.y+3*(R*R-2*R*S)*de.y1+3*(2*R*S-S*S)*de.y2+3*S*S*n.y;return{dx:ie,dy:xe}},Be=[],Ge=[];for(let S=0;S<=h;S++){const R=S/h,ie=S===0?t:S===h?n:to(R,t,de,n),xe=zo(R);let Le=Math.hypot(xe.dx,xe.dy);Le<1e-6&&(Le=1);const It=-xe.dy/Le,Wt=xe.dx/Le,Te=(c+(y-c)*R)/2;Be.push({x:ie.x+It*Te,y:ie.y+Wt*Te}),Ge.push({x:ie.x-It*Te,y:ie.y-Wt*Te})}let Re=`M ${Be[0].x.toFixed(2)} ${Be[0].y.toFixed(2)}`;for(let S=1;S<=h;S++)Re+=` L ${Be[S].x.toFixed(2)} ${Be[S].y.toFixed(2)}`;for(let S=h;S>=0;S--)Re+=` L ${Ge[S].x.toFixed(2)} ${Ge[S].y.toFixed(2)}`;return Re+=" Z",Re}const C=n.x-t.x,A=n.y-t.y;let X=Math.hypot(C,A);X<1e-6&&(X=1);const se=-A/X,ye=C/X,pe=c/2,Me=y/2,vt={x:t.x+se*pe,y:t.y+ye*pe},Vt={x:t.x-se*pe,y:t.y-ye*pe},zt={x:n.x-se*Me,y:n.y-ye*Me},$t={x:n.x+se*Me,y:n.y+ye*Me};return`M ${vt.x.toFixed(2)} ${vt.y.toFixed(2)} L ${$t.x.toFixed(2)} ${$t.y.toFixed(2)} L ${zt.x.toFixed(2)} ${zt.y.toFixed(2)} L ${Vt.x.toFixed(2)} ${Vt.y.toFixed(2)} Z`}const $e=e.computed(()=>Y.value.root.children),oo=ke[0].colors,gt=e.computed(()=>rn(N.branchPaletteId,N.customPalettes)),ce=e.computed(()=>{const t=new Map;if(!N.rainbowBranch)return t;const n=o.lineColors,c=n&&n.length>0?n:gt.value.colors.length>0?gt.value.colors:oo;for(let h=0;h<$e.value.length;h++){const r=$e.value[h];t.set(r.id,c[h%c.length])}const y=(h,r)=>{t.set(h.id,r);for(const p of h.children)y(p,r)};for(let h=0;h<$e.value.length;h++){const r=$e.value[h];y(r,c[h%c.length])}return t});function io(t,n){return N.rainbowBranch?ce.value.get(n.id)??ee.value.lineColor:ee.value.lineColor}function lo(t){const n=F(t.id);if(n.bg)return n.bg;if(t.isRoot)return ee.value.rootBg;if(N.rainbowBranch){const c=ce.value.get(t.id);if(c)return so(c,.18)}return ee.value.branchBg}function ro(t){const n=F(t.id);if(n.textColor)return n.textColor;if(t.isRoot)return ee.value.rootText;if(N.rainbowBranch){const c=ce.value.get(t.id);if(c)return yt(c,.55)}return ee.value.branchText}function ao(t){const n=F(t.id);if(n.borderColor)return n.borderColor;if(t.isRoot)return ee.value.rootBg;if(N.rainbowBranch){const c=ce.value.get(t.id);if(c)return yt(c,.3)}return ee.value.lineColor}function co(t){return F(t.id).fontWeight??(t.isRoot?600:400)}function so(t,n){const c=t.replace("#",""),y=c.length===6?c:c.split("").map(C=>C+C).join(""),h=parseInt(y.slice(0,2),16),r=parseInt(y.slice(2,4),16),p=parseInt(y.slice(4,6),16);return`rgba(${h}, ${r}, ${p}, ${n})`}function yt(t,n){const c=t.replace("#",""),y=c.length===6?c:c.split("").map(C=>C+C).join(""),h=Math.round(parseInt(y.slice(0,2),16)*(1-n)),r=Math.round(parseInt(y.slice(2,4),16)*(1-n)),p=Math.round(parseInt(y.slice(4,6),16)*(1-n));return`rgb(${h}, ${r}, ${p})`}const M=hn({getContainer:()=>u.value});M.setOnMarqueeEnd(Bo),yn({isEditing:()=>f.value!==null,isReadonly:()=>o.readonly,getSelectedId:()=>m.value,getRootId:()=>d.value.id,defaultTargetId:()=>d.value.id,onAddChild:ge,onAddSibling:We,onAddSiblingBefore:kt,onRemove:bt,onStartEdit:Ne,onClearSelection:()=>{m.value=null,a("select",null)},onDuplicate:wt,onUndo:Ke,onRedo:Ue,onNavigate:go,onSelectRoot:()=>{m.value=d.value.id;const t=$(d.value,d.value.id);t&&a("select",t)}});const Y=e.computed(()=>{const t=ne(d.value);return xt(t),tn(t,{mode:N.layoutMode,baseFontSize:ee.value.fontSize})}),pt=e.ref([]),qe=e.computed(()=>(ut.value,pt.value));e.watch(Y,t=>{const n=[],c=y=>{n.push(y);for(const h of y.children)c(h)};c(t.root),pt.value=n},{immediate:!0});const uo=e.computed(()=>{const t=[];for(const n of qe.value)for(const c of n.children)t.push({from:n,to:c,key:`${n.id}->${c.id}`});return t}),fo=e.computed(()=>`${Y.value.vbX} ${Y.value.vbY} ${Y.value.vbW} ${Y.value.vbH}`);function xt(t){if(g.value.has(t.id)){t.children=[],t.collapsed=!0;return}t.collapsed=!1;for(const n of t.children)xt(n)}function Ne(t){const n=$(d.value,t);n&&(f.value=t,k.value=n.text,e.nextTick(()=>{const c=document.querySelector(".zm-input");c==null||c.focus(),c==null||c.select()}))}function Ie(t={}){if(!f.value)return;const n=$(d.value,f.value);n&&n.text!==(k.value.trim()||" ")&&(n.text=k.value.trim()||" ",O(),a("change",d.value));const c=f.value;f.value=null,t.addChild?e.nextTick(()=>ge(c)):t.addSibling==="after"?e.nextTick(()=>We(c)):t.addSibling==="before"&&e.nextTick(()=>kt(c))}function mo(){f.value=null}function ho(t){const n=t.metaKey||t.ctrlKey;n&&(t.key==="z"||t.key==="Z")&&!t.shiftKey?(t.preventDefault(),Ke()):(n&&t.shiftKey&&(t.key==="z"||t.key==="Z")||n&&(t.key==="y"||t.key==="Y")&&!t.shiftKey)&&(t.preventDefault(),Ue())}function ge(t){const n=nt(d.value,t,Ve);n&&(O(),L(),a("change",d.value),e.nextTick(()=>Ne(n.id)))}function We(t){if(t===d.value.id){ge(t);return}const n=ot(d.value,t,Ve);n&&(O(),L(),a("change",d.value),e.nextTick(()=>Ne(n.id)))}function kt(t){if(t===d.value.id){ge(t);return}const n=sn(d.value,t,Ve);n&&(O(),L(),a("change",d.value),e.nextTick(()=>Ne(n.id)))}function wt(t){if(t===d.value.id)return;const n=dn(d.value,t);n&&(O(),m.value=n.id,a("change",d.value),L())}function Ke(){const t=le.undo();t&&(d.value=t.data,m.value=null,a("select",null),L(),a("change",d.value))}function Ue(){const t=le.redo();t&&(d.value=t.data,m.value=null,a("select",null),L(),a("change",d.value))}function go(t,n){const c=m.value??d.value.id,y=$(d.value,c);if(!y)return;let h=null;if(n===1){const r=Z(d.value,y.id);if(r){const p=r.children.findIndex(C=>C.id===y.id);p>=0&&p<r.children.length-1&&(h=r.children[p+1].id)}}else if(n===-1){const r=Z(d.value,y.id);if(r){const p=r.children.findIndex(C=>C.id===y.id);p>0&&(h=r.children[p-1].id)}}else if(t===1){const r=Z(d.value,y.id);r&&(h=r.id)}else t===-1&&y.children.length>0&&(h=y.children[0].id);if(h){m.value=h;const r=$(d.value,h);r&&a("select",r)}}function yo(t){const n=t.split(`
|
|
13
|
+
`);return/^(`{3,}|~{3,})/.test(n[0]??"")&&n.shift(),/^(`{3,}|~{3,})\s*$/.test(n[n.length-1]??"")&&n.pop(),n.join(`
|
|
14
|
+
`).replace(/\n+$/,"")}function po(t){return t.split(`
|
|
15
|
+
`).map(n=>n.replace(/^\s*[-*+]\s+/,"").replace(/^\s*\d+\.\s+/,"").trim()).filter(n=>n.length>0)}function xo(t){return t.split(`
|
|
16
|
+
`).filter(n=>n.trim().length>0).filter(n=>!/^\s*\|?\s*(:?-+:?\s*\|\s*)+(:?-+:?)(\s*\|)?\s*$/.test(n)).map(n=>n.replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|").map(c=>c.trim()))}function ko(t){return t.replace(/\s+/g," ").trim()}function bt(t){t!==d.value.id&&He(d.value,t)&&(O(),m.value===t&&(m.value=null),L(),a("change",d.value))}function Et(t){g.value.has(t)?g.value.delete(t):g.value.add(t),L()}function wo(t,n){an(d.value,t,n)&&(O(),L(),a("change",d.value))}function bo(t,n,c){return cn(d.value,t,n,c)?(O(),L(),a("change",d.value),!0):!1}function Eo(t,n){t.stopPropagation(),m.value=n.id;const c=$(d.value,n.id);a("select",c)}function No(t){const n=t.target;if(!n||n.closest(".zm-node, .zm-toolbar, button, input, textarea"))return;if(t.button===2){M.startPan(t);return}if(t.button!==0)return;const c=u.value.getBoundingClientRect(),y=(t.clientX-c.left-M.offsetX.value)/M.scale.value,h=(t.clientY-c.top-M.offsetY.value)/M.scale.value;M.startMarquee(y,h)}function Mo(t){if(Oe){Oe=!1;return}const n=t.target;if(!n||n.closest(".zm-node"))return;const c=M.marquee;c.width>=4||c.height>=4||m.value!==null&&(m.value=null,a("select",null))}function Bo(){const t=M.marquee;if(t.width<4&&t.height<4)return;const n=t.x,c=t.y,y=t.x+t.width,h=t.y+t.height,r=[];for(const p of qe.value){const C=p.width/2,A=p.height/2,X=p.x-C,se=p.x+C,ye=p.y-A,pe=p.y+A;X<=y&&se>=n&&ye<=h&&pe>=c&&r.push(p.id)}if(r.length>0){m.value=r[0];const p=$(d.value,r[0]);p&&a("select",p)}}function Nt(t){return g.value.has(t)}function Co(t){const n=$(d.value,t.id);return!!n&&n.children.length>0}function je(t){const n=$(d.value,t);return n?n.children.length:0}function Mt(t){if(!$(d.value,t))return 0;const y=[d.value];for(;y.length;){const h=y.pop(),r=h.children.findIndex(p=>p.id===t);if(r>=0)return r;for(const p of h.children)y.push(p)}return 0}function Bt(t,n,c,y){if(((y==null?void 0:y._dir)??t._dir)==="down")return n==="out"?{x:t.x,y:t.y+t.height/2}:{x:t.x,y:t.y-t.height/2};let r;return n==="in"?r=-t.side:c!==void 0?r=c:r=t.side,{x:t.x+r*(t.width/2),y:t.y}}function oe(){const t=Y.value;M.resetView(t.width,t.height,t.root.y)}function So(){Xe.value=!0,O(),L(),e.nextTick(()=>oe())}function Ye(t){N.layoutMode!==t&&(N.layoutMode=t,L(),e.nextTick(()=>oe()))}function Ct(){return JSON.stringify(d.value,null,2)}function St(t){try{const n=JSON.parse(t);return!n.id||!Array.isArray(n.children)?!1:(le.reset(),d.value=ne(n),m.value=null,g.value=new Set,L(),e.nextTick(()=>oe()),a("change",d.value),!0)}catch{return!1}}function vo(){const t=document.createElement("input");t.type="file",t.accept="application/json",t.onchange=()=>{var y;const n=(y=t.files)==null?void 0:y[0];if(!n)return;const c=new FileReader;c.onload=()=>{typeof c.result=="string"&&(St(c.result)||alert("导入失败:JSON 格式无效"))},c.readAsText(n)},t.click()}function Vo(){const t=new Blob([Ct()],{type:"application/json"}),n=URL.createObjectURL(t),c=document.createElement("a");c.href=n,c.download=`${d.value.text||"mindmap"}.json`,c.click(),URL.revokeObjectURL(n)}return s({addChild:t=>ge(t),addSibling:t=>We(t),removeNode:t=>bt(t),duplicateNode:t=>wt(t),setNodeText:(t,n)=>wo(t,n),moveNode:(t,n,c)=>bo(t,n,c),lineWidthForDepth:ft,endWidthForDepth:mt,getData:()=>d.value,setData:t=>{le.reset(),d.value=ne(t),m.value=null,g.value=new Set,L(),O(),e.nextTick(()=>oe())},resetView:()=>oe(),exportData:Ct,importData:St,getMarkdown:()=>ze(d.value),setMarkdown:(t,n=!0)=>{const c=Fe(t||"");n&&(x.value=!0),E=!n,le.reset(),d.value=ne(c),m.value=null,g.value=new Set,L(),O(),e.nextTick(()=>{E=!1,oe()}),a("change",d.value)},setBalanced:t=>{Xe.value=t},isBalanced:()=>Xe.value,balance:()=>So(),applyNodeStyle:(t,n)=>K(t,n),getNodeStyle:t=>F(t),applyNodeLink:(t,n)=>D(t,n),removeNodeLink:t=>te(t),applyNodeNote:(t,n)=>ae(t,n),removeNodeNote:t=>v(t),undo:()=>Ke(),redo:()=>Ue(),canUndo:()=>le.canUndo(),canRedo:()=>le.canRedo(),applySettings:t=>{t.autoBalanceOnChange!==void 0&&(N.autoBalanceOnChange=t.autoBalanceOnChange),t.lineWidthStart!==void 0&&(N.lineWidthStart=Math.max(.5,Math.min(20,t.lineWidthStart))),t.lineWidthEnd!==void 0&&(N.lineWidthEnd=Math.max(.3,Math.min(10,t.lineWidthEnd))),t.rainbowBranch!==void 0&&(N.rainbowBranch=t.rainbowBranch),t.branchPaletteId!==void 0&&(N.branchPaletteId=t.branchPaletteId),t.customPalettes!==void 0&&(N.customPalettes=t.customPalettes),t.lineStyle!==void 0&&(N.lineStyle=t.lineStyle),t.taperedEdge!==void 0&&(N.taperedEdge=t.taperedEdge),t.showOrderBadge!==void 0&&(N.showOrderBadge=t.showOrderBadge)},getSettings:()=>({autoBalanceOnChange:N.autoBalanceOnChange,lineWidthStart:N.lineWidthStart,lineWidthEnd:N.lineWidthEnd,rainbowBranch:N.rainbowBranch,branchPaletteId:N.branchPaletteId,customPalettes:N.customPalettes,lineStyle:N.lineStyle,layoutMode:N.layoutMode,taperedEdge:N.taperedEdge,showOrderBadge:N.showOrderBadge}),setBranchPalette:t=>{if(!t)return;[...ke,...N.customPalettes].find(c=>c.id===t)&&(N.branchPaletteId=t)},getBranchPalette:()=>N.branchPaletteId,getBranchPalettes:()=>[...ke,...N.customPalettes]}),e.watch(()=>o.data,t=>{d.value=ne(t),L()},{deep:!1}),e.onMounted(()=>{O(),e.nextTick(()=>oe())}),(t,n)=>{var c,y,h;return e.openBlock(),e.createElementBlock("div",{class:"zm-mindmap",style:e.normalizeStyle({background:ee.value.bgColor,fontSize:ee.value.fontSize+"px"})},[e.createElementVNode("div",{ref_key:"wrapperRef",ref:u,class:"zm-canvas",onMousedown:No,onContextmenu:n[16]||(n[16]=e.withModifiers(()=>{},["prevent"])),onWheel:n[17]||(n[17]=(...r)=>e.unref(M).onWheel&&e.unref(M).onWheel(...r)),onClick:Mo},[e.createElementVNode("div",{class:"zm-svg-layer",style:e.normalizeStyle({left:Y.value.vbX*e.unref(M).scale.value+e.unref(M).offsetX.value+"px",top:Y.value.vbY*e.unref(M).scale.value+e.unref(M).offsetY.value+"px",width:Y.value.vbW*e.unref(M).scale.value+"px",height:Y.value.vbH*e.unref(M).scale.value+"px"})},[(e.openBlock(),e.createElementBlock("svg",{class:"zm-svg",viewBox:fo.value,preserveAspectRatio:"xMinYMin meet",width:Y.value.vbW*e.unref(M).scale.value,height:Y.value.vbH*e.unref(M).scale.value},[e.createElementVNode("g",Cn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(uo.value,r=>(e.openBlock(),e.createElementBlock("path",{key:r.key,d:no(Bt(r.from,"out",r.to.side,r.to),Bt(r.to,"in"),ft(r.from.depth),mt(r.to.depth),32,N.lineStyle,r.to._dir),fill:io(r.from,r.to),stroke:"none"},null,8,Sn))),128))])],8,Bn))],4),e.unref(M).isMarquee.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"zm-marquee",style:e.normalizeStyle({left:e.unref(M).marquee.x*e.unref(M).scale.value+e.unref(M).offsetX.value+"px",top:e.unref(M).marquee.y*e.unref(M).scale.value+e.unref(M).offsetY.value+"px",width:e.unref(M).marquee.width*e.unref(M).scale.value+"px",height:e.unref(M).marquee.height*e.unref(M).scale.value+"px"})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"zm-world",style:e.normalizeStyle({transform:`translate(${e.unref(M).offsetX.value}px, ${e.unref(M).offsetY.value}px) scale(${e.unref(M).scale.value})`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(qe.value,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:e.normalizeClass(["zm-node",{"is-root":r.isRoot,"is-selected":m.value===r.id,"is-editing":f.value===r.id,"has-image":!!r.image,"is-resizing":Jn.value===r.id}]),"data-node-id":r.id,style:e.normalizeStyle({left:r.x+"px",top:r.y+"px",minWidth:r.width+"px",height:r.height+"px",fontSize:r.fontSize+"px",background:lo(r),color:ro(r),borderColor:ao(r),fontWeight:co(r),transform:"translate(-50%, -50%)"}),onClick:p=>Eo(p,r),onDblclick:p=>{p.stopPropagation(),i.readonly||Ne(r.id)},onContextmenu:p=>U(p,r),onMouseenter:p=>Qn(r.id),onMouseleave:p=>_n(r.id)},[r.image?(e.openBlock(),e.createElementBlock("img",{key:0,class:"zm-node-img",src:r.image.src,width:r.image.width,height:r.image.height,alt:r.text,draggable:"false"},null,8,Vn)):e.createCommentVNode("",!0),f.value!==r.id?(e.openBlock(),e.createElementBlock("span",zn,[e.createElementVNode("span",$n,e.toDisplayString(r.text),1),r.link&&!f.value?(e.openBlock(),e.createElementBlock("a",{key:0,class:"zm-node-link",href:r.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开链接:${r.link.url}`,onClick:n[0]||(n[0]=e.withModifiers(()=>{},["stop"])),onMousedown:n[1]||(n[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(H,{name:"link",size:11,stroke:2})],40,In)):e.createCommentVNode("",!0),r.note&&!f.value?(e.openBlock(),e.createElementBlock("button",{key:1,class:"zm-node-note-btn",type:"button",title:Gn(r.note.text),onClick:e.withModifiers(p=>at(r.id),["stop"]),onMousedown:n[2]||(n[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(H,{name:"note",size:11,stroke:2})],40,Wn)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),r.richContent&&f.value!==r.id?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["zm-rich",`zm-rich-${r.richContent.kind}`]),onClick:n[3]||(n[3]=e.withModifiers(()=>{},["stop"])),onDblclick:n[4]||(n[4]=e.withModifiers(()=>{},["stop"])),onMousedown:n[5]||(n[5]=e.withModifiers(()=>{},["stop"]))},[r.richContent.kind==="code"?(e.openBlock(),e.createElementBlock("pre",Rn,[e.createElementVNode("code",{class:e.normalizeClass(r.richContent.lang?`language-${r.richContent.lang}`:"")},e.toDisplayString(yo(r.richContent.raw)),3)])):r.richContent.kind==="list"?(e.openBlock(),e.createElementBlock("ul",Ln,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(po(r.richContent.raw),(p,C)=>(e.openBlock(),e.createElementBlock("li",{key:C},e.toDisplayString(p),1))),128))])):r.richContent.kind==="table"?(e.openBlock(),e.createElementBlock("table",Tn,[e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(xo(r.richContent.raw),(p,C)=>(e.openBlock(),e.createElementBlock("tr",{key:C},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p,(A,X)=>(e.openBlock(),e.createElementBlock("td",{key:X},e.toDisplayString(A),1))),128))]))),128))])])):(e.openBlock(),e.createElementBlock("div",Dn,e.toDisplayString(ko(r.richContent.raw)),1))],34)):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:3,class:"zm-input","onUpdate:modelValue":n[6]||(n[6]=p=>k.value=p),autofocus:"",onBlur:n[7]||(n[7]=p=>Ie()),onKeydown:[n[8]||(n[8]=e.withKeys(e.withModifiers(p=>Ie({addSibling:"after"}),["exact"]),["enter"])),n[9]||(n[9]=e.withKeys(e.withModifiers(p=>Ie({addSibling:"before"}),["shift","prevent","exact"]),["enter"])),n[10]||(n[10]=e.withKeys(e.withModifiers(p=>Ie({addChild:!0}),["prevent"]),["tab"])),e.withKeys(mo,["esc"]),ho],onMousedown:n[11]||(n[11]=e.withModifiers(()=>{},["stop"])),onClick:n[12]||(n[12]=e.withModifiers(()=>{},["stop"]))},null,544)),[[e.vModelText,k.value]]),w.value?(e.openBlock(),e.createElementBlock("span",{key:4,class:"zm-order-badge",title:`数据顺序:第 ${Mt(r.id)+1} 个`},e.toDisplayString(Mt(r.id)+1),9,An)):e.createCommentVNode("",!0),Nt(r.id)&&!r.isRoot&&je(r.id)>0?(e.openBlock(),e.createElementBlock("span",{key:5,class:e.normalizeClass(["zm-collapse-badge",{"is-on-left":r.side===-1}]),style:e.normalizeStyle({background:ce.value.get(r.id)??"#64748b"}),title:`展开 ${je(r.id)} 个子节点`,onMousedown:n[13]||(n[13]=e.withModifiers(()=>{},["stop"])),onClick:e.withModifiers(p=>Et(r.id),["stop"])},e.toDisplayString(je(r.id)),47,Hn)):e.createCommentVNode("",!0),!i.readonly&&!r.isRoot&&Co(r)&&!Nt(r.id)?(e.openBlock(),e.createElementBlock("button",{key:6,class:e.normalizeClass(["zm-btn zm-collapse",{"is-on-left":r.side===-1}]),style:e.normalizeStyle({color:ce.value.get(r.id)??"#64748b",borderColor:ce.value.get(r.id)??"#64748b"}),title:"折叠",onMousedown:n[14]||(n[14]=e.withModifiers(()=>{},["stop"])),onClick:e.withModifiers(p=>Et(r.id),["stop"])},[e.createVNode(H,{name:"minus",size:10,stroke:2.4})],46,Fn)):e.createCommentVNode("",!0),r.image&&m.value===r.id&&f.value!==r.id?(e.openBlock(),e.createElementBlock("span",{key:7,class:"zm-img-resize-handle",title:"拖动调整图片大小",onMousedown:e.withModifiers(p=>Zn(p,r),["stop"])},null,40,Pn)):e.createCommentVNode("",!0),r.image&&m.value===r.id&&f.value!==r.id?(e.openBlock(),e.createElementBlock("button",{key:8,class:"zm-img-remove-btn",title:"移除图片",onMousedown:n[15]||(n[15]=e.withModifiers(()=>{},["stop"])),onClick:e.withModifiers(p=>B(r.id),["stop"])},[e.createVNode(H,{name:"x",size:9,stroke:2.2})],40,On)):e.createCommentVNode("",!0)],46,vn))),128))],4),z.value?(e.openBlock(),e.createBlock(Mn,{key:1,x:z.value.x,y:z.value.y,container:u.value,"has-image":!!((c=e.unref($)(d.value,z.value.nodeId))!=null&&c.image),"has-link":!!((y=e.unref($)(d.value,z.value.nodeId))!=null&&y.link),"has-note":!!((h=e.unref($)(d.value,z.value.nodeId))!=null&&h.note),readonly:o.readonly,onPickImage:Q,onRemoveImage:Yn,onSetLink:_,onRemoveLink:me,onEditNote:be,onRemoveNote:he,onClose:j},null,8,["x","y","container","has-image","has-link","has-note","readonly"])):e.createCommentVNode("",!0)],544),o.previewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Xn,[e.createElementVNode("button",{class:"zm-tb-btn",title:"放大",onClick:n[18]||(n[18]=(...r)=>e.unref(M).zoomIn&&e.unref(M).zoomIn(...r))},[e.createVNode(H,{name:"zoom-in"})]),e.createElementVNode("button",{class:"zm-tb-btn",title:"缩小",onClick:n[19]||(n[19]=(...r)=>e.unref(M).zoomOut&&e.unref(M).zoomOut(...r))},[e.createVNode(H,{name:"zoom-out"})]),e.createElementVNode("button",{class:"zm-tb-btn",title:"重置视图",onClick:oe},[e.createVNode(H,{name:"reset"})]),n[25]||(n[25]=e.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),i.readonly?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"zm-tb-btn",title:"添加子节点 (Tab)",onClick:n[20]||(n[20]=r=>m.value&&ge(m.value))},[e.createElementVNode("img",{src:e.unref(At),width:"14",height:"14",alt:"添加子节点",draggable:"false"},null,8,qn)])),i.readonly?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:1,class:"zm-tb-btn",title:"添加同级 (Enter)",onClick:n[21]||(n[21]=r=>m.value&&We(m.value))},[e.createElementVNode("img",{src:e.unref(Dt),width:"14",height:"14",alt:"添加同级",draggable:"false"},null,8,Kn)])),n[26]||(n[26]=e.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),e.createElementVNode("button",{class:e.normalizeClass(["zm-tb-btn",{active:N.layoutMode==="mindmap"}]),title:"思维导图布局 (中心辐射)",onClick:n[22]||(n[22]=r=>Ye("mindmap"))},[e.createVNode(H,{name:"mindmap"})],2),e.createElementVNode("button",{class:e.normalizeClass(["zm-tb-btn",{active:N.layoutMode==="tree"}]),title:"树形布局 (向右展开)",onClick:n[23]||(n[23]=r=>Ye("tree"))},[e.createVNode(H,{name:"tree"})],2),e.createElementVNode("button",{class:e.normalizeClass(["zm-tb-btn",{active:N.layoutMode==="org"}]),title:"组织结构布局 (向下展开)",onClick:n[24]||(n[24]=r=>Ye("org"))},[e.createVNode(H,{name:"org"})],2),n[27]||(n[27]=e.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),i.readonly?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:2,class:"zm-tb-btn",title:"导入 JSON",onClick:vo},[e.createVNode(H,{name:"import"})])),e.createElementVNode("button",{class:"zm-tb-btn",title:"导出 JSON",onClick:Vo},[e.createVNode(H,{name:"export"})]),e.createElementVNode("span",Un,e.toDisplayString(Math.round(e.unref(M).scale.value*100))+"%",1)]))],4)}}}),jn={install(i){i.component("FlowMindMap",rt)}};T.MindMap=rt,T.addChild=nt,T.addSibling=ot,T.clone=ne,T.default=jn,T.findNode=$,T.findParent=Z,T.markdownToMindMap=Fe,T.markdownToRichMindMap=fn,T.mindMapToMarkdown=ze,T.removeNode=He,T.richBlockToMarkdown=mn,T.uid=J,Object.defineProperties(T,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.zm-node-menu{position:fixed;z-index:40;min-width:168px;padding:4px;background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 8px 24px #0f172a24;display:flex;flex-direction:column;gap:2px;font-size:13px;color:#1e293b;-webkit-user-select:none;user-select:none}.zm-node-menu-item{display:flex;align-items:center;gap:8px;padding:6px 10px;border:none;background:transparent;color:inherit;font:inherit;text-align:left;border-radius:4px;cursor:pointer;width:100%;transition:background .1s}.zm-node-menu-item:hover:not(:disabled){background:#f1f5f9}.zm-node-menu-item:active:not(:disabled){background:#e2e8f0}.zm-node-menu-item:disabled{color:#94a3b8;cursor:not-allowed}.zm-mindmap{position:relative;width:100%;height:100%;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif;-webkit-user-select:none;user-select:none}.zm-canvas{position:absolute;top:0;right:0;bottom:0;left:0;cursor:grab}.zm-canvas:active{cursor:grabbing}.zm-world{position:absolute;left:0;top:0;transform-origin:0 0}.zm-svg-layer{position:absolute;pointer-events:none;overflow:visible}.zm-marquee{position:absolute;border:1px dashed #3b82f6;background:#3b82f614;pointer-events:none;z-index:5}.zm-svg{position:absolute;left:0;top:0;pointer-events:none;overflow:visible;shape-rendering:geometricPrecision}.zm-node{position:absolute;display:flex;align-items:center;justify-content:center;padding:0 .8em;box-sizing:border-box;border-radius:8px;border:1px solid;line-height:1.2;cursor:default;transition:box-shadow .15s;box-shadow:0 1px 2px #0000000f;white-space:nowrap;z-index:1}.zm-node:hover{box-shadow:0 4px 12px #0000001a;z-index:2}.zm-node.is-root{font-weight:600}.zm-node.is-selected{outline:2px solid #3b82f6;outline-offset:2px;z-index:3}.zm-text{display:inline-flex;align-items:center;gap:4px;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.zm-text-label{pointer-events:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex-shrink:1}.zm-input{border:none;outline:none;background:transparent;color:inherit;font:inherit;text-align:center;width:100%;min-width:40px}.zm-btn{position:absolute;width:18px;height:18px;border-radius:50%;border:none;background:#3b82f6;color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;opacity:0;transition:opacity .15s,transform .15s;z-index:4}.zm-node:hover .zm-btn,.zm-node.is-selected .zm-btn{opacity:1}.zm-btn:hover{transform:scale(1.15)}.zm-collapse{right:-8px;top:50%;width:14px;height:14px;background:#fff;border:1.5px solid;transform:translateY(-50%);box-shadow:0 1px 3px #0f172a2e}.zm-collapse.is-on-left{right:auto;left:-8px}.zm-collapse:hover{transform:translateY(-50%) scale(1.15);background:#fff}.zm-collapse-badge{position:absolute;top:50%;transform:translateY(-50%);left:calc(100% + 8px);min-width:18px;height:18px;padding:0 5px;border-radius:5px;color:#fff;font-size:11px;font-weight:600;line-height:18px;text-align:center;box-shadow:0 1px 2px #00000026;cursor:pointer;-webkit-user-select:none;user-select:none;z-index:2;transition:filter .1s}.zm-collapse-badge.is-on-left{left:auto;right:calc(100% + 8px)}.zm-collapse-badge:hover{filter:brightness(.9)}.zm-node.has-image{flex-direction:column;padding:8px;gap:6px;white-space:normal}.zm-node-img{display:block;pointer-events:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none;object-fit:contain;border-radius:4px}.zm-node-link,.zm-node-note-btn{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:none;background:transparent;color:currentColor;border-radius:3px;cursor:pointer;flex-shrink:0;text-decoration:none;opacity:.75;transition:opacity .1s,background .1s;pointer-events:auto}.zm-node-link:hover,.zm-node-note-btn:hover{opacity:1;background:#0f172a14}.zm-node-link svg,.zm-node-note-btn svg{display:block}.zm-img-resize-handle{position:absolute;right:-5px;bottom:-5px;width:10px;height:10px;background:#fff;border:1.5px solid #3b82f6;border-radius:2px;cursor:nwse-resize;z-index:4;box-shadow:0 1px 3px #0f172a33}.zm-node.is-resizing{cursor:nwse-resize!important}.zm-img-remove-btn{position:absolute;right:-5px;bottom:14px;width:14px;height:14px;background:#fff;border:1px solid #cbd5e1;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#64748b;padding:0;z-index:4;box-shadow:0 1px 2px #0f172a1f}.zm-img-remove-btn:hover{background:#fee2e2;color:#b91c1c;border-color:#fca5a5}.zm-order-badge{display:inline-block;margin-left:6px;padding:0 5px;font-size:10px;font-weight:600;line-height:16px;color:#475569;background:#e2e8f0;border-radius:3px;font-variant-numeric:tabular-nums;pointer-events:none;-webkit-user-select:none;user-select:none;vertical-align:middle}.zm-toolbar{position:absolute;bottom:16px;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:4px;padding:6px 10px;background:#fff;border:1px solid #e2e8f0;border-radius:999px;box-shadow:0 4px 12px #0000000f;z-index:10}.zm-tb-btn{width:32px;height:32px;display:flex;align-items:center;justify-content:center;border:none;background:transparent;border-radius:6px;cursor:pointer;color:#475569}.zm-tb-btn:hover{background:#f1f5f9;color:#1e293b}.zm-tb-btn img{filter:invert(20%) sepia(15%) saturate(500%) hue-rotate(180deg);transition:filter .1s}.zm-tb-btn:hover img{filter:invert(15%) sepia(30%) saturate(800%) hue-rotate(180deg)}.zm-tb-btn.active{background:var(--zm-tb-active, #fff7ed);color:var(--zm-tb-active-fg, #c2410c)}.zm-tb-divider{width:1px;height:18px;background:#e2e8f0;margin:0 4px}.zm-tb-tip{font-size:12px;color:#64748b;min-width:38px;text-align:center}
|
|
1
|
+
.zm-node-menu{position:fixed;z-index:40;min-width:168px;padding:4px;background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 8px 24px #0f172a24;display:flex;flex-direction:column;gap:2px;font-size:13px;color:#1e293b;-webkit-user-select:none;user-select:none}.zm-node-menu-item{display:flex;align-items:center;gap:8px;padding:6px 10px;border:none;background:transparent;color:inherit;font:inherit;text-align:left;border-radius:4px;cursor:pointer;width:100%;transition:background .1s}.zm-node-menu-item:hover:not(:disabled){background:#f1f5f9}.zm-node-menu-item:active:not(:disabled){background:#e2e8f0}.zm-node-menu-item:disabled{color:#94a3b8;cursor:not-allowed}.zm-mindmap{position:relative;width:100%;height:100%;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif;-webkit-user-select:none;user-select:none}.zm-canvas{position:absolute;top:0;right:0;bottom:0;left:0;cursor:grab}.zm-canvas:active{cursor:grabbing}.zm-world{position:absolute;left:0;top:0;transform-origin:0 0}.zm-svg-layer{position:absolute;pointer-events:none;overflow:visible}.zm-marquee{position:absolute;border:1px dashed #3b82f6;background:#3b82f614;pointer-events:none;z-index:5}.zm-svg{position:absolute;left:0;top:0;pointer-events:none;overflow:visible;shape-rendering:geometricPrecision}.zm-node{position:absolute;display:flex;align-items:center;justify-content:center;padding:0 .8em;box-sizing:border-box;border-radius:8px;border:1px solid;line-height:1.2;cursor:default;transition:box-shadow .15s;box-shadow:0 1px 2px #0000000f;white-space:nowrap;z-index:1}.zm-node:hover{box-shadow:0 4px 12px #0000001a;z-index:2}.zm-node.is-root{font-weight:600}.zm-node.is-selected{outline:2px solid #3b82f6;outline-offset:2px;z-index:3}.zm-text{display:inline-flex;align-items:center;gap:4px;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.zm-text-label{pointer-events:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex-shrink:1}.zm-input{border:none;outline:none;background:transparent;color:inherit;font:inherit;text-align:center;width:100%;min-width:40px}.zm-rich{pointer-events:none;margin-top:6px;width:100%;max-width:260px;max-height:160px;overflow:auto;font-size:.78em;line-height:1.35;text-align:left;background:#0000000a;border-radius:4px;padding:6px 8px;color:inherit}.zm-rich-code{margin:0;font-family:JetBrains Mono,Fira Code,Consolas,monospace;font-size:.92em;white-space:pre-wrap;word-break:break-word}.zm-rich-list{margin:0;padding-left:1.2em;list-style:disc}.zm-rich-list li{margin:1px 0}.zm-rich-table{width:100%;border-collapse:collapse;font-size:.92em}.zm-rich-table td{border:1px solid currentColor;opacity:.7;padding:2px 5px}.zm-rich-paragraph{white-space:pre-wrap;word-break:break-word}.zm-btn{position:absolute;width:18px;height:18px;border-radius:50%;border:none;background:#3b82f6;color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;opacity:0;transition:opacity .15s,transform .15s;z-index:4}.zm-node:hover .zm-btn,.zm-node.is-selected .zm-btn{opacity:1}.zm-btn:hover{transform:scale(1.15)}.zm-collapse{right:-8px;top:50%;width:14px;height:14px;background:#fff;border:1.5px solid;transform:translateY(-50%);box-shadow:0 1px 3px #0f172a2e}.zm-collapse.is-on-left{right:auto;left:-8px}.zm-collapse:hover{transform:translateY(-50%) scale(1.15);background:#fff}.zm-collapse-badge{position:absolute;top:50%;transform:translateY(-50%);left:calc(100% + 8px);min-width:18px;height:18px;padding:0 5px;border-radius:5px;color:#fff;font-size:11px;font-weight:600;line-height:18px;text-align:center;box-shadow:0 1px 2px #00000026;cursor:pointer;-webkit-user-select:none;user-select:none;z-index:2;transition:filter .1s}.zm-collapse-badge.is-on-left{left:auto;right:calc(100% + 8px)}.zm-collapse-badge:hover{filter:brightness(.9)}.zm-node.has-image{flex-direction:column;padding:8px;gap:6px;white-space:normal}.zm-node-img{display:block;pointer-events:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none;object-fit:contain;border-radius:4px}.zm-node-link,.zm-node-note-btn{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:none;background:transparent;color:currentColor;border-radius:3px;cursor:pointer;flex-shrink:0;text-decoration:none;opacity:.75;transition:opacity .1s,background .1s;pointer-events:auto}.zm-node-link:hover,.zm-node-note-btn:hover{opacity:1;background:#0f172a14}.zm-node-link svg,.zm-node-note-btn svg{display:block}.zm-img-resize-handle{position:absolute;right:-5px;bottom:-5px;width:10px;height:10px;background:#fff;border:1.5px solid #3b82f6;border-radius:2px;cursor:nwse-resize;z-index:4;box-shadow:0 1px 3px #0f172a33}.zm-node.is-resizing{cursor:nwse-resize!important}.zm-img-remove-btn{position:absolute;right:-5px;bottom:14px;width:14px;height:14px;background:#fff;border:1px solid #cbd5e1;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#64748b;padding:0;z-index:4;box-shadow:0 1px 2px #0f172a1f}.zm-img-remove-btn:hover{background:#fee2e2;color:#b91c1c;border-color:#fca5a5}.zm-order-badge{display:inline-block;margin-left:6px;padding:0 5px;font-size:10px;font-weight:600;line-height:16px;color:#475569;background:#e2e8f0;border-radius:3px;font-variant-numeric:tabular-nums;pointer-events:none;-webkit-user-select:none;user-select:none;vertical-align:middle}.zm-toolbar{position:absolute;bottom:16px;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:4px;padding:6px 10px;background:#fff;border:1px solid #e2e8f0;border-radius:999px;box-shadow:0 4px 12px #0000000f;z-index:10}.zm-tb-btn{width:32px;height:32px;display:flex;align-items:center;justify-content:center;border:none;background:transparent;border-radius:6px;cursor:pointer;color:#475569}.zm-tb-btn:hover{background:#f1f5f9;color:#1e293b}.zm-tb-btn img{filter:invert(20%) sepia(15%) saturate(500%) hue-rotate(180deg);transition:filter .1s}.zm-tb-btn:hover img{filter:invert(15%) sepia(30%) saturate(800%) hue-rotate(180deg)}.zm-tb-btn.active{background:var(--zm-tb-active, #fff7ed);color:var(--zm-tb-active-fg, #c2410c)}.zm-tb-divider{width:1px;height:18px;background:#e2e8f0;margin:0 4px}.zm-tb-tip{font-size:12px;color:#64748b;min-width:38px;text-align:center}
|
package/dist/tree.d.ts
CHANGED
|
@@ -66,3 +66,31 @@ export declare function markdownToMindMap(md: string, rootText?: string): MindMa
|
|
|
66
66
|
* link to the right heading.
|
|
67
67
|
*/
|
|
68
68
|
export declare function mindMapToMarkdown(n: MindMapNode, depth?: number): string;
|
|
69
|
+
/**
|
|
70
|
+
* Parse a whole markdown document into a MindMapNode tree where
|
|
71
|
+
* every block (heading, paragraph, list, code fence, table)
|
|
72
|
+
* becomes a node. Body blocks carry their original markdown
|
|
73
|
+
* payload in `node.richContent` so the renderer can show code,
|
|
74
|
+
* tables, lists, etc. inside the node box. Headings form the
|
|
75
|
+
* hierarchy; everything else is attached to the most recent
|
|
76
|
+
* heading as a child (or to the synthetic root if no heading
|
|
77
|
+
* has been seen yet).
|
|
78
|
+
*
|
|
79
|
+
* Unlike `markdownToMindMap`, this does NOT collapse body into
|
|
80
|
+
* a single child of the heading, and the depth is unbounded —
|
|
81
|
+
* a paragraph under `## Foo` becomes a child of `Foo`, and a
|
|
82
|
+
* paragraph that follows a list under the same heading becomes
|
|
83
|
+
* a sibling of that list, etc. This is the mode the user
|
|
84
|
+
* asked for: "every paragraph becomes a child, no depth limit".
|
|
85
|
+
*
|
|
86
|
+
* A document with no `#` heading still produces a valid tree —
|
|
87
|
+
* every block lands under the synthetic root.
|
|
88
|
+
*/
|
|
89
|
+
export declare function markdownToRichMindMap(md: string, rootText?: string): MindMapNode;
|
|
90
|
+
/**
|
|
91
|
+
* Serialize a single node's rich body (if any) back to the
|
|
92
|
+
* original markdown it came from. Used by `mindMapToMarkdown`
|
|
93
|
+
* to round-trip a tree built by `markdownToRichMindMap`.
|
|
94
|
+
* Returns '' when the node has no rich body.
|
|
95
|
+
*/
|
|
96
|
+
export declare function richBlockToMarkdown(n: MindMapNode): string;
|
package/dist/types.d.ts
CHANGED
|
@@ -44,6 +44,34 @@ export interface MindMapNode {
|
|
|
44
44
|
note?: {
|
|
45
45
|
text: string;
|
|
46
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Optional rich body. When set, the node renders the raw
|
|
49
|
+
* markdown payload in a small framed block under the title
|
|
50
|
+
* (code fences get monospace styling, lists get bullet
|
|
51
|
+
* markers, tables get a mini grid, paragraphs get plain
|
|
52
|
+
* text). Produced by `markdownToRichMindMap` so a whole
|
|
53
|
+
* markdown document can be previewed as a mindmap without
|
|
54
|
+
* losing its body content. The first line of `raw` is
|
|
55
|
+
* still available as `text` so the node always has a
|
|
56
|
+
* meaningful label.
|
|
57
|
+
*/
|
|
58
|
+
richContent?: RichContent;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A node body that came from a markdown block. `raw` is the
|
|
62
|
+
* original markdown source for the block (preserved verbatim so
|
|
63
|
+
* `mindMapToMarkdown` can re-emit it byte-for-byte). `kind`
|
|
64
|
+
* tells the renderer which layout to use.
|
|
65
|
+
*/
|
|
66
|
+
export interface RichContent {
|
|
67
|
+
kind: 'code' | 'list' | 'table' | 'paragraph';
|
|
68
|
+
/** Original markdown source. Always non-empty. */
|
|
69
|
+
raw: string;
|
|
70
|
+
/**
|
|
71
|
+
* Optional language tag for code blocks (the info string after
|
|
72
|
+
* the opening fence). `undefined` for non-code kinds.
|
|
73
|
+
*/
|
|
74
|
+
lang?: string;
|
|
47
75
|
}
|
|
48
76
|
export interface MindMapImage {
|
|
49
77
|
/** Remote URL or data URL. Always a string — never undefined. */
|