mind-elixir 3.1.0 → 3.1.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.
@@ -3,9 +3,9 @@ var MindElixir=function(){"use strict";const sn="";(function(e){var t,n,i,s,o,r,
3
3
  <use xlink:href="#icon-${p}"></use>
4
4
  </svg>`,g},i=n("cm-add_child","zijiedian"),s=n("cm-add_sibling","tongjijiedian-"),o=n("cm-remove_child","shanchu2"),r=n("cm-up","rising"),l=n("cm-down","falling"),c=n("cm-edit","edit"),u=document.createElement("ul");if(u.className="menu-list",t&&t.extend)for(let a=0;a<t.extend.length;a++){const p=t.extend[a],g=n(p.name,p.name);u.appendChild(g),g.onclick=m=>{p.onclick(m)}}const d=document.createElement("mmenu");d.className="mobile-menu",d.appendChild(i),d.appendChild(s),d.appendChild(o),d.appendChild(r),d.appendChild(l),d.appendChild(c),d.hidden=!0,e.container.append(d);let h=!0;e.bus.addListener("unselectNode",function(){d.hidden=!0}),e.bus.addListener("selectNode",function(a){d.hidden=!1,a.root?h=!0:h=!1}),d.onclick=a=>{a.target===d&&(d.hidden=!0)},i.onclick=()=>{e.addChild()},s.onclick=()=>{h||e.insertSibling()},o.onclick=()=>{h||e.removeNode()},r.onclick=a=>{h||e.moveUpNode()},l.onclick=a=>{h||e.moveDownNode()},c.onclick=a=>{e.beginEdit()}}const le=document,_t=function(e,t){if(!t)return ce(e),e;const n=e.getElementsByClassName("insert-preview"),i=`insert-preview ${t} show`;if(n.length>0)n[0].className=i;else{const s=le.createElement("div");s.className=i,e.appendChild(s)}return e},ce=function(e){if(!e)return;const t=e.getElementsByClassName("insert-preview");for(const n of t||[])n.remove()},we=function(e,t){const n=t.parentElement.parentElement.contains(e);return e&&e.tagName==="ME-TPC"&&e!==t&&!n&&e.nodeObj.root!==!0},wt=function(e){const t=document.createElement("div");return t.className="mind-elixir-ghost",e.map.appendChild(t),t};function kt(e){let t=null,n=null,i=null;const s=wt(e),o=12;e.map.addEventListener("dragstart",r=>{var c;const l=r.target;if((l==null?void 0:l.tagName)!=="ME-TPC"){r.preventDefault();return}t=l,t.parentElement.parentElement.style.opacity="0.5",s.innerHTML=t.innerHTML,(c=r.dataTransfer)==null||c.setDragImage(s,0,0),A.clear()}),e.map.addEventListener("dragend",async r=>{if(!t)return;t.parentElement.parentElement.style.opacity="1";const l=r.target;if(l.style.opacity="",!i)return;ce(i);const c=t.nodeObj;switch(n){case"before":e.moveNodeBefore(t,i),e.selectNode(C(c.id));break;case"after":e.moveNodeAfter(t,i),e.selectNode(C(c.id));break;case"in":e.moveNode(t,i);break}t=null}),e.map.addEventListener("dragover",We(function(r){if(!t)return;ce(i);const l=le.elementFromPoint(r.clientX,r.clientY-o);if(we(l,t)){i=l;const c=l.getBoundingClientRect().y;r.clientY>c+l.clientHeight?n="after":r.clientY>c+l.clientHeight/2&&(n="in")}else{const c=le.elementFromPoint(r.clientX,r.clientY+o);if(we(c,t)){i=c;const u=c.getBoundingClientRect().y;r.clientY<u?n="before":r.clientY<u+c.clientHeight/2&&(n="in")}else n=i=null}i&&_t(i,n)},200))}function St(e){let t=[],n=-1,i=e.getData();e.bus.addListener("operation",s=>{if(s.name==="beginEdit")return;t=t.slice(0,n+1);const o=e.getData();t.push({prev:i,currentNodeId:s.obj.id,next:o}),i=o,n=t.length-1,console.log("operation",s.obj.id,t)}),e.undo=function(){if(n>-1){const s=t[n];i=s.prev,e.refresh(s.prev),e.selectNode(C(s.currentNodeId)),n--,console.log("current",i)}},e.redo=function(){if(n<t.length-1){n++;const s=t[n];i=s.next,e.refresh(s.next),e.selectNode(C(s.currentNodeId))}},e.map.addEventListener("keydown",s=>{(s.metaKey||s.ctrlKey)&&s.shiftKey&&s.key==="Z"?e.redo():(s.metaKey||s.ctrlKey)&&s.key==="z"&&e.undo()})}const ln="",R=(e,t)=>{const n=document.createElement("span");return n.id=e,n.innerHTML=`<svg class="icon" aria-hidden="true">
5
5
  <use xlink:href="#icon-${t}"></use>
6
- </svg>`,n};function Mt(e){const t=document.createElement("div"),n=R("fullscreen","full"),i=R("toCenter","living"),s=R("zoomout","move"),o=R("zoomin","add"),r=document.createElement("span");return r.innerText="100%",t.appendChild(n),t.appendChild(i),t.appendChild(s),t.appendChild(o),t.className="mind-elixir-toolbar rb",n.onclick=()=>{e.container.requestFullscreen()},i.onclick=()=>{e.toCenter()},s.onclick=()=>{e.scaleVal<.6||e.scale(e.scaleVal-=.2)},o.onclick=()=>{e.scaleVal>1.6||e.scale(e.scaleVal+=.2)},t}function Lt(e){const t=document.createElement("div"),n=R("tbltl","left"),i=R("tbltr","right"),s=R("tblts","side");return t.appendChild(n),t.appendChild(i),t.appendChild(s),t.className="mind-elixir-toolbar lt",n.onclick=()=>{e.initLeft()},i.onclick=()=>{e.initRight()},s.onclick=()=>{e.initSide()},t}function Tt(e){e.container.append(Mt(e)),e.container.append(Lt(e))}/*! @viselect/vanilla v3.3.1 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */var $t=Object.defineProperty,At=(e,t,n)=>t in e?$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E=(e,t,n)=>(At(e,typeof t!="symbol"?t+"":t,n),n);class Ot{constructor(){E(this,"_listeners",new Map),E(this,"on",this.addEventListener),E(this,"off",this.removeEventListener),E(this,"emit",this.dispatchEvent)}addEventListener(t,n){const i=this._listeners.get(t)??new Set;return this._listeners.set(t,i),i.add(n),this}removeEventListener(t,n){var i;return(i=this._listeners.get(t))==null||i.delete(n),this}dispatchEvent(t,...n){let i=!0;for(const s of this._listeners.get(t)??[])i=s(...n)!==!1&&i;return i}unbindAllListeners(){this._listeners.clear()}}const ke=(e,t="px")=>typeof e=="number"?e+t:e;function P({style:e},t,n){if(typeof t=="object")for(const[i,s]of Object.entries(t))s!==void 0&&(e[i]=ke(s));else n!==void 0&&(e[t]=ke(n))}function Se(e){return(t,n,i,s={})=>{t instanceof HTMLCollection||t instanceof NodeList?t=Array.from(t):Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);for(const o of t)for(const r of n)o[e](r,i,{capture:!1,...s});return[t,n,i,s]}}const q=Se("addEventListener"),j=Se("removeEventListener"),Z=e=>{var t;const{clientX:n,clientY:i,target:s}=((t=e.touches)==null?void 0:t[0])??e;return{x:n,y:i,target:s}};function Me(e,t,n="touch"){switch(n){case"center":{const i=t.left+t.width/2,s=t.top+t.height/2;return i>=e.left&&i<=e.right&&s>=e.top&&s<=e.bottom}case"cover":return t.left>=e.left&&t.top>=e.top&&t.right<=e.right&&t.bottom<=e.bottom;case"touch":return e.right>=t.left&&e.left<=t.right&&e.bottom>=t.top&&e.top<=t.bottom}}function Y(e,t=document){const n=Array.isArray(e)?e:[e];let i=[];for(let s=0,o=n.length;s<o;s++){const r=n[s];typeof r=="string"?i=i.concat(Array.from(t.querySelectorAll(r))):r instanceof Element&&i.push(r)}return i}const Pt=()=>matchMedia("(hover: none), (pointer: coarse)").matches,jt=()=>"safari"in window,Dt=e=>{let t,n=-1,i=!1;return{next(...s){t=s,i||(i=!0,n=requestAnimationFrame(()=>{e(...t),i=!1}))},cancel(){cancelAnimationFrame(n),i=!1}}},{abs:z,max:Le,min:Te,ceil:$e}=Math;class Ae extends Ot{constructor(t){var n,i,s,o,r;super(),E(this,"_options"),E(this,"_selection",{stored:[],selected:[],touched:[],changed:{added:[],removed:[]}}),E(this,"_area"),E(this,"_clippingElement"),E(this,"_targetElement"),E(this,"_targetRect"),E(this,"_selectables",[]),E(this,"_latestElement"),E(this,"_areaRect",new DOMRect),E(this,"_areaLocation",{y1:0,x2:0,y2:0,x1:0}),E(this,"_singleClick",!0),E(this,"_frame"),E(this,"_scrollAvailable",!0),E(this,"_scrollingActive",!1),E(this,"_scrollSpeed",{x:0,y:0}),E(this,"_scrollDelta",{x:0,y:0}),E(this,"disable",this._bindStartEvents.bind(this,!1)),E(this,"enable",this._bindStartEvents),this._options={selectionAreaClass:"selection-area",selectionContainerClass:void 0,selectables:[],document:window.document,startAreas:["html"],boundaries:["html"],container:"body",...t,behaviour:{overlap:"invert",intersect:"touch",...t.behaviour,startThreshold:(n=t.behaviour)!=null&&n.startThreshold?typeof t.behaviour.startThreshold=="number"?t.behaviour.startThreshold:{x:10,y:10,...t.behaviour.startThreshold}:{x:10,y:10},scrolling:{speedDivider:10,manualSpeed:750,...(i=t.behaviour)==null?void 0:i.scrolling,startScrollMargins:{x:0,y:0,...(o=(s=t.behaviour)==null?void 0:s.scrolling)==null?void 0:o.startScrollMargins}}},features:{range:!0,touch:!0,...t.features,singleTap:{allow:!0,intersect:"native",...(r=t.features)==null?void 0:r.singleTap}}};for(const d of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))typeof this[d]=="function"&&(this[d]=this[d].bind(this));const{document:l,selectionAreaClass:c,selectionContainerClass:u}=this._options;this._area=l.createElement("div"),this._clippingElement=l.createElement("div"),this._clippingElement.appendChild(this._area),this._area.classList.add(c),u&&this._clippingElement.classList.add(u),P(this._area,{willChange:"top, left, bottom, right, width, height",top:0,left:0,position:"fixed"}),P(this._clippingElement,{overflow:"hidden",position:"fixed",transform:"translate3d(0, 0, 0)",pointerEvents:"none",zIndex:"1"}),this._frame=Dt(d=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",d),this._redrawSelectionArea()}),this.enable()}_bindStartEvents(t=!0){const{document:n,features:i}=this._options,s=t?q:j;s(n,"mousedown",this._onTapStart),i.touch&&s(n,"touchstart",this._onTapStart,{passive:!1})}_onTapStart(t,n=!1){const{x:i,y:s,target:o}=Z(t),{_options:r}=this,{document:l}=this._options,c=o.getBoundingClientRect(),u=Y(r.startAreas,r.document),d=Y(r.boundaries,r.document);this._targetElement=d.find(p=>Me(p.getBoundingClientRect(),c));const h=t.composedPath();if(!this._targetElement||!u.find(p=>h.includes(p))||!d.find(p=>h.includes(p))||!n&&this._emitEvent("beforestart",t)===!1)return;this._areaLocation={x1:i,y1:s,x2:0,y2:0};const a=l.scrollingElement??l.body;this._scrollDelta={x:a.scrollLeft,y:a.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),q(l,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),q(l,["mouseup","touchcancel","touchend"],this._onTapStop),q(l,"scroll",this._onScroll)}_onSingleTap(t){const{singleTap:{intersect:n},range:i}=this._options.features,s=Z(t);let o;if(n==="native")o=s.target;else if(n==="touch"){this.resolveSelectables();const{x:l,y:c}=s;o=this._selectables.find(u=>{const{right:d,left:h,top:a,bottom:p}=u.getBoundingClientRect();return l<d&&l>h&&c<p&&c>a})}if(!o)return;for(this.resolveSelectables();!this._selectables.includes(o);){if(!o.parentElement)return;o=o.parentElement}const{stored:r}=this._selection;if(this._emitEvent("start",t),t.shiftKey&&i&&this._latestElement){const l=this._latestElement,[c,u]=l.compareDocumentPosition(o)&4?[o,l]:[l,o],d=[...this._selectables.filter(h=>h.compareDocumentPosition(c)&4&&h.compareDocumentPosition(u)&2),c,u];this.select(d),this._latestElement=l}else r.includes(o)&&(r.length===1||t.ctrlKey||r.every(l=>this._selection.stored.includes(l)))?this.deselect(o):(this.select(o),this._latestElement=o);this._emitEvent("stop",t)}_delayedTapMove(t){const{container:n,document:i,behaviour:{startThreshold:s}}=this._options,{x1:o,y1:r}=this._areaLocation,{x:l,y:c}=Z(t);if(typeof s=="number"&&z(l+c-(o+r))>=s||typeof s=="object"&&z(l-o)>=s.x||z(c-r)>=s.y){if(j(i,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),this._emitEvent("beforedrag",t)===!1){j(i,["mouseup","touchcancel","touchend"],this._onTapStop);return}q(i,["mousemove","touchmove"],this._onTapMove,{passive:!1}),P(this._area,"display","block"),Y(n,i)[0].appendChild(this._clippingElement),this.resolveSelectables(),this._singleClick=!1,this._targetRect=this._targetElement.getBoundingClientRect(),this._scrollAvailable=this._targetElement.scrollHeight!==this._targetElement.clientHeight||this._targetElement.scrollWidth!==this._targetElement.clientWidth,this._scrollAvailable&&(q(i,"wheel",this._manualScroll,{passive:!1}),this._selectables=this._selectables.filter(u=>this._targetElement.contains(u))),this._setupSelectionArea(),this._emitEvent("start",t),this._onTapMove(t)}this._handleMoveEvent(t)}_setupSelectionArea(){const{_clippingElement:t,_targetElement:n,_area:i}=this,s=this._targetRect=n.getBoundingClientRect();this._scrollAvailable?(P(t,{top:s.top,left:s.left,width:s.width,height:s.height}),P(i,{marginTop:-s.top,marginLeft:-s.left})):(P(t,{top:0,left:0,width:"100%",height:"100%"}),P(i,{marginTop:0,marginLeft:0}))}_onTapMove(t){const{x:n,y:i}=Z(t),{_scrollSpeed:s,_areaLocation:o,_options:r,_frame:l}=this,{speedDivider:c}=r.behaviour.scrolling,u=this._targetElement;if(o.x2=n,o.y2=i,this._scrollAvailable&&!this._scrollingActive&&(s.y||s.x)){this._scrollingActive=!0;const d=()=>{if(!s.x&&!s.y){this._scrollingActive=!1;return}const{scrollTop:h,scrollLeft:a}=u;s.y&&(u.scrollTop+=$e(s.y/c),o.y1-=u.scrollTop-h),s.x&&(u.scrollLeft+=$e(s.x/c),o.x1-=u.scrollLeft-a),l.next(t),requestAnimationFrame(d)};requestAnimationFrame(d)}else l.next(t);this._handleMoveEvent(t)}_handleMoveEvent(t){const{features:n}=this._options;(n.touch&&Pt()||this._scrollAvailable&&jt())&&t.preventDefault()}_onScroll(){const{_scrollDelta:t,_options:{document:n}}=this,{scrollTop:i,scrollLeft:s}=n.scrollingElement??n.body;this._areaLocation.x1+=t.x-s,this._areaLocation.y1+=t.y-i,t.x=s,t.y=i,this._setupSelectionArea(),this._frame.next(null)}_manualScroll(t){const{manualSpeed:n}=this._options.behaviour.scrolling,i=t.deltaY?t.deltaY>0?1:-1:0,s=t.deltaX?t.deltaX>0?1:-1:0;this._scrollSpeed.y+=i*n,this._scrollSpeed.x+=s*n,this._onTapMove(t),t.preventDefault()}_recalculateSelectionAreaRect(){const{_scrollSpeed:t,_areaLocation:n,_areaRect:i,_targetElement:s,_options:o}=this,{scrollTop:r,scrollHeight:l,clientHeight:c,scrollLeft:u,scrollWidth:d,clientWidth:h}=s,a=this._targetRect,{x1:p,y1:g}=n;let{x2:m,y2:f}=n;const{behaviour:{scrolling:{startScrollMargins:b}}}=o;m<a.left+b.x?(t.x=u?-z(a.left-m+b.x):0,m=m<a.left?a.left:m):m>a.right-b.x?(t.x=d-u-h?z(a.left+a.width-m-b.x):0,m=m>a.right?a.right:m):t.x=0,f<a.top+b.y?(t.y=r?-z(a.top-f+b.y):0,f=f<a.top?a.top:f):f>a.bottom-b.y?(t.y=l-r-c?z(a.top+a.height-f-b.y):0,f=f>a.bottom?a.bottom:f):t.y=0;const N=Te(p,m),v=Te(g,f),y=Le(p,m),x=Le(g,f);i.x=N,i.y=v,i.width=y-N,i.height=x-v}_redrawSelectionArea(){const{x:t,y:n,width:i,height:s}=this._areaRect,{style:o}=this._area;o.left=`${t}px`,o.top=`${n}px`,o.width=`${i}px`,o.height=`${s}px`}_onTapStop(t,n){var i;const{document:s,features:o}=this._options,{_singleClick:r}=this;j(s,["mousemove","touchmove"],this._delayedTapMove),j(s,["touchmove","mousemove"],this._onTapMove),j(s,["mouseup","touchcancel","touchend"],this._onTapStop),j(s,"scroll",this._onScroll),this._keepSelection(),t&&r&&o.singleTap.allow?this._onSingleTap(t):!r&&!n&&(this._updateElementSelection(),this._emitEvent("stop",t)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,this._scrollAvailable&&j(s,"wheel",this._manualScroll,{passive:!0}),this._clippingElement.remove(),(i=this._frame)==null||i.cancel(),P(this._area,"display","none")}_updateElementSelection(){const{_selectables:t,_options:n,_selection:i,_areaRect:s}=this,{stored:o,selected:r,touched:l}=i,{intersect:c,overlap:u}=n.behaviour,d=u==="invert",h=[],a=[],p=[];for(let m=0;m<t.length;m++){const f=t[m];if(Me(s,f.getBoundingClientRect(),c)){if(r.includes(f))o.includes(f)&&!l.includes(f)&&l.push(f);else if(d&&o.includes(f)){p.push(f);continue}else a.push(f);h.push(f)}}d&&a.push(...o.filter(m=>!r.includes(m)));const g=u==="keep";for(let m=0;m<r.length;m++){const f=r[m];!h.includes(f)&&!(g&&o.includes(f))&&p.push(f)}i.selected=h,i.changed={added:a,removed:p},this._latestElement=void 0}_emitEvent(t,n){return this.emit(t,{event:n,store:this._selection,selection:this})}_keepSelection(){const{_options:t,_selection:n}=this,{selected:i,changed:s,touched:o,stored:r}=n,l=i.filter(c=>!r.includes(c));switch(t.behaviour.overlap){case"drop":{n.stored=[...l,...r.filter(c=>!o.includes(c))];break}case"invert":{n.stored=[...l,...r.filter(c=>!s.removed.includes(c))];break}case"keep":{n.stored=[...r,...i.filter(c=>!r.includes(c))];break}}}trigger(t,n=!0){this._onTapStart(t,n)}resolveSelectables(){this._selectables=Y(this._options.selectables,this._options.document)}clearSelection(t=!0,n=!1){const{selected:i,stored:s,changed:o}=this._selection;o.added=[],o.removed.push(...i,...t?s:[]),n||(this._emitEvent("move",null),this._emitEvent("stop",null)),this._selection={stored:t?[]:s,selected:[],touched:[],changed:{added:[],removed:[]}}}getSelection(){return this._selection.stored}getSelectionArea(){return this._area}cancel(t=!1){this._onTapStop(null,!t)}destroy(){this.cancel(),this.disable(),this._clippingElement.remove(),super.unbindAllListeners()}select(t,n=!1){const{changed:i,selected:s,stored:o}=this._selection,r=Y(t,this._options.document).filter(l=>!s.includes(l)&&!o.includes(l));return o.push(...r),s.push(...r),i.added.push(...r),i.removed=[],this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null)),r}deselect(t,n=!1){const{selected:i,stored:s,changed:o}=this._selection,r=Y(t,this._options.document).filter(l=>i.includes(l)||s.includes(l));r.length&&(this._selection.stored=s.filter(l=>!r.includes(l)),this._selection.selected=i.filter(l=>!r.includes(l)),this._selection.changed.added=[],this._selection.changed.removed.push(...r.filter(l=>!o.removed.includes(l))),this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null)))}}E(Ae,"version","3.3.1");function Ht(e){const t=new Ae({selectables:["#map me-tpc"],boundaries:["#map .map-container"],container:".map-container",behaviour:{scrolling:{speedDivider:10,manualSpeed:750,startScrollMargins:{x:10,y:10}}}}).on("beforestart",({event:n})=>!(n.button!==0||n.target.tagName==="ME-TPC"||n.target.id==="input-box")).on("start",({event:n})=>{!n.ctrlKey&&!n.metaKey&&(e.unselectNode(),e.unselectNodes(),e.unselectSummary(),t.clearSelection(!0,!0))}).on("move",({store:{changed:{added:n,removed:i}}})=>{A.moved=!0;for(const s of n)s.classList.add("selected");for(const s of i)s.classList.remove("selected")}).on("stop",({store:{stored:n}})=>{console.log(n,"stored"),e.selectNodes(n)});console.log(t,"selection")}const Bt=function(e,t=!0){this.theme=e;const n=this.theme.cssVar,i=Object.keys(n);for(let s=0;s<i.length;s++){const o=i[s];this.mindElixirBox.style.setProperty(o,n[o])}t&&this.refresh()};function Oe(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,linkData:e.linkData,direction:e.direction,theme:e.theme}}const Rt=Object.freeze(Object.defineProperty({__proto__:null,cancelFocus:function(){this.isFocusMode=!1,this.tempDirection!==null&&(delete this.nodeData.root,this.nodeData=this.nodeDataBackup,this.direction=this.tempDirection,this.tempDirection=null,this.refresh(),this.toCenter())},disableEdit:function(){this.editable=!1},enableEdit:function(){this.editable=!0},expandNode:function(e,t){const n=e.nodeObj;typeof t=="boolean"?n.expanded=t:n.expanded!==!1?n.expanded=!1:n.expanded=!0,this.layout(),this.linkDiv(),this.bus.fire("expandNode",n)},focusNode:function(e){e.nodeObj.root||(this.tempDirection===null&&(this.tempDirection=this.direction),this.isFocusMode||(this.nodeDataBackup=this.nodeData,this.isFocusMode=!0),this.nodeData=e.nodeObj,this.nodeData.root=!0,this.initRight(),this.toCenter())},getData:function(){return JSON.parse(this.getDataString())},getDataMd:function(){const e=Oe(this).nodeData;let t="# "+e.topic+`
6
+ </svg>`,n};function Mt(e){const t=document.createElement("div"),n=R("fullscreen","full"),i=R("toCenter","living"),s=R("zoomout","move"),o=R("zoomin","add"),r=document.createElement("span");return r.innerText="100%",t.appendChild(n),t.appendChild(i),t.appendChild(s),t.appendChild(o),t.className="mind-elixir-toolbar rb",n.onclick=()=>{e.container.requestFullscreen()},i.onclick=()=>{e.toCenter()},s.onclick=()=>{e.scaleVal<.6||e.scale(e.scaleVal-=.2)},o.onclick=()=>{e.scaleVal>1.6||e.scale(e.scaleVal+=.2)},t}function Lt(e){const t=document.createElement("div"),n=R("tbltl","left"),i=R("tbltr","right"),s=R("tblts","side");return t.appendChild(n),t.appendChild(i),t.appendChild(s),t.className="mind-elixir-toolbar lt",n.onclick=()=>{e.initLeft()},i.onclick=()=>{e.initRight()},s.onclick=()=>{e.initSide()},t}function Tt(e){e.container.append(Mt(e)),e.container.append(Lt(e))}/*! @viselect/vanilla v3.3.1 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */var $t=Object.defineProperty,At=(e,t,n)=>t in e?$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E=(e,t,n)=>(At(e,typeof t!="symbol"?t+"":t,n),n);class Ot{constructor(){E(this,"_listeners",new Map),E(this,"on",this.addEventListener),E(this,"off",this.removeEventListener),E(this,"emit",this.dispatchEvent)}addEventListener(t,n){const i=this._listeners.get(t)??new Set;return this._listeners.set(t,i),i.add(n),this}removeEventListener(t,n){var i;return(i=this._listeners.get(t))==null||i.delete(n),this}dispatchEvent(t,...n){let i=!0;for(const s of this._listeners.get(t)??[])i=s(...n)!==!1&&i;return i}unbindAllListeners(){this._listeners.clear()}}const ke=(e,t="px")=>typeof e=="number"?e+t:e;function P({style:e},t,n){if(typeof t=="object")for(const[i,s]of Object.entries(t))s!==void 0&&(e[i]=ke(s));else n!==void 0&&(e[t]=ke(n))}function Se(e){return(t,n,i,s={})=>{t instanceof HTMLCollection||t instanceof NodeList?t=Array.from(t):Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);for(const o of t)for(const r of n)o[e](r,i,{capture:!1,...s});return[t,n,i,s]}}const q=Se("addEventListener"),j=Se("removeEventListener"),Z=e=>{var t;const{clientX:n,clientY:i,target:s}=((t=e.touches)==null?void 0:t[0])??e;return{x:n,y:i,target:s}};function Me(e,t,n="touch"){switch(n){case"center":{const i=t.left+t.width/2,s=t.top+t.height/2;return i>=e.left&&i<=e.right&&s>=e.top&&s<=e.bottom}case"cover":return t.left>=e.left&&t.top>=e.top&&t.right<=e.right&&t.bottom<=e.bottom;case"touch":return e.right>=t.left&&e.left<=t.right&&e.bottom>=t.top&&e.top<=t.bottom}}function Y(e,t=document){const n=Array.isArray(e)?e:[e];let i=[];for(let s=0,o=n.length;s<o;s++){const r=n[s];typeof r=="string"?i=i.concat(Array.from(t.querySelectorAll(r))):r instanceof Element&&i.push(r)}return i}const Pt=()=>matchMedia("(hover: none), (pointer: coarse)").matches,jt=()=>"safari"in window,Dt=e=>{let t,n=-1,i=!1;return{next(...s){t=s,i||(i=!0,n=requestAnimationFrame(()=>{e(...t),i=!1}))},cancel(){cancelAnimationFrame(n),i=!1}}},{abs:z,max:Le,min:Te,ceil:$e}=Math;class Ae extends Ot{constructor(t){var n,i,s,o,r;super(),E(this,"_options"),E(this,"_selection",{stored:[],selected:[],touched:[],changed:{added:[],removed:[]}}),E(this,"_area"),E(this,"_clippingElement"),E(this,"_targetElement"),E(this,"_targetRect"),E(this,"_selectables",[]),E(this,"_latestElement"),E(this,"_areaRect",new DOMRect),E(this,"_areaLocation",{y1:0,x2:0,y2:0,x1:0}),E(this,"_singleClick",!0),E(this,"_frame"),E(this,"_scrollAvailable",!0),E(this,"_scrollingActive",!1),E(this,"_scrollSpeed",{x:0,y:0}),E(this,"_scrollDelta",{x:0,y:0}),E(this,"disable",this._bindStartEvents.bind(this,!1)),E(this,"enable",this._bindStartEvents),this._options={selectionAreaClass:"selection-area",selectionContainerClass:void 0,selectables:[],document:window.document,startAreas:["html"],boundaries:["html"],container:"body",...t,behaviour:{overlap:"invert",intersect:"touch",...t.behaviour,startThreshold:(n=t.behaviour)!=null&&n.startThreshold?typeof t.behaviour.startThreshold=="number"?t.behaviour.startThreshold:{x:10,y:10,...t.behaviour.startThreshold}:{x:10,y:10},scrolling:{speedDivider:10,manualSpeed:750,...(i=t.behaviour)==null?void 0:i.scrolling,startScrollMargins:{x:0,y:0,...(o=(s=t.behaviour)==null?void 0:s.scrolling)==null?void 0:o.startScrollMargins}}},features:{range:!0,touch:!0,...t.features,singleTap:{allow:!0,intersect:"native",...(r=t.features)==null?void 0:r.singleTap}}};for(const d of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))typeof this[d]=="function"&&(this[d]=this[d].bind(this));const{document:l,selectionAreaClass:c,selectionContainerClass:u}=this._options;this._area=l.createElement("div"),this._clippingElement=l.createElement("div"),this._clippingElement.appendChild(this._area),this._area.classList.add(c),u&&this._clippingElement.classList.add(u),P(this._area,{willChange:"top, left, bottom, right, width, height",top:0,left:0,position:"fixed"}),P(this._clippingElement,{overflow:"hidden",position:"fixed",transform:"translate3d(0, 0, 0)",pointerEvents:"none",zIndex:"1"}),this._frame=Dt(d=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",d),this._redrawSelectionArea()}),this.enable()}_bindStartEvents(t=!0){const{document:n,features:i}=this._options,s=t?q:j;s(n,"mousedown",this._onTapStart),i.touch&&s(n,"touchstart",this._onTapStart,{passive:!1})}_onTapStart(t,n=!1){const{x:i,y:s,target:o}=Z(t),{_options:r}=this,{document:l}=this._options,c=o.getBoundingClientRect(),u=Y(r.startAreas,r.document),d=Y(r.boundaries,r.document);this._targetElement=d.find(p=>Me(p.getBoundingClientRect(),c));const h=t.composedPath();if(!this._targetElement||!u.find(p=>h.includes(p))||!d.find(p=>h.includes(p))||!n&&this._emitEvent("beforestart",t)===!1)return;this._areaLocation={x1:i,y1:s,x2:0,y2:0};const a=l.scrollingElement??l.body;this._scrollDelta={x:a.scrollLeft,y:a.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),q(l,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),q(l,["mouseup","touchcancel","touchend"],this._onTapStop),q(l,"scroll",this._onScroll)}_onSingleTap(t){const{singleTap:{intersect:n},range:i}=this._options.features,s=Z(t);let o;if(n==="native")o=s.target;else if(n==="touch"){this.resolveSelectables();const{x:l,y:c}=s;o=this._selectables.find(u=>{const{right:d,left:h,top:a,bottom:p}=u.getBoundingClientRect();return l<d&&l>h&&c<p&&c>a})}if(!o)return;for(this.resolveSelectables();!this._selectables.includes(o);){if(!o.parentElement)return;o=o.parentElement}const{stored:r}=this._selection;if(this._emitEvent("start",t),t.shiftKey&&i&&this._latestElement){const l=this._latestElement,[c,u]=l.compareDocumentPosition(o)&4?[o,l]:[l,o],d=[...this._selectables.filter(h=>h.compareDocumentPosition(c)&4&&h.compareDocumentPosition(u)&2),c,u];this.select(d),this._latestElement=l}else r.includes(o)&&(r.length===1||t.ctrlKey||r.every(l=>this._selection.stored.includes(l)))?this.deselect(o):(this.select(o),this._latestElement=o);this._emitEvent("stop",t)}_delayedTapMove(t){const{container:n,document:i,behaviour:{startThreshold:s}}=this._options,{x1:o,y1:r}=this._areaLocation,{x:l,y:c}=Z(t);if(typeof s=="number"&&z(l+c-(o+r))>=s||typeof s=="object"&&z(l-o)>=s.x||z(c-r)>=s.y){if(j(i,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),this._emitEvent("beforedrag",t)===!1){j(i,["mouseup","touchcancel","touchend"],this._onTapStop);return}q(i,["mousemove","touchmove"],this._onTapMove,{passive:!1}),P(this._area,"display","block"),Y(n,i)[0].appendChild(this._clippingElement),this.resolveSelectables(),this._singleClick=!1,this._targetRect=this._targetElement.getBoundingClientRect(),this._scrollAvailable=this._targetElement.scrollHeight!==this._targetElement.clientHeight||this._targetElement.scrollWidth!==this._targetElement.clientWidth,this._scrollAvailable&&(q(i,"wheel",this._manualScroll,{passive:!1}),this._selectables=this._selectables.filter(u=>this._targetElement.contains(u))),this._setupSelectionArea(),this._emitEvent("start",t),this._onTapMove(t)}this._handleMoveEvent(t)}_setupSelectionArea(){const{_clippingElement:t,_targetElement:n,_area:i}=this,s=this._targetRect=n.getBoundingClientRect();this._scrollAvailable?(P(t,{top:s.top,left:s.left,width:s.width,height:s.height}),P(i,{marginTop:-s.top,marginLeft:-s.left})):(P(t,{top:0,left:0,width:"100%",height:"100%"}),P(i,{marginTop:0,marginLeft:0}))}_onTapMove(t){const{x:n,y:i}=Z(t),{_scrollSpeed:s,_areaLocation:o,_options:r,_frame:l}=this,{speedDivider:c}=r.behaviour.scrolling,u=this._targetElement;if(o.x2=n,o.y2=i,this._scrollAvailable&&!this._scrollingActive&&(s.y||s.x)){this._scrollingActive=!0;const d=()=>{if(!s.x&&!s.y){this._scrollingActive=!1;return}const{scrollTop:h,scrollLeft:a}=u;s.y&&(u.scrollTop+=$e(s.y/c),o.y1-=u.scrollTop-h),s.x&&(u.scrollLeft+=$e(s.x/c),o.x1-=u.scrollLeft-a),l.next(t),requestAnimationFrame(d)};requestAnimationFrame(d)}else l.next(t);this._handleMoveEvent(t)}_handleMoveEvent(t){const{features:n}=this._options;(n.touch&&Pt()||this._scrollAvailable&&jt())&&t.preventDefault()}_onScroll(){const{_scrollDelta:t,_options:{document:n}}=this,{scrollTop:i,scrollLeft:s}=n.scrollingElement??n.body;this._areaLocation.x1+=t.x-s,this._areaLocation.y1+=t.y-i,t.x=s,t.y=i,this._setupSelectionArea(),this._frame.next(null)}_manualScroll(t){const{manualSpeed:n}=this._options.behaviour.scrolling,i=t.deltaY?t.deltaY>0?1:-1:0,s=t.deltaX?t.deltaX>0?1:-1:0;this._scrollSpeed.y+=i*n,this._scrollSpeed.x+=s*n,this._onTapMove(t),t.preventDefault()}_recalculateSelectionAreaRect(){const{_scrollSpeed:t,_areaLocation:n,_areaRect:i,_targetElement:s,_options:o}=this,{scrollTop:r,scrollHeight:l,clientHeight:c,scrollLeft:u,scrollWidth:d,clientWidth:h}=s,a=this._targetRect,{x1:p,y1:g}=n;let{x2:m,y2:f}=n;const{behaviour:{scrolling:{startScrollMargins:b}}}=o;m<a.left+b.x?(t.x=u?-z(a.left-m+b.x):0,m=m<a.left?a.left:m):m>a.right-b.x?(t.x=d-u-h?z(a.left+a.width-m-b.x):0,m=m>a.right?a.right:m):t.x=0,f<a.top+b.y?(t.y=r?-z(a.top-f+b.y):0,f=f<a.top?a.top:f):f>a.bottom-b.y?(t.y=l-r-c?z(a.top+a.height-f-b.y):0,f=f>a.bottom?a.bottom:f):t.y=0;const N=Te(p,m),v=Te(g,f),y=Le(p,m),x=Le(g,f);i.x=N,i.y=v,i.width=y-N,i.height=x-v}_redrawSelectionArea(){const{x:t,y:n,width:i,height:s}=this._areaRect,{style:o}=this._area;o.left=`${t}px`,o.top=`${n}px`,o.width=`${i}px`,o.height=`${s}px`}_onTapStop(t,n){var i;const{document:s,features:o}=this._options,{_singleClick:r}=this;j(s,["mousemove","touchmove"],this._delayedTapMove),j(s,["touchmove","mousemove"],this._onTapMove),j(s,["mouseup","touchcancel","touchend"],this._onTapStop),j(s,"scroll",this._onScroll),this._keepSelection(),t&&r&&o.singleTap.allow?this._onSingleTap(t):!r&&!n&&(this._updateElementSelection(),this._emitEvent("stop",t)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,this._scrollAvailable&&j(s,"wheel",this._manualScroll,{passive:!0}),this._clippingElement.remove(),(i=this._frame)==null||i.cancel(),P(this._area,"display","none")}_updateElementSelection(){const{_selectables:t,_options:n,_selection:i,_areaRect:s}=this,{stored:o,selected:r,touched:l}=i,{intersect:c,overlap:u}=n.behaviour,d=u==="invert",h=[],a=[],p=[];for(let m=0;m<t.length;m++){const f=t[m];if(Me(s,f.getBoundingClientRect(),c)){if(r.includes(f))o.includes(f)&&!l.includes(f)&&l.push(f);else if(d&&o.includes(f)){p.push(f);continue}else a.push(f);h.push(f)}}d&&a.push(...o.filter(m=>!r.includes(m)));const g=u==="keep";for(let m=0;m<r.length;m++){const f=r[m];!h.includes(f)&&!(g&&o.includes(f))&&p.push(f)}i.selected=h,i.changed={added:a,removed:p},this._latestElement=void 0}_emitEvent(t,n){return this.emit(t,{event:n,store:this._selection,selection:this})}_keepSelection(){const{_options:t,_selection:n}=this,{selected:i,changed:s,touched:o,stored:r}=n,l=i.filter(c=>!r.includes(c));switch(t.behaviour.overlap){case"drop":{n.stored=[...l,...r.filter(c=>!o.includes(c))];break}case"invert":{n.stored=[...l,...r.filter(c=>!s.removed.includes(c))];break}case"keep":{n.stored=[...r,...i.filter(c=>!r.includes(c))];break}}}trigger(t,n=!0){this._onTapStart(t,n)}resolveSelectables(){this._selectables=Y(this._options.selectables,this._options.document)}clearSelection(t=!0,n=!1){const{selected:i,stored:s,changed:o}=this._selection;o.added=[],o.removed.push(...i,...t?s:[]),n||(this._emitEvent("move",null),this._emitEvent("stop",null)),this._selection={stored:t?[]:s,selected:[],touched:[],changed:{added:[],removed:[]}}}getSelection(){return this._selection.stored}getSelectionArea(){return this._area}cancel(t=!1){this._onTapStop(null,!t)}destroy(){this.cancel(),this.disable(),this._clippingElement.remove(),super.unbindAllListeners()}select(t,n=!1){const{changed:i,selected:s,stored:o}=this._selection,r=Y(t,this._options.document).filter(l=>!s.includes(l)&&!o.includes(l));return o.push(...r),s.push(...r),i.added.push(...r),i.removed=[],this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null)),r}deselect(t,n=!1){const{selected:i,stored:s,changed:o}=this._selection,r=Y(t,this._options.document).filter(l=>i.includes(l)||s.includes(l));r.length&&(this._selection.stored=s.filter(l=>!r.includes(l)),this._selection.selected=i.filter(l=>!r.includes(l)),this._selection.changed.added=[],this._selection.changed.removed.push(...r.filter(l=>!o.removed.includes(l))),this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null)))}}E(Ae,"version","3.3.1");function Ht(e){const t=new Ae({selectables:["#map me-tpc"],boundaries:["#map .map-container"],container:".map-container",behaviour:{scrolling:{speedDivider:10,manualSpeed:750,startScrollMargins:{x:10,y:10}}}}).on("beforestart",({event:n})=>!(n.button!==0||n.target.tagName==="ME-TPC"||n.target.id==="input-box")).on("start",({event:n})=>{!n.ctrlKey&&!n.metaKey&&(e.unselectNode(),e.unselectNodes(),e.unselectSummary(),t.clearSelection(!0,!0))}).on("move",({store:{changed:{added:n,removed:i}}})=>{A.moved=!0;for(const s of n)s.classList.add("selected");for(const s of i)s.classList.remove("selected")}).on("stop",({store:{stored:n}})=>{console.log(n,"stored"),e.selectNodes(n)});console.log(t,"selection")}const Bt=function(e,t=!0){this.theme=e;const n=this.theme.cssVar,i=Object.keys(n);for(let s=0;s<i.length;s++){const o=i[s];this.mindElixirBox.style.setProperty(o,n[o])}t&&this.refresh()};function Oe(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,linkData:e.linkData,summaries:e.summaries,direction:e.direction,theme:e.theme}}const Rt=Object.freeze(Object.defineProperty({__proto__:null,cancelFocus:function(){this.isFocusMode=!1,this.tempDirection!==null&&(delete this.nodeData.root,this.nodeData=this.nodeDataBackup,this.direction=this.tempDirection,this.tempDirection=null,this.refresh(),this.toCenter())},disableEdit:function(){this.editable=!1},enableEdit:function(){this.editable=!0},expandNode:function(e,t){const n=e.nodeObj;typeof t=="boolean"?n.expanded=t:n.expanded!==!1?n.expanded=!1:n.expanded=!0,this.layout(),this.linkDiv(),this.bus.fire("expandNode",n)},focusNode:function(e){e.nodeObj.root||(this.tempDirection===null&&(this.tempDirection=this.direction),this.isFocusMode||(this.nodeDataBackup=this.nodeData,this.isFocusMode=!0),this.nodeData=e.nodeObj,this.nodeData.root=!0,this.initRight(),this.toCenter())},getData:function(){return JSON.parse(this.getDataString())},getDataMd:function(){const e=Oe(this).nodeData;let t="# "+e.topic+`
7
7
 
8
8
  `;function n(i,s){for(let o=0;o<i.length;o++)s<=6?t+="".padStart(s,"#")+" "+i[o].topic+`
9
9
 
10
10
  `:t+="".padStart(s-7," ")+"- "+i[o].topic+`
11
- `,i[o].children&&n(i[o].children||[],s+1)}return n(e.children||[],2),t},getDataString:function(){const e=Oe(this);return JSON.stringify(e,(t,n)=>{if(t!=="parent")return t==="from"||t==="to"?n.nodeObj.id:n})},initLeft:function(){this.direction=0,this.refresh()},initRight:function(){this.direction=1,this.refresh()},initSide:function(){this.direction=2,this.refresh()},install:function(e){e(this)},refresh:function(e){e&&(e=JSON.parse(JSON.stringify(e)),this.nodeData=e.nodeData,this.linkData=e.linkData||{}),$(this.nodeData),this.layout(),this.linkDiv()},scale:function(e){this.scaleVal=e,this.map.style.transform="scale("+e+")"},selectFirstChild:function(){if(!this.currentNode)return;const e=this.currentNode.parentElement.nextSibling;if(e&&e.firstChild){const t=e.firstChild.firstChild.firstChild;this.selectNode(t)}},selectNextSibling:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return!1;const e=this.currentNode.parentElement.parentElement.nextSibling;let t;if(e)t=e.firstChild.firstChild;else return!1;return this.selectNode(t),!0},selectNode:function(e,t,n){if(e){if(console.time("selectNode"),typeof e=="string"){const i=C(e);return i?this.selectNode(i):void 0}this.currentNode&&(this.currentNode.className=""),e.className="selected",e.scrollIntoView({block:"nearest",inline:"nearest"}),this.currentNode=e,t?this.bus.fire("selectNewNode",e.nodeObj):this.bus.fire("selectNode",e.nodeObj,n),console.timeEnd("selectNode")}},selectNodes:function(e){if(e){console.time("selectNodes");for(const t of e)t.className="selected";this.currentNodes=e,this.bus.fire("selectNodes",e.map(t=>t.nodeObj)),console.timeEnd("selectNodes")}},selectParent:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return;const e=this.currentNode.parentElement.parentElement.parentElement.previousSibling;if(e){const t=e.firstChild;this.selectNode(t)}},selectPrevSibling:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return!1;const e=this.currentNode.parentElement.parentElement.previousSibling;let t;if(e)t=e.firstChild.firstChild;else return!1;return this.selectNode(t),!0},setLocale:function(e){this.locale=e,this.refresh()},toCenter:function(){this.container.scrollTo(1e4-this.container.offsetWidth/2,1e4-this.container.offsetHeight/2)},unselectNode:function(){this.currentNode&&(this.currentNode.className=""),this.currentNode=null,this.bus.fire("unselectNode")},unselectNodes:function(){if(this.currentNodes)for(const e of this.currentNodes)e.classList.remove("selected");this.currentNodes=null,this.bus.fire("unselectNodes")}},Symbol.toStringTag,{value:"Module"})),ee=function(e){const n=e.parentElement.parentElement.lastElementChild;(n==null?void 0:n.tagName)==="svg"&&(n==null||n.remove())},Pe=function(e,t){var n,i;if(e===S)return S;if(e===D)return D;if(e===W){const s=((n=document.querySelector(".lhs"))==null?void 0:n.childElementCount)||0,o=((i=document.querySelector(".rhs"))==null?void 0:i.childElementCount)||0;return s<=o?(t.direction=S,S):(t.direction=D,D)}},zt=function(e,t){console.log(t);const n=e.nodeObj,i=pe(n);i.style&&t.style&&(t.style=Object.assign(i.style,t.style));const s=Object.assign(n,t);re(e,s),this.linkDiv(),this.bus.fire("operation",{name:"reshapeNode",obj:s,origin:i})},Vt=function(e,t){var u,d,h;const n=e||this.currentNode;if(!n)return;const i=n.nodeObj;if(i.root===!0){this.addChild();return}else if(((u=i.parent)==null?void 0:u.root)===!0&&((h=(d=i.parent)==null?void 0:d.children)==null?void 0:h.length)===1){this.addChild(C(i.parent.id));return}const s=t||this.generateNewObj();Ge(i,s),$(this.nodeData);const o=n.parentElement;console.time("insertSibling_DOM");const{grp:r,top:l}=this.createWrapper(s);o.parentNode.parentNode.insertBefore(r,o.parentNode.nextSibling),this.linkDiv(r.offsetParent),t||this.editTopic(l.firstChild),this.selectNode(l.firstChild,!0),console.timeEnd("insertSibling_DOM"),this.bus.fire("operation",{name:"insertSibling",obj:s})},Ft=function(e,t){const n=e||this.currentNode;if(!n)return;const i=n.nodeObj;if(i.root===!0){this.addChild();return}const s=t||this.generateNewObj();Je(i,s),$(this.nodeData);const o=n.parentElement;console.time("insertSibling_DOM");const{grp:r,top:l}=this.createWrapper(s);o.parentNode.parentNode.insertBefore(r,o.parentNode),this.linkDiv(r.offsetParent),t||this.editTopic(l.firstChild),this.selectNode(l.firstChild,!0),console.timeEnd("insertSibling_DOM"),this.bus.fire("operation",{name:"insertBefore",obj:s})},qt=function(e,t){const n=e||this.currentNode;if(!n)return;ee(n);const i=n.nodeObj;if(i.root===!0)return;const s=t||this.generateNewObj();Qe(i,s),$(this.nodeData);const o=n.parentElement.parentElement;console.time("insertParent_DOM");const{grp:r,top:l}=this.createWrapper(s,!0);l.appendChild(Q(!0)),o.insertAdjacentElement("afterend",r);const c=this.createChildren([o]);l.insertAdjacentElement("afterend",c),this.linkDiv(),t||this.editTopic(l.firstChild),this.selectNode(l.firstChild,!0),console.timeEnd("insertParent_DOM"),this.bus.fire("operation",{name:"insertParent",obj:s})},je=function(e,t){var l,c;if(!e)return null;const n=e.nodeObj;n.expanded===!1&&(this.expandNode(e,!0),e=C(n.id));const i=t||this.generateNewObj();n.children?n.children.push(i):n.children=[i],$(this.nodeData);const s=e.parentElement,{grp:o,top:r}=this.createWrapper(i);if(s.tagName==="ME-PARENT"){if(s.children[1])s.nextSibling.appendChild(o);else{const u=this.createChildren([o]);s.appendChild(Q(!0)),s.insertAdjacentElement("afterend",u)}this.linkDiv(o.offsetParent)}else s.tagName==="ME-ROOT"&&(Pe(this.direction,i)===S?(l=document.querySelector(".lhs"))==null||l.appendChild(o):(c=document.querySelector(".rhs"))==null||c.appendChild(o),this.linkDiv());return{newTop:r,newNodeObj:i}},De=Object.freeze(Object.defineProperty({__proto__:null,addChild:function(e,t){console.time("addChild");const n=e||this.currentNode;if(!n)return;const i=je.call(this,n,t);if(!i)return;const{newTop:s,newNodeObj:o}=i;this.bus.fire("operation",{name:"addChild",obj:o}),console.timeEnd("addChild"),t||this.editTopic(s.firstChild),this.selectNode(s.firstChild,!0)},beginEdit:function(e){const t=e||this.currentNode;t&&this.editTopic(t)},copyNode:function(e,t){console.time("copyNode");const n=pe(e.nodeObj);ue(n);const i=je.call(this,t,n);if(!i)return;const{newNodeObj:s}=i;console.timeEnd("copyNode"),this.bus.fire("operation",{name:"copyNode",obj:s})},insertBefore:Ft,insertParent:qt,insertSibling:Vt,moveDownNode:function(e){const t=e||this.currentNode;if(!t)return;const n=t.parentNode.parentNode,i=t.nodeObj;Ue(i),n.nextSibling?n.nextSibling.insertAdjacentElement("afterend",n):n.parentNode.prepend(n),this.linkDiv(),this.bus.fire("operation",{name:"moveDownNode",obj:i})},moveNode:function(e,t){var l;const n=e.nodeObj,i=t.nodeObj,s=(l=n==null?void 0:n.parent)==null?void 0:l.id;if(i.expanded===!1&&(this.expandNode(t,!0),e=C(n.id),t=C(i.id)),!Ie(n,i)){console.warn("Invalid move");return}console.time("moveNode"),Ze(n,i),$(this.nodeData);const o=e.parentElement,r=t.parentElement;if(r.tagName==="ME-PARENT")if(ee(e),r.children[1])r.nextSibling.appendChild(o.parentElement);else{const c=this.createChildren([o.parentElement]);r.appendChild(Q(!0)),r.parentElement.insertBefore(c,r.nextSibling)}else r.tagName==="ME-ROOT"&&(Pe(this.direction,n),r.nextSibling.appendChild(o.parentElement));this.linkDiv(),this.bus.fire("operation",{name:"moveNode",obj:n,toObj:i,originParentId:s}),console.timeEnd("moveNode")},moveNodeAfter:function(e,t){var u;const n=e.nodeObj,i=t.nodeObj,s=(u=n.parent)==null?void 0:u.id;tt(n,i),$(this.nodeData),ee(e);const r=e.parentElement.parentElement;t.parentElement.parentElement.insertAdjacentElement("afterend",r),this.linkDiv(),this.bus.fire("operation",{name:"moveNodeAfter",obj:n,toObj:i,originParentId:s})},moveNodeBefore:function(e,t){var u;const n=e.nodeObj,i=t.nodeObj,s=(u=n.parent)==null?void 0:u.id;et(n,i),$(this.nodeData),ee(e);const r=e.parentElement.parentNode;t.parentElement.parentNode.insertAdjacentElement("beforebegin",r),this.linkDiv(),this.bus.fire("operation",{name:"moveNodeBefore",obj:n,toObj:i,originParentId:s})},moveUpNode:function(e){const t=e||this.currentNode;if(!t)return;const n=t.parentNode.parentNode,i=t.nodeObj;Ke(i),n.parentNode.insertBefore(n,n.previousSibling),this.linkDiv(),this.bus.fire("operation",{name:"moveUpNode",obj:i})},removeNode:function(e){var l;const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;if(n.root===!0)throw new Error("Can not remove root node");const i=n.parent.children,s=i.findIndex(c=>c===n),o=G(n),r=t.parentNode;if(o===0){const c=r.parentNode.parentNode;c.tagName!=="ME-MAIN"&&c.previousSibling.children[1].remove()}if(i.length!==0){const c=i[s]||i[s-1];this.selectNode(C(c.id))}else this.selectNode(C(n.parent.id));for(const c in this.linkData){const u=this.linkData[c];if(u.from===n.id||u.to===n.id){const d=this.mindElixirBox.querySelector(`[data-linkid=${this.linkData[c].id}]`);this.removeLink(d)}}r.parentNode.remove(),this.linkDiv(),this.bus.fire("operation",{name:"removeNode",obj:n,originIndex:s,originParentId:(l=n==null?void 0:n.parent)==null?void 0:l.id})},reshapeNode:zt,setNodeTopic:function(e,t){e.childNodes[0].textContent=t,e.nodeObj.topic=t,this.linkDiv()}},Symbol.toStringTag,{value:"Module"})),He={create:function(e){return{dom:e,mousedown:!1,lastX:0,lastY:0,handleMouseMove(t){if(t.stopPropagation(),this.mousedown){if(!this.lastX){this.lastX=t.pageX,this.lastY=t.pageY;return}const n=this.lastX-t.pageX,i=this.lastY-t.pageY;this.cb&&this.cb(n,i),this.lastX=t.pageX,this.lastY=t.pageY}},handleMouseDown(t){t.stopPropagation(),this.mousedown=!0},handleClear(t){t.stopPropagation(),this.clear()},cb:null,init(t,n){this.cb=n,this.handleClear=this.handleClear.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),t.addEventListener("mousemove",this.handleMouseMove),t.addEventListener("mouseleave",this.handleClear),t.addEventListener("mouseup",this.handleClear),this.dom.addEventListener("mousedown",this.handleMouseDown)},destory(t){t.removeEventListener("mousemove",this.handleMouseMove),t.removeEventListener("mouseleave",this.handleClear),t.removeEventListener("mouseup",this.handleClear),this.dom.removeEventListener("mousedown",this.handleMouseDown)},clear(){this.mousedown=!1,this.lastX=0,this.lastY=0}}}},Yt=Object.freeze(Object.defineProperty({__proto__:null,createLink:function(e,t,n,i){const s=this.map.getBoundingClientRect();if(!e||!t)return;const o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),l=(o.x+o.width/2-s.x)/this.scaleVal,c=(o.y+o.height/2-s.y)/this.scaleVal,u=(r.x+r.width/2-s.x)/this.scaleVal,d=(r.y+r.height/2-s.y)/this.scaleVal;let h,a,p,g;n&&i?(h=l+i.delta1.x,a=c+i.delta1.y,p=u+i.delta2.x,g=d+i.delta2.y):(c+d)/2-c<=o.height/2?(h=(o.x+o.width-s.x)/this.scaleVal+100,a=c,p=(r.x+r.width-s.x)/this.scaleVal+100,g=d):(h=(l+u)/2,a=(c+d)/2,p=(l+u)/2,g=(c+d)/2);const m={cx:l,cy:c,w:o.width,h:o.height},f={cx:u,cy:d,w:r.width,h:r.height},b=ie(m,h,a),N=b.x,v=b.y,y=se(f,p,g),x=y.x,_=y.y,V=fe(p,g,x,_),w={id:"",label:"",from:e.nodeObj.id,to:t.nodeObj.id,delta1:{x:h-l,y:a-c},delta2:{x:p-u,y:g-d}},F=pt(`M ${N} ${v} C ${h} ${a} ${p} ${g} ${x} ${_}`,`M ${V.x1} ${V.y1} L ${x} ${_} L ${V.x2} ${V.y2}`);n&&i?(w.id=i.id,this.linkData[i.id]=w):(w.id=X(),this.linkData[w.id]=w,this.currentLink=F),F.linkObj=w,F.dataset.linkid=w.id,this.linkSvgGroup.appendChild(F),n||this.showLinkController(h,a,p,g,w,m,f)},hideLinkController:function(){this.linkController.style.display="none",this.P2.style.display="none",this.P3.style.display="none"},removeLink:function(e){let t;if(e?t=e:t=this.currentLink,!t)return;console.log(t),this.hideLinkController();const n=t.linkObj.id;console.log(n),delete this.linkData[n],t.remove(),t=null},selectLink:function(e){this.currentLink=e;const t=e.linkObj;if(!t)return;const n=t.from,i=t.to,s=this.map.getBoundingClientRect(),o=C(n).getBoundingClientRect(),r=C(i).getBoundingClientRect(),l=(o.x+o.width/2-s.x)/this.scaleVal,c=(o.y+o.height/2-s.y)/this.scaleVal,u=(r.x+r.width/2-s.x)/this.scaleVal,d=(r.y+r.height/2-s.y)/this.scaleVal,h={cx:l,cy:c,w:o.width,h:o.height},a={cx:u,cy:d,w:r.width,h:r.height},p=l+t.delta1.x,g=c+t.delta1.y,m=u+t.delta2.x,f=d+t.delta2.y;this.showLinkController(p,g,m,f,t,h,a)},showLinkController:function(e,t,n,i,s,o,r){this.linkController.style.display="initial",this.P2.style.display="initial",this.P3.style.display="initial";const l=ie(o,e,t);let c=l.x,u=l.y;const d=se(r,n,i);let h=d.x,a=d.y;this.P2.style.cssText=`top:${t}px;left:${e}px;`,this.P3.style.cssText=`top:${i}px;left:${n}px;`,this.line1.setAttribute("x1",c),this.line1.setAttribute("y1",u),this.line1.setAttribute("x2",e),this.line1.setAttribute("y2",t),this.line2.setAttribute("x1",n),this.line2.setAttribute("y1",i),this.line2.setAttribute("x2",h),this.line2.setAttribute("y2",a),this.helper1&&(this.helper1.destory(this.map),this.helper2.destory(this.map)),this.helper1=He.create(this.P2),this.helper2=He.create(this.P3),this.helper1.init(this.map,(p,g)=>{var f;e=e-p/this.scaleVal,t=t-g/this.scaleVal;const m=ie(o,e,t);c=m.x,u=m.y,this.P2.style.top=t+"px",this.P2.style.left=e+"px",(f=this.currentLink)==null||f.children[0].setAttribute("d",`M ${c} ${u} C ${e} ${t} ${n} ${i} ${h} ${a}`),this.line1.setAttribute("x1",c),this.line1.setAttribute("y1",u),this.line1.setAttribute("x2",e),this.line1.setAttribute("y2",t),s.delta1.x=e-o.cx,s.delta1.y=t-o.cy}),this.helper2.init(this.map,(p,g)=>{var b,N;n=n-p/this.scaleVal,i=i-g/this.scaleVal;const m=se(r,n,i);h=m.x,a=m.y;const f=fe(n,i,h,a);this.P3.style.top=i+"px",this.P3.style.left=n+"px",(b=this.currentLink)==null||b.children[0].setAttribute("d",`M ${c} ${u} C ${e} ${t} ${n} ${i} ${h} ${a}`),(N=this.currentLink)==null||N.children[1].setAttribute("d",`M ${f.x1} ${f.y1} L ${h} ${a} L ${f.x2} ${f.y2}`),this.line2.setAttribute("x1",n),this.line2.setAttribute("y1",i),this.line2.setAttribute("x2",h),this.line2.setAttribute("y2",a),s.delta2.x=n-r.cx,s.delta2.y=i-r.cy})}},Symbol.toStringTag,{value:"Module"})),Wt=function(e){var c,u;if(e.length===0)throw new Error("No selected node.");if(e.length===1){const d=e[0].nodeObj,h=e[0].nodeObj.parent;if(!h)throw new Error("Can not select root node.");const a=h.children.findIndex(p=>d===p);return{parent:h.id,start:a,end:a}}let t=0;const n=e.map(d=>{let h=d.nodeObj;const a=[];for(;h.parent;){const p=h.parent,g=p.children,m=g==null?void 0:g.indexOf(h);h=p,a.unshift({node:h,index:m})}return a.length>t&&(t=a.length),a});let i=0;e:for(;i<t;i++){const d=(c=n[0][i])==null?void 0:c.node;for(let h=1;h<n.length;h++)if(((u=n[h][i])==null?void 0:u.node)!==d)break e}const s=n.map(d=>d[i-1].index).sort(),o=s[0]||0,r=s[s.length-1]||0,l=n[0][i-1].node;if(l.root)throw new Error("Please select nodes in the same main topic.");return{parent:l.id,start:o,end:r}},Xt=function(e){const t=document.createElementNS("http://www.w3.org/2000/svg","g");return t.setAttribute("id",e),t},Be=function(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","path");return oe(n,{d:e,stroke:t||"#666",fill:"none","stroke-linecap":"round","stroke-width":"2"}),n},Re=function(e,t,n,i,s){const o=document.createElementNS("http://www.w3.org/2000/svg","text");return oe(o,{"text-anchor":i,x:t+"",y:n+"",fill:s||"#666"}),o.innerHTML=e,o},It=e=>C(e).parentElement.parentElement,ze=function(e,t){var _,V;const{id:n,text:i,parent:s,start:o,end:r}=t,l=e.nodes,c=C(s),u=(_=c.closest("me-main"))==null?void 0:_.className,d=c.nodeObj;let h=1/0,a=0,p=0,g=0;for(let w=o;w<=r;w++){const F=(V=d.children)==null?void 0:V[w];if(!F)return console.warn("Child not found"),e.removeSummary(n),null;const te=It(F.id),{offsetLeft:ne,offsetTop:qe}=me(l,te);w===o&&(p=qe),w===r&&(g=qe+te.offsetHeight),ne<h&&(h=ne),te.offsetWidth+ne>a&&(a=te.offsetWidth+ne)}let m,f;const b=p+10,N=g+10,v=(b+N)/2,y=e.theme.cssVar["--color"];u==="lhs"?(m=Be(`M ${h+10} ${b} c -5 0 -10 5 -10 10 L ${h} ${N-10} c 0 5 5 10 10 10 M ${h} ${v} h -10`,y),f=Re(i,h-20,v+6,"end",y)):(m=Be(`M ${a-10} ${b} c 5 0 10 5 10 10 L ${a} ${N-10} c 0 5 -5 10 -10 10 M ${a} ${v} h 10`,y),f=Re(i,a+20,v+6,"start",y));const x=Xt("s-"+n);return x.appendChild(m),x.appendChild(f),x.summaryObj=t,e.summarySvg.appendChild(x),x},Kt=function(){let e=[];this.currentNode?e=[this.currentNode]:this.currentNodes&&(e=this.currentNodes);const{parent:t,start:n,end:i}=Wt(e),s={id:X(),parent:t,start:n,end:i,text:"summary"},o=ze(this,s);this.summaries.push(s),this.editSummary(o)},Ut=function(e){var n;const t=this.summaries.findIndex(i=>i.id===e);t>-1&&(this.summaries.splice(t,1),(n=document.querySelector("#s-"+e))==null||n.remove())},Gt=function(e){const t=e.children[1].getBBox(),n=6,i=3,s=document.createElementNS("http://www.w3.org/2000/svg","rect");oe(s,{x:t.x-n+"",y:t.y-n+"",width:t.width+n*2+"",height:t.height+n*2+"",rx:i+"",stroke:this.theme.cssVar["--selected"]||"#4dc4ff","stroke-width":"2",fill:"none"}),s.classList.add("selected"),e.appendChild(s),this.currentSummary=e},Jt=function(){var e,t;(t=(e=this.currentSummary)==null?void 0:e.querySelector("rect"))==null||t.remove(),this.currentSummary=null},Qt=function(){this.summarySvg.innerHTML="",this.summaries.forEach(e=>{ze(this,e)}),this.nodes.insertAdjacentElement("beforeend",this.summarySvg)},Zt=function(e){var t;return(t=C(e).closest("me-main"))==null?void 0:t.className},en=Object.freeze(Object.defineProperty({__proto__:null,createSummary:Kt,editSummary:function(e){if(console.time("editSummary"),!e)return;const t=e.childNodes[1],n=document.createElement("div");this.nodes.appendChild(n);const i=t.innerHTML;n.id="input-box",n.textContent=i,n.contentEditable="true",n.spellcheck=!1;const s=t.getAttribute("x")+"px",o=t.getAttribute("y")+"px";n.style.cssText=`min-width:${100-8}px;position:absolute;left:${s};top:${o};`,Zt(e.summaryObj.parent)==="lhs"?n.style.cssText+="transform: translate(-100%, -100%);":n.style.cssText+="transform: translate(0, -100%);",n.focus(),be(n),n.addEventListener("keydown",r=>{r.stopPropagation();const l=r.key;if(l==="Enter"||l==="Tab"){if(r.shiftKey)return;r.preventDefault(),n.blur(),this.map.focus()}}),n.addEventListener("blur",()=>{var c;if(!n)return;const r=e.summaryObj,l=((c=n.textContent)==null?void 0:c.trim())||"";l===""?r.text=i:r.text=l,n.remove(),l!==i&&(t.innerHTML=r.text,this.linkDiv(),this.bus.fire("operation",{name:"finishEditSummary",obj:r,origin:i}))}),console.timeEnd("editSummary")},removeSummary:Ut,renderSummary:Qt,selectSummary:Gt,unselectSummary:Jt},Symbol.toStringTag,{value:"Module"}));function tn(e,t){return async function(...n){const i=this.before[t];i&&!await i.apply(this,n)||e.apply(this,n)}}const Ve=Object.keys(De),Fe={};for(let e=0;e<Ve.length;e++){const t=Ve[e];Fe[t]=tn(De[t],t)}const nn={getObjById:he,generateNewObj:Xe,layout:st,linkDiv:mt,editTopic:ht,createWrapper:lt,createParent:ct,createChildren:at,createTopic:dt,findEle:C,changeTheme:Bt,...Rt,...Fe,...Yt,...en,init(e){if(!e||!e.nodeData)return new Error("MindElixir: `data` is required");e.direction!==void 0&&(this.direction=e.direction),this.changeTheme(e.theme||this.theme,!1),this.nodeData=e.nodeData,$(this.nodeData),this.linkData=e.linkData||{},this.summaries=e.summaries||[],this.toolBar&&Tt(this),this.keypress&&xt(this),Ye()&&this.mobileMenu?Ct(this):this.contextMenu&&yt(this,this.contextMenuOption),this.draggable&&kt(this),this.allowUndo&&St(this),Ht(this),this.toCenter(),this.layout(),this.linkDiv()}},K=document;function M({el:e,direction:t,locale:n,draggable:i,editable:s,contextMenu:o,contextMenuOption:r,toolBar:l,keypress:c,before:u,newTopicName:d,allowUndo:h,mainLinkStyle:a,subLinkStyle:p,overflowHidden:g,mobileMenu:m,theme:f}){console.log("ME_version "+M.version,this);let b=null;const N=Object.prototype.toString.call(e);if(N==="[object HTMLDivElement]"?b=e:N==="[object String]"&&(b=document.querySelector(e)),!b)throw new Error("MindElixir: el is not a valid element");b.className+=" mind-elixir",b.innerHTML="",b.style.setProperty("--gap",L+"px"),this.mindElixirBox=b,this.before=u||{},this.locale=n||"en",this.contextMenuOption=r,this.contextMenu=o===void 0?!0:o,this.toolBar=l===void 0?!0:l,this.keypress=c===void 0?!0:c,this.mobileMenu=m||!1,this.direction=typeof t=="number"?t:1,this.draggable=i===void 0?!0:i,this.newTopicName=d||"new node",this.editable=s===void 0?!0:s,this.allowUndo=h===void 0?!1:h,this.currentNode=null,this.currentLink=null,this.scaleVal=1,this.tempDirection=null,this.mainLinkStyle=a||0,this.subLinkStyle=p||0,this.overflowHidden=g||!1,this.bus=it.create(),this.container=K.createElement("div"),this.container.className="map-container";const v=window.matchMedia("(prefers-color-scheme: dark)");this.theme=f||(v.matches?de:ae);const y=K.createElement("div");y.className="map-canvas",this.map=y,this.map.setAttribute("tabindex","0"),this.container.appendChild(this.map),this.mindElixirBox.appendChild(this.container),this.nodes=K.createElement("me-nodes"),this.nodes.className="main-node-container",this.lines=I("lines"),this.summarySvg=I("summary"),this.linkController=I("linkcontroller"),this.P2=K.createElement("div"),this.P3=K.createElement("div"),this.P2.className=this.P3.className="circle",this.P2.style.display=this.P3.style.display="none",this.line1=ve(0,0,0,0),this.line2=ve(0,0,0,0),this.linkController.appendChild(this.line1),this.linkController.appendChild(this.line2),this.linkSvgGroup=I("topiclinks"),this.map.appendChild(this.nodes),this.map.appendChild(this.linkController),this.map.appendChild(this.linkSvgGroup),this.map.appendChild(this.P2),this.map.appendChild(this.P3),this.overflowHidden?this.container.style.overflow="hidden":nt(this)}return M.prototype=nn,M.LEFT=S,M.RIGHT=D,M.SIDE=W,M.THEME=ae,M.DARK_THEME=de,M.version="3.1.0",M.E=C,M.new=e=>({nodeData:{id:X(),topic:e||"new topic",root:!0,children:[]},linkData:{}}),M}();
11
+ `,i[o].children&&n(i[o].children||[],s+1)}return n(e.children||[],2),t},getDataString:function(){const e=Oe(this);return JSON.stringify(e,(t,n)=>{if(!(t==="parent"&&typeof n!="string"))return t==="from"||t==="to"?n.nodeObj.id:n})},initLeft:function(){this.direction=0,this.refresh()},initRight:function(){this.direction=1,this.refresh()},initSide:function(){this.direction=2,this.refresh()},install:function(e){e(this)},refresh:function(e){e&&(e=JSON.parse(JSON.stringify(e)),this.nodeData=e.nodeData,this.linkData=e.linkData||{}),$(this.nodeData),this.layout(),this.linkDiv()},scale:function(e){this.scaleVal=e,this.map.style.transform="scale("+e+")"},selectFirstChild:function(){if(!this.currentNode)return;const e=this.currentNode.parentElement.nextSibling;if(e&&e.firstChild){const t=e.firstChild.firstChild.firstChild;this.selectNode(t)}},selectNextSibling:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return!1;const e=this.currentNode.parentElement.parentElement.nextSibling;let t;if(e)t=e.firstChild.firstChild;else return!1;return this.selectNode(t),!0},selectNode:function(e,t,n){if(e){if(console.time("selectNode"),typeof e=="string"){const i=C(e);return i?this.selectNode(i):void 0}this.currentNode&&(this.currentNode.className=""),e.className="selected",e.scrollIntoView({block:"nearest",inline:"nearest"}),this.currentNode=e,t?this.bus.fire("selectNewNode",e.nodeObj):this.bus.fire("selectNode",e.nodeObj,n),console.timeEnd("selectNode")}},selectNodes:function(e){if(e){console.time("selectNodes");for(const t of e)t.className="selected";this.currentNodes=e,this.bus.fire("selectNodes",e.map(t=>t.nodeObj)),console.timeEnd("selectNodes")}},selectParent:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return;const e=this.currentNode.parentElement.parentElement.parentElement.previousSibling;if(e){const t=e.firstChild;this.selectNode(t)}},selectPrevSibling:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return!1;const e=this.currentNode.parentElement.parentElement.previousSibling;let t;if(e)t=e.firstChild.firstChild;else return!1;return this.selectNode(t),!0},setLocale:function(e){this.locale=e,this.refresh()},toCenter:function(){this.container.scrollTo(1e4-this.container.offsetWidth/2,1e4-this.container.offsetHeight/2)},unselectNode:function(){this.currentNode&&(this.currentNode.className=""),this.currentNode=null,this.bus.fire("unselectNode")},unselectNodes:function(){if(this.currentNodes)for(const e of this.currentNodes)e.classList.remove("selected");this.currentNodes=null,this.bus.fire("unselectNodes")}},Symbol.toStringTag,{value:"Module"})),ee=function(e){const n=e.parentElement.parentElement.lastElementChild;(n==null?void 0:n.tagName)==="svg"&&(n==null||n.remove())},Pe=function(e,t){var n,i;if(e===S)return S;if(e===D)return D;if(e===W){const s=((n=document.querySelector(".lhs"))==null?void 0:n.childElementCount)||0,o=((i=document.querySelector(".rhs"))==null?void 0:i.childElementCount)||0;return s<=o?(t.direction=S,S):(t.direction=D,D)}},zt=function(e,t){console.log(t);const n=e.nodeObj,i=pe(n);i.style&&t.style&&(t.style=Object.assign(i.style,t.style));const s=Object.assign(n,t);re(e,s),this.linkDiv(),this.bus.fire("operation",{name:"reshapeNode",obj:s,origin:i})},Vt=function(e,t){var u,d,h;const n=e||this.currentNode;if(!n)return;const i=n.nodeObj;if(i.root===!0){this.addChild();return}else if(((u=i.parent)==null?void 0:u.root)===!0&&((h=(d=i.parent)==null?void 0:d.children)==null?void 0:h.length)===1){this.addChild(C(i.parent.id));return}const s=t||this.generateNewObj();Ge(i,s),$(this.nodeData);const o=n.parentElement;console.time("insertSibling_DOM");const{grp:r,top:l}=this.createWrapper(s);o.parentNode.parentNode.insertBefore(r,o.parentNode.nextSibling),this.linkDiv(r.offsetParent),t||this.editTopic(l.firstChild),this.selectNode(l.firstChild,!0),console.timeEnd("insertSibling_DOM"),this.bus.fire("operation",{name:"insertSibling",obj:s})},Ft=function(e,t){const n=e||this.currentNode;if(!n)return;const i=n.nodeObj;if(i.root===!0){this.addChild();return}const s=t||this.generateNewObj();Je(i,s),$(this.nodeData);const o=n.parentElement;console.time("insertSibling_DOM");const{grp:r,top:l}=this.createWrapper(s);o.parentNode.parentNode.insertBefore(r,o.parentNode),this.linkDiv(r.offsetParent),t||this.editTopic(l.firstChild),this.selectNode(l.firstChild,!0),console.timeEnd("insertSibling_DOM"),this.bus.fire("operation",{name:"insertBefore",obj:s})},qt=function(e,t){const n=e||this.currentNode;if(!n)return;ee(n);const i=n.nodeObj;if(i.root===!0)return;const s=t||this.generateNewObj();Qe(i,s),$(this.nodeData);const o=n.parentElement.parentElement;console.time("insertParent_DOM");const{grp:r,top:l}=this.createWrapper(s,!0);l.appendChild(Q(!0)),o.insertAdjacentElement("afterend",r);const c=this.createChildren([o]);l.insertAdjacentElement("afterend",c),this.linkDiv(),t||this.editTopic(l.firstChild),this.selectNode(l.firstChild,!0),console.timeEnd("insertParent_DOM"),this.bus.fire("operation",{name:"insertParent",obj:s})},je=function(e,t){var l,c;if(!e)return null;const n=e.nodeObj;n.expanded===!1&&(this.expandNode(e,!0),e=C(n.id));const i=t||this.generateNewObj();n.children?n.children.push(i):n.children=[i],$(this.nodeData);const s=e.parentElement,{grp:o,top:r}=this.createWrapper(i);if(s.tagName==="ME-PARENT"){if(s.children[1])s.nextSibling.appendChild(o);else{const u=this.createChildren([o]);s.appendChild(Q(!0)),s.insertAdjacentElement("afterend",u)}this.linkDiv(o.offsetParent)}else s.tagName==="ME-ROOT"&&(Pe(this.direction,i)===S?(l=document.querySelector(".lhs"))==null||l.appendChild(o):(c=document.querySelector(".rhs"))==null||c.appendChild(o),this.linkDiv());return{newTop:r,newNodeObj:i}},De=Object.freeze(Object.defineProperty({__proto__:null,addChild:function(e,t){console.time("addChild");const n=e||this.currentNode;if(!n)return;const i=je.call(this,n,t);if(!i)return;const{newTop:s,newNodeObj:o}=i;this.bus.fire("operation",{name:"addChild",obj:o}),console.timeEnd("addChild"),t||this.editTopic(s.firstChild),this.selectNode(s.firstChild,!0)},beginEdit:function(e){const t=e||this.currentNode;t&&this.editTopic(t)},copyNode:function(e,t){console.time("copyNode");const n=pe(e.nodeObj);ue(n);const i=je.call(this,t,n);if(!i)return;const{newNodeObj:s}=i;console.timeEnd("copyNode"),this.bus.fire("operation",{name:"copyNode",obj:s})},insertBefore:Ft,insertParent:qt,insertSibling:Vt,moveDownNode:function(e){const t=e||this.currentNode;if(!t)return;const n=t.parentNode.parentNode,i=t.nodeObj;Ue(i),n.nextSibling?n.nextSibling.insertAdjacentElement("afterend",n):n.parentNode.prepend(n),this.linkDiv(),this.bus.fire("operation",{name:"moveDownNode",obj:i})},moveNode:function(e,t){var l;const n=e.nodeObj,i=t.nodeObj,s=(l=n==null?void 0:n.parent)==null?void 0:l.id;if(i.expanded===!1&&(this.expandNode(t,!0),e=C(n.id),t=C(i.id)),!Ie(n,i)){console.warn("Invalid move");return}console.time("moveNode"),Ze(n,i),$(this.nodeData);const o=e.parentElement,r=t.parentElement;if(r.tagName==="ME-PARENT")if(ee(e),r.children[1])r.nextSibling.appendChild(o.parentElement);else{const c=this.createChildren([o.parentElement]);r.appendChild(Q(!0)),r.parentElement.insertBefore(c,r.nextSibling)}else r.tagName==="ME-ROOT"&&(Pe(this.direction,n),r.nextSibling.appendChild(o.parentElement));this.linkDiv(),this.bus.fire("operation",{name:"moveNode",obj:n,toObj:i,originParentId:s}),console.timeEnd("moveNode")},moveNodeAfter:function(e,t){var u;const n=e.nodeObj,i=t.nodeObj,s=(u=n.parent)==null?void 0:u.id;tt(n,i),$(this.nodeData),ee(e);const r=e.parentElement.parentElement;t.parentElement.parentElement.insertAdjacentElement("afterend",r),this.linkDiv(),this.bus.fire("operation",{name:"moveNodeAfter",obj:n,toObj:i,originParentId:s})},moveNodeBefore:function(e,t){var u;const n=e.nodeObj,i=t.nodeObj,s=(u=n.parent)==null?void 0:u.id;et(n,i),$(this.nodeData),ee(e);const r=e.parentElement.parentNode;t.parentElement.parentNode.insertAdjacentElement("beforebegin",r),this.linkDiv(),this.bus.fire("operation",{name:"moveNodeBefore",obj:n,toObj:i,originParentId:s})},moveUpNode:function(e){const t=e||this.currentNode;if(!t)return;const n=t.parentNode.parentNode,i=t.nodeObj;Ke(i),n.parentNode.insertBefore(n,n.previousSibling),this.linkDiv(),this.bus.fire("operation",{name:"moveUpNode",obj:i})},removeNode:function(e){var l;const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;if(n.root===!0)throw new Error("Can not remove root node");const i=n.parent.children,s=i.findIndex(c=>c===n),o=G(n),r=t.parentNode;if(o===0){const c=r.parentNode.parentNode;c.tagName!=="ME-MAIN"&&c.previousSibling.children[1].remove()}if(i.length!==0){const c=i[s]||i[s-1];this.selectNode(C(c.id))}else this.selectNode(C(n.parent.id));for(const c in this.linkData){const u=this.linkData[c];if(u.from===n.id||u.to===n.id){const d=this.mindElixirBox.querySelector(`[data-linkid=${this.linkData[c].id}]`);this.removeLink(d)}}r.parentNode.remove(),this.linkDiv(),this.bus.fire("operation",{name:"removeNode",obj:n,originIndex:s,originParentId:(l=n==null?void 0:n.parent)==null?void 0:l.id})},reshapeNode:zt,setNodeTopic:function(e,t){e.childNodes[0].textContent=t,e.nodeObj.topic=t,this.linkDiv()}},Symbol.toStringTag,{value:"Module"})),He={create:function(e){return{dom:e,mousedown:!1,lastX:0,lastY:0,handleMouseMove(t){if(t.stopPropagation(),this.mousedown){if(!this.lastX){this.lastX=t.pageX,this.lastY=t.pageY;return}const n=this.lastX-t.pageX,i=this.lastY-t.pageY;this.cb&&this.cb(n,i),this.lastX=t.pageX,this.lastY=t.pageY}},handleMouseDown(t){t.stopPropagation(),this.mousedown=!0},handleClear(t){t.stopPropagation(),this.clear()},cb:null,init(t,n){this.cb=n,this.handleClear=this.handleClear.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),t.addEventListener("mousemove",this.handleMouseMove),t.addEventListener("mouseleave",this.handleClear),t.addEventListener("mouseup",this.handleClear),this.dom.addEventListener("mousedown",this.handleMouseDown)},destory(t){t.removeEventListener("mousemove",this.handleMouseMove),t.removeEventListener("mouseleave",this.handleClear),t.removeEventListener("mouseup",this.handleClear),this.dom.removeEventListener("mousedown",this.handleMouseDown)},clear(){this.mousedown=!1,this.lastX=0,this.lastY=0}}}},Yt=Object.freeze(Object.defineProperty({__proto__:null,createLink:function(e,t,n,i){const s=this.map.getBoundingClientRect();if(!e||!t)return;const o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),l=(o.x+o.width/2-s.x)/this.scaleVal,c=(o.y+o.height/2-s.y)/this.scaleVal,u=(r.x+r.width/2-s.x)/this.scaleVal,d=(r.y+r.height/2-s.y)/this.scaleVal;let h,a,p,g;n&&i?(h=l+i.delta1.x,a=c+i.delta1.y,p=u+i.delta2.x,g=d+i.delta2.y):(c+d)/2-c<=o.height/2?(h=(o.x+o.width-s.x)/this.scaleVal+100,a=c,p=(r.x+r.width-s.x)/this.scaleVal+100,g=d):(h=(l+u)/2,a=(c+d)/2,p=(l+u)/2,g=(c+d)/2);const m={cx:l,cy:c,w:o.width,h:o.height},f={cx:u,cy:d,w:r.width,h:r.height},b=ie(m,h,a),N=b.x,v=b.y,y=se(f,p,g),x=y.x,_=y.y,V=fe(p,g,x,_),w={id:"",label:"",from:e.nodeObj.id,to:t.nodeObj.id,delta1:{x:h-l,y:a-c},delta2:{x:p-u,y:g-d}},F=pt(`M ${N} ${v} C ${h} ${a} ${p} ${g} ${x} ${_}`,`M ${V.x1} ${V.y1} L ${x} ${_} L ${V.x2} ${V.y2}`);n&&i?(w.id=i.id,this.linkData[i.id]=w):(w.id=X(),this.linkData[w.id]=w,this.currentLink=F),F.linkObj=w,F.dataset.linkid=w.id,this.linkSvgGroup.appendChild(F),n||this.showLinkController(h,a,p,g,w,m,f)},hideLinkController:function(){this.linkController.style.display="none",this.P2.style.display="none",this.P3.style.display="none"},removeLink:function(e){let t;if(e?t=e:t=this.currentLink,!t)return;console.log(t),this.hideLinkController();const n=t.linkObj.id;console.log(n),delete this.linkData[n],t.remove(),t=null},selectLink:function(e){this.currentLink=e;const t=e.linkObj;if(!t)return;const n=t.from,i=t.to,s=this.map.getBoundingClientRect(),o=C(n).getBoundingClientRect(),r=C(i).getBoundingClientRect(),l=(o.x+o.width/2-s.x)/this.scaleVal,c=(o.y+o.height/2-s.y)/this.scaleVal,u=(r.x+r.width/2-s.x)/this.scaleVal,d=(r.y+r.height/2-s.y)/this.scaleVal,h={cx:l,cy:c,w:o.width,h:o.height},a={cx:u,cy:d,w:r.width,h:r.height},p=l+t.delta1.x,g=c+t.delta1.y,m=u+t.delta2.x,f=d+t.delta2.y;this.showLinkController(p,g,m,f,t,h,a)},showLinkController:function(e,t,n,i,s,o,r){this.linkController.style.display="initial",this.P2.style.display="initial",this.P3.style.display="initial";const l=ie(o,e,t);let c=l.x,u=l.y;const d=se(r,n,i);let h=d.x,a=d.y;this.P2.style.cssText=`top:${t}px;left:${e}px;`,this.P3.style.cssText=`top:${i}px;left:${n}px;`,this.line1.setAttribute("x1",c),this.line1.setAttribute("y1",u),this.line1.setAttribute("x2",e),this.line1.setAttribute("y2",t),this.line2.setAttribute("x1",n),this.line2.setAttribute("y1",i),this.line2.setAttribute("x2",h),this.line2.setAttribute("y2",a),this.helper1&&(this.helper1.destory(this.map),this.helper2.destory(this.map)),this.helper1=He.create(this.P2),this.helper2=He.create(this.P3),this.helper1.init(this.map,(p,g)=>{var f;e=e-p/this.scaleVal,t=t-g/this.scaleVal;const m=ie(o,e,t);c=m.x,u=m.y,this.P2.style.top=t+"px",this.P2.style.left=e+"px",(f=this.currentLink)==null||f.children[0].setAttribute("d",`M ${c} ${u} C ${e} ${t} ${n} ${i} ${h} ${a}`),this.line1.setAttribute("x1",c),this.line1.setAttribute("y1",u),this.line1.setAttribute("x2",e),this.line1.setAttribute("y2",t),s.delta1.x=e-o.cx,s.delta1.y=t-o.cy}),this.helper2.init(this.map,(p,g)=>{var b,N;n=n-p/this.scaleVal,i=i-g/this.scaleVal;const m=se(r,n,i);h=m.x,a=m.y;const f=fe(n,i,h,a);this.P3.style.top=i+"px",this.P3.style.left=n+"px",(b=this.currentLink)==null||b.children[0].setAttribute("d",`M ${c} ${u} C ${e} ${t} ${n} ${i} ${h} ${a}`),(N=this.currentLink)==null||N.children[1].setAttribute("d",`M ${f.x1} ${f.y1} L ${h} ${a} L ${f.x2} ${f.y2}`),this.line2.setAttribute("x1",n),this.line2.setAttribute("y1",i),this.line2.setAttribute("x2",h),this.line2.setAttribute("y2",a),s.delta2.x=n-r.cx,s.delta2.y=i-r.cy})}},Symbol.toStringTag,{value:"Module"})),Wt=function(e){var c,u;if(e.length===0)throw new Error("No selected node.");if(e.length===1){const d=e[0].nodeObj,h=e[0].nodeObj.parent;if(!h)throw new Error("Can not select root node.");const a=h.children.findIndex(p=>d===p);return{parent:h.id,start:a,end:a}}let t=0;const n=e.map(d=>{let h=d.nodeObj;const a=[];for(;h.parent;){const p=h.parent,g=p.children,m=g==null?void 0:g.indexOf(h);h=p,a.unshift({node:h,index:m})}return a.length>t&&(t=a.length),a});let i=0;e:for(;i<t;i++){const d=(c=n[0][i])==null?void 0:c.node;for(let h=1;h<n.length;h++)if(((u=n[h][i])==null?void 0:u.node)!==d)break e}const s=n.map(d=>d[i-1].index).sort(),o=s[0]||0,r=s[s.length-1]||0,l=n[0][i-1].node;if(l.root)throw new Error("Please select nodes in the same main topic.");return{parent:l.id,start:o,end:r}},Xt=function(e){const t=document.createElementNS("http://www.w3.org/2000/svg","g");return t.setAttribute("id",e),t},Be=function(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","path");return oe(n,{d:e,stroke:t||"#666",fill:"none","stroke-linecap":"round","stroke-width":"2"}),n},Re=function(e,t,n,i,s){const o=document.createElementNS("http://www.w3.org/2000/svg","text");return oe(o,{"text-anchor":i,x:t+"",y:n+"",fill:s||"#666"}),o.innerHTML=e,o},It=e=>C(e).parentElement.parentElement,ze=function(e,t){var _,V;const{id:n,text:i,parent:s,start:o,end:r}=t,l=e.nodes,c=C(s),u=(_=c.closest("me-main"))==null?void 0:_.className,d=c.nodeObj;let h=1/0,a=0,p=0,g=0;for(let w=o;w<=r;w++){const F=(V=d.children)==null?void 0:V[w];if(!F)return console.warn("Child not found"),e.removeSummary(n),null;const te=It(F.id),{offsetLeft:ne,offsetTop:qe}=me(l,te);w===o&&(p=qe),w===r&&(g=qe+te.offsetHeight),ne<h&&(h=ne),te.offsetWidth+ne>a&&(a=te.offsetWidth+ne)}let m,f;const b=p+10,N=g+10,v=(b+N)/2,y=e.theme.cssVar["--color"];u==="lhs"?(m=Be(`M ${h+10} ${b} c -5 0 -10 5 -10 10 L ${h} ${N-10} c 0 5 5 10 10 10 M ${h} ${v} h -10`,y),f=Re(i,h-20,v+6,"end",y)):(m=Be(`M ${a-10} ${b} c 5 0 10 5 10 10 L ${a} ${N-10} c 0 5 -5 10 -10 10 M ${a} ${v} h 10`,y),f=Re(i,a+20,v+6,"start",y));const x=Xt("s-"+n);return x.appendChild(m),x.appendChild(f),x.summaryObj=t,e.summarySvg.appendChild(x),x},Kt=function(){let e=[];this.currentNode?e=[this.currentNode]:this.currentNodes&&(e=this.currentNodes);const{parent:t,start:n,end:i}=Wt(e),s={id:X(),parent:t,start:n,end:i,text:"summary"},o=ze(this,s);this.summaries.push(s),this.editSummary(o)},Ut=function(e){var n;const t=this.summaries.findIndex(i=>i.id===e);t>-1&&(this.summaries.splice(t,1),(n=document.querySelector("#s-"+e))==null||n.remove())},Gt=function(e){const t=e.children[1].getBBox(),n=6,i=3,s=document.createElementNS("http://www.w3.org/2000/svg","rect");oe(s,{x:t.x-n+"",y:t.y-n+"",width:t.width+n*2+"",height:t.height+n*2+"",rx:i+"",stroke:this.theme.cssVar["--selected"]||"#4dc4ff","stroke-width":"2",fill:"none"}),s.classList.add("selected"),e.appendChild(s),this.currentSummary=e},Jt=function(){var e,t;(t=(e=this.currentSummary)==null?void 0:e.querySelector("rect"))==null||t.remove(),this.currentSummary=null},Qt=function(){this.summarySvg.innerHTML="",this.summaries.forEach(e=>{ze(this,e)}),this.nodes.insertAdjacentElement("beforeend",this.summarySvg)},Zt=function(e){var t;return(t=C(e).closest("me-main"))==null?void 0:t.className},en=Object.freeze(Object.defineProperty({__proto__:null,createSummary:Kt,editSummary:function(e){if(console.time("editSummary"),!e)return;const t=e.childNodes[1],n=document.createElement("div");this.nodes.appendChild(n);const i=t.innerHTML;n.id="input-box",n.textContent=i,n.contentEditable="true",n.spellcheck=!1;const s=t.getAttribute("x")+"px",o=t.getAttribute("y")+"px";n.style.cssText=`min-width:${100-8}px;position:absolute;left:${s};top:${o};`,Zt(e.summaryObj.parent)==="lhs"?n.style.cssText+="transform: translate(-100%, -100%);":n.style.cssText+="transform: translate(0, -100%);",n.focus(),be(n),n.addEventListener("keydown",r=>{r.stopPropagation();const l=r.key;if(l==="Enter"||l==="Tab"){if(r.shiftKey)return;r.preventDefault(),n.blur(),this.map.focus()}}),n.addEventListener("blur",()=>{var c;if(!n)return;const r=e.summaryObj,l=((c=n.textContent)==null?void 0:c.trim())||"";l===""?r.text=i:r.text=l,n.remove(),l!==i&&(t.innerHTML=r.text,this.linkDiv(),this.bus.fire("operation",{name:"finishEditSummary",obj:r,origin:i}))}),console.timeEnd("editSummary")},removeSummary:Ut,renderSummary:Qt,selectSummary:Gt,unselectSummary:Jt},Symbol.toStringTag,{value:"Module"}));function tn(e,t){return async function(...n){const i=this.before[t];i&&!await i.apply(this,n)||e.apply(this,n)}}const Ve=Object.keys(De),Fe={};for(let e=0;e<Ve.length;e++){const t=Ve[e];Fe[t]=tn(De[t],t)}const nn={getObjById:he,generateNewObj:Xe,layout:st,linkDiv:mt,editTopic:ht,createWrapper:lt,createParent:ct,createChildren:at,createTopic:dt,findEle:C,changeTheme:Bt,...Rt,...Fe,...Yt,...en,init(e){if(!e||!e.nodeData)return new Error("MindElixir: `data` is required");e.direction!==void 0&&(this.direction=e.direction),this.changeTheme(e.theme||this.theme,!1),this.nodeData=e.nodeData,$(this.nodeData),this.linkData=e.linkData||{},this.summaries=e.summaries||[],this.toolBar&&Tt(this),this.keypress&&xt(this),Ye()&&this.mobileMenu?Ct(this):this.contextMenu&&yt(this,this.contextMenuOption),this.draggable&&kt(this),this.allowUndo&&St(this),Ht(this),this.toCenter(),this.layout(),this.linkDiv()}},K=document;function M({el:e,direction:t,locale:n,draggable:i,editable:s,contextMenu:o,contextMenuOption:r,toolBar:l,keypress:c,before:u,newTopicName:d,allowUndo:h,mainLinkStyle:a,subLinkStyle:p,overflowHidden:g,mobileMenu:m,theme:f}){console.log("ME_version "+M.version,this);let b=null;const N=Object.prototype.toString.call(e);if(N==="[object HTMLDivElement]"?b=e:N==="[object String]"&&(b=document.querySelector(e)),!b)throw new Error("MindElixir: el is not a valid element");b.className+=" mind-elixir",b.innerHTML="",b.style.setProperty("--gap",L+"px"),this.mindElixirBox=b,this.before=u||{},this.locale=n||"en",this.contextMenuOption=r,this.contextMenu=o===void 0?!0:o,this.toolBar=l===void 0?!0:l,this.keypress=c===void 0?!0:c,this.mobileMenu=m||!1,this.direction=typeof t=="number"?t:1,this.draggable=i===void 0?!0:i,this.newTopicName=d||"new node",this.editable=s===void 0?!0:s,this.allowUndo=h===void 0?!1:h,this.currentNode=null,this.currentLink=null,this.scaleVal=1,this.tempDirection=null,this.mainLinkStyle=a||0,this.subLinkStyle=p||0,this.overflowHidden=g||!1,this.bus=it.create(),this.container=K.createElement("div"),this.container.className="map-container";const v=window.matchMedia("(prefers-color-scheme: dark)");this.theme=f||(v.matches?de:ae);const y=K.createElement("div");y.className="map-canvas",this.map=y,this.map.setAttribute("tabindex","0"),this.container.appendChild(this.map),this.mindElixirBox.appendChild(this.container),this.nodes=K.createElement("me-nodes"),this.nodes.className="main-node-container",this.lines=I("lines"),this.summarySvg=I("summary"),this.linkController=I("linkcontroller"),this.P2=K.createElement("div"),this.P3=K.createElement("div"),this.P2.className=this.P3.className="circle",this.P2.style.display=this.P3.style.display="none",this.line1=ve(0,0,0,0),this.line2=ve(0,0,0,0),this.linkController.appendChild(this.line1),this.linkController.appendChild(this.line2),this.linkSvgGroup=I("topiclinks"),this.map.appendChild(this.nodes),this.map.appendChild(this.linkController),this.map.appendChild(this.linkSvgGroup),this.map.appendChild(this.P2),this.map.appendChild(this.P3),this.overflowHidden?this.container.style.overflow="hidden":nt(this)}return M.prototype=nn,M.LEFT=S,M.RIGHT=D,M.SIDE=W,M.THEME=ae,M.DARK_THEME=de,M.version="3.1.2",M.E=C,M.new=e=>({nodeData:{id:X(),topic:e||"new topic",root:!0,children:[]},linkData:{}}),M}();
@@ -1340,6 +1340,7 @@ function Be(e) {
1340
1340
  return {
1341
1341
  nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
1342
1342
  linkData: e.linkData,
1343
+ summaries: e.summaries,
1343
1344
  direction: e.direction,
1344
1345
  theme: e.theme
1345
1346
  };
@@ -1408,7 +1409,7 @@ const Rt = function(e, t, n) {
1408
1409
  }, It = function() {
1409
1410
  const e = Be(this);
1410
1411
  return JSON.stringify(e, (t, n) => {
1411
- if (t !== "parent")
1412
+ if (!(t === "parent" && typeof n != "string"))
1412
1413
  return t === "from" || t === "to" ? n.nodeObj.id : n;
1413
1414
  });
1414
1415
  }, Kt = function() {
@@ -2057,7 +2058,7 @@ $.RIGHT = R;
2057
2058
  $.SIDE = I;
2058
2059
  $.THEME = we;
2059
2060
  $.DARK_THEME = ke;
2060
- $.version = "3.1.0";
2061
+ $.version = "3.1.2";
2061
2062
  $.E = C;
2062
2063
  $.new = (e) => ({
2063
2064
  nodeData: {
@@ -1,9 +1,9 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".mind-elixir{--gap: 30px;--root-radius: 30px;--main-radius: 20px;--root-color: #ffffff;--root-bgcolor: #4c4f69;--main-color: #444446;--main-bgcolor: #ffffff;--topic-padding: 3px;--color: #777777;--bgcolor: #f6f6f6;--selected: #4dc4ff;--panel-color: #444446;--panel-bgcolor: #ffffff;--panel-border-color: #eaeaea;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0);font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,PingFang SC,Microsoft YaHei,Source Han Sans SC,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif}.mind-elixir .hyper-link{text-decoration:none}.map-container{-webkit-user-select:none;user-select:none;height:100%;width:100%;overflow:scroll;font-size:15px}.map-container::-webkit-scrollbar{width:0px;height:0px}.map-container .selected{box-shadow:0 0 0 2px var(--selected)}.map-container .lhs{direction:rtl}.map-container .lhs me-tpc{direction:ltr}.map-container .map-canvas{height:20000px;width:20000px;position:relative;-webkit-user-select:none;user-select:none;transition:transform .3s;transform:scale(1);background-color:var(--bgcolor)}.map-container .map-canvas me-nodes{position:absolute;display:flex;justify-content:center;align-items:center;height:fit-content;width:fit-content}.map-container .map-canvas me-root{position:relative}.map-container .map-canvas me-root me-tpc{display:block;font-size:25px;color:var(--root-color);padding:10px var(--gap);border-radius:var(--root-radius);white-space:pre-wrap;background-color:var(--root-bgcolor)}.map-container .map-canvas me-root me-tpc #input-box{padding:10px var(--gap)}.map-container me-main>me-wrapper{position:relative;margin:20px 65px}.map-container me-main>me-wrapper>me-parent{margin:var(--gap);padding:0}.map-container me-main>me-wrapper>me-parent>me-tpc{border-radius:var(--main-radius);background-color:var(--main-bgcolor);border:2px solid var(--main-color);color:var(--main-color);padding:8px var(--gap)}.map-container me-main>me-wrapper>me-parent>me-tpc #input-box{padding:8px var(--gap)}.map-container me-wrapper{display:block;pointer-events:none;width:fit-content}.map-container me-children,.map-container me-parent{display:inline-block;vertical-align:middle}.map-container me-parent{position:relative;cursor:pointer;padding:6px var(--gap);margin-top:10px}.map-container me-parent me-tpc{position:relative;display:block;border-radius:3px;color:var(--color);pointer-events:all;max-width:800px;white-space:pre-wrap;padding:var(--topic-padding);line-height:1.2}.map-container me-parent me-tpc>div,.map-container me-parent me-tpc>span,.map-container me-parent me-tpc>img{pointer-events:none}.map-container me-parent me-tpc .insert-preview{position:absolute;width:100%;left:0;z-index:9}.map-container me-parent me-tpc .show{background:#7ad5ff;pointer-events:none;opacity:.7}.map-container me-parent me-tpc .before{height:14px;top:-14px}.map-container me-parent me-tpc .in{height:100%;top:0}.map-container me-parent me-tpc .after{height:14px;bottom:-14px}.map-container me-parent me-epd{position:absolute;height:18px;width:18px;opacity:.8;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdD0iMTY1NjY1NDcxNzI0MiIgY2xhc3M9Imljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIKICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+CiAgICA8cGF0aCBkPSJNNTEyIDc0LjY2NjY2N0MyNzAuOTMzMzMzIDc0LjY2NjY2NyA3NC42NjY2NjcgMjcwLjkzMzMzMyA3NC42NjY2NjcgNTEyUzI3MC45MzMzMzMgOTQ5LjMzMzMzMyA1MTIgOTQ5LjMzMzMzMyA5NDkuMzMzMzMzIDc1My4wNjY2NjcgOTQ5LjMzMzMzMyA1MTIgNzUzLjA2NjY2NyA3NC42NjY2NjcgNTEyIDc0LjY2NjY2N3oiIHN0cm9rZS13aWR0aD0iNTQiIHN0cm9rZT0nYmxhY2snIGZpbGw9J3doaXRlJyA+PC9wYXRoPgogICAgPHBhdGggZD0iTTY4Mi42NjY2NjcgNDgwaC0xMzguNjY2NjY3VjM0MS4zMzMzMzNjMC0xNy4wNjY2NjctMTQuOTMzMzMzLTMyLTMyLTMycy0zMiAxNC45MzMzMzMtMzIgMzJ2MTM4LjY2NjY2N0gzNDEuMzMzMzMzYy0xNy4wNjY2NjcgMC0zMiAxNC45MzMzMzMtMzIgMzJzMTQuOTMzMzMzIDMyIDMyIDMyaDEzOC42NjY2NjdWNjgyLjY2NjY2N2MwIDE3LjA2NjY2NyAxNC45MzMzMzMgMzIgMzIgMzJzMzItMTQuOTMzMzMzIDMyLTMydi0xMzguNjY2NjY3SDY4Mi42NjY2NjdjMTcuMDY2NjY3IDAgMzItMTQuOTMzMzMzIDMyLTMycy0xNC45MzMzMzMtMzItMzItMzJ6Ij48L3BhdGg+Cjwvc3ZnPg==);background-repeat:no-repeat;background-size:contain;background-position:center;pointer-events:all;z-index:9}.map-container me-parent me-epd.minus{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdD0iMTY1NjY1NTU2NDk4NSIgY2xhc3M9Imljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIKICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+CiAgICA8cGF0aCBkPSJNNTEyIDc0LjY2NjY2N0MyNzAuOTMzMzMzIDc0LjY2NjY2NyA3NC42NjY2NjcgMjcwLjkzMzMzMyA3NC42NjY2NjcgNTEyUzI3MC45MzMzMzMgOTQ5LjMzMzMzMyA1MTIgOTQ5LjMzMzMzMyA5NDkuMzMzMzMzIDc1My4wNjY2NjcgOTQ5LjMzMzMzMyA1MTIgNzUzLjA2NjY2NyA3NC42NjY2NjcgNTEyIDc0LjY2NjY2N3oiIHN0cm9rZS13aWR0aD0iNTQiIHN0cm9rZT0nYmxhY2snIGZpbGw9J3doaXRlJyA+PC9wYXRoPgogICAgPHBhdGggZD0iTTY4Mi42NjY2NjcgNTQ0SDM0MS4zMzMzMzNjLTE3LjA2NjY2NyAwLTMyLTE0LjkzMzMzMy0zMi0zMnMxNC45MzMzMzMtMzIgMzItMzJoMzQxLjMzMzMzNGMxNy4wNjY2NjcgMCAzMiAxNC45MzMzMzMgMzIgMzJzLTE0LjkzMzMzMyAzMi0zMiAzMnoiPjwvcGF0aD4KPC9zdmc+)!important;transition:opacity .3s;opacity:0}.map-container me-parent me-epd.minus:hover{opacity:.8}.map-container .icon{width:1em;height:1em;vertical-align:-.15em;fill:currentColor;overflow:hidden}.map-container .lines,.map-container .summary,.map-container .subLines,.map-container .topiclinks,.map-container .linkcontroller{position:absolute;height:102%;width:100%;top:0;left:0}.map-container .topiclinks,.map-container .linkcontroller,.map-container .summary{pointer-events:none}.map-container .topiclinks text,.map-container .linkcontroller text,.map-container .summary text{pointer-events:all}.map-container .topiclinks .selected,.map-container .linkcontroller .selected,.map-container .summary .selected{pointer-events:none}.map-container .lines,.map-container .subLines{pointer-events:none;z-index:-1}.map-container .topiclinks *,.map-container .linkcontroller *{z-index:100}.map-container .topiclinks g{cursor:pointer}.map-container #input-box{position:absolute;top:0;left:0;padding:var(--topic-padding);color:var(--color);background-color:var(--bgcolor);width:max-content;max-width:800px;z-index:11;direction:ltr;-webkit-user-select:auto;user-select:auto;pointer-events:all}.map-container me-tpc>img{pointer-events:none;display:block;margin-top:8px}.map-container .circle{position:absolute;height:10px;width:10px;margin-top:-5px;margin-left:-5px;border-radius:100%;background:#aaa;cursor:pointer}.map-container .tags{direction:ltr}.map-container .tags span{display:inline-block;border-radius:3px;padding:2px 4px;background:#d6f0f8;color:#276f86;margin:2px 3px 0 0;font-size:12px;line-height:16px}.map-container .icons{display:inline-block;direction:ltr;margin-right:10px}.map-container .mind-elixir-ghost{position:fixed;top:-100%;left:-100%;box-sizing:content-box;opacity:.5;background-color:#f6f6f6;max-width:200px;width:fit-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:8px 16px;border-radius:6px;border:#666666 2px solid}.selection-area{background:#4f90f22d;border:1px solid #4f90f2}.mind-elixir .context-menu{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99}.mind-elixir .context-menu .menu-list{position:fixed;list-style:none;margin:0;padding:0;font:300 15px Roboto,sans-serif;color:var(--panel-color);box-shadow:0 12px 15px #0003}.mind-elixir .context-menu .menu-list li{min-width:200px;overflow:hidden;white-space:nowrap;padding:10px 14px;background:var(--panel-bgcolor);border-bottom:1px solid var(--panel-border-color)}.mind-elixir .context-menu .menu-list li a{color:#333;text-decoration:none}.mind-elixir .context-menu .menu-list li.disabled{display:none;color:#5e5e5e;background-color:#f7f7f7}.mind-elixir .context-menu .menu-list li.disabled:hover{cursor:default;background-color:#f7f7f7}.mind-elixir .context-menu .menu-list li:hover{cursor:pointer;filter:brightness(.9)}.mind-elixir .context-menu .menu-list li:first-child{border-radius:5px 5px 0 0}.mind-elixir .context-menu .menu-list li:last-child{border-bottom:0;border-radius:0 0 5px 5px}.mind-elixir .context-menu .menu-list li span:last-child{float:right}.mind-elixir .mobile-menu{position:absolute;left:20px;bottom:70px;z-index:99;margin:0;padding:0;color:#333;border-radius:5px;box-shadow:0 12px 15px #0003;overflow:hidden}.mind-elixir .mobile-menu *{transition:color .4s,background-color .4s}.mind-elixir .mobile-menu div{float:left;text-align:center;width:30px;overflow:hidden;white-space:nowrap;padding:8px;background-color:#fff;border-bottom:1px solid #ecf0f1}.mind-elixir .mobile-menu div a{color:#333;text-decoration:none}.mind-elixir .mobile-menu div.disabled{color:#5e5e5e;background-color:#f7f7f7}.mind-elixir .mobile-menu div.disabled:hover{cursor:default;background-color:#f7f7f7}.mind-elixir .mobile-menu div:hover{cursor:pointer;background-color:#ecf0f1}.mind-elixir-toolbar{font-family:iconfont;position:absolute;color:var(--panel-color);background:var(--panel-bgcolor);padding:10px;border-radius:5px;box-shadow:0 1px 2px #0003}.mind-elixir-toolbar svg{display:inline-block}.mind-elixir-toolbar span:active{opacity:.5}.mind-elixir-toolbar.rb{right:20px;bottom:20px}.mind-elixir-toolbar.rb span+span{margin-left:10px}.mind-elixir-toolbar.lt{font-size:20px;left:20px;top:20px}.mind-elixir-toolbar.lt span{display:block}.mind-elixir-toolbar.lt span+span{margin-top:10px}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
2
2
  var MindElixirLite=function(){"use strict";const me="";(function(e){var t,i,n,s,o,l,r='<svg><symbol id="icon-edit" viewBox="0 0 1024 1024"><path d="M423.765333 128a42.666667 42.666667 0 0 1 3.2 85.205333L423.765333 213.333333H234.666667a64 64 0 0 0-63.872 60.245334L170.666667 277.333333v512a64 64 0 0 0 60.245333 63.872L234.666667 853.333333h512a64 64 0 0 0 63.872-60.245333L810.666667 789.333333v-189.098666a42.666667 42.666667 0 0 1 85.205333-3.2l0.128 3.2V789.333333a149.333333 149.333333 0 0 1-144.213333 149.248L746.666667 938.666667h-512a149.333333 149.333333 0 0 1-149.248-144.213334L85.333333 789.333333v-512a149.333333 149.333333 0 0 1 144.213334-149.248L234.666667 128h189.098666z m324.949334-53.248a42.666667 42.666667 0 0 1 60.330666 0l150.869334 150.869333a42.666667 42.666667 0 0 1 0 60.330667l-329.386667 329.386667a42.666667 42.666667 0 0 1-29.44 12.458666l-153.386667 2.517334a42.666667 42.666667 0 0 1-43.349333-43.349334l2.56-153.386666a42.666667 42.666667 0 0 1 12.458667-29.44z m30.165333 90.496L491.946667 452.266667l-1.493334 91.989333 92.032-1.493333 286.976-286.976-90.538666-90.538667z" ></path></symbol><symbol id="icon-rising" viewBox="0 0 1024 1024"><path d="M553.173333 803.84h-64l0.021334-474.581333-224.021334 224-45.269333-45.226667L521.6 206.293333l301.717333 301.696-45.269333 45.269334-224.853333-224.896v475.477333z" ></path></symbol><symbol id="icon-falling" viewBox="0 0 1024 1024"><path d="M553.173333 238.314667h-64l0.021334 474.602666-224.021334-224-45.269333 45.226667L521.6 835.861333l301.717333-301.717333-45.269333-45.226667-224.853333 224.853334V238.336z" ></path></symbol><symbol id="icon-shanchu2" viewBox="0 0 1024 1024"><path d="M516.60601807 107.93026734c-82.64382935 0-149.71865844 65.51751709-152.5729065 147.77160644H171.37136841c-21.40603638 0-38.92044068 17.38504028-38.92044068 38.92126465 0 21.40686036 17.38504028 38.92208862 38.92126466 38.92208862h42.94308471v435.40136719c0 81.73498536 55.39828492 148.55026245 123.90106201 148.55026245h348.99444581c68.37341309 0 123.90106201-66.42553711 123.901062-148.55026245V333.80477906h38.92126465c21.40686036 0 38.92126464-17.38586426 38.92126465-38.92208863 0-21.40686036-17.38504028-38.92126464-38.92126465-38.92126465H668.91854859C666.45321656 173.44860839 599.24902344 107.93109131 516.60601807 107.93109131z m-79.65939331 147.77160644c2.85424805-42.16442872 37.2354126-74.85809326 79.78875732-74.85809326s76.93450927 32.82302857 79.39984131 74.85809326H436.94662476z m-98.86047364 589.01165771c-24.2611084 0-50.98754883-31.13717651-50.98754883-75.76693725V333.80477906h450.97036744V769.33551026c0 44.50039673-26.72644043 75.76776123-50.98754884 75.76776122H338.08615112v-0.38973999z m0 0" ></path><path d="M390.37063599 751.17263794c17.77313232 0 32.43411255-17.7739563 32.43411255-40.08883667V482.35504151c0-22.31488037-14.53079224-40.08966065-32.43411255-40.08966065-17.77478027 0-32.43493653 17.77478027-32.43493653 40.08966065v228.72875976c0 22.18469239 14.27124023 40.08883667 32.43493653 40.08883667z m117.41308594 0c17.7739563 0 32.43411255-17.7739563 32.43411255-40.08883667V482.35504151c0-22.31488037-14.53079224-40.08966065-32.43411255-40.08966065-17.7739563 0-32.43493653 17.77478027-32.43493653 40.08966065v228.72875976c0 22.18469239 14.66098023 40.08883667 32.43493653 40.08883667z m123.51049804 0c17.7739563 0 32.43493653-17.7739563 32.43493652-40.08883667V482.35504151c0-22.31488037-14.53079224-40.08966065-32.43493652-40.08966065-17.7739563 0-32.43411255 17.77478027-32.43411255 40.08966065v228.72875976c0 22.18469239 14.14105224 40.08883667 32.43411255 40.08883667z m0 0" ></path></symbol><symbol id="icon-zijiedian" viewBox="0 0 1024 1024"><path d="M312.208 472c19.568-157.856 153.432-280 315.656-280 175.68 0 318.112 143.272 318.112 320S803.552 832 627.864 832c-162.224 0-296.08-122.144-315.656-280H120a40 40 0 0 1 0-80h192.208zM632 752c132.552 0 240-107.448 240-240 0-132.552-107.448-240-240-240-132.552 0-240 107.448-240 240 0 132.552 107.448 240 240 240z m-40-280v-80a40 40 0 0 1 80 0v80h80a40 40 0 0 1 0 80h-80v80a40 40 0 0 1-80 0v-80h-80a40 40 0 0 1 0-80h80z" ></path></symbol><symbol id="icon-tongjijiedian-" viewBox="0 0 1024 1024"><path d="M803.84 131.626667H410.24A59.733333 59.733333 0 0 0 350.506667 192v45.226667H199.68a51.626667 51.626667 0 0 0-51.626667 51.626666v465.92a51.626667 51.626667 0 0 0 51.626667 51.626667h187.52v-55.466667h-162.133333a21.333333 21.333333 0 0 1-21.333334-21.333333V313.386667a21.333333 21.333333 0 0 1 21.333334-21.333334h125.653333v64a59.733333 59.733333 0 0 0 59.733333 59.733334h393.386667a59.733333 59.733333 0 0 0 59.733333-59.733334V192a59.733333 59.733333 0 0 0-59.733333-60.373333z m4.266667 224.64a4.266667 4.266667 0 0 1-4.266667 4.266666H410.24a4.266667 4.266667 0 0 1-4.266667-4.266666V192a4.266667 4.266667 0 0 1 4.266667-4.266667h393.6a4.266667 4.266667 0 0 1 4.266667 4.266667zM716.16 749.44h-81.28v-81.493333a27.733333 27.733333 0 0 0-55.466667 0v81.28h-81.493333a27.733333 27.733333 0 1 0 0 55.466666h81.28v81.28a27.733333 27.733333 0 1 0 55.466667 0v-81.066666h81.28a27.733333 27.733333 0 0 0 0-55.466667z" ></path></symbol><symbol id="icon-close" viewBox="0 0 1024 1024"><path d="M557.312 513.248l265.28-263.904c12.544-12.48 12.608-32.704 0.128-45.248-12.512-12.576-32.704-12.608-45.248-0.128L512.128 467.904l-263.04-263.84c-12.448-12.48-32.704-12.544-45.248-0.064-12.512 12.48-12.544 32.736-0.064 45.28l262.976 263.776L201.6 776.8c-12.544 12.48-12.608 32.704-0.128 45.248a31.937 31.937 0 0 0 22.688 9.44c8.16 0 16.32-3.104 22.56-9.312l265.216-263.808 265.44 266.24c6.24 6.272 14.432 9.408 22.656 9.408a31.94 31.94 0 0 0 22.592-9.344c12.512-12.48 12.544-32.704 0.064-45.248L557.312 513.248z" fill="" ></path></symbol><symbol id="icon-menu" viewBox="0 0 1024 1024"><path d="M109.714 292.571h804.572c21.943 0 36.571-21.942 36.571-43.885 0-14.629-14.628-29.257-36.571-29.257H109.714c-21.943 0-36.571 14.628-36.571 36.571 0 14.629 14.628 36.571 36.571 36.571zM914.286 512H109.714c-21.943 0-36.571 14.629-36.571 36.571 0 14.629 14.628 36.572 36.571 36.572h804.572c21.943 0 36.571-21.943 36.571-43.886 0-14.628-14.628-29.257-36.571-29.257z m0 292.571H109.714c-21.943 0-36.571 14.629-36.571 36.572s14.628 36.571 36.571 36.571h804.572c21.943 0 36.571-21.943 36.571-36.571 0-21.943-14.628-36.572-36.571-36.572z" ></path></symbol><symbol id="icon-right" viewBox="0 0 1024 1024"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="" ></path></symbol><symbol id="icon-left" viewBox="0 0 1024 1024"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="" ></path></symbol><symbol id="icon-side" viewBox="0 0 1024 1024"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" ></path></symbol><symbol id="icon-B" viewBox="0 0 1024 1024"><path d="M98.067692 65.457231H481.28c75.854769 0 132.411077 3.150769 169.668923 9.452307 37.336615 6.301538 70.656 19.534769 100.036923 39.620924 29.459692 20.007385 53.956923 46.710154 73.570462 80.029538 19.692308 33.398154 29.459692 70.734769 29.459692 112.167385 0 44.898462-12.130462 86.094769-36.233846 123.588923a224.886154 224.886154 0 0 1-98.461539 84.283077c58.368 17.092923 103.266462 46.08 134.695385 87.04 31.350154 40.96 47.025231 89.088 47.025231 144.462769 0 43.638154-10.082462 86.016-30.404923 127.212308-20.243692 41.196308-47.891692 74.043077-83.02277 98.697846-35.052308 24.654769-78.296615 39.778462-129.732923 45.449846-32.295385 3.465846-110.119385 5.671385-233.472 6.537846H98.067692V65.457231z m193.536 159.507692V446.621538h126.818462c75.460923 0 122.328615-1.024 140.603077-3.229538 33.083077-3.938462 59.155692-15.36 78.139077-34.343385 18.904615-18.904615 28.435692-43.874462 28.435692-74.830769 0-29.696-8.192-53.720615-24.497231-72.310154-16.384-18.510769-40.644923-29.696-72.940307-33.634461-19.140923-2.205538-74.279385-3.308308-165.415385-3.308308h-111.064615z m0 381.243077v256.315077h179.2c69.710769 0 113.979077-1.969231 132.726154-5.907692 28.750769-5.198769 52.145231-17.959385 70.262154-38.281847 18.116923-20.243692 27.096615-47.340308 27.096615-81.368615 0-28.750769-6.931692-53.169231-20.873846-73.255385a118.232615 118.232615 0 0 0-60.494769-43.795692c-26.387692-9.137231-83.574154-13.705846-171.638154-13.705846H291.603692z" ></path></symbol><symbol id="icon-a" viewBox="0 0 1024 1024"><path d="M757.76 665.6q0 20.48 1.536 34.304t7.68 22.016 18.944 12.288 34.304 4.096q-3.072 25.6-15.36 44.032-11.264 16.384-33.28 29.696t-62.976 13.312q-11.264 0-20.48-0.512t-17.408-2.56l-6.144-2.048-1.024 0q-4.096-1.024-10.24-4.096-2.048-2.048-4.096-2.048-1.024-1.024-2.048-1.024-14.336-8.192-23.552-17.408t-14.336-17.408q-6.144-10.24-9.216-20.48-63.488 75.776-178.176 75.776-48.128 0-88.064-15.36t-69.12-44.032-45.056-68.096-15.872-88.576 16.896-89.088 47.616-67.584 74.24-42.496 96.768-14.848q48.128 0 88.576 17.408t66.048 49.152q0-8.192 0.512-16.384t0.512-15.36q0-71.68-39.936-104.448t-128-32.768q-43.008 0-84.992 6.656t-84.992 17.92q14.336-28.672 25.088-47.616t24.064-29.184q30.72-24.576 158.72-24.576 79.872 0 135.168 13.824t90.624 43.52 51.2 75.264 15.872 108.032l0 200.704zM487.424 743.424q50.176 0 79.872-33.28t29.696-95.744q0-61.44-28.672-93.696t-76.8-32.256q-52.224 0-82.944 33.28t-30.72 94.72q0 58.368 31.744 92.672t77.824 34.304z" ></path></symbol><symbol id="icon-full" viewBox="0 0 1024 1024"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" ></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" ></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" ></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" ></path></symbol><symbol id="icon-add" viewBox="0 0 1024 1024"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" ></path></symbol><symbol id="icon-move" viewBox="0 0 1024 1024"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" ></path></symbol><symbol id="icon-living" viewBox="0 0 1024 1024"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="" ></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="" ></path></symbol></svg>',h=(h=document.getElementsByTagName("script"))[h.length-1].getAttribute("data-injectcss");if(h&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch(d){console&&console.log(d)}}function f(){o||(o=!0,n())}t=function(){var d,a,c,u;(u=document.createElement("div")).innerHTML=r,r=null,(c=u.getElementsByTagName("svg")[0])&&(c.setAttribute("aria-hidden","true"),c.style.position="absolute",c.style.width=0,c.style.height=0,c.style.overflow="hidden",d=c,(a=document.body).firstChild?(u=d,(c=a.firstChild).parentNode.insertBefore(u,c)):a.appendChild(d))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),t()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(n=t,s=e.document,o=!1,(l=function(){try{s.documentElement.doScroll("left")}catch{return void setTimeout(l,50)}f()})(),s.onreadystatechange=function(){s.readyState=="complete"&&(s.onreadystatechange=null,f())})})(window);const R=0,K=1,F=2,L=30,S=8,et={name:"Latte",palette:["#dd7878","#ea76cb","#8839ef","#e64553","#fe640b","#df8e1d","#40a02b","#209fb5","#1e66f5","#7287fd"],cssVar:{"--main-color":"#444446","--main-bgcolor":"#ffffff","--color":"#777777","--bgcolor":"#f6f6f6","--panel-color":"#444446","--panel-bgcolor":"#ffffff","--panel-border-color":"#eaeaea"}},it={name:"Dark",palette:["#848FA0","#748BE9","#D2F9FE","#4145A5","#789AFA","#706CF4","#EF987F","#775DD5","#FCEECF","#DA7FBC"],cssVar:{"--main-color":"#ffffff","--main-bgcolor":"#4c4f69","--color":"#cccccc","--bgcolor":"#252526","--panel-color":"#ffffff","--panel-bgcolor":"#2d3748","--panel-border-color":"#696969"}};function nt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}const st=function(e,t){if(t.id===e)return t;if(t.children&&t.children.length){for(let i=0;i<t.children.length;i++){const n=st(e,t.children[i]);if(n)return n}return null}else return null},J=(e,t)=>{if(e.parent=t,e.children)for(let i=0;i<e.children.length;i++)J(e.children[i],e)};function ot(e,t,i,n){const s=n-t,o=e-i;let l=Math.atan(Math.abs(s)/Math.abs(o))/3.14*180;o<0&&s>0&&(l=180-l),o<0&&s<0&&(l=180+l),o>0&&s<0&&(l=360-l);const r=20,h=30,f=l+h,d=l-h;return{x1:i+Math.cos(Math.PI*f/180)*r,y1:n-Math.sin(Math.PI*f/180)*r,x2:i+Math.cos(Math.PI*d/180)*r,y2:n-Math.sin(Math.PI*d/180)*r}}function U(e,t,i){let n,s;const o=(e.cy-i)/(t-e.cx);return o>e.h/e.w||o<-e.h/e.w?e.cy-i<0?(n=e.cx-e.h/2/o,s=e.cy+e.h/2):(n=e.cx+e.h/2/o,s=e.cy-e.h/2):e.cx-t<0?(n=e.cx+e.w/2,s=e.cy-e.w*o/2):(n=e.cx-e.w/2,s=e.cy+e.w*o/2),{x:n,y:s}}function Q(e,t,i){let n,s;const o=(e.cy-i)/(t-e.cx);return o>e.h/e.w||o<-e.h/e.w?e.cy-i<0?(n=e.cx-e.h/2/o,s=e.cy+e.h/2):(n=e.cx+e.h/2/o,s=e.cy-e.h/2):e.cx-t<0?(n=e.cx+e.w/2,s=e.cy-e.w*o/2):(n=e.cx-e.w/2,s=e.cy+e.w*o/2),{x:n,y:s}}function Z(){return(new Date().getTime().toString(16)+Math.random().toString(16).substr(2)).substr(2,16)}const Mt=function(){const e=Z();return{topic:this.newTopicName,id:e}},lt=(e,t)=>{let i=0,n=0;for(;t&&t!==e;)i+=t.offsetLeft,n+=t.offsetTop,t=t.offsetParent;return{offsetLeft:i,offsetTop:n}},tt=(e,t)=>{for(const i in t)e.setAttribute(i,t[i])},$={moved:!1,mousedown:!1,lastX:0,lastY:0,onMove(e,t){if(this.mousedown){if(this.moved=!0,!this.lastX){this.lastX=e.pageX,this.lastY=e.pageY;return}const i=this.lastX-e.pageX,n=this.lastY-e.pageY;t.scrollTo(t.scrollLeft+i,t.scrollTop+n),this.lastX=e.pageX,this.lastY=e.pageY}},clear(){this.moved=!1,this.mousedown=!1,this.lastX=0,this.lastY=0}},rt=e=>e.tagName==="ME-TPC";function kt(e){e.map.addEventListener("click",t=>{var n;if($.moved){$.clear();return}e.unselectNode(),e.unselectNodes(),e.unselectSummary();const i=t.target;if(i.tagName==="ME-EPD")e.expandNode(i.previousSibling);else if(e.editable)rt(i)?e.selectNode(i,!1,t):i.tagName==="text"?e.selectSummary(i.parentElement):i.tagName==="path"?((n=i==null?void 0:i.parentElement)==null?void 0:n.tagName)==="g"&&e.selectLink(i.parentElement):i.className==="circle"||e.hideLinkController&&e.hideLinkController();else return}),e.map.addEventListener("dblclick",t=>{if(t.preventDefault(),!e.editable)return;const i=t.target;rt(i)?e.beginEdit(i):i.tagName==="text"&&e.editSummary(i.parentElement)}),e.map.addEventListener("mousemove",t=>{t.target.contentEditable!=="true"&&$.onMove(t,e.container)}),e.map.addEventListener("mousedown",t=>{t.button===2&&t.target.contentEditable!=="true"&&($.moved=!1,$.mousedown=!0)}),e.map.addEventListener("mouseleave",t=>{console.log(t.button),t.button===2&&$.clear()}),e.map.addEventListener("mouseup",t=>{t.button===2&&$.clear()})}const $t={create(){return{handlers:{},showHandler:function(){console.log(this.handlers)},addListener:function(e,t){this.handlers[e]===void 0&&(this.handlers[e]=[]),this.handlers[e].push(t)},fire:function(e,...t){if(this.handlers[e]instanceof Array){const i=this.handlers[e];for(let n=0;n<i.length;n++)i[n](...t)}},removeListener:function(e,t){if(!this.handlers[e])return;const i=this.handlers[e];if(!t)i.length=0;else if(i.length)for(let n=0;n<i.length;n++)i[n]===t&&this.handlers[e].splice(n,1)}}}},W=document,Nt=function(){console.time("layout"),this.nodes.innerHTML="";const e=this.createTopic(this.nodeData);ct(e,this.nodeData),e.draggable=!1;const t=W.createElement("me-root");t.appendChild(e);const i=this.nodeData.children||[];if(this.direction===F){let n=0,s=0;i.map(o=>{o.direction===R?n+=1:o.direction===K?s+=1:n<=s?(o.direction=R,n+=1):(o.direction=K,s+=1)})}Tt(this,i,t),console.timeEnd("layout")},Tt=function(e,t,i){const n=W.createElement("me-main");n.className="lhs";const s=W.createElement("me-main");s.className="rhs";for(let o=0;o<t.length;o++){const l=t[o],{grp:r}=e.createWrapper(l);e.direction===F?l.direction===R?n.appendChild(r):s.appendChild(r):e.direction===R?n.appendChild(r):s.appendChild(r)}e.nodes.appendChild(n),e.nodes.appendChild(i),e.nodes.appendChild(s),e.nodes.appendChild(e.lines)},At=function(e,t){const i=W.createElement("me-children");for(let n=0;n<t.length;n++){const s=t[n],{grp:o}=e.createWrapper(s);i.appendChild(o)}return i},w=document,M=(e,t)=>(t?t.mindElixirBox:w).querySelector(`[data-nodeid=me${e}]`),ct=function(e,t){if(e.textContent=t.topic,t.style&&(e.style.color=t.style.color||"",e.style.background=t.style.background||"",e.style.fontSize=t.style.fontSize+"px",e.style.fontWeight=t.style.fontWeight||"normal"),t.image){const i=t.image;if(i.url&&i.width&&i.height){const n=w.createElement("img");n.src=i.url,n.style.width=i.width+"px",n.style.height=i.height+"px",e.appendChild(n),e.image=n}else console.warn("image url/width/height are required")}if(t.hyperLink){const i=w.createElement("a");i.className="hyper-link",i.target="_blank",i.innerText="🔗",i.href=t.hyperLink,e.appendChild(i),e.linkContainer=i,console.log(i)}else e.linkContainer&&(e.linkContainer.remove(),e.linkContainer=null);if(t.icons&&t.icons.length){const i=w.createElement("span");i.className="icons",i.innerHTML=t.icons.map(n=>`<span>${nt(n)}</span>`).join(""),e.appendChild(i),e.icons=i}if(t.tags&&t.tags.length){const i=w.createElement("div");i.className="tags",i.innerHTML=t.tags.map(n=>`<span>${nt(n)}</span>`).join(""),e.appendChild(i),e.tags=i}t.branchColor&&(e.style.borderColor=t.branchColor)},Ht=function(e,t){const i=w.createElement("me-wrapper"),{p:n,tpc:s}=this.createParent(e);if(i.appendChild(n),!t&&e.children&&e.children.length>0){const o=Vt(e.expanded);if(n.appendChild(o),e.expanded!==!1){const l=At(this,e.children);i.appendChild(l)}}return{grp:i,top:n,tpc:s}},Pt=function(e){const t=w.createElement("me-parent"),i=this.createTopic(e);return ct(i,e),t.appendChild(i),{p:t,tpc:i}},Bt=function(e){const t=w.createElement("me-children");return t.append(...e),t},zt=function(e){const t=w.createElement("me-tpc");return t.nodeObj=e,t.dataset.nodeid="me"+e.id,t.draggable=this.draggable,t};function at(e){const t=w.createRange();t.selectNodeContents(e);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(t))}const Dt=function(e){if(console.time("editTopic"),!e)return;const t=w.createElement("div"),i=e.childNodes[0].textContent;e.appendChild(t),t.id="input-box",t.textContent=i,t.contentEditable="true",t.spellcheck=!1,t.style.cssText=`min-width:${e.offsetWidth-8}px;`,this.direction===R&&(t.style.right="0"),t.focus(),at(t),this.bus.fire("operation",{name:"beginEdit",obj:e.nodeObj}),t.addEventListener("keydown",n=>{n.stopPropagation();const s=n.key;if(s==="Enter"||s==="Tab"){if(n.shiftKey)return;n.preventDefault(),t==null||t.blur(),this.map.focus()}}),t.addEventListener("blur",()=>{var o;if(!t)return;const n=e.nodeObj,s=((o=t.textContent)==null?void 0:o.trim())||"";console.log(s),s===""?n.topic=i:n.topic=s,t.remove(),s!==i&&(e.childNodes[0].textContent=n.topic,this.linkDiv(),this.bus.fire("operation",{name:"finishEdit",obj:n,origin:i}))}),console.timeEnd("editTopic")},Vt=function(e){const t=w.createElement("me-epd");return t.expanded=e!==!1,t.className=e!==!1?"minus":"",t},H=document,P="http://www.w3.org/2000/svg",Rt=function(e,t){const i=H.createElementNS(P,"path");return i.setAttribute("d",e),i.setAttribute("stroke",t||"#666"),i.setAttribute("fill","none"),i.setAttribute("stroke-width","3"),i},j=function(e){const t=H.createElementNS(P,"svg");return t.setAttribute("class",e),t.setAttribute("overflow","visible"),t},ht=function(e,t,i,n){const s=H.createElementNS(P,"line");return s.setAttribute("x1",String(e)),s.setAttribute("y1",String(t)),s.setAttribute("x2",String(i)),s.setAttribute("y2",String(n)),s.setAttribute("stroke","#bbb"),s.setAttribute("fill","none"),s.setAttribute("stroke-width","2"),s},Ot=function(e,t){const i=H.createElementNS(P,"path");return i.setAttribute("d",e),i.setAttribute("stroke",t||"#555"),i.setAttribute("fill","none"),i.setAttribute("stroke-linecap","square"),i.setAttribute("stroke-width","2"),i},qt=function(e,t){const i=H.createElementNS(P,"g"),n=H.createElementNS(P,"path"),s=H.createElementNS(P,"path");return s.setAttribute("d",t),s.setAttribute("stroke","rgb(235, 95, 82)"),s.setAttribute("fill","none"),s.setAttribute("stroke-linecap","cap"),s.setAttribute("stroke-width","2"),n.setAttribute("d",e),n.setAttribute("stroke","rgb(235, 95, 82)"),n.setAttribute("fill","none"),n.setAttribute("stroke-linecap","cap"),n.setAttribute("stroke-width","2"),i.appendChild(n),i.appendChild(s),i};let dt=ft;const jt=function(e){console.time("linkDiv");const t=this.map.querySelector("me-root");this.nodes.style.top=`${1e4-this.nodes.offsetHeight/2}px`,this.nodes.style.left=`${1e4-t.offsetLeft-t.offsetWidth/2}px`;const i=this.map.querySelectorAll("me-main > me-wrapper");this.lines.innerHTML="",dt=this.subLinkStyle===2?Wt:ft;for(let n=0;n<i.length;n++){const s=i[n],o=s.querySelector("me-tpc"),l=s.firstChild,r=s.parentNode.className;let h=t.offsetLeft+t.offsetWidth/2;const f=t.offsetTop+t.offsetHeight/2;let d;const a=this.theme.palette,c=o.nodeObj.branchColor||a[n%a.length],{offsetLeft:u,offsetTop:g}=lt(this.nodes,l);r==="lhs"?d=u+l.offsetWidth:d=u;const m=g+l.offsetHeight/2;let p="";if(this.mainLinkStyle===2)this.direction===F&&(r==="lhs"?h=h-t.offsetWidth/6:h=h+t.offsetWidth/6),p=Xt({x1:h,y1:f,x2:d,y2:m});else{const x=(1-Math.abs(m-s.parentElement.offsetTop-s.parentElement.offsetHeight/2)/s.parentElement.offsetHeight)*.25*(t.offsetWidth/2);r==="lhs"?h=h-t.offsetWidth/10-x:h=h+t.offsetWidth/10+x,p=Ft({x1:h,y1:f,x2:d,y2:m})}this.lines.appendChild(Rt(p,c));const v=s.children[0].children[1];if(v&&(v.style.top=(v.parentNode.offsetHeight-v.offsetHeight)/2+"px",r==="lhs"?v.style.left="-10px":v.style.right="-10px"),!(e&&e!==s)&&s.childElementCount){const y=j("subLines"),x=s.lastChild;x.tagName==="svg"&&x.remove(),s.appendChild(y);const _=s.firstChild,C=s.children[1].children,A=ut(C,_,r,!0);y.appendChild(Ot(A,c))}}this.linkSvgGroup.innerHTML="";for(const n in this.linkData){const s=this.linkData[n];this.createLink(M(s.from),M(s.to),!0,s)}this.renderSummary(),console.timeEnd("linkDiv")},ut=function(e,t,i,n){let s="";const o=t.offsetTop,l=t.offsetLeft,r=t.offsetWidth,h=t.offsetHeight;for(let f=0;f<e.length;f++){const d=e[f],a=d.firstChild,c=a.offsetTop,u=a.offsetLeft,g=a.offsetWidth,m=a.offsetHeight;s+=dt({pT:o,pL:l,pW:r,pH:h,cT:c,cL:u,cW:g,cH:m,direction:i,isFirst:n});const p=a.children[1];if(p){if(p.style.bottom=-(p.offsetHeight/2)+"px",i==="lhs"?p.style.left="10px":i==="rhs"&&(p.style.right="10px"),!p.expanded)continue}else continue;const v=d.children[1].children;v.length>0&&(s+=ut(v,a,i))}return s};function Xt({x1:e,y1:t,x2:i,y2:n}){return`M ${e} ${t} V ${n>t?n-20:n+20} C ${e} ${n} ${e} ${n} ${i>e?e+20:e-20} ${n} H ${i}`}function Ft({x1:e,y1:t,x2:i,y2:n}){return`M ${e} ${t} Q ${e} ${n} ${i} ${n}`}function Wt({pT:e,pL:t,pW:i,pH:n,cT:s,cL:o,cW:l,cH:r,direction:h,isFirst:f}){let d;f?d=e+n/2:d=e+n;const a=s+r;let c=0,u=0,g=0;return h==="lhs"?(c=t+L,u=o,g=o+l):h==="rhs"&&(c=t+i-L,u=o+l,g=o),a<d+50&&a>d-50?`M ${c} ${d} H ${g} V ${a} H ${u}`:a>=d?`M ${c} ${d} H ${g} V ${a-S} A ${S} ${S} 0 0 ${c>u?1:0} ${c>u?g-S:g+S} ${a} H ${u}`:`M ${c} ${d} H ${g} V ${a+S} A ${S} ${S} 0 0 ${c>u?0:1} ${c>u?g-S:g+S} ${a} H ${u}`}function ft({pT:e,pL:t,pW:i,pH:n,cT:s,cL:o,cW:l,cH:r,direction:h,isFirst:f}){let d=0,a=0;f?d=e+n/2:d=e+n;const c=s+r;let u=0,g=0,m=0;const p=Math.min(Math.abs(d-c)/800,1.2)*L;return h==="lhs"?(m=t,u=m+L,g=m-L,a=o+L,`M ${u} ${d} C ${m} ${d} ${m+p} ${c} ${g} ${c} H ${a}`):(m=t+i,u=m-L,g=m+L,a=o+l-L,`M ${u} ${d} C ${m} ${d} ${m-p} ${c} ${g} ${c} H ${a}`)}const ge="",ve="",be="",B=(e,t)=>{const i=document.createElement("span");return i.id=e,i.innerHTML=`<svg class="icon" aria-hidden="true">
3
3
  <use xlink:href="#icon-${t}"></use>
4
- </svg>`,i};function Yt(e){const t=document.createElement("div"),i=B("fullscreen","full"),n=B("toCenter","living"),s=B("zoomout","move"),o=B("zoomin","add"),l=document.createElement("span");return l.innerText="100%",t.appendChild(i),t.appendChild(n),t.appendChild(s),t.appendChild(o),t.className="mind-elixir-toolbar rb",i.onclick=()=>{e.container.requestFullscreen()},n.onclick=()=>{e.toCenter()},s.onclick=()=>{e.scaleVal<.6||e.scale(e.scaleVal-=.2)},o.onclick=()=>{e.scaleVal>1.6||e.scale(e.scaleVal+=.2)},t}function It(e){const t=document.createElement("div"),i=B("tbltl","left"),n=B("tbltr","right"),s=B("tblts","side");return t.appendChild(i),t.appendChild(n),t.appendChild(s),t.className="mind-elixir-toolbar lt",i.onclick=()=>{e.initLeft()},n.onclick=()=>{e.initRight()},s.onclick=()=>{e.initSide()},t}function Gt(e){e.container.append(Yt(e)),e.container.append(It(e))}/*! @viselect/vanilla v3.3.1 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */var Kt=Object.defineProperty,Jt=(e,t,i)=>t in e?Kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,b=(e,t,i)=>(Jt(e,typeof t!="symbol"?t+"":t,i),i);class Ut{constructor(){b(this,"_listeners",new Map),b(this,"on",this.addEventListener),b(this,"off",this.removeEventListener),b(this,"emit",this.dispatchEvent)}addEventListener(t,i){const n=this._listeners.get(t)??new Set;return this._listeners.set(t,n),n.add(i),this}removeEventListener(t,i){var n;return(n=this._listeners.get(t))==null||n.delete(i),this}dispatchEvent(t,...i){let n=!0;for(const s of this._listeners.get(t)??[])n=s(...i)!==!1&&n;return n}unbindAllListeners(){this._listeners.clear()}}const pt=(e,t="px")=>typeof e=="number"?e+t:e;function N({style:e},t,i){if(typeof t=="object")for(const[n,s]of Object.entries(t))s!==void 0&&(e[n]=pt(s));else i!==void 0&&(e[t]=pt(i))}function mt(e){return(t,i,n,s={})=>{t instanceof HTMLCollection||t instanceof NodeList?t=Array.from(t):Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);for(const o of t)for(const l of i)o[e](l,n,{capture:!1,...s});return[t,i,n,s]}}const O=mt("addEventListener"),T=mt("removeEventListener"),Y=e=>{var t;const{clientX:i,clientY:n,target:s}=((t=e.touches)==null?void 0:t[0])??e;return{x:i,y:n,target:s}};function gt(e,t,i="touch"){switch(i){case"center":{const n=t.left+t.width/2,s=t.top+t.height/2;return n>=e.left&&n<=e.right&&s>=e.top&&s<=e.bottom}case"cover":return t.left>=e.left&&t.top>=e.top&&t.right<=e.right&&t.bottom<=e.bottom;case"touch":return e.right>=t.left&&e.left<=t.right&&e.bottom>=t.top&&e.top<=t.bottom}}function q(e,t=document){const i=Array.isArray(e)?e:[e];let n=[];for(let s=0,o=i.length;s<o;s++){const l=i[s];typeof l=="string"?n=n.concat(Array.from(t.querySelectorAll(l))):l instanceof Element&&n.push(l)}return n}const Qt=()=>matchMedia("(hover: none), (pointer: coarse)").matches,Zt=()=>"safari"in window,te=e=>{let t,i=-1,n=!1;return{next(...s){t=s,n||(n=!0,i=requestAnimationFrame(()=>{e(...t),n=!1}))},cancel(){cancelAnimationFrame(i),n=!1}}},{abs:z,max:vt,min:bt,ceil:yt}=Math;class xt extends Ut{constructor(t){var i,n,s,o,l;super(),b(this,"_options"),b(this,"_selection",{stored:[],selected:[],touched:[],changed:{added:[],removed:[]}}),b(this,"_area"),b(this,"_clippingElement"),b(this,"_targetElement"),b(this,"_targetRect"),b(this,"_selectables",[]),b(this,"_latestElement"),b(this,"_areaRect",new DOMRect),b(this,"_areaLocation",{y1:0,x2:0,y2:0,x1:0}),b(this,"_singleClick",!0),b(this,"_frame"),b(this,"_scrollAvailable",!0),b(this,"_scrollingActive",!1),b(this,"_scrollSpeed",{x:0,y:0}),b(this,"_scrollDelta",{x:0,y:0}),b(this,"disable",this._bindStartEvents.bind(this,!1)),b(this,"enable",this._bindStartEvents),this._options={selectionAreaClass:"selection-area",selectionContainerClass:void 0,selectables:[],document:window.document,startAreas:["html"],boundaries:["html"],container:"body",...t,behaviour:{overlap:"invert",intersect:"touch",...t.behaviour,startThreshold:(i=t.behaviour)!=null&&i.startThreshold?typeof t.behaviour.startThreshold=="number"?t.behaviour.startThreshold:{x:10,y:10,...t.behaviour.startThreshold}:{x:10,y:10},scrolling:{speedDivider:10,manualSpeed:750,...(n=t.behaviour)==null?void 0:n.scrolling,startScrollMargins:{x:0,y:0,...(o=(s=t.behaviour)==null?void 0:s.scrolling)==null?void 0:o.startScrollMargins}}},features:{range:!0,touch:!0,...t.features,singleTap:{allow:!0,intersect:"native",...(l=t.features)==null?void 0:l.singleTap}}};for(const d of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))typeof this[d]=="function"&&(this[d]=this[d].bind(this));const{document:r,selectionAreaClass:h,selectionContainerClass:f}=this._options;this._area=r.createElement("div"),this._clippingElement=r.createElement("div"),this._clippingElement.appendChild(this._area),this._area.classList.add(h),f&&this._clippingElement.classList.add(f),N(this._area,{willChange:"top, left, bottom, right, width, height",top:0,left:0,position:"fixed"}),N(this._clippingElement,{overflow:"hidden",position:"fixed",transform:"translate3d(0, 0, 0)",pointerEvents:"none",zIndex:"1"}),this._frame=te(d=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",d),this._redrawSelectionArea()}),this.enable()}_bindStartEvents(t=!0){const{document:i,features:n}=this._options,s=t?O:T;s(i,"mousedown",this._onTapStart),n.touch&&s(i,"touchstart",this._onTapStart,{passive:!1})}_onTapStart(t,i=!1){const{x:n,y:s,target:o}=Y(t),{_options:l}=this,{document:r}=this._options,h=o.getBoundingClientRect(),f=q(l.startAreas,l.document),d=q(l.boundaries,l.document);this._targetElement=d.find(u=>gt(u.getBoundingClientRect(),h));const a=t.composedPath();if(!this._targetElement||!f.find(u=>a.includes(u))||!d.find(u=>a.includes(u))||!i&&this._emitEvent("beforestart",t)===!1)return;this._areaLocation={x1:n,y1:s,x2:0,y2:0};const c=r.scrollingElement??r.body;this._scrollDelta={x:c.scrollLeft,y:c.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),O(r,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),O(r,["mouseup","touchcancel","touchend"],this._onTapStop),O(r,"scroll",this._onScroll)}_onSingleTap(t){const{singleTap:{intersect:i},range:n}=this._options.features,s=Y(t);let o;if(i==="native")o=s.target;else if(i==="touch"){this.resolveSelectables();const{x:r,y:h}=s;o=this._selectables.find(f=>{const{right:d,left:a,top:c,bottom:u}=f.getBoundingClientRect();return r<d&&r>a&&h<u&&h>c})}if(!o)return;for(this.resolveSelectables();!this._selectables.includes(o);){if(!o.parentElement)return;o=o.parentElement}const{stored:l}=this._selection;if(this._emitEvent("start",t),t.shiftKey&&n&&this._latestElement){const r=this._latestElement,[h,f]=r.compareDocumentPosition(o)&4?[o,r]:[r,o],d=[...this._selectables.filter(a=>a.compareDocumentPosition(h)&4&&a.compareDocumentPosition(f)&2),h,f];this.select(d),this._latestElement=r}else l.includes(o)&&(l.length===1||t.ctrlKey||l.every(r=>this._selection.stored.includes(r)))?this.deselect(o):(this.select(o),this._latestElement=o);this._emitEvent("stop",t)}_delayedTapMove(t){const{container:i,document:n,behaviour:{startThreshold:s}}=this._options,{x1:o,y1:l}=this._areaLocation,{x:r,y:h}=Y(t);if(typeof s=="number"&&z(r+h-(o+l))>=s||typeof s=="object"&&z(r-o)>=s.x||z(h-l)>=s.y){if(T(n,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),this._emitEvent("beforedrag",t)===!1){T(n,["mouseup","touchcancel","touchend"],this._onTapStop);return}O(n,["mousemove","touchmove"],this._onTapMove,{passive:!1}),N(this._area,"display","block"),q(i,n)[0].appendChild(this._clippingElement),this.resolveSelectables(),this._singleClick=!1,this._targetRect=this._targetElement.getBoundingClientRect(),this._scrollAvailable=this._targetElement.scrollHeight!==this._targetElement.clientHeight||this._targetElement.scrollWidth!==this._targetElement.clientWidth,this._scrollAvailable&&(O(n,"wheel",this._manualScroll,{passive:!1}),this._selectables=this._selectables.filter(f=>this._targetElement.contains(f))),this._setupSelectionArea(),this._emitEvent("start",t),this._onTapMove(t)}this._handleMoveEvent(t)}_setupSelectionArea(){const{_clippingElement:t,_targetElement:i,_area:n}=this,s=this._targetRect=i.getBoundingClientRect();this._scrollAvailable?(N(t,{top:s.top,left:s.left,width:s.width,height:s.height}),N(n,{marginTop:-s.top,marginLeft:-s.left})):(N(t,{top:0,left:0,width:"100%",height:"100%"}),N(n,{marginTop:0,marginLeft:0}))}_onTapMove(t){const{x:i,y:n}=Y(t),{_scrollSpeed:s,_areaLocation:o,_options:l,_frame:r}=this,{speedDivider:h}=l.behaviour.scrolling,f=this._targetElement;if(o.x2=i,o.y2=n,this._scrollAvailable&&!this._scrollingActive&&(s.y||s.x)){this._scrollingActive=!0;const d=()=>{if(!s.x&&!s.y){this._scrollingActive=!1;return}const{scrollTop:a,scrollLeft:c}=f;s.y&&(f.scrollTop+=yt(s.y/h),o.y1-=f.scrollTop-a),s.x&&(f.scrollLeft+=yt(s.x/h),o.x1-=f.scrollLeft-c),r.next(t),requestAnimationFrame(d)};requestAnimationFrame(d)}else r.next(t);this._handleMoveEvent(t)}_handleMoveEvent(t){const{features:i}=this._options;(i.touch&&Qt()||this._scrollAvailable&&Zt())&&t.preventDefault()}_onScroll(){const{_scrollDelta:t,_options:{document:i}}=this,{scrollTop:n,scrollLeft:s}=i.scrollingElement??i.body;this._areaLocation.x1+=t.x-s,this._areaLocation.y1+=t.y-n,t.x=s,t.y=n,this._setupSelectionArea(),this._frame.next(null)}_manualScroll(t){const{manualSpeed:i}=this._options.behaviour.scrolling,n=t.deltaY?t.deltaY>0?1:-1:0,s=t.deltaX?t.deltaX>0?1:-1:0;this._scrollSpeed.y+=n*i,this._scrollSpeed.x+=s*i,this._onTapMove(t),t.preventDefault()}_recalculateSelectionAreaRect(){const{_scrollSpeed:t,_areaLocation:i,_areaRect:n,_targetElement:s,_options:o}=this,{scrollTop:l,scrollHeight:r,clientHeight:h,scrollLeft:f,scrollWidth:d,clientWidth:a}=s,c=this._targetRect,{x1:u,y1:g}=i;let{x2:m,y2:p}=i;const{behaviour:{scrolling:{startScrollMargins:v}}}=o;m<c.left+v.x?(t.x=f?-z(c.left-m+v.x):0,m=m<c.left?c.left:m):m>c.right-v.x?(t.x=d-f-a?z(c.left+c.width-m-v.x):0,m=m>c.right?c.right:m):t.x=0,p<c.top+v.y?(t.y=l?-z(c.top-p+v.y):0,p=p<c.top?c.top:p):p>c.bottom-v.y?(t.y=r-l-h?z(c.top+c.height-p-v.y):0,p=p>c.bottom?c.bottom:p):t.y=0;const y=bt(u,m),x=bt(g,p),_=vt(u,m),C=vt(g,p);n.x=y,n.y=x,n.width=_-y,n.height=C-x}_redrawSelectionArea(){const{x:t,y:i,width:n,height:s}=this._areaRect,{style:o}=this._area;o.left=`${t}px`,o.top=`${i}px`,o.width=`${n}px`,o.height=`${s}px`}_onTapStop(t,i){var n;const{document:s,features:o}=this._options,{_singleClick:l}=this;T(s,["mousemove","touchmove"],this._delayedTapMove),T(s,["touchmove","mousemove"],this._onTapMove),T(s,["mouseup","touchcancel","touchend"],this._onTapStop),T(s,"scroll",this._onScroll),this._keepSelection(),t&&l&&o.singleTap.allow?this._onSingleTap(t):!l&&!i&&(this._updateElementSelection(),this._emitEvent("stop",t)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,this._scrollAvailable&&T(s,"wheel",this._manualScroll,{passive:!0}),this._clippingElement.remove(),(n=this._frame)==null||n.cancel(),N(this._area,"display","none")}_updateElementSelection(){const{_selectables:t,_options:i,_selection:n,_areaRect:s}=this,{stored:o,selected:l,touched:r}=n,{intersect:h,overlap:f}=i.behaviour,d=f==="invert",a=[],c=[],u=[];for(let m=0;m<t.length;m++){const p=t[m];if(gt(s,p.getBoundingClientRect(),h)){if(l.includes(p))o.includes(p)&&!r.includes(p)&&r.push(p);else if(d&&o.includes(p)){u.push(p);continue}else c.push(p);a.push(p)}}d&&c.push(...o.filter(m=>!l.includes(m)));const g=f==="keep";for(let m=0;m<l.length;m++){const p=l[m];!a.includes(p)&&!(g&&o.includes(p))&&u.push(p)}n.selected=a,n.changed={added:c,removed:u},this._latestElement=void 0}_emitEvent(t,i){return this.emit(t,{event:i,store:this._selection,selection:this})}_keepSelection(){const{_options:t,_selection:i}=this,{selected:n,changed:s,touched:o,stored:l}=i,r=n.filter(h=>!l.includes(h));switch(t.behaviour.overlap){case"drop":{i.stored=[...r,...l.filter(h=>!o.includes(h))];break}case"invert":{i.stored=[...r,...l.filter(h=>!s.removed.includes(h))];break}case"keep":{i.stored=[...l,...n.filter(h=>!l.includes(h))];break}}}trigger(t,i=!0){this._onTapStart(t,i)}resolveSelectables(){this._selectables=q(this._options.selectables,this._options.document)}clearSelection(t=!0,i=!1){const{selected:n,stored:s,changed:o}=this._selection;o.added=[],o.removed.push(...n,...t?s:[]),i||(this._emitEvent("move",null),this._emitEvent("stop",null)),this._selection={stored:t?[]:s,selected:[],touched:[],changed:{added:[],removed:[]}}}getSelection(){return this._selection.stored}getSelectionArea(){return this._area}cancel(t=!1){this._onTapStop(null,!t)}destroy(){this.cancel(),this.disable(),this._clippingElement.remove(),super.unbindAllListeners()}select(t,i=!1){const{changed:n,selected:s,stored:o}=this._selection,l=q(t,this._options.document).filter(r=>!s.includes(r)&&!o.includes(r));return o.push(...l),s.push(...l),n.added.push(...l),n.removed=[],this._latestElement=void 0,i||(this._emitEvent("move",null),this._emitEvent("stop",null)),l}deselect(t,i=!1){const{selected:n,stored:s,changed:o}=this._selection,l=q(t,this._options.document).filter(r=>n.includes(r)||s.includes(r));l.length&&(this._selection.stored=s.filter(r=>!l.includes(r)),this._selection.selected=n.filter(r=>!l.includes(r)),this._selection.changed.added=[],this._selection.changed.removed.push(...l.filter(r=>!o.removed.includes(r))),this._latestElement=void 0,i||(this._emitEvent("move",null),this._emitEvent("stop",null)))}}b(xt,"version","3.3.1");function ee(e){const t=new xt({selectables:["#map me-tpc"],boundaries:["#map .map-container"],container:".map-container",behaviour:{scrolling:{speedDivider:10,manualSpeed:750,startScrollMargins:{x:10,y:10}}}}).on("beforestart",({event:i})=>!(i.button!==0||i.target.tagName==="ME-TPC"||i.target.id==="input-box")).on("start",({event:i})=>{!i.ctrlKey&&!i.metaKey&&(e.unselectNode(),e.unselectNodes(),e.unselectSummary(),t.clearSelection(!0,!0))}).on("move",({store:{changed:{added:i,removed:n}}})=>{$.moved=!0;for(const s of i)s.classList.add("selected");for(const s of n)s.classList.remove("selected")}).on("stop",({store:{stored:i}})=>{console.log(i,"stored"),e.selectNodes(i)});console.log(t,"selection")}const ie=function(e,t=!0){this.theme=e;const i=this.theme.cssVar,n=Object.keys(i);for(let s=0;s<n.length;s++){const o=n[s];this.mindElixirBox.style.setProperty(o,i[o])}t&&this.refresh()};function _t(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,linkData:e.linkData,direction:e.direction,theme:e.theme}}const ne=Object.freeze(Object.defineProperty({__proto__:null,cancelFocus:function(){this.isFocusMode=!1,this.tempDirection!==null&&(delete this.nodeData.root,this.nodeData=this.nodeDataBackup,this.direction=this.tempDirection,this.tempDirection=null,this.refresh(),this.toCenter())},disableEdit:function(){this.editable=!1},enableEdit:function(){this.editable=!0},expandNode:function(e,t){const i=e.nodeObj;typeof t=="boolean"?i.expanded=t:i.expanded!==!1?i.expanded=!1:i.expanded=!0,this.layout(),this.linkDiv(),this.bus.fire("expandNode",i)},focusNode:function(e){e.nodeObj.root||(this.tempDirection===null&&(this.tempDirection=this.direction),this.isFocusMode||(this.nodeDataBackup=this.nodeData,this.isFocusMode=!0),this.nodeData=e.nodeObj,this.nodeData.root=!0,this.initRight(),this.toCenter())},getData:function(){return JSON.parse(this.getDataString())},getDataMd:function(){const e=_t(this).nodeData;let t="# "+e.topic+`
4
+ </svg>`,i};function Yt(e){const t=document.createElement("div"),i=B("fullscreen","full"),n=B("toCenter","living"),s=B("zoomout","move"),o=B("zoomin","add"),l=document.createElement("span");return l.innerText="100%",t.appendChild(i),t.appendChild(n),t.appendChild(s),t.appendChild(o),t.className="mind-elixir-toolbar rb",i.onclick=()=>{e.container.requestFullscreen()},n.onclick=()=>{e.toCenter()},s.onclick=()=>{e.scaleVal<.6||e.scale(e.scaleVal-=.2)},o.onclick=()=>{e.scaleVal>1.6||e.scale(e.scaleVal+=.2)},t}function It(e){const t=document.createElement("div"),i=B("tbltl","left"),n=B("tbltr","right"),s=B("tblts","side");return t.appendChild(i),t.appendChild(n),t.appendChild(s),t.className="mind-elixir-toolbar lt",i.onclick=()=>{e.initLeft()},n.onclick=()=>{e.initRight()},s.onclick=()=>{e.initSide()},t}function Gt(e){e.container.append(Yt(e)),e.container.append(It(e))}/*! @viselect/vanilla v3.3.1 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */var Kt=Object.defineProperty,Jt=(e,t,i)=>t in e?Kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,b=(e,t,i)=>(Jt(e,typeof t!="symbol"?t+"":t,i),i);class Ut{constructor(){b(this,"_listeners",new Map),b(this,"on",this.addEventListener),b(this,"off",this.removeEventListener),b(this,"emit",this.dispatchEvent)}addEventListener(t,i){const n=this._listeners.get(t)??new Set;return this._listeners.set(t,n),n.add(i),this}removeEventListener(t,i){var n;return(n=this._listeners.get(t))==null||n.delete(i),this}dispatchEvent(t,...i){let n=!0;for(const s of this._listeners.get(t)??[])n=s(...i)!==!1&&n;return n}unbindAllListeners(){this._listeners.clear()}}const pt=(e,t="px")=>typeof e=="number"?e+t:e;function N({style:e},t,i){if(typeof t=="object")for(const[n,s]of Object.entries(t))s!==void 0&&(e[n]=pt(s));else i!==void 0&&(e[t]=pt(i))}function mt(e){return(t,i,n,s={})=>{t instanceof HTMLCollection||t instanceof NodeList?t=Array.from(t):Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);for(const o of t)for(const l of i)o[e](l,n,{capture:!1,...s});return[t,i,n,s]}}const O=mt("addEventListener"),T=mt("removeEventListener"),Y=e=>{var t;const{clientX:i,clientY:n,target:s}=((t=e.touches)==null?void 0:t[0])??e;return{x:i,y:n,target:s}};function gt(e,t,i="touch"){switch(i){case"center":{const n=t.left+t.width/2,s=t.top+t.height/2;return n>=e.left&&n<=e.right&&s>=e.top&&s<=e.bottom}case"cover":return t.left>=e.left&&t.top>=e.top&&t.right<=e.right&&t.bottom<=e.bottom;case"touch":return e.right>=t.left&&e.left<=t.right&&e.bottom>=t.top&&e.top<=t.bottom}}function q(e,t=document){const i=Array.isArray(e)?e:[e];let n=[];for(let s=0,o=i.length;s<o;s++){const l=i[s];typeof l=="string"?n=n.concat(Array.from(t.querySelectorAll(l))):l instanceof Element&&n.push(l)}return n}const Qt=()=>matchMedia("(hover: none), (pointer: coarse)").matches,Zt=()=>"safari"in window,te=e=>{let t,i=-1,n=!1;return{next(...s){t=s,n||(n=!0,i=requestAnimationFrame(()=>{e(...t),n=!1}))},cancel(){cancelAnimationFrame(i),n=!1}}},{abs:z,max:vt,min:bt,ceil:yt}=Math;class xt extends Ut{constructor(t){var i,n,s,o,l;super(),b(this,"_options"),b(this,"_selection",{stored:[],selected:[],touched:[],changed:{added:[],removed:[]}}),b(this,"_area"),b(this,"_clippingElement"),b(this,"_targetElement"),b(this,"_targetRect"),b(this,"_selectables",[]),b(this,"_latestElement"),b(this,"_areaRect",new DOMRect),b(this,"_areaLocation",{y1:0,x2:0,y2:0,x1:0}),b(this,"_singleClick",!0),b(this,"_frame"),b(this,"_scrollAvailable",!0),b(this,"_scrollingActive",!1),b(this,"_scrollSpeed",{x:0,y:0}),b(this,"_scrollDelta",{x:0,y:0}),b(this,"disable",this._bindStartEvents.bind(this,!1)),b(this,"enable",this._bindStartEvents),this._options={selectionAreaClass:"selection-area",selectionContainerClass:void 0,selectables:[],document:window.document,startAreas:["html"],boundaries:["html"],container:"body",...t,behaviour:{overlap:"invert",intersect:"touch",...t.behaviour,startThreshold:(i=t.behaviour)!=null&&i.startThreshold?typeof t.behaviour.startThreshold=="number"?t.behaviour.startThreshold:{x:10,y:10,...t.behaviour.startThreshold}:{x:10,y:10},scrolling:{speedDivider:10,manualSpeed:750,...(n=t.behaviour)==null?void 0:n.scrolling,startScrollMargins:{x:0,y:0,...(o=(s=t.behaviour)==null?void 0:s.scrolling)==null?void 0:o.startScrollMargins}}},features:{range:!0,touch:!0,...t.features,singleTap:{allow:!0,intersect:"native",...(l=t.features)==null?void 0:l.singleTap}}};for(const d of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))typeof this[d]=="function"&&(this[d]=this[d].bind(this));const{document:r,selectionAreaClass:h,selectionContainerClass:f}=this._options;this._area=r.createElement("div"),this._clippingElement=r.createElement("div"),this._clippingElement.appendChild(this._area),this._area.classList.add(h),f&&this._clippingElement.classList.add(f),N(this._area,{willChange:"top, left, bottom, right, width, height",top:0,left:0,position:"fixed"}),N(this._clippingElement,{overflow:"hidden",position:"fixed",transform:"translate3d(0, 0, 0)",pointerEvents:"none",zIndex:"1"}),this._frame=te(d=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",d),this._redrawSelectionArea()}),this.enable()}_bindStartEvents(t=!0){const{document:i,features:n}=this._options,s=t?O:T;s(i,"mousedown",this._onTapStart),n.touch&&s(i,"touchstart",this._onTapStart,{passive:!1})}_onTapStart(t,i=!1){const{x:n,y:s,target:o}=Y(t),{_options:l}=this,{document:r}=this._options,h=o.getBoundingClientRect(),f=q(l.startAreas,l.document),d=q(l.boundaries,l.document);this._targetElement=d.find(u=>gt(u.getBoundingClientRect(),h));const a=t.composedPath();if(!this._targetElement||!f.find(u=>a.includes(u))||!d.find(u=>a.includes(u))||!i&&this._emitEvent("beforestart",t)===!1)return;this._areaLocation={x1:n,y1:s,x2:0,y2:0};const c=r.scrollingElement??r.body;this._scrollDelta={x:c.scrollLeft,y:c.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),O(r,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),O(r,["mouseup","touchcancel","touchend"],this._onTapStop),O(r,"scroll",this._onScroll)}_onSingleTap(t){const{singleTap:{intersect:i},range:n}=this._options.features,s=Y(t);let o;if(i==="native")o=s.target;else if(i==="touch"){this.resolveSelectables();const{x:r,y:h}=s;o=this._selectables.find(f=>{const{right:d,left:a,top:c,bottom:u}=f.getBoundingClientRect();return r<d&&r>a&&h<u&&h>c})}if(!o)return;for(this.resolveSelectables();!this._selectables.includes(o);){if(!o.parentElement)return;o=o.parentElement}const{stored:l}=this._selection;if(this._emitEvent("start",t),t.shiftKey&&n&&this._latestElement){const r=this._latestElement,[h,f]=r.compareDocumentPosition(o)&4?[o,r]:[r,o],d=[...this._selectables.filter(a=>a.compareDocumentPosition(h)&4&&a.compareDocumentPosition(f)&2),h,f];this.select(d),this._latestElement=r}else l.includes(o)&&(l.length===1||t.ctrlKey||l.every(r=>this._selection.stored.includes(r)))?this.deselect(o):(this.select(o),this._latestElement=o);this._emitEvent("stop",t)}_delayedTapMove(t){const{container:i,document:n,behaviour:{startThreshold:s}}=this._options,{x1:o,y1:l}=this._areaLocation,{x:r,y:h}=Y(t);if(typeof s=="number"&&z(r+h-(o+l))>=s||typeof s=="object"&&z(r-o)>=s.x||z(h-l)>=s.y){if(T(n,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),this._emitEvent("beforedrag",t)===!1){T(n,["mouseup","touchcancel","touchend"],this._onTapStop);return}O(n,["mousemove","touchmove"],this._onTapMove,{passive:!1}),N(this._area,"display","block"),q(i,n)[0].appendChild(this._clippingElement),this.resolveSelectables(),this._singleClick=!1,this._targetRect=this._targetElement.getBoundingClientRect(),this._scrollAvailable=this._targetElement.scrollHeight!==this._targetElement.clientHeight||this._targetElement.scrollWidth!==this._targetElement.clientWidth,this._scrollAvailable&&(O(n,"wheel",this._manualScroll,{passive:!1}),this._selectables=this._selectables.filter(f=>this._targetElement.contains(f))),this._setupSelectionArea(),this._emitEvent("start",t),this._onTapMove(t)}this._handleMoveEvent(t)}_setupSelectionArea(){const{_clippingElement:t,_targetElement:i,_area:n}=this,s=this._targetRect=i.getBoundingClientRect();this._scrollAvailable?(N(t,{top:s.top,left:s.left,width:s.width,height:s.height}),N(n,{marginTop:-s.top,marginLeft:-s.left})):(N(t,{top:0,left:0,width:"100%",height:"100%"}),N(n,{marginTop:0,marginLeft:0}))}_onTapMove(t){const{x:i,y:n}=Y(t),{_scrollSpeed:s,_areaLocation:o,_options:l,_frame:r}=this,{speedDivider:h}=l.behaviour.scrolling,f=this._targetElement;if(o.x2=i,o.y2=n,this._scrollAvailable&&!this._scrollingActive&&(s.y||s.x)){this._scrollingActive=!0;const d=()=>{if(!s.x&&!s.y){this._scrollingActive=!1;return}const{scrollTop:a,scrollLeft:c}=f;s.y&&(f.scrollTop+=yt(s.y/h),o.y1-=f.scrollTop-a),s.x&&(f.scrollLeft+=yt(s.x/h),o.x1-=f.scrollLeft-c),r.next(t),requestAnimationFrame(d)};requestAnimationFrame(d)}else r.next(t);this._handleMoveEvent(t)}_handleMoveEvent(t){const{features:i}=this._options;(i.touch&&Qt()||this._scrollAvailable&&Zt())&&t.preventDefault()}_onScroll(){const{_scrollDelta:t,_options:{document:i}}=this,{scrollTop:n,scrollLeft:s}=i.scrollingElement??i.body;this._areaLocation.x1+=t.x-s,this._areaLocation.y1+=t.y-n,t.x=s,t.y=n,this._setupSelectionArea(),this._frame.next(null)}_manualScroll(t){const{manualSpeed:i}=this._options.behaviour.scrolling,n=t.deltaY?t.deltaY>0?1:-1:0,s=t.deltaX?t.deltaX>0?1:-1:0;this._scrollSpeed.y+=n*i,this._scrollSpeed.x+=s*i,this._onTapMove(t),t.preventDefault()}_recalculateSelectionAreaRect(){const{_scrollSpeed:t,_areaLocation:i,_areaRect:n,_targetElement:s,_options:o}=this,{scrollTop:l,scrollHeight:r,clientHeight:h,scrollLeft:f,scrollWidth:d,clientWidth:a}=s,c=this._targetRect,{x1:u,y1:g}=i;let{x2:m,y2:p}=i;const{behaviour:{scrolling:{startScrollMargins:v}}}=o;m<c.left+v.x?(t.x=f?-z(c.left-m+v.x):0,m=m<c.left?c.left:m):m>c.right-v.x?(t.x=d-f-a?z(c.left+c.width-m-v.x):0,m=m>c.right?c.right:m):t.x=0,p<c.top+v.y?(t.y=l?-z(c.top-p+v.y):0,p=p<c.top?c.top:p):p>c.bottom-v.y?(t.y=r-l-h?z(c.top+c.height-p-v.y):0,p=p>c.bottom?c.bottom:p):t.y=0;const y=bt(u,m),x=bt(g,p),_=vt(u,m),C=vt(g,p);n.x=y,n.y=x,n.width=_-y,n.height=C-x}_redrawSelectionArea(){const{x:t,y:i,width:n,height:s}=this._areaRect,{style:o}=this._area;o.left=`${t}px`,o.top=`${i}px`,o.width=`${n}px`,o.height=`${s}px`}_onTapStop(t,i){var n;const{document:s,features:o}=this._options,{_singleClick:l}=this;T(s,["mousemove","touchmove"],this._delayedTapMove),T(s,["touchmove","mousemove"],this._onTapMove),T(s,["mouseup","touchcancel","touchend"],this._onTapStop),T(s,"scroll",this._onScroll),this._keepSelection(),t&&l&&o.singleTap.allow?this._onSingleTap(t):!l&&!i&&(this._updateElementSelection(),this._emitEvent("stop",t)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,this._scrollAvailable&&T(s,"wheel",this._manualScroll,{passive:!0}),this._clippingElement.remove(),(n=this._frame)==null||n.cancel(),N(this._area,"display","none")}_updateElementSelection(){const{_selectables:t,_options:i,_selection:n,_areaRect:s}=this,{stored:o,selected:l,touched:r}=n,{intersect:h,overlap:f}=i.behaviour,d=f==="invert",a=[],c=[],u=[];for(let m=0;m<t.length;m++){const p=t[m];if(gt(s,p.getBoundingClientRect(),h)){if(l.includes(p))o.includes(p)&&!r.includes(p)&&r.push(p);else if(d&&o.includes(p)){u.push(p);continue}else c.push(p);a.push(p)}}d&&c.push(...o.filter(m=>!l.includes(m)));const g=f==="keep";for(let m=0;m<l.length;m++){const p=l[m];!a.includes(p)&&!(g&&o.includes(p))&&u.push(p)}n.selected=a,n.changed={added:c,removed:u},this._latestElement=void 0}_emitEvent(t,i){return this.emit(t,{event:i,store:this._selection,selection:this})}_keepSelection(){const{_options:t,_selection:i}=this,{selected:n,changed:s,touched:o,stored:l}=i,r=n.filter(h=>!l.includes(h));switch(t.behaviour.overlap){case"drop":{i.stored=[...r,...l.filter(h=>!o.includes(h))];break}case"invert":{i.stored=[...r,...l.filter(h=>!s.removed.includes(h))];break}case"keep":{i.stored=[...l,...n.filter(h=>!l.includes(h))];break}}}trigger(t,i=!0){this._onTapStart(t,i)}resolveSelectables(){this._selectables=q(this._options.selectables,this._options.document)}clearSelection(t=!0,i=!1){const{selected:n,stored:s,changed:o}=this._selection;o.added=[],o.removed.push(...n,...t?s:[]),i||(this._emitEvent("move",null),this._emitEvent("stop",null)),this._selection={stored:t?[]:s,selected:[],touched:[],changed:{added:[],removed:[]}}}getSelection(){return this._selection.stored}getSelectionArea(){return this._area}cancel(t=!1){this._onTapStop(null,!t)}destroy(){this.cancel(),this.disable(),this._clippingElement.remove(),super.unbindAllListeners()}select(t,i=!1){const{changed:n,selected:s,stored:o}=this._selection,l=q(t,this._options.document).filter(r=>!s.includes(r)&&!o.includes(r));return o.push(...l),s.push(...l),n.added.push(...l),n.removed=[],this._latestElement=void 0,i||(this._emitEvent("move",null),this._emitEvent("stop",null)),l}deselect(t,i=!1){const{selected:n,stored:s,changed:o}=this._selection,l=q(t,this._options.document).filter(r=>n.includes(r)||s.includes(r));l.length&&(this._selection.stored=s.filter(r=>!l.includes(r)),this._selection.selected=n.filter(r=>!l.includes(r)),this._selection.changed.added=[],this._selection.changed.removed.push(...l.filter(r=>!o.removed.includes(r))),this._latestElement=void 0,i||(this._emitEvent("move",null),this._emitEvent("stop",null)))}}b(xt,"version","3.3.1");function ee(e){const t=new xt({selectables:["#map me-tpc"],boundaries:["#map .map-container"],container:".map-container",behaviour:{scrolling:{speedDivider:10,manualSpeed:750,startScrollMargins:{x:10,y:10}}}}).on("beforestart",({event:i})=>!(i.button!==0||i.target.tagName==="ME-TPC"||i.target.id==="input-box")).on("start",({event:i})=>{!i.ctrlKey&&!i.metaKey&&(e.unselectNode(),e.unselectNodes(),e.unselectSummary(),t.clearSelection(!0,!0))}).on("move",({store:{changed:{added:i,removed:n}}})=>{$.moved=!0;for(const s of i)s.classList.add("selected");for(const s of n)s.classList.remove("selected")}).on("stop",({store:{stored:i}})=>{console.log(i,"stored"),e.selectNodes(i)});console.log(t,"selection")}const ie=function(e,t=!0){this.theme=e;const i=this.theme.cssVar,n=Object.keys(i);for(let s=0;s<n.length;s++){const o=n[s];this.mindElixirBox.style.setProperty(o,i[o])}t&&this.refresh()};function _t(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,linkData:e.linkData,summaries:e.summaries,direction:e.direction,theme:e.theme}}const ne=Object.freeze(Object.defineProperty({__proto__:null,cancelFocus:function(){this.isFocusMode=!1,this.tempDirection!==null&&(delete this.nodeData.root,this.nodeData=this.nodeDataBackup,this.direction=this.tempDirection,this.tempDirection=null,this.refresh(),this.toCenter())},disableEdit:function(){this.editable=!1},enableEdit:function(){this.editable=!0},expandNode:function(e,t){const i=e.nodeObj;typeof t=="boolean"?i.expanded=t:i.expanded!==!1?i.expanded=!1:i.expanded=!0,this.layout(),this.linkDiv(),this.bus.fire("expandNode",i)},focusNode:function(e){e.nodeObj.root||(this.tempDirection===null&&(this.tempDirection=this.direction),this.isFocusMode||(this.nodeDataBackup=this.nodeData,this.isFocusMode=!0),this.nodeData=e.nodeObj,this.nodeData.root=!0,this.initRight(),this.toCenter())},getData:function(){return JSON.parse(this.getDataString())},getDataMd:function(){const e=_t(this).nodeData;let t="# "+e.topic+`
5
5
 
6
6
  `;function i(n,s){for(let o=0;o<n.length;o++)s<=6?t+="".padStart(s,"#")+" "+n[o].topic+`
7
7
 
8
8
  `:t+="".padStart(s-7," ")+"- "+n[o].topic+`
9
- `,n[o].children&&i(n[o].children||[],s+1)}return i(e.children||[],2),t},getDataString:function(){const e=_t(this);return JSON.stringify(e,(t,i)=>{if(t!=="parent")return t==="from"||t==="to"?i.nodeObj.id:i})},initLeft:function(){this.direction=0,this.refresh()},initRight:function(){this.direction=1,this.refresh()},initSide:function(){this.direction=2,this.refresh()},install:function(e){e(this)},refresh:function(e){e&&(e=JSON.parse(JSON.stringify(e)),this.nodeData=e.nodeData,this.linkData=e.linkData||{}),J(this.nodeData),this.layout(),this.linkDiv()},scale:function(e){this.scaleVal=e,this.map.style.transform="scale("+e+")"},selectFirstChild:function(){if(!this.currentNode)return;const e=this.currentNode.parentElement.nextSibling;if(e&&e.firstChild){const t=e.firstChild.firstChild.firstChild;this.selectNode(t)}},selectNextSibling:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return!1;const e=this.currentNode.parentElement.parentElement.nextSibling;let t;if(e)t=e.firstChild.firstChild;else return!1;return this.selectNode(t),!0},selectNode:function(e,t,i){if(e){if(console.time("selectNode"),typeof e=="string"){const n=M(e);return n?this.selectNode(n):void 0}this.currentNode&&(this.currentNode.className=""),e.className="selected",e.scrollIntoView({block:"nearest",inline:"nearest"}),this.currentNode=e,t?this.bus.fire("selectNewNode",e.nodeObj):this.bus.fire("selectNode",e.nodeObj,i),console.timeEnd("selectNode")}},selectNodes:function(e){if(e){console.time("selectNodes");for(const t of e)t.className="selected";this.currentNodes=e,this.bus.fire("selectNodes",e.map(t=>t.nodeObj)),console.timeEnd("selectNodes")}},selectParent:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return;const e=this.currentNode.parentElement.parentElement.parentElement.previousSibling;if(e){const t=e.firstChild;this.selectNode(t)}},selectPrevSibling:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return!1;const e=this.currentNode.parentElement.parentElement.previousSibling;let t;if(e)t=e.firstChild.firstChild;else return!1;return this.selectNode(t),!0},setLocale:function(e){this.locale=e,this.refresh()},toCenter:function(){this.container.scrollTo(1e4-this.container.offsetWidth/2,1e4-this.container.offsetHeight/2)},unselectNode:function(){this.currentNode&&(this.currentNode.className=""),this.currentNode=null,this.bus.fire("unselectNode")},unselectNodes:function(){if(this.currentNodes)for(const e of this.currentNodes)e.classList.remove("selected");this.currentNodes=null,this.bus.fire("unselectNodes")}},Symbol.toStringTag,{value:"Module"})),Et={create:function(e){return{dom:e,mousedown:!1,lastX:0,lastY:0,handleMouseMove(t){if(t.stopPropagation(),this.mousedown){if(!this.lastX){this.lastX=t.pageX,this.lastY=t.pageY;return}const i=this.lastX-t.pageX,n=this.lastY-t.pageY;this.cb&&this.cb(i,n),this.lastX=t.pageX,this.lastY=t.pageY}},handleMouseDown(t){t.stopPropagation(),this.mousedown=!0},handleClear(t){t.stopPropagation(),this.clear()},cb:null,init(t,i){this.cb=i,this.handleClear=this.handleClear.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),t.addEventListener("mousemove",this.handleMouseMove),t.addEventListener("mouseleave",this.handleClear),t.addEventListener("mouseup",this.handleClear),this.dom.addEventListener("mousedown",this.handleMouseDown)},destory(t){t.removeEventListener("mousemove",this.handleMouseMove),t.removeEventListener("mouseleave",this.handleClear),t.removeEventListener("mouseup",this.handleClear),this.dom.removeEventListener("mousedown",this.handleMouseDown)},clear(){this.mousedown=!1,this.lastX=0,this.lastY=0}}}},se=Object.freeze(Object.defineProperty({__proto__:null,createLink:function(e,t,i,n){const s=this.map.getBoundingClientRect();if(!e||!t)return;const o=e.getBoundingClientRect(),l=t.getBoundingClientRect(),r=(o.x+o.width/2-s.x)/this.scaleVal,h=(o.y+o.height/2-s.y)/this.scaleVal,f=(l.x+l.width/2-s.x)/this.scaleVal,d=(l.y+l.height/2-s.y)/this.scaleVal;let a,c,u,g;i&&n?(a=r+n.delta1.x,c=h+n.delta1.y,u=f+n.delta2.x,g=d+n.delta2.y):(h+d)/2-h<=o.height/2?(a=(o.x+o.width-s.x)/this.scaleVal+100,c=h,u=(l.x+l.width-s.x)/this.scaleVal+100,g=d):(a=(r+f)/2,c=(h+d)/2,u=(r+f)/2,g=(h+d)/2);const m={cx:r,cy:h,w:o.width,h:o.height},p={cx:f,cy:d,w:l.width,h:l.height},v=U(m,a,c),y=v.x,x=v.y,_=Q(p,u,g),C=_.x,A=_.y,D=ot(u,g,C,A),E={id:"",label:"",from:e.nodeObj.id,to:t.nodeObj.id,delta1:{x:a-r,y:c-h},delta2:{x:u-f,y:g-d}},V=qt(`M ${y} ${x} C ${a} ${c} ${u} ${g} ${C} ${A}`,`M ${D.x1} ${D.y1} L ${C} ${A} L ${D.x2} ${D.y2}`);i&&n?(E.id=n.id,this.linkData[n.id]=E):(E.id=Z(),this.linkData[E.id]=E,this.currentLink=V),V.linkObj=E,V.dataset.linkid=E.id,this.linkSvgGroup.appendChild(V),i||this.showLinkController(a,c,u,g,E,m,p)},hideLinkController:function(){this.linkController.style.display="none",this.P2.style.display="none",this.P3.style.display="none"},removeLink:function(e){let t;if(e?t=e:t=this.currentLink,!t)return;console.log(t),this.hideLinkController();const i=t.linkObj.id;console.log(i),delete this.linkData[i],t.remove(),t=null},selectLink:function(e){this.currentLink=e;const t=e.linkObj;if(!t)return;const i=t.from,n=t.to,s=this.map.getBoundingClientRect(),o=M(i).getBoundingClientRect(),l=M(n).getBoundingClientRect(),r=(o.x+o.width/2-s.x)/this.scaleVal,h=(o.y+o.height/2-s.y)/this.scaleVal,f=(l.x+l.width/2-s.x)/this.scaleVal,d=(l.y+l.height/2-s.y)/this.scaleVal,a={cx:r,cy:h,w:o.width,h:o.height},c={cx:f,cy:d,w:l.width,h:l.height},u=r+t.delta1.x,g=h+t.delta1.y,m=f+t.delta2.x,p=d+t.delta2.y;this.showLinkController(u,g,m,p,t,a,c)},showLinkController:function(e,t,i,n,s,o,l){this.linkController.style.display="initial",this.P2.style.display="initial",this.P3.style.display="initial";const r=U(o,e,t);let h=r.x,f=r.y;const d=Q(l,i,n);let a=d.x,c=d.y;this.P2.style.cssText=`top:${t}px;left:${e}px;`,this.P3.style.cssText=`top:${n}px;left:${i}px;`,this.line1.setAttribute("x1",h),this.line1.setAttribute("y1",f),this.line1.setAttribute("x2",e),this.line1.setAttribute("y2",t),this.line2.setAttribute("x1",i),this.line2.setAttribute("y1",n),this.line2.setAttribute("x2",a),this.line2.setAttribute("y2",c),this.helper1&&(this.helper1.destory(this.map),this.helper2.destory(this.map)),this.helper1=Et.create(this.P2),this.helper2=Et.create(this.P3),this.helper1.init(this.map,(u,g)=>{var p;e=e-u/this.scaleVal,t=t-g/this.scaleVal;const m=U(o,e,t);h=m.x,f=m.y,this.P2.style.top=t+"px",this.P2.style.left=e+"px",(p=this.currentLink)==null||p.children[0].setAttribute("d",`M ${h} ${f} C ${e} ${t} ${i} ${n} ${a} ${c}`),this.line1.setAttribute("x1",h),this.line1.setAttribute("y1",f),this.line1.setAttribute("x2",e),this.line1.setAttribute("y2",t),s.delta1.x=e-o.cx,s.delta1.y=t-o.cy}),this.helper2.init(this.map,(u,g)=>{var v,y;i=i-u/this.scaleVal,n=n-g/this.scaleVal;const m=Q(l,i,n);a=m.x,c=m.y;const p=ot(i,n,a,c);this.P3.style.top=n+"px",this.P3.style.left=i+"px",(v=this.currentLink)==null||v.children[0].setAttribute("d",`M ${h} ${f} C ${e} ${t} ${i} ${n} ${a} ${c}`),(y=this.currentLink)==null||y.children[1].setAttribute("d",`M ${p.x1} ${p.y1} L ${a} ${c} L ${p.x2} ${p.y2}`),this.line2.setAttribute("x1",i),this.line2.setAttribute("y1",n),this.line2.setAttribute("x2",a),this.line2.setAttribute("y2",c),s.delta2.x=i-l.cx,s.delta2.y=n-l.cy})}},Symbol.toStringTag,{value:"Module"})),oe=function(e){var h,f;if(e.length===0)throw new Error("No selected node.");if(e.length===1){const d=e[0].nodeObj,a=e[0].nodeObj.parent;if(!a)throw new Error("Can not select root node.");const c=a.children.findIndex(u=>d===u);return{parent:a.id,start:c,end:c}}let t=0;const i=e.map(d=>{let a=d.nodeObj;const c=[];for(;a.parent;){const u=a.parent,g=u.children,m=g==null?void 0:g.indexOf(a);a=u,c.unshift({node:a,index:m})}return c.length>t&&(t=c.length),c});let n=0;t:for(;n<t;n++){const d=(h=i[0][n])==null?void 0:h.node;for(let a=1;a<i.length;a++)if(((f=i[a][n])==null?void 0:f.node)!==d)break t}const s=i.map(d=>d[n-1].index).sort(),o=s[0]||0,l=s[s.length-1]||0,r=i[0][n-1].node;if(r.root)throw new Error("Please select nodes in the same main topic.");return{parent:r.id,start:o,end:l}},le=function(e){const t=document.createElementNS("http://www.w3.org/2000/svg","g");return t.setAttribute("id",e),t},Ct=function(e,t){const i=document.createElementNS("http://www.w3.org/2000/svg","path");return tt(i,{d:e,stroke:t||"#666",fill:"none","stroke-linecap":"round","stroke-width":"2"}),i},wt=function(e,t,i,n,s){const o=document.createElementNS("http://www.w3.org/2000/svg","text");return tt(o,{"text-anchor":n,x:t+"",y:i+"",fill:s||"#666"}),o.innerHTML=e,o},re=e=>M(e).parentElement.parentElement,Lt=function(e,t){var A,D;const{id:i,text:n,parent:s,start:o,end:l}=t,r=e.nodes,h=M(s),f=(A=h.closest("me-main"))==null?void 0:A.className,d=h.nodeObj;let a=1/0,c=0,u=0,g=0;for(let E=o;E<=l;E++){const V=(D=d.children)==null?void 0:D[E];if(!V)return console.warn("Child not found"),e.removeSummary(i),null;const I=re(V.id),{offsetLeft:G,offsetTop:St}=lt(r,I);E===o&&(u=St),E===l&&(g=St+I.offsetHeight),G<a&&(a=G),I.offsetWidth+G>c&&(c=I.offsetWidth+G)}let m,p;const v=u+10,y=g+10,x=(v+y)/2,_=e.theme.cssVar["--color"];f==="lhs"?(m=Ct(`M ${a+10} ${v} c -5 0 -10 5 -10 10 L ${a} ${y-10} c 0 5 5 10 10 10 M ${a} ${x} h -10`,_),p=wt(n,a-20,x+6,"end",_)):(m=Ct(`M ${c-10} ${v} c 5 0 10 5 10 10 L ${c} ${y-10} c 0 5 -5 10 -10 10 M ${c} ${x} h 10`,_),p=wt(n,c+20,x+6,"start",_));const C=le("s-"+i);return C.appendChild(m),C.appendChild(p),C.summaryObj=t,e.summarySvg.appendChild(C),C},ce=function(){let e=[];this.currentNode?e=[this.currentNode]:this.currentNodes&&(e=this.currentNodes);const{parent:t,start:i,end:n}=oe(e),s={id:Z(),parent:t,start:i,end:n,text:"summary"},o=Lt(this,s);this.summaries.push(s),this.editSummary(o)},ae=function(e){var i;const t=this.summaries.findIndex(n=>n.id===e);t>-1&&(this.summaries.splice(t,1),(i=document.querySelector("#s-"+e))==null||i.remove())},he=function(e){const t=e.children[1].getBBox(),i=6,n=3,s=document.createElementNS("http://www.w3.org/2000/svg","rect");tt(s,{x:t.x-i+"",y:t.y-i+"",width:t.width+i*2+"",height:t.height+i*2+"",rx:n+"",stroke:this.theme.cssVar["--selected"]||"#4dc4ff","stroke-width":"2",fill:"none"}),s.classList.add("selected"),e.appendChild(s),this.currentSummary=e},de=function(){var e,t;(t=(e=this.currentSummary)==null?void 0:e.querySelector("rect"))==null||t.remove(),this.currentSummary=null},ue=function(){this.summarySvg.innerHTML="",this.summaries.forEach(e=>{Lt(this,e)}),this.nodes.insertAdjacentElement("beforeend",this.summarySvg)},fe=function(e){var t;return(t=M(e).closest("me-main"))==null?void 0:t.className},pe={getObjById:st,generateNewObj:Mt,layout:Nt,linkDiv:jt,editTopic:Dt,createWrapper:Ht,createParent:Pt,createChildren:Bt,createTopic:zt,findEle:M,changeTheme:ie,...ne,...{},...se,...Object.freeze(Object.defineProperty({__proto__:null,createSummary:ce,editSummary:function(e){if(console.time("editSummary"),!e)return;const t=e.childNodes[1],i=document.createElement("div");this.nodes.appendChild(i);const n=t.innerHTML;i.id="input-box",i.textContent=n,i.contentEditable="true",i.spellcheck=!1;const s=t.getAttribute("x")+"px",o=t.getAttribute("y")+"px";i.style.cssText=`min-width:${100-8}px;position:absolute;left:${s};top:${o};`,fe(e.summaryObj.parent)==="lhs"?i.style.cssText+="transform: translate(-100%, -100%);":i.style.cssText+="transform: translate(0, -100%);",i.focus(),at(i),i.addEventListener("keydown",l=>{l.stopPropagation();const r=l.key;if(r==="Enter"||r==="Tab"){if(l.shiftKey)return;l.preventDefault(),i.blur(),this.map.focus()}}),i.addEventListener("blur",()=>{var h;if(!i)return;const l=e.summaryObj,r=((h=i.textContent)==null?void 0:h.trim())||"";r===""?l.text=n:l.text=r,i.remove(),r!==n&&(t.innerHTML=l.text,this.linkDiv(),this.bus.fire("operation",{name:"finishEditSummary",obj:l,origin:n}))}),console.timeEnd("editSummary")},removeSummary:ae,renderSummary:ue,selectSummary:he,unselectSummary:de},Symbol.toStringTag,{value:"Module"})),init(e){if(!e||!e.nodeData)return new Error("MindElixir: `data` is required");e.direction!==void 0&&(this.direction=e.direction),this.changeTheme(e.theme||this.theme,!1),this.nodeData=e.nodeData,J(this.nodeData),this.linkData=e.linkData||{},this.summaries=e.summaries||[],this.toolBar&&Gt(this),ee(this),this.toCenter(),this.layout(),this.linkDiv()}},X=document;function k({el:e,direction:t,locale:i,draggable:n,editable:s,contextMenu:o,contextMenuOption:l,toolBar:r,keypress:h,before:f,newTopicName:d,allowUndo:a,mainLinkStyle:c,subLinkStyle:u,overflowHidden:g,mobileMenu:m,theme:p}){console.log("ME_version "+k.version,this);let v=null;const y=Object.prototype.toString.call(e);if(y==="[object HTMLDivElement]"?v=e:y==="[object String]"&&(v=document.querySelector(e)),!v)throw new Error("MindElixir: el is not a valid element");v.className+=" mind-elixir",v.innerHTML="",v.style.setProperty("--gap",L+"px"),this.mindElixirBox=v,this.before=f||{},this.locale=i||"en",this.contextMenuOption=l,this.contextMenu=o===void 0?!0:o,this.toolBar=r===void 0?!0:r,this.keypress=h===void 0?!0:h,this.mobileMenu=m||!1,this.direction=typeof t=="number"?t:1,this.draggable=n===void 0?!0:n,this.newTopicName=d||"new node",this.editable=s===void 0?!0:s,this.allowUndo=a===void 0?!1:a,this.currentNode=null,this.currentLink=null,this.scaleVal=1,this.tempDirection=null,this.mainLinkStyle=c||0,this.subLinkStyle=u||0,this.overflowHidden=g||!1,this.bus=$t.create(),this.container=X.createElement("div"),this.container.className="map-container";const x=window.matchMedia("(prefers-color-scheme: dark)");this.theme=p||(x.matches?it:et);const _=X.createElement("div");_.className="map-canvas",this.map=_,this.map.setAttribute("tabindex","0"),this.container.appendChild(this.map),this.mindElixirBox.appendChild(this.container),this.nodes=X.createElement("me-nodes"),this.nodes.className="main-node-container",this.lines=j("lines"),this.summarySvg=j("summary"),this.linkController=j("linkcontroller"),this.P2=X.createElement("div"),this.P3=X.createElement("div"),this.P2.className=this.P3.className="circle",this.P2.style.display=this.P3.style.display="none",this.line1=ht(0,0,0,0),this.line2=ht(0,0,0,0),this.linkController.appendChild(this.line1),this.linkController.appendChild(this.line2),this.linkSvgGroup=j("topiclinks"),this.map.appendChild(this.nodes),this.map.appendChild(this.linkController),this.map.appendChild(this.linkSvgGroup),this.map.appendChild(this.P2),this.map.appendChild(this.P3),this.overflowHidden?this.container.style.overflow="hidden":kt(this)}return k.prototype=pe,k.LEFT=R,k.RIGHT=K,k.SIDE=F,k.THEME=et,k.DARK_THEME=it,k.version="3.1.0",k.E=M,k}();
9
+ `,n[o].children&&i(n[o].children||[],s+1)}return i(e.children||[],2),t},getDataString:function(){const e=_t(this);return JSON.stringify(e,(t,i)=>{if(!(t==="parent"&&typeof i!="string"))return t==="from"||t==="to"?i.nodeObj.id:i})},initLeft:function(){this.direction=0,this.refresh()},initRight:function(){this.direction=1,this.refresh()},initSide:function(){this.direction=2,this.refresh()},install:function(e){e(this)},refresh:function(e){e&&(e=JSON.parse(JSON.stringify(e)),this.nodeData=e.nodeData,this.linkData=e.linkData||{}),J(this.nodeData),this.layout(),this.linkDiv()},scale:function(e){this.scaleVal=e,this.map.style.transform="scale("+e+")"},selectFirstChild:function(){if(!this.currentNode)return;const e=this.currentNode.parentElement.nextSibling;if(e&&e.firstChild){const t=e.firstChild.firstChild.firstChild;this.selectNode(t)}},selectNextSibling:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return!1;const e=this.currentNode.parentElement.parentElement.nextSibling;let t;if(e)t=e.firstChild.firstChild;else return!1;return this.selectNode(t),!0},selectNode:function(e,t,i){if(e){if(console.time("selectNode"),typeof e=="string"){const n=M(e);return n?this.selectNode(n):void 0}this.currentNode&&(this.currentNode.className=""),e.className="selected",e.scrollIntoView({block:"nearest",inline:"nearest"}),this.currentNode=e,t?this.bus.fire("selectNewNode",e.nodeObj):this.bus.fire("selectNode",e.nodeObj,i),console.timeEnd("selectNode")}},selectNodes:function(e){if(e){console.time("selectNodes");for(const t of e)t.className="selected";this.currentNodes=e,this.bus.fire("selectNodes",e.map(t=>t.nodeObj)),console.timeEnd("selectNodes")}},selectParent:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return;const e=this.currentNode.parentElement.parentElement.parentElement.previousSibling;if(e){const t=e.firstChild;this.selectNode(t)}},selectPrevSibling:function(){if(!this.currentNode||this.currentNode.dataset.nodeid==="meroot")return!1;const e=this.currentNode.parentElement.parentElement.previousSibling;let t;if(e)t=e.firstChild.firstChild;else return!1;return this.selectNode(t),!0},setLocale:function(e){this.locale=e,this.refresh()},toCenter:function(){this.container.scrollTo(1e4-this.container.offsetWidth/2,1e4-this.container.offsetHeight/2)},unselectNode:function(){this.currentNode&&(this.currentNode.className=""),this.currentNode=null,this.bus.fire("unselectNode")},unselectNodes:function(){if(this.currentNodes)for(const e of this.currentNodes)e.classList.remove("selected");this.currentNodes=null,this.bus.fire("unselectNodes")}},Symbol.toStringTag,{value:"Module"})),Et={create:function(e){return{dom:e,mousedown:!1,lastX:0,lastY:0,handleMouseMove(t){if(t.stopPropagation(),this.mousedown){if(!this.lastX){this.lastX=t.pageX,this.lastY=t.pageY;return}const i=this.lastX-t.pageX,n=this.lastY-t.pageY;this.cb&&this.cb(i,n),this.lastX=t.pageX,this.lastY=t.pageY}},handleMouseDown(t){t.stopPropagation(),this.mousedown=!0},handleClear(t){t.stopPropagation(),this.clear()},cb:null,init(t,i){this.cb=i,this.handleClear=this.handleClear.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),t.addEventListener("mousemove",this.handleMouseMove),t.addEventListener("mouseleave",this.handleClear),t.addEventListener("mouseup",this.handleClear),this.dom.addEventListener("mousedown",this.handleMouseDown)},destory(t){t.removeEventListener("mousemove",this.handleMouseMove),t.removeEventListener("mouseleave",this.handleClear),t.removeEventListener("mouseup",this.handleClear),this.dom.removeEventListener("mousedown",this.handleMouseDown)},clear(){this.mousedown=!1,this.lastX=0,this.lastY=0}}}},se=Object.freeze(Object.defineProperty({__proto__:null,createLink:function(e,t,i,n){const s=this.map.getBoundingClientRect();if(!e||!t)return;const o=e.getBoundingClientRect(),l=t.getBoundingClientRect(),r=(o.x+o.width/2-s.x)/this.scaleVal,h=(o.y+o.height/2-s.y)/this.scaleVal,f=(l.x+l.width/2-s.x)/this.scaleVal,d=(l.y+l.height/2-s.y)/this.scaleVal;let a,c,u,g;i&&n?(a=r+n.delta1.x,c=h+n.delta1.y,u=f+n.delta2.x,g=d+n.delta2.y):(h+d)/2-h<=o.height/2?(a=(o.x+o.width-s.x)/this.scaleVal+100,c=h,u=(l.x+l.width-s.x)/this.scaleVal+100,g=d):(a=(r+f)/2,c=(h+d)/2,u=(r+f)/2,g=(h+d)/2);const m={cx:r,cy:h,w:o.width,h:o.height},p={cx:f,cy:d,w:l.width,h:l.height},v=U(m,a,c),y=v.x,x=v.y,_=Q(p,u,g),C=_.x,A=_.y,D=ot(u,g,C,A),E={id:"",label:"",from:e.nodeObj.id,to:t.nodeObj.id,delta1:{x:a-r,y:c-h},delta2:{x:u-f,y:g-d}},V=qt(`M ${y} ${x} C ${a} ${c} ${u} ${g} ${C} ${A}`,`M ${D.x1} ${D.y1} L ${C} ${A} L ${D.x2} ${D.y2}`);i&&n?(E.id=n.id,this.linkData[n.id]=E):(E.id=Z(),this.linkData[E.id]=E,this.currentLink=V),V.linkObj=E,V.dataset.linkid=E.id,this.linkSvgGroup.appendChild(V),i||this.showLinkController(a,c,u,g,E,m,p)},hideLinkController:function(){this.linkController.style.display="none",this.P2.style.display="none",this.P3.style.display="none"},removeLink:function(e){let t;if(e?t=e:t=this.currentLink,!t)return;console.log(t),this.hideLinkController();const i=t.linkObj.id;console.log(i),delete this.linkData[i],t.remove(),t=null},selectLink:function(e){this.currentLink=e;const t=e.linkObj;if(!t)return;const i=t.from,n=t.to,s=this.map.getBoundingClientRect(),o=M(i).getBoundingClientRect(),l=M(n).getBoundingClientRect(),r=(o.x+o.width/2-s.x)/this.scaleVal,h=(o.y+o.height/2-s.y)/this.scaleVal,f=(l.x+l.width/2-s.x)/this.scaleVal,d=(l.y+l.height/2-s.y)/this.scaleVal,a={cx:r,cy:h,w:o.width,h:o.height},c={cx:f,cy:d,w:l.width,h:l.height},u=r+t.delta1.x,g=h+t.delta1.y,m=f+t.delta2.x,p=d+t.delta2.y;this.showLinkController(u,g,m,p,t,a,c)},showLinkController:function(e,t,i,n,s,o,l){this.linkController.style.display="initial",this.P2.style.display="initial",this.P3.style.display="initial";const r=U(o,e,t);let h=r.x,f=r.y;const d=Q(l,i,n);let a=d.x,c=d.y;this.P2.style.cssText=`top:${t}px;left:${e}px;`,this.P3.style.cssText=`top:${n}px;left:${i}px;`,this.line1.setAttribute("x1",h),this.line1.setAttribute("y1",f),this.line1.setAttribute("x2",e),this.line1.setAttribute("y2",t),this.line2.setAttribute("x1",i),this.line2.setAttribute("y1",n),this.line2.setAttribute("x2",a),this.line2.setAttribute("y2",c),this.helper1&&(this.helper1.destory(this.map),this.helper2.destory(this.map)),this.helper1=Et.create(this.P2),this.helper2=Et.create(this.P3),this.helper1.init(this.map,(u,g)=>{var p;e=e-u/this.scaleVal,t=t-g/this.scaleVal;const m=U(o,e,t);h=m.x,f=m.y,this.P2.style.top=t+"px",this.P2.style.left=e+"px",(p=this.currentLink)==null||p.children[0].setAttribute("d",`M ${h} ${f} C ${e} ${t} ${i} ${n} ${a} ${c}`),this.line1.setAttribute("x1",h),this.line1.setAttribute("y1",f),this.line1.setAttribute("x2",e),this.line1.setAttribute("y2",t),s.delta1.x=e-o.cx,s.delta1.y=t-o.cy}),this.helper2.init(this.map,(u,g)=>{var v,y;i=i-u/this.scaleVal,n=n-g/this.scaleVal;const m=Q(l,i,n);a=m.x,c=m.y;const p=ot(i,n,a,c);this.P3.style.top=n+"px",this.P3.style.left=i+"px",(v=this.currentLink)==null||v.children[0].setAttribute("d",`M ${h} ${f} C ${e} ${t} ${i} ${n} ${a} ${c}`),(y=this.currentLink)==null||y.children[1].setAttribute("d",`M ${p.x1} ${p.y1} L ${a} ${c} L ${p.x2} ${p.y2}`),this.line2.setAttribute("x1",i),this.line2.setAttribute("y1",n),this.line2.setAttribute("x2",a),this.line2.setAttribute("y2",c),s.delta2.x=i-l.cx,s.delta2.y=n-l.cy})}},Symbol.toStringTag,{value:"Module"})),oe=function(e){var h,f;if(e.length===0)throw new Error("No selected node.");if(e.length===1){const d=e[0].nodeObj,a=e[0].nodeObj.parent;if(!a)throw new Error("Can not select root node.");const c=a.children.findIndex(u=>d===u);return{parent:a.id,start:c,end:c}}let t=0;const i=e.map(d=>{let a=d.nodeObj;const c=[];for(;a.parent;){const u=a.parent,g=u.children,m=g==null?void 0:g.indexOf(a);a=u,c.unshift({node:a,index:m})}return c.length>t&&(t=c.length),c});let n=0;t:for(;n<t;n++){const d=(h=i[0][n])==null?void 0:h.node;for(let a=1;a<i.length;a++)if(((f=i[a][n])==null?void 0:f.node)!==d)break t}const s=i.map(d=>d[n-1].index).sort(),o=s[0]||0,l=s[s.length-1]||0,r=i[0][n-1].node;if(r.root)throw new Error("Please select nodes in the same main topic.");return{parent:r.id,start:o,end:l}},le=function(e){const t=document.createElementNS("http://www.w3.org/2000/svg","g");return t.setAttribute("id",e),t},Ct=function(e,t){const i=document.createElementNS("http://www.w3.org/2000/svg","path");return tt(i,{d:e,stroke:t||"#666",fill:"none","stroke-linecap":"round","stroke-width":"2"}),i},wt=function(e,t,i,n,s){const o=document.createElementNS("http://www.w3.org/2000/svg","text");return tt(o,{"text-anchor":n,x:t+"",y:i+"",fill:s||"#666"}),o.innerHTML=e,o},re=e=>M(e).parentElement.parentElement,Lt=function(e,t){var A,D;const{id:i,text:n,parent:s,start:o,end:l}=t,r=e.nodes,h=M(s),f=(A=h.closest("me-main"))==null?void 0:A.className,d=h.nodeObj;let a=1/0,c=0,u=0,g=0;for(let E=o;E<=l;E++){const V=(D=d.children)==null?void 0:D[E];if(!V)return console.warn("Child not found"),e.removeSummary(i),null;const I=re(V.id),{offsetLeft:G,offsetTop:St}=lt(r,I);E===o&&(u=St),E===l&&(g=St+I.offsetHeight),G<a&&(a=G),I.offsetWidth+G>c&&(c=I.offsetWidth+G)}let m,p;const v=u+10,y=g+10,x=(v+y)/2,_=e.theme.cssVar["--color"];f==="lhs"?(m=Ct(`M ${a+10} ${v} c -5 0 -10 5 -10 10 L ${a} ${y-10} c 0 5 5 10 10 10 M ${a} ${x} h -10`,_),p=wt(n,a-20,x+6,"end",_)):(m=Ct(`M ${c-10} ${v} c 5 0 10 5 10 10 L ${c} ${y-10} c 0 5 -5 10 -10 10 M ${c} ${x} h 10`,_),p=wt(n,c+20,x+6,"start",_));const C=le("s-"+i);return C.appendChild(m),C.appendChild(p),C.summaryObj=t,e.summarySvg.appendChild(C),C},ce=function(){let e=[];this.currentNode?e=[this.currentNode]:this.currentNodes&&(e=this.currentNodes);const{parent:t,start:i,end:n}=oe(e),s={id:Z(),parent:t,start:i,end:n,text:"summary"},o=Lt(this,s);this.summaries.push(s),this.editSummary(o)},ae=function(e){var i;const t=this.summaries.findIndex(n=>n.id===e);t>-1&&(this.summaries.splice(t,1),(i=document.querySelector("#s-"+e))==null||i.remove())},he=function(e){const t=e.children[1].getBBox(),i=6,n=3,s=document.createElementNS("http://www.w3.org/2000/svg","rect");tt(s,{x:t.x-i+"",y:t.y-i+"",width:t.width+i*2+"",height:t.height+i*2+"",rx:n+"",stroke:this.theme.cssVar["--selected"]||"#4dc4ff","stroke-width":"2",fill:"none"}),s.classList.add("selected"),e.appendChild(s),this.currentSummary=e},de=function(){var e,t;(t=(e=this.currentSummary)==null?void 0:e.querySelector("rect"))==null||t.remove(),this.currentSummary=null},ue=function(){this.summarySvg.innerHTML="",this.summaries.forEach(e=>{Lt(this,e)}),this.nodes.insertAdjacentElement("beforeend",this.summarySvg)},fe=function(e){var t;return(t=M(e).closest("me-main"))==null?void 0:t.className},pe={getObjById:st,generateNewObj:Mt,layout:Nt,linkDiv:jt,editTopic:Dt,createWrapper:Ht,createParent:Pt,createChildren:Bt,createTopic:zt,findEle:M,changeTheme:ie,...ne,...{},...se,...Object.freeze(Object.defineProperty({__proto__:null,createSummary:ce,editSummary:function(e){if(console.time("editSummary"),!e)return;const t=e.childNodes[1],i=document.createElement("div");this.nodes.appendChild(i);const n=t.innerHTML;i.id="input-box",i.textContent=n,i.contentEditable="true",i.spellcheck=!1;const s=t.getAttribute("x")+"px",o=t.getAttribute("y")+"px";i.style.cssText=`min-width:${100-8}px;position:absolute;left:${s};top:${o};`,fe(e.summaryObj.parent)==="lhs"?i.style.cssText+="transform: translate(-100%, -100%);":i.style.cssText+="transform: translate(0, -100%);",i.focus(),at(i),i.addEventListener("keydown",l=>{l.stopPropagation();const r=l.key;if(r==="Enter"||r==="Tab"){if(l.shiftKey)return;l.preventDefault(),i.blur(),this.map.focus()}}),i.addEventListener("blur",()=>{var h;if(!i)return;const l=e.summaryObj,r=((h=i.textContent)==null?void 0:h.trim())||"";r===""?l.text=n:l.text=r,i.remove(),r!==n&&(t.innerHTML=l.text,this.linkDiv(),this.bus.fire("operation",{name:"finishEditSummary",obj:l,origin:n}))}),console.timeEnd("editSummary")},removeSummary:ae,renderSummary:ue,selectSummary:he,unselectSummary:de},Symbol.toStringTag,{value:"Module"})),init(e){if(!e||!e.nodeData)return new Error("MindElixir: `data` is required");e.direction!==void 0&&(this.direction=e.direction),this.changeTheme(e.theme||this.theme,!1),this.nodeData=e.nodeData,J(this.nodeData),this.linkData=e.linkData||{},this.summaries=e.summaries||[],this.toolBar&&Gt(this),ee(this),this.toCenter(),this.layout(),this.linkDiv()}},X=document;function k({el:e,direction:t,locale:i,draggable:n,editable:s,contextMenu:o,contextMenuOption:l,toolBar:r,keypress:h,before:f,newTopicName:d,allowUndo:a,mainLinkStyle:c,subLinkStyle:u,overflowHidden:g,mobileMenu:m,theme:p}){console.log("ME_version "+k.version,this);let v=null;const y=Object.prototype.toString.call(e);if(y==="[object HTMLDivElement]"?v=e:y==="[object String]"&&(v=document.querySelector(e)),!v)throw new Error("MindElixir: el is not a valid element");v.className+=" mind-elixir",v.innerHTML="",v.style.setProperty("--gap",L+"px"),this.mindElixirBox=v,this.before=f||{},this.locale=i||"en",this.contextMenuOption=l,this.contextMenu=o===void 0?!0:o,this.toolBar=r===void 0?!0:r,this.keypress=h===void 0?!0:h,this.mobileMenu=m||!1,this.direction=typeof t=="number"?t:1,this.draggable=n===void 0?!0:n,this.newTopicName=d||"new node",this.editable=s===void 0?!0:s,this.allowUndo=a===void 0?!1:a,this.currentNode=null,this.currentLink=null,this.scaleVal=1,this.tempDirection=null,this.mainLinkStyle=c||0,this.subLinkStyle=u||0,this.overflowHidden=g||!1,this.bus=$t.create(),this.container=X.createElement("div"),this.container.className="map-container";const x=window.matchMedia("(prefers-color-scheme: dark)");this.theme=p||(x.matches?it:et);const _=X.createElement("div");_.className="map-canvas",this.map=_,this.map.setAttribute("tabindex","0"),this.container.appendChild(this.map),this.mindElixirBox.appendChild(this.container),this.nodes=X.createElement("me-nodes"),this.nodes.className="main-node-container",this.lines=j("lines"),this.summarySvg=j("summary"),this.linkController=j("linkcontroller"),this.P2=X.createElement("div"),this.P3=X.createElement("div"),this.P2.className=this.P3.className="circle",this.P2.style.display=this.P3.style.display="none",this.line1=ht(0,0,0,0),this.line2=ht(0,0,0,0),this.linkController.appendChild(this.line1),this.linkController.appendChild(this.line2),this.linkSvgGroup=j("topiclinks"),this.map.appendChild(this.nodes),this.map.appendChild(this.linkController),this.map.appendChild(this.linkSvgGroup),this.map.appendChild(this.P2),this.map.appendChild(this.P3),this.overflowHidden?this.container.style.overflow="hidden":kt(this)}return k.prototype=pe,k.LEFT=R,k.RIGHT=K,k.SIDE=F,k.THEME=et,k.DARK_THEME=it,k.version="3.1.2",k.E=M,k}();