flow-mindmap 0.2.0 → 0.2.2
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/README.md +337 -337
- package/dist/components/MindMap.vue.d.ts +9 -1
- package/dist/components/NodeContextMenu.vue.d.ts +21 -0
- package/dist/components/NotePanel.vue.d.ts +14 -0
- package/dist/composables/useAutosize.d.ts +21 -0
- package/dist/composables/useMarkdown.d.ts +6 -0
- package/dist/composables/useRichContent.d.ts +29 -0
- package/dist/core/layout.d.ts +23 -0
- package/dist/flow-mindmap.js +7896 -1523
- package/dist/flow-mindmap.umd.cjs +22 -16
- package/dist/style.css +10 -1
- package/dist/types.d.ts +20 -0
- package/package.json +8 -1
|
@@ -1,16 +1,22 @@
|
|
|
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
|
-
`);
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`),
|
|
6
|
-
`)
|
|
7
|
-
`).
|
|
8
|
-
`)
|
|
9
|
-
`)
|
|
10
|
-
`)})
|
|
11
|
-
`)}),
|
|
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
|
-
`).
|
|
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"}})});
|
|
1
|
+
(function(se,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(se=typeof globalThis<"u"?globalThis:se||self,t(se.FlowMind={},se.Vue))})(this,function(se,t){"use strict";const fi=["width","height","stroke-width"],gi={key:4,points:"6 9 12 15 18 9"},mi={key:5,points:"9 6 15 12 9 18"},re=t.defineComponent({__name:"Icon",props:{name:{},size:{},stroke:{}},setup(e){return(r,i)=>(t.openBlock(),t.createElementBlock("svg",{width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":e.stroke??1.8,"stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.name==="add"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[i[0]||(i[0]=t.createElementVNode("circle",{cx:"12",cy:"12",r:"9"},null,-1)),i[1]||(i[1]=t.createElementVNode("line",{x1:"12",y1:"8",x2:"12",y2:"16"},null,-1)),i[2]||(i[2]=t.createElementVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"},null,-1))],64)):e.name==="minus"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[i[3]||(i[3]=t.createElementVNode("circle",{cx:"12",cy:"12",r:"9"},null,-1)),i[4]||(i[4]=t.createElementVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"},null,-1))],64)):e.name==="delete"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[i[5]||(i[5]=t.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)):e.name==="edit"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[i[6]||(i[6]=t.createElementVNode("path",{d:"M4 20 l4 -1 11 -11 -3 -3 -11 11 z"},null,-1)),i[7]||(i[7]=t.createElementVNode("line",{x1:"14",y1:"6",x2:"18",y2:"10"},null,-1))],64)):e.name==="collapse"?(t.openBlock(),t.createElementBlock("polyline",gi)):e.name==="expand"?(t.openBlock(),t.createElementBlock("polyline",mi)):e.name==="zoom-in"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[i[8]||(i[8]=t.createElementVNode("circle",{cx:"11",cy:"11",r:"7"},null,-1)),i[9]||(i[9]=t.createElementVNode("line",{x1:"11",y1:"8",x2:"11",y2:"14"},null,-1)),i[10]||(i[10]=t.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"},null,-1)),i[11]||(i[11]=t.createElementVNode("line",{x1:"16",y1:"16",x2:"21",y2:"21"},null,-1))],64)):e.name==="zoom-out"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:7},[i[12]||(i[12]=t.createElementVNode("circle",{cx:"11",cy:"11",r:"7"},null,-1)),i[13]||(i[13]=t.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"},null,-1)),i[14]||(i[14]=t.createElementVNode("line",{x1:"16",y1:"16",x2:"21",y2:"21"},null,-1))],64)):e.name==="reset"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:8},[i[15]||(i[15]=t.createElementVNode("circle",{cx:"12",cy:"12",r:"9"},null,-1)),i[16]||(i[16]=t.createElementVNode("circle",{cx:"12",cy:"12",r:"4"},null,-1)),i[17]||(i[17]=t.createElementVNode("circle",{cx:"12",cy:"12",r:"0.8",fill:"currentColor"},null,-1))],64)):e.name==="logo"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:9},[i[18]||(i[18]=t.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)):e.name==="import"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:10},[i[19]||(i[19]=t.createElementVNode("path",{d:"M12 4 V15"},null,-1)),i[20]||(i[20]=t.createElementVNode("polyline",{points:"7 10 12 15 17 10"},null,-1)),i[21]||(i[21]=t.createElementVNode("path",{d:"M4 19 H20"},null,-1))],64)):e.name==="export"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:11},[i[22]||(i[22]=t.createElementVNode("path",{d:"M12 15 V4"},null,-1)),i[23]||(i[23]=t.createElementVNode("polyline",{points:"7 9 12 4 17 9"},null,-1)),i[24]||(i[24]=t.createElementVNode("path",{d:"M4 19 H20"},null,-1))],64)):e.name==="balance"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:12},[i[25]||(i[25]=t.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)):e.name==="mindmap"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:13},[i[26]||(i[26]=t.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)):e.name==="tree"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:14},[i[27]||(i[27]=t.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)):e.name==="org"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:15},[i[28]||(i[28]=t.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)):e.name==="image"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:16},[i[29]||(i[29]=t.createElementVNode("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"},null,-1)),i[30]||(i[30]=t.createElementVNode("circle",{cx:"9",cy:"11",r:"1.6"},null,-1)),i[31]||(i[31]=t.createElementVNode("polyline",{points:"3 17 9 12 13 15 16 13 21 17"},null,-1))],64)):e.name==="x"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:17},[i[32]||(i[32]=t.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)),i[33]||(i[33]=t.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"},null,-1))],64)):e.name==="link"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:18},[i[34]||(i[34]=t.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)),i[35]||(i[35]=t.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)):e.name==="note"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:19},[i[36]||(i[36]=t.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)),i[37]||(i[37]=t.createElementVNode("line",{x1:"8",y1:"10",x2:"16",y2:"10"},null,-1)),i[38]||(i[38]=t.createElementVNode("line",{x1:"8",y1:"13",x2:"16",y2:"13"},null,-1)),i[39]||(i[39]=t.createElementVNode("line",{x1:"8",y1:"16",x2:"13",y2:"16"},null,-1))],64)):t.createCommentVNode("",!0)],8,fi))}}),hi="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",pi="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",Yt=[18,15,13,12],bi=[700,600,500,400],Ei=[52,40,32,28],yi=[120,80,60,44],xi=[.8,.8,.8,.8],ki=Yt.length-1;function Ni(e,r){return Math.round(Mt(e,r)*xi[ot(e)])}function ot(e){return Math.min(ki,Math.max(0,e))}function Mt(e,r=14){return Math.round(Yt[ot(e)]*r/14*10)/10}function wi(e,r=14){return Math.round(Ei[ot(e)]*r/14)}const rt=60,$e=14,me=24;let vt=null;function _i(){if(vt)return vt;const e=typeof document<"u"?document.createElement("canvas").getContext("2d"):null;return e?(vt=e,e):{font:"",measureText:()=>({width:0})}}const Xt=new Map;function Si(e,r,i){const a=`${i}|${r}|${e}`,s=Xt.get(a);if(s!==void 0)return s;const g=_i();g.font=`${i} ${r}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;const l=g.measureText(e).width;return Xt.set(a,l),l}const Mi=24,vi=400,Ti=8,qt=16,Ci=4,Ai=200;function Ri(e,r,i){return Math.min(i,Math.max(r,e))}function Oi(e,r,i,a,s){const g=ot(r),l=Mt(r,i),d=Math.min(Si(e.text||"",l,bi[g]),Ai),u=Ni(r,i),m=Math.ceil(d+u*2),p=!!(e.richContent&&(e.richContent.kind==="code"||e.richContent.kind==="table"))?Math.ceil(l*1.2)+6:wi(r,i);let x=0;if(e.link&&(x+=qt),e.note&&(x+=qt),x>0){const R=(e.link?1:0)+(e.note?1:0);x+=Ci*R}const c=m+x,A=(()=>{const R=Math.round(yi[g]*i/14);if(e.richContent&&(e.richContent.kind==="code"||e.richContent.kind==="table")){const j=s==null?void 0:s[e.id];return Math.max(R,j??240)}return R})(),L=!!(e.richContent&&(e.richContent.kind==="code"||e.richContent.kind==="table")),G=a==null?void 0:a[e.id],S=L?Math.max(24,G??Math.max(70,Math.ceil(l*5))):0,Z=S>0?10:0;if(!e.image){const R=Math.max(A,c),j=Math.ceil(p+Z+S);return{w:R,h:j}}const O=Ri(e.image.width,Mi,vi),B=Math.max(A,c,Math.ceil(O+u*2)),P=Math.ceil(e.image.height+Ti+p+Z+S);return{w:B,h:P}}function Ii(e,r={}){const i=r.mode??"mindmap",a=r.preservePositions===!0,s=r.baseFontSize??14,g=Jt(e,0,null,1,"right",s,r.richHeights,r.richWidths);return Li(g),Bi(g,i,a),g.x=0,g.y=0,Di(g,a)}function Bi(e,r,i=!1){if(r==="mindmap"){const a=e.children;if(a.length!==0)if(a.length===1)a[0]._dir="right",a[0].side=1,a[0]._dirRight=1;else{const d=a.reduce((p,x)=>p+x._subtreeH,0);let u=1,m=Math.abs(a[0]._subtreeH-(d-a[0]._subtreeH)),y=0;for(let p=0;p<a.length-1;p++){y+=a[p]._subtreeH;const x=Math.abs(y-(d-y));x<m&&(m=x,u=p+1)}for(let p=0;p<u;p++)a[p]._dir="right",a[p].side=1,a[p]._dirRight=1;for(let p=u;p<a.length;p++)a[p]._dir="left",a[p].side=-1,a[p]._dirRight=-1}const s=e.children.filter(d=>d.side===1),g=e.children.filter(d=>d.side===-1),l=(d,u)=>{const m=u==="right"?1:-1;d._dir=u,d.side=m,d._dirRight=m;for(const y of d.children)l(y,u)};for(const d of s)l(d,"right");for(const d of g)l(d,"left");if(s.length>0){const d={...e,children:s};at(d,"right",rt,!0,i)}if(g.length>0){const d={...e,children:g};at(d,"left",rt,!0,i)}}else if(r==="tree"){const a=s=>{s.side=1,s._dir="right";for(const g of s.children)a(g)};for(const s of e.children)s._dir="right";at(e,"right",rt,!0,i),a(e)}else{for(const a of e.children)a._dir="down";jt(e,rt,i)}}function at(e,r,i,a,s=!1){if(e.children.length===0)return;const g=e.children.reduce((m,y,p)=>m+y._subtreeH+(p>0?$e:0),0),l=r==="right"?1:-1,d=a?l:1;let u=e.y-d*g/2;e.children.forEach(m=>{s||(m.x=e.x+l*(e.width/2+i+m.width/2),m.y=u+d*m._subtreeH/2),m._dir=r,u+=d*(m._subtreeH+$e),at(m,r,i,!1,s)})}function jt(e,r,i=!1){if(e.children.length===0)return;const a=e.children.reduce((g,l,d)=>g+l._subtreeW+(d>0?$e*2:0),0);let s=e.x-a/2;e.children.forEach(g=>{i||(g.x=s+g._subtreeW/2,g.y=e.y+e.height/2+r+g.height/2),g._dir="down",s+=g._subtreeW+$e*2,jt(g,r,i)})}function Jt(e,r,i,a,s,g,l,d){const u=Oi(e,r,g,l,d),m={id:e.id,text:e.text,depth:r,x:e._x??0,y:e._y??0,width:u.w,height:u.h,fontSize:Mt(r,g),isRoot:r===0,collapsed:e.collapsed,side:a,_dir:s,_dirRight:a,_subtreeH:u.h,_subtreeW:u.w,image:e.image?{...e.image}:void 0,link:e.link?{url:e.link.url}:void 0,note:e.note?{text:e.note.text}:void 0,richContent:e.richContent?{kind:e.richContent.kind,raw:e.richContent.raw,lang:e.richContent.lang}:void 0,children:[],parent:i};if(e.collapsed)return m;const y=e.children.length,p=Math.ceil(y/2);return m.children=e.children.map((x,c)=>{const A=r===0?c<p?1:-1:a;return Jt(x,r+1,m,A,s,g,l,d)}),m}function Li(e){const r=[e];for(let i=0;i<r.length;i++){const a=r[i];for(const s of a.children)r.push(s)}for(let i=r.length-1;i>=0;i--){const a=r[i];if(a.collapsed||a.children.length===0){a._subtreeH=a.height,a._subtreeW=a.width;continue}let s=0,g=0;for(const l of a.children)s+=l._subtreeH,g+=l._subtreeW;a.children.length>1&&(s+=$e*(a.children.length-1),g+=$e*2*(a.children.length-1)),a._subtreeH=Math.max(a.height,s),a._subtreeW=Math.max(a.width,g)}}function Di(e,r=!1){const i=[e];let a=1/0,s=-1/0,g=1/0,l=-1/0;for(;i.length;){const m=i.pop(),y=m.width/2,p=m.height/2;m.x-y<a&&(a=m.x-y),m.x+y>s&&(s=m.x+y),m.y-p<g&&(g=m.y-p),m.y+p>l&&(l=m.y+p),i.push(...m.children)}if(r)return{root:e,width:s-a+me*2,height:l-g+me*2,vbX:a-me,vbY:g-me,vbW:s-a+me*2,vbH:l-g+me*2};const d=me-g,u=[e];for(;u.length;){const m=u.pop();m.y+=d,u.push(...m.children)}return g+=d,l+=d,{root:e,width:s-a+me*2,height:l+me,vbX:a-me,vbY:0,vbW:s-a+me*2,vbH:l+me}}const Ye=[{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 zi(e,r=[]){return[...Ye,...r].find(a=>a.id===e)??Ye[0]}function we(){return"n_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function Me(e){return JSON.parse(JSON.stringify(e))}function F(e,r){if(e.id===r)return e;for(const i of e.children){const a=F(i,r);if(a)return a}return null}function ke(e,r,i=null){if(e.id===r)return i;for(const a of e.children){const s=ke(a,r,e);if(s!==null)return s}return null}function Tt(e,r){const i=e.children.findIndex(a=>a.id===r);if(i>=0)return e.children.splice(i,1),!0;for(const a of e.children)if(Tt(a,r))return!0;return!1}function $i(e,r,i){const a=F(e,r);return!a||a.text===i?!1:(a.text=i,!0)}function Pi(e,r,i,a){if(!ke(e,r)||r===i||F(F(e,r),i))return!1;const s=ke(e,r),g=s.children.findIndex(m=>m.id===r);if(g<0)return!1;const[l]=s.children.splice(g,1);if(a==="child"){const m=F(e,i);return m?(m.children.push(l),!0):(s.children.splice(g,0,l),!1)}const d=ke(e,i);if(!d)return s.children.splice(g,0,l),!1;let u=d.children.findIndex(m=>m.id===i);return u<0?(s.children.splice(g,0,l),!1):(a==="after"&&(u+=1),d.children.splice(u,0,l),!0)}function Qt(e){const r=/^新节点(?:\s+(\d+))?$/;let i=0,a=!1;for(const s of e.children){const g=s.text.match(r);if(g)if(g[1]){const l=parseInt(g[1],10);l>i&&(i=l)}else a=!0}return i===0&&!a?st:i>0?`新节点 ${i+1}`:"新节点 2"}function en(e,r,i){const a=F(e,r);if(!a)return null;const s={id:we(),text:i??Qt(a),children:[]};return a.children.push(s),s}function tn(e,r,i){const a=ke(e,r);if(!a)return null;const s=a.children.findIndex(l=>l.id===r);if(s<0)return null;const g={id:we(),text:i??Qt(a),children:[]};return a.children.splice(s+1,0,g),g}function Ui(e,r,i){const a=ke(e,r);if(!a)return null;const s=a.children.findIndex(l=>l.id===r);if(s<0)return null;const g={id:we(),text:i,children:[]};return a.children.splice(s,0,g),g}function Hi(e,r){const i=ke(e,r);if(!i)return null;const a=i.children.findIndex(l=>l.id===r);if(a<0)return null;const s=i.children[a],g=Me(s);return nn(g),i.children.splice(a+1,0,g),g}function nn(e){e.id=we();for(const r of e.children)nn(r)}const st="新节点";function Ct(e,r="导入的导图"){const i=e.split(/\r?\n/),a={id:we(),text:r,children:[]},s=[a],g=[-1/0],l=[],d=/^(#{1,6})\s+(.+?)\s*#*\s*$/,u=/^!\[([^\]]*)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,m=/^\[([^\]]+)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,y=/^(`{3,}|~{3,})\s*(\S+)?\s*$/;let p=!1,x=[],c=null;function A(S){x.push(S)}function L(){if(c&&x.length>0){for(;x.length>0&&x[0].trim()==="";)x.shift();for(;x.length>0&&x[x.length-1].trim()==="";)x.pop();const S=x.join(`
|
|
2
|
+
`);S&&(c.note={text:S})}p=!1,x=[]}for(const S of i){if(p){const R=S.match(y);if(R&&R[1][0]==="`"){L();continue}A(S);continue}const Z=S.match(d);if(Z){const R=Z[1].length,j=Z[2].trim();l.push({level:R,text:j,body:""}),c=l[l.length-1];continue}const O=S.match(y);if(O&&O[2]==="note"){p=!0,x=[];continue}const B=S.match(u);if(B&&c){const R=B[2],j=160,J=120;c.image={src:R,naturalW:j,naturalH:J,width:j,height:J};continue}const P=S.match(m);if(P&&c){c.link={url:P[2]},c.text=P[1];continue}if(S.trim().length>0&&c){const R=S.trim();c.body=c.body?c.body+`
|
|
3
|
+
`+R:R}}p&&L();function G(S){for(;s.length>1;){const P=s.length-1,R=g[P];if(R!==void 0&&R<S.level)break;s.pop(),g.pop()}const Z=s[s.length-1],O=S.text,B={id:we(),text:O,children:[]};S.image&&(B.image={...S.image}),S.link&&(B.link={url:S.link.url}),S.note&&(B.note={text:S.note.text}),S.body&&(B.note={text:S.body}),Z.children.push(B),s.push(B),g.push(S.level)}for(const S of l)G(S);if(l.length>0&&l[0].level===1){const S=a.children[0];S&&(a.text=S.text,a.id=S.id,S.image&&(a.image={...S.image}),S.link&&(a.link={url:S.link.url}),S.note&&(a.note={text:S.note.text}),a.children=S.children)}return a}function lt(e,r=1){let i="#".repeat(r)+" "+(e.text||"")+`
|
|
4
|
+
`;e.link&&(i+=`[${e.text||"link"}](${e.link.url})
|
|
5
|
+
`),e.image&&(i+=`
|
|
6
|
+
`),e.note&&(i+="```note\n"+e.note.text+"\n```\n"),e.richContent&&(i+=e.richContent.raw+`
|
|
7
|
+
`);for(const a of e.children)i+=lt(a,r+1);return i}function Vi(e){var m,y;const r=e.split(/\r?\n/),i=[];let a=0;const s=/^(#{1,6})\s+(.+?)\s*#*\s*$/,g=/^(`{3,}|~{3,})\s*(\S+)?\s*$/,l=/^\s*\|?\s*(:?-+:?\s*\|\s*)+(:?-+:?)(\s*\|)?\s*$/,d=/^(\s*)[-*+]\s+(.*)$/,u=/^(\s*)\d+\.\s+(.*)$/;for(;a<r.length;){const p=r[a],x=p.match(g);if(x){const O=x[1][0],B=x[2]||"",P=[p];for(a++;a<r.length;){const j=r[a].match(g);if(j&&j[1][0]===O){P.push(r[a]),a++;break}P.push(r[a]),a++}const R=P.slice(1,-1).join(`
|
|
8
|
+
`).trim();i.push({kind:"code",text:((m=R.split(`
|
|
9
|
+
`)[0])==null?void 0:m.slice(0,80))||"(空代码块)",raw:P.join(`
|
|
10
|
+
`),lang:B});continue}const c=p.match(s);if(c){i.push({kind:"heading",level:c[1].length,text:c[2].trim(),raw:p}),a++;continue}if(/^\s*\|/.test(p)){const O=[];let B=a,P=!1;for(;B<r.length&&/^\s*\|/.test(r[B]);)O.push(r[B]),l.test(r[B])&&(P=!0),B++;if(P&&O.length>=2){i.push({kind:"table",text:((y=O[0].replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|")[0])==null?void 0:y.trim())||"表格",raw:O.join(`
|
|
11
|
+
`)}),a=B;continue}}const A=p.match(d),L=p.match(u);if(A||L){let O=a;for(;O<r.length;){const B=r[O].match(d),P=r[O].match(u);if(!(B||P))break;const R=r[O].replace(/^\s*[-*+]\s+/,"").replace(/^\s*\d+\.\s+/,"").trim();R.length>0&&i.push({kind:"list",text:R.slice(0,80)||"(列表项)",raw:r[O]}),O++}a=O;continue}if(p.trim()===""){a++;continue}const G=[p];let S=a+1;for(;S<r.length;){const O=r[S];if(O.trim()===""||s.test(O)||g.test(O)||d.test(O)||u.test(O)||/^\s*\|/.test(O))break;G.push(O),S++}const Z=G.join(" ").trim();i.push({kind:"paragraph",text:Z.slice(0,80)||"(空段落)",raw:G.join(`
|
|
12
|
+
`)}),a=S}return i}function Fi(e,r="导入的导图"){const i=Vi(e||""),a={id:we(),text:r,children:[]},s=[a],g=[0];let l=!1;function d(u){if(u.kind==="heading"){const y=u.level;for(;s.length>1&&g[g.length-1]>=y;)s.pop(),g.pop();if(!l&&y===1){l=!0,a.text=u.text,g[0]=1;return}const p={id:we(),text:u.text,children:[]};s[s.length-1].children.push(p),s.push(p),g.push(y);return}const m={id:we(),text:u.text,children:[],richContent:{kind:u.kind,raw:u.raw,lang:u.lang}};s[s.length-1].children.push(m)}for(const u of i)d(u);return a}function Wi(e){return e.richContent?e.richContent.raw+`
|
|
13
|
+
`:""}function Gi(e){const r=e.minScale??.2,i=e.maxScale??1/0,a=e.step??1.2,s=t.ref(1),g=t.ref(0),l=t.ref(0),d=t.ref(!1),u=t.reactive({x:0,y:0,ox:0,oy:0}),m=t.ref(!1),y=t.reactive({x:0,y:0}),p=t.reactive({x:0,y:0,width:0,height:0}),x=t.ref(0);let c=null;function A(z){c=z}function L(z){z.preventDefault();const Q=e.getContainer();if(!Q)return;const ae=-z.deltaY*.001,ne=Math.min(i,Math.max(r,s.value*(1+ae))),ie=Q.getBoundingClientRect(),le=z.clientX-ie.left,E=z.clientY-ie.top,v=(le-g.value)/s.value,N=(E-l.value)/s.value;s.value=ne,g.value=le-v*ne,l.value=E-N*ne}function G(){s.value=Math.min(i,s.value*a)}function S(){s.value=Math.max(r,s.value/a)}function Z(z){var ae;z.target.closest(".zm-node, .zm-toolbar, button, input, textarea")||(d.value=!0,u.x=z.clientX,u.y=z.clientY,u.ox=g.value,u.oy=l.value,window.addEventListener("mousemove",O),window.addEventListener("mouseup",B),(ae=z.preventDefault)==null||ae.call(z))}function O(z){d.value&&(g.value=u.ox+(z.clientX-u.x),l.value=u.oy+(z.clientY-u.y))}function B(){d.value=!1,window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",B)}function P(z,Q){m.value=!0,y.x=z,y.y=Q,p.x=z,p.y=Q,p.width=0,p.height=0,x.value++,window.addEventListener("mousemove",J),window.addEventListener("mouseup",j)}function R(z,Q){if(!m.value)return;const ae=Math.min(y.x,z),ne=Math.min(y.y,Q),ie=Math.max(y.x,z),le=Math.max(y.y,Q);p.x=ae,p.y=ne,p.width=ie-ae,p.height=le-ne,x.value++}function j(){m.value=!1,window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",j),c&&c()}function J(z){if(!m.value)return;const Q=e.getContainer();if(!Q)return;const ae=Q.getBoundingClientRect(),ne=(z.clientX-ae.left-g.value)/s.value,ie=(z.clientY-ae.top-l.value)/s.value;R(ne,ie)}function de(z,Q,ae,ne=60){const ie=e.getContainer();if(!ie)return;const le=ie.getBoundingClientRect(),E=(le.width-ne*2)/z,v=(le.height-ne*2)/Q,N=Math.min(1,Math.max(.3,Math.min(E,v)));s.value=N,g.value=le.width/2,l.value=le.height/2-ae*N}return{scale:s,offsetX:g,offsetY:l,isPanning:d,onWheel:L,zoomIn:G,zoomOut:S,startPan:Z,startMarquee:P,updateMarquee:R,isMarquee:m,marquee:p,marqueeVersion:x,setOnMarqueeEnd:A,resetView:de}}const Ki=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function on(e){return Ki?e.metaKey:e.ctrlKey}function Zi(e){function r(){const a=e.getSelectedId();return a||(e.defaultTargetId?e.defaultTargetId():e.getRootId())}function i(a){const s=a.target;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable)||e.isReadonly()||e.isEditing())return;const g=e.getSelectedId(),l=r();if(l){if(on(a)&&!a.shiftKey){if(a.key==="d"||a.key==="D"){g&&g!==e.getRootId()&&(a.preventDefault(),e.onDuplicate(g));return}if(a.key==="z"||a.key==="Z"){a.preventDefault(),e.onUndo();return}if(a.key==="y"||a.key==="Y"){a.preventDefault(),e.onRedo();return}if(a.key==="Home"){a.preventDefault(),e.onSelectRoot();return}}if(on(a)&&a.shiftKey&&(a.key==="Z"||a.key==="z")){a.preventDefault(),e.onRedo();return}a.key==="Tab"?(a.preventDefault(),e.onAddChild(l)):a.key==="Enter"?(a.preventDefault(),a.shiftKey?g&&g!==e.getRootId()&&e.onAddSiblingBefore(g):e.onAddSibling(l)):(a.key==="Delete"||a.key==="Backspace")&&g&&g!==e.getRootId()?(a.preventDefault(),e.onRemove(g)):a.key==="F2"&&g?(a.preventDefault(),e.onStartEdit(g)):a.key==="Escape"?(a.preventDefault(),e.onClearSelection()):a.key==="ArrowDown"?(a.preventDefault(),e.onNavigate(0,1)):a.key==="ArrowUp"?(a.preventDefault(),e.onNavigate(0,-1)):a.key==="ArrowRight"?(a.preventDefault(),e.onNavigate(1,0)):a.key==="ArrowLeft"&&(a.preventDefault(),e.onNavigate(-1,0))}}t.onMounted(()=>{window.addEventListener("keydown",i)}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",i)})}function Yi(e=100){const r=t.ref([]);let i=-1;function a(){return i>0}function s(){return i<r.value.length-1}function g(m){const y=JSON.stringify(m);for(i<r.value.length-1&&(r.value=r.value.slice(0,i+1)),r.value.push(y),i=r.value.length-1;r.value.length>e;)r.value.shift(),i--}function l(){return a()?(i--,JSON.parse(r.value[i])):null}function d(){return s()?(i++,JSON.parse(r.value[i])):null}function u(){r.value=[],i=-1}return{canUndo:a,canRedo:s,record:g,undo:l,redo:d,reset:u}}const Xi=["disabled"],qi=["disabled"],ji=["disabled"],Ji=["disabled"],Qi=["disabled"],eo=["disabled"],to=["disabled"],no=["disabled"],io=["disabled"],oo=["disabled"],ro=t.defineComponent({__name:"NodeContextMenu",props:{x:{},y:{},container:{},hasImage:{type:Boolean,default:!1},hasLink:{type:Boolean,default:!1},hasNote:{type:Boolean,default:!1},hasCode:{type:Boolean,default:!1},hasTable:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1}},emits:["pickImage","setLink","removeLink","editNote","removeNote","removeImage","addCode","editCode","removeCode","addTable","editTable","removeTable","close"],setup(e,{emit:r}){const i=e,a=r,s=t.computed(()=>{let x=i.x+2,c=i.y+2;if(i.container){const A=i.container.getBoundingClientRect(),L=180,S=4+(3+(i.hasImage?1:0)+(i.hasLink?1:0)+(i.hasNote?1:0)+1+(i.hasCode?1:0)+1+(i.hasTable?1:0))*28;x+L>A.right&&(x=Math.max(A.left+4,i.x-L-2)),c+S>A.bottom&&(c=Math.max(A.top+4,i.y-S-2)),x<A.left+2&&(x=A.left+2),c<A.top+2&&(c=A.top+2)}return{left:x,top:c}}),g=t.computed(()=>i.hasImage),l=t.computed(()=>i.hasLink),d=t.computed(()=>i.hasNote);function u(x){const c=x.target;c&&c.closest(".zm-node-menu")||a("close")}function m(x){x.key==="Escape"&&a("close")}function y(){a("close")}window.addEventListener("mousedown",u,!0),window.addEventListener("keydown",m,!0),window.addEventListener("wheel",y,!0),window.addEventListener("scroll",y,!0),t.onBeforeUnmount(()=>{window.removeEventListener("mousedown",u,!0),window.removeEventListener("keydown",m,!0),window.removeEventListener("wheel",y,!0),window.removeEventListener("scroll",y,!0)});function p(x){i.readonly||(x(),a("close"))}return(x,c)=>(t.openBlock(),t.createElementBlock("div",{class:"zm-node-menu",style:t.normalizeStyle({left:s.value.left+"px",top:s.value.top+"px"}),onContextmenu:c[10]||(c[10]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("button",{class:"zm-node-menu-item",disabled:e.readonly,onClick:c[0]||(c[0]=t.withModifiers(A=>p(()=>a("pickImage")),["stop"]))},[t.createVNode(re,{name:"image",size:13}),t.createElementVNode("span",null,t.toDisplayString(g.value?"替换图片":"添加图片"),1)],8,Xi),g.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"zm-node-menu-item",disabled:e.readonly,onClick:c[1]||(c[1]=t.withModifiers(A=>p(()=>a("removeImage")),["stop"]))},[t.createVNode(re,{name:"x",size:13}),c[11]||(c[11]=t.createElementVNode("span",null,"移除图片",-1))],8,qi)):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",disabled:e.readonly,onClick:c[2]||(c[2]=t.withModifiers(A=>p(()=>a("setLink")),["stop"]))},[t.createVNode(re,{name:"link",size:13}),t.createElementVNode("span",null,t.toDisplayString(l.value?"编辑链接":"添加链接"),1)],8,ji),l.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"zm-node-menu-item",disabled:e.readonly,onClick:c[3]||(c[3]=t.withModifiers(A=>p(()=>a("removeLink")),["stop"]))},[t.createVNode(re,{name:"x",size:13}),c[12]||(c[12]=t.createElementVNode("span",null,"移除链接",-1))],8,Ji)):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",disabled:e.readonly,onClick:c[4]||(c[4]=t.withModifiers(A=>p(()=>a("addCode")),["stop"]))},[c[13]||(c[13]=t.createElementVNode("span",{class:"zm-node-menu-icon zm-node-menu-icon-code","aria-hidden":"true"},"{ }",-1)),t.createElementVNode("span",null,t.toDisplayString(e.hasCode?"编辑代码块":"添加代码块"),1)],8,Qi),e.hasCode?(t.openBlock(),t.createElementBlock("button",{key:2,class:"zm-node-menu-item",disabled:e.readonly,onClick:c[5]||(c[5]=t.withModifiers(A=>p(()=>a("removeCode")),["stop"]))},[t.createVNode(re,{name:"x",size:13}),c[14]||(c[14]=t.createElementVNode("span",null,"移除代码块",-1))],8,eo)):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",disabled:e.readonly,onClick:c[6]||(c[6]=t.withModifiers(A=>p(()=>a("addTable")),["stop"]))},[c[15]||(c[15]=t.createElementVNode("span",{class:"zm-node-menu-icon zm-node-menu-icon-table","aria-hidden":"true"},"▦",-1)),t.createElementVNode("span",null,t.toDisplayString(e.hasTable?"编辑表格":"添加表格"),1)],8,to),e.hasTable?(t.openBlock(),t.createElementBlock("button",{key:3,class:"zm-node-menu-item",disabled:e.readonly,onClick:c[7]||(c[7]=t.withModifiers(A=>p(()=>a("removeTable")),["stop"]))},[t.createVNode(re,{name:"x",size:13}),c[16]||(c[16]=t.createElementVNode("span",null,"移除表格",-1))],8,no)):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",disabled:e.readonly,onClick:c[8]||(c[8]=t.withModifiers(A=>p(()=>a("editNote")),["stop"]))},[t.createVNode(re,{name:"note",size:13}),t.createElementVNode("span",null,t.toDisplayString(d.value?"编辑笔记":"添加笔记"),1)],8,io),d.value?(t.openBlock(),t.createElementBlock("button",{key:4,class:"zm-node-menu-item",disabled:e.readonly,onClick:c[9]||(c[9]=t.withModifiers(A=>p(()=>a("removeNote")),["stop"]))},[t.createVNode(re,{name:"x",size:13}),c[17]||(c[17]=t.createElementVNode("span",null,"移除笔记",-1))],8,oo)):t.createCommentVNode("",!0)],36))}});function ao(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function rn(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(r=>{const i=e[r],a=typeof i;(a==="object"||a==="function")&&!Object.isFrozen(i)&&rn(i)}),e}class an{constructor(r){r.data===void 0&&(r.data={}),this.data=r.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function sn(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ce(e,...r){const i=Object.create(null);for(const a in e)i[a]=e[a];return r.forEach(function(a){for(const s in a)i[s]=a[s]}),i}const so="</span>",ln=e=>!!e.scope,lo=(e,{prefix:r})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const i=e.split(".");return[`${r}${i.shift()}`,...i.map((a,s)=>`${a}${"_".repeat(s+1)}`)].join(" ")}return`${r}${e}`};class co{constructor(r,i){this.buffer="",this.classPrefix=i.classPrefix,r.walk(this)}addText(r){this.buffer+=sn(r)}openNode(r){if(!ln(r))return;const i=lo(r.scope,{prefix:this.classPrefix});this.span(i)}closeNode(r){ln(r)&&(this.buffer+=so)}value(){return this.buffer}span(r){this.buffer+=`<span class="${r}">`}}const cn=(e={})=>{const r={children:[]};return Object.assign(r,e),r};class At{constructor(){this.rootNode=cn(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(r){this.top.children.push(r)}openNode(r){const i=cn({scope:r});this.add(i),this.stack.push(i)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(r){return this.constructor._walk(r,this.rootNode)}static _walk(r,i){return typeof i=="string"?r.addText(i):i.children&&(r.openNode(i),i.children.forEach(a=>this._walk(r,a)),r.closeNode(i)),r}static _collapse(r){typeof r!="string"&&r.children&&(r.children.every(i=>typeof i=="string")?r.children=[r.children.join("")]:r.children.forEach(i=>{At._collapse(i)}))}}class uo extends At{constructor(r){super(),this.options=r}addText(r){r!==""&&this.add(r)}startScope(r){this.openNode(r)}endScope(){this.closeNode()}__addSublanguage(r,i){const a=r.root;i&&(a.scope=`language:${i}`),this.add(a)}toHTML(){return new co(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Xe(e){return e?typeof e=="string"?e:e.source:null}function dn(e){return Oe("(?=",e,")")}function fo(e){return Oe("(?:",e,")*")}function go(e){return Oe("(?:",e,")?")}function Oe(...e){return e.map(i=>Xe(i)).join("")}function mo(e){const r=e[e.length-1];return typeof r=="object"&&r.constructor===Object?(e.splice(e.length-1,1),r):{}}function Rt(...e){return"("+(mo(e).capture?"":"?:")+e.map(a=>Xe(a)).join("|")+")"}function un(e){return new RegExp(e.toString()+"|").exec("").length-1}function ho(e,r){const i=e&&e.exec(r);return i&&i.index===0}const po=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Ot(e,{joinWith:r}){let i=0;return e.map(a=>{i+=1;const s=i;let g=Xe(a),l="";for(;g.length>0;){const d=po.exec(g);if(!d){l+=g;break}l+=g.substring(0,d.index),g=g.substring(d.index+d[0].length),d[0][0]==="\\"&&d[1]?l+="\\"+String(Number(d[1])+s):(l+=d[0],d[0]==="("&&i++)}return l}).map(a=>`(${a})`).join(r)}const bo=/\b\B/,fn="[a-zA-Z]\\w*",It="[a-zA-Z_]\\w*",gn="\\b\\d+(\\.\\d+)?",mn="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",hn="\\b(0b[01]+)",Eo="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",yo=(e={})=>{const r=/^#![ ]*\//;return e.binary&&(e.begin=Oe(r,/.*\b/,e.binary,/\b.*/)),Ce({scope:"meta",begin:r,end:/$/,relevance:0,"on:begin":(i,a)=>{i.index!==0&&a.ignoreMatch()}},e)},qe={begin:"\\\\[\\s\\S]",relevance:0},xo={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[qe]},ko={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[qe]},No={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},ct=function(e,r,i={}){const a=Ce({scope:"comment",begin:e,end:r,contains:[]},i);a.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const s=Rt("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return a.contains.push({begin:Oe(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),a},wo=ct("//","$"),_o=ct("/\\*","\\*/"),So=ct("#","$"),Mo={scope:"number",begin:gn,relevance:0},vo={scope:"number",begin:mn,relevance:0},To={scope:"number",begin:hn,relevance:0},Co={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[qe,{begin:/\[/,end:/\]/,relevance:0,contains:[qe]}]},Ao={scope:"title",begin:fn,relevance:0},Ro={scope:"title",begin:It,relevance:0},Oo={begin:"\\.\\s*"+It,relevance:0};var dt=Object.freeze({__proto__:null,APOS_STRING_MODE:xo,BACKSLASH_ESCAPE:qe,BINARY_NUMBER_MODE:To,BINARY_NUMBER_RE:hn,COMMENT:ct,C_BLOCK_COMMENT_MODE:_o,C_LINE_COMMENT_MODE:wo,C_NUMBER_MODE:vo,C_NUMBER_RE:mn,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(r,i)=>{i.data._beginMatch=r[1]},"on:end":(r,i)=>{i.data._beginMatch!==r[1]&&i.ignoreMatch()}})},HASH_COMMENT_MODE:So,IDENT_RE:fn,MATCH_NOTHING_RE:bo,METHOD_GUARD:Oo,NUMBER_MODE:Mo,NUMBER_RE:gn,PHRASAL_WORDS_MODE:No,QUOTE_STRING_MODE:ko,REGEXP_MODE:Co,RE_STARTERS_RE:Eo,SHEBANG:yo,TITLE_MODE:Ao,UNDERSCORE_IDENT_RE:It,UNDERSCORE_TITLE_MODE:Ro});function Io(e,r){e.input[e.index-1]==="."&&r.ignoreMatch()}function Bo(e,r){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Lo(e,r){r&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=Io,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function Do(e,r){Array.isArray(e.illegal)&&(e.illegal=Rt(...e.illegal))}function zo(e,r){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function $o(e,r){e.relevance===void 0&&(e.relevance=1)}const Po=(e,r)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const i=Object.assign({},e);Object.keys(e).forEach(a=>{delete e[a]}),e.keywords=i.keywords,e.begin=Oe(i.beforeMatch,dn(i.begin)),e.starts={relevance:0,contains:[Object.assign(i,{endsParent:!0})]},e.relevance=0,delete i.beforeMatch},Uo=["of","and","for","in","not","or","if","then","parent","list","value"],Ho="keyword";function pn(e,r,i=Ho){const a=Object.create(null);return typeof e=="string"?s(i,e.split(" ")):Array.isArray(e)?s(i,e):Object.keys(e).forEach(function(g){Object.assign(a,pn(e[g],r,g))}),a;function s(g,l){r&&(l=l.map(d=>d.toLowerCase())),l.forEach(function(d){const u=d.split("|");a[u[0]]=[g,Vo(u[0],u[1])]})}}function Vo(e,r){return r?Number(r):Fo(e)?0:1}function Fo(e){return Uo.includes(e.toLowerCase())}const bn={},Ie=e=>{console.error(e)},En=(e,...r)=>{console.log(`WARN: ${e}`,...r)},Pe=(e,r)=>{bn[`${e}/${r}`]||(console.log(`Deprecated as of ${e}. ${r}`),bn[`${e}/${r}`]=!0)},ut=new Error;function yn(e,r,{key:i}){let a=0;const s=e[i],g={},l={};for(let d=1;d<=r.length;d++)l[d+a]=s[d],g[d+a]=!0,a+=un(r[d-1]);e[i]=l,e[i]._emit=g,e[i]._multi=!0}function Wo(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Ie("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ut;if(typeof e.beginScope!="object"||e.beginScope===null)throw Ie("beginScope must be object"),ut;yn(e,e.begin,{key:"beginScope"}),e.begin=Ot(e.begin,{joinWith:""})}}function Go(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Ie("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ut;if(typeof e.endScope!="object"||e.endScope===null)throw Ie("endScope must be object"),ut;yn(e,e.end,{key:"endScope"}),e.end=Ot(e.end,{joinWith:""})}}function Ko(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Zo(e){Ko(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),Wo(e),Go(e)}function Yo(e){function r(l,d){return new RegExp(Xe(l),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(d?"g":""))}class i{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(d,u){u.position=this.position++,this.matchIndexes[this.matchAt]=u,this.regexes.push([u,d]),this.matchAt+=un(d)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const d=this.regexes.map(u=>u[1]);this.matcherRe=r(Ot(d,{joinWith:"|"}),!0),this.lastIndex=0}exec(d){this.matcherRe.lastIndex=this.lastIndex;const u=this.matcherRe.exec(d);if(!u)return null;const m=u.findIndex((p,x)=>x>0&&p!==void 0),y=this.matchIndexes[m];return u.splice(0,m),Object.assign(u,y)}}class a{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(d){if(this.multiRegexes[d])return this.multiRegexes[d];const u=new i;return this.rules.slice(d).forEach(([m,y])=>u.addRule(m,y)),u.compile(),this.multiRegexes[d]=u,u}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(d,u){this.rules.push([d,u]),u.type==="begin"&&this.count++}exec(d){const u=this.getMatcher(this.regexIndex);u.lastIndex=this.lastIndex;let m=u.exec(d);if(this.resumingScanAtSamePosition()&&!(m&&m.index===this.lastIndex)){const y=this.getMatcher(0);y.lastIndex=this.lastIndex+1,m=y.exec(d)}return m&&(this.regexIndex+=m.position+1,this.regexIndex===this.count&&this.considerAll()),m}}function s(l){const d=new a;return l.contains.forEach(u=>d.addRule(u.begin,{rule:u,type:"begin"})),l.terminatorEnd&&d.addRule(l.terminatorEnd,{type:"end"}),l.illegal&&d.addRule(l.illegal,{type:"illegal"}),d}function g(l,d){const u=l;if(l.isCompiled)return u;[Bo,zo,Zo,Po].forEach(y=>y(l,d)),e.compilerExtensions.forEach(y=>y(l,d)),l.__beforeBegin=null,[Lo,Do,$o].forEach(y=>y(l,d)),l.isCompiled=!0;let m=null;return typeof l.keywords=="object"&&l.keywords.$pattern&&(l.keywords=Object.assign({},l.keywords),m=l.keywords.$pattern,delete l.keywords.$pattern),m=m||/\w+/,l.keywords&&(l.keywords=pn(l.keywords,e.case_insensitive)),u.keywordPatternRe=r(m,!0),d&&(l.begin||(l.begin=/\B|\b/),u.beginRe=r(u.begin),!l.end&&!l.endsWithParent&&(l.end=/\B|\b/),l.end&&(u.endRe=r(u.end)),u.terminatorEnd=Xe(u.end)||"",l.endsWithParent&&d.terminatorEnd&&(u.terminatorEnd+=(l.end?"|":"")+d.terminatorEnd)),l.illegal&&(u.illegalRe=r(l.illegal)),l.contains||(l.contains=[]),l.contains=[].concat(...l.contains.map(function(y){return Xo(y==="self"?l:y)})),l.contains.forEach(function(y){g(y,u)}),l.starts&&g(l.starts,d),u.matcher=s(u),u}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Ce(e.classNameAliases||{}),g(e)}function xn(e){return e?e.endsWithParent||xn(e.starts):!1}function Xo(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(r){return Ce(e,{variants:null},r)})),e.cachedVariants?e.cachedVariants:xn(e)?Ce(e,{starts:e.starts?Ce(e.starts):null}):Object.isFrozen(e)?Ce(e):e}var qo="11.11.1";class jo extends Error{constructor(r,i){super(r),this.name="HTMLInjectionError",this.html=i}}const Bt=sn,kn=Ce,Nn=Symbol("nomatch"),Jo=7,wn=function(e){const r=Object.create(null),i=Object.create(null),a=[];let s=!0;const g="Could not find the language '{}', did you forget to load/include a language module?",l={disableAutodetect:!0,name:"Plain text",contains:[]};let d={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:uo};function u(E){return d.noHighlightRe.test(E)}function m(E){let v=E.className+" ";v+=E.parentNode?E.parentNode.className:"";const N=d.languageDetectRe.exec(v);if(N){const $=J(N[1]);return $||(En(g.replace("{}",N[1])),En("Falling back to no-highlight mode for this block.",E)),$?N[1]:"no-highlight"}return v.split(/\s+/).find($=>u($)||J($))}function y(E,v,N){let $="",K="";typeof v=="object"?($=E,N=v.ignoreIllegals,K=v.language):(Pe("10.7.0","highlight(lang, code, ...args) has been deprecated."),Pe("10.7.0",`Please use highlight(code, options) instead.
|
|
14
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),K=E,$=v),N===void 0&&(N=!0);const ee={code:$,language:K};ie("before:highlight",ee);const ce=ee.result?ee.result:p(ee.language,ee.code,N);return ce.code=ee.code,ie("after:highlight",ce),ce}function p(E,v,N,$){const K=Object.create(null);function ee(k,_){return k.keywords[_]}function ce(){if(!I.keywords){oe.addText(q);return}let k=0;I.keywordPatternRe.lastIndex=0;let _=I.keywordPatternRe.exec(q),U="";for(;_;){U+=q.substring(k,_.index);const H=be.case_insensitive?_[0].toLowerCase():_[0],T=ee(I,H);if(T){const[ye,yt]=T;if(oe.addText(U),U="",K[H]=(K[H]||0)+1,K[H]<=Jo&&(Ge+=yt),ye.startsWith("_"))U+=_[0];else{const Ht=be.classNameAliases[ye]||ye;pe(_[0],Ht)}}else U+=_[0];k=I.keywordPatternRe.lastIndex,_=I.keywordPatternRe.exec(q)}U+=q.substring(k),oe.addText(U)}function he(){if(q==="")return;let k=null;if(typeof I.subLanguage=="string"){if(!r[I.subLanguage]){oe.addText(q);return}k=p(I.subLanguage,q,!0,We[I.subLanguage]),We[I.subLanguage]=k._top}else k=c(q,I.subLanguage.length?I.subLanguage:null);I.relevance>0&&(Ge+=k.relevance),oe.__addSublanguage(k._emitter,k.language)}function ue(){I.subLanguage!=null?he():ce(),q=""}function pe(k,_){k!==""&&(oe.startScope(_),oe.addText(k),oe.endScope())}function ht(k,_){let U=1;const H=_.length-1;for(;U<=H;){if(!k._emit[U]){U++;continue}const T=be.classNameAliases[k[U]]||k[U],ye=_[U];T?pe(ye,T):(q=ye,ce(),q=""),U++}}function je(k,_){return k.scope&&typeof k.scope=="string"&&oe.openNode(be.classNameAliases[k.scope]||k.scope),k.beginScope&&(k.beginScope._wrap?(pe(q,be.classNameAliases[k.beginScope._wrap]||k.beginScope._wrap),q=""):k.beginScope._multi&&(ht(k.beginScope,_),q="")),I=Object.create(k,{parent:{value:I}}),I}function pt(k,_,U){let H=ho(k.endRe,U);if(H){if(k["on:end"]){const T=new an(k);k["on:end"](_,T),T.isMatchIgnored&&(H=!1)}if(H){for(;k.endsParent&&k.parent;)k=k.parent;return k}}if(k.endsWithParent)return pt(k.parent,_,U)}function bt(k){return I.matcher.regexIndex===0?(q+=k[0],1):(Ee=!0,0)}function $t(k){const _=k[0],U=k.rule,H=new an(U),T=[U.__beforeBegin,U["on:begin"]];for(const ye of T)if(ye&&(ye(k,H),H.isMatchIgnored))return bt(_);return U.skip?q+=_:(U.excludeBegin&&(q+=_),ue(),!U.returnBegin&&!U.excludeBegin&&(q=_)),je(U,k),U.returnBegin?0:_.length}function Et(k){const _=k[0],U=v.substring(k.index),H=pt(I,k,U);if(!H)return Nn;const T=I;I.endScope&&I.endScope._wrap?(ue(),pe(_,I.endScope._wrap)):I.endScope&&I.endScope._multi?(ue(),ht(I.endScope,k)):T.skip?q+=_:(T.returnEnd||T.excludeEnd||(q+=_),ue(),T.excludeEnd&&(q=_));do I.scope&&oe.closeNode(),!I.skip&&!I.subLanguage&&(Ge+=I.relevance),I=I.parent;while(I!==H.parent);return H.starts&&je(H.starts,k),T.returnEnd?0:_.length}function Pt(){const k=[];for(let _=I;_!==be;_=_.parent)_.scope&&k.unshift(_.scope);k.forEach(_=>oe.openNode(_))}let Le={};function Re(k,_){const U=_&&_[0];if(q+=k,U==null)return ue(),0;if(Le.type==="begin"&&_.type==="end"&&Le.index===_.index&&U===""){if(q+=v.slice(_.index,_.index+1),!s){const H=new Error(`0 width match regex (${E})`);throw H.languageName=E,H.badRule=Le.rule,H}return 1}if(Le=_,_.type==="begin")return $t(_);if(_.type==="illegal"&&!N){const H=new Error('Illegal lexeme "'+U+'" for mode "'+(I.scope||"<unnamed>")+'"');throw H.mode=I,H}else if(_.type==="end"){const H=Et(_);if(H!==Nn)return H}if(_.type==="illegal"&&U==="")return q+=`
|
|
15
|
+
`,1;if(De>1e5&&De>_.index*3)throw new Error("potential infinite loop, way more iterations than matches");return q+=U,U.length}const be=J(E);if(!be)throw Ie(g.replace("{}",E)),new Error('Unknown language: "'+E+'"');const Ut=Yo(be);let Fe="",I=$||Ut;const We={},oe=new d.__emitter(d);Pt();let q="",Ge=0,Ne=0,De=0,Ee=!1;try{if(be.__emitTokens)be.__emitTokens(v,oe);else{for(I.matcher.considerAll();;){De++,Ee?Ee=!1:I.matcher.considerAll(),I.matcher.lastIndex=Ne;const k=I.matcher.exec(v);if(!k)break;const _=v.substring(Ne,k.index),U=Re(_,k);Ne=k.index+U}Re(v.substring(Ne))}return oe.finalize(),Fe=oe.toHTML(),{language:E,value:Fe,relevance:Ge,illegal:!1,_emitter:oe,_top:I}}catch(k){if(k.message&&k.message.includes("Illegal"))return{language:E,value:Bt(v),illegal:!0,relevance:0,_illegalBy:{message:k.message,index:Ne,context:v.slice(Ne-100,Ne+100),mode:k.mode,resultSoFar:Fe},_emitter:oe};if(s)return{language:E,value:Bt(v),illegal:!1,relevance:0,errorRaised:k,_emitter:oe,_top:I};throw k}}function x(E){const v={value:Bt(E),illegal:!1,relevance:0,_top:l,_emitter:new d.__emitter(d)};return v._emitter.addText(E),v}function c(E,v){v=v||d.languages||Object.keys(r);const N=x(E),$=v.filter(J).filter(z).map(ue=>p(ue,E,!1));$.unshift(N);const K=$.sort((ue,pe)=>{if(ue.relevance!==pe.relevance)return pe.relevance-ue.relevance;if(ue.language&&pe.language){if(J(ue.language).supersetOf===pe.language)return 1;if(J(pe.language).supersetOf===ue.language)return-1}return 0}),[ee,ce]=K,he=ee;return he.secondBest=ce,he}function A(E,v,N){const $=v&&i[v]||N;E.classList.add("hljs"),E.classList.add(`language-${$}`)}function L(E){let v=null;const N=m(E);if(u(N))return;if(ie("before:highlightElement",{el:E,language:N}),E.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",E);return}if(E.children.length>0&&(d.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(E)),d.throwUnescapedHTML))throw new jo("One of your code blocks includes unescaped HTML.",E.innerHTML);v=E;const $=v.textContent,K=N?y($,{language:N,ignoreIllegals:!0}):c($);E.innerHTML=K.value,E.dataset.highlighted="yes",A(E,N,K.language),E.result={language:K.language,re:K.relevance,relevance:K.relevance},K.secondBest&&(E.secondBest={language:K.secondBest.language,relevance:K.secondBest.relevance}),ie("after:highlightElement",{el:E,result:K,text:$})}function G(E){d=kn(d,E)}const S=()=>{B(),Pe("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Z(){B(),Pe("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let O=!1;function B(){function E(){B()}if(document.readyState==="loading"){O||window.addEventListener("DOMContentLoaded",E,!1),O=!0;return}document.querySelectorAll(d.cssSelector).forEach(L)}function P(E,v){let N=null;try{N=v(e)}catch($){if(Ie("Language definition for '{}' could not be registered.".replace("{}",E)),s)Ie($);else throw $;N=l}N.name||(N.name=E),r[E]=N,N.rawDefinition=v.bind(null,e),N.aliases&&de(N.aliases,{languageName:E})}function R(E){delete r[E];for(const v of Object.keys(i))i[v]===E&&delete i[v]}function j(){return Object.keys(r)}function J(E){return E=(E||"").toLowerCase(),r[E]||r[i[E]]}function de(E,{languageName:v}){typeof E=="string"&&(E=[E]),E.forEach(N=>{i[N.toLowerCase()]=v})}function z(E){const v=J(E);return v&&!v.disableAutodetect}function Q(E){E["before:highlightBlock"]&&!E["before:highlightElement"]&&(E["before:highlightElement"]=v=>{E["before:highlightBlock"](Object.assign({block:v.el},v))}),E["after:highlightBlock"]&&!E["after:highlightElement"]&&(E["after:highlightElement"]=v=>{E["after:highlightBlock"](Object.assign({block:v.el},v))})}function ae(E){Q(E),a.push(E)}function ne(E){const v=a.indexOf(E);v!==-1&&a.splice(v,1)}function ie(E,v){const N=E;a.forEach(function($){$[N]&&$[N](v)})}function le(E){return Pe("10.7.0","highlightBlock will be removed entirely in v12.0"),Pe("10.7.0","Please use highlightElement now."),L(E)}Object.assign(e,{highlight:y,highlightAuto:c,highlightAll:B,highlightElement:L,highlightBlock:le,configure:G,initHighlighting:S,initHighlightingOnLoad:Z,registerLanguage:P,unregisterLanguage:R,listLanguages:j,getLanguage:J,registerAliases:de,autoDetection:z,inherit:kn,addPlugin:ae,removePlugin:ne}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=qo,e.regex={concat:Oe,lookahead:dn,either:Rt,optional:go,anyNumberOfTimes:fo};for(const E in dt)typeof dt[E]=="object"&&rn(dt[E]);return Object.assign(e,dt),e},Ue=wn({});Ue.newInstance=()=>wn({});var Qo=Ue;Ue.HighlightJS=Ue,Ue.default=Ue;const Lt=ao(Qo);function Dt(e){const r=e.regex,i={},a={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:r.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},a]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},g=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),l={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},d={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,i,s]};s.contains.push(d);const u={match:/\\"/},m={className:"string",begin:/'/,end:/'/},y={match:/\\'/},p={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,i]},x=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],c=e.SHEBANG({binary:`(${x.join("|")})`,relevance:10}),A={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},L=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],G=["true","false"],S={match:/(\/[a-z._-]+)+/},Z=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],O=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],B=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],P=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:L,literal:G,built_in:[...Z,...O,"set","shopt",...B,...P]},contains:[c,e.SHEBANG(),A,p,g,l,S,d,u,m,y,i]}}const er=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),tr=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],nr=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],ir=[...tr,...nr],or=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),rr=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),ar=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),sr=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function lr(e){const r=e.regex,i=er(e),a={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",g=/@-?\w[\w]*(-\w+)*/,l="[a-zA-Z-][a-zA-Z0-9_-]*",d=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[i.BLOCK_COMMENT,a,i.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+l,relevance:0},i.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+rr.join("|")+")"},{begin:":(:)?("+ar.join("|")+")"}]},i.CSS_VARIABLE,{className:"attribute",begin:"\\b("+sr.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[i.BLOCK_COMMENT,i.HEXCOLOR,i.IMPORTANT,i.CSS_NUMBER_MODE,...d,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...d,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},i.FUNCTION_DISPATCH]},{begin:r.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:g},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:or.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...d,i.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+ir.join("|")+")\\b"}]}}function _n(e){const g={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:g,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:g,illegal:/["']/}]}]}}var He="[0-9](_*[0-9])*",ft=`\\.(${He})`,gt="[0-9a-fA-F](_*[0-9a-fA-F])*",Sn={className:"number",variants:[{begin:`(\\b(${He})((${ft})|\\.)?|(${ft}))[eE][+-]?(${He})[fFdD]?\\b`},{begin:`\\b(${He})((${ft})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ft})[fFdD]?\\b`},{begin:`\\b(${He})[fFdD]\\b`},{begin:`\\b0[xX]((${gt})\\.?|(${gt})?\\.(${gt}))[pP][+-]?(${He})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${gt})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Mn(e,r,i){return i===-1?"":e.replace(r,a=>Mn(e,r,i-1))}function cr(e){const r=e.regex,i="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",a=i+Mn("(?:<"+i+"~~~(?:\\s*,\\s*"+i+"~~~)*>)?",/~~~/g,2),u={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},m={className:"meta",begin:"@"+i,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},y={className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:u,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,i],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[r.concat(/(?!else)/,i),/\s+/,i,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,i],className:{1:"keyword",3:"title.class"},contains:[y,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+a+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:u,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,contains:[m,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Sn,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Sn,m]}}const vn="[A-Za-z$_][0-9A-Za-z$_]*",dr=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],ur=["true","false","null","undefined","NaN","Infinity"],Tn=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Cn=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],An=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],fr=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],gr=[].concat(An,Tn,Cn);function Rn(e){const r=e.regex,i=(N,{after:$})=>{const K="</"+N[0].slice(1);return N.input.indexOf(K,$)!==-1},a=vn,s={begin:"<>",end:"</>"},g=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(N,$)=>{const K=N[0].length+N.index,ee=N.input[K];if(ee==="<"||ee===","){$.ignoreMatch();return}ee===">"&&(i(N,{after:K})||$.ignoreMatch());let ce;const he=N.input.substring(K);if(ce=he.match(/^\s*=/)){$.ignoreMatch();return}if((ce=he.match(/^\s+extends\s+/))&&ce.index===0){$.ignoreMatch();return}}},d={$pattern:vn,keyword:dr,literal:ur,built_in:gr,"variable.language":fr},u="[0-9](_?[0-9])*",m=`\\.(${u})`,y="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${y})((${m})|\\.)?|(${m}))[eE][+-]?(${u})\\b`},{begin:`\\b(${y})\\b((${m})\\b|\\.)?|(${m})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},x={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},c={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"xml"}},A={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"css"}},L={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"graphql"}},G={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,x]},Z={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:a+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},O=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,A,L,G,{match:/\$\d+/},p];x.contains=O.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(O)});const B=[].concat(Z,x.contains),P=B.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(B)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:P},j={variants:[{match:[/class/,/\s+/,a,/\s+/,/extends/,/\s+/,r.concat(a,"(",r.concat(/\./,a),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,a],scope:{1:"keyword",3:"title.class"}}]},J={relevance:0,match:r.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Tn,...Cn]}},de={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},z={variants:[{match:[/function/,/\s+/,a,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},Q={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ae(N){return r.concat("(?!",N.join("|"),")")}const ne={match:r.concat(/\b/,ae([...An,"super","import"].map(N=>`${N}\\s*\\(`)),a,r.lookahead(/\s*\(/)),className:"title.function",relevance:0},ie={begin:r.concat(/\./,r.lookahead(r.concat(a,/(?![0-9A-Za-z$_(])/))),end:a,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},le={match:[/get|set/,/\s+/,a,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",v={match:[/const|var|let/,/\s+/,a,/\s*/,/=\s*/,/(async\s*)?/,r.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:P,CLASS_REFERENCE:J},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),de,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,A,L,G,Z,{match:/\$\d+/},p,J,{scope:"attr",match:a+r.lookahead(":"),relevance:0},v,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[Z,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:P}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:g},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},z,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,e.inherit(e.TITLE_MODE,{begin:a,className:"title.function"})]},{match:/\.\.\./,relevance:0},ie,{match:"\\$"+a,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},ne,Q,j,le,{match:/\$[(.]/}]}}function mr(e){const r={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},i={match:/[{}[\],:]/,className:"punctuation",relevance:0},a=["true","false","null"],s={scope:"literal",beginKeywords:a.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:a},contains:[r,i,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function On(e){const r=e.regex,i={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},a={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},g={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},l={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},d=/[A-Za-z][A-Za-z0-9+.-]*/,u={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:r.concat(/\[.+?\]\(/,d,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},m={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},y={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},p=e.inherit(m,{contains:[]}),x=e.inherit(y,{contains:[]});m.contains.push(x),y.contains.push(p);let c=[i,u];return[m,y,p,x].forEach(S=>{S.contains=S.contains.concat(c)}),c=c.concat(m,y),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:c},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:c}]}]},i,g,m,y,{className:"quote",begin:"^>\\s+",contains:c,end:"$"},s,a,u,l,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function In(e){const r=e.regex,i=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],d={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},u={className:"meta",begin:/^(>>>|\.\.\.) /},m={className:"subst",begin:/\{/,end:/\}/,keywords:d,illegal:/#/},y={begin:/\{\{/,relevance:0},p={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,u,y,m]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,u,y,m]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,y,m]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,y,m]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},x="[0-9](_?[0-9])*",c=`(\\b(${x}))?\\.(${x})|\\b(${x})\\.`,A=`\\b|${a.join("|")}`,L={className:"number",relevance:0,variants:[{begin:`(\\b(${x})|(${c}))[eE][+-]?(${x})[jJ]?(?=${A})`},{begin:`(${c})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${A})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${A})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${A})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${A})`},{begin:`\\b(${x})[jJ](?=${A})`}]},G={className:"comment",begin:r.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},S={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",u,L,p,e.HASH_COMMENT_MODE]}]};return m.contains=[p,L,u],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:d,illegal:/(<\/|\?)|=>/,contains:[u,L,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},p,G,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[S]},{variants:[{match:[/\bclass/,/\s+/,i,/\s*/,/\(\s*/,i,/\s*\)/]},{match:[/\bclass/,/\s+/,i]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[L,S,p]}]}}function Bn(e){const r=e.regex,i=/(r#)?/,a=r.concat(i,e.UNDERSCORE_IDENT_RE),s=r.concat(i,e.IDENT_RE),g={className:"title.function.invoke",relevance:0,begin:r.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,r.lookahead(/\s*\(/))},l="([ui](8|16|32|64|128|size)|f(32|64))?",d=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],u=["true","false","Some","None","Ok","Err"],m=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],y=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:y,keyword:d,literal:u,built_in:m},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+l},{begin:"\\b0o([0-7_]+)"+l},{begin:"\\b0x([A-Fa-f0-9_]+)"+l},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+l}],relevance:0},{begin:[/fn/,/\s+/,a],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,a],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,a,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:m,type:y}},{className:"punctuation",begin:"->"},g]}}function hr(e){const r=e.regex,i=e.COMMENT("--","$"),a={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},g=["true","false","unknown"],l=["double precision","large object","with timezone","without timezone"],d=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],u=["add","asc","collation","desc","final","first","last","view"],m=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],y=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],p=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],x=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],c=y,A=[...m,...u].filter(P=>!y.includes(P)),L={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},G={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},S={match:r.concat(/\b/,r.either(...c),/\s*\(/),relevance:0,keywords:{built_in:c}};function Z(P){return r.concat(/\b/,r.either(...P.map(R=>R.replace(/\s+/,"\\s+"))),/\b/)}const O={scope:"keyword",match:Z(x),relevance:0};function B(P,{exceptions:R,when:j}={}){const J=j;return R=R||[],P.map(de=>de.match(/\|\d+$/)||R.includes(de)?de:J(de)?`${de}|0`:de)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:B(A,{when:P=>P.length<3}),literal:g,type:d,built_in:p},contains:[{scope:"type",match:Z(l)},O,S,L,a,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,i,G]}}const mt="[A-Za-z$_][0-9A-Za-z$_]*",Ln=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Dn=["true","false","null","undefined","NaN","Infinity"],zn=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],$n=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Pn=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Un=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Hn=[].concat(Pn,zn,$n);function pr(e){const r=e.regex,i=(N,{after:$})=>{const K="</"+N[0].slice(1);return N.input.indexOf(K,$)!==-1},a=mt,s={begin:"<>",end:"</>"},g=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(N,$)=>{const K=N[0].length+N.index,ee=N.input[K];if(ee==="<"||ee===","){$.ignoreMatch();return}ee===">"&&(i(N,{after:K})||$.ignoreMatch());let ce;const he=N.input.substring(K);if(ce=he.match(/^\s*=/)){$.ignoreMatch();return}if((ce=he.match(/^\s+extends\s+/))&&ce.index===0){$.ignoreMatch();return}}},d={$pattern:mt,keyword:Ln,literal:Dn,built_in:Hn,"variable.language":Un},u="[0-9](_?[0-9])*",m=`\\.(${u})`,y="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${y})((${m})|\\.)?|(${m}))[eE][+-]?(${u})\\b`},{begin:`\\b(${y})\\b((${m})\\b|\\.)?|(${m})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},x={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},c={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"xml"}},A={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"css"}},L={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"graphql"}},G={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,x]},Z={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:a+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},O=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,A,L,G,{match:/\$\d+/},p];x.contains=O.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(O)});const B=[].concat(Z,x.contains),P=B.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(B)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:P},j={variants:[{match:[/class/,/\s+/,a,/\s+/,/extends/,/\s+/,r.concat(a,"(",r.concat(/\./,a),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,a],scope:{1:"keyword",3:"title.class"}}]},J={relevance:0,match:r.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...zn,...$n]}},de={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},z={variants:[{match:[/function/,/\s+/,a,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},Q={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ae(N){return r.concat("(?!",N.join("|"),")")}const ne={match:r.concat(/\b/,ae([...Pn,"super","import"].map(N=>`${N}\\s*\\(`)),a,r.lookahead(/\s*\(/)),className:"title.function",relevance:0},ie={begin:r.concat(/\./,r.lookahead(r.concat(a,/(?![0-9A-Za-z$_(])/))),end:a,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},le={match:[/get|set/,/\s+/,a,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",v={match:[/const|var|let/,/\s+/,a,/\s*/,/=\s*/,/(async\s*)?/,r.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:P,CLASS_REFERENCE:J},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),de,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,A,L,G,Z,{match:/\$\d+/},p,J,{scope:"attr",match:a+r.lookahead(":"),relevance:0},v,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[Z,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:P}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:g},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},z,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,e.inherit(e.TITLE_MODE,{begin:a,className:"title.function"})]},{match:/\.\.\./,relevance:0},ie,{match:"\\$"+a,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},ne,Q,j,le,{match:/\$[(.]/}]}}function Vn(e){const r=e.regex,i=pr(e),a=mt,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],g={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},l={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[i.exports.CLASS_REFERENCE]},d={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},u=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],m={$pattern:mt,keyword:Ln.concat(u),literal:Dn,built_in:Hn.concat(s),"variable.language":Un},y={className:"meta",begin:"@"+a},p=(L,G,S)=>{const Z=L.contains.findIndex(O=>O.label===G);if(Z===-1)throw new Error("can not find mode to replace");L.contains.splice(Z,1,S)};Object.assign(i.keywords,m),i.exports.PARAMS_CONTAINS.push(y);const x=i.contains.find(L=>L.scope==="attr"),c=Object.assign({},x,{match:r.concat(a,r.lookahead(/\s*\?:/))});i.exports.PARAMS_CONTAINS.push([i.exports.CLASS_REFERENCE,x,c]),i.contains=i.contains.concat([y,g,l,c]),p(i,"shebang",e.SHEBANG()),p(i,"use_strict",d);const A=i.contains.find(L=>L.label==="func.def");return A.relevance=0,Object.assign(i,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),i}function Fn(e){const r=e.regex,i=r.concat(/[\p{L}_]/u,r.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),a=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},g={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},l=e.inherit(g,{begin:/\(/,end:/\)/}),d=e.inherit(e.APOS_STRING_MODE,{className:"string"}),u=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),m={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:a,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[g,u,d,l,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[g,l,u,d]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[u]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[m],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[m],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:r.concat(/</,r.lookahead(r.concat(i,r.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:i,relevance:0,starts:m}]},{className:"tag",begin:r.concat(/<\//,r.lookahead(r.concat(i,/>/))),contains:[{className:"name",begin:i,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Wn(e){const r="true false yes no null",i="[\\w#;/?:@&=+$,.~*'()[\\]]+",a={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},g={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},l={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},d=e.inherit(l,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),x={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},c={end:",",endsWithParent:!0,excludeEnd:!0,keywords:r,relevance:0},A={begin:/\{/,end:/\}/,contains:[c],illegal:"\\n",relevance:0},L={begin:"\\[",end:"\\]",contains:[c],illegal:"\\n",relevance:0},G=[a,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+i},{className:"type",begin:"!<"+i+">"},{className:"type",begin:"!"+i},{className:"type",begin:"!!"+i},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:r,keywords:{literal:r}},x,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},A,L,g,l],S=[...G];return S.pop(),S.push(d),c.contains=S,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:G}}const zt={bash:Dt,sh:Dt,shell:Dt,css:lr,go:_n,golang:_n,java:cr,javascript:Rn,js:Rn,json:mr,markdown:On,md:On,python:In,py:In,rust:Bn,rs:Bn,sql:hr,typescript:Vn,ts:Vn,xml:Fn,html:Fn,yaml:Wn,yml:Wn};for(const[e,r]of Object.entries(zt))Lt.registerLanguage(e,r);function Gn(e){const r=e.split(`
|
|
16
|
+
`);return/^(`{3,}|~{3,})/.test(r[0]??"")&&r.shift(),/^(`{3,}|~{3,})\s*$/.test(r[r.length-1]??"")&&r.pop(),r.join(`
|
|
17
|
+
`).replace(/\n+$/,"")}function Kn(e){const r=/^(`{3,}|~{3,})([^\s`~]*)/.exec(e.split(`
|
|
18
|
+
`)[0]??""),i=((r==null?void 0:r[2])??"").toLowerCase();return i&&zt[i]?i:""}function br(e,r){const i=r&&zt[r]?r:"";try{return i?Lt.highlight(e,{language:i,ignoreIllegals:!0}).value:Lt.highlightAuto(e).value}catch{return yr(e)}}function Er(e){return e.split(`
|
|
19
|
+
`).filter(r=>r.trim().length>0).filter(r=>!/^\s*\|?\s*(:?-+:?\s*\|\s*)+(:?-+:?)(\s*\|)?\s*$/.test(r)).map(r=>r.replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|").map(i=>i.trim()))}function yr(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function xr(e,r,i){if(e.length<=1)return e.slice();const[a,...s]=e,g=s.map(m=>m[r]??""),l=g.length>0&&g.every(m=>m.trim()!==""&&!Number.isNaN(Number(m))),d=i==="asc"?1:-1,u=s.slice().sort((m,y)=>{const p=m[r]??"",x=y[r]??"";return l?(Number(p)-Number(x))*d:p.localeCompare(x,"zh-Hans-CN",{numeric:!0})*d});return[a,...u]}const kr=["viewBox","width","height"],Nr={class:"zm-edges"},wr=["d","fill"],_r=["data-node-id","onClick","onDblclick","onContextmenu","onMouseenter","onMouseleave"],Sr=["src","width","height","alt"],Mr=["onDblclick"],vr={key:0,class:"zm-rich-code"},Tr=["innerHTML"],Cr={key:1,class:"zm-rich-table"},Ar=["onClick"],Rr={class:"zm-rich-sort-mark","aria-hidden":"true"},Or={key:2,class:"zm-text"},Ir={class:"zm-text-label"},Br=["href","title"],Lr=["title","onClick"],Dr=["title"],zr=["title","onClick"],$r=["onClick"],Pr=["onMousedown"],Ur=["onClick"],Hr={key:0,class:"zm-toolbar"},Vr=["src"],Fr=["src"],Wr={class:"zm-tb-tip"},Be=24,Ve=400,Ae=160,Zn=t.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(e,{expose:r,emit:i}){const a=e,s=i,g=t.ref(null),l=t.ref(null),d=t.ref(""),u=t.ref(null),m=t.ref(new Set),y=t.ref(null),p=t.ref(""),x=t.ref(new Map),c=t.ref(Me(a.data)),A=t.ref({}),L=t.ref({}),G=t.ref(a.markdown!==void 0);let S=!1;t.watch(()=>a.markdown,n=>{if(n===void 0){G.value=!1;return}G.value=!0;const o=Ct(n||"");S=!0,c.value=Me(o),u.value=null,m.value=new Set,_(),t.nextTick(()=>{S=!1,ve()})}),t.watch(c,()=>{G.value&&!S&&s("markdownChange",lt(c.value))},{deep:!0});const Z=t.computed(()=>T.showOrderBadge===!0),O=t.ref(new Map),B=O.value;function P(n,o){const f={};o.bg&&(f.bg=o.bg),o.textColor&&(f.textColor=o.textColor),o.borderColor&&(f.borderColor=o.borderColor),o.fontWeight&&(f.fontWeight=o.fontWeight),Object.keys(f).length===0?B.delete(n):B.set(n,f),O.value=new Map(B)}function R(n){return B.get(n)??{}}function j(n,o){const f=F(c.value,n);f&&(f.image={src:o.src,naturalW:o.naturalW,naturalH:o.naturalH,width:z(o.width,Be,Ve),height:z(o.height,Be,Ve)},k(),_(),s("change",c.value))}function J(n){const o=F(c.value,n);!o||!o.image||(delete o.image,k(),_(),s("change",c.value))}function de(n,o){const f=o.trim();if(!F(c.value,n))return;if(!f){J(n);return}const b=new Image;b.onload=()=>{const M=F(c.value,n);if(!M)return;const C=b.naturalWidth&&b.naturalHeight?b.naturalWidth/b.naturalHeight:1,D=z(b.naturalWidth||Ae,Be,Ve),X=Math.round(D/C);M.image={src:f,naturalW:b.naturalWidth||D,naturalH:b.naturalHeight||X,width:D,height:X},k(),_(),s("change",c.value)},b.onerror=()=>{},b.src=f}function z(n,o,f){return Math.min(f,Math.max(o,n))}function Q(n,o){const f=new FileReader;f.onload=()=>{if(typeof f.result!="string")return;const w=f.result,b=new window.Image;b.onload=()=>{const M=b.naturalWidth||Ae,C=b.naturalHeight||Ae,D=z(M,Be,Ae),X=z(Math.round(C*D/M),Be,Ve);o({src:w,naturalW:M,naturalH:C,width:D,height:X})},b.onerror=()=>{o({src:w,naturalW:Ae,naturalH:Ae,width:Ae,height:Ae})},b.src=w},f.readAsDataURL(n)}function ae(n){const o=document.createElement("input");o.type="file",o.accept="image/*",o.style.display="none",o.onchange=()=>{var w;const f=(w=o.files)==null?void 0:w[0];f&&(Q(f,b=>j(n,b)),document.body.removeChild(o))},document.body.appendChild(o),o.click()}function ne(n,o){const f=o.trim(),w=F(c.value,n);w&&(f?w.link={url:f}:delete w.link,k(),_(),s("change",c.value))}function ie(n){ne(n,"")}function le(n,o){const f=F(c.value,n);f&&(o?f.note={text:o}:delete f.note,k(),_(),s("change",c.value))}function E(n){le(n,"")}function v(n,o){const f=F(c.value,n);f&&(o?f.richContent=o:delete f.richContent,k(),_(),s("change",c.value))}const N=t.ref(null);function $(n,o){a.readonly||(n.preventDefault(),n.stopPropagation(),u.value=o.id,s("select",F(c.value,o.id)),N.value={nodeId:o.id,x:n.clientX,y:n.clientY})}function K(){N.value=null}function ee(){var o;const n=(o=N.value)==null?void 0:o.nodeId;n&&ae(n)}function ce(){var w,b,M;const n=(w=N.value)==null?void 0:w.nodeId;if(!n)return;const o=((M=(b=F(c.value,n))==null?void 0:b.link)==null?void 0:M.url)??"",f=window.prompt("输入链接 URL(留空取消)",o);f!==null&&ne(n,f)}function he(){var o;const n=(o=N.value)==null?void 0:o.nodeId;n&&ie(n)}function ue(){var o;const n=(o=N.value)==null?void 0:o.nodeId;n&&Et(n)}function pe(){var o;const n=(o=N.value)==null?void 0:o.nodeId;n&&E(n)}function ht(){var o;const n=(o=N.value)==null?void 0:o.nodeId;n&&J(n)}function je(){var W,xe;const n=(W=N.value)==null?void 0:W.nodeId;if(!n)return;const o=(xe=F(c.value,n))==null?void 0:xe.richContent,f=(o==null?void 0:o.kind)==="code"?Gn(o.raw):"",w=(o==null?void 0:o.kind)==="code"&&o.lang||"",b=w?"```"+w+`
|
|
20
|
+
`:"```\n",C=window.prompt("输入代码块内容(用 ```lang 包裹;留空取消)",f?b+f+(f.endsWith("```")?"":"\n```"):b+"// 你的代码"+"\n```");if(C===null)return;const D=C.trim();if(!D){v(n,null);return}const X=/^```([^\s`]*)/.exec(D),h=X?X[1]:void 0;v(n,{kind:"code",raw:D,lang:h})}function pt(){var o;const n=(o=N.value)==null?void 0:o.nodeId;n&&v(n,null)}function bt(){var C,D;const n=(C=N.value)==null?void 0:C.nodeId;if(!n)return;const o=(D=F(c.value,n))==null?void 0:D.richContent,f=(o==null?void 0:o.kind)==="table"?o.raw:"",b=window.prompt("输入 markdown 表格(每行以 | 分隔;留空取消)",f||`| 列1 | 列2 | 列3 |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| a | b | c |`);if(b===null)return;const M=b.trim();if(!M){v(n,null);return}v(n,{kind:"table",raw:M})}function $t(){var o;const n=(o=N.value)==null?void 0:o.nodeId;n&&v(n,null)}function Et(n){a.readonly||s("edit-note",n)}function Pt(n,o=60){const f=n.replace(/\s+/g," ").trim();return f.length<=o?f||"点击编辑笔记":f.slice(0,o)+"…"}function Le(n){var b;if(a.readonly||l.value)return;const o=n.target;if(o&&(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable))return;const f=u.value;if(!f)return;const w=(b=n.clipboardData)==null?void 0:b.items;if(w)for(let M=0;M<w.length;M++){const C=w[M];if(C.kind==="file"&&C.type.startsWith("image/")){const D=C.getAsFile();if(!D)continue;n.preventDefault();const X=F(c.value,f);if(X!=null&&X.image&&!window.confirm("该节点已有图片,要用剪贴板里的图片替换吗?"))return;Q(D,h=>j(f,h));return}}}t.onMounted(()=>{window.addEventListener("paste",Le),_()}),t.onBeforeUnmount(()=>{window.removeEventListener("paste",Le)});const Re=t.ref(null),be=t.computed(()=>{var n;return((n=Re.value)==null?void 0:n.nodeId)??null});function Ut(n,o){if(!o.image)return;n.preventDefault(),n.stopPropagation();const f=o.image.naturalW||o.image.width,w=o.image.naturalH||o.image.height,b=w>0?w/f:1;Re.value={nodeId:o.id,startX:n.clientX,startY:n.clientY,startW:o.image.width,startH:o.image.height,naturalW:f,naturalH:w,ratio:b,pendingW:o.image.width,pendingH:o.image.height},window.addEventListener("mousemove",Fe),window.addEventListener("mouseup",I)}function Fe(n){var X,h;const o=Re.value;if(!o)return;const f=V.scale.value||1,w=n.clientX-o.startX,b=z(o.startW+w/f,Be,Ve),M=z(b*o.ratio,Be,Ve);o.pendingW=b,o.pendingH=M;const C=(X=g.value)==null?void 0:X.querySelector(`[data-node-id="${o.nodeId}"] .zm-node-img`);C&&(C.style.width=`${b}px`,C.style.height=`${M}px`);const D=(h=g.value)==null?void 0:h.querySelector(`[data-node-id="${o.nodeId}"]`);D&&(D.style.minWidth=`${Math.max(80,Math.ceil(b+28))}px`,D.style.height=`${Math.ceil(M+8+30)}px`)}function I(){const n=Re.value;if(window.removeEventListener("mousemove",Fe),window.removeEventListener("mouseup",I),Re.value=null,!n)return;const o=F(c.value,n.nodeId);!o||!o.image||(j(n.nodeId,{src:o.image.src,naturalW:o.image.naturalW,naturalH:o.image.naturalH,width:n.pendingW,height:n.pendingH}),u.value=n.nodeId,s("select",o),oe=!0)}const We=t.ref(null);let oe=!1;function q(n){We.value=n}function Ge(n){We.value===n&&(We.value=null)}const Ne=t.ref(0),De=t.ref(!1),Ee=Yi(100);function k(){Ee.record({data:c.value})}function _(){m.value=new Set(m.value),Ne.value++,t.nextTick().then(()=>t.nextTick()).then(()=>U()).then(()=>{Ne.value++})}function U(){const n=document.querySelectorAll(".zm-rich"),o={},f={};n.forEach(w=>{let b=w,M=null;for(;b&&!M;)M=b.getAttribute("data-node-id"),b=b.parentElement;if(!M)return;const C=w.offsetHeight,D=w.scrollWidth,X=Math.round(C*2)/2,h=Math.round(D*2)/2;o[M]=X,f[M]=h,A.value[M],L.value[M]}),A.value=o,L.value=f}const H=t.computed(()=>{var n,o,f,w,b,M,C,D,X,h;return{rootBg:((n=a.theme)==null?void 0:n.rootBg)??"#1f2937",rootText:((o=a.theme)==null?void 0:o.rootText)??"#ffffff",branchBg:((f=a.theme)==null?void 0:f.branchBg)??"#ffffff",branchText:((w=a.theme)==null?void 0:w.branchText)??"#1f2937",lineColor:((b=a.theme)==null?void 0:b.lineColor)??"#94a3b8",bgColor:((M=a.theme)==null?void 0:M.bgColor)??"#f8fafc",fontSize:((C=a.theme)==null?void 0:C.fontSize)??14,lineWidthStart:((D=a.theme)==null?void 0:D.lineWidthStart)??2.2,lineWidthEnd:((X=a.theme)==null?void 0:X.lineWidthEnd)??.8,rainbowBranch:((h=a.theme)==null?void 0:h.rainbowBranch)??!1}}),T=t.reactive({autoBalanceOnChange:!0,lineWidthStart:12,lineWidthEnd:3.6,rainbowBranch:!0,branchPaletteId:"default",customPalettes:[],lineStyle:"curve",layoutMode:"mindmap",taperedEdge:!0,showOrderBadge:!1});function ye(n){return T.taperedEdge?Ht(n):Yn(n)}function yt(n){return T.taperedEdge?T.lineWidthEnd:Yn(n)}function Ht(n){return n<=0?T.lineWidthStart:n===1?Math.max(1.5,T.lineWidthStart*.67):n===2?Math.max(.8,T.lineWidthStart*.42):T.lineWidthEnd}function Yn(n){if(n<=0)return T.lineWidthStart;if(n>=3)return T.lineWidthEnd;const o=n/3;return T.lineWidthStart+(T.lineWidthEnd-T.lineWidthStart)*o}function Kr(n,o,f,w){const b=1-n,M=b*b*b*o.x+3*b*b*n*f.x1+3*b*n*n*f.x2+n*n*n*w.x,C=b*b*b*o.y+3*b*b*n*f.y1+3*b*n*n*f.y2+n*n*n*w.y;return{x:M,y:C}}function Zr(n,o,f,w,b=32,M="curve",C="right"){if(M==="curve"){let Se;if(C==="right"||C==="left"){const te=Math.abs(o.x-n.x)*.45,Te=C==="right"?1:-1;Se={x1:n.x+Te*te,y1:n.y,x2:o.x-Te*te,y2:o.y}}else{const te=Math.abs(o.y-n.y)*.45;Se={x1:n.x,y1:n.y+te,x2:o.x,y2:o.y-te}}const ci=Y=>{const te=1-Y,Te=-3*te*te*n.x+3*(te*te-2*te*Y)*Se.x1+3*(2*te*Y-Y*Y)*Se.x2+3*Y*Y*o.x,Ze=-3*te*te*n.y+3*(te*te-2*te*Y)*Se.y1+3*(2*te*Y-Y*Y)*Se.y2+3*Y*Y*o.y;return{dx:Te,dy:Ze}},it=[],Zt=[];for(let Y=0;Y<=b;Y++){const te=Y/b,Te=Y===0?n:Y===b?o:Kr(te,n,Se,o),Ze=ci(te);let _t=Math.hypot(Ze.dx,Ze.dy);_t<1e-6&&(_t=1);const di=-Ze.dy/_t,ui=Ze.dx/_t,St=(f+(w-f)*te)/2;it.push({x:Te.x+di*St,y:Te.y+ui*St}),Zt.push({x:Te.x-di*St,y:Te.y-ui*St})}let wt=`M ${it[0].x.toFixed(2)} ${it[0].y.toFixed(2)}`;for(let Y=1;Y<=b;Y++)wt+=` L ${it[Y].x.toFixed(2)} ${it[Y].y.toFixed(2)}`;for(let Y=b;Y>=0;Y--)wt+=` L ${Zt[Y].x.toFixed(2)} ${Zt[Y].y.toFixed(2)}`;return wt+=" Z",wt}const D=o.x-n.x,X=o.y-n.y;let h=Math.hypot(D,X);h<1e-6&&(h=1);const W=-X/h,xe=D/h,_e=f/2,fe=w/2,Qe={x:n.x+W*_e,y:n.y+xe*_e},et={x:n.x-W*_e,y:n.y-xe*_e},tt={x:o.x-W*fe,y:o.y-xe*fe},nt={x:o.x+W*fe,y:o.y+xe*fe};return`M ${Qe.x.toFixed(2)} ${Qe.y.toFixed(2)} L ${nt.x.toFixed(2)} ${nt.y.toFixed(2)} L ${tt.x.toFixed(2)} ${tt.y.toFixed(2)} L ${et.x.toFixed(2)} ${et.y.toFixed(2)} Z`}const xt=t.computed(()=>ge.value.root.children),Yr=Ye[0].colors,Xn=t.computed(()=>zi(T.branchPaletteId,T.customPalettes)),ze=t.computed(()=>{const n=new Map;if(!T.rainbowBranch)return n;const o=a.lineColors,f=o&&o.length>0?o:Xn.value.colors.length>0?Xn.value.colors:Yr;for(let b=0;b<xt.value.length;b++){const M=xt.value[b];n.set(M.id,f[b%f.length])}const w=(b,M)=>{n.set(b.id,M);for(const C of b.children)w(C,M)};for(let b=0;b<xt.value.length;b++){const M=xt.value[b];w(M,f[b%f.length])}return n});function Xr(n,o){return T.rainbowBranch?ze.value.get(o.id)??H.value.lineColor:H.value.lineColor}function qr(n){const o=R(n.id);if(o.bg)return o.bg;if(n.isRoot)return H.value.rootBg;if(T.rainbowBranch){const f=ze.value.get(n.id);if(f)return ea(f,.18)}return H.value.branchBg}function jr(n){const o=R(n.id);if(o.textColor)return o.textColor;if(n.isRoot)return H.value.rootText;if(T.rainbowBranch){const f=ze.value.get(n.id);if(f)return qn(f,.55)}return H.value.branchText}function Jr(n){const o=R(n.id);if(o.borderColor)return o.borderColor;if(n.isRoot)return H.value.rootBg;if(T.rainbowBranch){const f=ze.value.get(n.id);if(f)return qn(f,.3)}return H.value.lineColor}function Qr(n){return R(n.id).fontWeight??(n.isRoot?600:400)}function ea(n,o){const f=n.replace("#",""),w=f.length===6?f:f.split("").map(D=>D+D).join(""),b=parseInt(w.slice(0,2),16),M=parseInt(w.slice(2,4),16),C=parseInt(w.slice(4,6),16);return`rgba(${b}, ${M}, ${C}, ${o})`}function qn(n,o){const f=n.replace("#",""),w=f.length===6?f:f.split("").map(D=>D+D).join(""),b=Math.round(parseInt(w.slice(0,2),16)*(1-o)),M=Math.round(parseInt(w.slice(2,4),16)*(1-o)),C=Math.round(parseInt(w.slice(4,6),16)*(1-o));return`rgb(${b}, ${M}, ${C})`}const V=Gi({getContainer:()=>g.value});V.setOnMarqueeEnd(ba),Zi({isEditing:()=>l.value!==null,isReadonly:()=>a.readonly,getSelectedId:()=>u.value,getRootId:()=>c.value.id,defaultTargetId:()=>c.value.id,onAddChild:Ke,onAddSibling:Nt,onAddSiblingBefore:ei,onRemove:ni,onStartEdit:Je,onClearSelection:()=>{u.value=null,s("select",null)},onDuplicate:ti,onUndo:Ft,onRedo:Wt,onNavigate:ua,onSelectRoot:()=>{u.value=c.value.id;const n=F(c.value,c.value.id);n&&s("select",n)}});const ge=t.computed(()=>{const n=Me(c.value);return Jn(n),Ii(n,{mode:T.layoutMode,baseFontSize:H.value.fontSize,richHeights:A.value,richWidths:L.value})}),jn=t.ref([]),Vt=t.computed(()=>(Ne.value,jn.value));t.watch(ge,n=>{const o=[],f=w=>{o.push(w);for(const b of w.children)f(b)};f(n.root),jn.value=o},{immediate:!0});const ta=t.computed(()=>{const n=[];for(const o of Vt.value)for(const f of o.children)n.push({from:o,to:f,key:`${o.id}->${f.id}`});return n}),na=t.computed(()=>`${ge.value.vbX} ${ge.value.vbY} ${ge.value.vbW} ${ge.value.vbH}`);function Jn(n){if(m.value.has(n.id)){n.children=[],n.collapsed=!0;return}n.collapsed=!1;for(const o of n.children)Jn(o)}function Je(n){const o=F(c.value,n);o&&(l.value=n,d.value=o.text,t.nextTick(()=>{const f=document.querySelector(".zm-input");f==null||f.focus(),f==null||f.select()}))}function kt(n={}){if(!l.value)return;const o=F(c.value,l.value);o&&o.text!==(d.value.trim()||" ")&&(o.text=d.value.trim()||" ",k(),s("change",c.value));const f=l.value;l.value=null,n.addChild?t.nextTick(()=>Ke(f)):n.addSibling==="after"?t.nextTick(()=>Nt(f)):n.addSibling==="before"&&t.nextTick(()=>ei(f))}function ia(){l.value=null}function oa(n){if(a.readonly)return;const o=F(c.value,n);o!=null&&o.richContent&&(y.value=n,p.value=o.richContent.raw,t.nextTick(()=>{const f=document.querySelector(".zm-node .zm-rich textarea");f==null||f.focus()}))}function Qn(){if(!y.value)return;const n=y.value,o=F(c.value,n),f=p.value;if(o&&o.richContent&&o.richContent.raw!==f)if(o.richContent.kind==="code"){const w=Kn(f)||void 0;v(n,{kind:"code",raw:f,lang:w})}else v(n,{kind:"table",raw:f});y.value=null}function ra(){y.value=null}function aa(n){n.key==="Escape"?(n.preventDefault(),ra()):n.key==="Enter"&&(n.ctrlKey||n.metaKey)&&(n.preventDefault(),Qn())}function sa(n,o){const f=x.value.get(n);!f||f.col!==o?x.value.set(n,{col:o,dir:"asc"}):f.dir==="asc"?x.value.set(n,{col:o,dir:"desc"}):x.value.delete(n)}function la(n,o){const f=x.value.get(n);return!f||o.length<=1?o:xr(o,f.col,f.dir)}function ca(n,o){const f=x.value.get(n);return!f||f.col!==o?"↕":f.dir==="asc"?"▲":"▼"}function da(n){const o=n.metaKey||n.ctrlKey;o&&(n.key==="z"||n.key==="Z")&&!n.shiftKey?(n.preventDefault(),Ft()):(o&&n.shiftKey&&(n.key==="z"||n.key==="Z")||o&&(n.key==="y"||n.key==="Y")&&!n.shiftKey)&&(n.preventDefault(),Wt())}function Ke(n){const o=en(c.value,n,st);o&&(k(),_(),s("change",c.value),t.nextTick(()=>Je(o.id)))}function Nt(n){if(n===c.value.id){Ke(n);return}const o=tn(c.value,n,st);o&&(k(),_(),s("change",c.value),t.nextTick(()=>Je(o.id)))}function ei(n){if(n===c.value.id){Ke(n);return}const o=Ui(c.value,n,st);o&&(k(),_(),s("change",c.value),t.nextTick(()=>Je(o.id)))}function ti(n){if(n===c.value.id)return;const o=Hi(c.value,n);o&&(k(),u.value=o.id,s("change",c.value),_())}function Ft(){const n=Ee.undo();n&&(c.value=n.data,u.value=null,s("select",null),_(),s("change",c.value))}function Wt(){const n=Ee.redo();n&&(c.value=n.data,u.value=null,s("select",null),_(),s("change",c.value))}function ua(n,o){const f=u.value??c.value.id,w=F(c.value,f);if(!w)return;let b=null;if(o===1){const M=ke(c.value,w.id);if(M){const C=M.children.findIndex(D=>D.id===w.id);C>=0&&C<M.children.length-1&&(b=M.children[C+1].id)}}else if(o===-1){const M=ke(c.value,w.id);if(M){const C=M.children.findIndex(D=>D.id===w.id);C>0&&(b=M.children[C-1].id)}}else if(n===1){const M=ke(c.value,w.id);M&&(b=M.id)}else n===-1&&w.children.length>0&&(b=w.children[0].id);if(b){u.value=b;const M=F(c.value,b);M&&s("select",M)}}function ni(n){n!==c.value.id&&Tt(c.value,n)&&(k(),u.value===n&&(u.value=null),_(),s("change",c.value))}function ii(n){m.value.has(n)?m.value.delete(n):m.value.add(n),_()}function fa(n,o){$i(c.value,n,o)&&(k(),_(),s("change",c.value))}function ga(n,o,f){return Pi(c.value,n,o,f)?(k(),_(),s("change",c.value),!0):!1}function ma(n,o){n.stopPropagation(),u.value=o.id;const f=F(c.value,o.id);s("select",f)}function ha(n){const o=n.target;if(!o||o.closest(".zm-node, .zm-toolbar, button, input, textarea"))return;if(n.button===2){V.startPan(n);return}if(n.button!==0)return;const f=g.value.getBoundingClientRect(),w=(n.clientX-f.left-V.offsetX.value)/V.scale.value,b=(n.clientY-f.top-V.offsetY.value)/V.scale.value;V.startMarquee(w,b)}function pa(n){if(oe){oe=!1;return}const o=n.target;if(!o||o.closest(".zm-node"))return;const f=V.marquee;f.width>=4||f.height>=4||u.value!==null&&(u.value=null,s("select",null))}function ba(){const n=V.marquee;if(n.width<4&&n.height<4)return;const o=n.x,f=n.y,w=n.x+n.width,b=n.y+n.height,M=[];for(const C of Vt.value){const D=C.width/2,X=C.height/2,h=C.x-D,W=C.x+D,xe=C.y-X,_e=C.y+X;h<=w&&W>=o&&xe<=b&&_e>=f&&M.push(C.id)}if(M.length>0){u.value=M[0];const C=F(c.value,M[0]);C&&s("select",C)}}function oi(n){return m.value.has(n)}function Ea(n){const o=F(c.value,n.id);return!!o&&o.children.length>0}function Gt(n){const o=F(c.value,n);return o?o.children.length:0}function ri(n){if(!F(c.value,n))return 0;const w=[c.value];for(;w.length;){const b=w.pop(),M=b.children.findIndex(C=>C.id===n);if(M>=0)return M;for(const C of b.children)w.push(C)}return 0}function ai(n,o,f,w){if(((w==null?void 0:w._dir)??n._dir)==="down")return o==="out"?{x:n.x,y:n.y+n.height/2}:{x:n.x,y:n.y-n.height/2};let M;o==="in"?M=-n.side:f!==void 0?M=f:M=n.side;const C=o==="in"?n._richInsetX??0:0;return{x:n.x+M*(n.width/2-C),y:n.y}}function ve(){const n=ge.value;V.resetView(n.width,n.height,n.root.y)}function ya(){De.value=!0,k(),_(),t.nextTick(()=>ve())}function Kt(n){T.layoutMode!==n&&(T.layoutMode=n,_(),t.nextTick(()=>ve()))}function si(){return JSON.stringify(c.value,null,2)}function li(n){try{const o=JSON.parse(n);return!o.id||!Array.isArray(o.children)?!1:(Ee.reset(),c.value=Me(o),u.value=null,m.value=new Set,_(),t.nextTick(()=>ve()),s("change",c.value),!0)}catch{return!1}}function xa(){const n=document.createElement("input");n.type="file",n.accept="application/json",n.onchange=()=>{var w;const o=(w=n.files)==null?void 0:w[0];if(!o)return;const f=new FileReader;f.onload=()=>{typeof f.result=="string"&&(li(f.result)||alert("导入失败:JSON 格式无效"))},f.readAsText(o)},n.click()}function ka(){const n=new Blob([si()],{type:"application/json"}),o=URL.createObjectURL(n),f=document.createElement("a");f.href=o,f.download=`${c.value.text||"mindmap"}.json`,f.click(),URL.revokeObjectURL(o)}return r({addChild:n=>Ke(n),addSibling:n=>Nt(n),removeNode:n=>ni(n),duplicateNode:n=>ti(n),setNodeText:(n,o)=>fa(n,o),moveNode:(n,o,f)=>ga(n,o,f),lineWidthForDepth:ye,endWidthForDepth:yt,getData:()=>c.value,setData:n=>{Ee.reset(),c.value=Me(n),u.value=null,m.value=new Set,_(),k(),t.nextTick(()=>ve())},resetView:()=>ve(),exportData:si,importData:li,getMarkdown:()=>lt(c.value),setMarkdown:(n,o=!0)=>{const f=Ct(n||"");o&&(G.value=!0),S=!o,Ee.reset(),c.value=Me(f),u.value=null,m.value=new Set,_(),k(),t.nextTick(()=>{S=!1,ve()}),s("change",c.value)},setBalanced:n=>{De.value=n},isBalanced:()=>De.value,balance:()=>ya(),applyNodeStyle:(n,o)=>P(n,o),getNodeStyle:n=>R(n),applyNodeImage:(n,o)=>j(n,o),applyNodeImageByUrl:(n,o)=>de(n,o),removeNodeImage:n=>J(n),applyNodeLink:(n,o)=>ne(n,o),removeNodeLink:n=>ie(n),applyNodeNote:(n,o)=>le(n,o),removeNodeNote:n=>E(n),applyNodeRichContent:(n,o)=>v(n,o),undo:()=>Ft(),redo:()=>Wt(),canUndo:()=>Ee.canUndo(),canRedo:()=>Ee.canRedo(),applySettings:n=>{n.autoBalanceOnChange!==void 0&&(T.autoBalanceOnChange=n.autoBalanceOnChange),n.lineWidthStart!==void 0&&(T.lineWidthStart=Math.max(.5,Math.min(20,n.lineWidthStart))),n.lineWidthEnd!==void 0&&(T.lineWidthEnd=Math.max(.3,Math.min(10,n.lineWidthEnd))),n.rainbowBranch!==void 0&&(T.rainbowBranch=n.rainbowBranch),n.branchPaletteId!==void 0&&(T.branchPaletteId=n.branchPaletteId),n.customPalettes!==void 0&&(T.customPalettes=n.customPalettes),n.lineStyle!==void 0&&(T.lineStyle=n.lineStyle),n.taperedEdge!==void 0&&(T.taperedEdge=n.taperedEdge),n.showOrderBadge!==void 0&&(T.showOrderBadge=n.showOrderBadge)},getSettings:()=>({autoBalanceOnChange:T.autoBalanceOnChange,lineWidthStart:T.lineWidthStart,lineWidthEnd:T.lineWidthEnd,rainbowBranch:T.rainbowBranch,branchPaletteId:T.branchPaletteId,customPalettes:T.customPalettes,lineStyle:T.lineStyle,layoutMode:T.layoutMode,taperedEdge:T.taperedEdge,showOrderBadge:T.showOrderBadge}),setBranchPalette:n=>{if(!n)return;[...Ye,...T.customPalettes].find(f=>f.id===n)&&(T.branchPaletteId=n)},getBranchPalette:()=>T.branchPaletteId,getBranchPalettes:()=>[...Ye,...T.customPalettes]}),t.watch(()=>a.data,n=>{c.value=Me(n),_()},{deep:!1}),t.onMounted(()=>{k(),t.nextTick(()=>ve())}),(n,o)=>{var f,w,b,M,C,D,X;return t.openBlock(),t.createElementBlock("div",{class:"zm-mindmap",style:t.normalizeStyle({background:H.value.bgColor,fontSize:H.value.fontSize+"px"})},[t.createElementVNode("div",{ref_key:"wrapperRef",ref:g,class:"zm-canvas",onMousedown:ha,onContextmenu:o[16]||(o[16]=t.withModifiers(()=>{},["prevent"])),onWheel:o[17]||(o[17]=(...h)=>t.unref(V).onWheel&&t.unref(V).onWheel(...h)),onClick:pa},[t.createElementVNode("div",{class:"zm-svg-layer",style:t.normalizeStyle({left:ge.value.vbX*t.unref(V).scale.value+t.unref(V).offsetX.value+"px",top:ge.value.vbY*t.unref(V).scale.value+t.unref(V).offsetY.value+"px",width:ge.value.vbW*t.unref(V).scale.value+"px",height:ge.value.vbH*t.unref(V).scale.value+"px"})},[(t.openBlock(),t.createElementBlock("svg",{class:"zm-svg",viewBox:na.value,preserveAspectRatio:"xMinYMin meet",width:ge.value.vbW*t.unref(V).scale.value,height:ge.value.vbH*t.unref(V).scale.value},[t.createElementVNode("g",Nr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ta.value,h=>(t.openBlock(),t.createElementBlock("path",{key:h.key,d:Zr(ai(h.from,"out",h.to.side,h.to),ai(h.to,"in"),ye(h.from.depth),yt(h.to.depth),32,T.lineStyle,h.to._dir),fill:Xr(h.from,h.to),stroke:"none"},null,8,wr))),128))])],8,kr))],4),t.unref(V).isMarquee.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"zm-marquee",style:t.normalizeStyle({left:t.unref(V).marquee.x*t.unref(V).scale.value+t.unref(V).offsetX.value+"px",top:t.unref(V).marquee.y*t.unref(V).scale.value+t.unref(V).offsetY.value+"px",width:t.unref(V).marquee.width*t.unref(V).scale.value+"px",height:t.unref(V).marquee.height*t.unref(V).scale.value+"px"})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:"zm-world",style:t.normalizeStyle({transform:`translate(${t.unref(V).offsetX.value}px, ${t.unref(V).offsetY.value}px) scale(${t.unref(V).scale.value})`})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Vt.value,h=>(t.openBlock(),t.createElementBlock("div",{key:h.id,class:t.normalizeClass(["zm-node",{"is-root":h.isRoot,"is-selected":u.value===h.id,"is-editing":l.value===h.id,"has-image":!!h.image,"is-resizing":be.value===h.id}]),"data-node-id":h.id,style:t.normalizeStyle({left:h.x+"px",top:h.y+"px",width:h.width+"px",minWidth:h.width+"px",height:h.height+"px",fontSize:h.fontSize+"px",background:qr(h),color:jr(h),borderColor:Jr(h),fontWeight:Qr(h),transform:"translate(-50%, -50%)"}),onClick:W=>ma(W,h),onDblclick:W=>{W.stopPropagation(),e.readonly||Je(h.id)},onContextmenu:W=>$(W,h),onMouseenter:W=>q(h.id),onMouseleave:W=>Ge(h.id)},[h.image?(t.openBlock(),t.createElementBlock("img",{key:0,class:"zm-node-img",src:h.image.src,width:h.image.width,height:h.image.height,alt:h.text,draggable:"false"},null,8,Sr)):t.createCommentVNode("",!0),h.richContent&&(h.richContent.kind==="code"||h.richContent.kind==="table")&&l.value!==h.id?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["zm-rich zm-rich-above",{"zm-rich-no-overflow":h.richContent.kind==="table"||h.richContent.kind==="code"}]),onClick:o[1]||(o[1]=t.withModifiers(()=>{},["stop"])),onDblclick:t.withModifiers(W=>oa(h.id),["stop"]),onMousedown:o[2]||(o[2]=t.withModifiers(()=>{},["stop"]))},[y.value===h.id?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:0,"onUpdate:modelValue":o[0]||(o[0]=W=>p.value=W),class:"zm-rich-edit",spellcheck:"false",onBlur:Qn,onKeydown:aa},null,544)),[[t.vModelText,p.value]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[h.richContent.kind==="code"?(t.openBlock(),t.createElementBlock("pre",vr,[t.createElementVNode("code",{innerHTML:t.unref(br)(t.unref(Gn)(h.richContent.raw),t.unref(Kn)(h.richContent.raw))},null,8,Tr)])):h.richContent.kind==="table"?(t.openBlock(),t.createElementBlock("table",Cr,[t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(la(h.id,t.unref(Er)(h.richContent.raw)),(W,xe)=>(t.openBlock(),t.createElementBlock("tr",{key:xe},[xe===0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(W,(_e,fe)=>{var Qe,et,tt,nt,Se;return t.openBlock(),t.createElementBlock("th",{key:`h${fe}`,class:t.normalizeClass(["zm-rich-table-sort",{"is-sorted":((Qe=x.value.get(h.id))==null?void 0:Qe.col)===fe,"is-asc":((et=x.value.get(h.id))==null?void 0:et.col)===fe&&((tt=x.value.get(h.id))==null?void 0:tt.dir)==="asc","is-desc":((nt=x.value.get(h.id))==null?void 0:nt.col)===fe&&((Se=x.value.get(h.id))==null?void 0:Se.dir)==="desc"}]),onClick:t.withModifiers(ci=>sa(h.id,fe),["stop"])},[t.createElementVNode("span",null,t.toDisplayString(_e),1),t.createElementVNode("span",Rr,t.toDisplayString(ca(h.id,fe)),1)],10,Ar)}),128)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(W,(_e,fe)=>(t.openBlock(),t.createElementBlock("td",{key:`c${fe}`},t.toDisplayString(_e),1))),128))]))),128))])])):t.createCommentVNode("",!0)],64))],42,Mr)):t.createCommentVNode("",!0),l.value!==h.id?(t.openBlock(),t.createElementBlock("span",Or,[t.createElementVNode("span",Ir,t.toDisplayString(h.text),1),h.link&&!l.value?(t.openBlock(),t.createElementBlock("a",{key:0,class:"zm-node-link",href:h.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开链接:${h.link.url}`,onClick:o[3]||(o[3]=t.withModifiers(()=>{},["stop"])),onMousedown:o[4]||(o[4]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(re,{name:"link",size:11,stroke:2})],40,Br)):t.createCommentVNode("",!0),h.note&&!l.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"zm-node-note-btn",type:"button",title:Pt(h.note.text),onClick:t.withModifiers(W=>Et(h.id),["stop"]),onMousedown:o[5]||(o[5]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(re,{name:"note",size:11,stroke:2})],40,Lr)):t.createCommentVNode("",!0)])):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:3,class:"zm-input","onUpdate:modelValue":o[6]||(o[6]=W=>d.value=W),autofocus:"",onBlur:o[7]||(o[7]=W=>kt()),onKeydown:[o[8]||(o[8]=t.withKeys(t.withModifiers(W=>kt({addSibling:"after"}),["exact"]),["enter"])),o[9]||(o[9]=t.withKeys(t.withModifiers(W=>kt({addSibling:"before"}),["shift","prevent","exact"]),["enter"])),o[10]||(o[10]=t.withKeys(t.withModifiers(W=>kt({addChild:!0}),["prevent"]),["tab"])),t.withKeys(ia,["esc"]),da],onMousedown:o[11]||(o[11]=t.withModifiers(()=>{},["stop"])),onClick:o[12]||(o[12]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,d.value]]),Z.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:"zm-order-badge",title:`数据顺序:第 ${ri(h.id)+1} 个`},t.toDisplayString(ri(h.id)+1),9,Dr)):t.createCommentVNode("",!0),oi(h.id)&&!h.isRoot&&Gt(h.id)>0?(t.openBlock(),t.createElementBlock("span",{key:5,class:t.normalizeClass(["zm-collapse-badge",{"is-on-left":h.side===-1}]),style:t.normalizeStyle({background:ze.value.get(h.id)??"#64748b"}),title:`展开 ${Gt(h.id)} 个子节点`,onMousedown:o[13]||(o[13]=t.withModifiers(()=>{},["stop"])),onClick:t.withModifiers(W=>ii(h.id),["stop"])},t.toDisplayString(Gt(h.id)),47,zr)):t.createCommentVNode("",!0),!e.readonly&&!h.isRoot&&Ea(h)&&!oi(h.id)?(t.openBlock(),t.createElementBlock("button",{key:6,class:t.normalizeClass(["zm-btn zm-collapse",{"is-on-left":h.side===-1}]),style:t.normalizeStyle({color:ze.value.get(h.id)??"#64748b",borderColor:ze.value.get(h.id)??"#64748b"}),title:"折叠",onMousedown:o[14]||(o[14]=t.withModifiers(()=>{},["stop"])),onClick:t.withModifiers(W=>ii(h.id),["stop"])},[t.createVNode(re,{name:"minus",size:10,stroke:2.4})],46,$r)):t.createCommentVNode("",!0),h.image&&u.value===h.id&&l.value!==h.id?(t.openBlock(),t.createElementBlock("span",{key:7,class:"zm-img-resize-handle",title:"拖动调整图片大小",onMousedown:t.withModifiers(W=>Ut(W,h),["stop"])},null,40,Pr)):t.createCommentVNode("",!0),h.image&&u.value===h.id&&l.value!==h.id?(t.openBlock(),t.createElementBlock("button",{key:8,class:"zm-img-remove-btn",title:"移除图片",onMousedown:o[15]||(o[15]=t.withModifiers(()=>{},["stop"])),onClick:t.withModifiers(W=>J(h.id),["stop"])},[t.createVNode(re,{name:"x",size:9,stroke:2.2})],40,Ur)):t.createCommentVNode("",!0)],46,_r))),128))],4),N.value?(t.openBlock(),t.createBlock(ro,{key:1,x:N.value.x,y:N.value.y,container:g.value,"has-image":!!((f=t.unref(F)(c.value,N.value.nodeId))!=null&&f.image),"has-link":!!((w=t.unref(F)(c.value,N.value.nodeId))!=null&&w.link),"has-note":!!((b=t.unref(F)(c.value,N.value.nodeId))!=null&&b.note),"has-code":((C=(M=t.unref(F)(c.value,N.value.nodeId))==null?void 0:M.richContent)==null?void 0:C.kind)==="code","has-table":((X=(D=t.unref(F)(c.value,N.value.nodeId))==null?void 0:D.richContent)==null?void 0:X.kind)==="table",readonly:a.readonly,onPickImage:ee,onRemoveImage:ht,onSetLink:ce,onRemoveLink:he,onEditNote:ue,onRemoveNote:pe,onAddCode:je,onEditCode:je,onRemoveCode:pt,onAddTable:bt,onEditTable:bt,onRemoveTable:$t,onClose:K},null,8,["x","y","container","has-image","has-link","has-note","has-code","has-table","readonly"])):t.createCommentVNode("",!0)],544),a.previewMode?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Hr,[t.createElementVNode("button",{class:"zm-tb-btn",title:"放大",onClick:o[18]||(o[18]=(...h)=>t.unref(V).zoomIn&&t.unref(V).zoomIn(...h))},[t.createVNode(re,{name:"zoom-in"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"缩小",onClick:o[19]||(o[19]=(...h)=>t.unref(V).zoomOut&&t.unref(V).zoomOut(...h))},[t.createVNode(re,{name:"zoom-out"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"重置视图",onClick:ve},[t.createVNode(re,{name:"reset"})]),o[25]||(o[25]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),e.readonly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:0,class:"zm-tb-btn",title:"添加子节点 (Tab)",onClick:o[20]||(o[20]=h=>u.value&&Ke(u.value))},[t.createElementVNode("img",{src:t.unref(pi),width:"14",height:"14",alt:"添加子节点",draggable:"false"},null,8,Vr)])),e.readonly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:1,class:"zm-tb-btn",title:"添加同级 (Enter)",onClick:o[21]||(o[21]=h=>u.value&&Nt(u.value))},[t.createElementVNode("img",{src:t.unref(hi),width:"14",height:"14",alt:"添加同级",draggable:"false"},null,8,Fr)])),o[26]||(o[26]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),t.createElementVNode("button",{class:t.normalizeClass(["zm-tb-btn",{active:T.layoutMode==="mindmap"}]),title:"思维导图布局 (中心辐射)",onClick:o[22]||(o[22]=h=>Kt("mindmap"))},[t.createVNode(re,{name:"mindmap"})],2),t.createElementVNode("button",{class:t.normalizeClass(["zm-tb-btn",{active:T.layoutMode==="tree"}]),title:"树形布局 (向右展开)",onClick:o[23]||(o[23]=h=>Kt("tree"))},[t.createVNode(re,{name:"tree"})],2),t.createElementVNode("button",{class:t.normalizeClass(["zm-tb-btn",{active:T.layoutMode==="org"}]),title:"组织结构布局 (向下展开)",onClick:o[24]||(o[24]=h=>Kt("org"))},[t.createVNode(re,{name:"org"})],2),o[27]||(o[27]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),e.readonly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:2,class:"zm-tb-btn",title:"导入 JSON",onClick:xa},[t.createVNode(re,{name:"import"})])),t.createElementVNode("button",{class:"zm-tb-btn",title:"导出 JSON",onClick:ka},[t.createVNode(re,{name:"export"})]),t.createElementVNode("span",Wr,t.toDisplayString(Math.round(t.unref(V).scale.value*100))+"%",1)]))],4)}}}),Gr={install(e){e.component("FlowMindMap",Zn)}};se.MindMap=Zn,se.addChild=en,se.addSibling=tn,se.clone=Me,se.default=Gr,se.findNode=F,se.findParent=ke,se.markdownToMindMap=Ct,se.markdownToRichMindMap=Fi,se.mindMapToMarkdown=lt,se.removeNode=Tt,se.richBlockToMarkdown=Wi,se.uid=we,Object.defineProperties(se,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|