flow-mindmap 0.3.1 → 0.3.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/dist/components/CanvasContextMenu.vue.d.ts +17 -0
- package/dist/components/MindMap.vue.d.ts +2 -0
- package/dist/flow-mindmap.js +2508 -2439
- package/dist/flow-mindmap.umd.cjs +18 -18
- package/dist/style.css +1 -1
- package/package.json +77 -77
|
@@ -1,22 +1,22 @@
|
|
|
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 mi=["width","height","stroke-width"],pi={key:4,points:"6 9 12 15 18 9"},hi={key:5,points:"9 6 15 12 9 18"},te=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",pi)):e.name==="expand"?(t.openBlock(),t.createElementBlock("polyline",hi)):e.name==="collapse-all"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[i[8]||(i[8]=t.createStaticVNode('<line x1="4" y1="4" x2="10" y2="10"></line><polyline points="6 10 10 10 10 6"></polyline><line x1="20" y1="4" x2="14" y2="10"></line><polyline points="14 6 14 10 18 10"></polyline><line x1="20" y1="20" x2="14" y2="14"></line><polyline points="14 18 14 14 18 14"></polyline><line x1="4" y1="20" x2="10" y2="14"></line><polyline points="6 14 10 14 10 18"></polyline>',8))],64)):e.name==="expand-all"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:7},[i[9]||(i[9]=t.createStaticVNode('<line x1="10" y1="10" x2="4" y2="4"></line><polyline points="4 6 4 4 6 4"></polyline><line x1="14" y1="10" x2="20" y2="4"></line><polyline points="20 6 20 4 18 4"></polyline><line x1="14" y1="14" x2="20" y2="20"></line><polyline points="20 18 20 20 18 20"></polyline><line x1="10" y1="14" x2="4" y2="20"></line><polyline points="4 18 4 20 6 20"></polyline>',8))],64)):e.name==="expand-level-1"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:8},[i[10]||(i[10]=t.createStaticVNode('<circle cx="12" cy="5" r="1.8" fill="currentColor" stroke="none"></circle><line x1="12" y1="7" x2="12" y2="11"></line><line x1="12" y1="11" x2="5" y2="17"></line><line x1="12" y1="11" x2="12" y2="17"></line><line x1="12" y1="11" x2="19" y2="17"></line><circle cx="5" cy="19" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="12" cy="19" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="19" cy="19" r="1.8" fill="currentColor" stroke="none"></circle>',8))],64)):e.name==="expand-level-2"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:9},[i[11]||(i[11]=t.createStaticVNode('<circle cx="12" cy="3" r="1.4" fill="currentColor" stroke="none"></circle><line x1="12" y1="4.5" x2="12" y2="7"></line><line x1="12" y1="7" x2="5" y2="11"></line><line x1="12" y1="7" x2="12" y2="11"></line><line x1="12" y1="7" x2="19" y2="11"></line><line x1="5" y1="11" x2="3" y2="16"></line><line x1="5" y1="11" x2="7" y2="16"></line><line x1="12" y1="11" x2="10" y2="16"></line><line x1="12" y1="11" x2="14" y2="16"></line><line x1="19" y1="11" x2="17" y2="16"></line><line x1="19" y1="11" x2="21" y2="16"></line><circle cx="5" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="12" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="19" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="3" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="7" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="10" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="14" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="17" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="21" cy="18" r="1.4" fill="currentColor" stroke="none"></circle>',20))],64)):e.name==="zoom-in"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:10},[i[12]||(i[12]=t.createElementVNode("circle",{cx:"11",cy:"11",r:"7"},null,-1)),i[13]||(i[13]=t.createElementVNode("line",{x1:"11",y1:"8",x2:"11",y2:"14"},null,-1)),i[14]||(i[14]=t.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"},null,-1)),i[15]||(i[15]=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:11},[i[16]||(i[16]=t.createElementVNode("circle",{cx:"11",cy:"11",r:"7"},null,-1)),i[17]||(i[17]=t.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"},null,-1)),i[18]||(i[18]=t.createElementVNode("line",{x1:"16",y1:"16",x2:"21",y2:"21"},null,-1))],64)):e.name==="reset"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:12},[i[19]||(i[19]=t.createElementVNode("polyline",{points:"4 9 4 4 9 4"},null,-1)),i[20]||(i[20]=t.createElementVNode("polyline",{points:"15 4 20 4 20 9"},null,-1)),i[21]||(i[21]=t.createElementVNode("polyline",{points:"20 15 20 20 15 20"},null,-1)),i[22]||(i[22]=t.createElementVNode("polyline",{points:"9 20 4 20 4 15"},null,-1))],64)):e.name==="logo"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:13},[i[23]||(i[23]=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:14},[i[24]||(i[24]=t.createElementVNode("path",{d:"M12 4 V15"},null,-1)),i[25]||(i[25]=t.createElementVNode("polyline",{points:"7 10 12 15 17 10"},null,-1)),i[26]||(i[26]=t.createElementVNode("path",{d:"M4 19 H20"},null,-1))],64)):e.name==="export"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:15},[i[27]||(i[27]=t.createElementVNode("path",{d:"M12 15 V4"},null,-1)),i[28]||(i[28]=t.createElementVNode("polyline",{points:"7 9 12 4 17 9"},null,-1)),i[29]||(i[29]=t.createElementVNode("path",{d:"M4 19 H20"},null,-1))],64)):e.name==="balance"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:16},[i[30]||(i[30]=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:17},[i[31]||(i[31]=t.createStaticVNode('<circle cx="12" cy="12" r="2.4" fill="currentColor" stroke="none"></circle><line x1="13.4" y1="10.6" x2="18.5" y2="5.5"></line><line x1="13.4" y1="13.4" x2="18.5" y2="18.5"></line><line x1="10.6" y1="10.6" x2="5.5" y2="5.5"></line><line x1="10.6" y1="13.4" x2="5.5" y2="18.5"></line><circle cx="19.5" cy="4.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="19.5" cy="19.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="4.5" cy="4.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="4.5" cy="19.5" r="1.8" fill="currentColor" stroke="none"></circle>',9))],64)):e.name==="tree"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:18},[i[32]||(i[32]=t.createStaticVNode('<circle cx="5" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="5" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="19" r="2" fill="currentColor" stroke="none"></circle><line x1="7" y1="12" x2="12" y2="12"></line><line x1="12" y1="12" x2="12" y2="5"></line><line x1="12" y1="12" x2="12" y2="19"></line><line x1="12" y1="5" x2="17" y2="5"></line><line x1="12" y1="19" x2="17" y2="19"></line>',9))],64)):e.name==="org"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:19},[i[33]||(i[33]=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:20},[i[34]||(i[34]=t.createElementVNode("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"},null,-1)),i[35]||(i[35]=t.createElementVNode("circle",{cx:"9",cy:"11",r:"1.6"},null,-1)),i[36]||(i[36]=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:21},[i[37]||(i[37]=t.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)),i[38]||(i[38]=t.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"},null,-1))],64)):e.name==="link"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:22},[i[39]||(i[39]=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[40]||(i[40]=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:23},[i[41]||(i[41]=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[42]||(i[42]=t.createElementVNode("line",{x1:"8",y1:"10",x2:"16",y2:"10"},null,-1)),i[43]||(i[43]=t.createElementVNode("line",{x1:"8",y1:"13",x2:"16",y2:"13"},null,-1)),i[44]||(i[44]=t.createElementVNode("line",{x1:"8",y1:"16",x2:"13",y2:"16"},null,-1))],64)):t.createCommentVNode("",!0)],8,mi))}}),bi="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",Ei="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],yi=[700,600,500,400],xi=[52,40,32,28],ki=[120,80,60,44],Ni=[.8,.8,.8,.8],wi=Yt.length-1;function _i(e,r){return Math.round(vt(e,r)*Ni[ot(e)])}function ot(e){return Math.min(wi,Math.max(0,e))}function vt(e,r=14){return Math.round(Yt[ot(e)]*r/14*10)/10}function Si(e,r=14){return Math.round(xi[ot(e)]*r/14)}const rt=60,De=14,he=24;let Ct=null;function Mi(){if(Ct)return Ct;const e=typeof document<"u"?document.createElement("canvas").getContext("2d"):null;return e?(Ct=e,e):{font:"",measureText:()=>({width:0})}}const Xt=new Map;function vi(e,r,i){const a=`${i}|${r}|${e}`,l=Xt.get(a);if(l!==void 0)return l;const f=Mi();f.font=`${i} ${r}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;const s=f.measureText(e).width;return Xt.set(a,s),s}const Ci=24,Ti=400,Ai=8,qt=16,Ri=4,Oi=200;function Ii(e,r,i){return Math.min(i,Math.max(r,e))}function Bi(e,r,i,a,l){const f=ot(r),s=vt(r,i),d=Math.min(vi(e.text||"",s,yi[f]),Oi),u=_i(r,i),g=Math.ceil(d+u*2),b=!!(e.richContent&&(e.richContent.kind==="code"||e.richContent.kind==="table"))?Math.ceil(s*1.2)+6:Si(r,i);let k=0;if(e.link&&(k+=qt),e.note&&(k+=qt),k>0){const B=(e.link?1:0)+(e.note?1:0);k+=Ri*B}const h=g+k,m=(()=>{const B=Math.round(ki[f]*i/14);if(e.richContent&&(e.richContent.kind==="code"||e.richContent.kind==="table")){const j=l==null?void 0:l[e.id];return Math.max(B,j??240)}return B})(),D=!!(e.richContent&&(e.richContent.kind==="code"||e.richContent.kind==="table")),G=a==null?void 0:a[e.id],S=D?Math.max(24,G??Math.max(70,Math.ceil(s*5))):0,H=S>0?10:0;if(!e.image){const B=Math.max(m,h),j=Math.ceil(b+H+S);return{w:B,h:j}}const I=Ii(e.image.width,Ci,Ti),P=Math.max(m,h,Math.ceil(I+u*2)),z=Math.ceil(e.image.height+Ai+b+H+S);return{w:P,h:z}}function Li(e,r={}){const i=r.mode??"mindmap",a=r.preservePositions===!0,l=r.baseFontSize??14,f=Jt(e,0,null,1,"right",l,r.richHeights,r.richWidths);return zi(f),Di(f,i,a),f.x=0,f.y=0,$i(f,a)}function Di(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((b,k)=>b+k._subtreeH,0);let u=1,g=Math.abs(a[0]._subtreeH-(d-a[0]._subtreeH)),x=0;for(let b=0;b<a.length-1;b++){x+=a[b]._subtreeH;const k=Math.abs(x-(d-x));k<g&&(g=k,u=b+1)}for(let b=0;b<u;b++)a[b]._dir="right",a[b].side=1,a[b]._dirRight=1;for(let b=u;b<a.length;b++)a[b]._dir="left",a[b].side=-1,a[b]._dirRight=-1}const l=e.children.filter(d=>d.side===1),f=e.children.filter(d=>d.side===-1),s=(d,u)=>{const g=u==="right"?1:-1;d._dir=u,d.side=g,d._dirRight=g;for(const x of d.children)s(x,u)};for(const d of l)s(d,"right");for(const d of f)s(d,"left");if(l.length>0){const d={...e,children:l};at(d,"right",rt,!0,i)}if(f.length>0){const d={...e,children:f};at(d,"left",rt,!0,i)}}else if(r==="tree"){const a=l=>{l.side=1,l._dir="right";for(const f of l.children)a(f)};for(const l of e.children)l._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,l=!1){if(e.children.length===0)return;const f=e.children.reduce((g,x,b)=>g+x._subtreeH+(b>0?De:0),0),s=r==="right"?1:-1,d=a?s:1;let u=e.y-d*f/2;e.children.forEach(g=>{l||(g.x=e.x+s*(e.width/2+i+g.width/2),g.y=u+d*g._subtreeH/2),g._dir=r,u+=d*(g._subtreeH+De),at(g,r,i,!1,l)})}function jt(e,r,i=!1){if(e.children.length===0)return;const a=e.children.reduce((f,s,d)=>f+s._subtreeW+(d>0?De*2:0),0);let l=e.x-a/2;e.children.forEach(f=>{i||(f.x=l+f._subtreeW/2,f.y=e.y+e.height/2+r+f.height/2),f._dir="down",l+=f._subtreeW+De*2,jt(f,r,i)})}function Jt(e,r,i,a,l,f,s,d){const u=Bi(e,r,f,s,d),g={id:e.id,text:e.text,depth:r,x:e._x??0,y:e._y??0,width:u.w,height:u.h,fontSize:vt(r,f),isRoot:r===0,collapsed:e.collapsed,side:a,_dir:l,_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 g;const x=e.children.length,b=Math.ceil(x/2);return g.children=e.children.map((k,h)=>{const m=r===0?h<b?1:-1:a;return Jt(k,r+1,g,m,l,f,s,d)}),g}function zi(e){const r=[e];for(let i=0;i<r.length;i++){const a=r[i];for(const l of a.children)r.push(l)}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 l=0,f=0;for(const s of a.children)l+=s._subtreeH,f+=s._subtreeW;a.children.length>1&&(l+=De*(a.children.length-1),f+=De*2*(a.children.length-1)),a._subtreeH=Math.max(a.height,l),a._subtreeW=Math.max(a.width,f)}}function $i(e,r=!1){const i=[e];let a=1/0,l=-1/0,f=1/0,s=-1/0;for(;i.length;){const g=i.pop(),x=g.width/2,b=g.height/2;g.x-x<a&&(a=g.x-x),g.x+x>l&&(l=g.x+x),g.y-b<f&&(f=g.y-b),g.y+b>s&&(s=g.y+b),i.push(...g.children)}if(r)return{root:e,width:l-a+he*2,height:s-f+he*2,vbX:a-he,vbY:f-he,vbW:l-a+he*2,vbH:s-f+he*2};const d=he-f,u=[e];for(;u.length;){const g=u.pop();g.y+=d,u.push(...g.children)}return f+=d,s+=d,{root:e,width:l-a+he*2,height:s+he,vbX:a-he,vbY:0,vbW:l-a+he*2,vbH:s+he}}const Ge=[{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 Pi(e,r=[]){return[...Ge,...r].find(a=>a.id===e)??Ge[0]}function ke(){return"n_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function _e(e){return JSON.parse(JSON.stringify(e))}function V(e,r){if(e.id===r)return e;for(const i of e.children){const a=V(i,r);if(a)return a}return null}function xe(e,r,i=null){if(e.id===r)return i;for(const a of e.children){const l=xe(a,r,e);if(l!==null)return l}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 Ui(e,r,i){const a=V(e,r);return!a||a.text===i?!1:(a.text=i,!0)}function Vi(e,r,i,a){if(!xe(e,r)||r===i||V(V(e,r),i))return!1;const l=xe(e,r),f=l.children.findIndex(g=>g.id===r);if(f<0)return!1;const[s]=l.children.splice(f,1);if(a==="child"){const g=V(e,i);return g?(g.children.push(s),!0):(l.children.splice(f,0,s),!1)}const d=xe(e,i);if(!d)return l.children.splice(f,0,s),!1;let u=d.children.findIndex(g=>g.id===i);return u<0?(l.children.splice(f,0,s),!1):(a==="after"&&(u+=1),d.children.splice(u,0,s),!0)}function Qt(e){const r=/^新节点(?:\s+(\d+))?$/;let i=0,a=!1;for(const l of e.children){const f=l.text.match(r);if(f)if(f[1]){const s=parseInt(f[1],10);s>i&&(i=s)}else a=!0}return i===0&&!a?lt:i>0?`新节点 ${i+1}`:"新节点 2"}function en(e,r,i){const a=V(e,r);if(!a)return null;const l={id:ke(),text:i??Qt(a),children:[]};return a.children.push(l),l}function tn(e,r,i){const a=xe(e,r);if(!a)return null;const l=a.children.findIndex(s=>s.id===r);if(l<0)return null;const f={id:ke(),text:i??Qt(a),children:[]};return a.children.splice(l+1,0,f),f}function Hi(e,r,i){const a=xe(e,r);if(!a)return null;const l=a.children.findIndex(s=>s.id===r);if(l<0)return null;const f={id:ke(),text:i,children:[]};return a.children.splice(l,0,f),f}function Fi(e,r){const i=xe(e,r);if(!i)return null;const a=i.children.findIndex(s=>s.id===r);if(a<0)return null;const l=i.children[a],f=_e(l);return nn(f),i.children.splice(a+1,0,f),f}function nn(e){e.id=ke();for(const r of e.children)nn(r)}const lt="新节点";function At(e,r="导入的导图"){const i=e.split(/\r?\n/),a={id:ke(),text:r,children:[]},l=[a],f=[-1/0],s=[],d=/^(#{1,6})\s+(.+?)\s*#*\s*$/,u=/^!\[([^\]]*)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,g=/^\[([^\]]+)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,x=/^(`{3,}|~{3,})\s*(\S+)?\s*$/;let b=!1,k=[],h=null;function m(S){k.push(S)}function D(){if(h&&k.length>0){for(;k.length>0&&k[0].trim()==="";)k.shift();for(;k.length>0&&k[k.length-1].trim()==="";)k.pop();const S=k.join(`
|
|
2
|
-
`);
|
|
3
|
-
`+
|
|
1
|
+
(function(ce,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(ce=typeof globalThis<"u"?globalThis:ce||self,t(ce.FlowMind={},ce.Vue))})(this,function(ce,t){"use strict";const yi=["width","height","stroke-width"],Ei={key:4,points:"6 9 12 15 18 9"},xi={key:5,points:"9 6 15 12 9 18"},ne=t.defineComponent({__name:"Icon",props:{name:{},size:{},stroke:{}},setup(e){return(a,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",Ei)):e.name==="expand"?(t.openBlock(),t.createElementBlock("polyline",xi)):e.name==="collapse-all"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[i[8]||(i[8]=t.createStaticVNode('<line x1="4" y1="4" x2="10" y2="10"></line><polyline points="6 10 10 10 10 6"></polyline><line x1="20" y1="4" x2="14" y2="10"></line><polyline points="14 6 14 10 18 10"></polyline><line x1="20" y1="20" x2="14" y2="14"></line><polyline points="14 18 14 14 18 14"></polyline><line x1="4" y1="20" x2="10" y2="14"></line><polyline points="6 14 10 14 10 18"></polyline>',8))],64)):e.name==="expand-all"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:7},[i[9]||(i[9]=t.createStaticVNode('<line x1="10" y1="10" x2="4" y2="4"></line><polyline points="4 6 4 4 6 4"></polyline><line x1="14" y1="10" x2="20" y2="4"></line><polyline points="20 6 20 4 18 4"></polyline><line x1="14" y1="14" x2="20" y2="20"></line><polyline points="20 18 20 20 18 20"></polyline><line x1="10" y1="14" x2="4" y2="20"></line><polyline points="4 18 4 20 6 20"></polyline>',8))],64)):e.name==="expand-level-1"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:8},[i[10]||(i[10]=t.createStaticVNode('<circle cx="12" cy="5" r="1.8" fill="currentColor" stroke="none"></circle><line x1="12" y1="7" x2="12" y2="11"></line><line x1="12" y1="11" x2="5" y2="17"></line><line x1="12" y1="11" x2="12" y2="17"></line><line x1="12" y1="11" x2="19" y2="17"></line><circle cx="5" cy="19" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="12" cy="19" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="19" cy="19" r="1.8" fill="currentColor" stroke="none"></circle>',8))],64)):e.name==="expand-level-2"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:9},[i[11]||(i[11]=t.createStaticVNode('<circle cx="12" cy="3" r="1.4" fill="currentColor" stroke="none"></circle><line x1="12" y1="4.5" x2="12" y2="7"></line><line x1="12" y1="7" x2="5" y2="11"></line><line x1="12" y1="7" x2="12" y2="11"></line><line x1="12" y1="7" x2="19" y2="11"></line><line x1="5" y1="11" x2="3" y2="16"></line><line x1="5" y1="11" x2="7" y2="16"></line><line x1="12" y1="11" x2="10" y2="16"></line><line x1="12" y1="11" x2="14" y2="16"></line><line x1="19" y1="11" x2="17" y2="16"></line><line x1="19" y1="11" x2="21" y2="16"></line><circle cx="5" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="12" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="19" cy="11" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="3" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="7" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="10" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="14" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="17" cy="18" r="1.4" fill="currentColor" stroke="none"></circle><circle cx="21" cy="18" r="1.4" fill="currentColor" stroke="none"></circle>',20))],64)):e.name==="zoom-in"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:10},[i[12]||(i[12]=t.createElementVNode("circle",{cx:"11",cy:"11",r:"7"},null,-1)),i[13]||(i[13]=t.createElementVNode("line",{x1:"11",y1:"8",x2:"11",y2:"14"},null,-1)),i[14]||(i[14]=t.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"},null,-1)),i[15]||(i[15]=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:11},[i[16]||(i[16]=t.createElementVNode("circle",{cx:"11",cy:"11",r:"7"},null,-1)),i[17]||(i[17]=t.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"},null,-1)),i[18]||(i[18]=t.createElementVNode("line",{x1:"16",y1:"16",x2:"21",y2:"21"},null,-1))],64)):e.name==="reset"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:12},[i[19]||(i[19]=t.createElementVNode("polyline",{points:"4 9 4 4 9 4"},null,-1)),i[20]||(i[20]=t.createElementVNode("polyline",{points:"15 4 20 4 20 9"},null,-1)),i[21]||(i[21]=t.createElementVNode("polyline",{points:"20 15 20 20 15 20"},null,-1)),i[22]||(i[22]=t.createElementVNode("polyline",{points:"9 20 4 20 4 15"},null,-1))],64)):e.name==="settings"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:13},[i[23]||(i[23]=t.createStaticVNode('<circle cx="12" cy="12" r="3"></circle><line x1="12" y1="2.5" x2="12" y2="4.5"></line><line x1="12" y1="19.5" x2="12" y2="21.5"></line><line x1="2.5" y1="12" x2="4.5" y2="12"></line><line x1="19.5" y1="12" x2="21.5" y2="12"></line><line x1="5.6" y1="5.6" x2="7" y2="7"></line><line x1="17" y1="17" x2="18.4" y2="18.4"></line><line x1="5.6" y1="18.4" x2="7" y2="17"></line><line x1="17" y1="7" x2="18.4" y2="5.6"></line>',9))],64)):e.name==="logo"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:14},[i[24]||(i[24]=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:15},[i[25]||(i[25]=t.createElementVNode("path",{d:"M12 4 V15"},null,-1)),i[26]||(i[26]=t.createElementVNode("polyline",{points:"7 10 12 15 17 10"},null,-1)),i[27]||(i[27]=t.createElementVNode("path",{d:"M4 19 H20"},null,-1))],64)):e.name==="export"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:16},[i[28]||(i[28]=t.createElementVNode("path",{d:"M12 15 V4"},null,-1)),i[29]||(i[29]=t.createElementVNode("polyline",{points:"7 9 12 4 17 9"},null,-1)),i[30]||(i[30]=t.createElementVNode("path",{d:"M4 19 H20"},null,-1))],64)):e.name==="balance"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:17},[i[31]||(i[31]=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:18},[i[32]||(i[32]=t.createStaticVNode('<circle cx="12" cy="12" r="2.4" fill="currentColor" stroke="none"></circle><line x1="13.4" y1="10.6" x2="18.5" y2="5.5"></line><line x1="13.4" y1="13.4" x2="18.5" y2="18.5"></line><line x1="10.6" y1="10.6" x2="5.5" y2="5.5"></line><line x1="10.6" y1="13.4" x2="5.5" y2="18.5"></line><circle cx="19.5" cy="4.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="19.5" cy="19.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="4.5" cy="4.5" r="1.8" fill="currentColor" stroke="none"></circle><circle cx="4.5" cy="19.5" r="1.8" fill="currentColor" stroke="none"></circle>',9))],64)):e.name==="tree"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:19},[i[33]||(i[33]=t.createStaticVNode('<circle cx="5" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="5" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="19" cy="19" r="2" fill="currentColor" stroke="none"></circle><line x1="7" y1="12" x2="12" y2="12"></line><line x1="12" y1="12" x2="12" y2="5"></line><line x1="12" y1="12" x2="12" y2="19"></line><line x1="12" y1="5" x2="17" y2="5"></line><line x1="12" y1="19" x2="17" y2="19"></line>',9))],64)):e.name==="org"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:20},[i[34]||(i[34]=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:21},[i[35]||(i[35]=t.createElementVNode("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"},null,-1)),i[36]||(i[36]=t.createElementVNode("circle",{cx:"9",cy:"11",r:"1.6"},null,-1)),i[37]||(i[37]=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:22},[i[38]||(i[38]=t.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)),i[39]||(i[39]=t.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"},null,-1))],64)):e.name==="link"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:23},[i[40]||(i[40]=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[41]||(i[41]=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:24},[i[42]||(i[42]=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[43]||(i[43]=t.createElementVNode("line",{x1:"8",y1:"10",x2:"16",y2:"10"},null,-1)),i[44]||(i[44]=t.createElementVNode("line",{x1:"8",y1:"13",x2:"16",y2:"13"},null,-1)),i[45]||(i[45]=t.createElementVNode("line",{x1:"8",y1:"16",x2:"13",y2:"16"},null,-1))],64)):t.createCommentVNode("",!0)],8,yi))}}),ki="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",wi="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",qt=[18,15,13,12],Ni=[700,600,500,400],_i=[52,40,32,28],Si=[120,80,60,44],Mi=[.8,.8,.8,.8],vi=qt.length-1;function Ci(e,a){return Math.round(Ct(e,a)*Mi[at(e)])}function at(e){return Math.min(vi,Math.max(0,e))}function Ct(e,a=14){return Math.round(qt[at(e)]*a/14*10)/10}function Ti(e,a=14){return Math.round(_i[at(e)]*a/14)}const lt=60,Ve=14,be=24;let Tt=null;function Ai(){if(Tt)return Tt;const e=typeof document<"u"?document.createElement("canvas").getContext("2d"):null;return e?(Tt=e,e):{font:"",measureText:()=>({width:0})}}const jt=new Map;function Ri(e,a,i){const r=`${i}|${a}|${e}`,l=jt.get(r);if(l!==void 0)return l;const f=Ai();f.font=`${i} ${a}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;const s=f.measureText(e).width;return jt.set(r,s),s}const Oi=24,Ii=400,Bi=8,Jt=16,Li=4,Di=200;function zi(e,a,i){return Math.min(i,Math.max(a,e))}function $i(e,a,i,r,l){const f=at(a),s=Ct(a,i),c=Math.min(Ri(e.text||"",s,Ni[f]),Di),u=Ci(a,i),g=Math.ceil(c+u*2),b=!!(e.richContent&&(e.richContent.kind==="code"||e.richContent.kind==="table"))?Math.ceil(s*1.2)+6:Ti(a,i);let k=0;if(e.link&&(k+=Jt),e.note&&(k+=Jt),k>0){const I=(e.link?1:0)+(e.note?1:0);k+=Li*I}const h=g+k,m=(()=>{const I=Math.round(Si[f]*i/14);if(e.richContent&&(e.richContent.kind==="code"||e.richContent.kind==="table")){const j=l==null?void 0:l[e.id];return Math.max(I,j??240)}return I})(),L=!!(e.richContent&&(e.richContent.kind==="code"||e.richContent.kind==="table")),K=r==null?void 0:r[e.id],_=L?Math.max(24,K??Math.max(70,Math.ceil(s*5))):0,F=_>0?10:0;if(!e.image){const I=Math.max(m,h),j=Math.ceil(b+F+_);return{w:I,h:j}}const O=zi(e.image.width,Oi,Ii),$=Math.max(m,h,Math.ceil(O+u*2)),D=Math.ceil(e.image.height+Bi+b+F+_);return{w:$,h:D}}function Pi(e,a={}){const i=a.mode??"mindmap",r=a.preservePositions===!0,l=a.baseFontSize??14,f=en(e,0,null,1,"right",l,a.richHeights,a.richWidths);return Vi(f),Ui(f,i,r),f.x=0,f.y=0,Hi(f,r)}function Ui(e,a,i=!1){if(a==="mindmap"){const r=e.children;if(r.length!==0)if(r.length===1)r[0]._dir="right",r[0].side=1,r[0]._dirRight=1;else{const c=r.reduce((b,k)=>b+k._subtreeH,0);let u=1,g=Math.abs(r[0]._subtreeH-(c-r[0]._subtreeH)),y=0;for(let b=0;b<r.length-1;b++){y+=r[b]._subtreeH;const k=Math.abs(y-(c-y));k<g&&(g=k,u=b+1)}for(let b=0;b<u;b++)r[b]._dir="right",r[b].side=1,r[b]._dirRight=1;for(let b=u;b<r.length;b++)r[b]._dir="left",r[b].side=-1,r[b]._dirRight=-1}const l=e.children.filter(c=>c.side===1),f=e.children.filter(c=>c.side===-1),s=(c,u)=>{const g=u==="right"?1:-1;c._dir=u,c.side=g,c._dirRight=g;for(const y of c.children)s(y,u)};for(const c of l)s(c,"right");for(const c of f)s(c,"left");if(l.length>0){const c={...e,children:l};st(c,"right",lt,!0,i)}if(f.length>0){const c={...e,children:f};st(c,"left",lt,!0,i)}}else if(a==="tree"){const r=l=>{l.side=1,l._dir="right";for(const f of l.children)r(f)};for(const l of e.children)l._dir="right";st(e,"right",lt,!0,i),r(e)}else{for(const r of e.children)r._dir="down";Qt(e,lt,i)}}function st(e,a,i,r,l=!1){if(e.children.length===0)return;const f=e.children.reduce((g,y,b)=>g+y._subtreeH+(b>0?Ve:0),0),s=a==="right"?1:-1,c=r?s:1;let u=e.y-c*f/2;e.children.forEach(g=>{l||(g.x=e.x+s*(e.width/2+i+g.width/2),g.y=u+c*g._subtreeH/2),g._dir=a,u+=c*(g._subtreeH+Ve),st(g,a,i,!1,l)})}function Qt(e,a,i=!1){if(e.children.length===0)return;const r=e.children.reduce((f,s,c)=>f+s._subtreeW+(c>0?Ve*2:0),0);let l=e.x-r/2;e.children.forEach(f=>{i||(f.x=l+f._subtreeW/2,f.y=e.y+e.height/2+a+f.height/2),f._dir="down",l+=f._subtreeW+Ve*2,Qt(f,a,i)})}function en(e,a,i,r,l,f,s,c){const u=$i(e,a,f,s,c),g={id:e.id,text:e.text,depth:a,x:e._x??0,y:e._y??0,width:u.w,height:u.h,fontSize:Ct(a,f),isRoot:a===0,collapsed:e.collapsed,side:r,_dir:l,_dirRight:r,_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 g;const y=e.children.length,b=Math.ceil(y/2);return g.children=e.children.map((k,h)=>{const m=a===0?h<b?1:-1:r;return en(k,a+1,g,m,l,f,s,c)}),g}function Vi(e){const a=[e];for(let i=0;i<a.length;i++){const r=a[i];for(const l of r.children)a.push(l)}for(let i=a.length-1;i>=0;i--){const r=a[i];if(r.collapsed||r.children.length===0){r._subtreeH=r.height,r._subtreeW=r.width;continue}let l=0,f=0;for(const s of r.children)l+=s._subtreeH,f+=s._subtreeW;r.children.length>1&&(l+=Ve*(r.children.length-1),f+=Ve*2*(r.children.length-1)),r._subtreeH=Math.max(r.height,l),r._subtreeW=Math.max(r.width,f)}}function Hi(e,a=!1){const i=[e];let r=1/0,l=-1/0,f=1/0,s=-1/0;for(;i.length;){const g=i.pop(),y=g.width/2,b=g.height/2;g.x-y<r&&(r=g.x-y),g.x+y>l&&(l=g.x+y),g.y-b<f&&(f=g.y-b),g.y+b>s&&(s=g.y+b),i.push(...g.children)}if(a)return{root:e,width:l-r+be*2,height:s-f+be*2,vbX:r-be,vbY:f-be,vbW:l-r+be*2,vbH:s-f+be*2};const c=be-f,u=[e];for(;u.length;){const g=u.pop();g.y+=c,u.push(...g.children)}return f+=c,s+=c,{root:e,width:l-r+be*2,height:s+be,vbX:r-be,vbY:0,vbW:l-r+be*2,vbH:s+be}}const Xe=[{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 Fi(e,a=[]){return[...Xe,...a].find(r=>r.id===e)??Xe[0]}function _e(){return"n_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function Ce(e){return JSON.parse(JSON.stringify(e))}function H(e,a){if(e.id===a)return e;for(const i of e.children){const r=H(i,a);if(r)return r}return null}function we(e,a,i=null){if(e.id===a)return i;for(const r of e.children){const l=we(r,a,e);if(l!==null)return l}return null}function At(e,a){const i=e.children.findIndex(r=>r.id===a);if(i>=0)return e.children.splice(i,1),!0;for(const r of e.children)if(At(r,a))return!0;return!1}function Wi(e,a,i){const r=H(e,a);return!r||r.text===i?!1:(r.text=i,!0)}function Gi(e,a,i,r){if(!we(e,a)||a===i||H(H(e,a),i))return!1;const l=we(e,a),f=l.children.findIndex(g=>g.id===a);if(f<0)return!1;const[s]=l.children.splice(f,1);if(r==="child"){const g=H(e,i);return g?(g.children.push(s),!0):(l.children.splice(f,0,s),!1)}const c=we(e,i);if(!c)return l.children.splice(f,0,s),!1;let u=c.children.findIndex(g=>g.id===i);return u<0?(l.children.splice(f,0,s),!1):(r==="after"&&(u+=1),c.children.splice(u,0,s),!0)}function tn(e){const a=/^新节点(?:\s+(\d+))?$/;let i=0,r=!1;for(const l of e.children){const f=l.text.match(a);if(f)if(f[1]){const s=parseInt(f[1],10);s>i&&(i=s)}else r=!0}return i===0&&!r?ct:i>0?`新节点 ${i+1}`:"新节点 2"}function nn(e,a,i){const r=H(e,a);if(!r)return null;const l={id:_e(),text:i??tn(r),children:[]};return r.children.push(l),l}function on(e,a,i){const r=we(e,a);if(!r)return null;const l=r.children.findIndex(s=>s.id===a);if(l<0)return null;const f={id:_e(),text:i??tn(r),children:[]};return r.children.splice(l+1,0,f),f}function Ki(e,a,i){const r=we(e,a);if(!r)return null;const l=r.children.findIndex(s=>s.id===a);if(l<0)return null;const f={id:_e(),text:i,children:[]};return r.children.splice(l,0,f),f}function Yi(e,a){const i=we(e,a);if(!i)return null;const r=i.children.findIndex(s=>s.id===a);if(r<0)return null;const l=i.children[r],f=Ce(l);return rn(f),i.children.splice(r+1,0,f),f}function rn(e){e.id=_e();for(const a of e.children)rn(a)}const ct="新节点";function Rt(e,a="导入的导图"){const i=e.split(/\r?\n/),r={id:_e(),text:a,children:[]},l=[r],f=[-1/0],s=[],c=/^(#{1,6})\s+(.+?)\s*#*\s*$/,u=/^!\[([^\]]*)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,g=/^\[([^\]]+)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/,y=/^(`{3,}|~{3,})\s*(\S+)?\s*$/;let b=!1,k=[],h=null;function m(_){k.push(_)}function L(){if(h&&k.length>0){for(;k.length>0&&k[0].trim()==="";)k.shift();for(;k.length>0&&k[k.length-1].trim()==="";)k.pop();const _=k.join(`
|
|
2
|
+
`);_&&(h.note={text:_})}b=!1,k=[]}for(const _ of i){if(b){const I=_.match(y);if(I&&I[1][0]==="`"){L();continue}m(_);continue}const F=_.match(c);if(F){const I=F[1].length,j=F[2].trim();s.push({level:I,text:j,body:""}),h=s[s.length-1];continue}const O=_.match(y);if(O&&O[2]==="note"){b=!0,k=[];continue}const $=_.match(u);if($&&h){const I=$[2],j=160,te=120;h.image={src:I,naturalW:j,naturalH:te,width:j,height:te};continue}const D=_.match(g);if(D&&h){h.link={url:D[2]},h.text=D[1];continue}if(_.trim().length>0&&h){const I=_.trim();h.body=h.body?h.body+`
|
|
3
|
+
`+I:I}}b&&L();function K(_){for(;l.length>1;){const D=l.length-1,I=f[D];if(I!==void 0&&I<_.level)break;l.pop(),f.pop()}const F=l[l.length-1],O=_.text,$={id:_e(),text:O,children:[]};_.image&&($.image={..._.image}),_.link&&($.link={url:_.link.url}),_.note&&($.note={text:_.note.text}),_.body&&($.note={text:_.body}),F.children.push($),l.push($),f.push(_.level)}for(const _ of s)K(_);if(s.length>0&&s[0].level===1){const _=r.children[0];_&&(r.text=_.text,r.id=_.id,_.image&&(r.image={..._.image}),_.link&&(r.link={url:_.link.url}),_.note&&(r.note={text:_.note.text}),r.children=_.children)}return r}function dt(e,a=1){let i="#".repeat(a)+" "+(e.text||"")+`
|
|
4
4
|
`;e.link&&(i+=`[${e.text||"link"}](${e.link.url})
|
|
5
5
|
`),e.image&&(i+=`
|
|
6
6
|
`),e.note&&(i+="```note\n"+e.note.text+"\n```\n"),e.richContent&&(i+=e.richContent.raw+`
|
|
7
|
-
`);for(const
|
|
8
|
-
`).trim();i.push({kind:"code",text:((g=
|
|
9
|
-
`)[0])==null?void 0:g.slice(0,80))||"(空代码块)",raw:
|
|
10
|
-
`),lang
|
|
11
|
-
`)}),
|
|
12
|
-
`)}),
|
|
13
|
-
`:""}function Zi(e){const r=e.minScale??.2,i=e.maxScale??1/0,a=e.step??1.2,l=t.ref(1),f=t.ref(0),s=t.ref(0),d=t.ref(!1),u=t.reactive({x:0,y:0,ox:0,oy:0}),g=t.ref(!1),x=t.reactive({x:0,y:0}),b=t.reactive({x:0,y:0,width:0,height:0}),k=t.ref(0);let h=null;function m(F){h=F}function D(F){F.preventDefault();const J=e.getContainer();if(!J)return;const re=-F.deltaY*.001,ce=Math.min(i,Math.max(r,l.value*(1+re))),ie=J.getBoundingClientRect(),de=F.clientX-ie.left,y=F.clientY-ie.top,T=(de-f.value)/l.value,M=(y-s.value)/l.value;l.value=ce,f.value=de-T*ce,s.value=y-M*ce}function G(){l.value=Math.min(i,l.value*a)}function S(){l.value=Math.max(r,l.value/a)}function H(F){var re;F.target.closest(".zm-node, .zm-toolbar, button, input, textarea")||(d.value=!0,u.x=F.clientX,u.y=F.clientY,u.ox=f.value,u.oy=s.value,window.addEventListener("mousemove",I),window.addEventListener("mouseup",P),(re=F.preventDefault)==null||re.call(F))}function I(F){d.value&&(f.value=u.ox+(F.clientX-u.x),s.value=u.oy+(F.clientY-u.y))}function P(){d.value=!1,window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",P)}function z(F,J){g.value=!0,x.x=F,x.y=J,b.x=F,b.y=J,b.width=0,b.height=0,k.value++,window.addEventListener("mousemove",ee),window.addEventListener("mouseup",j)}function B(F,J){if(!g.value)return;const re=Math.min(x.x,F),ce=Math.min(x.y,J),ie=Math.max(x.x,F),de=Math.max(x.y,J);b.x=re,b.y=ce,b.width=ie-re,b.height=de-ce,k.value++}function j(){g.value=!1,window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",j),h&&h()}function ee(F){if(!g.value)return;const J=e.getContainer();if(!J)return;const re=J.getBoundingClientRect(),ce=(F.clientX-re.left-f.value)/l.value,ie=(F.clientY-re.top-s.value)/l.value;B(ce,ie)}function le(F,J,re,ce=60){const ie=e.getContainer();if(!ie)return;const de=ie.getBoundingClientRect(),y=(de.width-ce*2)/F,T=(de.height-ce*2)/J,M=Math.min(1,Math.max(.3,Math.min(y,T)));l.value=M,f.value=de.width/2,s.value=de.height/2-re*M}return{scale:l,offsetX:f,offsetY:s,isPanning:d,onWheel:D,zoomIn:G,zoomOut:S,startPan:H,startMarquee:z,updateMarquee:B,isMarquee:g,marquee:b,marqueeVersion:k,setOnMarqueeEnd:m,resetView:le}}const Yi=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function on(e){return Yi?e.metaKey:e.ctrlKey}function Xi(e){function r(){const a=e.getSelectedId();return a||(e.defaultTargetId?e.defaultTargetId():e.getRootId())}function i(a){const l=a.target;if(l&&(l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.isContentEditable)||e.isReadonly()||e.isEditing())return;const f=e.getSelectedId(),s=r();if(s){if(on(a)&&!a.shiftKey){if(a.key==="d"||a.key==="D"){f&&f!==e.getRootId()&&(a.preventDefault(),e.onDuplicate(f));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(s)):a.key==="Enter"?(a.preventDefault(),a.shiftKey?f&&f!==e.getRootId()&&e.onAddSiblingBefore(f):e.onAddSibling(s)):(a.key==="Delete"||a.key==="Backspace")&&f&&f!==e.getRootId()?(a.preventDefault(),e.onRemove(f)):a.key==="F2"&&f?(a.preventDefault(),e.onStartEdit(f)):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 qi(e=100){const r=t.ref([]);let i=-1;function a(){return i>0}function l(){return i<r.value.length-1}function f(g){const x=JSON.stringify(g);for(i<r.value.length-1&&(r.value=r.value.slice(0,i+1)),r.value.push(x),i=r.value.length-1;r.value.length>e;)r.value.shift(),i--}function s(){return a()?(i--,JSON.parse(r.value[i])):null}function d(){return l()?(i++,JSON.parse(r.value[i])):null}function u(){r.value=[],i=-1}return{canUndo:a,canRedo:l,record:f,undo:s,redo:d,reset:u}}const ji=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}},emits:["pickImage","setLink","removeLink","editNote","removeNote","removeImage","addCode","editCode","removeCode","addTable","editTable","removeTable","close"],setup(e,{emit:r}){const i=e,a=r,l=t.computed(()=>{let k=i.x+2,h=i.y+2;if(i.container){const m=i.container.getBoundingClientRect(),D=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;k+D>m.right&&(k=Math.max(m.left+4,i.x-D-2)),h+S>m.bottom&&(h=Math.max(m.top+4,i.y-S-2)),k<m.left+2&&(k=m.left+2),h<m.top+2&&(h=m.top+2)}return{left:k,top:h}}),f=t.computed(()=>i.hasImage),s=t.computed(()=>i.hasLink),d=t.computed(()=>i.hasNote);function u(k){const h=k.target;h&&h.closest(".zm-node-menu")||a("close")}function g(k){k.key==="Escape"&&a("close")}function x(){a("close")}window.addEventListener("mousedown",u,!0),window.addEventListener("keydown",g,!0),window.addEventListener("wheel",x,!0),window.addEventListener("scroll",x,!0),t.onBeforeUnmount(()=>{window.removeEventListener("mousedown",u,!0),window.removeEventListener("keydown",g,!0),window.removeEventListener("wheel",x,!0),window.removeEventListener("scroll",x,!0)});function b(k){k(),a("close")}return(k,h)=>(t.openBlock(),t.createElementBlock("div",{class:"zm-node-menu",style:t.normalizeStyle({left:l.value.left+"px",top:l.value.top+"px"}),onContextmenu:h[10]||(h[10]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("button",{class:"zm-node-menu-item",onClick:h[0]||(h[0]=t.withModifiers(m=>b(()=>a("pickImage")),["stop"]))},[t.createVNode(te,{name:"image",size:13}),t.createElementVNode("span",null,t.toDisplayString(f.value?"替换图片":"添加图片"),1)]),f.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"zm-node-menu-item",onClick:h[1]||(h[1]=t.withModifiers(m=>b(()=>a("removeImage")),["stop"]))},[t.createVNode(te,{name:"x",size:13}),h[11]||(h[11]=t.createElementVNode("span",null,"移除图片",-1))])):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",onClick:h[2]||(h[2]=t.withModifiers(m=>b(()=>a("setLink")),["stop"]))},[t.createVNode(te,{name:"link",size:13}),t.createElementVNode("span",null,t.toDisplayString(s.value?"编辑链接":"添加链接"),1)]),s.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"zm-node-menu-item",onClick:h[3]||(h[3]=t.withModifiers(m=>b(()=>a("removeLink")),["stop"]))},[t.createVNode(te,{name:"x",size:13}),h[12]||(h[12]=t.createElementVNode("span",null,"移除链接",-1))])):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",onClick:h[4]||(h[4]=t.withModifiers(m=>b(()=>a("addCode")),["stop"]))},[h[13]||(h[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)]),e.hasCode?(t.openBlock(),t.createElementBlock("button",{key:2,class:"zm-node-menu-item",onClick:h[5]||(h[5]=t.withModifiers(m=>b(()=>a("removeCode")),["stop"]))},[t.createVNode(te,{name:"x",size:13}),h[14]||(h[14]=t.createElementVNode("span",null,"移除代码块",-1))])):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",onClick:h[6]||(h[6]=t.withModifiers(m=>b(()=>a("addTable")),["stop"]))},[h[15]||(h[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)]),e.hasTable?(t.openBlock(),t.createElementBlock("button",{key:3,class:"zm-node-menu-item",onClick:h[7]||(h[7]=t.withModifiers(m=>b(()=>a("removeTable")),["stop"]))},[t.createVNode(te,{name:"x",size:13}),h[16]||(h[16]=t.createElementVNode("span",null,"移除表格",-1))])):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",onClick:h[8]||(h[8]=t.withModifiers(m=>b(()=>a("editNote")),["stop"]))},[t.createVNode(te,{name:"note",size:13}),t.createElementVNode("span",null,t.toDisplayString(d.value?"编辑笔记":"添加笔记"),1)]),d.value?(t.openBlock(),t.createElementBlock("button",{key:4,class:"zm-node-menu-item",onClick:h[9]||(h[9]=t.withModifiers(m=>b(()=>a("removeNote")),["stop"]))},[t.createVNode(te,{name:"x",size:13}),h[17]||(h[17]=t.createElementVNode("span",null,"移除笔记",-1))])):t.createCommentVNode("",!0)],36))}});function Ji(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 ln(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 l in a)i[l]=a[l]}),i}const Qi="</span>",sn=e=>!!e.scope,eo=(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,l)=>`${a}${"_".repeat(l+1)}`)].join(" ")}return`${r}${e}`};class to{constructor(r,i){this.buffer="",this.classPrefix=i.classPrefix,r.walk(this)}addText(r){this.buffer+=ln(r)}openNode(r){if(!sn(r))return;const i=eo(r.scope,{prefix:this.classPrefix});this.span(i)}closeNode(r){sn(r)&&(this.buffer+=Qi)}value(){return this.buffer}span(r){this.buffer+=`<span class="${r}">`}}const cn=(e={})=>{const r={children:[]};return Object.assign(r,e),r};class Rt{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=>{Rt._collapse(i)}))}}class no extends Rt{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 to(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Ke(e){return e?typeof e=="string"?e:e.source:null}function dn(e){return Ae("(?=",e,")")}function io(e){return Ae("(?:",e,")*")}function oo(e){return Ae("(?:",e,")?")}function Ae(...e){return e.map(i=>Ke(i)).join("")}function ro(e){const r=e[e.length-1];return typeof r=="object"&&r.constructor===Object?(e.splice(e.length-1,1),r):{}}function Ot(...e){return"("+(ro(e).capture?"":"?:")+e.map(a=>Ke(a)).join("|")+")"}function un(e){return new RegExp(e.toString()+"|").exec("").length-1}function ao(e,r){const i=e&&e.exec(r);return i&&i.index===0}const lo=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function It(e,{joinWith:r}){let i=0;return e.map(a=>{i+=1;const l=i;let f=Ke(a),s="";for(;f.length>0;){const d=lo.exec(f);if(!d){s+=f;break}s+=f.substring(0,d.index),f=f.substring(d.index+d[0].length),d[0][0]==="\\"&&d[1]?s+="\\"+String(Number(d[1])+l):(s+=d[0],d[0]==="("&&i++)}return s}).map(a=>`(${a})`).join(r)}const so=/\b\B/,fn="[a-zA-Z]\\w*",Bt="[a-zA-Z_]\\w*",gn="\\b\\d+(\\.\\d+)?",mn="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",pn="\\b(0b[01]+)",co="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",uo=(e={})=>{const r=/^#![ ]*\//;return e.binary&&(e.begin=Ae(r,/.*\b/,e.binary,/\b.*/)),Ce({scope:"meta",begin:r,end:/$/,relevance:0,"on:begin":(i,a)=>{i.index!==0&&a.ignoreMatch()}},e)},Ze={begin:"\\\\[\\s\\S]",relevance:0},fo={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Ze]},go={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Ze]},mo={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 l=Ot("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:Ae(/[ ]+/,"(",l,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),a},po=ct("//","$"),ho=ct("/\\*","\\*/"),bo=ct("#","$"),Eo={scope:"number",begin:gn,relevance:0},yo={scope:"number",begin:mn,relevance:0},xo={scope:"number",begin:pn,relevance:0},ko={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ze,{begin:/\[/,end:/\]/,relevance:0,contains:[Ze]}]},No={scope:"title",begin:fn,relevance:0},wo={scope:"title",begin:Bt,relevance:0},_o={begin:"\\.\\s*"+Bt,relevance:0};var dt=Object.freeze({__proto__:null,APOS_STRING_MODE:fo,BACKSLASH_ESCAPE:Ze,BINARY_NUMBER_MODE:xo,BINARY_NUMBER_RE:pn,COMMENT:ct,C_BLOCK_COMMENT_MODE:ho,C_LINE_COMMENT_MODE:po,C_NUMBER_MODE:yo,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:bo,IDENT_RE:fn,MATCH_NOTHING_RE:so,METHOD_GUARD:_o,NUMBER_MODE:Eo,NUMBER_RE:gn,PHRASAL_WORDS_MODE:mo,QUOTE_STRING_MODE:go,REGEXP_MODE:ko,RE_STARTERS_RE:co,SHEBANG:uo,TITLE_MODE:No,UNDERSCORE_IDENT_RE:Bt,UNDERSCORE_TITLE_MODE:wo});function So(e,r){e.input[e.index-1]==="."&&r.ignoreMatch()}function Mo(e,r){e.className!==void 0&&(e.scope=e.className,delete e.className)}function vo(e,r){r&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=So,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function Co(e,r){Array.isArray(e.illegal)&&(e.illegal=Ot(...e.illegal))}function To(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 Ao(e,r){e.relevance===void 0&&(e.relevance=1)}const Ro=(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=Ae(i.beforeMatch,dn(i.begin)),e.starts={relevance:0,contains:[Object.assign(i,{endsParent:!0})]},e.relevance=0,delete i.beforeMatch},Oo=["of","and","for","in","not","or","if","then","parent","list","value"],Io="keyword";function hn(e,r,i=Io){const a=Object.create(null);return typeof e=="string"?l(i,e.split(" ")):Array.isArray(e)?l(i,e):Object.keys(e).forEach(function(f){Object.assign(a,hn(e[f],r,f))}),a;function l(f,s){r&&(s=s.map(d=>d.toLowerCase())),s.forEach(function(d){const u=d.split("|");a[u[0]]=[f,Bo(u[0],u[1])]})}}function Bo(e,r){return r?Number(r):Lo(e)?0:1}function Lo(e){return Oo.includes(e.toLowerCase())}const bn={},Re=e=>{console.error(e)},En=(e,...r)=>{console.log(`WARN: ${e}`,...r)},ze=(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 l=e[i],f={},s={};for(let d=1;d<=r.length;d++)s[d+a]=l[d],f[d+a]=!0,a+=un(r[d-1]);e[i]=s,e[i]._emit=f,e[i]._multi=!0}function Do(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Re("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ut;if(typeof e.beginScope!="object"||e.beginScope===null)throw Re("beginScope must be object"),ut;yn(e,e.begin,{key:"beginScope"}),e.begin=It(e.begin,{joinWith:""})}}function zo(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Re("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ut;if(typeof e.endScope!="object"||e.endScope===null)throw Re("endScope must be object"),ut;yn(e,e.end,{key:"endScope"}),e.end=It(e.end,{joinWith:""})}}function $o(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Po(e){$o(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),Do(e),zo(e)}function Uo(e){function r(s,d){return new RegExp(Ke(s),"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(It(d,{joinWith:"|"}),!0),this.lastIndex=0}exec(d){this.matcherRe.lastIndex=this.lastIndex;const u=this.matcherRe.exec(d);if(!u)return null;const g=u.findIndex((b,k)=>k>0&&b!==void 0),x=this.matchIndexes[g];return u.splice(0,g),Object.assign(u,x)}}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(([g,x])=>u.addRule(g,x)),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 g=u.exec(d);if(this.resumingScanAtSamePosition()&&!(g&&g.index===this.lastIndex)){const x=this.getMatcher(0);x.lastIndex=this.lastIndex+1,g=x.exec(d)}return g&&(this.regexIndex+=g.position+1,this.regexIndex===this.count&&this.considerAll()),g}}function l(s){const d=new a;return s.contains.forEach(u=>d.addRule(u.begin,{rule:u,type:"begin"})),s.terminatorEnd&&d.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&d.addRule(s.illegal,{type:"illegal"}),d}function f(s,d){const u=s;if(s.isCompiled)return u;[Mo,To,Po,Ro].forEach(x=>x(s,d)),e.compilerExtensions.forEach(x=>x(s,d)),s.__beforeBegin=null,[vo,Co,Ao].forEach(x=>x(s,d)),s.isCompiled=!0;let g=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),g=s.keywords.$pattern,delete s.keywords.$pattern),g=g||/\w+/,s.keywords&&(s.keywords=hn(s.keywords,e.case_insensitive)),u.keywordPatternRe=r(g,!0),d&&(s.begin||(s.begin=/\B|\b/),u.beginRe=r(u.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(u.endRe=r(u.end)),u.terminatorEnd=Ke(u.end)||"",s.endsWithParent&&d.terminatorEnd&&(u.terminatorEnd+=(s.end?"|":"")+d.terminatorEnd)),s.illegal&&(u.illegalRe=r(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(x){return Vo(x==="self"?s:x)})),s.contains.forEach(function(x){f(x,u)}),s.starts&&f(s.starts,d),u.matcher=l(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||{}),f(e)}function xn(e){return e?e.endsWithParent||xn(e.starts):!1}function Vo(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 Ho="11.11.1";class Fo extends Error{constructor(r,i){super(r),this.name="HTMLInjectionError",this.html=i}}const Lt=ln,kn=Ce,Nn=Symbol("nomatch"),Wo=7,wn=function(e){const r=Object.create(null),i=Object.create(null),a=[];let l=!0;const f="Could not find the language '{}', did you forget to load/include a language module?",s={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:no};function u(y){return d.noHighlightRe.test(y)}function g(y){let T=y.className+" ";T+=y.parentNode?y.parentNode.className:"";const M=d.languageDetectRe.exec(T);if(M){const R=ee(M[1]);return R||(En(f.replace("{}",M[1])),En("Falling back to no-highlight mode for this block.",y)),R?M[1]:"no-highlight"}return T.split(/\s+/).find(R=>u(R)||ee(R))}function x(y,T,M){let R="",K="";typeof T=="object"?(R=y,M=T.ignoreIllegals,K=T.language):(ze("10.7.0","highlight(lang, code, ...args) has been deprecated."),ze("10.7.0",`Please use highlight(code, options) instead.
|
|
14
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),
|
|
15
|
-
`,1;if(Ie>1e5&&Ie>v.index*3)throw new Error("potential infinite loop, way more iterations than matches");return X+=C,C.length}const fe=ee(y);if(!fe)throw Re(f.replace("{}",y)),new Error('Unknown language: "'+y+'"');const Vt=Uo(fe);let qe="",L=R||Vt;const je={},ae=new d.__emitter(d);Et();let X="",He=0,Se=0,Ie=0,Be=!1;try{if(fe.__emitTokens)fe.__emitTokens(T,ae);else{for(L.matcher.considerAll();;){Ie++,Be?Be=!1:L.matcher.considerAll(),L.matcher.lastIndex=Se;const w=L.matcher.exec(T);if(!w)break;const v=T.substring(Se,w.index),C=Xe(v,w);Se=w.index+C}Xe(T.substring(Se))}return ae.finalize(),qe=ae.toHTML(),{language:y,value:qe,relevance:He,illegal:!1,_emitter:ae,_top:L}}catch(w){if(w.message&&w.message.includes("Illegal"))return{language:y,value:Lt(T),illegal:!0,relevance:0,_illegalBy:{message:w.message,index:Se,context:T.slice(Se-100,Se+100),mode:w.mode,resultSoFar:qe},_emitter:ae};if(l)return{language:y,value:Lt(T),illegal:!1,relevance:0,errorRaised:w,_emitter:ae,_top:L};throw w}}function k(y){const T={value:Lt(y),illegal:!1,relevance:0,_top:s,_emitter:new d.__emitter(d)};return T._emitter.addText(y),T}function h(y,T){T=T||d.languages||Object.keys(r);const M=k(y),R=T.filter(ee).filter(F).map(ge=>b(ge,y,!1));R.unshift(M);const K=R.sort((ge,Ee)=>{if(ge.relevance!==Ee.relevance)return Ee.relevance-ge.relevance;if(ge.language&&Ee.language){if(ee(ge.language).supersetOf===Ee.language)return 1;if(ee(Ee.language).supersetOf===ge.language)return-1}return 0}),[ne,ue]=K,be=ne;return be.secondBest=ue,be}function m(y,T,M){const R=T&&i[T]||M;y.classList.add("hljs"),y.classList.add(`language-${R}`)}function D(y){let T=null;const M=g(y);if(u(M))return;if(ie("before:highlightElement",{el:y,language:M}),y.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",y);return}if(y.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(y)),d.throwUnescapedHTML))throw new Fo("One of your code blocks includes unescaped HTML.",y.innerHTML);T=y;const R=T.textContent,K=M?x(R,{language:M,ignoreIllegals:!0}):h(R);y.innerHTML=K.value,y.dataset.highlighted="yes",m(y,M,K.language),y.result={language:K.language,re:K.relevance,relevance:K.relevance},K.secondBest&&(y.secondBest={language:K.secondBest.language,relevance:K.secondBest.relevance}),ie("after:highlightElement",{el:y,result:K,text:R})}function G(y){d=kn(d,y)}const S=()=>{P(),ze("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function H(){P(),ze("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let I=!1;function P(){function y(){P()}if(document.readyState==="loading"){I||window.addEventListener("DOMContentLoaded",y,!1),I=!0;return}document.querySelectorAll(d.cssSelector).forEach(D)}function z(y,T){let M=null;try{M=T(e)}catch(R){if(Re("Language definition for '{}' could not be registered.".replace("{}",y)),l)Re(R);else throw R;M=s}M.name||(M.name=y),r[y]=M,M.rawDefinition=T.bind(null,e),M.aliases&&le(M.aliases,{languageName:y})}function B(y){delete r[y];for(const T of Object.keys(i))i[T]===y&&delete i[T]}function j(){return Object.keys(r)}function ee(y){return y=(y||"").toLowerCase(),r[y]||r[i[y]]}function le(y,{languageName:T}){typeof y=="string"&&(y=[y]),y.forEach(M=>{i[M.toLowerCase()]=T})}function F(y){const T=ee(y);return T&&!T.disableAutodetect}function J(y){y["before:highlightBlock"]&&!y["before:highlightElement"]&&(y["before:highlightElement"]=T=>{y["before:highlightBlock"](Object.assign({block:T.el},T))}),y["after:highlightBlock"]&&!y["after:highlightElement"]&&(y["after:highlightElement"]=T=>{y["after:highlightBlock"](Object.assign({block:T.el},T))})}function re(y){J(y),a.push(y)}function ce(y){const T=a.indexOf(y);T!==-1&&a.splice(T,1)}function ie(y,T){const M=y;a.forEach(function(R){R[M]&&R[M](T)})}function de(y){return ze("10.7.0","highlightBlock will be removed entirely in v12.0"),ze("10.7.0","Please use highlightElement now."),D(y)}Object.assign(e,{highlight:x,highlightAuto:h,highlightAll:P,highlightElement:D,highlightBlock:de,configure:G,initHighlighting:S,initHighlightingOnLoad:H,registerLanguage:z,unregisterLanguage:B,listLanguages:j,getLanguage:ee,registerAliases:le,autoDetection:F,inherit:kn,addPlugin:re,removePlugin:ce}),e.debugMode=function(){l=!1},e.safeMode=function(){l=!0},e.versionString=Ho,e.regex={concat:Ae,lookahead:dn,either:Ot,optional:oo,anyNumberOfTimes:io};for(const y in dt)typeof dt[y]=="object"&&rn(dt[y]);return Object.assign(e,dt),e},$e=wn({});$e.newInstance=()=>wn({});var Go=$e;$e.HighlightJS=$e,$e.default=$e;const Dt=Ji(Go);function zt(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 l={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},f=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={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,l]};l.contains.push(d);const u={match:/\\"/},g={className:"string",begin:/'/,end:/'/},x={match:/\\'/},b={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,i]},k=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],h=e.SHEBANG({binary:`(${k.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},D=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],G=["true","false"],S={match:/(\/[a-z._-]+)+/},H=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],I=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],P=["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"],z=["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:D,literal:G,built_in:[...H,...I,"set","shopt",...P,...z]},contains:[h,e.SHEBANG(),m,b,f,s,S,d,u,g,x,i]}}const Ko=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_-]*/}}),Zo=["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"],Yo=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Xo=[...Zo,...Yo],qo=["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(),jo=["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(),Jo=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Qo=["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 er(e){const r=e.regex,i=Ko(e),a={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},l="and or not only",f=/@-?\w[\w]*(-\w+)*/,s="[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:"\\."+s,relevance:0},i.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+jo.join("|")+")"},{begin:":(:)?("+Jo.join("|")+")"}]},i.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Qo.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:f},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:l,attribute:qo.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...d,i.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Xo.join("|")+")\\b"}]}}function _n(e){const f={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:f,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:f,illegal:/["']/}]}]}}var Pe="[0-9](_*[0-9])*",ft=`\\.(${Pe})`,gt="[0-9a-fA-F](_*[0-9a-fA-F])*",Sn={className:"number",variants:[{begin:`(\\b(${Pe})((${ft})|\\.)?|(${ft}))[eE][+-]?(${Pe})[fFdD]?\\b`},{begin:`\\b(${Pe})((${ft})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ft})[fFdD]?\\b`},{begin:`\\b(${Pe})[fFdD]\\b`},{begin:`\\b0[xX]((${gt})\\.?|(${gt})?\\.(${gt}))[pP][+-]?(${Pe})[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 tr(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"]},g={className:"meta",begin:"@"+i,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},x={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:[x,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:[g,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,g]}}const vn="[A-Za-z$_][0-9A-Za-z$_]*",nr=["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"],ir=["true","false","null","undefined","NaN","Infinity"],Cn=["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"],Tn=["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"],or=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],rr=[].concat(An,Cn,Tn);function Rn(e){const r=e.regex,i=(M,{after:R})=>{const K="</"+M[0].slice(1);return M.input.indexOf(K,R)!==-1},a=vn,l={begin:"<>",end:"</>"},f=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(M,R)=>{const K=M[0].length+M.index,ne=M.input[K];if(ne==="<"||ne===","){R.ignoreMatch();return}ne===">"&&(i(M,{after:K})||R.ignoreMatch());let ue;const be=M.input.substring(K);if(ue=be.match(/^\s*=/)){R.ignoreMatch();return}if((ue=be.match(/^\s+extends\s+/))&&ue.index===0){R.ignoreMatch();return}}},d={$pattern:vn,keyword:nr,literal:ir,built_in:rr,"variable.language":or},u="[0-9](_?[0-9])*",g=`\\.(${u})`,x="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",b={className:"number",variants:[{begin:`(\\b(${x})((${g})|\\.)?|(${g}))[eE][+-]?(${u})\\b`},{begin:`\\b(${x})\\b((${g})\\b|\\.)?|(${g})\\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},k={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"css"}},D={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"graphql"}},G={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,k]},H={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]},I=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,D,G,{match:/\$\d+/},b];k.contains=I.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(I)});const P=[].concat(H,k.contains),z=P.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(P)}]),B={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:z},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"}}]},ee={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:{_:[...Cn,...Tn]}},le={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},F={variants:[{match:[/function/,/\s+/,a,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[B],illegal:/%/},J={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function re(M){return r.concat("(?!",M.join("|"),")")}const ce={match:r.concat(/\b/,re([...An,"super","import"].map(M=>`${M}\\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},de={match:[/get|set/,/\s+/,a,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},B]},y="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",T={match:[/const|var|let/,/\s+/,a,/\s*/,/=\s*/,/(async\s*)?/,r.lookahead(y)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[B]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:z,CLASS_REFERENCE:ee},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),le,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,D,G,H,{match:/\$\d+/},b,ee,{scope:"attr",match:a+r.lookahead(":"),relevance:0},T,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[H,e.REGEXP_MODE,{className:"function",begin:y,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:z}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:l.begin,end:l.end},{match:f},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},F,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[B,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:[B]},ce,J,j,de,{match:/\$[(.]/}]}}function ar(e){const r={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},i={match:/[{}[\],:]/,className:"punctuation",relevance:0},a=["true","false","null"],l={scope:"literal",beginKeywords:a.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:a},contains:[r,i,e.QUOTE_STRING_MODE,l,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:"$"},l={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}]},f={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={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}]},g={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},x={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},b=e.inherit(g,{contains:[]}),k=e.inherit(x,{contains:[]});g.contains.push(k),x.contains.push(b);let h=[i,u];return[g,x,b,k].forEach(S=>{S.contains=S.contains.concat(h)}),h=h.concat(g,x),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:h},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:h}]}]},i,f,g,x,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},l,a,u,s,{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:/^(>>>|\.\.\.) /},g={className:"subst",begin:/\{/,end:/\}/,keywords:d,illegal:/#/},x={begin:/\{\{/,relevance:0},b={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,x,g]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,u,x,g]},{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,x,g]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,x,g]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},k="[0-9](_?[0-9])*",h=`(\\b(${k}))?\\.(${k})|\\b(${k})\\.`,m=`\\b|${a.join("|")}`,D={className:"number",relevance:0,variants:[{begin:`(\\b(${k})|(${h}))[eE][+-]?(${k})[jJ]?(?=${m})`},{begin:`(${h})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${k})[jJ](?=${m})`}]},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,D,b,e.HASH_COMMENT_MODE]}]};return g.contains=[b,D,u],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:d,illegal:/(<\/|\?)|=>/,contains:[u,D,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},b,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:[D,S,b]}]}}function Bn(e){const r=e.regex,i=/(r#)?/,a=r.concat(i,e.UNDERSCORE_IDENT_RE),l=r.concat(i,e.IDENT_RE),f={className:"title.function.invoke",relevance:0,begin:r.concat(/\b/,/(?!let|for|while|if|else|match\b)/,l,r.lookahead(/\s*\(/))},s="([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"],g=["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!"],x=["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:x,keyword:d,literal:u,built_in:g},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_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],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:g,type:x}},{className:"punctuation",begin:"->"},f]}}function lr(e){const r=e.regex,i=e.COMMENT("--","$"),a={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},l={begin:/"/,end:/"/,contains:[{match:/""/}]},f=["true","false","unknown"],s=["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"],g=["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"],x=["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"],b=["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"],k=["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"],h=x,m=[...g,...u].filter(z=>!x.includes(z)),D={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},G={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},S={match:r.concat(/\b/,r.either(...h),/\s*\(/),relevance:0,keywords:{built_in:h}};function H(z){return r.concat(/\b/,r.either(...z.map(B=>B.replace(/\s+/,"\\s+"))),/\b/)}const I={scope:"keyword",match:H(k),relevance:0};function P(z,{exceptions:B,when:j}={}){const ee=j;return B=B||[],z.map(le=>le.match(/\|\d+$/)||B.includes(le)?le:ee(le)?`${le}|0`:le)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:P(m,{when:z=>z.length<3}),literal:f,type:d,built_in:b},contains:[{scope:"type",match:H(s)},I,S,D,a,l,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"],Vn=[].concat(Pn,zn,$n);function sr(e){const r=e.regex,i=(M,{after:R})=>{const K="</"+M[0].slice(1);return M.input.indexOf(K,R)!==-1},a=mt,l={begin:"<>",end:"</>"},f=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(M,R)=>{const K=M[0].length+M.index,ne=M.input[K];if(ne==="<"||ne===","){R.ignoreMatch();return}ne===">"&&(i(M,{after:K})||R.ignoreMatch());let ue;const be=M.input.substring(K);if(ue=be.match(/^\s*=/)){R.ignoreMatch();return}if((ue=be.match(/^\s+extends\s+/))&&ue.index===0){R.ignoreMatch();return}}},d={$pattern:mt,keyword:Ln,literal:Dn,built_in:Vn,"variable.language":Un},u="[0-9](_?[0-9])*",g=`\\.(${u})`,x="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",b={className:"number",variants:[{begin:`(\\b(${x})((${g})|\\.)?|(${g}))[eE][+-]?(${u})\\b`},{begin:`\\b(${x})\\b((${g})\\b|\\.)?|(${g})\\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},k={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"css"}},D={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"graphql"}},G={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,k]},H={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]},I=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,D,G,{match:/\$\d+/},b];k.contains=I.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(I)});const P=[].concat(H,k.contains),z=P.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(P)}]),B={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:z},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"}}]},ee={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]}},le={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},F={variants:[{match:[/function/,/\s+/,a,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[B],illegal:/%/},J={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function re(M){return r.concat("(?!",M.join("|"),")")}const ce={match:r.concat(/\b/,re([...Pn,"super","import"].map(M=>`${M}\\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},de={match:[/get|set/,/\s+/,a,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},B]},y="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",T={match:[/const|var|let/,/\s+/,a,/\s*/,/=\s*/,/(async\s*)?/,r.lookahead(y)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[B]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:z,CLASS_REFERENCE:ee},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),le,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,D,G,H,{match:/\$\d+/},b,ee,{scope:"attr",match:a+r.lookahead(":"),relevance:0},T,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[H,e.REGEXP_MODE,{className:"function",begin:y,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:z}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:l.begin,end:l.end},{match:f},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},F,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[B,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:[B]},ce,J,j,de,{match:/\$[(.]/}]}}function Hn(e){const r=e.regex,i=sr(e),a=mt,l=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],f={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:l},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"],g={$pattern:mt,keyword:Ln.concat(u),literal:Dn,built_in:Vn.concat(l),"variable.language":Un},x={className:"meta",begin:"@"+a},b=(D,G,S)=>{const H=D.contains.findIndex(I=>I.label===G);if(H===-1)throw new Error("can not find mode to replace");D.contains.splice(H,1,S)};Object.assign(i.keywords,g),i.exports.PARAMS_CONTAINS.push(x);const k=i.contains.find(D=>D.scope==="attr"),h=Object.assign({},k,{match:r.concat(a,r.lookahead(/\s*\?:/))});i.exports.PARAMS_CONTAINS.push([i.exports.CLASS_REFERENCE,k,h]),i.contains=i.contains.concat([x,f,s,h]),b(i,"shebang",e.SHEBANG()),b(i,"use_strict",d);const m=i.contains.find(D=>D.label==="func.def");return m.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,l={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},f={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=e.inherit(f,{begin:/\(/,end:/\)/}),d=e.inherit(e.APOS_STRING_MODE,{className:"string"}),u=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),g={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:[l]},{begin:/'/,end:/'/,contains:[l]},{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:[f,u,d,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[f,s,u,d]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},l,{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:[g],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[g],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:g}]},{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]|$)/}]},l={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},f={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},s={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,l]},d=e.inherit(s,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),k={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"},h={end:",",endsWithParent:!0,excludeEnd:!0,keywords:r,relevance:0},m={begin:/\{/,end:/\}/,contains:[h],illegal:"\\n",relevance:0},D={begin:"\\[",end:"\\]",contains:[h],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}},k,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,D,f,s],S=[...G];return S.pop(),S.push(d),h.contains=S,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:G}}const $t={bash:zt,sh:zt,shell:zt,css:er,go:_n,golang:_n,java:tr,javascript:Rn,js:Rn,json:ar,markdown:On,md:On,python:In,py:In,rust:Bn,rs:Bn,sql:lr,typescript:Hn,ts:Hn,xml:Fn,html:Fn,yaml:Wn,yml:Wn};for(const[e,r]of Object.entries($t))Dt.registerLanguage(e,r);function Gn(e){const r=e.split(`
|
|
16
|
-
`);return/^(`{3,}|~{3,})/.test(
|
|
17
|
-
`).replace(/\n+$/,"")}function
|
|
18
|
-
`)[0]??""),i=((
|
|
19
|
-
`).filter(
|
|
20
|
-
`:"```\n",
|
|
7
|
+
`);for(const r of e.children)i+=dt(r,a+1);return i}function Zi(e){var g,y;const a=e.split(/\r?\n/),i=[];let r=0;const l=/^(#{1,6})\s+(.+?)\s*#*\s*$/,f=/^(`{3,}|~{3,})\s*(\S+)?\s*$/,s=/^\s*\|?\s*(:?-+:?\s*\|\s*)+(:?-+:?)(\s*\|)?\s*$/,c=/^(\s*)[-*+]\s+(.*)$/,u=/^(\s*)\d+\.\s+(.*)$/;for(;r<a.length;){const b=a[r],k=b.match(f);if(k){const O=k[1][0],$=k[2]||"",D=[b];for(r++;r<a.length;){const j=a[r].match(f);if(j&&j[1][0]===O){D.push(a[r]),r++;break}D.push(a[r]),r++}const I=D.slice(1,-1).join(`
|
|
8
|
+
`).trim();i.push({kind:"code",text:((g=I.split(`
|
|
9
|
+
`)[0])==null?void 0:g.slice(0,80))||"(空代码块)",raw:D.join(`
|
|
10
|
+
`),lang:$});continue}const h=b.match(l);if(h){i.push({kind:"heading",level:h[1].length,text:h[2].trim(),raw:b}),r++;continue}if(/^\s*\|/.test(b)){const O=[];let $=r,D=!1;for(;$<a.length&&/^\s*\|/.test(a[$]);)O.push(a[$]),s.test(a[$])&&(D=!0),$++;if(D&&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
|
+
`)}),r=$;continue}}const m=b.match(c),L=b.match(u);if(m||L){let O=r;for(;O<a.length;){const $=a[O].match(c),D=a[O].match(u);if(!($||D))break;const I=a[O].replace(/^\s*[-*+]\s+/,"").replace(/^\s*\d+\.\s+/,"").trim();I.length>0&&i.push({kind:"list",text:I.slice(0,80)||"(列表项)",raw:a[O]}),O++}r=O;continue}if(b.trim()===""){r++;continue}const K=[b];let _=r+1;for(;_<a.length;){const O=a[_];if(O.trim()===""||l.test(O)||f.test(O)||c.test(O)||u.test(O)||/^\s*\|/.test(O))break;K.push(O),_++}const F=K.join(" ").trim();i.push({kind:"paragraph",text:F.slice(0,80)||"(空段落)",raw:K.join(`
|
|
12
|
+
`)}),r=_}return i}function Xi(e,a="导入的导图"){const i=Zi(e||""),r={id:_e(),text:a,children:[]},l=[r],f=[0];let s=!1;function c(u){if(u.kind==="heading"){const y=u.level;for(;l.length>1&&f[f.length-1]>=y;)l.pop(),f.pop();if(!s&&y===1){s=!0,r.text=u.text,f[0]=1;return}const b={id:_e(),text:u.text,children:[]};l[l.length-1].children.push(b),l.push(b),f.push(y);return}const g={id:_e(),text:u.text,children:[],richContent:{kind:u.kind,raw:u.raw,lang:u.lang}};l[l.length-1].children.push(g)}for(const u of i)c(u);return r}function qi(e){return e.richContent?e.richContent.raw+`
|
|
13
|
+
`:""}function ji(e){const a=e.minScale??.2,i=e.maxScale??1/0,r=e.step??1.2,l=t.ref(1),f=t.ref(0),s=t.ref(0),c=t.ref(!1),u=t.reactive({x:0,y:0,ox:0,oy:0}),g=t.ref(!1),y=t.reactive({x:0,y:0}),b=t.reactive({x:0,y:0,width:0,height:0}),k=t.ref(0);let h=null;function m(W){h=W}function L(W){W.preventDefault();const J=e.getContainer();if(!J)return;const le=-W.deltaY*.001,de=Math.min(i,Math.max(a,l.value*(1+le))),re=J.getBoundingClientRect(),fe=W.clientX-re.left,x=W.clientY-re.top,v=(fe-f.value)/l.value,S=(x-s.value)/l.value;l.value=de,f.value=fe-v*de,s.value=x-S*de}function K(){l.value=Math.min(i,l.value*r)}function _(){l.value=Math.max(a,l.value/r)}function F(W){var le;W.target.closest(".zm-node, .zm-toolbar, button, input, textarea")||(c.value=!0,u.x=W.clientX,u.y=W.clientY,u.ox=f.value,u.oy=s.value,window.addEventListener("mousemove",O),window.addEventListener("mouseup",$),(le=W.preventDefault)==null||le.call(W))}function O(W){c.value&&(f.value=u.ox+(W.clientX-u.x),s.value=u.oy+(W.clientY-u.y))}function $(){c.value=!1,window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",$)}function D(W,J){g.value=!0,y.x=W,y.y=J,b.x=W,b.y=J,b.width=0,b.height=0,k.value++,window.addEventListener("mousemove",te),window.addEventListener("mouseup",j)}function I(W,J){if(!g.value)return;const le=Math.min(y.x,W),de=Math.min(y.y,J),re=Math.max(y.x,W),fe=Math.max(y.y,J);b.x=le,b.y=de,b.width=re-le,b.height=fe-de,k.value++}function j(){g.value=!1,window.removeEventListener("mousemove",te),window.removeEventListener("mouseup",j),h&&h()}function te(W){if(!g.value)return;const J=e.getContainer();if(!J)return;const le=J.getBoundingClientRect(),de=(W.clientX-le.left-f.value)/l.value,re=(W.clientY-le.top-s.value)/l.value;I(de,re)}function se(W,J,le,de=60){const re=e.getContainer();if(!re)return;const fe=re.getBoundingClientRect(),x=(fe.width-de*2)/W,v=(fe.height-de*2)/J,S=Math.min(1,Math.max(.3,Math.min(x,v)));l.value=S,f.value=fe.width/2,s.value=fe.height/2-le*S}return{scale:l,offsetX:f,offsetY:s,isPanning:c,onWheel:L,zoomIn:K,zoomOut:_,startPan:F,startMarquee:D,updateMarquee:I,isMarquee:g,marquee:b,marqueeVersion:k,setOnMarqueeEnd:m,resetView:se}}const Ji=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function an(e){return Ji?e.metaKey:e.ctrlKey}function Qi(e){function a(){const r=e.getSelectedId();return r||(e.defaultTargetId?e.defaultTargetId():e.getRootId())}function i(r){const l=r.target;if(l&&(l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.isContentEditable)||e.isReadonly()||e.isEditing())return;const f=e.getSelectedId(),s=a();if(s){if(an(r)&&!r.shiftKey){if(r.key==="d"||r.key==="D"){f&&f!==e.getRootId()&&(r.preventDefault(),e.onDuplicate(f));return}if(r.key==="z"||r.key==="Z"){r.preventDefault(),e.onUndo();return}if(r.key==="y"||r.key==="Y"){r.preventDefault(),e.onRedo();return}if(r.key==="Home"){r.preventDefault(),e.onSelectRoot();return}}if(an(r)&&r.shiftKey&&(r.key==="Z"||r.key==="z")){r.preventDefault(),e.onRedo();return}r.key==="Tab"?(r.preventDefault(),e.onAddChild(s)):r.key==="Enter"?(r.preventDefault(),r.shiftKey?f&&f!==e.getRootId()&&e.onAddSiblingBefore(f):e.onAddSibling(s)):(r.key==="Delete"||r.key==="Backspace")&&f&&f!==e.getRootId()?(r.preventDefault(),e.onRemove(f)):r.key==="F2"&&f?(r.preventDefault(),e.onStartEdit(f)):r.key==="Escape"?(r.preventDefault(),e.onClearSelection()):r.key==="ArrowDown"?(r.preventDefault(),e.onNavigate(0,1)):r.key==="ArrowUp"?(r.preventDefault(),e.onNavigate(0,-1)):r.key==="ArrowRight"?(r.preventDefault(),e.onNavigate(1,0)):r.key==="ArrowLeft"&&(r.preventDefault(),e.onNavigate(-1,0))}}t.onMounted(()=>{window.addEventListener("keydown",i)}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",i)})}function eo(e=100){const a=t.ref([]);let i=-1;function r(){return i>0}function l(){return i<a.value.length-1}function f(g){const y=JSON.stringify(g);for(i<a.value.length-1&&(a.value=a.value.slice(0,i+1)),a.value.push(y),i=a.value.length-1;a.value.length>e;)a.value.shift(),i--}function s(){return r()?(i--,JSON.parse(a.value[i])):null}function c(){return l()?(i++,JSON.parse(a.value[i])):null}function u(){a.value=[],i=-1}return{canUndo:r,canRedo:l,record:f,undo:s,redo:c,reset:u}}const to=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}},emits:["pickImage","setLink","removeLink","editNote","removeNote","removeImage","addCode","editCode","removeCode","addTable","editTable","removeTable","close"],setup(e,{emit:a}){const i=e,r=a,l=t.computed(()=>{let k=i.x+2,h=i.y+2;if(i.container){const m=i.container.getBoundingClientRect(),L=180,_=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;k+L>m.right&&(k=Math.max(m.left+4,i.x-L-2)),h+_>m.bottom&&(h=Math.max(m.top+4,i.y-_-2)),k<m.left+2&&(k=m.left+2),h<m.top+2&&(h=m.top+2)}return{left:k,top:h}}),f=t.computed(()=>i.hasImage),s=t.computed(()=>i.hasLink),c=t.computed(()=>i.hasNote);function u(k){const h=k.target;h&&h.closest(".zm-node-menu")||r("close")}function g(k){k.key==="Escape"&&r("close")}function y(){r("close")}window.addEventListener("mousedown",u,!0),window.addEventListener("keydown",g,!0),window.addEventListener("wheel",y,!0),window.addEventListener("scroll",y,!0),t.onBeforeUnmount(()=>{window.removeEventListener("mousedown",u,!0),window.removeEventListener("keydown",g,!0),window.removeEventListener("wheel",y,!0),window.removeEventListener("scroll",y,!0)});function b(k){k(),r("close")}return(k,h)=>(t.openBlock(),t.createElementBlock("div",{class:"zm-node-menu",style:t.normalizeStyle({left:l.value.left+"px",top:l.value.top+"px"}),onContextmenu:h[10]||(h[10]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("button",{class:"zm-node-menu-item",onClick:h[0]||(h[0]=t.withModifiers(m=>b(()=>r("pickImage")),["stop"]))},[t.createVNode(ne,{name:"image",size:13}),t.createElementVNode("span",null,t.toDisplayString(f.value?"替换图片":"添加图片"),1)]),f.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"zm-node-menu-item",onClick:h[1]||(h[1]=t.withModifiers(m=>b(()=>r("removeImage")),["stop"]))},[t.createVNode(ne,{name:"x",size:13}),h[11]||(h[11]=t.createElementVNode("span",null,"移除图片",-1))])):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",onClick:h[2]||(h[2]=t.withModifiers(m=>b(()=>r("setLink")),["stop"]))},[t.createVNode(ne,{name:"link",size:13}),t.createElementVNode("span",null,t.toDisplayString(s.value?"编辑链接":"添加链接"),1)]),s.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"zm-node-menu-item",onClick:h[3]||(h[3]=t.withModifiers(m=>b(()=>r("removeLink")),["stop"]))},[t.createVNode(ne,{name:"x",size:13}),h[12]||(h[12]=t.createElementVNode("span",null,"移除链接",-1))])):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",onClick:h[4]||(h[4]=t.withModifiers(m=>b(()=>r("addCode")),["stop"]))},[h[13]||(h[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)]),e.hasCode?(t.openBlock(),t.createElementBlock("button",{key:2,class:"zm-node-menu-item",onClick:h[5]||(h[5]=t.withModifiers(m=>b(()=>r("removeCode")),["stop"]))},[t.createVNode(ne,{name:"x",size:13}),h[14]||(h[14]=t.createElementVNode("span",null,"移除代码块",-1))])):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",onClick:h[6]||(h[6]=t.withModifiers(m=>b(()=>r("addTable")),["stop"]))},[h[15]||(h[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)]),e.hasTable?(t.openBlock(),t.createElementBlock("button",{key:3,class:"zm-node-menu-item",onClick:h[7]||(h[7]=t.withModifiers(m=>b(()=>r("removeTable")),["stop"]))},[t.createVNode(ne,{name:"x",size:13}),h[16]||(h[16]=t.createElementVNode("span",null,"移除表格",-1))])):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"zm-node-menu-item",onClick:h[8]||(h[8]=t.withModifiers(m=>b(()=>r("editNote")),["stop"]))},[t.createVNode(ne,{name:"note",size:13}),t.createElementVNode("span",null,t.toDisplayString(c.value?"编辑笔记":"添加笔记"),1)]),c.value?(t.openBlock(),t.createElementBlock("button",{key:4,class:"zm-node-menu-item",onClick:h[9]||(h[9]=t.withModifiers(m=>b(()=>r("removeNote")),["stop"]))},[t.createVNode(ne,{name:"x",size:13}),h[17]||(h[17]=t.createElementVNode("span",null,"移除笔记",-1))])):t.createCommentVNode("",!0)],36))}}),no=t.defineComponent({__name:"CanvasContextMenu",props:{x:{},y:{},container:{}},emits:["openSettings","close"],setup(e,{emit:a}){const i=e,r=a,l=t.computed(()=>{let g=i.x+2,y=i.y+2;if(i.container){const b=i.container.getBoundingClientRect(),k=168,h=4+1*28;g+k>b.right&&(g=Math.max(b.left+4,i.x-k-2)),y+h>b.bottom&&(y=Math.max(b.top+4,i.y-h-2)),g<b.left+2&&(g=b.left+2),y<b.top+2&&(y=b.top+2)}return{left:g,top:y}});function f(g){const y=g.target;y&&y.closest(".zm-canvas-menu")||r("close")}function s(g){g.key==="Escape"&&r("close")}function c(){r("close")}window.addEventListener("mousedown",f,!0),window.addEventListener("keydown",s,!0),window.addEventListener("wheel",c,!0),window.addEventListener("scroll",c,!0),t.onBeforeUnmount(()=>{window.removeEventListener("mousedown",f,!0),window.removeEventListener("keydown",s,!0),window.removeEventListener("wheel",c,!0),window.removeEventListener("scroll",c,!0)});function u(g){g(),r("close")}return(g,y)=>(t.openBlock(),t.createElementBlock("div",{class:"zm-canvas-menu",style:t.normalizeStyle({left:l.value.left+"px",top:l.value.top+"px"}),onContextmenu:y[1]||(y[1]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("button",{class:"zm-canvas-menu-item",onClick:y[0]||(y[0]=t.withModifiers(b=>u(()=>r("openSettings")),["stop"]))},[t.createVNode(ne,{name:"settings",size:13}),y[2]||(y[2]=t.createElementVNode("span",null,"设置",-1))])],36))}});function io(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ln(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(a=>{const i=e[a],r=typeof i;(r==="object"||r==="function")&&!Object.isFrozen(i)&&ln(i)}),e}class sn{constructor(a){a.data===void 0&&(a.data={}),this.data=a.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function cn(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Re(e,...a){const i=Object.create(null);for(const r in e)i[r]=e[r];return a.forEach(function(r){for(const l in r)i[l]=r[l]}),i}const oo="</span>",dn=e=>!!e.scope,ro=(e,{prefix:a})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const i=e.split(".");return[`${a}${i.shift()}`,...i.map((r,l)=>`${r}${"_".repeat(l+1)}`)].join(" ")}return`${a}${e}`};class ao{constructor(a,i){this.buffer="",this.classPrefix=i.classPrefix,a.walk(this)}addText(a){this.buffer+=cn(a)}openNode(a){if(!dn(a))return;const i=ro(a.scope,{prefix:this.classPrefix});this.span(i)}closeNode(a){dn(a)&&(this.buffer+=oo)}value(){return this.buffer}span(a){this.buffer+=`<span class="${a}">`}}const un=(e={})=>{const a={children:[]};return Object.assign(a,e),a};class Ot{constructor(){this.rootNode=un(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(a){this.top.children.push(a)}openNode(a){const i=un({scope:a});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(a){return this.constructor._walk(a,this.rootNode)}static _walk(a,i){return typeof i=="string"?a.addText(i):i.children&&(a.openNode(i),i.children.forEach(r=>this._walk(a,r)),a.closeNode(i)),a}static _collapse(a){typeof a!="string"&&a.children&&(a.children.every(i=>typeof i=="string")?a.children=[a.children.join("")]:a.children.forEach(i=>{Ot._collapse(i)}))}}class lo extends Ot{constructor(a){super(),this.options=a}addText(a){a!==""&&this.add(a)}startScope(a){this.openNode(a)}endScope(){this.closeNode()}__addSublanguage(a,i){const r=a.root;i&&(r.scope=`language:${i}`),this.add(r)}toHTML(){return new ao(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function qe(e){return e?typeof e=="string"?e:e.source:null}function fn(e){return Be("(?=",e,")")}function so(e){return Be("(?:",e,")*")}function co(e){return Be("(?:",e,")?")}function Be(...e){return e.map(i=>qe(i)).join("")}function uo(e){const a=e[e.length-1];return typeof a=="object"&&a.constructor===Object?(e.splice(e.length-1,1),a):{}}function It(...e){return"("+(uo(e).capture?"":"?:")+e.map(r=>qe(r)).join("|")+")"}function gn(e){return new RegExp(e.toString()+"|").exec("").length-1}function fo(e,a){const i=e&&e.exec(a);return i&&i.index===0}const go=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Bt(e,{joinWith:a}){let i=0;return e.map(r=>{i+=1;const l=i;let f=qe(r),s="";for(;f.length>0;){const c=go.exec(f);if(!c){s+=f;break}s+=f.substring(0,c.index),f=f.substring(c.index+c[0].length),c[0][0]==="\\"&&c[1]?s+="\\"+String(Number(c[1])+l):(s+=c[0],c[0]==="("&&i++)}return s}).map(r=>`(${r})`).join(a)}const mo=/\b\B/,mn="[a-zA-Z]\\w*",Lt="[a-zA-Z_]\\w*",pn="\\b\\d+(\\.\\d+)?",hn="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",bn="\\b(0b[01]+)",po="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ho=(e={})=>{const a=/^#![ ]*\//;return e.binary&&(e.begin=Be(a,/.*\b/,e.binary,/\b.*/)),Re({scope:"meta",begin:a,end:/$/,relevance:0,"on:begin":(i,r)=>{i.index!==0&&r.ignoreMatch()}},e)},je={begin:"\\\\[\\s\\S]",relevance:0},bo={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[je]},yo={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[je]},Eo={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/},ut=function(e,a,i={}){const r=Re({scope:"comment",begin:e,end:a,contains:[]},i);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const l=It("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Be(/[ ]+/,"(",l,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},xo=ut("//","$"),ko=ut("/\\*","\\*/"),wo=ut("#","$"),No={scope:"number",begin:pn,relevance:0},_o={scope:"number",begin:hn,relevance:0},So={scope:"number",begin:bn,relevance:0},Mo={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[je,{begin:/\[/,end:/\]/,relevance:0,contains:[je]}]},vo={scope:"title",begin:mn,relevance:0},Co={scope:"title",begin:Lt,relevance:0},To={begin:"\\.\\s*"+Lt,relevance:0};var ft=Object.freeze({__proto__:null,APOS_STRING_MODE:bo,BACKSLASH_ESCAPE:je,BINARY_NUMBER_MODE:So,BINARY_NUMBER_RE:bn,COMMENT:ut,C_BLOCK_COMMENT_MODE:ko,C_LINE_COMMENT_MODE:xo,C_NUMBER_MODE:_o,C_NUMBER_RE:hn,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(a,i)=>{i.data._beginMatch=a[1]},"on:end":(a,i)=>{i.data._beginMatch!==a[1]&&i.ignoreMatch()}})},HASH_COMMENT_MODE:wo,IDENT_RE:mn,MATCH_NOTHING_RE:mo,METHOD_GUARD:To,NUMBER_MODE:No,NUMBER_RE:pn,PHRASAL_WORDS_MODE:Eo,QUOTE_STRING_MODE:yo,REGEXP_MODE:Mo,RE_STARTERS_RE:po,SHEBANG:ho,TITLE_MODE:vo,UNDERSCORE_IDENT_RE:Lt,UNDERSCORE_TITLE_MODE:Co});function Ao(e,a){e.input[e.index-1]==="."&&a.ignoreMatch()}function Ro(e,a){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Oo(e,a){a&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=Ao,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function Io(e,a){Array.isArray(e.illegal)&&(e.illegal=It(...e.illegal))}function Bo(e,a){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 Lo(e,a){e.relevance===void 0&&(e.relevance=1)}const Do=(e,a)=>{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(r=>{delete e[r]}),e.keywords=i.keywords,e.begin=Be(i.beforeMatch,fn(i.begin)),e.starts={relevance:0,contains:[Object.assign(i,{endsParent:!0})]},e.relevance=0,delete i.beforeMatch},zo=["of","and","for","in","not","or","if","then","parent","list","value"],$o="keyword";function yn(e,a,i=$o){const r=Object.create(null);return typeof e=="string"?l(i,e.split(" ")):Array.isArray(e)?l(i,e):Object.keys(e).forEach(function(f){Object.assign(r,yn(e[f],a,f))}),r;function l(f,s){a&&(s=s.map(c=>c.toLowerCase())),s.forEach(function(c){const u=c.split("|");r[u[0]]=[f,Po(u[0],u[1])]})}}function Po(e,a){return a?Number(a):Uo(e)?0:1}function Uo(e){return zo.includes(e.toLowerCase())}const En={},Le=e=>{console.error(e)},xn=(e,...a)=>{console.log(`WARN: ${e}`,...a)},He=(e,a)=>{En[`${e}/${a}`]||(console.log(`Deprecated as of ${e}. ${a}`),En[`${e}/${a}`]=!0)},gt=new Error;function kn(e,a,{key:i}){let r=0;const l=e[i],f={},s={};for(let c=1;c<=a.length;c++)s[c+r]=l[c],f[c+r]=!0,r+=gn(a[c-1]);e[i]=s,e[i]._emit=f,e[i]._multi=!0}function Vo(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Le("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),gt;if(typeof e.beginScope!="object"||e.beginScope===null)throw Le("beginScope must be object"),gt;kn(e,e.begin,{key:"beginScope"}),e.begin=Bt(e.begin,{joinWith:""})}}function Ho(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Le("skip, excludeEnd, returnEnd not compatible with endScope: {}"),gt;if(typeof e.endScope!="object"||e.endScope===null)throw Le("endScope must be object"),gt;kn(e,e.end,{key:"endScope"}),e.end=Bt(e.end,{joinWith:""})}}function Fo(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Wo(e){Fo(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),Vo(e),Ho(e)}function Go(e){function a(s,c){return new RegExp(qe(s),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(c?"g":""))}class i{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(c,u){u.position=this.position++,this.matchIndexes[this.matchAt]=u,this.regexes.push([u,c]),this.matchAt+=gn(c)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const c=this.regexes.map(u=>u[1]);this.matcherRe=a(Bt(c,{joinWith:"|"}),!0),this.lastIndex=0}exec(c){this.matcherRe.lastIndex=this.lastIndex;const u=this.matcherRe.exec(c);if(!u)return null;const g=u.findIndex((b,k)=>k>0&&b!==void 0),y=this.matchIndexes[g];return u.splice(0,g),Object.assign(u,y)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(c){if(this.multiRegexes[c])return this.multiRegexes[c];const u=new i;return this.rules.slice(c).forEach(([g,y])=>u.addRule(g,y)),u.compile(),this.multiRegexes[c]=u,u}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(c,u){this.rules.push([c,u]),u.type==="begin"&&this.count++}exec(c){const u=this.getMatcher(this.regexIndex);u.lastIndex=this.lastIndex;let g=u.exec(c);if(this.resumingScanAtSamePosition()&&!(g&&g.index===this.lastIndex)){const y=this.getMatcher(0);y.lastIndex=this.lastIndex+1,g=y.exec(c)}return g&&(this.regexIndex+=g.position+1,this.regexIndex===this.count&&this.considerAll()),g}}function l(s){const c=new r;return s.contains.forEach(u=>c.addRule(u.begin,{rule:u,type:"begin"})),s.terminatorEnd&&c.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&c.addRule(s.illegal,{type:"illegal"}),c}function f(s,c){const u=s;if(s.isCompiled)return u;[Ro,Bo,Wo,Do].forEach(y=>y(s,c)),e.compilerExtensions.forEach(y=>y(s,c)),s.__beforeBegin=null,[Oo,Io,Lo].forEach(y=>y(s,c)),s.isCompiled=!0;let g=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),g=s.keywords.$pattern,delete s.keywords.$pattern),g=g||/\w+/,s.keywords&&(s.keywords=yn(s.keywords,e.case_insensitive)),u.keywordPatternRe=a(g,!0),c&&(s.begin||(s.begin=/\B|\b/),u.beginRe=a(u.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(u.endRe=a(u.end)),u.terminatorEnd=qe(u.end)||"",s.endsWithParent&&c.terminatorEnd&&(u.terminatorEnd+=(s.end?"|":"")+c.terminatorEnd)),s.illegal&&(u.illegalRe=a(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(y){return Ko(y==="self"?s:y)})),s.contains.forEach(function(y){f(y,u)}),s.starts&&f(s.starts,c),u.matcher=l(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=Re(e.classNameAliases||{}),f(e)}function wn(e){return e?e.endsWithParent||wn(e.starts):!1}function Ko(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(a){return Re(e,{variants:null},a)})),e.cachedVariants?e.cachedVariants:wn(e)?Re(e,{starts:e.starts?Re(e.starts):null}):Object.isFrozen(e)?Re(e):e}var Yo="11.11.1";class Zo extends Error{constructor(a,i){super(a),this.name="HTMLInjectionError",this.html=i}}const Dt=cn,Nn=Re,_n=Symbol("nomatch"),Xo=7,Sn=function(e){const a=Object.create(null),i=Object.create(null),r=[];let l=!0;const f="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]};let c={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:lo};function u(x){return c.noHighlightRe.test(x)}function g(x){let v=x.className+" ";v+=x.parentNode?x.parentNode.className:"";const S=c.languageDetectRe.exec(v);if(S){const C=te(S[1]);return C||(xn(f.replace("{}",S[1])),xn("Falling back to no-highlight mode for this block.",x)),C?S[1]:"no-highlight"}return v.split(/\s+/).find(C=>u(C)||te(C))}function y(x,v,S){let C="",V="";typeof v=="object"?(C=x,S=v.ignoreIllegals,V=v.language):(He("10.7.0","highlight(lang, code, ...args) has been deprecated."),He("10.7.0",`Please use highlight(code, options) instead.
|
|
14
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),V=x,C=v),S===void 0&&(S=!0);const oe={code:C,language:V};re("before:highlight",oe);const ge=oe.result?oe.result:b(oe.language,oe.code,S);return ge.code=oe.code,re("after:highlight",ge),ge}function b(x,v,S,C){const V=Object.create(null);function oe(M,A){return M.keywords[A]}function ge(){if(!B.keywords){ue.addText(Q);return}let M=0;B.keywordPatternRe.lastIndex=0;let A=B.keywordPatternRe.exec(Q),P="";for(;A;){P+=Q.substring(M,A.index);const Y=xe.case_insensitive?A[0].toLowerCase():A[0],ie=oe(B,Y);if(ie){const[ee,X]=ie;if(ue.addText(P),P="",V[Y]=(V[Y]||0)+1,V[Y]<=Xo&&(ze+=X),ee.startsWith("_"))P+=A[0];else{const Ft=xe.classNameAliases[ee]||ee;Ee(A[0],Ft)}}else P+=A[0];M=B.keywordPatternRe.lastIndex,A=B.keywordPatternRe.exec(Q)}P+=Q.substring(M),ue.addText(P)}function ye(){if(Q==="")return;let M=null;if(typeof B.subLanguage=="string"){if(!a[B.subLanguage]){ue.addText(Q);return}M=b(B.subLanguage,Q,!0,Ie[B.subLanguage]),Ie[B.subLanguage]=M._top}else M=h(Q,B.subLanguage.length?B.subLanguage:null);B.relevance>0&&(ze+=M.relevance),ue.__addSublanguage(M._emitter,M.language)}function me(){B.subLanguage!=null?ye():ge(),Q=""}function Ee(M,A){M!==""&&(ue.startScope(A),ue.addText(M),ue.endScope())}function bt(M,A){let P=1;const Y=A.length-1;for(;P<=Y;){if(!M._emit[P]){P++;continue}const ie=xe.classNameAliases[M[P]]||M[P],ee=A[P];ie?Ee(ee,ie):(Q=ee,ge(),Q=""),P++}}function yt(M,A){return M.scope&&typeof M.scope=="string"&&ue.openNode(xe.classNameAliases[M.scope]||M.scope),M.beginScope&&(M.beginScope._wrap?(Ee(Q,xe.classNameAliases[M.beginScope._wrap]||M.beginScope._wrap),Q=""):M.beginScope._multi&&(bt(M.beginScope,A),Q="")),B=Object.create(M,{parent:{value:B}}),B}function Et(M,A,P){let Y=fo(M.endRe,P);if(Y){if(M["on:end"]){const ie=new sn(M);M["on:end"](A,ie),ie.isMatchIgnored&&(Y=!1)}if(Y){for(;M.endsParent&&M.parent;)M=M.parent;return M}}if(M.endsWithParent)return Et(M.parent,A,P)}function Ut(M){return B.matcher.regexIndex===0?(Q+=M[0],1):(Pe=!0,0)}function Vt(M){const A=M[0],P=M.rule,Y=new sn(P),ie=[P.__beforeBegin,P["on:begin"]];for(const ee of ie)if(ee&&(ee(M,Y),Y.isMatchIgnored))return Ut(A);return P.skip?Q+=A:(P.excludeBegin&&(Q+=A),me(),!P.returnBegin&&!P.excludeBegin&&(Q=A)),yt(P,M),P.returnBegin?0:A.length}function Ht(M){const A=M[0],P=v.substring(M.index),Y=Et(B,M,P);if(!Y)return _n;const ie=B;B.endScope&&B.endScope._wrap?(me(),Ee(A,B.endScope._wrap)):B.endScope&&B.endScope._multi?(me(),bt(B.endScope,M)):ie.skip?Q+=A:(ie.returnEnd||ie.excludeEnd||(Q+=A),me(),ie.excludeEnd&&(Q=A));do B.scope&&ue.closeNode(),!B.skip&&!B.subLanguage&&(ze+=B.relevance),B=B.parent;while(B!==Y.parent);return Y.starts&&yt(Y.starts,M),ie.returnEnd?0:A.length}function xt(){const M=[];for(let A=B;A!==xe;A=A.parent)A.scope&&M.unshift(A.scope);M.forEach(A=>ue.openNode(A))}let Ke={};function Je(M,A){const P=A&&A[0];if(Q+=M,P==null)return me(),0;if(Ke.type==="begin"&&A.type==="end"&&Ke.index===A.index&&P===""){if(Q+=v.slice(A.index,A.index+1),!l){const Y=new Error(`0 width match regex (${x})`);throw Y.languageName=x,Y.badRule=Ke.rule,Y}return 1}if(Ke=A,A.type==="begin")return Vt(A);if(A.type==="illegal"&&!S){const Y=new Error('Illegal lexeme "'+P+'" for mode "'+(B.scope||"<unnamed>")+'"');throw Y.mode=B,Y}else if(A.type==="end"){const Y=Ht(A);if(Y!==_n)return Y}if(A.type==="illegal"&&P==="")return Q+=`
|
|
15
|
+
`,1;if($e>1e5&&$e>A.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Q+=P,P.length}const xe=te(x);if(!xe)throw Le(f.replace("{}",x)),new Error('Unknown language: "'+x+'"');const kt=Go(xe);let Qe="",B=C||kt;const Ie={},ue=new c.__emitter(c);xt();let Q="",ze=0,Se=0,$e=0,Pe=!1;try{if(xe.__emitTokens)xe.__emitTokens(v,ue);else{for(B.matcher.considerAll();;){$e++,Pe?Pe=!1:B.matcher.considerAll(),B.matcher.lastIndex=Se;const M=B.matcher.exec(v);if(!M)break;const A=v.substring(Se,M.index),P=Je(A,M);Se=M.index+P}Je(v.substring(Se))}return ue.finalize(),Qe=ue.toHTML(),{language:x,value:Qe,relevance:ze,illegal:!1,_emitter:ue,_top:B}}catch(M){if(M.message&&M.message.includes("Illegal"))return{language:x,value:Dt(v),illegal:!0,relevance:0,_illegalBy:{message:M.message,index:Se,context:v.slice(Se-100,Se+100),mode:M.mode,resultSoFar:Qe},_emitter:ue};if(l)return{language:x,value:Dt(v),illegal:!1,relevance:0,errorRaised:M,_emitter:ue,_top:B};throw M}}function k(x){const v={value:Dt(x),illegal:!1,relevance:0,_top:s,_emitter:new c.__emitter(c)};return v._emitter.addText(x),v}function h(x,v){v=v||c.languages||Object.keys(a);const S=k(x),C=v.filter(te).filter(W).map(me=>b(me,x,!1));C.unshift(S);const V=C.sort((me,Ee)=>{if(me.relevance!==Ee.relevance)return Ee.relevance-me.relevance;if(me.language&&Ee.language){if(te(me.language).supersetOf===Ee.language)return 1;if(te(Ee.language).supersetOf===me.language)return-1}return 0}),[oe,ge]=V,ye=oe;return ye.secondBest=ge,ye}function m(x,v,S){const C=v&&i[v]||S;x.classList.add("hljs"),x.classList.add(`language-${C}`)}function L(x){let v=null;const S=g(x);if(u(S))return;if(re("before:highlightElement",{el:x,language:S}),x.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",x);return}if(x.children.length>0&&(c.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(x)),c.throwUnescapedHTML))throw new Zo("One of your code blocks includes unescaped HTML.",x.innerHTML);v=x;const C=v.textContent,V=S?y(C,{language:S,ignoreIllegals:!0}):h(C);x.innerHTML=V.value,x.dataset.highlighted="yes",m(x,S,V.language),x.result={language:V.language,re:V.relevance,relevance:V.relevance},V.secondBest&&(x.secondBest={language:V.secondBest.language,relevance:V.secondBest.relevance}),re("after:highlightElement",{el:x,result:V,text:C})}function K(x){c=Nn(c,x)}const _=()=>{$(),He("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function F(){$(),He("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let O=!1;function $(){function x(){$()}if(document.readyState==="loading"){O||window.addEventListener("DOMContentLoaded",x,!1),O=!0;return}document.querySelectorAll(c.cssSelector).forEach(L)}function D(x,v){let S=null;try{S=v(e)}catch(C){if(Le("Language definition for '{}' could not be registered.".replace("{}",x)),l)Le(C);else throw C;S=s}S.name||(S.name=x),a[x]=S,S.rawDefinition=v.bind(null,e),S.aliases&&se(S.aliases,{languageName:x})}function I(x){delete a[x];for(const v of Object.keys(i))i[v]===x&&delete i[v]}function j(){return Object.keys(a)}function te(x){return x=(x||"").toLowerCase(),a[x]||a[i[x]]}function se(x,{languageName:v}){typeof x=="string"&&(x=[x]),x.forEach(S=>{i[S.toLowerCase()]=v})}function W(x){const v=te(x);return v&&!v.disableAutodetect}function J(x){x["before:highlightBlock"]&&!x["before:highlightElement"]&&(x["before:highlightElement"]=v=>{x["before:highlightBlock"](Object.assign({block:v.el},v))}),x["after:highlightBlock"]&&!x["after:highlightElement"]&&(x["after:highlightElement"]=v=>{x["after:highlightBlock"](Object.assign({block:v.el},v))})}function le(x){J(x),r.push(x)}function de(x){const v=r.indexOf(x);v!==-1&&r.splice(v,1)}function re(x,v){const S=x;r.forEach(function(C){C[S]&&C[S](v)})}function fe(x){return He("10.7.0","highlightBlock will be removed entirely in v12.0"),He("10.7.0","Please use highlightElement now."),L(x)}Object.assign(e,{highlight:y,highlightAuto:h,highlightAll:$,highlightElement:L,highlightBlock:fe,configure:K,initHighlighting:_,initHighlightingOnLoad:F,registerLanguage:D,unregisterLanguage:I,listLanguages:j,getLanguage:te,registerAliases:se,autoDetection:W,inherit:Nn,addPlugin:le,removePlugin:de}),e.debugMode=function(){l=!1},e.safeMode=function(){l=!0},e.versionString=Yo,e.regex={concat:Be,lookahead:fn,either:It,optional:co,anyNumberOfTimes:so};for(const x in ft)typeof ft[x]=="object"&&ln(ft[x]);return Object.assign(e,ft),e},Fe=Sn({});Fe.newInstance=()=>Sn({});var qo=Fe;Fe.HighlightJS=Fe,Fe.default=Fe;const zt=io(qo);function $t(e){const a=e.regex,i={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:a.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const l={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},f=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},c={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,i,l]};l.contains.push(c);const u={match:/\\"/},g={className:"string",begin:/'/,end:/'/},y={match:/\\'/},b={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,i]},k=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],h=e.SHEBANG({binary:`(${k.join("|")})`,relevance:10}),m={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"],K=["true","false"],_={match:/(\/[a-z._-]+)+/},F=["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"],$=["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"],D=["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:K,built_in:[...F,...O,"set","shopt",...$,...D]},contains:[h,e.SHEBANG(),m,b,f,s,_,c,u,g,y,i]}}const jo=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_-]*/}}),Jo=["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"],Qo=["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"],er=[...Jo,...Qo],tr=["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(),nr=["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(),ir=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),or=["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 rr(e){const a=e.regex,i=jo(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},l="and or not only",f=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",c=[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,r,i.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},i.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+nr.join("|")+")"},{begin:":(:)?("+ir.join("|")+")"}]},i.CSS_VARIABLE,{className:"attribute",begin:"\\b("+or.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[i.BLOCK_COMMENT,i.HEXCOLOR,i.IMPORTANT,i.CSS_NUMBER_MODE,...c,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...c,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},i.FUNCTION_DISPATCH]},{begin:a.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:f},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:l,attribute:tr.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...c,i.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+er.join("|")+")\\b"}]}}function Mn(e){const f={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:f,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:f,illegal:/["']/}]}]}}var We="[0-9](_*[0-9])*",mt=`\\.(${We})`,pt="[0-9a-fA-F](_*[0-9a-fA-F])*",vn={className:"number",variants:[{begin:`(\\b(${We})((${mt})|\\.)?|(${mt}))[eE][+-]?(${We})[fFdD]?\\b`},{begin:`\\b(${We})((${mt})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${mt})[fFdD]?\\b`},{begin:`\\b(${We})[fFdD]\\b`},{begin:`\\b0[xX]((${pt})\\.?|(${pt})?\\.(${pt}))[pP][+-]?(${We})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${pt})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Cn(e,a,i){return i===-1?"":e.replace(a,r=>Cn(e,a,i-1))}function ar(e){const a=e.regex,i="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=i+Cn("(?:<"+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"]},g={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:[a.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:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:u,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,contains:[g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,vn,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},vn,g]}}const Tn="[A-Za-z$_][0-9A-Za-z$_]*",lr=["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"],sr=["true","false","null","undefined","NaN","Infinity"],An=["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"],Rn=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],On=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],cr=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],dr=[].concat(On,An,Rn);function In(e){const a=e.regex,i=(S,{after:C})=>{const V="</"+S[0].slice(1);return S.input.indexOf(V,C)!==-1},r=Tn,l={begin:"<>",end:"</>"},f=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(S,C)=>{const V=S[0].length+S.index,oe=S.input[V];if(oe==="<"||oe===","){C.ignoreMatch();return}oe===">"&&(i(S,{after:V})||C.ignoreMatch());let ge;const ye=S.input.substring(V);if(ge=ye.match(/^\s*=/)){C.ignoreMatch();return}if((ge=ye.match(/^\s+extends\s+/))&&ge.index===0){C.ignoreMatch();return}}},c={$pattern:Tn,keyword:lr,literal:sr,built_in:dr,"variable.language":cr},u="[0-9](_?[0-9])*",g=`\\.(${u})`,y="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",b={className:"number",variants:[{begin:`(\\b(${y})((${g})|\\.)?|(${g}))[eE][+-]?(${u})\\b`},{begin:`\\b(${y})\\b((${g})\\b|\\.)?|(${g})\\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},k={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"css"}},L={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"graphql"}},K={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,k]},F={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\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,h,m,L,K,{match:/\$\d+/},b];k.contains=O.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(O)});const $=[].concat(F,k.contains),D=$.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat($)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:D},j={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,a.concat(r,"(",a.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},te={relevance:0,match:a.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:{_:[...An,...Rn]}},se={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},W={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},J={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function le(S){return a.concat("(?!",S.join("|"),")")}const de={match:a.concat(/\b/,le([...On,"super","import"].map(S=>`${S}\\s*\\(`)),r,a.lookahead(/\s*\(/)),className:"title.function",relevance:0},re={begin:a.concat(/\./,a.lookahead(a.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},fe={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",v={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,a.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:D,CLASS_REFERENCE:te},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),se,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,L,K,F,{match:/\$\d+/},b,te,{scope:"attr",match:r+a.lookahead(":"),relevance:0},v,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[F,e.REGEXP_MODE,{className:"function",begin:x,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:c,contains:D}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:l.begin,end:l.end},{match:f},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},W,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},re,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},de,J,j,fe,{match:/\$[(.]/}]}}function ur(e){const a={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},i={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],l={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[a,i,e.QUOTE_STRING_MODE,l,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function Bn(e){const a=e.regex,i={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},l={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}]},f={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},c=/[A-Za-z][A-Za-z0-9+.-]*/,u={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:a.concat(/\[.+?\]\(/,c,/:\/\/.*?\)/),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}]},g={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}]},b=e.inherit(g,{contains:[]}),k=e.inherit(y,{contains:[]});g.contains.push(k),y.contains.push(b);let h=[i,u];return[g,y,b,k].forEach(_=>{_.contains=_.contains.concat(h)}),h=h.concat(g,y),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:h},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:h}]}]},i,f,g,y,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},l,r,u,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Ln(e){const a=e.regex,i=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],c={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],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:/^(>>>|\.\.\.) /},g={className:"subst",begin:/\{/,end:/\}/,keywords:c,illegal:/#/},y={begin:/\{\{/,relevance:0},b={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,g]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,u,y,g]},{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,g]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,y,g]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},k="[0-9](_?[0-9])*",h=`(\\b(${k}))?\\.(${k})|\\b(${k})\\.`,m=`\\b|${r.join("|")}`,L={className:"number",relevance:0,variants:[{begin:`(\\b(${k})|(${h}))[eE][+-]?(${k})[jJ]?(?=${m})`},{begin:`(${h})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${k})[jJ](?=${m})`}]},K={className:"comment",begin:a.lookahead(/# type:/),end:/$/,keywords:c,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},_={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",u,L,b,e.HASH_COMMENT_MODE]}]};return g.contains=[b,L,u],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:c,illegal:/(<\/|\?)|=>/,contains:[u,L,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},b,K,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[_]},{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,_,b]}]}}function Dn(e){const a=e.regex,i=/(r#)?/,r=a.concat(i,e.UNDERSCORE_IDENT_RE),l=a.concat(i,e.IDENT_RE),f={className:"title.function.invoke",relevance:0,begin:a.concat(/\b/,/(?!let|for|while|if|else|match\b)/,l,a.lookahead(/\s*\(/))},s="([ui](8|16|32|64|128|size)|f(32|64))?",c=["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"],g=["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:c,literal:u,built_in:g},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_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:g,type:y}},{className:"punctuation",begin:"->"},f]}}function fr(e){const a=e.regex,i=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},l={begin:/"/,end:/"/,contains:[{match:/""/}]},f=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],c=["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"],g=["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"],b=["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"],k=["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"],h=y,m=[...g,...u].filter(D=>!y.includes(D)),L={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},K={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:a.concat(/\b/,a.either(...h),/\s*\(/),relevance:0,keywords:{built_in:h}};function F(D){return a.concat(/\b/,a.either(...D.map(I=>I.replace(/\s+/,"\\s+"))),/\b/)}const O={scope:"keyword",match:F(k),relevance:0};function $(D,{exceptions:I,when:j}={}){const te=j;return I=I||[],D.map(se=>se.match(/\|\d+$/)||I.includes(se)?se:te(se)?`${se}|0`:se)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:$(m,{when:D=>D.length<3}),literal:f,type:c,built_in:b},contains:[{scope:"type",match:F(s)},O,_,L,r,l,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,i,K]}}const ht="[A-Za-z$_][0-9A-Za-z$_]*",zn=["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"],$n=["true","false","null","undefined","NaN","Infinity"],Pn=["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"],Un=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Vn=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Hn=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Fn=[].concat(Vn,Pn,Un);function gr(e){const a=e.regex,i=(S,{after:C})=>{const V="</"+S[0].slice(1);return S.input.indexOf(V,C)!==-1},r=ht,l={begin:"<>",end:"</>"},f=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(S,C)=>{const V=S[0].length+S.index,oe=S.input[V];if(oe==="<"||oe===","){C.ignoreMatch();return}oe===">"&&(i(S,{after:V})||C.ignoreMatch());let ge;const ye=S.input.substring(V);if(ge=ye.match(/^\s*=/)){C.ignoreMatch();return}if((ge=ye.match(/^\s+extends\s+/))&&ge.index===0){C.ignoreMatch();return}}},c={$pattern:ht,keyword:zn,literal:$n,built_in:Fn,"variable.language":Hn},u="[0-9](_?[0-9])*",g=`\\.(${u})`,y="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",b={className:"number",variants:[{begin:`(\\b(${y})((${g})|\\.)?|(${g}))[eE][+-]?(${u})\\b`},{begin:`\\b(${y})\\b((${g})\\b|\\.)?|(${g})\\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},k={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"css"}},L={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,k],subLanguage:"graphql"}},K={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,k]},F={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\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,h,m,L,K,{match:/\$\d+/},b];k.contains=O.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(O)});const $=[].concat(F,k.contains),D=$.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat($)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:D},j={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,a.concat(r,"(",a.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},te={relevance:0,match:a.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:{_:[...Pn,...Un]}},se={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},W={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},J={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function le(S){return a.concat("(?!",S.join("|"),")")}const de={match:a.concat(/\b/,le([...Vn,"super","import"].map(S=>`${S}\\s*\\(`)),r,a.lookahead(/\s*\(/)),className:"title.function",relevance:0},re={begin:a.concat(/\./,a.lookahead(a.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},fe={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",v={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,a.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:D,CLASS_REFERENCE:te},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),se,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,L,K,F,{match:/\$\d+/},b,te,{scope:"attr",match:r+a.lookahead(":"),relevance:0},v,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[F,e.REGEXP_MODE,{className:"function",begin:x,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:c,contains:D}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:l.begin,end:l.end},{match:f},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},W,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},re,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},de,J,j,fe,{match:/\$[(.]/}]}}function Wn(e){const a=e.regex,i=gr(e),r=ht,l=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],f={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:l},contains:[i.exports.CLASS_REFERENCE]},c={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},u=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],g={$pattern:ht,keyword:zn.concat(u),literal:$n,built_in:Fn.concat(l),"variable.language":Hn},y={className:"meta",begin:"@"+r},b=(L,K,_)=>{const F=L.contains.findIndex(O=>O.label===K);if(F===-1)throw new Error("can not find mode to replace");L.contains.splice(F,1,_)};Object.assign(i.keywords,g),i.exports.PARAMS_CONTAINS.push(y);const k=i.contains.find(L=>L.scope==="attr"),h=Object.assign({},k,{match:a.concat(r,a.lookahead(/\s*\?:/))});i.exports.PARAMS_CONTAINS.push([i.exports.CLASS_REFERENCE,k,h]),i.contains=i.contains.concat([y,f,s,h]),b(i,"shebang",e.SHEBANG()),b(i,"use_strict",c);const m=i.contains.find(L=>L.label==="func.def");return m.relevance=0,Object.assign(i,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),i}function Gn(e){const a=e.regex,i=a.concat(/[\p{L}_]/u,a.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,l={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},f={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=e.inherit(f,{begin:/\(/,end:/\)/}),c=e.inherit(e.APOS_STRING_MODE,{className:"string"}),u=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),g={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[l]},{begin:/'/,end:/'/,contains:[l]},{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:[f,u,c,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[f,s,u,c]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},l,{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:[g],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[g],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:a.concat(/</,a.lookahead(a.concat(i,a.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:i,relevance:0,starts:g}]},{className:"tag",begin:a.concat(/<\//,a.lookahead(a.concat(i,/>/))),contains:[{className:"name",begin:i,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Kn(e){const a="true false yes no null",i="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},l={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},f={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},s={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,l]},c=e.inherit(s,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),k={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"},h={end:",",endsWithParent:!0,excludeEnd:!0,keywords:a,relevance:0},m={begin:/\{/,end:/\}/,contains:[h],illegal:"\\n",relevance:0},L={begin:"\\[",end:"\\]",contains:[h],illegal:"\\n",relevance:0},K=[r,{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:a,keywords:{literal:a}},k,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,L,f,s],_=[...K];return _.pop(),_.push(c),h.contains=_,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:K}}const Pt={bash:$t,sh:$t,shell:$t,css:rr,go:Mn,golang:Mn,java:ar,javascript:In,js:In,json:ur,markdown:Bn,md:Bn,python:Ln,py:Ln,rust:Dn,rs:Dn,sql:fr,typescript:Wn,ts:Wn,xml:Gn,html:Gn,yaml:Kn,yml:Kn};for(const[e,a]of Object.entries(Pt))zt.registerLanguage(e,a);function Yn(e){const a=e.split(`
|
|
16
|
+
`);return/^(`{3,}|~{3,})/.test(a[0]??"")&&a.shift(),/^(`{3,}|~{3,})\s*$/.test(a[a.length-1]??"")&&a.pop(),a.join(`
|
|
17
|
+
`).replace(/\n+$/,"")}function Zn(e){const a=/^(`{3,}|~{3,})([^\s`~]*)/.exec(e.split(`
|
|
18
|
+
`)[0]??""),i=((a==null?void 0:a[2])??"").toLowerCase();return i&&Pt[i]?i:""}function mr(e,a){const i=a&&Pt[a]?a:"";try{return i?zt.highlight(e,{language:i,ignoreIllegals:!0}).value:zt.highlightAuto(e).value}catch{return hr(e)}}function pr(e){return e.split(`
|
|
19
|
+
`).filter(a=>a.trim().length>0).filter(a=>!/^\s*\|?\s*(:?-+:?\s*\|\s*)+(:?-+:?)(\s*\|)?\s*$/.test(a)).map(a=>a.replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|").map(i=>i.trim()))}function hr(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function br(e,a,i){if(e.length<=1)return e.slice();const[r,...l]=e,f=l.map(g=>g[a]??""),s=f.length>0&&f.every(g=>g.trim()!==""&&!Number.isNaN(Number(g))),c=i==="asc"?1:-1,u=l.slice().sort((g,y)=>{const b=g[a]??"",k=y[a]??"";return s?(Number(b)-Number(k))*c:b.localeCompare(k,"zh-Hans-CN",{numeric:!0})*c});return[r,...u]}const yr=["viewBox","width","height"],Er={class:"zm-edges"},xr=["d","fill"],kr=["data-node-id","onClick","onDblclick","onContextmenu","onMouseenter","onMouseleave"],wr=["src","width","height","alt"],Nr=["onDblclick"],_r={key:0,class:"zm-rich-code"},Sr=["innerHTML"],Mr={key:1,class:"zm-rich-table"},vr=["onClick"],Cr={class:"zm-rich-sort-mark","aria-hidden":"true"},Tr={key:2,class:"zm-text"},Ar={class:"zm-text-label"},Rr=["href","title"],Or=["title","onClick"],Ir=["title"],Br=["title","onClick"],Lr=["onClick"],Dr=["onMousedown"],zr=["onClick"],$r={class:"zm-tb-tip zm-tb-zoom"},Pr=["src"],Ur=["src"],De=24,Ge=400,Oe=160,Xn=t.defineComponent({__name:"MindMap",props:{data:{},theme:{},previewMode:{type:Boolean,default:!1},markdown:{},lineColors:{}},emits:["change","select","edit-note","markdownChange","canvas-settings"],setup(e,{expose:a,emit:i}){const r=e,l=i,f=t.ref(null),s=t.ref(null),c=t.ref(""),u=t.ref(null),g=t.ref(new Set),y=t.ref(!1),b=t.ref(null),k=t.ref(""),h=t.ref(new Map),m=t.ref(Ce(r.data)),L=t.ref({}),K=t.ref({}),_=t.ref(r.markdown!==void 0);let F=!1;t.watch(()=>r.markdown,n=>{if(n===void 0){_.value=!1;return}_.value=!0;const o=Rt(n||"");F=!0,m.value=Ce(o),u.value=null,g.value=new Set,X(),t.nextTick(()=>{F=!1,Te()})}),t.watch(m,()=>{_.value&&!F&&l("markdownChange",dt(m.value))},{deep:!0});const O=t.computed(()=>R.showOrderBadge===!0),$=t.ref(new Map),D=$.value;function I(n,o){const d={};o.bg&&(d.bg=o.bg),o.textColor&&(d.textColor=o.textColor),o.borderColor&&(d.borderColor=o.borderColor),o.fontWeight&&(d.fontWeight=o.fontWeight),Object.keys(d).length===0?D.delete(n):D.set(n,d),$.value=new Map(D)}function j(n){return D.get(n)??{}}function te(n,o){const d=H(m.value,n);d&&(d.image={src:o.src,naturalW:o.naturalW,naturalH:o.naturalH,width:J(o.width,De,Ge),height:J(o.height,De,Ge)},ee(),X(),l("change",m.value))}function se(n){const o=H(m.value,n);!o||!o.image||(delete o.image,ee(),X(),l("change",m.value))}function W(n,o){const d=o.trim();if(!H(m.value,n))return;if(!d){se(n);return}const E=new Image;E.onload=()=>{const N=H(m.value,n);if(!N)return;const T=E.naturalWidth&&E.naturalHeight?E.naturalWidth/E.naturalHeight:1,z=J(E.naturalWidth||Oe,De,Ge),q=Math.round(z/T);N.image={src:d,naturalW:E.naturalWidth||z,naturalH:E.naturalHeight||q,width:z,height:q},ee(),X(),l("change",m.value)},E.onerror=()=>{},E.src=d}function J(n,o,d){return Math.min(d,Math.max(o,n))}function le(n,o){const d=new FileReader;d.onload=()=>{if(typeof d.result!="string")return;const w=d.result,E=new window.Image;E.onload=()=>{const N=E.naturalWidth||Oe,T=E.naturalHeight||Oe,z=J(N,De,Oe),q=J(Math.round(T*z/N),De,Ge);o({src:w,naturalW:N,naturalH:T,width:z,height:q})},E.onerror=()=>{o({src:w,naturalW:Oe,naturalH:Oe,width:Oe,height:Oe})},E.src=w},d.readAsDataURL(n)}function de(n){const o=document.createElement("input");o.type="file",o.accept="image/*",o.style.display="none",o.onchange=()=>{var w;const d=(w=o.files)==null?void 0:w[0];d&&(le(d,E=>te(n,E)),document.body.removeChild(o))},document.body.appendChild(o),o.click()}function re(n,o){const d=o.trim(),w=H(m.value,n);w&&(d?w.link={url:d}:delete w.link,ee(),X(),l("change",m.value))}function fe(n){re(n,"")}function x(n,o){const d=H(m.value,n);d&&(o?d.note={text:o}:delete d.note,ee(),X(),l("change",m.value))}function v(n){x(n,"")}function S(n,o){const d=H(m.value,n);d&&(o?d.richContent=o:delete d.richContent,ee(),X(),l("change",m.value))}const C=t.ref(null),V=t.ref(null);function oe(n,o){r.previewMode||(n.preventDefault(),n.stopPropagation(),u.value=o.id,l("select",H(m.value,o.id)),C.value={nodeId:o.id,x:n.clientX,y:n.clientY})}function ge(){C.value=null}function ye(n){r.previewMode||(n.preventDefault(),C.value=null,V.value={x:n.clientX,y:n.clientY})}function me(){V.value=null}function Ee(){V.value=null,l("canvas-settings")}function bt(){var o;const n=(o=C.value)==null?void 0:o.nodeId;n&&de(n)}function yt(){var w,E,N;const n=(w=C.value)==null?void 0:w.nodeId;if(!n)return;const o=((N=(E=H(m.value,n))==null?void 0:E.link)==null?void 0:N.url)??"",d=window.prompt("输入链接 URL(留空取消)",o);d!==null&&re(n,d)}function Et(){var o;const n=(o=C.value)==null?void 0:o.nodeId;n&&fe(n)}function Ut(){var o;const n=(o=C.value)==null?void 0:o.nodeId;n&&kt(n)}function Vt(){var o;const n=(o=C.value)==null?void 0:o.nodeId;n&&v(n)}function Ht(){var o;const n=(o=C.value)==null?void 0:o.nodeId;n&&se(n)}function xt(){var G,ke;const n=(G=C.value)==null?void 0:G.nodeId;if(!n)return;const o=(ke=H(m.value,n))==null?void 0:ke.richContent,d=(o==null?void 0:o.kind)==="code"?Yn(o.raw):"",w=(o==null?void 0:o.kind)==="code"&&o.lang||"",E=w?"```"+w+`
|
|
20
|
+
`:"```\n",T=window.prompt("输入代码块内容(用 ```lang 包裹;留空取消)",d?E+d+(d.endsWith("```")?"":"\n```"):E+"// 你的代码"+"\n```");if(T===null)return;const z=T.trim();if(!z){S(n,null);return}const q=/^```([^\s`]*)/.exec(z),p=q?q[1]:void 0;S(n,{kind:"code",raw:z,lang:p})}function Ke(){var o;const n=(o=C.value)==null?void 0:o.nodeId;n&&S(n,null)}function Je(){var T,z;const n=(T=C.value)==null?void 0:T.nodeId;if(!n)return;const o=(z=H(m.value,n))==null?void 0:z.richContent,d=(o==null?void 0:o.kind)==="table"?o.raw:"",E=window.prompt("输入 markdown 表格(每行以 | 分隔;留空取消)",d||`| 列1 | 列2 | 列3 |
|
|
21
21
|
| --- | --- | --- |
|
|
22
|
-
| a | b | c |`);if(E===null)return;const _=E.trim();if(!_){M(n,null);return}M(n,{kind:"table",raw:_})}function Ut(){var o;const n=(o=R.value)==null?void 0:o.nodeId;n&&M(n,null)}function Et(n){a.previewMode||l("edit-note",n)}function Ve(n,o=60){const c=n.replace(/\s+/g," ").trim();return c.length<=o?c||"点击编辑笔记":c.slice(0,o)+"…"}function Xe(n){var E;if(a.previewMode||s.value)return;const o=n.target;if(o&&(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable))return;const c=u.value;if(!c)return;const N=(E=n.clipboardData)==null?void 0:E.items;if(N)for(let _=0;_<N.length;_++){const A=N[_];if(A.kind==="file"&&A.type.startsWith("image/")){const $=A.getAsFile();if(!$)continue;n.preventDefault();const q=V(m.value,c);if(q!=null&&q.image&&!window.confirm("该节点已有图片,要用剪贴板里的图片替换吗?"))return;re($,p=>ee(c,p));return}}}t.onMounted(()=>{window.addEventListener("paste",Xe),C()}),t.onBeforeUnmount(()=>{window.removeEventListener("paste",Xe)});const fe=t.ref(null),Vt=t.computed(()=>{var n;return((n=fe.value)==null?void 0:n.nodeId)??null});function qe(n,o){if(!o.image)return;n.preventDefault(),n.stopPropagation();const c=o.image.naturalW||o.image.width,N=o.image.naturalH||o.image.height,E=N>0?N/c:1;fe.value={nodeId:o.id,startX:n.clientX,startY:n.clientY,startW:o.image.width,startH:o.image.height,naturalW:c,naturalH:N,ratio:E,pendingW:o.image.width,pendingH:o.image.height},window.addEventListener("mousemove",L),window.addEventListener("mouseup",je)}function L(n){var q,p;const o=fe.value;if(!o)return;const c=U.scale.value||1,N=n.clientX-o.startX,E=J(o.startW+N/c,Oe,Ue),_=J(E*o.ratio,Oe,Ue);o.pendingW=E,o.pendingH=_;const A=(q=f.value)==null?void 0:q.querySelector(`[data-node-id="${o.nodeId}"] .zm-node-img`);A&&(A.style.width=`${E}px`,A.style.height=`${_}px`);const $=(p=f.value)==null?void 0:p.querySelector(`[data-node-id="${o.nodeId}"]`);$&&($.style.minWidth=`${Math.max(80,Math.ceil(E+28))}px`,$.style.height=`${Math.ceil(_+8+30)}px`)}function je(){const n=fe.value;if(window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",je),fe.value=null,!n)return;const o=V(m.value,n.nodeId);!o||!o.image||(ee(n.nodeId,{src:o.image.src,naturalW:o.image.naturalW,naturalH:o.image.naturalH,width:n.pendingW,height:n.pendingH}),u.value=n.nodeId,l("select",o),X=!0)}const ae=t.ref(null);let X=!1;function He(n){ae.value=n}function Se(n){ae.value===n&&(ae.value=null)}const Ie=t.ref(0),Be=t.ref(!1),w=qi(100);function v(){w.record({data:m.value})}function C(){g.value=new Set(g.value),Ie.value++,t.nextTick().then(()=>t.nextTick()).then(()=>Z()).then(()=>{Ie.value++})}function Z(){const n=document.querySelectorAll(".zm-rich"),o={},c={};n.forEach(N=>{let E=N,_=null;for(;E&&!_;)_=E.getAttribute("data-node-id"),E=E.parentElement;if(!_)return;const A=N.offsetHeight,$=N.scrollWidth,q=Math.round(A*2)/2,p=Math.round($*2)/2;o[_]=q,c[_]=p,D.value[_],G.value[_]}),D.value=o,G.value=c}const Q=t.computed(()=>{var n,o,c,N,E,_,A,$,q,p;return{rootBg:((n=a.theme)==null?void 0:n.rootBg)??"#1f2937",rootText:((o=a.theme)==null?void 0:o.rootText)??"#ffffff",branchBg:((c=a.theme)==null?void 0:c.branchBg)??"#ffffff",branchText:((N=a.theme)==null?void 0:N.branchText)??"#1f2937",lineColor:((E=a.theme)==null?void 0:E.lineColor)??"#94a3b8",bgColor:((_=a.theme)==null?void 0:_.bgColor)??"#f8fafc",fontSize:((A=a.theme)==null?void 0:A.fontSize)??14,lineWidthStart:(($=a.theme)==null?void 0:$.lineWidthStart)??2.2,lineWidthEnd:((q=a.theme)==null?void 0:q.lineWidthEnd)??.8,rainbowBranch:((p=a.theme)==null?void 0:p.rainbowBranch)??!1}}),O=t.reactive({autoBalanceOnChange:!0,lineWidthStart:12,lineWidthEnd:3.6,rainbowBranch:!0,branchPaletteId:"default",customPalettes:[],lineStyle:"curve",layoutMode:"mindmap",taperedEdge:!0,showOrderBadge:!1});function yt(n){return O.taperedEdge?zr(n):Yn(n)}function xt(n){return O.taperedEdge?O.lineWidthEnd:Yn(n)}function zr(n){return n<=0?O.lineWidthStart:n===1?Math.max(1.5,O.lineWidthStart*.67):n===2?Math.max(.8,O.lineWidthStart*.42):O.lineWidthEnd}function Yn(n){if(n<=0)return O.lineWidthStart;if(n>=3)return O.lineWidthEnd;const o=n/3;return O.lineWidthStart+(O.lineWidthEnd-O.lineWidthStart)*o}function $r(n,o,c,N){const E=1-n,_=E*E*E*o.x+3*E*E*n*c.x1+3*E*n*n*c.x2+n*n*n*N.x,A=E*E*E*o.y+3*E*E*n*c.y1+3*E*n*n*c.y2+n*n*n*N.y;return{x:_,y:A}}function Pr(n,o,c,N,E=32,_="curve",A="right"){if(_==="curve"){let we;if(A==="right"||A==="left"){const oe=Math.abs(o.x-n.x)*.45,ve=A==="right"?1:-1;we={x1:n.x+ve*oe,y1:n.y,x2:o.x-ve*oe,y2:o.y}}else{const oe=Math.abs(o.y-n.y)*.45;we={x1:n.x,y1:n.y+oe,x2:o.x,y2:o.y-oe}}const ui=Y=>{const oe=1-Y,ve=-3*oe*oe*n.x+3*(oe*oe-2*oe*Y)*we.x1+3*(2*oe*Y-Y*Y)*we.x2+3*Y*Y*o.x,We=-3*oe*oe*n.y+3*(oe*oe-2*oe*Y)*we.y1+3*(2*oe*Y-Y*Y)*we.y2+3*Y*Y*o.y;return{dx:ve,dy:We}},it=[],Zt=[];for(let Y=0;Y<=E;Y++){const oe=Y/E,ve=Y===0?n:Y===E?o:$r(oe,n,we,o),We=ui(oe);let St=Math.hypot(We.dx,We.dy);St<1e-6&&(St=1);const fi=-We.dy/St,gi=We.dx/St,Mt=(c+(N-c)*oe)/2;it.push({x:ve.x+fi*Mt,y:ve.y+gi*Mt}),Zt.push({x:ve.x-fi*Mt,y:ve.y-gi*Mt})}let _t=`M ${it[0].x.toFixed(2)} ${it[0].y.toFixed(2)}`;for(let Y=1;Y<=E;Y++)_t+=` L ${it[Y].x.toFixed(2)} ${it[Y].y.toFixed(2)}`;for(let Y=E;Y>=0;Y--)_t+=` L ${Zt[Y].x.toFixed(2)} ${Zt[Y].y.toFixed(2)}`;return _t+=" Z",_t}const $=o.x-n.x,q=o.y-n.y;let p=Math.hypot($,q);p<1e-6&&(p=1);const W=-q/p,ye=$/p,Ne=c/2,me=N/2,Qe={x:n.x+W*Ne,y:n.y+ye*Ne},et={x:n.x-W*Ne,y:n.y-ye*Ne},tt={x:o.x-W*me,y:o.y-ye*me},nt={x:o.x+W*me,y:o.y+ye*me};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 kt=t.computed(()=>pe.value.root.children),Ur=Ge[0].colors,Xn=t.computed(()=>Pi(O.branchPaletteId,O.customPalettes)),Le=t.computed(()=>{const n=new Map;if(!O.rainbowBranch)return n;const o=a.lineColors,c=o&&o.length>0?o:Xn.value.colors.length>0?Xn.value.colors:Ur;for(let E=0;E<kt.value.length;E++){const _=kt.value[E];n.set(_.id,c[E%c.length])}const N=(E,_)=>{n.set(E.id,_);for(const A of E.children)N(A,_)};for(let E=0;E<kt.value.length;E++){const _=kt.value[E];N(_,c[E%c.length])}return n});function Vr(n,o){return O.rainbowBranch?Le.value.get(o.id)??Q.value.lineColor:Q.value.lineColor}function Hr(n){const o=j(n.id);if(o.bg)return o.bg;if(n.isRoot)return Q.value.rootBg;if(O.rainbowBranch){const c=Le.value.get(n.id);if(c)return Kr(c,.18)}return Q.value.branchBg}function Fr(n){const o=j(n.id);if(o.textColor)return o.textColor;if(n.isRoot)return Q.value.rootText;if(O.rainbowBranch){const c=Le.value.get(n.id);if(c)return qn(c,.55)}return Q.value.branchText}function Wr(n){const o=j(n.id);if(o.borderColor)return o.borderColor;if(n.isRoot)return Q.value.rootBg;if(O.rainbowBranch){const c=Le.value.get(n.id);if(c)return qn(c,.3)}return Q.value.lineColor}function Gr(n){return j(n.id).fontWeight??(n.isRoot?600:400)}function Kr(n,o){const c=n.replace("#",""),N=c.length===6?c:c.split("").map($=>$+$).join(""),E=parseInt(N.slice(0,2),16),_=parseInt(N.slice(2,4),16),A=parseInt(N.slice(4,6),16);return`rgba(${E}, ${_}, ${A}, ${o})`}function qn(n,o){const c=n.replace("#",""),N=c.length===6?c:c.split("").map($=>$+$).join(""),E=Math.round(parseInt(N.slice(0,2),16)*(1-o)),_=Math.round(parseInt(N.slice(2,4),16)*(1-o)),A=Math.round(parseInt(N.slice(4,6),16)*(1-o));return`rgb(${E}, ${_}, ${A})`}const U=Zi({getContainer:()=>f.value});U.setOnMarqueeEnd(ua),Xi({isEditing:()=>s.value!==null,isReadonly:()=>a.previewMode,getSelectedId:()=>u.value,getRootId:()=>m.value.id,defaultTargetId:()=>m.value.id,onAddChild:Fe,onAddSibling:wt,onAddSiblingBefore:ei,onRemove:ni,onStartEdit:Je,onClearSelection:()=>{u.value=null,l("select",null)},onDuplicate:ti,onUndo:Ft,onRedo:Wt,onNavigate:ia,onSelectRoot:()=>{u.value=m.value.id;const n=V(m.value,m.value.id);n&&l("select",n)}});const pe=t.computed(()=>{const n=_e(m.value);return Jn(n),Li(n,{mode:O.layoutMode,baseFontSize:Q.value.fontSize,richHeights:D.value,richWidths:G.value})}),jn=t.ref([]),Ht=t.computed(()=>(Ie.value,jn.value));t.watch(pe,n=>{const o=[],c=N=>{o.push(N);for(const E of N.children)c(E)};c(n.root),jn.value=o},{immediate:!0});const Zr=t.computed(()=>{const n=[];for(const o of Ht.value)for(const c of o.children)n.push({from:o,to:c,key:`${o.id}->${c.id}`});return n}),Yr=t.computed(()=>`${pe.value.vbX} ${pe.value.vbY} ${pe.value.vbW} ${pe.value.vbH}`);function Jn(n){if(g.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=V(m.value,n);o&&(s.value=n,d.value=o.text,t.nextTick(()=>{const c=document.querySelector(".zm-input");c==null||c.focus(),c==null||c.select()}))}function Nt(n={}){if(!s.value)return;const o=V(m.value,s.value);o&&o.text!==(d.value.trim()||" ")&&(o.text=d.value.trim()||" ",v(),l("change",m.value));const c=s.value;s.value=null,n.addChild?t.nextTick(()=>Fe(c)):n.addSibling==="after"?t.nextTick(()=>wt(c)):n.addSibling==="before"&&t.nextTick(()=>ei(c))}function Xr(){s.value=null}function qr(n){if(a.previewMode)return;const o=V(m.value,n);o!=null&&o.richContent&&(b.value=n,k.value=o.richContent.raw,t.nextTick(()=>{const c=document.querySelector(".zm-node .zm-rich textarea");c==null||c.focus()}))}function Qn(){if(!b.value)return;const n=b.value,o=V(m.value,n),c=k.value;if(o&&o.richContent&&o.richContent.raw!==c)if(o.richContent.kind==="code"){const N=Kn(c)||void 0;M(n,{kind:"code",raw:c,lang:N})}else M(n,{kind:"table",raw:c});b.value=null}function jr(){b.value=null}function Jr(n){n.key==="Escape"?(n.preventDefault(),jr()):n.key==="Enter"&&(n.ctrlKey||n.metaKey)&&(n.preventDefault(),Qn())}function Qr(n,o){const c=h.value.get(n);!c||c.col!==o?h.value.set(n,{col:o,dir:"asc"}):c.dir==="asc"?h.value.set(n,{col:o,dir:"desc"}):h.value.delete(n)}function ea(n,o){const c=h.value.get(n);return!c||o.length<=1?o:fr(o,c.col,c.dir)}function ta(n,o){const c=h.value.get(n);return!c||c.col!==o?"↕":c.dir==="asc"?"▲":"▼"}function na(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 Fe(n){const o=en(m.value,n,lt);o&&(v(),C(),l("change",m.value),t.nextTick(()=>Je(o.id)))}function wt(n){if(n===m.value.id){Fe(n);return}const o=tn(m.value,n,lt);o&&(v(),C(),l("change",m.value),t.nextTick(()=>Je(o.id)))}function ei(n){if(n===m.value.id){Fe(n);return}const o=Hi(m.value,n,lt);o&&(v(),C(),l("change",m.value),t.nextTick(()=>Je(o.id)))}function ti(n){if(n===m.value.id)return;const o=Fi(m.value,n);o&&(v(),u.value=o.id,l("change",m.value),C())}function Ft(){const n=w.undo();n&&(m.value=n.data,u.value=null,l("select",null),C(),l("change",m.value))}function Wt(){const n=w.redo();n&&(m.value=n.data,u.value=null,l("select",null),C(),l("change",m.value))}function ia(n,o){const c=u.value??m.value.id,N=V(m.value,c);if(!N)return;let E=null;if(o===1){const _=xe(m.value,N.id);if(_){const A=_.children.findIndex($=>$.id===N.id);A>=0&&A<_.children.length-1&&(E=_.children[A+1].id)}}else if(o===-1){const _=xe(m.value,N.id);if(_){const A=_.children.findIndex($=>$.id===N.id);A>0&&(E=_.children[A-1].id)}}else if(n===1){const _=xe(m.value,N.id);_&&(E=_.id)}else n===-1&&N.children.length>0&&(E=N.children[0].id);if(E){u.value=E;const _=V(m.value,E);_&&l("select",_)}}function ni(n){n!==m.value.id&&Tt(m.value,n)&&(v(),u.value===n&&(u.value=null),C(),l("change",m.value))}function ii(n){g.value.has(n)?g.value.delete(n):g.value.add(n),C()}function oi(n){const o=[{n:m.value,depth:1}];for(;o.length;){const{n:c,depth:N}=o.pop();n(c,N);for(let E=c.children.length-1;E>=0;E--)o.push({n:c.children[E],depth:N+1})}}function oa(){g.value=new Set,oi(n=>{n.children.length>0&&g.value.add(n.id)}),C()}function ri(n){g.value=new Set,oi((o,c)=>{c>n&&o.children.length>0&&g.value.add(o.id)}),C()}function ra(){g.value=new Set,C()}function aa(n,o){Ui(m.value,n,o)&&(v(),C(),l("change",m.value))}function la(n,o,c){return Vi(m.value,n,o,c)?(v(),C(),l("change",m.value),!0):!1}function sa(n,o){n.stopPropagation(),u.value=o.id;const c=V(m.value,o.id);l("select",c)}function ca(n){const o=n.target;if(!o||o.closest(".zm-node, .zm-toolbar, button, input, textarea"))return;if(n.button===2){U.startPan(n);return}if(n.button!==0)return;const c=f.value.getBoundingClientRect(),N=(n.clientX-c.left-U.offsetX.value)/U.scale.value,E=(n.clientY-c.top-U.offsetY.value)/U.scale.value;U.startMarquee(N,E)}function da(n){if(X){X=!1;return}const o=n.target;if(!o||o.closest(".zm-node"))return;const c=U.marquee;c.width>=4||c.height>=4||u.value!==null&&(u.value=null,l("select",null))}function ua(){const n=U.marquee;if(n.width<4&&n.height<4)return;const o=n.x,c=n.y,N=n.x+n.width,E=n.y+n.height,_=[];for(const A of Ht.value){const $=A.width/2,q=A.height/2,p=A.x-$,W=A.x+$,ye=A.y-q,Ne=A.y+q;p<=N&&W>=o&&ye<=E&&Ne>=c&&_.push(A.id)}if(_.length>0){u.value=_[0];const A=V(m.value,_[0]);A&&l("select",A)}}function ai(n){return g.value.has(n)}function fa(n){const o=V(m.value,n.id);return!!o&&o.children.length>0}function Gt(n){const o=V(m.value,n);return o?o.children.length:0}function li(n){if(!V(m.value,n))return 0;const N=[m.value];for(;N.length;){const E=N.pop(),_=E.children.findIndex(A=>A.id===n);if(_>=0)return _;for(const A of E.children)N.push(A)}return 0}function si(n,o,c,N){if(((N==null?void 0:N._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 _;o==="in"?_=-n.side:c!==void 0?_=c:_=n.side;const A=o==="in"?n._richInsetX??0:0;return{x:n.x+_*(n.width/2-A),y:n.y}}function Me(){const n=pe.value;U.resetView(n.width,n.height,n.root.y)}function ga(){Be.value=!0,v(),C(),t.nextTick(()=>Me())}function Kt(n){O.layoutMode!==n&&(O.layoutMode=n,C(),t.nextTick(()=>Me()))}function ci(){return JSON.stringify(m.value,null,2)}function di(n){try{const o=JSON.parse(n);return!o.id||!Array.isArray(o.children)?!1:(w.reset(),m.value=_e(o),u.value=null,g.value=new Set,C(),t.nextTick(()=>Me()),l("change",m.value),!0)}catch{return!1}}function ma(){const n=document.createElement("input");n.type="file",n.accept="application/json",n.onchange=()=>{var N;const o=(N=n.files)==null?void 0:N[0];if(!o)return;const c=new FileReader;c.onload=()=>{typeof c.result=="string"&&(di(c.result)||alert("导入失败:JSON 格式无效"))},c.readAsText(o)},n.click()}function pa(){const n=new Blob([ci()],{type:"application/json"}),o=URL.createObjectURL(n),c=document.createElement("a");c.href=o,c.download=`${m.value.text||"mindmap"}.json`,c.click(),URL.revokeObjectURL(o)}return r({addChild:n=>Fe(n),addSibling:n=>wt(n),removeNode:n=>ni(n),duplicateNode:n=>ti(n),setNodeText:(n,o)=>aa(n,o),moveNode:(n,o,c)=>la(n,o,c),lineWidthForDepth:yt,endWidthForDepth:xt,getData:()=>m.value,setData:n=>{w.reset(),m.value=_e(n),u.value=null,g.value=new Set,C(),v(),t.nextTick(()=>Me())},resetView:()=>Me(),exportData:ci,importData:di,getMarkdown:()=>st(m.value),setMarkdown:(n,o=!0)=>{const c=At(n||"");o&&(S.value=!0),H=!o,w.reset(),m.value=_e(c),u.value=null,g.value=new Set,C(),v(),t.nextTick(()=>{H=!1,Me()}),l("change",m.value)},setBalanced:n=>{Be.value=n},isBalanced:()=>Be.value,balance:()=>ga(),applyNodeStyle:(n,o)=>B(n,o),getNodeStyle:n=>j(n),applyNodeImage:(n,o)=>ee(n,o),applyNodeImageByUrl:(n,o)=>F(n,o),removeNodeImage:n=>le(n),applyNodeLink:(n,o)=>ie(n,o),removeNodeLink:n=>de(n),applyNodeNote:(n,o)=>y(n,o),removeNodeNote:n=>T(n),applyNodeRichContent:(n,o)=>M(n,o),undo:()=>Ft(),redo:()=>Wt(),canUndo:()=>w.canUndo(),canRedo:()=>w.canRedo(),applySettings:n=>{n.autoBalanceOnChange!==void 0&&(O.autoBalanceOnChange=n.autoBalanceOnChange),n.lineWidthStart!==void 0&&(O.lineWidthStart=Math.max(.5,Math.min(20,n.lineWidthStart))),n.lineWidthEnd!==void 0&&(O.lineWidthEnd=Math.max(.3,Math.min(10,n.lineWidthEnd))),n.rainbowBranch!==void 0&&(O.rainbowBranch=n.rainbowBranch),n.branchPaletteId!==void 0&&(O.branchPaletteId=n.branchPaletteId),n.customPalettes!==void 0&&(O.customPalettes=n.customPalettes),n.lineStyle!==void 0&&(O.lineStyle=n.lineStyle),n.taperedEdge!==void 0&&(O.taperedEdge=n.taperedEdge),n.showOrderBadge!==void 0&&(O.showOrderBadge=n.showOrderBadge)},getSettings:()=>({autoBalanceOnChange:O.autoBalanceOnChange,lineWidthStart:O.lineWidthStart,lineWidthEnd:O.lineWidthEnd,rainbowBranch:O.rainbowBranch,branchPaletteId:O.branchPaletteId,customPalettes:O.customPalettes,lineStyle:O.lineStyle,layoutMode:O.layoutMode,taperedEdge:O.taperedEdge,showOrderBadge:O.showOrderBadge}),setBranchPalette:n=>{if(!n)return;[...Ge,...O.customPalettes].find(c=>c.id===n)&&(O.branchPaletteId=n)},getBranchPalette:()=>O.branchPaletteId,getBranchPalettes:()=>[...Ge,...O.customPalettes]}),t.watch(()=>a.data,n=>{m.value=_e(n),C()},{deep:!1}),t.onMounted(()=>{v(),t.nextTick(()=>Me())}),(n,o)=>{var c,N,E,_,A,$,q;return t.openBlock(),t.createElementBlock("div",{class:"zm-mindmap",style:t.normalizeStyle({background:Q.value.bgColor,fontSize:Q.value.fontSize+"px"})},[t.createElementVNode("div",{ref_key:"wrapperRef",ref:f,class:"zm-canvas",onMousedown:ca,onContextmenu:o[25]||(o[25]=t.withModifiers(()=>{},["prevent"])),onWheel:o[26]||(o[26]=(...p)=>t.unref(U).onWheel&&t.unref(U).onWheel(...p)),onMouseenter:o[27]||(o[27]=p=>x.value=!0),onMouseleave:o[28]||(o[28]=p=>x.value=!1),onClick:da},[t.createElementVNode("div",{class:"zm-svg-layer",style:t.normalizeStyle({left:pe.value.vbX*t.unref(U).scale.value+t.unref(U).offsetX.value+"px",top:pe.value.vbY*t.unref(U).scale.value+t.unref(U).offsetY.value+"px",width:pe.value.vbW*t.unref(U).scale.value+"px",height:pe.value.vbH*t.unref(U).scale.value+"px"})},[(t.openBlock(),t.createElementBlock("svg",{class:"zm-svg",viewBox:Yr.value,preserveAspectRatio:"xMinYMin meet",width:pe.value.vbW*t.unref(U).scale.value,height:pe.value.vbH*t.unref(U).scale.value},[t.createElementVNode("g",mr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Zr.value,p=>(t.openBlock(),t.createElementBlock("path",{key:p.key,d:Pr(si(p.from,"out",p.to.side,p.to),si(p.to,"in"),yt(p.from.depth),xt(p.to.depth),32,O.lineStyle,p.to._dir),fill:Vr(p.from,p.to),stroke:"none"},null,8,pr))),128))])],8,gr))],4),t.unref(U).isMarquee.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"zm-marquee",style:t.normalizeStyle({left:t.unref(U).marquee.x*t.unref(U).scale.value+t.unref(U).offsetX.value+"px",top:t.unref(U).marquee.y*t.unref(U).scale.value+t.unref(U).offsetY.value+"px",width:t.unref(U).marquee.width*t.unref(U).scale.value+"px",height:t.unref(U).marquee.height*t.unref(U).scale.value+"px"})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:"zm-world",style:t.normalizeStyle({transform:`translate(${t.unref(U).offsetX.value}px, ${t.unref(U).offsetY.value}px) scale(${t.unref(U).scale.value})`})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ht.value,p=>(t.openBlock(),t.createElementBlock("div",{key:p.id,class:t.normalizeClass(["zm-node",{"is-root":p.isRoot,"is-selected":u.value===p.id,"is-editing":s.value===p.id,"has-image":!!p.image,"is-resizing":Vt.value===p.id}]),"data-node-id":p.id,style:t.normalizeStyle({left:p.x+"px",top:p.y+"px",width:p.width+"px",minWidth:p.width+"px",height:p.height+"px",fontSize:p.fontSize+"px",background:Hr(p),color:Fr(p),borderColor:Wr(p),fontWeight:Gr(p),transform:"translate(-50%, -50%)"}),onClick:W=>sa(W,p),onDblclick:W=>{W.stopPropagation(),e.previewMode||Je(p.id)},onContextmenu:W=>K(W,p),onMouseenter:W=>He(p.id),onMouseleave:W=>Se(p.id)},[p.image?(t.openBlock(),t.createElementBlock("img",{key:0,class:"zm-node-img",src:p.image.src,width:p.image.width,height:p.image.height,alt:p.text,draggable:"false"},null,8,br)):t.createCommentVNode("",!0),p.richContent&&(p.richContent.kind==="code"||p.richContent.kind==="table")&&s.value!==p.id?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["zm-rich zm-rich-above",{"zm-rich-no-overflow":p.richContent.kind==="table"||p.richContent.kind==="code"}]),onClick:o[1]||(o[1]=t.withModifiers(()=>{},["stop"])),onDblclick:t.withModifiers(W=>qr(p.id),["stop"]),onMousedown:o[2]||(o[2]=t.withModifiers(()=>{},["stop"]))},[b.value===p.id?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:0,"onUpdate:modelValue":o[0]||(o[0]=W=>k.value=W),class:"zm-rich-edit",spellcheck:"false",onBlur:Qn,onKeydown:Jr},null,544)),[[t.vModelText,k.value]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[p.richContent.kind==="code"?(t.openBlock(),t.createElementBlock("pre",yr,[t.createElementVNode("code",{innerHTML:t.unref(cr)(t.unref(Gn)(p.richContent.raw),t.unref(Kn)(p.richContent.raw))},null,8,xr)])):p.richContent.kind==="table"?(t.openBlock(),t.createElementBlock("table",kr,[t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ea(p.id,t.unref(dr)(p.richContent.raw)),(W,ye)=>(t.openBlock(),t.createElementBlock("tr",{key:ye},[ye===0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(W,(Ne,me)=>{var Qe,et,tt,nt,we;return t.openBlock(),t.createElementBlock("th",{key:`h${me}`,class:t.normalizeClass(["zm-rich-table-sort",{"is-sorted":((Qe=h.value.get(p.id))==null?void 0:Qe.col)===me,"is-asc":((et=h.value.get(p.id))==null?void 0:et.col)===me&&((tt=h.value.get(p.id))==null?void 0:tt.dir)==="asc","is-desc":((nt=h.value.get(p.id))==null?void 0:nt.col)===me&&((we=h.value.get(p.id))==null?void 0:we.dir)==="desc"}]),onClick:t.withModifiers(ui=>Qr(p.id,me),["stop"])},[t.createElementVNode("span",null,t.toDisplayString(Ne),1),t.createElementVNode("span",wr,t.toDisplayString(ta(p.id,me)),1)],10,Nr)}),128)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(W,(Ne,me)=>(t.openBlock(),t.createElementBlock("td",{key:`c${me}`},t.toDisplayString(Ne),1))),128))]))),128))])])):t.createCommentVNode("",!0)],64))],42,Er)):t.createCommentVNode("",!0),s.value!==p.id?(t.openBlock(),t.createElementBlock("span",_r,[t.createElementVNode("span",Sr,t.toDisplayString(p.text),1),p.link&&!s.value?(t.openBlock(),t.createElementBlock("a",{key:0,class:"zm-node-link",href:p.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开链接:${p.link.url}`,onClick:o[3]||(o[3]=t.withModifiers(()=>{},["stop"])),onMousedown:o[4]||(o[4]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(te,{name:"link",size:11,stroke:2})],40,Mr)):t.createCommentVNode("",!0),p.note&&!s.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"zm-node-note-btn",type:"button",title:Ve(p.note.text),onClick:t.withModifiers(W=>Et(p.id),["stop"]),onMousedown:o[5]||(o[5]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(te,{name:"note",size:11,stroke:2})],40,vr)):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=>Nt()),onKeydown:[o[8]||(o[8]=t.withKeys(t.withModifiers(W=>Nt({addSibling:"after"}),["exact"]),["enter"])),o[9]||(o[9]=t.withKeys(t.withModifiers(W=>Nt({addSibling:"before"}),["shift","prevent","exact"]),["enter"])),o[10]||(o[10]=t.withKeys(t.withModifiers(W=>Nt({addChild:!0}),["prevent"]),["tab"])),t.withKeys(Xr,["esc"]),na],onMousedown:o[11]||(o[11]=t.withModifiers(()=>{},["stop"])),onClick:o[12]||(o[12]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,d.value]]),I.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:"zm-order-badge",title:`数据顺序:第 ${li(p.id)+1} 个`},t.toDisplayString(li(p.id)+1),9,Cr)):t.createCommentVNode("",!0),ai(p.id)&&Gt(p.id)>0?(t.openBlock(),t.createElementBlock("span",{key:5,class:t.normalizeClass(["zm-collapse-badge",{"is-on-left":p.side===-1}]),style:t.normalizeStyle({background:Le.value.get(p.id)??"#64748b"}),title:`展开 ${Gt(p.id)} 个子节点`,onMousedown:o[13]||(o[13]=t.withModifiers(()=>{},["stop"])),onClick:t.withModifiers(W=>ii(p.id),["stop"])},t.toDisplayString(Gt(p.id)),47,Tr)):t.createCommentVNode("",!0),fa(p)&&!ai(p.id)?(t.openBlock(),t.createElementBlock("button",{key:6,class:t.normalizeClass(["zm-btn zm-collapse",{"is-on-left":p.side===-1}]),style:t.normalizeStyle({color:Le.value.get(p.id)??"#64748b",borderColor:Le.value.get(p.id)??"#64748b"}),title:"折叠",onMousedown:o[14]||(o[14]=t.withModifiers(()=>{},["stop"])),onClick:t.withModifiers(W=>ii(p.id),["stop"])},[t.createVNode(te,{name:"minus",size:10,stroke:2.4})],46,Ar)):t.createCommentVNode("",!0),p.image&&u.value===p.id&&s.value!==p.id?(t.openBlock(),t.createElementBlock("span",{key:7,class:"zm-img-resize-handle",title:"拖动调整图片大小",onMousedown:t.withModifiers(W=>qe(W,p),["stop"])},null,40,Rr)):t.createCommentVNode("",!0),p.image&&u.value===p.id&&s.value!==p.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=>le(p.id),["stop"])},[t.createVNode(te,{name:"x",size:9,stroke:2.2})],40,Or)):t.createCommentVNode("",!0)],46,hr))),128))],4),R.value?(t.openBlock(),t.createBlock(ji,{key:1,x:R.value.x,y:R.value.y,container:f.value,"has-image":!!((c=t.unref(V)(m.value,R.value.nodeId))!=null&&c.image),"has-link":!!((N=t.unref(V)(m.value,R.value.nodeId))!=null&&N.link),"has-note":!!((E=t.unref(V)(m.value,R.value.nodeId))!=null&&E.note),"has-code":((A=(_=t.unref(V)(m.value,R.value.nodeId))==null?void 0:_.richContent)==null?void 0:A.kind)==="code","has-table":((q=($=t.unref(V)(m.value,R.value.nodeId))==null?void 0:$.richContent)==null?void 0:q.kind)==="table",onPickImage:ue,onRemoveImage:ht,onSetLink:be,onRemoveLink:ge,onEditNote:Ee,onRemoveNote:pt,onAddCode:Ye,onEditCode:Ye,onRemoveCode:Pt,onAddTable:bt,onEditTable:bt,onRemoveTable:Ut,onClose:ne},null,8,["x","y","container","has-image","has-link","has-note","has-code","has-table"])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["zm-toolbar",{"is-preview-only":a.previewMode,"is-hovered":x.value}])},[t.createElementVNode("span",Ir,t.toDisplayString(Math.round(t.unref(U).scale.value*100))+"%",1),t.createElementVNode("button",{class:"zm-tb-btn",title:"放大",onClick:o[16]||(o[16]=(...p)=>t.unref(U).zoomIn&&t.unref(U).zoomIn(...p))},[t.createVNode(te,{name:"zoom-in"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"缩小",onClick:o[17]||(o[17]=(...p)=>t.unref(U).zoomOut&&t.unref(U).zoomOut(...p))},[t.createVNode(te,{name:"zoom-out"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"重置视图",onClick:Me},[t.createVNode(te,{name:"reset"})]),o[32]||(o[32]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),t.createElementVNode("button",{class:"zm-tb-btn",title:"全部收起",onClick:oa},[t.createVNode(te,{name:"collapse-all"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"展开一级",onClick:o[18]||(o[18]=p=>ri(1))},[t.createVNode(te,{name:"expand-level-1"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"展开二级",onClick:o[19]||(o[19]=p=>ri(2))},[t.createVNode(te,{name:"expand-level-2"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"全部展开",onClick:ra},[t.createVNode(te,{name:"expand-all"})]),o[33]||(o[33]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),t.createElementVNode("button",{class:"zm-tb-btn",title:"导出 JSON",onClick:pa},[t.createVNode(te,{name:"export"})]),a.previewMode?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o[29]||(o[29]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),t.createElementVNode("button",{class:"zm-tb-btn",title:"添加子节点 (Tab)",onClick:o[20]||(o[20]=p=>u.value&&Fe(u.value))},[t.createElementVNode("img",{src:t.unref(Ei),width:"14",height:"14",alt:"添加子节点",draggable:"false"},null,8,Br)]),t.createElementVNode("button",{class:"zm-tb-btn",title:"添加同级 (Enter)",onClick:o[21]||(o[21]=p=>u.value&&wt(u.value))},[t.createElementVNode("img",{src:t.unref(bi),width:"14",height:"14",alt:"添加同级",draggable:"false"},null,8,Lr)]),o[30]||(o[30]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),t.createElementVNode("button",{class:t.normalizeClass(["zm-tb-btn",{active:O.layoutMode==="mindmap"}]),title:"思维导图布局 (中心辐射)",onClick:o[22]||(o[22]=p=>Kt("mindmap"))},[t.createVNode(te,{name:"mindmap"})],2),t.createElementVNode("button",{class:t.normalizeClass(["zm-tb-btn",{active:O.layoutMode==="tree"}]),title:"树形布局 (向右展开)",onClick:o[23]||(o[23]=p=>Kt("tree"))},[t.createVNode(te,{name:"tree"})],2),t.createElementVNode("button",{class:t.normalizeClass(["zm-tb-btn",{active:O.layoutMode==="org"}]),title:"组织结构布局 (向下展开)",onClick:o[24]||(o[24]=p=>Kt("org"))},[t.createVNode(te,{name:"org"})],2),o[31]||(o[31]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),t.createElementVNode("button",{class:"zm-tb-btn",title:"导入 JSON",onClick:ma},[t.createVNode(te,{name:"import"})])],64))],2)],544)],4)}}}),Dr={install(e){e.component("FlowMindMap",Zn)}};se.MindMap=Zn,se.addChild=en,se.addSibling=tn,se.clone=_e,se.default=Dr,se.findNode=V,se.findParent=xe,se.markdownToMindMap=At,se.markdownToRichMindMap=Gi,se.mindMapToMarkdown=st,se.removeNode=Tt,se.richBlockToMarkdown=Ki,se.uid=ke,Object.defineProperties(se,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
22
|
+
| a | b | c |`);if(E===null)return;const N=E.trim();if(!N){S(n,null);return}S(n,{kind:"table",raw:N})}function xe(){var o;const n=(o=C.value)==null?void 0:o.nodeId;n&&S(n,null)}function kt(n){r.previewMode||l("edit-note",n)}function Qe(n,o=60){const d=n.replace(/\s+/g," ").trim();return d.length<=o?d||"点击编辑笔记":d.slice(0,o)+"…"}function B(n){var E;if(r.previewMode||s.value)return;const o=n.target;if(o&&(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable))return;const d=u.value;if(!d)return;const w=(E=n.clipboardData)==null?void 0:E.items;if(w)for(let N=0;N<w.length;N++){const T=w[N];if(T.kind==="file"&&T.type.startsWith("image/")){const z=T.getAsFile();if(!z)continue;n.preventDefault();const q=H(m.value,d);if(q!=null&&q.image&&!window.confirm("该节点已有图片,要用剪贴板里的图片替换吗?"))return;le(z,p=>te(d,p));return}}}t.onMounted(()=>{window.addEventListener("paste",B),X()}),t.onBeforeUnmount(()=>{window.removeEventListener("paste",B)});const Ie=t.ref(null),ue=t.computed(()=>{var n;return((n=Ie.value)==null?void 0:n.nodeId)??null});function Q(n,o){if(!o.image)return;n.preventDefault(),n.stopPropagation();const d=o.image.naturalW||o.image.width,w=o.image.naturalH||o.image.height,E=w>0?w/d:1;Ie.value={nodeId:o.id,startX:n.clientX,startY:n.clientY,startW:o.image.width,startH:o.image.height,naturalW:d,naturalH:w,ratio:E,pendingW:o.image.width,pendingH:o.image.height},window.addEventListener("mousemove",ze),window.addEventListener("mouseup",Se)}function ze(n){var q,p;const o=Ie.value;if(!o)return;const d=U.scale.value||1,w=n.clientX-o.startX,E=J(o.startW+w/d,De,Ge),N=J(E*o.ratio,De,Ge);o.pendingW=E,o.pendingH=N;const T=(q=f.value)==null?void 0:q.querySelector(`[data-node-id="${o.nodeId}"] .zm-node-img`);T&&(T.style.width=`${E}px`,T.style.height=`${N}px`);const z=(p=f.value)==null?void 0:p.querySelector(`[data-node-id="${o.nodeId}"]`);z&&(z.style.minWidth=`${Math.max(80,Math.ceil(E+28))}px`,z.style.height=`${Math.ceil(N+8+30)}px`)}function Se(){const n=Ie.value;if(window.removeEventListener("mousemove",ze),window.removeEventListener("mouseup",Se),Ie.value=null,!n)return;const o=H(m.value,n.nodeId);!o||!o.image||(te(n.nodeId,{src:o.image.src,naturalW:o.image.naturalW,naturalH:o.image.naturalH,width:n.pendingW,height:n.pendingH}),u.value=n.nodeId,l("select",o),Pe=!0)}const $e=t.ref(null);let Pe=!1;function M(n){$e.value=n}function A(n){$e.value===n&&($e.value=null)}const P=t.ref(0),Y=t.ref(!1),ie=eo(100);function ee(){ie.record({data:m.value})}function X(){g.value=new Set(g.value),P.value++,t.nextTick().then(()=>t.nextTick()).then(()=>Ft()).then(()=>{P.value++})}function Ft(){const n=document.querySelectorAll(".zm-rich"),o={},d={};n.forEach(w=>{let E=w,N=null;for(;E&&!N;)N=E.getAttribute("data-node-id"),E=E.parentElement;if(!N)return;const T=w.offsetHeight,z=w.scrollWidth,q=Math.round(T*2)/2,p=Math.round(z*2)/2;o[N]=q,d[N]=p,L.value[N],K.value[N]}),L.value=o,K.value=d}const Ne=t.computed(()=>{var n,o,d,w,E,N,T,z,q,p;return{rootBg:((n=r.theme)==null?void 0:n.rootBg)??"#1f2937",rootText:((o=r.theme)==null?void 0:o.rootText)??"#ffffff",branchBg:((d=r.theme)==null?void 0:d.branchBg)??"#ffffff",branchText:((w=r.theme)==null?void 0:w.branchText)??"#1f2937",lineColor:((E=r.theme)==null?void 0:E.lineColor)??"#94a3b8",bgColor:((N=r.theme)==null?void 0:N.bgColor)??"#f8fafc",fontSize:((T=r.theme)==null?void 0:T.fontSize)??14,lineWidthStart:((z=r.theme)==null?void 0:z.lineWidthStart)??2.2,lineWidthEnd:((q=r.theme)==null?void 0:q.lineWidthEnd)??.8,rainbowBranch:((p=r.theme)==null?void 0:p.rainbowBranch)??!1}}),R=t.reactive({autoBalanceOnChange:!0,lineWidthStart:12,lineWidthEnd:3.6,rainbowBranch:!0,branchPaletteId:"default",customPalettes:[],lineStyle:"curve",layoutMode:"mindmap",taperedEdge:!0,showOrderBadge:!1});function qn(n){return R.taperedEdge?Hr(n):Jn(n)}function jn(n){return R.taperedEdge?R.lineWidthEnd:Jn(n)}function Hr(n){return n<=0?R.lineWidthStart:n===1?Math.max(1.5,R.lineWidthStart*.67):n===2?Math.max(.8,R.lineWidthStart*.42):R.lineWidthEnd}function Jn(n){if(n<=0)return R.lineWidthStart;if(n>=3)return R.lineWidthEnd;const o=n/3;return R.lineWidthStart+(R.lineWidthEnd-R.lineWidthStart)*o}function Fr(n,o,d,w){const E=1-n,N=E*E*E*o.x+3*E*E*n*d.x1+3*E*n*n*d.x2+n*n*n*w.x,T=E*E*E*o.y+3*E*E*n*d.y1+3*E*n*n*d.y2+n*n*n*w.y;return{x:N,y:T}}function Wr(n,o,d,w,E=32,N="curve",T="right"){if(N==="curve"){let ve;if(T==="right"||T==="left"){const ae=Math.abs(o.x-n.x)*.45,Ae=T==="right"?1:-1;ve={x1:n.x+Ae*ae,y1:n.y,x2:o.x-Ae*ae,y2:o.y}}else{const ae=Math.abs(o.y-n.y)*.45;ve={x1:n.x,y1:n.y+ae,x2:o.x,y2:o.y-ae}}const pi=Z=>{const ae=1-Z,Ae=-3*ae*ae*n.x+3*(ae*ae-2*ae*Z)*ve.x1+3*(2*ae*Z-Z*Z)*ve.x2+3*Z*Z*o.x,Ze=-3*ae*ae*n.y+3*(ae*ae-2*ae*Z)*ve.y1+3*(2*ae*Z-Z*Z)*ve.y2+3*Z*Z*o.y;return{dx:Ae,dy:Ze}},rt=[],Xt=[];for(let Z=0;Z<=E;Z++){const ae=Z/E,Ae=Z===0?n:Z===E?o:Fr(ae,n,ve,o),Ze=pi(ae);let Mt=Math.hypot(Ze.dx,Ze.dy);Mt<1e-6&&(Mt=1);const hi=-Ze.dy/Mt,bi=Ze.dx/Mt,vt=(d+(w-d)*ae)/2;rt.push({x:Ae.x+hi*vt,y:Ae.y+bi*vt}),Xt.push({x:Ae.x-hi*vt,y:Ae.y-bi*vt})}let St=`M ${rt[0].x.toFixed(2)} ${rt[0].y.toFixed(2)}`;for(let Z=1;Z<=E;Z++)St+=` L ${rt[Z].x.toFixed(2)} ${rt[Z].y.toFixed(2)}`;for(let Z=E;Z>=0;Z--)St+=` L ${Xt[Z].x.toFixed(2)} ${Xt[Z].y.toFixed(2)}`;return St+=" Z",St}const z=o.x-n.x,q=o.y-n.y;let p=Math.hypot(z,q);p<1e-6&&(p=1);const G=-q/p,ke=z/p,Me=d/2,pe=w/2,tt={x:n.x+G*Me,y:n.y+ke*Me},nt={x:n.x-G*Me,y:n.y-ke*Me},it={x:o.x-G*pe,y:o.y-ke*pe},ot={x:o.x+G*pe,y:o.y+ke*pe};return`M ${tt.x.toFixed(2)} ${tt.y.toFixed(2)} L ${ot.x.toFixed(2)} ${ot.y.toFixed(2)} L ${it.x.toFixed(2)} ${it.y.toFixed(2)} L ${nt.x.toFixed(2)} ${nt.y.toFixed(2)} Z`}const wt=t.computed(()=>he.value.root.children),Gr=Xe[0].colors,Qn=t.computed(()=>Fi(R.branchPaletteId,R.customPalettes)),Ue=t.computed(()=>{const n=new Map;if(!R.rainbowBranch)return n;const o=r.lineColors,d=o&&o.length>0?o:Qn.value.colors.length>0?Qn.value.colors:Gr;for(let E=0;E<wt.value.length;E++){const N=wt.value[E];n.set(N.id,d[E%d.length])}const w=(E,N)=>{n.set(E.id,N);for(const T of E.children)w(T,N)};for(let E=0;E<wt.value.length;E++){const N=wt.value[E];w(N,d[E%d.length])}return n});function Kr(n,o){return R.rainbowBranch?Ue.value.get(o.id)??Ne.value.lineColor:Ne.value.lineColor}function Yr(n){const o=j(n.id);if(o.bg)return o.bg;if(n.isRoot)return Ne.value.rootBg;if(R.rainbowBranch){const d=Ue.value.get(n.id);if(d)return jr(d,.18)}return Ne.value.branchBg}function Zr(n){const o=j(n.id);if(o.textColor)return o.textColor;if(n.isRoot)return Ne.value.rootText;if(R.rainbowBranch){const d=Ue.value.get(n.id);if(d)return ei(d,.55)}return Ne.value.branchText}function Xr(n){const o=j(n.id);if(o.borderColor)return o.borderColor;if(n.isRoot)return Ne.value.rootBg;if(R.rainbowBranch){const d=Ue.value.get(n.id);if(d)return ei(d,.3)}return Ne.value.lineColor}function qr(n){return j(n.id).fontWeight??(n.isRoot?600:400)}function jr(n,o){const d=n.replace("#",""),w=d.length===6?d:d.split("").map(z=>z+z).join(""),E=parseInt(w.slice(0,2),16),N=parseInt(w.slice(2,4),16),T=parseInt(w.slice(4,6),16);return`rgba(${E}, ${N}, ${T}, ${o})`}function ei(n,o){const d=n.replace("#",""),w=d.length===6?d:d.split("").map(z=>z+z).join(""),E=Math.round(parseInt(w.slice(0,2),16)*(1-o)),N=Math.round(parseInt(w.slice(2,4),16)*(1-o)),T=Math.round(parseInt(w.slice(4,6),16)*(1-o));return`rgb(${E}, ${N}, ${T})`}const U=ji({getContainer:()=>f.value});U.setOnMarqueeEnd(ha),Qi({isEditing:()=>s.value!==null,isReadonly:()=>r.previewMode,getSelectedId:()=>u.value,getRootId:()=>m.value.id,defaultTargetId:()=>m.value.id,onAddChild:Ye,onAddSibling:_t,onAddSiblingBefore:oi,onRemove:ai,onStartEdit:et,onClearSelection:()=>{u.value=null,l("select",null)},onDuplicate:ri,onUndo:Gt,onRedo:Kt,onNavigate:sa,onSelectRoot:()=>{u.value=m.value.id;const n=H(m.value,m.value.id);n&&l("select",n)}});const he=t.computed(()=>{const n=Ce(m.value);return ni(n),Pi(n,{mode:R.layoutMode,baseFontSize:Ne.value.fontSize,richHeights:L.value,richWidths:K.value})}),ti=t.ref([]),Wt=t.computed(()=>(P.value,ti.value));t.watch(he,n=>{const o=[],d=w=>{o.push(w);for(const E of w.children)d(E)};d(n.root),ti.value=o},{immediate:!0});const Jr=t.computed(()=>{const n=[];for(const o of Wt.value)for(const d of o.children)n.push({from:o,to:d,key:`${o.id}->${d.id}`});return n}),Qr=t.computed(()=>`${he.value.vbX} ${he.value.vbY} ${he.value.vbW} ${he.value.vbH}`);function ni(n){if(g.value.has(n.id)){n.children=[],n.collapsed=!0;return}n.collapsed=!1;for(const o of n.children)ni(o)}function et(n){const o=H(m.value,n);o&&(s.value=n,c.value=o.text,t.nextTick(()=>{const d=document.querySelector(".zm-input");d==null||d.focus(),d==null||d.select()}))}function Nt(n={}){if(!s.value)return;const o=H(m.value,s.value);o&&o.text!==(c.value.trim()||" ")&&(o.text=c.value.trim()||" ",ee(),l("change",m.value));const d=s.value;s.value=null,n.addChild?t.nextTick(()=>Ye(d)):n.addSibling==="after"?t.nextTick(()=>_t(d)):n.addSibling==="before"&&t.nextTick(()=>oi(d))}function ea(){s.value=null}function ta(n){if(r.previewMode)return;const o=H(m.value,n);o!=null&&o.richContent&&(b.value=n,k.value=o.richContent.raw,t.nextTick(()=>{const d=document.querySelector(".zm-node .zm-rich textarea");d==null||d.focus()}))}function ii(){if(!b.value)return;const n=b.value,o=H(m.value,n),d=k.value;if(o&&o.richContent&&o.richContent.raw!==d)if(o.richContent.kind==="code"){const w=Zn(d)||void 0;S(n,{kind:"code",raw:d,lang:w})}else S(n,{kind:"table",raw:d});b.value=null}function na(){b.value=null}function ia(n){n.key==="Escape"?(n.preventDefault(),na()):n.key==="Enter"&&(n.ctrlKey||n.metaKey)&&(n.preventDefault(),ii())}function oa(n,o){const d=h.value.get(n);!d||d.col!==o?h.value.set(n,{col:o,dir:"asc"}):d.dir==="asc"?h.value.set(n,{col:o,dir:"desc"}):h.value.delete(n)}function ra(n,o){const d=h.value.get(n);return!d||o.length<=1?o:br(o,d.col,d.dir)}function aa(n,o){const d=h.value.get(n);return!d||d.col!==o?"↕":d.dir==="asc"?"▲":"▼"}function la(n){const o=n.metaKey||n.ctrlKey;o&&(n.key==="z"||n.key==="Z")&&!n.shiftKey?(n.preventDefault(),Gt()):(o&&n.shiftKey&&(n.key==="z"||n.key==="Z")||o&&(n.key==="y"||n.key==="Y")&&!n.shiftKey)&&(n.preventDefault(),Kt())}function Ye(n){const o=nn(m.value,n,ct);o&&(ee(),X(),l("change",m.value),t.nextTick(()=>et(o.id)))}function _t(n){if(n===m.value.id){Ye(n);return}const o=on(m.value,n,ct);o&&(ee(),X(),l("change",m.value),t.nextTick(()=>et(o.id)))}function oi(n){if(n===m.value.id){Ye(n);return}const o=Ki(m.value,n,ct);o&&(ee(),X(),l("change",m.value),t.nextTick(()=>et(o.id)))}function ri(n){if(n===m.value.id)return;const o=Yi(m.value,n);o&&(ee(),u.value=o.id,l("change",m.value),X())}function Gt(){const n=ie.undo();n&&(m.value=n.data,u.value=null,l("select",null),X(),l("change",m.value))}function Kt(){const n=ie.redo();n&&(m.value=n.data,u.value=null,l("select",null),X(),l("change",m.value))}function sa(n,o){const d=u.value??m.value.id,w=H(m.value,d);if(!w)return;let E=null;if(o===1){const N=we(m.value,w.id);if(N){const T=N.children.findIndex(z=>z.id===w.id);T>=0&&T<N.children.length-1&&(E=N.children[T+1].id)}}else if(o===-1){const N=we(m.value,w.id);if(N){const T=N.children.findIndex(z=>z.id===w.id);T>0&&(E=N.children[T-1].id)}}else if(n===1){const N=we(m.value,w.id);N&&(E=N.id)}else n===-1&&w.children.length>0&&(E=w.children[0].id);if(E){u.value=E;const N=H(m.value,E);N&&l("select",N)}}function ai(n){n!==m.value.id&&At(m.value,n)&&(ee(),u.value===n&&(u.value=null),X(),l("change",m.value))}function li(n){g.value.has(n)?g.value.delete(n):g.value.add(n),X()}function si(n){const o=[{n:m.value,depth:1}];for(;o.length;){const{n:d,depth:w}=o.pop();n(d,w);for(let E=d.children.length-1;E>=0;E--)o.push({n:d.children[E],depth:w+1})}}function ca(){g.value=new Set,si(n=>{n.children.length>0&&g.value.add(n.id)}),X()}function ci(n){g.value=new Set,si((o,d)=>{d>n&&o.children.length>0&&g.value.add(o.id)}),X()}function da(){g.value=new Set,X()}function ua(n,o){Wi(m.value,n,o)&&(ee(),X(),l("change",m.value))}function fa(n,o,d){return Gi(m.value,n,o,d)?(ee(),X(),l("change",m.value),!0):!1}function ga(n,o){n.stopPropagation(),u.value=o.id;const d=H(m.value,o.id);l("select",d)}function ma(n){const o=n.target;if(!o||o.closest(".zm-node, .zm-toolbar, button, input, textarea"))return;if(n.button===2){U.startPan(n);return}if(n.button!==0)return;const d=f.value.getBoundingClientRect(),w=(n.clientX-d.left-U.offsetX.value)/U.scale.value,E=(n.clientY-d.top-U.offsetY.value)/U.scale.value;U.startMarquee(w,E)}function pa(n){if(Pe){Pe=!1;return}const o=n.target;if(!o||o.closest(".zm-node"))return;const d=U.marquee;d.width>=4||d.height>=4||u.value!==null&&(u.value=null,l("select",null))}function ha(){const n=U.marquee;if(n.width<4&&n.height<4)return;const o=n.x,d=n.y,w=n.x+n.width,E=n.y+n.height,N=[];for(const T of Wt.value){const z=T.width/2,q=T.height/2,p=T.x-z,G=T.x+z,ke=T.y-q,Me=T.y+q;p<=w&&G>=o&&ke<=E&&Me>=d&&N.push(T.id)}if(N.length>0){u.value=N[0];const T=H(m.value,N[0]);T&&l("select",T)}}function di(n){return g.value.has(n)}function ba(n){const o=H(m.value,n.id);return!!o&&o.children.length>0}function Yt(n){const o=H(m.value,n);return o?o.children.length:0}function ui(n){if(!H(m.value,n))return 0;const w=[m.value];for(;w.length;){const E=w.pop(),N=E.children.findIndex(T=>T.id===n);if(N>=0)return N;for(const T of E.children)w.push(T)}return 0}function fi(n,o,d,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 N;o==="in"?N=-n.side:d!==void 0?N=d:N=n.side;const T=o==="in"?n._richInsetX??0:0;return{x:n.x+N*(n.width/2-T),y:n.y}}function Te(){const n=he.value;U.resetView(n.width,n.height,n.root.y)}function ya(){Y.value=!0,ee(),X(),t.nextTick(()=>Te())}function Zt(n){R.layoutMode!==n&&(R.layoutMode=n,X(),t.nextTick(()=>Te()))}function gi(){return JSON.stringify(m.value,null,2)}function mi(n){try{const o=JSON.parse(n);return!o.id||!Array.isArray(o.children)?!1:(ie.reset(),m.value=Ce(o),u.value=null,g.value=new Set,X(),t.nextTick(()=>Te()),l("change",m.value),!0)}catch{return!1}}function Ea(){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 d=new FileReader;d.onload=()=>{typeof d.result=="string"&&(mi(d.result)||alert("导入失败:JSON 格式无效"))},d.readAsText(o)},n.click()}function xa(){const n=new Blob([gi()],{type:"application/json"}),o=URL.createObjectURL(n),d=document.createElement("a");d.href=o,d.download=`${m.value.text||"mindmap"}.json`,d.click(),URL.revokeObjectURL(o)}return a({addChild:n=>Ye(n),addSibling:n=>_t(n),removeNode:n=>ai(n),duplicateNode:n=>ri(n),setNodeText:(n,o)=>ua(n,o),moveNode:(n,o,d)=>fa(n,o,d),lineWidthForDepth:qn,endWidthForDepth:jn,getData:()=>m.value,setData:n=>{ie.reset(),m.value=Ce(n),u.value=null,g.value=new Set,X(),ee(),t.nextTick(()=>Te())},resetView:()=>Te(),exportData:gi,importData:mi,getMarkdown:()=>dt(m.value),setMarkdown:(n,o=!0)=>{const d=Rt(n||"");o&&(_.value=!0),F=!o,ie.reset(),m.value=Ce(d),u.value=null,g.value=new Set,X(),ee(),t.nextTick(()=>{F=!1,Te()}),l("change",m.value)},setBalanced:n=>{Y.value=n},isBalanced:()=>Y.value,balance:()=>ya(),applyNodeStyle:(n,o)=>I(n,o),getNodeStyle:n=>j(n),applyNodeImage:(n,o)=>te(n,o),applyNodeImageByUrl:(n,o)=>W(n,o),removeNodeImage:n=>se(n),applyNodeLink:(n,o)=>re(n,o),removeNodeLink:n=>fe(n),applyNodeNote:(n,o)=>x(n,o),removeNodeNote:n=>v(n),applyNodeRichContent:(n,o)=>S(n,o),undo:()=>Gt(),redo:()=>Kt(),canUndo:()=>ie.canUndo(),canRedo:()=>ie.canRedo(),applySettings:n=>{n.autoBalanceOnChange!==void 0&&(R.autoBalanceOnChange=n.autoBalanceOnChange),n.lineWidthStart!==void 0&&(R.lineWidthStart=Math.max(.5,Math.min(20,n.lineWidthStart))),n.lineWidthEnd!==void 0&&(R.lineWidthEnd=Math.max(.3,Math.min(10,n.lineWidthEnd))),n.rainbowBranch!==void 0&&(R.rainbowBranch=n.rainbowBranch),n.branchPaletteId!==void 0&&(R.branchPaletteId=n.branchPaletteId),n.customPalettes!==void 0&&(R.customPalettes=n.customPalettes),n.lineStyle!==void 0&&(R.lineStyle=n.lineStyle),n.taperedEdge!==void 0&&(R.taperedEdge=n.taperedEdge),n.showOrderBadge!==void 0&&(R.showOrderBadge=n.showOrderBadge)},getSettings:()=>({autoBalanceOnChange:R.autoBalanceOnChange,lineWidthStart:R.lineWidthStart,lineWidthEnd:R.lineWidthEnd,rainbowBranch:R.rainbowBranch,branchPaletteId:R.branchPaletteId,customPalettes:R.customPalettes,lineStyle:R.lineStyle,layoutMode:R.layoutMode,taperedEdge:R.taperedEdge,showOrderBadge:R.showOrderBadge}),setBranchPalette:n=>{if(!n)return;[...Xe,...R.customPalettes].find(d=>d.id===n)&&(R.branchPaletteId=n)},getBranchPalette:()=>R.branchPaletteId,getBranchPalettes:()=>[...Xe,...R.customPalettes]}),t.watch(()=>r.data,n=>{m.value=Ce(n),X()},{deep:!1}),t.onMounted(()=>{ee(),t.nextTick(()=>Te())}),(n,o)=>{var d,w,E,N,T,z,q;return t.openBlock(),t.createElementBlock("div",{class:"zm-mindmap",style:t.normalizeStyle({background:Ne.value.bgColor,fontSize:Ne.value.fontSize+"px"})},[t.createElementVNode("div",{ref_key:"wrapperRef",ref:f,class:"zm-canvas",onMousedown:ma,onContextmenu:ye,onWheel:o[25]||(o[25]=(...p)=>t.unref(U).onWheel&&t.unref(U).onWheel(...p)),onMouseenter:o[26]||(o[26]=p=>y.value=!0),onMouseleave:o[27]||(o[27]=p=>y.value=!1),onClick:pa},[t.createElementVNode("div",{class:"zm-svg-layer",style:t.normalizeStyle({left:he.value.vbX*t.unref(U).scale.value+t.unref(U).offsetX.value+"px",top:he.value.vbY*t.unref(U).scale.value+t.unref(U).offsetY.value+"px",width:he.value.vbW*t.unref(U).scale.value+"px",height:he.value.vbH*t.unref(U).scale.value+"px"})},[(t.openBlock(),t.createElementBlock("svg",{class:"zm-svg",viewBox:Qr.value,preserveAspectRatio:"xMinYMin meet",width:he.value.vbW*t.unref(U).scale.value,height:he.value.vbH*t.unref(U).scale.value},[t.createElementVNode("g",Er,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Jr.value,p=>(t.openBlock(),t.createElementBlock("path",{key:p.key,d:Wr(fi(p.from,"out",p.to.side,p.to),fi(p.to,"in"),qn(p.from.depth),jn(p.to.depth),32,R.lineStyle,p.to._dir),fill:Kr(p.from,p.to),stroke:"none"},null,8,xr))),128))])],8,yr))],4),t.unref(U).isMarquee.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"zm-marquee",style:t.normalizeStyle({left:t.unref(U).marquee.x*t.unref(U).scale.value+t.unref(U).offsetX.value+"px",top:t.unref(U).marquee.y*t.unref(U).scale.value+t.unref(U).offsetY.value+"px",width:t.unref(U).marquee.width*t.unref(U).scale.value+"px",height:t.unref(U).marquee.height*t.unref(U).scale.value+"px"})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:"zm-world",style:t.normalizeStyle({transform:`translate(${t.unref(U).offsetX.value}px, ${t.unref(U).offsetY.value}px) scale(${t.unref(U).scale.value})`})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Wt.value,p=>(t.openBlock(),t.createElementBlock("div",{key:p.id,class:t.normalizeClass(["zm-node",{"is-root":p.isRoot,"is-selected":u.value===p.id,"is-editing":s.value===p.id,"has-image":!!p.image,"is-resizing":ue.value===p.id}]),"data-node-id":p.id,style:t.normalizeStyle({left:p.x+"px",top:p.y+"px",width:p.width+"px",minWidth:p.width+"px",height:p.height+"px",fontSize:p.fontSize+"px",background:Yr(p),color:Zr(p),borderColor:Xr(p),fontWeight:qr(p),transform:"translate(-50%, -50%)"}),onClick:G=>ga(G,p),onDblclick:G=>{G.stopPropagation(),e.previewMode||et(p.id)},onContextmenu:G=>oe(G,p),onMouseenter:G=>M(p.id),onMouseleave:G=>A(p.id)},[p.image?(t.openBlock(),t.createElementBlock("img",{key:0,class:"zm-node-img",src:p.image.src,width:p.image.width,height:p.image.height,alt:p.text,draggable:"false"},null,8,wr)):t.createCommentVNode("",!0),p.richContent&&(p.richContent.kind==="code"||p.richContent.kind==="table")&&s.value!==p.id?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["zm-rich zm-rich-above",{"zm-rich-no-overflow":p.richContent.kind==="table"||p.richContent.kind==="code"}]),onClick:o[1]||(o[1]=t.withModifiers(()=>{},["stop"])),onDblclick:t.withModifiers(G=>ta(p.id),["stop"]),onMousedown:o[2]||(o[2]=t.withModifiers(()=>{},["stop"]))},[b.value===p.id?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:0,"onUpdate:modelValue":o[0]||(o[0]=G=>k.value=G),class:"zm-rich-edit",spellcheck:"false",onBlur:ii,onKeydown:ia},null,544)),[[t.vModelText,k.value]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[p.richContent.kind==="code"?(t.openBlock(),t.createElementBlock("pre",_r,[t.createElementVNode("code",{innerHTML:t.unref(mr)(t.unref(Yn)(p.richContent.raw),t.unref(Zn)(p.richContent.raw))},null,8,Sr)])):p.richContent.kind==="table"?(t.openBlock(),t.createElementBlock("table",Mr,[t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ra(p.id,t.unref(pr)(p.richContent.raw)),(G,ke)=>(t.openBlock(),t.createElementBlock("tr",{key:ke},[ke===0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(G,(Me,pe)=>{var tt,nt,it,ot,ve;return t.openBlock(),t.createElementBlock("th",{key:`h${pe}`,class:t.normalizeClass(["zm-rich-table-sort",{"is-sorted":((tt=h.value.get(p.id))==null?void 0:tt.col)===pe,"is-asc":((nt=h.value.get(p.id))==null?void 0:nt.col)===pe&&((it=h.value.get(p.id))==null?void 0:it.dir)==="asc","is-desc":((ot=h.value.get(p.id))==null?void 0:ot.col)===pe&&((ve=h.value.get(p.id))==null?void 0:ve.dir)==="desc"}]),onClick:t.withModifiers(pi=>oa(p.id,pe),["stop"])},[t.createElementVNode("span",null,t.toDisplayString(Me),1),t.createElementVNode("span",Cr,t.toDisplayString(aa(p.id,pe)),1)],10,vr)}),128)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(G,(Me,pe)=>(t.openBlock(),t.createElementBlock("td",{key:`c${pe}`},t.toDisplayString(Me),1))),128))]))),128))])])):t.createCommentVNode("",!0)],64))],42,Nr)):t.createCommentVNode("",!0),s.value!==p.id?(t.openBlock(),t.createElementBlock("span",Tr,[t.createElementVNode("span",Ar,t.toDisplayString(p.text),1),p.link&&!s.value?(t.openBlock(),t.createElementBlock("a",{key:0,class:"zm-node-link",href:p.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开链接:${p.link.url}`,onClick:o[3]||(o[3]=t.withModifiers(()=>{},["stop"])),onMousedown:o[4]||(o[4]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(ne,{name:"link",size:11,stroke:2})],40,Rr)):t.createCommentVNode("",!0),p.note&&!s.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"zm-node-note-btn",type:"button",title:Qe(p.note.text),onClick:t.withModifiers(G=>kt(p.id),["stop"]),onMousedown:o[5]||(o[5]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(ne,{name:"note",size:11,stroke:2})],40,Or)):t.createCommentVNode("",!0)])):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:3,class:"zm-input","onUpdate:modelValue":o[6]||(o[6]=G=>c.value=G),autofocus:"",onBlur:o[7]||(o[7]=G=>Nt()),onKeydown:[o[8]||(o[8]=t.withKeys(t.withModifiers(G=>Nt({addSibling:"after"}),["exact"]),["enter"])),o[9]||(o[9]=t.withKeys(t.withModifiers(G=>Nt({addSibling:"before"}),["shift","prevent","exact"]),["enter"])),o[10]||(o[10]=t.withKeys(t.withModifiers(G=>Nt({addChild:!0}),["prevent"]),["tab"])),t.withKeys(ea,["esc"]),la],onMousedown:o[11]||(o[11]=t.withModifiers(()=>{},["stop"])),onClick:o[12]||(o[12]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,c.value]]),O.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:"zm-order-badge",title:`数据顺序:第 ${ui(p.id)+1} 个`},t.toDisplayString(ui(p.id)+1),9,Ir)):t.createCommentVNode("",!0),di(p.id)&&Yt(p.id)>0?(t.openBlock(),t.createElementBlock("span",{key:5,class:t.normalizeClass(["zm-collapse-badge",{"is-on-left":p.side===-1}]),style:t.normalizeStyle({background:Ue.value.get(p.id)??"#64748b"}),title:`展开 ${Yt(p.id)} 个子节点`,onMousedown:o[13]||(o[13]=t.withModifiers(()=>{},["stop"])),onClick:t.withModifiers(G=>li(p.id),["stop"])},t.toDisplayString(Yt(p.id)),47,Br)):t.createCommentVNode("",!0),ba(p)&&!di(p.id)?(t.openBlock(),t.createElementBlock("button",{key:6,class:t.normalizeClass(["zm-btn zm-collapse",{"is-on-left":p.side===-1}]),style:t.normalizeStyle({color:Ue.value.get(p.id)??"#64748b",borderColor:Ue.value.get(p.id)??"#64748b"}),title:"折叠",onMousedown:o[14]||(o[14]=t.withModifiers(()=>{},["stop"])),onClick:t.withModifiers(G=>li(p.id),["stop"])},[t.createVNode(ne,{name:"minus",size:10,stroke:2.4})],46,Lr)):t.createCommentVNode("",!0),p.image&&u.value===p.id&&s.value!==p.id?(t.openBlock(),t.createElementBlock("span",{key:7,class:"zm-img-resize-handle",title:"拖动调整图片大小",onMousedown:t.withModifiers(G=>Q(G,p),["stop"])},null,40,Dr)):t.createCommentVNode("",!0),p.image&&u.value===p.id&&s.value!==p.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(G=>se(p.id),["stop"])},[t.createVNode(ne,{name:"x",size:9,stroke:2.2})],40,zr)):t.createCommentVNode("",!0)],46,kr))),128))],4),C.value?(t.openBlock(),t.createBlock(to,{key:1,x:C.value.x,y:C.value.y,container:f.value,"has-image":!!((d=t.unref(H)(m.value,C.value.nodeId))!=null&&d.image),"has-link":!!((w=t.unref(H)(m.value,C.value.nodeId))!=null&&w.link),"has-note":!!((E=t.unref(H)(m.value,C.value.nodeId))!=null&&E.note),"has-code":((T=(N=t.unref(H)(m.value,C.value.nodeId))==null?void 0:N.richContent)==null?void 0:T.kind)==="code","has-table":((q=(z=t.unref(H)(m.value,C.value.nodeId))==null?void 0:z.richContent)==null?void 0:q.kind)==="table",onPickImage:bt,onRemoveImage:Ht,onSetLink:yt,onRemoveLink:Et,onEditNote:Ut,onRemoveNote:Vt,onAddCode:xt,onEditCode:xt,onRemoveCode:Ke,onAddTable:Je,onEditTable:Je,onRemoveTable:xe,onClose:ge},null,8,["x","y","container","has-image","has-link","has-note","has-code","has-table"])):t.createCommentVNode("",!0),V.value?(t.openBlock(),t.createBlock(no,{key:2,x:V.value.x,y:V.value.y,container:f.value,onOpenSettings:Ee,onClose:me},null,8,["x","y","container"])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["zm-toolbar",{"is-preview-only":r.previewMode,"is-hovered":y.value}])},[t.createElementVNode("span",$r,t.toDisplayString(Math.round(t.unref(U).scale.value*100))+"%",1),t.createElementVNode("button",{class:"zm-tb-btn",title:"放大",onClick:o[16]||(o[16]=(...p)=>t.unref(U).zoomIn&&t.unref(U).zoomIn(...p))},[t.createVNode(ne,{name:"zoom-in"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"缩小",onClick:o[17]||(o[17]=(...p)=>t.unref(U).zoomOut&&t.unref(U).zoomOut(...p))},[t.createVNode(ne,{name:"zoom-out"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"重置视图",onClick:Te},[t.createVNode(ne,{name:"reset"})]),o[31]||(o[31]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),t.createElementVNode("button",{class:"zm-tb-btn",title:"全部收起",onClick:ca},[t.createVNode(ne,{name:"collapse-all"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"展开一级",onClick:o[18]||(o[18]=p=>ci(1))},[t.createVNode(ne,{name:"expand-level-1"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"展开二级",onClick:o[19]||(o[19]=p=>ci(2))},[t.createVNode(ne,{name:"expand-level-2"})]),t.createElementVNode("button",{class:"zm-tb-btn",title:"全部展开",onClick:da},[t.createVNode(ne,{name:"expand-all"})]),o[32]||(o[32]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),t.createElementVNode("button",{class:"zm-tb-btn",title:"导出 JSON",onClick:xa},[t.createVNode(ne,{name:"export"})]),r.previewMode?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o[28]||(o[28]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),t.createElementVNode("button",{class:"zm-tb-btn",title:"添加子节点 (Tab)",onClick:o[20]||(o[20]=p=>u.value&&Ye(u.value))},[t.createElementVNode("img",{src:t.unref(wi),width:"14",height:"14",alt:"添加子节点",draggable:"false"},null,8,Pr)]),t.createElementVNode("button",{class:"zm-tb-btn",title:"添加同级 (Enter)",onClick:o[21]||(o[21]=p=>u.value&&_t(u.value))},[t.createElementVNode("img",{src:t.unref(ki),width:"14",height:"14",alt:"添加同级",draggable:"false"},null,8,Ur)]),o[29]||(o[29]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),t.createElementVNode("button",{class:t.normalizeClass(["zm-tb-btn",{active:R.layoutMode==="mindmap"}]),title:"思维导图布局 (中心辐射)",onClick:o[22]||(o[22]=p=>Zt("mindmap"))},[t.createVNode(ne,{name:"mindmap"})],2),t.createElementVNode("button",{class:t.normalizeClass(["zm-tb-btn",{active:R.layoutMode==="tree"}]),title:"树形布局 (向右展开)",onClick:o[23]||(o[23]=p=>Zt("tree"))},[t.createVNode(ne,{name:"tree"})],2),t.createElementVNode("button",{class:t.normalizeClass(["zm-tb-btn",{active:R.layoutMode==="org"}]),title:"组织结构布局 (向下展开)",onClick:o[24]||(o[24]=p=>Zt("org"))},[t.createVNode(ne,{name:"org"})],2),o[30]||(o[30]=t.createElementVNode("span",{class:"zm-tb-divider"},null,-1)),t.createElementVNode("button",{class:"zm-tb-btn",title:"导入 JSON",onClick:Ea},[t.createVNode(ne,{name:"import"})])],64))],2)],544)],4)}}}),Vr={install(e){e.component("FlowMindMap",Xn)}};ce.MindMap=Xn,ce.addChild=nn,ce.addSibling=on,ce.clone=Ce,ce.default=Vr,ce.findNode=H,ce.findParent=we,ce.markdownToMindMap=Rt,ce.markdownToRichMindMap=Xi,ce.mindMapToMarkdown=dt,ce.removeNode=At,ce.richBlockToMarkdown=qi,ce.uid=_e,Object.defineProperties(ce,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|