mind-elixir 5.14.0-beta.1 → 5.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,9 +8,9 @@ var MindElixir=(function($){"use strict";const Z={name:"Latte",type:"light",pale
8
8
  margin:${l.margin};
9
9
  background-color:${l.backgroundColor!=="rgba(0, 0, 0, 0)"&&l.backgroundColor};
10
10
  border: ${l.border};
11
- border-radius:${l.borderRadius}; `,this.direction===0&&(t.style.right="0"),e.style.opacity="0",$e(t),this.bus.fire("operation",{name:"beginEdit",obj:e.nodeObj}),t.addEventListener("keydown",c=>{if(c.stopPropagation(),c.isComposing)return;const r=c.key;if(r==="Enter"||r==="Tab"){if(c.shiftKey)return;c.preventDefault(),t.blur(),this.container.focus()}else r==="Escape"&&(c.preventDefault(),t.textContent=o,t.blur(),this.container.focus())}),t.addEventListener("blur",()=>{if(!t)return;e.style.opacity="1",t.remove();const c=t.innerText?.trim()||"";c===o||c===""||(n.topic=c,this.markdown?e.text.innerHTML=this.markdown(n.topic,n):e.text.textContent=c,this.linkDiv(),this.bus.fire("operation",{name:"finishEdit",obj:n,origin:o}))})},ye=function(e){const t=document.createElement("me-epd");return t.expanded=e!==!1,t.className=e!==!1?"minus":"",t},X=e=>{const t=e.parent?.children,n=t?.indexOf(e)??0;return{siblings:t,index:n}};function Ht(e){const{siblings:t,index:n}=X(e);if(t===void 0)return;const o=t[n];n===0?(t[n]=t[t.length-1],t[t.length-1]=o):(t[n]=t[n-1],t[n-1]=o)}function $t(e){const{siblings:t,index:n}=X(e);if(t===void 0)return;const o=t[n];n===t.length-1?(t[n]=t[0],t[0]=o):(t[n]=t[n+1],t[n+1]=o)}function Ie(e){const{siblings:t,index:n}=X(e);return t===void 0?0:(t.splice(n,1),t.length)}function It(e,t,n){const{siblings:o,index:s}=X(n);o!==void 0&&(t==="before"?o.splice(s,0,e):o.splice(s+1,0,e))}function jt(e,t){const{siblings:n,index:o}=X(e);n!==void 0&&(n[o]=t,t.children=[e])}function Rt(e,t,n){if(Ie(t),n.parent?.parent||(t.direction=n.direction),e==="in")n.children?n.children.push(t):n.children=[t];else{t.direction!==void 0&&(t.direction=n.direction);const{siblings:o,index:s}=X(n);if(o===void 0)return;e==="before"?o.splice(s,0,t):o.splice(s+1,0,t)}}const Bt=function({map:e,direction:t},n){if(t===0)return 0;if(t===1)return 1;if(t===2){const o=e.querySelector(".lhs")?.childElementCount||0,s=e.querySelector(".rhs")?.childElementCount||0;return o<=s?(n.direction=0,0):(n.direction=1,1)}},je=function(e,t,n){const o=n.children[0].children[0],s=t.parentElement;if(s.tagName==="ME-PARENT"){if(q(o),s.children[1])s.nextSibling.appendChild(n);else{const i=e.createChildren([n]);s.appendChild(ye(!0)),s.insertAdjacentElement("afterend",i)}e.linkDiv(n.offsetParent)}else s.tagName==="ME-ROOT"&&(Bt(e,o.nodeObj)===0?e.container.querySelector(".lhs")?.appendChild(n):e.container.querySelector(".rhs")?.appendChild(n),e.linkDiv())},Wt=function(e,t){const n=e.parentNode;if(t===0){const o=n.parentNode.parentNode;o.tagName!=="ME-MAIN"&&(o.previousSibling.children[1].remove(),o.remove())}n.parentNode.remove()},Re={before:"beforebegin",after:"afterend"},q=function(e){const n=e.parentElement.parentElement.lastElementChild;n?.tagName==="svg"&&n?.remove()},Yt=function(e,t){const n=e.nodeObj,o=ne(n);o.style&&t.style&&(t.style=Object.assign(o.style,t.style));const s=Object.assign(n,t);me.call(this,e,s),this.linkDiv(),this.bus.fire("operation",{name:"reshapeNode",obj:s,origin:o})},be=function(e,t,n){if(!t)return null;const o=t.nodeObj;o.expanded===!1&&(e.expandNode(t,!0),t=e.findEle(o.id));const s=n||e.generateNewObj();o.children?o.children.push(s):o.children=[s],R(e.nodeData);const{grp:i,top:l}=e.createWrapper(s);return je(e,t,i),{newTop:l,newNodeObj:s}},Ft=function(e,t,n){const o=t||this.currentNode;if(!o)return;const s=o.nodeObj;if(s.parent){if(!s.parent?.parent&&this.direction===2){const a=this.map.querySelector(".lhs")?.childElementCount||0,d=this.map.querySelector(".rhs")?.childElementCount||0;if(!a||!d){this.addChild(this.findEle(s.parent.id),n);return}}}else{this.addChild();return}const i=n||this.generateNewObj();if(!s.parent?.parent){const a=o.closest("me-main").className===O.LHS?0:1;i.direction=a}It(i,e,s),R(this.nodeData);const l=o.parentElement,{grp:c,top:r}=this.createWrapper(i);l.parentElement.insertAdjacentElement(Re[e],c),this.linkDiv(c.offsetParent),n||this.editTopic(r.firstChild),this.bus.fire("operation",{name:"insertSibling",type:e,obj:i}),this.selectNode(r.firstChild,!0)},Xt=function(e,t){const n=e||this.currentNode;if(!n)return;q(n);const o=n.nodeObj;if(!o.parent)return;const s=t||this.generateNewObj();jt(o,s),R(this.nodeData);const i=n.parentElement.parentElement,{grp:l,top:c}=this.createWrapper(s,!0);c.appendChild(ye(!0)),i.insertAdjacentElement("afterend",l);const r=this.createChildren([i]);c.insertAdjacentElement("afterend",r),this.linkDiv(),t||this.editTopic(c.firstChild),this.selectNode(c.firstChild,!0),this.bus.fire("operation",{name:"insertParent",obj:s})},Kt=function(e,t){const n=e||this.currentNode;if(!n)return;const o=be(this,n,t);if(!o)return;const{newTop:s,newNodeObj:i}=o;this.bus.fire("operation",{name:"addChild",obj:i}),t||this.editTopic(s.firstChild),this.selectNode(s.firstChild,!0)},zt=function(e,t){const n=ne(e.nodeObj);ue(n);const o=be(this,t,n);if(!o)return;const{newNodeObj:s}=o;this.selectNode(this.findEle(s.id)),this.bus.fire("operation",{name:"copyNode",obj:s})},Vt=function(e,t){const n=[];for(let o=0;o<e.length;o++){const s=e[o],i=ne(s.nodeObj);ue(i);const l=be(this,t,i);if(!l)return;const{newNodeObj:c}=l;n.push(c)}this.unselectNodes(this.currentNodes),this.selectNodes(n.map(o=>this.findEle(o.id))),this.bus.fire("operation",{name:"copyNodes",objs:n})},Gt=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;Ht(n);const o=t.parentNode.parentNode;o.parentNode.insertBefore(o,o.previousSibling),this.linkDiv(),this.bus.fire("operation",{name:"moveUpNode",obj:n})},qt=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;$t(n);const o=t.parentNode.parentNode;o.nextSibling?o.nextSibling.insertAdjacentElement("afterend",o):o.parentNode.prepend(o),this.linkDiv(),this.bus.fire("operation",{name:"moveDownNode",obj:n})},Ut=function(e){if(e=pe(e),e.length===0)return;for(const n of e){const o=n.nodeObj,s=Ie(o);Wt(n,s)}const t=e[e.length-1];this.selectNode(this.findEle(t.nodeObj.parent.id)),this.linkDiv(),this.bus.fire("operation",{name:"removeNodes",objs:e.map(n=>n.nodeObj)})},ve=(e,t,n,o)=>{e=pe(e);let s=n.nodeObj;t==="in"&&s.expanded===!1&&(o.expandNode(n,!0),n=o.findEle(s.id),s=n.nodeObj),t==="after"&&(e=e.reverse());const i=[];for(const c of e){const r=c.nodeObj;if(Rt(t,r,s),R(o.nodeData),t==="in"){const a=c.parentElement;je(o,n,a.parentElement)}else{q(c);const a=c.parentElement.parentNode;i.includes(a.parentElement)||i.push(a.parentElement),n.parentElement.parentNode.insertAdjacentElement(Re[t],a)}}for(const c of i)c.childElementCount===0&&c.tagName!=="ME-MAIN"&&(c.previousSibling.children[1].remove(),c.remove());o.linkDiv(),o.scrollIntoView(e[e.length-1]);const l=t==="before"?"moveNodeBefore":t==="after"?"moveNodeAfter":"moveNodeIn";o.bus.fire("operation",{name:l,objs:e.map(c=>c.nodeObj),toObj:s})},Be=Object.freeze(Object.defineProperty({__proto__:null,addChild:Kt,beginEdit:function(e){const t=e||this.currentNode;t&&(t.nodeObj.dangerouslySetInnerHTML||this.editTopic(t))},copyNode:zt,copyNodes:Vt,insertParent:Xt,insertSibling:Ft,moveDownNode:qt,moveNodeAfter:function(e,t){ve(e,"after",t,this)},moveNodeBefore:function(e,t){ve(e,"before",t,this)},moveNodeIn:function(e,t){ve(e,"in",t,this)},moveUpNode:Gt,removeNodes:Ut,reshapeNode:Yt,rmSubline:q,setNodeTopic:function(e,t){e.text.textContent=t,e.nodeObj.topic=t,this.linkDiv()}},Symbol.toStringTag,{value:"Module"}));function Jt(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,arrows:e.arrows,summaries:e.summaries,direction:e.direction,theme:e.theme,compact:e.compact,meta:e.meta}}const Zt=function(e,t=!1){const n=this.container,o=e.getBoundingClientRect(),s=n.getBoundingClientRect();if(t||o.top>s.bottom-50||o.bottom<s.top+50||o.left>s.right-50||o.right<s.left+50){const l=o.left+o.width/2,c=o.top+o.height/2,r=s.left+s.width/2,a=s.top+s.height/2,d=l-r,h=c-a;this.move(-d,-h,!0)}},Qt=function(e,t,n){this.clearSelection(),this.scrollIntoView(e),this.selection?.select(e),t&&this.bus.fire("selectNewNode",e.nodeObj)},en=function(e){this.selection?.select(e)},tn=function(e){this.selection?.deselect(e)},nn=function(){this.unselectNodes(this.currentNodes),this.unselectSummary(),this.unselectArrow()},xe=function(e){return JSON.stringify(e,(t,n)=>{if(!(t==="parent"&&typeof n!="string"))return n})},on=function(){const e=Jt(this);return xe(e)},sn=function(){return JSON.parse(this.getDataString())},rn=function(){this.editable=!0},ln=function(){this.editable=!1},cn=function(e,t={x:0,y:0}){if(e<this.scaleMin&&e<this.scaleVal||e>this.scaleMax&&e>this.scaleVal)return;const n=this.container.getBoundingClientRect(),o=t.x?t.x-n.left-n.width/2:0,s=t.y?t.y-n.top-n.height/2:0,{dx:i,dy:l}=we(this),c=this.map.style.transform,{x:r,y:a}=ge(c),d=r-i,h=a-l,u=this.scaleVal,p=(-o+d)*(1-e/u),v=(-s+h)*(1-e/u);this.map.style.transform=`translate3d(${r-p}px, ${a-v}px, 0) scale(${e})`,this.scaleVal=e,this.bus.fire("scale",e)},an=function(){const e=this.nodes.offsetHeight/this.container.offsetHeight,t=this.nodes.offsetWidth/this.container.offsetWidth,n=1/Math.max(1,Math.max(e,t));this.scaleVal=n;const{dx:o,dy:s}=we(this,!0);this.map.style.transform=`translate3d(${o}px, ${s}px, 0) scale(${n})`,this.bus.fire("scale",n)},dn=function(e,t,n=!1){const{map:o,scaleVal:s,bus:i,container:l,nodes:c}=this;if(n&&o.style.transition==="transform 0.3s")return;const r=o.style.transform;let{x:a,y:d}=ge(r);const h=l.getBoundingClientRect(),u=c.getBoundingClientRect(),p=u.left<h.right&&u.right>h.left,v=u.top<h.bottom&&u.bottom>h.top;if(p){const m=u.left+e,y=u.right+e;(m>=h.right||y<=h.left)&&(e=0)}if(v){const m=u.top+t,y=u.bottom+t;(m>=h.bottom||y<=h.top)&&(t=0)}a+=e,d+=t,n&&(o.style.transition="transform 0.3s",setTimeout(()=>{o.style.transition="none"},300)),o.style.transform=`translate3d(${a}px, ${d}px, 0) scale(${s})`,i.fire("move",{dx:e,dy:t})},we=(e,t=!1)=>{const{container:n,map:o,nodes:s}=e;let i,l;if(e.alignment==="nodes"||t)i=(n.offsetWidth-s.offsetWidth)/2,l=(n.offsetHeight-s.offsetHeight)/2,o.style.transformOrigin="50% 50%";else{const c=o.querySelector("me-root"),r=c.offsetTop,a=c.offsetLeft,d=c.offsetWidth,h=c.offsetHeight;i=n.offsetWidth/2-a-d/2,l=n.offsetHeight/2-r-h/2,o.style.transformOrigin=`${a+d/2}px 50%`}return{dx:i,dy:l}},hn=Object.freeze(Object.defineProperty({__proto__:null,cancelFocus:function(){this.isFocusMode=!1,this.tempDirection!==null&&(this.nodeData=this.nodeDataBackup,this.direction=this.tempDirection,this.tempDirection=null,this.refresh(),this.toCenter())},clearSelection:nn,disableEdit:ln,enableEdit:rn,expandNode:function(e,t){const n=e.nodeObj;typeof t=="boolean"?n.expanded=t:n.expanded!==!1?n.expanded=!1:n.expanded=!0;const o=e.getBoundingClientRect(),s={x:o.left,y:o.top},i=e.parentNode,l=i.children[1];if(l.expanded=n.expanded,l.className=n.expanded?"minus":"",q(e),n.expanded){const h=this.createChildren(n.children.map(u=>this.createWrapper(u).grp));i.parentNode.appendChild(h)}else i.parentNode.children[1].remove();this.linkDiv(e.closest("me-main > me-wrapper"));const c=e.getBoundingClientRect(),r={x:c.left,y:c.top},a=s.x-r.x,d=s.y-r.y;this.move(a,d),this.bus.fire("expandNode",n)},expandNodeAll:function(e,t){const n=e.nodeObj,o=e.getBoundingClientRect(),s={x:o.left,y:o.top};F(n,t??!n.expanded),this.refresh();const i=this.findEle(n.id).getBoundingClientRect(),l={x:i.left,y:i.top},c=s.x-l.x,r=s.y-l.y;this.move(c,r)},focusNode:function(e){e.nodeObj.parent&&(this.clearSelection(),this.tempDirection===null&&(this.tempDirection=this.direction),this.isFocusMode||(this.nodeDataBackup=this.nodeData,this.isFocusMode=!0),this.nodeData=e.nodeObj,this.initRight(),this.toCenter())},getData:sn,getDataString:on,initLeft:function(){this.direction=0,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},initRight:function(){this.direction=1,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},initSide:function(){this.direction=2,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},install:function(e){e(this)},move:dn,refresh:function(e){this.clearSelection(),e&&(e=JSON.parse(JSON.stringify(e)),this.nodeData=e.nodeData,this.arrows=e.arrows||[],this.summaries=e.summaries||[],e.meta&&(this.meta=e.meta),e.theme&&this.changeTheme(e.theme)),R(this.nodeData),this.layout(),this.linkDiv()},scale:cn,scaleFit:an,scrollIntoView:Zt,selectNode:Qt,selectNodes:en,stringifyData:xe,toCenter:function(){const{map:e,container:t}=this,{dx:n,dy:o}=we(this);t.scrollTop=0,t.scrollLeft=0,e.style.transform=`translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`},unselectNodes:tn},Symbol.toStringTag,{value:"Module"})),We="MIND-ELIXIR-WAIT-COPY",fn=40,un=10,pn=({deltaMode:e,deltaY:t,viewportHeight:n})=>e===WheelEvent.DOM_DELTA_LINE?t*fn:e===WheelEvent.DOM_DELTA_PAGE?t*n:t,gn=({deltaMode:e,deltaY:t,scaleSensitivity:n,viewportHeight:o})=>{const i=-pn({deltaMode:e,deltaY:t,viewportHeight:o})/un*n;return Math.max(-n,Math.min(n,i))},Ye=(e,t,n)=>{t!==0&&e.scale(e.scaleVal+t,n)},mn=(e,t)=>{const n=e.map.querySelectorAll(`.${t}>me-wrapper>me-parent>me-tpc`);n.length!==0&&e.selectNode(n[Math.ceil(n.length/2)-1])},yn=e=>{e.selectNode(e.map.querySelector("me-root>me-tpc"))},bn=function(e,t){const n=t.parentElement.parentElement.parentElement.previousSibling;if(n){const o=n.firstChild;e.selectNode(o)}},vn=function(e,t){const n=t.parentElement.nextSibling;if(n&&n.firstChild){const o=n.firstChild.firstChild.firstChild;e.selectNode(o)}},Fe=function(e,t){const n=e.currentNode||e.currentNodes?.[0];if(!n)return;const o=n.nodeObj,s=n.offsetParent.offsetParent.parentElement;o.parent?s.className===t?vn(e,n):o.parent?.parent?bn(e,n):yn(e):mn(e,t)},Xe=function(e,t){const n=e.currentNode;if(!n||!n.nodeObj.parent)return;const s=t+"Sibling",i=n.parentElement.parentElement[s];i?e.selectNode(i.firstChild.firstChild):e.selectNode(n)},Ke=function(e,t,n){const o=t==="in"?e.scaleSensitivity:-e.scaleSensitivity;Ye(e,o,n)},xn=(e,t)=>{const n=gn({deltaMode:t.deltaMode,deltaY:t.deltaY,scaleSensitivity:e.scaleSensitivity,viewportHeight:e.container.clientHeight||window.innerHeight});Ye(e,n,{x:t.clientX,y:t.clientY})};function wn(e,t){t=t===!0?{}:t;const n=()=>{e.currentArrow?e.removeArrow():e.currentSummary?e.removeSummary(e.currentSummary.summaryObj.id):e.currentNodes&&e.removeNodes(e.currentNodes)};let o=!1,s=null;const i=r=>{const a=e.nodeData;if(r.key==="0")for(const d of a.children)F(d,!1);if(r.key==="=")for(const d of a.children)F(d,!0);if(["1","2","3","4","5","6","7","8","9"].includes(r.key))for(const d of a.children)F(d,!0,Number(r.key)-1);e.refresh(),e.toCenter(),o=!1,s&&(clearTimeout(s),s=null,e.container.removeEventListener("keydown",i))},l={Enter:r=>{r.shiftKey?e.insertSibling("before"):r.ctrlKey||r.metaKey?e.insertParent():e.insertSibling("after")},Tab:()=>{e.addChild()},F1:()=>{e.toCenter()},F2:()=>{e.currentSummary?e.editSummary(e.currentSummary):e.currentArrow?e.editArrowLabel(e.currentArrow):e.beginEdit()},ArrowUp:r=>{if(r.altKey)e.moveUpNode();else{if(r.metaKey||r.ctrlKey)return e.initSide();Xe(e,"previous")}},ArrowDown:r=>{r.altKey?e.moveDownNode():Xe(e,"next")},ArrowLeft:r=>{if(r.metaKey||r.ctrlKey)return e.initLeft();Fe(e,O.LHS)},ArrowRight:r=>{if(r.metaKey||r.ctrlKey)return e.initRight();Fe(e,O.RHS)},PageUp:()=>e.moveUpNode(),PageDown:()=>{e.moveDownNode()},"=":r=>{(r.metaKey||r.ctrlKey)&&Ke(e,"in")},"-":r=>{(r.metaKey||r.ctrlKey)&&Ke(e,"out")},0:r=>{if(r.metaKey||r.ctrlKey){if(o)return;e.scale(1)}},k:r=>{(r.metaKey||r.ctrlKey)&&(o=!0,s&&(clearTimeout(s),e.container.removeEventListener("keydown",i)),s=window.setTimeout(()=>{o=!1,s=null},2e3),e.container.addEventListener("keydown",i))},Delete:n,Backspace:n,...t};e.container.onkeydown=r=>{if((r.ctrlKey||r.metaKey)&&["c","v","x"].includes(r.key)||r.preventDefault(),!e.editable)return;const d=l[r.key];d&&d(r)};const c=r=>{if(r.target instanceof HTMLElement&&r.target.id==="input-box"||e.currentNodes.length===0)return!1;if(r.clipboardData){const a=pe(e.currentNodes).map(h=>h.nodeObj),d=xe({magic:We,data:a});return r.clipboardData.setData("text/plain",d),r.preventDefault(),!0}return!1};e.container.addEventListener("copy",c),e.container.addEventListener("cut",r=>{c(r)&&n()}),e.container.addEventListener("paste",r=>{const a=r.clipboardData?.getData("text/plain");if(a)try{const d=JSON.parse(a);if(d&&d.magic===We&&Array.isArray(d.data)){const h=d.data,u=h.map(p=>({nodeObj:p}));h.length>0&&e.currentNode&&(e.copyNodes(u,e.currentNode),r.preventDefault());return}}catch{}e.pasteHandler&&e.pasteHandler(r)})}function En(e){const{panHelper:t,container:n}=e;let o=null;e.spacePressed=!1;const s={lastTap:0,lastTapTarget:null,DOUBLE_CLICK_THRESHOLD:300,detect(f,b){if(f.button!==0){this.clear();return}const w=new Date().getTime(),S=w-this.lastTap,C=S<this.DOUBLE_CLICK_THRESHOLD&&S>0&&this.lastTapTarget===f.target;this.lastTap=w,this.lastTapTarget=f.target,C&&b(f)},clear(){this.lastTap=0,this.lastTapTarget=null}},i={Idle:0,Pinch:1,DragWait:2,Drag:3,Pan:4,BoxSelect:5};e.ptState=i.Idle;const l={lastDistance:null,activePointers:new Map,handlePointerDown(f){if(f.pointerType!=="touch")return!1;if(this.activePointers.set(f.pointerId,{x:f.clientX,y:f.clientY}),this.activePointers.size>=2){const[b,w]=Array.from(this.activePointers.values());return this.lastDistance=De(b,w),!0}return!1},handlePointerMove(f){if(f.pointerType!=="touch"||!this.activePointers.has(f.pointerId))return!1;if(this.activePointers.set(f.pointerId,{x:f.clientX,y:f.clientY}),this.activePointers.size>=2){const[b,w]=Array.from(this.activePointers.values()),S=De(b,w);if(this.lastDistance!==null&&this.lastDistance>0){const C=S/this.lastDistance;e.scale(e.scaleVal*C,{x:(b.x+w.x)/2,y:(b.y+w.y)/2})}return this.lastDistance=S,!0}return!1},handlePointerUp(f){f.pointerType==="touch"&&(this.activePointers.delete(f.pointerId),this.activePointers.size<2&&(this.lastDistance=null))},clear(){this.activePointers.clear(),this.lastDistance=null}},c=Et(e),r={timer:null,startPos:null,pointerId:null,DURATION:500,MOVE_THRESHOLD:10,clear(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null,this.startPos=null,this.pointerId=null)},start(f,b){this.timer=window.setTimeout(()=>{b(f),this.timer=null,this.startPos=null,this.pointerId=null},this.DURATION),this.startPos={x:f.clientX,y:f.clientY},this.pointerId=f.pointerId},handleMove(f){if(this.timer!==null&&this.startPos!==null&&f.pointerId===this.pointerId){const b=f.clientX-this.startPos.x,w=f.clientY-this.startPos.y;Math.sqrt(b*b+w*w)>this.MOVE_THRESHOLD&&this.clear()}}},a=(f,b)=>{if(f.closest("#input-box"))return!1;const w=f.closest(".svg-label"),S=f.closest(".topiclinks, .summary"),C=w?{type:w.dataset.type,element:document.getElementById(w.dataset.svgId)}:S?{type:S.classList.contains("topiclinks")?"arrow":"summary",element:f.closest("g")}:null;if(!C?.type||!C?.element)return!1;const{type:T,element:D}=C;return e.clearSelection(),T==="arrow"?b?e.editArrowLabel(D):e.selectArrow(D):b?e.editSummary(D):e.selectSummary(D),!0},d=f=>{if(f.pointerType==="mouse"&&f.button!==0)return;if(e.helper1?.moved){e.helper1.clear();return}if(e.helper2?.moved){e.helper2.clear();return}if(t.moved){t.clear();return}if(c?.isDragging)return;const b=f.target;b.tagName==="ME-EPD"&&(f.ctrlKey||f.metaKey?e.expandNodeAll(b.previousSibling):e.expandNode(b.previousSibling))},h=f=>{if(!e.editable)return;const b=f.target;if(oe(b)){e.selectNode(b),e.beginEdit(b);return}a(b,!0)},u=f=>{if(f.pointerType==="touch"&&l.handlePointerDown(f)){e.ptState=i.Pinch,r.clear(),t.clear(),(c.isDragging||c.pointerId!==null)&&Oe(e,c);return}if(e.ptState===i.Pinch)return;const b=f.target;if(e.editable&&b.className==="map-container"&&f.button===0&&f.pointerType==="mouse"){e.ptState=i.BoxSelect;return}if(t.handlePointerDown(f),t.mousedown&&(e.ptState=i.Pan),f.button===0||f.pointerType==="touch")if(oe(b)){e.selection?.cancel();const S=e.currentNodes||[];if(f.ctrlKey||f.metaKey||e.mobileMultiSelect?S.includes(b)?o=b:((e.currentArrow||e.currentSummary)&&e.clearSelection(),e.selection?.select(b)):S.includes(b)||e.selectNode(b),!e.editable)return;f.pointerType==="touch"?(e.ptState=i.DragWait,r.start(f,T=>{Ae(e,c,T,!0)&&(e.ptState=i.Drag,b.setPointerCapture(T.pointerId))})):Ae(e,c,f,!1)&&(e.ptState=i.Drag,b.setPointerCapture(f.pointerId))}else a(b,!1)},p=f=>{switch(e.ptState){case i.Pinch:l.handlePointerMove(f);break;case i.DragWait:r.handleMove(f),r.timer===null&&(e.ptState=i.Idle);break;case i.Drag:St(e,c,f);break;case i.Pan:t.handlePointerMove(f);break}},v=f=>{f.pointerType==="touch"&&l.handlePointerUp(f);const b=c.isDragging,w=t.moved;switch(e.ptState){case i.DragWait:r.clear();break;case i.Drag:Nt(e,c,f);break;case i.Pan:t.handlePointerUp(f);break}s.detect(f,h),(e.ptState!==i.Pinch||l.activePointers.size<2)&&(e.ptState=i.Idle),o&&(!b&&!w&&e.selection?.deselect(o),o=null)},m=()=>{l.clear(),r.clear(),t.clear(),s.clear(),(c.isDragging||c.pointerId!==null)&&Oe(e,c),e.ptState=i.Idle,o=null},y=f=>{f.preventDefault(),f.button===2&&e.editable&&setTimeout(()=>{if(e.panHelper.moved||e.ptState!==i.Idle&&e.ptState!==i.Pan)return;const b=f.target;oe(b)&&!b.classList.contains("selected")&&e.selectNode(b),e.bus.fire("showContextMenu",f)},200)},g=f=>{if(f.stopPropagation(),f.preventDefault(),f.ctrlKey||f.metaKey)return xn(e,f);if(f.shiftKey)return e.move(-f.deltaY,0);e.move(-f.deltaX,-f.deltaY)},x=f=>{f.code==="Space"&&(e.spacePressed=!0,e.container.classList.add("space-pressed"))},E=f=>{f.code==="Space"&&(e.spacePressed=!1,e.container.classList.remove("space-pressed"))};return ke([{dom:n,evt:"pointerdown",func:u},{dom:n,evt:"pointermove",func:p},{dom:n,evt:"pointerup",func:v},{dom:n,evt:"pointercancel",func:m},{dom:n,evt:"click",func:d},{dom:n,evt:"contextmenu",func:y},{dom:n,evt:"wheel",func:typeof e.handleWheel=="function"?e.handleWheel:g},{dom:n,evt:"blur",func:m},{dom:n,evt:"keydown",func:x},{dom:n,evt:"keyup",func:E}])}function Cn(){return{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 n=this.handlers[e];for(let o=0;o<n.length;o++)n[o](...t)}},removeListener:function(e,t){if(!this.handlers[e])return;const n=this.handlers[e];if(!t)n.length=0;else if(n.length)for(let o=0;o<n.length;o++)n[o]===t&&this.handlers[e].splice(o,1)}}}const P="http://www.w3.org/2000/svg",ie=function(e){const t=e.clientWidth,n=e.clientHeight,o=e.dataset,s=Number(o.x),i=Number(o.y),l=o.anchor;let c=s;l==="middle"?c=s-t/2:l==="end"&&(c=s-t),e.style.left=`${c}px`,e.style.top=`${i-n/2}px`,e.style.visibility="visible"},Ee=function(e,t,n,o){const{anchor:s="middle",color:i,dataType:l,svgId:c}=o,r=document.createElement("div");r.className="svg-label",r.style.color=i||"#666";const a="label-"+c;return r.id=a,r.innerHTML=e,r.dataset.type=l,r.dataset.svgId=c,r.dataset.x=t.toString(),r.dataset.y=n.toString(),r.dataset.anchor=s,r},ze=function(e,t,n){const o=document.createElementNS(P,"path");return _(o,{d:e,stroke:t||"#666",fill:"none","stroke-width":n}),o},U=function(e){const t=document.createElementNS(P,"svg");return t.setAttribute("class",e),t.setAttribute("overflow","visible"),t},Ve=function(){const e=document.createElementNS(P,"line");return e.setAttribute("stroke","#4dc4ff"),e.setAttribute("fill","none"),e.setAttribute("stroke-width","2"),e.setAttribute("opacity","0.45"),e},Sn=function(e,t,n,o){const s=document.createElementNS(P,"g");return[{name:"line",d:e},{name:"arrow1",d:t},{name:"arrow2",d:n}].forEach((l,c)=>{const r=l.d,a=document.createElementNS(P,"path"),d={d:r,stroke:o?.stroke||"rgb(227, 125, 116)",fill:"none","stroke-linecap":o?.strokeLinecap||"cap","stroke-width":String(o?.strokeWidth||"2")};o?.opacity!==void 0&&(d.opacity=String(o.opacity)),_(a,d),c===0&&a.setAttribute("stroke-dasharray",o?.strokeDasharray||"8,2");const h=document.createElementNS(P,"path");_(h,{d:r,stroke:"transparent",fill:"none","stroke-width":"15"}),s.appendChild(h),s.appendChild(a),s[l.name]=a}),s},Ge=function(e,t,n){if(!t)return;const o=n.label;t.style.opacity="0";const s=t.cloneNode(!0);e.nodes.appendChild(s),s.id="input-box",s.textContent=o,s.contentEditable="plaintext-only",s.spellcheck=!1,s.style.cssText=`
11
+ border-radius:${l.borderRadius}; `,this.direction===0&&(t.style.right="0"),e.style.opacity="0",$e(t),this.bus.fire("operation",{name:"beginEdit",obj:e.nodeObj}),t.addEventListener("keydown",c=>{if(c.stopPropagation(),c.isComposing)return;const r=c.key;if(r==="Enter"||r==="Tab"){if(c.shiftKey)return;c.preventDefault(),t.blur(),this.container.focus()}else r==="Escape"&&(c.preventDefault(),t.textContent=o,t.blur(),this.container.focus())}),t.addEventListener("blur",()=>{if(!t)return;e.style.opacity="1",t.remove();const c=t.innerText?.trim()||"";c===o||c===""||(n.topic=c,this.markdown?e.text.innerHTML=this.markdown(n.topic,n):e.text.textContent=c,this.linkDiv(),this.bus.fire("operation",{name:"finishEdit",obj:n,origin:o}))})},ye=function(e){const t=document.createElement("me-epd");return t.expanded=e!==!1,t.className=e!==!1?"minus":"",t},X=e=>{const t=e.parent?.children,n=t?.indexOf(e)??0;return{siblings:t,index:n}};function Ht(e){const{siblings:t,index:n}=X(e);if(t===void 0)return;const o=t[n];n===0?(t[n]=t[t.length-1],t[t.length-1]=o):(t[n]=t[n-1],t[n-1]=o)}function $t(e){const{siblings:t,index:n}=X(e);if(t===void 0)return;const o=t[n];n===t.length-1?(t[n]=t[0],t[0]=o):(t[n]=t[n+1],t[n+1]=o)}function Ie(e){const{siblings:t,index:n}=X(e);return t===void 0?0:(t.splice(n,1),t.length)}function It(e,t,n){const{siblings:o,index:s}=X(n);o!==void 0&&(t==="before"?o.splice(s,0,e):o.splice(s+1,0,e))}function jt(e,t){const{siblings:n,index:o}=X(e);n!==void 0&&(n[o]=t,t.children=[e])}function Rt(e,t,n){if(Ie(t),n.parent?.parent||(t.direction=n.direction),e==="in")n.children?n.children.push(t):n.children=[t];else{t.direction!==void 0&&(t.direction=n.direction);const{siblings:o,index:s}=X(n);if(o===void 0)return;e==="before"?o.splice(s,0,t):o.splice(s+1,0,t)}}const Bt=function({map:e,direction:t},n){if(t===0)return 0;if(t===1)return 1;if(t===2){const o=e.querySelector(".lhs")?.childElementCount||0,s=e.querySelector(".rhs")?.childElementCount||0;return o<=s?(n.direction=0,0):(n.direction=1,1)}},je=function(e,t,n){const o=n.children[0].children[0],s=t.parentElement;if(s.tagName==="ME-PARENT"){if(q(o),s.children[1])s.nextSibling.appendChild(n);else{const i=e.createChildren([n]);s.appendChild(ye(!0)),s.insertAdjacentElement("afterend",i)}e.linkDiv(n.offsetParent)}else s.tagName==="ME-ROOT"&&(Bt(e,o.nodeObj)===0?e.container.querySelector(".lhs")?.appendChild(n):e.container.querySelector(".rhs")?.appendChild(n),e.linkDiv())},Wt=function(e,t){const n=e.parentNode;if(t===0){const o=n.parentNode.parentNode;o.tagName!=="ME-MAIN"&&(o.previousSibling.children[1].remove(),o.remove())}n.parentNode.remove()},Re={before:"beforebegin",after:"afterend"},q=function(e){const n=e.parentElement.parentElement.lastElementChild;n?.tagName==="svg"&&n?.remove()},Yt=function(e,t){const n=e.nodeObj,o=ne(n);o.style&&t.style&&(t.style=Object.assign(o.style,t.style));const s=Object.assign(n,t);me.call(this,e,s),this.linkDiv(),this.bus.fire("operation",{name:"reshapeNode",obj:s,origin:o})},be=function(e,t,n){if(!t)return null;const o=t.nodeObj;o.expanded===!1&&(e.expandNode(t,!0),t=e.findEle(o.id));const s=n||e.generateNewObj();o.children?o.children.push(s):o.children=[s],R(e.nodeData);const{grp:i,top:l}=e.createWrapper(s);return je(e,t,i),{newTop:l,newNodeObj:s}},Ft=function(e,t,n){const o=t||this.currentNode;if(!o)return;const s=o.nodeObj;if(s.parent){if(!s.parent?.parent&&this.direction===2){const a=this.map.querySelector(".lhs")?.childElementCount||0,d=this.map.querySelector(".rhs")?.childElementCount||0;if(!a||!d){this.addChild(this.findEle(s.parent.id),n);return}}}else{this.addChild();return}const i=n||this.generateNewObj();if(!s.parent?.parent){const a=o.closest("me-main").className===O.LHS?0:1;i.direction=a}It(i,e,s),R(this.nodeData);const l=o.parentElement,{grp:c,top:r}=this.createWrapper(i);l.parentElement.insertAdjacentElement(Re[e],c),this.linkDiv(c.offsetParent),n||this.editTopic(r.firstChild),this.bus.fire("operation",{name:"insertSibling",type:e,obj:i}),this.selectNode(r.firstChild,!0)},Xt=function(e,t){const n=e||this.currentNode;if(!n)return;q(n);const o=n.nodeObj;if(!o.parent)return;const s=t||this.generateNewObj();jt(o,s),R(this.nodeData);const i=n.parentElement.parentElement,{grp:l,top:c}=this.createWrapper(s,!0);c.appendChild(ye(!0)),i.insertAdjacentElement("afterend",l);const r=this.createChildren([i]);c.insertAdjacentElement("afterend",r),this.linkDiv(),t||this.editTopic(c.firstChild),this.selectNode(c.firstChild,!0),this.bus.fire("operation",{name:"insertParent",obj:s})},Kt=function(e,t){const n=e||this.currentNode;if(!n)return;const o=be(this,n,t);if(!o)return;const{newTop:s,newNodeObj:i}=o;this.bus.fire("operation",{name:"addChild",obj:i}),t||this.editTopic(s.firstChild),this.selectNode(s.firstChild,!0)},zt=function(e,t){const n=ne(e.nodeObj);ue(n);const o=be(this,t,n);if(!o)return;const{newNodeObj:s}=o;this.selectNode(this.findEle(s.id)),this.bus.fire("operation",{name:"copyNode",obj:s})},Vt=function(e,t){const n=[];for(let o=0;o<e.length;o++){const s=e[o],i=ne(s.nodeObj);ue(i);const l=be(this,t,i);if(!l)return;const{newNodeObj:c}=l;n.push(c)}this.unselectNodes(this.currentNodes),this.selectNodes(n.map(o=>this.findEle(o.id))),this.bus.fire("operation",{name:"copyNodes",objs:n})},Gt=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;Ht(n);const o=t.parentNode.parentNode;o.parentNode.insertBefore(o,o.previousSibling),this.linkDiv(),this.bus.fire("operation",{name:"moveUpNode",obj:n})},qt=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;$t(n);const o=t.parentNode.parentNode;o.nextSibling?o.nextSibling.insertAdjacentElement("afterend",o):o.parentNode.prepend(o),this.linkDiv(),this.bus.fire("operation",{name:"moveDownNode",obj:n})},Ut=function(e){if(e=pe(e),e.length===0)return;for(const n of e){const o=n.nodeObj,s=Ie(o);Wt(n,s)}const t=e[e.length-1];this.selectNode(this.findEle(t.nodeObj.parent.id)),this.linkDiv(),this.bus.fire("operation",{name:"removeNodes",objs:e.map(n=>n.nodeObj)})},ve=(e,t,n,o)=>{e=pe(e);let s=n.nodeObj;t==="in"&&s.expanded===!1&&(o.expandNode(n,!0),n=o.findEle(s.id),s=n.nodeObj),t==="after"&&(e=e.reverse());const i=[];for(const c of e){const r=c.nodeObj;if(Rt(t,r,s),R(o.nodeData),t==="in"){const a=c.parentElement;je(o,n,a.parentElement)}else{q(c);const a=c.parentElement.parentNode;i.includes(a.parentElement)||i.push(a.parentElement),n.parentElement.parentNode.insertAdjacentElement(Re[t],a)}}for(const c of i)c.childElementCount===0&&c.tagName!=="ME-MAIN"&&(c.previousSibling.children[1].remove(),c.remove());o.linkDiv(),o.scrollIntoView(e[e.length-1]);const l=t==="before"?"moveNodeBefore":t==="after"?"moveNodeAfter":"moveNodeIn";o.bus.fire("operation",{name:l,objs:e.map(c=>c.nodeObj),toObj:s})},Be=Object.freeze(Object.defineProperty({__proto__:null,addChild:Kt,beginEdit:function(e){const t=e||this.currentNode;t&&(t.nodeObj.dangerouslySetInnerHTML||this.editTopic(t))},copyNode:zt,copyNodes:Vt,insertParent:Xt,insertSibling:Ft,moveDownNode:qt,moveNodeAfter:function(e,t){ve(e,"after",t,this)},moveNodeBefore:function(e,t){ve(e,"before",t,this)},moveNodeIn:function(e,t){ve(e,"in",t,this)},moveUpNode:Gt,removeNodes:Ut,reshapeNode:Yt,rmSubline:q,setNodeTopic:function(e,t){e.text.textContent=t,e.nodeObj.topic=t,this.linkDiv()}},Symbol.toStringTag,{value:"Module"}));function Jt(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,arrows:e.arrows,summaries:e.summaries,direction:e.direction,theme:e.theme,compact:e.compact,meta:e.meta}}const Zt=function(e,t=!1){const n=this.container,o=e.getBoundingClientRect(),s=n.getBoundingClientRect();if(t||o.top>s.bottom-50||o.bottom<s.top+50||o.left>s.right-50||o.right<s.left+50){const l=o.left+o.width/2,c=o.top+o.height/2,r=s.left+s.width/2,a=s.top+s.height/2,d=l-r,h=c-a;this.move(-d,-h,!0)}},Qt=function(e,t,n){this.clearSelection(),this.scrollIntoView(e),this.selection?.select(e),t&&this.bus.fire("selectNewNode",e.nodeObj)},en=function(e){this.selection?.select(e)},tn=function(e){this.selection?.deselect(e)},nn=function(){this.unselectNodes(this.currentNodes),this.unselectSummary(),this.unselectArrow()},xe=function(e){return JSON.stringify(e,(t,n)=>{if(!(t==="parent"&&typeof n!="string"))return n})},on=function(){const e=Jt(this);return xe(e)},sn=function(){return JSON.parse(this.getDataString())},rn=function(){this.editable=!0},ln=function(){this.editable=!1},cn=function(e,t={x:0,y:0}){if(e<this.scaleMin&&e<this.scaleVal||e>this.scaleMax&&e>this.scaleVal)return;const n=this.container.getBoundingClientRect(),o=t.x?t.x-n.left-n.width/2:0,s=t.y?t.y-n.top-n.height/2:0,{dx:i,dy:l}=we(this),c=this.map.style.transform,{x:r,y:a}=ge(c),d=r-i,h=a-l,u=this.scaleVal,p=(-o+d)*(1-e/u),v=(-s+h)*(1-e/u);this.map.style.transform=`translate3d(${r-p}px, ${a-v}px, 0) scale(${e})`,this.scaleVal=e,this.bus.fire("scale",e)},an=function(){const e=this.nodes.offsetHeight/this.container.offsetHeight,t=this.nodes.offsetWidth/this.container.offsetWidth,n=1/Math.max(1,Math.max(e,t));this.scaleVal=n;const{dx:o,dy:s}=we(this,!0);this.map.style.transform=`translate3d(${o}px, ${s}px, 0) scale(${n})`,this.bus.fire("scale",n)},dn=function(e,t,n=!1){const{map:o,scaleVal:s,bus:i,container:l,nodes:c}=this;if(n&&o.style.transition==="transform 0.3s")return;const r=o.style.transform;let{x:a,y:d}=ge(r);const h=l.getBoundingClientRect(),u=c.getBoundingClientRect(),p=u.left<h.right&&u.right>h.left,v=u.top<h.bottom&&u.bottom>h.top;if(p){const m=u.left+e,y=u.right+e;(m>=h.right||y<=h.left)&&(e=0)}if(v){const m=u.top+t,y=u.bottom+t;(m>=h.bottom||y<=h.top)&&(t=0)}a+=e,d+=t,n&&(o.style.transition="transform 0.3s",setTimeout(()=>{o.style.transition="none"},300)),o.style.transform=`translate3d(${a}px, ${d}px, 0) scale(${s})`,i.fire("move",{dx:e,dy:t})},we=(e,t=!1)=>{const{container:n,map:o,nodes:s}=e;let i,l;if(e.alignment==="nodes"||t)i=(n.offsetWidth-s.offsetWidth)/2,l=(n.offsetHeight-s.offsetHeight)/2,o.style.transformOrigin="50% 50%";else{const c=o.querySelector("me-root"),r=c.offsetTop,a=c.offsetLeft,d=c.offsetWidth,h=c.offsetHeight;i=n.offsetWidth/2-a-d/2,l=n.offsetHeight/2-r-h/2,o.style.transformOrigin=`${a+d/2}px 50%`}return{dx:i,dy:l}},hn=Object.freeze(Object.defineProperty({__proto__:null,cancelFocus:function(){this.isFocusMode=!1,this.tempDirection!==null&&(this.nodeData=this.nodeDataBackup,this.direction=this.tempDirection,this.tempDirection=null,this.refresh(),this.toCenter())},clearSelection:nn,disableEdit:ln,enableEdit:rn,expandNode:function(e,t){const n=e.nodeObj;typeof t=="boolean"?n.expanded=t:n.expanded!==!1?n.expanded=!1:n.expanded=!0;const o=e.getBoundingClientRect(),s={x:o.left,y:o.top},i=e.parentNode,l=i.children[1];if(l.expanded=n.expanded,l.className=n.expanded?"minus":"",q(e),n.expanded){const h=this.createChildren(n.children.map(u=>this.createWrapper(u).grp));i.parentNode.appendChild(h)}else i.parentNode.children[1].remove();this.linkDiv(e.closest("me-main > me-wrapper"));const c=e.getBoundingClientRect(),r={x:c.left,y:c.top},a=s.x-r.x,d=s.y-r.y;this.move(a,d),this.bus.fire("expandNode",n)},expandNodeAll:function(e,t){const n=e.nodeObj,o=e.getBoundingClientRect(),s={x:o.left,y:o.top};F(n,t??!n.expanded),this.refresh();const i=this.findEle(n.id).getBoundingClientRect(),l={x:i.left,y:i.top},c=s.x-l.x,r=s.y-l.y;this.move(c,r)},focusNode:function(e){e.nodeObj.parent&&(this.clearSelection(),this.tempDirection===null&&(this.tempDirection=this.direction),this.isFocusMode||(this.nodeDataBackup=this.nodeData,this.isFocusMode=!0),this.nodeData=e.nodeObj,this.initRight(),this.toCenter())},getData:sn,getDataString:on,initLeft:function(){this.direction=0,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},initRight:function(){this.direction=1,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},initSide:function(){this.direction=2,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},install:function(e){e(this)},move:dn,refresh:function(e){this.clearSelection(),e&&(e=JSON.parse(JSON.stringify(e)),this.nodeData=e.nodeData,this.arrows=e.arrows||[],this.summaries=e.summaries||[],e.meta&&(this.meta=e.meta),e.theme&&this.changeTheme(e.theme)),R(this.nodeData),this.layout(),this.linkDiv()},scale:cn,scaleFit:an,scrollIntoView:Zt,selectNode:Qt,selectNodes:en,stringifyData:xe,toCenter:function(){const{map:e,container:t}=this,{dx:n,dy:o}=we(this);t.scrollTop=0,t.scrollLeft=0,e.style.transform=`translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`},unselectNodes:tn},Symbol.toStringTag,{value:"Module"})),We="MIND-ELIXIR-WAIT-COPY",fn=40,un=10,pn=({deltaMode:e,deltaY:t,viewportHeight:n})=>e===WheelEvent.DOM_DELTA_LINE?t*fn:e===WheelEvent.DOM_DELTA_PAGE?t*n:t,gn=({deltaMode:e,deltaY:t,scaleSensitivity:n,viewportHeight:o})=>{const i=-pn({deltaMode:e,deltaY:t,viewportHeight:o})/un*n;return Math.max(-n,Math.min(n,i))},Ye=(e,t,n)=>{t!==0&&e.scale(e.scaleVal+t,n)},mn=(e,t)=>{const n=e.map.querySelectorAll(`.${t}>me-wrapper>me-parent>me-tpc`);n.length!==0&&e.selectNode(n[Math.ceil(n.length/2)-1])},yn=e=>{e.selectNode(e.map.querySelector("me-root>me-tpc"))},bn=function(e,t){const n=t.parentElement.parentElement.parentElement.previousSibling;if(n){const o=n.firstChild;e.selectNode(o)}},vn=function(e,t){const n=t.parentElement.nextSibling;if(n&&n.firstChild){const o=n.firstChild.firstChild.firstChild;e.selectNode(o)}},Fe=function(e,t){const n=e.currentNode||e.currentNodes?.[0];if(!n)return;const o=n.nodeObj,s=n.offsetParent.offsetParent.parentElement;o.parent?s.className===t?vn(e,n):o.parent?.parent?bn(e,n):yn(e):mn(e,t)},Xe=function(e,t){const n=e.currentNode;if(!n||!n.nodeObj.parent)return;const s=t+"Sibling",i=n.parentElement.parentElement[s];i?e.selectNode(i.firstChild.firstChild):e.selectNode(n)},Ke=function(e,t,n){const o=t==="in"?e.scaleSensitivity:-e.scaleSensitivity;Ye(e,o,n)},xn=(e,t)=>{const n=gn({deltaMode:t.deltaMode,deltaY:t.deltaY,scaleSensitivity:e.scaleSensitivity,viewportHeight:e.container.clientHeight||window.innerHeight});Ye(e,n,{x:t.clientX,y:t.clientY})};function wn(e,t){t=t===!0?{}:t;const n=()=>{e.currentArrow?e.removeArrow():e.currentSummary?e.removeSummary(e.currentSummary.summaryObj.id):e.currentNodes&&e.removeNodes(e.currentNodes)};let o=!1,s=null;const i=r=>{const a=e.nodeData;if(r.key==="0")for(const d of a.children)F(d,!1);if(r.key==="=")for(const d of a.children)F(d,!0);if(["1","2","3","4","5","6","7","8","9"].includes(r.key))for(const d of a.children)F(d,!0,Number(r.key)-1);e.refresh(),e.toCenter(),o=!1,s&&(clearTimeout(s),s=null,e.container.removeEventListener("keydown",i))},l={Enter:r=>{r.shiftKey?e.insertSibling("before"):r.ctrlKey||r.metaKey?e.insertParent():e.insertSibling("after")},Tab:()=>{e.addChild()},F1:()=>{e.toCenter()},F2:()=>{e.currentSummary?e.editSummary(e.currentSummary):e.currentArrow?e.editArrowLabel(e.currentArrow):e.beginEdit()},ArrowUp:r=>{if(r.altKey)e.moveUpNode();else{if(r.metaKey||r.ctrlKey)return e.initSide();Xe(e,"previous")}},ArrowDown:r=>{r.altKey?e.moveDownNode():Xe(e,"next")},ArrowLeft:r=>{if(r.metaKey||r.ctrlKey)return e.initLeft();Fe(e,O.LHS)},ArrowRight:r=>{if(r.metaKey||r.ctrlKey)return e.initRight();Fe(e,O.RHS)},PageUp:()=>e.moveUpNode(),PageDown:()=>{e.moveDownNode()},"=":r=>{(r.metaKey||r.ctrlKey)&&Ke(e,"in")},"-":r=>{(r.metaKey||r.ctrlKey)&&Ke(e,"out")},0:r=>{if(r.metaKey||r.ctrlKey){if(o)return;e.scale(1)}},k:r=>{(r.metaKey||r.ctrlKey)&&(o=!0,s&&(clearTimeout(s),e.container.removeEventListener("keydown",i)),s=window.setTimeout(()=>{o=!1,s=null},2e3),e.container.addEventListener("keydown",i))},Delete:n,Backspace:n,...t};e.container.onkeydown=r=>{if((r.ctrlKey||r.metaKey)&&["c","v","x"].includes(r.key)||r.preventDefault(),!e.editable)return;const d=l[r.key];d&&d(r)};const c=r=>{if(r.target instanceof HTMLElement&&r.target.id==="input-box"||e.currentNodes.length===0)return!1;if(r.clipboardData){const a=pe(e.currentNodes).map(h=>h.nodeObj),d=xe({magic:We,data:a});return r.clipboardData.setData("text/plain",d),r.preventDefault(),!0}return!1};e.container.addEventListener("copy",c),e.container.addEventListener("cut",r=>{c(r)&&n()}),e.container.addEventListener("paste",r=>{const a=r.clipboardData?.getData("text/plain");if(a)try{const d=JSON.parse(a);if(d&&d.magic===We&&Array.isArray(d.data)){const h=d.data,u=h.map(p=>({nodeObj:p}));h.length>0&&e.currentNode&&(e.copyNodes(u,e.currentNode),r.preventDefault());return}}catch{}e.pasteHandler&&e.pasteHandler(r)})}function En(e){const{panHelper:t,container:n}=e;let o=null;e.spacePressed=!1;const s={lastTap:0,lastTapTarget:null,DOUBLE_CLICK_THRESHOLD:300,detect(f,b){if(f.button!==0){this.clear();return}const w=new Date().getTime(),S=w-this.lastTap,C=S<this.DOUBLE_CLICK_THRESHOLD&&S>0&&this.lastTapTarget===f.target;this.lastTap=w,this.lastTapTarget=f.target,C&&b(f)},clear(){this.lastTap=0,this.lastTapTarget=null}},i={Idle:0,Pinch:1,DragWait:2,Drag:3,Pan:4,BoxSelect:5};e.ptState=i.Idle;const l={lastDistance:null,activePointers:new Map,handlePointerDown(f){if(f.pointerType!=="touch")return!1;if(this.activePointers.set(f.pointerId,{x:f.clientX,y:f.clientY}),this.activePointers.size>=2){const[b,w]=Array.from(this.activePointers.values());return this.lastDistance=De(b,w),!0}return!1},handlePointerMove(f){if(f.pointerType!=="touch"||!this.activePointers.has(f.pointerId))return!1;if(this.activePointers.set(f.pointerId,{x:f.clientX,y:f.clientY}),this.activePointers.size>=2){const[b,w]=Array.from(this.activePointers.values()),S=De(b,w);if(this.lastDistance!==null&&this.lastDistance>0){const C=S/this.lastDistance;e.scale(e.scaleVal*C,{x:(b.x+w.x)/2,y:(b.y+w.y)/2})}return this.lastDistance=S,!0}return!1},handlePointerUp(f){f.pointerType==="touch"&&(this.activePointers.delete(f.pointerId),this.activePointers.size<2&&(this.lastDistance=null))},clear(){this.activePointers.clear(),this.lastDistance=null}},c=Et(e),r={timer:null,startPos:null,pointerId:null,DURATION:500,MOVE_THRESHOLD:10,clear(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null,this.startPos=null,this.pointerId=null)},start(f,b){this.timer=window.setTimeout(()=>{b(f),this.timer=null,this.startPos=null,this.pointerId=null},this.DURATION),this.startPos={x:f.clientX,y:f.clientY},this.pointerId=f.pointerId},handleMove(f){if(this.timer!==null&&this.startPos!==null&&f.pointerId===this.pointerId){const b=f.clientX-this.startPos.x,w=f.clientY-this.startPos.y;Math.sqrt(b*b+w*w)>this.MOVE_THRESHOLD&&this.clear()}}},a=(f,b)=>{if(f.closest("#input-box"))return!1;const w=f.closest(".svg-label"),S=f.closest(".topiclinks, .summary"),C=w?{type:w.dataset.type,element:document.getElementById(w.dataset.svgId)}:S?{type:S.classList.contains("topiclinks")?"arrow":"summary",element:f.closest("g")}:null;if(!C?.type||!C?.element)return!1;const{type:T,element:D}=C;return e.clearSelection(),T==="arrow"?b?e.editArrowLabel(D):e.selectArrow(D):b?e.editSummary(D):e.selectSummary(D),!0},d=f=>{if(f.pointerType==="mouse"&&f.button!==0)return;if(e.helper1?.moved){e.helper1.clear();return}if(e.helper2?.moved){e.helper2.clear();return}if(t.moved){t.clear();return}if(c?.isDragging)return;const b=f.target;b.tagName==="ME-EPD"&&(f.ctrlKey||f.metaKey?e.expandNodeAll(b.previousSibling):e.expandNode(b.previousSibling))},h=f=>{if(!e.editable)return;const b=f.target;if(oe(b)){e.selectNode(b),e.beginEdit(b);return}a(b,!0)},u=f=>{if(f.pointerType==="touch"&&l.handlePointerDown(f)){e.ptState=i.Pinch,r.clear(),t.clear(),(c.isDragging||c.pointerId!==null)&&Oe(e,c);return}if(e.ptState===i.Pinch)return;const b=f.target;if(e.editable&&b.className==="map-container"&&f.button===0&&f.pointerType==="mouse"){e.ptState=i.BoxSelect;return}if(t.handlePointerDown(f),t.mousedown&&(e.ptState=i.Pan),f.button===0||f.pointerType==="touch")if(oe(b)){e.selection?.cancel();const S=e.currentNodes||[];if(f.ctrlKey||f.metaKey||e.mobileMultiSelect?S.includes(b)?o=b:((e.currentArrow||e.currentSummary)&&e.clearSelection(),e.selection?.select(b)):S.includes(b)||e.selectNode(b),!e.editable)return;f.pointerType==="touch"?(e.ptState=i.DragWait,r.start(f,T=>{Ae(e,c,T,!0)&&(e.ptState=i.Drag,b.setPointerCapture(T.pointerId))})):Ae(e,c,f,!1)&&(e.ptState=i.Drag,b.setPointerCapture(f.pointerId))}else a(b,!1)},p=f=>{switch(e.ptState){case i.Pinch:l.handlePointerMove(f);break;case i.DragWait:r.handleMove(f),r.timer===null&&(e.ptState=i.Pan,t.handlePointerMove(f));break;case i.Drag:St(e,c,f);break;case i.Pan:t.handlePointerMove(f);break}},v=f=>{f.pointerType==="touch"&&l.handlePointerUp(f);const b=c.isDragging,w=t.moved;switch(e.ptState){case i.DragWait:r.clear();break;case i.Drag:Nt(e,c,f);break;case i.Pan:t.handlePointerUp(f);break}s.detect(f,h),(e.ptState!==i.Pinch||l.activePointers.size<2)&&(e.ptState=i.Idle),o&&(!b&&!w&&e.selection?.deselect(o),o=null)},m=()=>{l.clear(),r.clear(),t.clear(),s.clear(),(c.isDragging||c.pointerId!==null)&&Oe(e,c),e.ptState=i.Idle,o=null},y=f=>{f.preventDefault(),f.button===2&&e.editable&&setTimeout(()=>{if(e.panHelper.moved||e.ptState!==i.Idle&&e.ptState!==i.Pan)return;const b=f.target;oe(b)&&!b.classList.contains("selected")&&e.selectNode(b),e.bus.fire("showContextMenu",f)},200)},g=f=>{if(f.stopPropagation(),f.preventDefault(),f.ctrlKey||f.metaKey)return xn(e,f);if(f.shiftKey)return e.move(-f.deltaY,0);e.move(-f.deltaX,-f.deltaY)},x=f=>{f.code==="Space"&&(e.spacePressed=!0,e.container.classList.add("space-pressed"))},E=f=>{f.code==="Space"&&(e.spacePressed=!1,e.container.classList.remove("space-pressed"))};return ke([{dom:n,evt:"pointerdown",func:u},{dom:n,evt:"pointermove",func:p},{dom:n,evt:"pointerup",func:v},{dom:n,evt:"pointercancel",func:m},{dom:n,evt:"click",func:d},{dom:n,evt:"contextmenu",func:y},{dom:n,evt:"wheel",func:typeof e.handleWheel=="function"?e.handleWheel:g},{dom:n,evt:"blur",func:m},{dom:n,evt:"keydown",func:x},{dom:n,evt:"keyup",func:E}])}function Cn(){return{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 n=this.handlers[e];for(let o=0;o<n.length;o++)n[o](...t)}},removeListener:function(e,t){if(!this.handlers[e])return;const n=this.handlers[e];if(!t)n.length=0;else if(n.length)for(let o=0;o<n.length;o++)n[o]===t&&this.handlers[e].splice(o,1)}}}const P="http://www.w3.org/2000/svg",ie=function(e){const t=e.clientWidth,n=e.clientHeight,o=e.dataset,s=Number(o.x),i=Number(o.y),l=o.anchor;let c=s;l==="middle"?c=s-t/2:l==="end"&&(c=s-t),e.style.left=`${c}px`,e.style.top=`${i-n/2}px`,e.style.visibility="visible"},Ee=function(e,t,n,o){const{anchor:s="middle",color:i,dataType:l,svgId:c}=o,r=document.createElement("div");r.className="svg-label",r.style.color=i||"#666";const a="label-"+c;return r.id=a,r.innerHTML=e,r.dataset.type=l,r.dataset.svgId=c,r.dataset.x=t.toString(),r.dataset.y=n.toString(),r.dataset.anchor=s,r},ze=function(e,t,n){const o=document.createElementNS(P,"path");return _(o,{d:e,stroke:t||"#666",fill:"none","stroke-width":n}),o},U=function(e){const t=document.createElementNS(P,"svg");return t.setAttribute("class",e),t.setAttribute("overflow","visible"),t},Ve=function(){const e=document.createElementNS(P,"line");return e.setAttribute("stroke","#4dc4ff"),e.setAttribute("fill","none"),e.setAttribute("stroke-width","2"),e.setAttribute("opacity","0.45"),e},Sn=function(e,t,n,o){const s=document.createElementNS(P,"g");return[{name:"line",d:e},{name:"arrow1",d:t},{name:"arrow2",d:n}].forEach((l,c)=>{const r=l.d,a=document.createElementNS(P,"path"),d={d:r,stroke:o?.stroke||"rgb(227, 125, 116)",fill:"none","stroke-linecap":o?.strokeLinecap||"cap","stroke-width":String(o?.strokeWidth||"2")};o?.opacity!==void 0&&(d.opacity=String(o.opacity)),_(a,d),c===0&&a.setAttribute("stroke-dasharray",o?.strokeDasharray||"8,2");const h=document.createElementNS(P,"path");_(h,{d:r,stroke:"transparent",fill:"none","stroke-width":"15"}),s.appendChild(h),s.appendChild(a),s[l.name]=a}),s},Ge=function(e,t,n){if(!t)return;const o=n.label;t.style.opacity="0";const s=t.cloneNode(!0);e.nodes.appendChild(s),s.id="input-box",s.textContent=o,s.contentEditable="plaintext-only",s.spellcheck=!1,s.style.cssText=`
12
12
  left:${t.style.left};
13
13
  top:${t.style.top};
14
14
  max-width: 200px;
15
15
  `,$e(s),e.scrollIntoView(s),s.addEventListener("keydown",i=>{if(i.stopPropagation(),i.isComposing)return;const l=i.key;if(l==="Enter"||l==="Tab"){if(i.shiftKey)return;i.preventDefault(),s.blur(),e.container.focus()}}),s.addEventListener("blur",()=>{if(!s)return;const i=s.innerText?.trim()||"";i===""?n.label=o:n.label=i,t.style.opacity="1",s.remove(),i!==o&&(e.markdown?t.innerHTML=e.markdown(n.label,n):t.textContent=n.label,ie(t),"parent"in n?e.bus.fire("operation",{name:"finishEditSummary",obj:n}):e.bus.fire("operation",{name:"finishEditArrowLabel",obj:n}))})},Nn=function(e){const t=this.map.querySelector("me-root"),n=t.offsetTop,o=t.offsetLeft,s=t.offsetWidth,i=t.offsetHeight,l=this.map.querySelectorAll("me-main > me-wrapper");this.lines.innerHTML="";for(let c=0;c<l.length;c++){const r=l[c],a=r.querySelector("me-tpc"),{offsetLeft:d,offsetTop:h}=L(this.nodes,a),u=a.offsetWidth,p=a.offsetHeight,v=r.parentNode.className,m=this.generateMainBranch({pT:n,pL:o,pW:s,pH:i,cT:h,cL:d,cW:u,cH:p,direction:v,containerHeight:this.nodes.offsetHeight}),y=this.theme.palette,g=a.nodeObj.branchColor||y[c%y.length];if(a.style.borderColor=g,this.lines.appendChild(ze(m,g,"3")),e&&e!==r)continue;const x=U("subLines"),E=r.lastChild;E.tagName==="svg"&&E.remove(),r.appendChild(x),qe(this,x,g,r,v,!0)}this.labelContainer.innerHTML="",this.renderArrow(),this.renderSummary(),this.bus.fire("linkDiv")},qe=function(e,t,n,o,s,i){const l=o.firstChild,c=o.children[1].children;if(c.length===0)return;const r=l.offsetTop,a=l.offsetLeft,d=l.offsetWidth,h=l.offsetHeight;for(let u=0;u<c.length;u++){const p=c[u],v=p.firstChild,m=v.offsetTop,y=v.offsetLeft,g=v.offsetWidth,x=v.offsetHeight,E=v.firstChild.nodeObj.branchColor||n,N=e.generateSubBranch({pT:r,pL:a,pW:d,pH:h,cT:m,cL:y,cW:g,cH:x,direction:s,isFirst:i});t.appendChild(ze(N,E,"2"));const f=v.children[1];if(f){if(!f.expanded)continue}else continue;qe(e,t,E,p,s)}},Tn={addChild:"Add child",addParent:"Add parent",addSibling:"Add sibling",removeNode:"Remove node",focus:"Focus Mode",cancelFocus:"Cancel Focus Mode",moveUp:"Move up",moveDown:"Move down",link:"Link",linkBidirectional:"Bidirectional Link",clickTips:"Please click the target node",summary:"Summary"};function _n(e,t){const n={focus:!0,link:!0,locale:Tn};t=t===!0?n:Object.assign(n,t);const o=b=>{const w=document.createElement("div");return w.innerText=b,w.className="tips",w},s=(b,w,S)=>{const C=document.createElement("li");return C.id=b,C.innerHTML=`<span>${fe(w)}</span><span ${S?'class="key"':""}>${fe(S)}</span>`,C},i=t.locale,l=s("cm-add_child",i.addChild,"Tab"),c=s("cm-add_parent",i.addParent,"Ctrl + Enter"),r=s("cm-add_sibling",i.addSibling,"Enter"),a=s("cm-remove_child",i.removeNode,"Delete"),d=s("cm-fucus",i.focus,""),h=s("cm-unfucus",i.cancelFocus,""),u=s("cm-up",i.moveUp,"PgUp"),p=s("cm-down",i.moveDown,"Pgdn"),v=s("cm-link",i.link,""),m=s("cm-link-bidirectional",i.linkBidirectional,""),y=s("cm-summary",i.summary,""),g=document.createElement("ul");if(g.className="menu-list",g.appendChild(l),g.appendChild(c),g.appendChild(r),g.appendChild(a),t.focus&&(g.appendChild(d),g.appendChild(h)),g.appendChild(u),g.appendChild(p),g.appendChild(y),t.link&&(g.appendChild(v),g.appendChild(m)),t&&t.extend)for(let b=0;b<t.extend.length;b++){const w=t.extend[b],S=s(w.name,w.name,w.key||"");g.appendChild(S),S.onclick=C=>{w.onclick(C)}}const x=document.createElement("div");x.className="context-menu",x.appendChild(g),x.hidden=!0,e.container.append(x);let E=!0;const N=b=>{const w=b.target;if(oe(w)){w.parentElement.tagName==="ME-ROOT"?E=!0:E=!1,E?(d.className="disabled",u.className="disabled",p.className="disabled",c.className="disabled",r.className="disabled",a.className="disabled"):(d.className="",u.className="",p.className="",c.className="",r.className="",a.className=""),x.hidden=!1,g.style.top="",g.style.bottom="",g.style.left="",g.style.right="";const S=g.offsetHeight,C=g.offsetWidth,T=g.getBoundingClientRect(),D=b.clientY-T.top,M=b.clientX-T.left;S+D>window.innerHeight?(g.style.top="",g.style.bottom="0px"):(g.style.bottom="",g.style.top=D+15+"px"),C+M>window.innerWidth?(g.style.left="",g.style.right="0px"):(g.style.right="",g.style.left=M+10+"px")}};e.bus.addListener("showContextMenu",N),x.onclick=b=>{b.target===x&&(x.hidden=!0)},l.onclick=()=>{e.addChild(),x.hidden=!0},c.onclick=()=>{e.insertParent(),x.hidden=!0},r.onclick=()=>{E||(e.insertSibling("after"),x.hidden=!0)},a.onclick=()=>{E||(e.removeNodes(e.currentNodes||[]),x.hidden=!0)},d.onclick=()=>{E||(e.focusNode(e.currentNode),x.hidden=!0)},h.onclick=()=>{e.cancelFocus(),x.hidden=!0},u.onclick=()=>{E||(e.moveUpNode(),x.hidden=!0)},p.onclick=()=>{E||(e.moveDownNode(),x.hidden=!0)};const f=b=>{x.hidden=!0;const w=e.currentNode,S=o(i.clickTips);e.container.appendChild(S),e.map.addEventListener("click",C=>{C.preventDefault(),S.remove();const T=C.target;(T.parentElement.tagName==="ME-PARENT"||T.parentElement.tagName==="ME-ROOT")&&e.createArrow(w,T,b)},{once:!0})};return v.onclick=()=>f(),m.onclick=()=>f({bidirectional:!0}),y.onclick=()=>{x.hidden=!0,e.createSummary(),e.unselectNodes(e.currentNodes)},()=>{l.onclick=null,c.onclick=null,r.onclick=null,a.onclick=null,d.onclick=null,h.onclick=null,u.onclick=null,p.onclick=null,v.onclick=null,y.onclick=null,x.onclick=null,e.container.oncontextmenu=null}}const kn=function(e){return["createSummary","removeSummary","finishEditSummary"].includes(e.name)?{type:"summary",value:e.obj.id}:["createArrow","removeArrow","finishEditArrowLabel"].includes(e.name)?{type:"arrow",value:e.obj.id}:["removeNodes","copyNodes","moveNodeBefore","moveNodeAfter","moveNodeIn"].includes(e.name)?{type:"nodes",value:e.objs.map(t=>t.id)}:{type:"nodes",value:[e.obj.id]}};function Dn(e){let t=[],n=-1,o=e.getData(),s=[];e.undo=function(){if(n>-1){const r=t[n];o=r.prev,e.refresh(r.prev);try{r.currentTarget.type==="nodes"&&(r.operation==="removeNodes"?e.selectNodes(r.currentTarget.value.map(a=>this.findEle(a))):e.selectNodes(r.currentSelected.map(a=>this.findEle(a))))}catch{}finally{n--}}},e.redo=function(){if(n<t.length-1){n++;const r=t[n];o=r.next,e.refresh(r.next);try{r.currentTarget.type==="nodes"&&(r.operation==="removeNodes"?e.selectNodes(r.currentSelected.map(a=>this.findEle(a))):e.selectNodes(r.currentTarget.value.map(a=>this.findEle(a))))}catch{}}},e.clearHistory=function(){t=[],n=-1,o=e.getData(),e.clearSelection()};const i=function(r){if(r.name==="beginEdit")return;t=t.slice(0,n+1);const a=e.getData(),d={prev:o,operation:r.name,currentSelected:s.map(h=>h.id),currentTarget:kn(r),next:a};t.push(d),o=a,n=t.length-1},l=function(r){(r.metaKey||r.ctrlKey)&&(r.shiftKey&&r.key==="Z"||r.key==="y")?e.redo():(r.metaKey||r.ctrlKey)&&r.key==="z"&&e.undo()},c=function(){s=e.currentNodes.map(r=>r.nodeObj)};return e.bus.addListener("operation",i),e.bus.addListener("selectNodes",c),e.container.addEventListener("keydown",l),()=>{e.bus.removeListener("operation",i),e.bus.removeListener("selectNodes",c),e.container.removeEventListener("keydown",l)}}const Ln={side:'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169394918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><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" p-id="2022"></path></svg>',left:'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169375313" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1775" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><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="currentColor" p-id="1776"></path></svg>',right:'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><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="currentColor" p-id="3038"></path></svg>',full:'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><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" p-id="2171"></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" p-id="2172"></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" p-id="2173"></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" p-id="2174"></path></svg>',living:'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><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="currentColor" p-id="2884"></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="currentColor" p-id="2885"></path></svg>',zoomin:'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169419447" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><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" p-id="2481"></path></svg>',zoomout:'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169426515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><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" p-id="2731"></path></svg>'},W=(e,t)=>{const n=document.createElement("span");return n.id=e,n.innerHTML=Ln[t],n};function An(e){const t=document.createElement("div"),n=W("fullscreen","full"),o=W("toCenter","living"),s=W("zoomout","zoomout"),i=W("zoomin","zoomin");t.appendChild(n),t.appendChild(o),t.appendChild(s),t.appendChild(i),t.className="mind-elixir-toolbar rb";let l=null;const c=()=>{const a=e.container.getBoundingClientRect(),d=ge(e.map.style.transform),h=a.width/2,u=a.height/2,p=(h-d.x)/e.scaleVal,v=(u-d.y)/e.scaleVal;l={containerRect:a,currentTransform:d,mapCenterX:p,mapCenterY:v}},r=()=>{if(l){const a=e.container.getBoundingClientRect(),d=a.width/2,h=a.height/2,u=d-l.mapCenterX*e.scaleVal,p=h-l.mapCenterY*e.scaleVal,v=u-l.currentTransform.x,m=p-l.currentTransform.y;e.move(v,m)}};return e.el.addEventListener("fullscreenchange",r),n.onclick=()=>{c(),document.fullscreenElement!==e.el?e.el.requestFullscreen():document.exitFullscreen()},o.onclick=()=>{e.toCenter()},s.onclick=()=>{e.scale(e.scaleVal-e.scaleSensitivity)},i.onclick=()=>{e.scale(e.scaleVal+e.scaleSensitivity)},t}function Mn(e){const t=document.createElement("div"),n=W("tbltl","left"),o=W("tbltr","right"),s=W("tblts","side");return t.appendChild(n),t.appendChild(o),t.appendChild(s),t.className="mind-elixir-toolbar lt",n.onclick=()=>{e.initLeft()},o.onclick=()=>{e.initRight()},s.onclick=()=>{e.initSide()},t}function Pn(e){e.container.append(An(e)),e.container.append(Mn(e))}class On{_listeners=new Map;addEventListener(t,n){const o=this._listeners.get(t)??new Set;return this._listeners.set(t,o),o.add(n),this}removeEventListener(t,n){return this._listeners.get(t)?.delete(n),this}dispatchEvent(t,...n){let o=!0;for(const s of this._listeners.get(t)??[])o=s(...n)!==!1&&o;return o}unbindAllListeners(){this._listeners.clear()}on=this.addEventListener;off=this.removeEventListener;emit=this.dispatchEvent}const Ue=(e,t="px")=>typeof e=="number"?e+t:e,I=({style:e},t,n)=>{if(typeof t=="object")for(const[o,s]of Object.entries(t))s!==void 0&&(e[o]=Ue(s));else n!==void 0&&(e[t]=Ue(n))},Je=(e=0,t=0,n=0,o=0)=>{const s={x:e,y:t,width:n,height:o,top:t,left:e,right:e+n,bottom:t+o};return{...s,toJSON:()=>JSON.stringify(s)}},Hn=e=>{let t,n=-1,o=!1;return{next:(...s)=>{t=s,o||(o=!0,n=requestAnimationFrame(()=>{e(...t),o=!1}))},cancel:()=>{cancelAnimationFrame(n),o=!1}}},Ze=(e,t,n="touch")=>{switch(n){case"center":{const o=t.left+t.width/2,s=t.top+t.height/2;return o>=e.left&&o<=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}},$n=()=>matchMedia("(hover: none), (pointer: coarse)").matches,In=()=>"safari"in window,Ce=e=>Array.isArray(e)?e:[e],Qe=e=>(t,n,o,s={})=>{(t instanceof HTMLCollection||t instanceof NodeList)&&(t=Array.from(t)),n=Ce(n),t=Ce(t);for(const i of t)if(i)for(const l of n)i[e](l,o,{capture:!1,...s})},K=Qe("addEventListener"),H=Qe("removeEventListener"),re=e=>{const{clientX:t,clientY:n,target:o}=e.touches?.[0]??e;return{x:t,y:n,target:o}},z=(e,t=document)=>Ce(e).map(n=>typeof n=="string"?Array.from(t.querySelectorAll(n)):n instanceof Element?n:null).flat().filter(Boolean),jn=(e,t)=>t.some(n=>typeof n=="number"?e.button===n:typeof n=="object"?n.button!==e.button?!1:n.modifiers.every(o=>{switch(o){case"alt":return e.altKey;case"ctrl":return e.ctrlKey||e.metaKey;case"shift":return e.shiftKey}}):!1),{abs:Y,max:et,min:tt,ceil:nt}=Math,ot=(e=[])=>({stored:e,selected:[],touched:[],changed:{added:[],removed:[]}});class Rn extends On{static version="mind-elixir-fork";_options;_selection=ot();_area;_clippingElement;_targetElement;_targetBoundary;_targetBoundaryScrolled=!0;_targetRect;_selectables=[];_latestElement;_areaLocation={y1:0,x2:0,y2:0,x1:0};_areaRect=Je();_singleClick=!0;_frame;_scrollAvailable=!0;_scrollingActive=!1;_scrollSpeed={x:0,y:0};_scrollDelta={x:0,y:0};constructor(t){super(),this._options={selectionAreaClass:"selection-area",selectionContainerClass:void 0,selectables:[],document:window.document,startAreas:["html"],boundaries:["html"],container:"body",mindElixirInstance:void 0,...t,behaviour:{overlap:"invert",intersect:"touch",triggers:[0],...t.behaviour,startThreshold:t.behaviour?.startThreshold?typeof t.behaviour.startThreshold=="number"?t.behaviour.startThreshold:{x:10,y:10,...t.behaviour.startThreshold}:{x:10,y:10},scrolling:{speedDivider:10,...t.behaviour?.scrolling,startScrollMargins:{x:0,y:0,...t.behaviour?.scrolling?.startScrollMargins}}},features:{range:!0,touch:!0,deselectOnBlur:!1,...t.features,singleTap:{allow:!0,intersect:"native",...t.features?.singleTap}}};for(const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))typeof this[i]=="function"&&(this[i]=this[i].bind(this));const{document:n,selectionAreaClass:o,selectionContainerClass:s}=this._options;this._area=n.createElement("div"),this._clippingElement=n.createElement("div"),this._clippingElement.appendChild(this._area),this._area.classList.add(o),s&&this._clippingElement.classList.add(s),I(this._area,{willChange:"top, left, bottom, right, width, height",top:0,left:0,position:"fixed"}),I(this._clippingElement,{overflow:"hidden",position:"fixed",transform:"translate3d(0, 0, 0)",pointerEvents:"none",zIndex:"1"}),this._frame=Hn(i=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",i),this._redrawSelectionArea()}),this.enable()}_toggleStartEvents(t=!0){const{document:n}=this._options;(t?K:H)(n,"pointerdown",this._onTapStart)}_onTapStart(t,n=!1){const{x:o,y:s,target:i}=re(t),{document:l,startAreas:c,boundaries:r,behaviour:a,features:d}=this._options,h=i.getBoundingClientRect();if(!jn(t,a.triggers))return;const u=z(c,l),p=z(r,l);this._targetElement=p.find(g=>Ze(g.getBoundingClientRect(),h));const v=t.composedPath(),m=u.find(g=>v.includes(g));if(this._targetBoundary=p.find(g=>v.includes(g)),!this._targetElement||!m||!this._targetBoundary||!n&&this._emitEvent("beforestart",t)===!1)return;this._areaLocation={x1:o,y1:s,x2:0,y2:0};const y=l.scrollingElement??l.body;this._scrollDelta={x:y.scrollLeft,y:y.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),K(l,["pointermove"],this._delayedTapMove,{passive:!1}),K(l,["pointerup","pointercancel"],this._onTapStop),K(l,"scroll",this._onScroll),d.deselectOnBlur&&(this._targetBoundaryScrolled=!1,K(this._targetBoundary,"scroll",this._onStartAreaScroll))}_onSingleTap(t){const{singleTap:{intersect:n},range:o}=this._options.features,s=re(t);let i;if(n==="native")i=s.target;else if(n==="touch"){this.resolveSelectables();const{x:c,y:r}=s;i=this._selectables.find(a=>{const{right:d,left:h,top:u,bottom:p}=a.getBoundingClientRect();return c<d&&c>h&&r<p&&r>u})}if(!i)return;for(this.resolveSelectables();!this._selectables.includes(i);)if(i.parentElement)i=i.parentElement;else{this._targetBoundaryScrolled||this.clearSelection();return}const{stored:l}=this._selection;if(this._emitEvent("start",t),t.shiftKey&&o&&this._latestElement){const c=this._latestElement,[r,a]=c.compareDocumentPosition(i)&4?[i,c]:[c,i],d=[...this._selectables.filter(h=>h.compareDocumentPosition(r)&4&&h.compareDocumentPosition(a)&2),r,a];this.select(d),this._latestElement=c}else l.includes(i)&&(l.length===1||t.ctrlKey||l.every(c=>this._selection.stored.includes(c)))?this.deselect(i):(this.select(i),this._latestElement=i)}_delayedTapMove(t){const{container:n,document:o,behaviour:{startThreshold:s}}=this._options,{x1:i,y1:l}=this._areaLocation,{x:c,y:r}=re(t);if(typeof s=="number"&&Y(c+r-(i+l))>=s||typeof s=="object"&&Y(c-i)>=s.x||Y(r-l)>=s.y){if(H(o,["pointermove"],this._delayedTapMove,{passive:!1}),this._emitEvent("beforedrag",t)===!1){H(o,["pointerup","pointercancel"],this._onTapStop);return}K(o,["pointermove"],this._onTapMove,{passive:!1}),I(this._area,"display","block"),z(n,o)[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&&(this._selectables=this._selectables.filter(a=>this._targetElement.contains(a))),this._setupSelectionArea(),this._emitEvent("start",t),this._onTapMove(t)}this._handleMoveEvent(t)}_setupSelectionArea(){const{_clippingElement:t,_targetElement:n,_area:o}=this,s=this._targetRect=n.getBoundingClientRect();this._scrollAvailable?(I(t,{top:s.top,left:s.left,width:s.width,height:s.height}),I(o,{marginTop:-s.top,marginLeft:-s.left})):(I(t,{top:0,left:0,width:"100%",height:"100%"}),I(o,{marginTop:0,marginLeft:0}))}_onTapMove(t){const{_scrollSpeed:n,_areaLocation:o,_options:s,_frame:i}=this,{speedDivider:l}=s.behaviour.scrolling,{x:c,y:r}=re(t);if(o.x2=c,o.y2=r,this._scrollAvailable&&!this._scrollingActive&&(n.y||n.x)){this._scrollingActive=!0;const a=()=>{if(!n.x&&!n.y){this._scrollingActive=!1;return}const d=this._options.mindElixirInstance;if(d&&d.move){const h=n.x?nt(n.x/l):0,u=n.y?nt(n.y/l):0;(h||u)&&(d.move(-h,-u),o.x1-=h,o.y1-=u)}i.next(t),requestAnimationFrame(a)};requestAnimationFrame(a)}else i.next(t);this._handleMoveEvent(t)}_handleMoveEvent(t){const{features:n}=this._options;(n.touch&&$n()||this._scrollAvailable&&In())&&t.preventDefault()}_onScroll(){const{_scrollDelta:t,_options:{document:n}}=this,{scrollTop:o,scrollLeft:s}=n.scrollingElement??n.body;this._areaLocation.x1+=t.x-s,this._areaLocation.y1+=t.y-o,t.x=s,t.y=o,this._setupSelectionArea(),this._frame.next(null)}_onStartAreaScroll(){this._targetBoundaryScrolled=!0,H(this._targetElement,"scroll",this._onStartAreaScroll)}_recalculateSelectionAreaRect(){const{_scrollSpeed:t,_areaLocation:n,_targetElement:o,_options:s}=this,i=this._targetRect,{x1:l,y1:c}=n;let{x2:r,y2:a}=n;const{behaviour:{scrolling:{startScrollMargins:d}}}=s;r<i.left+d.x?(t.x=-Y(i.left-r+d.x),r=r<i.left?i.left:r):r>i.right-d.x?(t.x=Y(i.left+i.width-r-d.x),r=r>i.right?i.right:r):t.x=0,a<i.top+d.y?(t.y=-Y(i.top-a+d.y),a=a<i.top?i.top:a):a>i.bottom-d.y?(t.y=Y(i.top+i.height-a-d.y),a=a>i.bottom?i.bottom:a):t.y=0;const h=tt(l,r),u=tt(c,a),p=et(l,r),v=et(c,a);this._areaRect=Je(h,u,p-h,v-u)}_redrawSelectionArea(){const{x:t,y:n,width:o,height:s}=this._areaRect,{style:i}=this._area;i.left=`${t}px`,i.top=`${n}px`,i.width=`${o}px`,i.height=`${s}px`}_onTapStop(t,n){const{document:o,features:s}=this._options,{_singleClick:i}=this;H(this._targetElement,"scroll",this._onStartAreaScroll),H(o,["pointermove"],this._delayedTapMove),H(o,["pointermove"],this._onTapMove),H(o,["pointerup","pointercancel"],this._onTapStop),H(o,"scroll",this._onScroll),this._keepSelection(),t&&i&&s.singleTap.allow?this._onSingleTap(t):!i&&!n&&(this._updateElementSelection(),this._emitEvent("stop",t)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,this._clippingElement.remove(),this._frame?.cancel(),I(this._area,"display","none")}_updateElementSelection(){const{_selectables:t,_options:n,_selection:o,_areaRect:s}=this,{stored:i,selected:l,touched:c}=o,{intersect:r,overlap:a}=n.behaviour,d=a==="invert",h=[],u=[],p=[];for(let m=0;m<t.length;m++){const y=t[m];if(Ze(s,y.getBoundingClientRect(),r)){if(l.includes(y))i.includes(y)&&!c.includes(y)&&c.push(y);else if(d&&i.includes(y)){p.push(y);continue}else u.push(y);h.push(y)}}d&&u.push(...i.filter(m=>!l.includes(m)));const v=a==="keep";for(let m=0;m<l.length;m++){const y=l[m];!h.includes(y)&&!(v&&i.includes(y))&&p.push(y)}o.selected=h,o.changed={added:u,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:o,changed:s,touched:i,stored:l}=n,c=o.filter(r=>!l.includes(r));switch(t.behaviour.overlap){case"drop":{n.stored=[...c,...l.filter(r=>!i.includes(r))];break}case"invert":{n.stored=[...c,...l.filter(r=>!s.removed.includes(r))];break}case"keep":{n.stored=[...l,...o.filter(r=>!l.includes(r))];break}}}trigger(t,n=!0){this._onTapStart(t,n)}resolveSelectables(){this._selectables=z(this._options.selectables,this._options.document)}clearSelection(t=!0,n=!1){const{selected:o,stored:s,changed:i}=this._selection;i.added=[],i.removed.push(...o,...t?s:[]),n||(this._emitEvent("move",null),this._emitEvent("stop",null)),this._selection=ot(t?[]:s)}getSelection(){return this._selection.stored}getSelectionArea(){return this._area}getSelectables(){return this._selectables}setAreaLocation(t){Object.assign(this._areaLocation,t),this._redrawSelectionArea()}getAreaLocation(){return this._areaLocation}cancel(t=!1){this._onTapStop(null,!t)}destroy(){this.cancel(),this.disable(),this._clippingElement.remove(),super.unbindAllListeners()}enable=this._toggleStartEvents;disable=this._toggleStartEvents.bind(this,!1);select(t,n=!1){const{changed:o,selected:s,stored:i}=this._selection,l=z(t,this._options.document).filter(c=>!s.includes(c)&&!i.includes(c));return i.push(...l),s.push(...l),o.added.push(...l),o.removed=[],this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null)),l}deselect(t,n=!1){const{selected:o,stored:s,changed:i}=this._selection,l=z(t,this._options.document).filter(c=>o.includes(c)||s.includes(c));this._selection.stored=s.filter(c=>!l.includes(c)),this._selection.selected=o.filter(c=>!l.includes(c)),this._selection.changed.added=[],this._selection.changed.removed.push(...l.filter(c=>!i.removed.includes(c))),this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null))}}function Bn(e){const t=e.mouseSelectionButton===2?[2]:[0],n=new Rn({selectables:[".map-container me-tpc"],boundaries:[e.container],container:e.selectionContainer,mindElixirInstance:e,features:{touch:!1,singleTap:{allow:!1}},behaviour:{triggers:t,scrolling:{speedDivider:10,startScrollMargins:{x:50,y:50}}}}).on("beforestart",({event:o})=>{if(!e.editable||e.spacePressed||e.ptState!==5)return!1;const s=o.target;if(s.id==="input-box"||s.className==="circle"||s.className!=="map-container")return!1;!o.ctrlKey&&!o.metaKey&&e.clearSelection();const i=n.getSelectionArea();return i.style.background="#4f90f22d",i.style.border="1px solid #4f90f2",i.style.borderRadius="3px",i.parentElement&&(i.parentElement.style.zIndex="9999"),!0}).on("move",({store:{changed:{added:o,removed:s}}})=>{if(o.length>0||s.length>0,o.length>0){const i=o.filter(l=>!e.currentNodes?.includes(l));if(i.length>0){for(const l of i)l.className="selected";e.currentNodes=[...e.currentNodes||[],...i],e.bus.fire("selectNodes",i.map(l=>l.nodeObj))}}if(s.length>0){const i=s.filter(l=>e.currentNodes?.includes(l));if(i.length>0){for(const l of i)l.classList.remove("selected");e.currentNodes=(e.currentNodes||[]).filter(l=>!i.includes(l)),e.bus.fire("unselectNodes",i.map(l=>l.nodeObj))}}});e.selection=n}function st({pT:e,pL:t,pW:n,pH:o,cT:s,cL:i,cW:l,cH:c,direction:r,containerHeight:a}){let d=t+n/2;const h=e+o/2;let u;r===O.LHS?u=i+l:u=i;const p=s+c/2,m=(1-Math.abs(p-h)/a)*.25*(n/2);return r===O.LHS?d=d-n/10-m:d=d+n/10+m,`M ${d} ${h} Q ${d} ${p} ${u} ${p}`}function it({pT:e,pL:t,pW:n,pH:o,cT:s,cL:i,cW:l,cH:c,direction:r,isFirst:a}){const d=parseInt(this.container.style.getPropertyValue("--node-gap-x"));let h=0,u=0;a?h=e+o/2:h=e+o;const p=s+c;let v=0,m=0,y=0;const g=Math.abs(h-p)/300*d;return r===O.LHS?(y=t,v=y+d,m=y-d,u=i+d,`M ${v} ${h} C ${y} ${h} ${y+g} ${p} ${m} ${p} H ${u}`):(y=t+n,v=y-d,m=y+d,u=i+l-d,`M ${v} ${h} C ${y} ${h} ${y-g} ${p} ${m} ${p} H ${u}`)}const Wn=function(e,t=!0){this.theme=e,this.generateMainBranch=this.theme.generateMainBranch||st,this.generateSubBranch=this.theme.generateSubBranch||it;const o={...(this.theme.type==="dark"?Q:Z).cssVar,...this.theme.cssVar};this.compact&&(o["--node-gap-x"]="15px",o["--node-gap-y"]="2px",o["--main-gap-x"]="30px",o["--main-gap-y"]="6px");const s=Object.keys(o);for(let i=0;i<s.length;i++){const l=s[i];this.container.style.setProperty(l,o[l])}t&&this.refresh()},Yn=function(e){this.compact=e,this.theme&&this.changeTheme(this.theme)},rt={create:function(e){return{dom:e,moved:!1,pointerdown:!1,lastX:0,lastY:0,handlePointerMove(t){if(this.pointerdown){this.moved=!0;const n=t.clientX-this.lastX,o=t.clientY-this.lastY;this.lastX=t.clientX,this.lastY=t.clientY,this.cb&&this.cb(n,o)}},handlePointerDown(t){t.button===0&&(this.pointerdown=!0,this.lastX=t.clientX,this.lastY=t.clientY,this.dom.setPointerCapture(t.pointerId))},handleClear(t){this.pointerdown=!1,t.pointerId!==void 0&&this.dom.releasePointerCapture(t.pointerId)},cb:null,init(t,n){this.cb=n,this.handleClear=this.handleClear.bind(this),this.handlePointerMove=this.handlePointerMove.bind(this),this.handlePointerDown=this.handlePointerDown.bind(this),this.destroy=ke([{dom:t,evt:"pointermove",func:this.handlePointerMove},{dom:t,evt:"pointerleave",func:this.handleClear},{dom:t,evt:"pointerup",func:this.handleClear},{dom:this.dom,evt:"pointerdown",func:this.handlePointerDown}])},destroy:null,clear(){this.moved=!1,this.pointerdown=!1}}}},lt="#4dc4ff";function ct(e,t,n,o,s,i,l,c){return{x:e/8+n*3/8+s*3/8+l/8,y:t/8+o*3/8+i*3/8+c/8}}function Fn(e,t,n){e&&(e.dataset.x=t.toString(),e.dataset.y=n.toString(),ie(e))}function V(e,t,n,o,s){_(e,{x1:t+"",y1:n+"",x2:o+"",y2:s+""})}function Se(e,t,n,o,s,i,l,c,r,a){const d=`M ${t} ${n} C ${o} ${s} ${i} ${l} ${c} ${r}`;e.line.setAttribute("d",d);const h=a.style||{};e.line.setAttribute("stroke",h.stroke||"rgb(227, 125, 116)"),e.line.setAttribute("stroke-width",String(h.strokeWidth||"2")),e.line.setAttribute("stroke-dasharray",h.strokeDasharray||"8,2"),e.line.setAttribute("stroke-linecap",h.strokeLinecap||"cap"),h.opacity!==void 0&&h.opacity!==null&&h.opacity!==""?e.line.setAttribute("opacity",String(h.opacity)):e.line.removeAttribute("opacity");const u=e.querySelectorAll('path[stroke="transparent"]');u.length>0&&u[0].setAttribute("d",d);const p=te(i,l,c,r);if(p){const g=`M ${p.x1} ${p.y1} L ${c} ${r} L ${p.x2} ${p.y2}`;e.arrow1.setAttribute("d",g),u.length>1&&u[1].setAttribute("d",g),e.arrow1.setAttribute("stroke",h.stroke||"rgb(227, 125, 116)"),e.arrow1.setAttribute("stroke-width",String(h.strokeWidth||"2")),e.arrow1.setAttribute("stroke-linecap",h.strokeLinecap||"cap"),h.opacity!==void 0&&h.opacity!==null&&h.opacity!==""?e.arrow1.setAttribute("opacity",String(h.opacity)):e.arrow1.removeAttribute("opacity")}if(a.bidirectional){const g=te(o,s,t,n);if(g){const x=`M ${g.x1} ${g.y1} L ${t} ${n} L ${g.x2} ${g.y2}`;e.arrow2.setAttribute("d",x),u.length>2&&u[2].setAttribute("d",x)}}else e.arrow2.setAttribute("d",""),u.length>2&&u[2].setAttribute("d","");e.arrow2.setAttribute("stroke",h.stroke||"rgb(227, 125, 116)"),e.arrow2.setAttribute("stroke-width",String(h.strokeWidth||"2")),e.arrow2.setAttribute("stroke-linecap",h.strokeLinecap||"cap"),h.opacity!==void 0&&h.opacity!==null&&h.opacity!==""?e.arrow2.setAttribute("opacity",String(h.opacity)):e.arrow2.removeAttribute("opacity");const{x:v,y:m}=ct(t,n,o,s,i,l,c,r);e.labelEl&&Fn(e.labelEl,v,m);const y=e.labelEl;y&&(y.style.color=h.labelColor||"rgb(235, 95, 82)"),Un(e)}function G(e,t,n){const{offsetLeft:o,offsetTop:s}=L(e.nodes,t),i=t.offsetWidth,l=t.offsetHeight,c=o+i/2,r=s+l/2,a=c+n.x,d=r+n.y;return{w:i,h:l,cx:c,cy:r,ctrlX:a,ctrlY:d}}function j(e){let t,n;const o=(e.cy-e.ctrlY)/(e.ctrlX-e.cx);return o>e.h/e.w||o<-e.h/e.w?e.cy-e.ctrlY<0?(t=e.cx-e.h/2/o,n=e.cy+e.h/2):(t=e.cx+e.h/2/o,n=e.cy-e.h/2):e.cx-e.ctrlX<0?(t=e.cx+e.w/2,n=e.cy-e.w*o/2):(t=e.cx-e.w/2,n=e.cy+e.w*o/2),{x:t,y:n}}const at=function(e,t,n){const o=L(e.nodes,t),s=L(e.nodes,n),i=o.offsetLeft+t.offsetWidth/2,l=o.offsetTop+t.offsetHeight/2,c=s.offsetLeft+n.offsetWidth/2,r=s.offsetTop+n.offsetHeight/2,a=c-i,d=r-l,h=Math.sqrt(a*a+d*d),u=Math.max(50,Math.min(200,h*.3)),p=Math.abs(a),v=Math.abs(d);let m,y;if(h<150){const x=t.closest("me-main").className==="lhs"?-1:1;m={x:200*x,y:0},y={x:200*x,y:0}}else if(p>v*1.5){const x=a>0?t.offsetWidth/2:-t.offsetWidth/2,E=a>0?-n.offsetWidth/2:n.offsetWidth/2;m={x:x+(a>0?u:-u),y:0},y={x:E+(a>0?-u:u),y:0}}else if(v>p*1.5){const x=d>0?t.offsetHeight/2:-t.offsetHeight/2,E=d>0?-n.offsetHeight/2:n.offsetHeight/2;m={x:0,y:x+(d>0?u:-u)},y={x:0,y:E+(d>0?-u:u)}}else{const x=Math.atan2(d,a),E=t.offsetWidth/2*Math.cos(x),N=t.offsetHeight/2*Math.sin(x),f=-(n.offsetWidth/2)*Math.cos(x),b=-(n.offsetHeight/2)*Math.sin(x),w=u*.7*(a>0?1:-1),S=u*.7*(d>0?1:-1);m={x:E+w,y:N+S},y={x:f-w,y:b-S}}return{delta1:{x:Math.round(m.x),y:Math.round(m.y)},delta2:{x:Math.round(y.x),y:Math.round(y.y)}}},Ne=function(e,t,n,o,s){if(!t||!n)return;if(!o.delta1||!o.delta2){const C=at(e,t,n);o.delta1=C.delta1,o.delta2=C.delta2}const i=G(e,t,o.delta1),l=G(e,n,o.delta2),{x:c,y:r}=j(i),{ctrlX:a,ctrlY:d}=i,{ctrlX:h,ctrlY:u}=l,{x:p,y:v}=j(l),m=te(h,u,p,v);if(!m)return;const y=`M ${m.x1} ${m.y1} L ${p} ${v} L ${m.x2} ${m.y2}`;let g="";if(o.bidirectional){const C=te(a,d,c,r);if(!C)return;g=`M ${C.x1} ${C.y1} L ${c} ${r} L ${C.x2} ${C.y2}`}const x=Sn(`M ${c} ${r} C ${a} ${d} ${h} ${u} ${p} ${v}`,y,g,o.style),{x:E,y:N}=ct(c,r,a,d,h,u,p,v),f=o.style?.labelColor||"rgb(235, 95, 82)",b="a-"+o.id;x.id=b;const w=e.markdown?e.markdown(o.label,o):o.label,S=Ee(w,E,N,{anchor:"middle",color:f,dataType:"arrow",svgId:b});x.labelEl=S,x.arrowObj=o,x.dataset.linkid=o.id,e.labelContainer.appendChild(S),e.arrowSvg.appendChild(x),ie(S),s||(e.arrows.push(o),e.currentArrow=x,ht(e,o,i,l))},Xn=function(e,t,n={}){const o={id:B(),label:"Custom Link",from:e.nodeObj.id,to:t.nodeObj.id,...n};Ne(this,e,t,o),this.bus.fire("operation",{name:"createArrow",obj:o})},Kn=function(e){le(this);const t={...e,id:B()};Ne(this,this.findEle(t.from),this.findEle(t.to),t),this.bus.fire("operation",{name:"createArrow",obj:t})},zn=function(e){let t;if(e?t=e:t=this.currentArrow,!t)return;le(this);const n=t.arrowObj.id;this.arrows=this.arrows.filter(o=>o.id!==n),t.labelEl?.remove(),t.remove(),this.bus.fire("operation",{name:"removeArrow",obj:{id:n}})},Vn=function(e){this.currentArrow=e;const t=e.arrowObj,n=this.findEle(t.from),o=this.findEle(t.to),s=G(this,n,t.delta1),i=G(this,o,t.delta2);this.editable?ht(this,t,s,i):dt(e,lt),this.bus.fire("selectArrow",t)},Gn=function(){le(this),this.currentArrow=null,this.bus.fire("unselectArrow")},Te=function(e,t){const n=document.createElementNS(P,"path");return _(n,{d:e,stroke:t,fill:"none","stroke-width":"6","stroke-linecap":"round","stroke-linejoin":"round"}),n},dt=function(e,t){const n=document.createElementNS(P,"g");n.setAttribute("class","arrow-highlight"),n.setAttribute("opacity","0.45");const o=Te(e.line.getAttribute("d"),t);n.appendChild(o);const s=Te(e.arrow1.getAttribute("d"),t);if(n.appendChild(s),e.arrow2.getAttribute("d")){const i=Te(e.arrow2.getAttribute("d"),t);n.appendChild(i)}e.insertBefore(n,e.firstChild)},qn=function(e){const t=e.querySelector(".arrow-highlight");t&&t.remove()},Un=function(e){const t=e.querySelector(".arrow-highlight");if(!t)return;const n=t.querySelectorAll("path");n.length>=1&&n[0].setAttribute("d",e.line.getAttribute("d")),n.length>=2&&n[1].setAttribute("d",e.arrow1.getAttribute("d")),n.length>=3&&e.arrow2.getAttribute("d")&&n[2].setAttribute("d",e.arrow2.getAttribute("d"))},le=function(e){e.helper1?.destroy(),e.helper2?.destroy(),e.linkController.style.display="none",e.P2.style.display="none",e.P3.style.display="none",e.currentArrow&&qn(e.currentArrow)},ht=function(e,t,n,o){const{linkController:s,P2:i,P3:l,line1:c,line2:r,nodes:a,map:d,currentArrow:h,bus:u}=e;if(!h)return;s.style.display="initial",i.style.display="initial",l.style.display="initial",a.appendChild(s),a.appendChild(i),a.appendChild(l),dt(h,lt);let{x:p,y:v}=j(n),{ctrlX:m,ctrlY:y}=n,{ctrlX:g,ctrlY:x}=o,{x:E,y:N}=j(o);i.style.cssText=`top:${y}px;left:${m}px;`,l.style.cssText=`top:${x}px;left:${g}px;`,V(c,p,v,m,y),V(r,g,x,E,N),e.helper1=rt.create(i),e.helper2=rt.create(l),e.helper1.init(d,(f,b)=>{m=m+f/e.scaleVal,y=y+b/e.scaleVal;const w=j({...n,ctrlX:m,ctrlY:y});p=w.x,v=w.y,i.style.top=y+"px",i.style.left=m+"px",Se(h,p,v,m,y,g,x,E,N,t),V(c,p,v,m,y),t.delta1.x=Math.round(m-n.cx),t.delta1.y=Math.round(y-n.cy),u.fire("updateArrowDelta",t)}),e.helper2.init(d,(f,b)=>{g=g+f/e.scaleVal,x=x+b/e.scaleVal;const w=j({...o,ctrlX:g,ctrlY:x});E=w.x,N=w.y,l.style.top=x+"px",l.style.left=g+"px",Se(h,p,v,m,y,g,x,E,N,t),V(r,g,x,E,N),t.delta2.x=Math.round(g-o.cx),t.delta2.y=Math.round(x-o.cy),u.fire("updateArrowDelta",t)})};function Jn(){this.arrowSvg.innerHTML="",this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach(t=>t.remove());for(let t=0;t<this.arrows.length;t++){const n=this.arrows[t];try{Ne(this,this.findEle(n.from),this.findEle(n.to),n,!0)}catch{}}this.nodes.appendChild(this.arrowSvg)}function Zn(e){le(this),e&&e.labelEl&&Ge(this,e.labelEl,e.arrowObj)}function Qn(){this.arrows=this.arrows.filter(e=>ee(e.from,this.nodeData)&&ee(e.to,this.nodeData))}const eo=Object.freeze(Object.defineProperty({__proto__:null,createArrow:Xn,createArrowFrom:Kn,editArrowLabel:Zn,removeArrow:zn,renderArrow:Jn,reshapeArrow:function(e,t){const n=ne(e);n.style&&t.style&&(t.style=Object.assign({},n.style,t.style)),Object.assign(e,t);const o=this.arrowSvg.querySelector(`g[data-linkid="${e.id}"]`);if(o){if(t.label!==void 0&&o.labelEl){const l=this.markdown?this.markdown(e.label,e):e.label;o.labelEl.innerHTML=l}const s=this.findEle(e.from),i=this.findEle(e.to);if(s&&i){if(!e.delta1||!e.delta2){const y=at(this,s,i);e.delta1=e.delta1||y.delta1,e.delta2=e.delta2||y.delta2}const l=G(this,s,e.delta1),c=G(this,i,e.delta2),{x:r,y:a}=j(l),{ctrlX:d,ctrlY:h}=l,{ctrlX:u,ctrlY:p}=c,{x:v,y:m}=j(c);Se(o,r,a,d,h,u,p,v,m,e),this.currentArrow?.arrowObj?.id===e.id&&(this.P2.style.cssText=`top:${h}px;left:${d}px;`,this.P3.style.cssText=`top:${p}px;left:${u}px;`,V(this.line1,r,a,d,h),V(this.line2,u,p,v,m))}}this.bus.fire("operation",{name:"reshapeArrow",obj:e,origin:n})},selectArrow:Vn,tidyArrow:Qn,unselectArrow:Gn},Symbol.toStringTag,{value:"Module"})),to=function(e){if(e.length===0)throw new Error("No selected node.");if(e.length===1){const r=e[0].nodeObj,a=e[0].nodeObj.parent;if(!a)throw new Error("Can not select root node.");const d=a.children.findIndex(h=>r===h);return{parent:a.id,start:d,end:d}}let t=0;const n=e.map(r=>{let a=r.nodeObj;const d=[];for(;a.parent;){const h=a.parent,p=h.children?.indexOf(a);a=h,d.unshift({node:a,index:p})}return d.length>t&&(t=d.length),d});let o=0;e:for(;o<t;o++){const r=n[0][o]?.node;for(let a=1;a<n.length;a++)if(n[a][o]?.node!==r)break e}if(!o)throw new Error("Can not select root node.");const s=n.map(r=>r[o-1].index).sort(),i=s[0]||0,l=s[s.length-1]||0,c=n[0][o-1].node;if(!c.parent)throw new Error("Please select nodes in the same main topic.");return{parent:c.id,start:i,end:l}},no=function(e){const t=document.createElementNS(P,"g");return t.setAttribute("id",e),t},ft=function(e,t){const n=document.createElementNS(P,"path");return _(n,{d:e,stroke:t||"#666",fill:"none","stroke-linecap":"round","stroke-width":"2"}),n},oo=e=>e.parentElement.parentElement,so=function(e,{parent:t,start:n}){const o=e.findEle(t),s=o.nodeObj;let i;return s.parent?i=o.closest("me-main").className:i=e.findEle(s.children[n].id).closest("me-main").className,i},_e=function(e,t){const{id:n,label:o,parent:s,start:i,end:l,style:c}=t,{nodes:r,theme:a,summarySvg:d}=e,u=e.findEle(s).nodeObj,p=so(e,t);let v=1/0,m=0,y=0,g=0;for(let J=i;J<=l;J++){const gt=u.children?.[J];if(!gt)return e.removeSummary(n),null;const de=oo(e.findEle(gt.id)),{offsetLeft:he,offsetTop:mt}=L(r,de),yt=i===l?10:20;J===i&&(y=mt+yt),J===l&&(g=mt+de.offsetHeight-yt),he<v&&(v=he),de.offsetWidth+he>m&&(m=de.offsetWidth+he)}let x,E;const N=u.parent?10:0,f=y+N,b=g+N,w=(f+b)/2,S=c?.stroke||a.cssVar["--color"],C=c?.labelColor||a.cssVar["--color"],T="s-"+n,D=e.markdown?e.markdown(o,t):o;p===O.LHS?(x=ft(`M ${v+10} ${f} c -5 0 -10 5 -10 10 L ${v} ${b-10} c 0 5 5 10 10 10 M ${v} ${w} h -10`,S),E=Ee(D,v-20,w,{anchor:"end",color:C,dataType:"summary",svgId:T})):(x=ft(`M ${m-10} ${f} c 5 0 10 5 10 10 L ${m} ${b-10} c 0 5 -5 10 -10 10 M ${m} ${w} h 10`,S),E=Ee(D,m+20,w,{anchor:"start",color:C,dataType:"summary",svgId:T}));const M=no(T);return M.appendChild(x),e.labelContainer.appendChild(E),ie(E),M.summaryObj=t,M.labelEl=E,d.appendChild(M),M},io=Object.freeze(Object.defineProperty({__proto__:null,createSummary:function(e={}){if(!this.currentNodes)return;const{currentNodes:t,summaries:n,bus:o}=this,{parent:s,start:i,end:l}=to(t),c={id:B(),parent:s,start:i,end:l,label:"summary",style:e.style},r=_e(this,c);n.push(c),this.editSummary(r),o.fire("operation",{name:"createSummary",obj:c})},createSummaryFrom:function(e){const t=B(),n={...e,id:t};_e(this,n),this.summaries.push(n),this.bus.fire("operation",{name:"createSummary",obj:n})},editSummary:function(e){e&&e.labelEl&&Ge(this,e.labelEl,e.summaryObj)},removeSummary:function(e){const t=this.summaries.findIndex(n=>n.id===e);t>-1&&(this.summaries.splice(t,1),this.nodes.querySelector("#s-"+e)?.remove(),this.nodes.querySelector("#label-s-"+e)?.remove()),this.bus.fire("operation",{name:"removeSummary",obj:{id:e}})},renderSummary:function(){this.summarySvg.innerHTML="",this.summaries.forEach(e=>{try{_e(this,e)}catch{}}),this.nodes.insertAdjacentElement("beforeend",this.summarySvg)},selectSummary:function(e){const t=e.labelEl;t&&t.classList.add("selected"),this.currentSummary=e,this.bus.fire("selectSummary",e.summaryObj)},unselectSummary:function(){this.currentSummary?.labelEl?.classList.remove("selected"),this.currentSummary=null,this.bus.fire("unselectSummary")}},Symbol.toStringTag,{value:"Module"})),k="http://www.w3.org/2000/svg";function ro(e,t){const n=document.createElementNS(k,"svg");return _(n,{version:"1.1",xmlns:k,height:e,width:t}),n}function lo(e,t){return(parseInt(e)-parseInt(t))/2}function co(e,t,n,o){const s=document.createElementNS(k,"g");let i="";return e.text?i=e.text.textContent:i=e.childNodes[0].textContent,i.split(`
16
- `).forEach((c,r)=>{const a=document.createElementNS(k,"text");_(a,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+lo(t.lineHeight,t.fontSize)*(r+1)+parseFloat(t.fontSize)*(r+1)+"","text-anchor":"start","font-family":t.fontFamily,"font-size":`${t.fontSize}`,"font-weight":`${t.fontWeight}`,fill:`${t.color}`}),a.innerHTML=c,s.appendChild(a)}),s}function ao(e,t,n,o){let s="";e.nodeObj?.dangerouslySetInnerHTML?s=e.nodeObj.dangerouslySetInnerHTML:e.text?s=e.text.textContent:s=e.childNodes[0].textContent;const i=document.createElementNS(k,"foreignObject");_(i,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+"",width:t.width,height:t.height});const l=document.createElement("div");return _(l,{xmlns:"http://www.w3.org/1999/xhtml",style:`font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`}),l.innerHTML=s,i.appendChild(l),i}function ho(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:s}=L(e.nodes,t),i=document.createElementNS(k,"rect");return _(i,{x:o+"",y:s+"",rx:n.borderRadius,ry:n.borderRadius,width:n.width,height:n.height,fill:n.backgroundColor,stroke:n.borderColor,"stroke-width":n.borderWidth}),i}function ce(e,t,n=!1){const o=getComputedStyle(t),{offsetLeft:s,offsetTop:i}=L(e.nodes,t),l=document.createElementNS(k,"rect");_(l,{x:s+"",y:i+"",rx:o.borderRadius,ry:o.borderRadius,width:o.width,height:o.height,fill:o.backgroundColor,stroke:o.borderColor,"stroke-width":o.borderWidth});const c=document.createElementNS(k,"g");c.appendChild(l);let r;return n?r=ao(t,o,s,i):r=co(t,o,s,i),c.appendChild(r),c}function fo(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:s}=L(e.nodes,t),i=document.createElementNS(k,"a"),l=document.createElementNS(k,"text");return _(l,{x:o+"",y:s+parseInt(n.fontSize)+"","text-anchor":"start","font-family":n.fontFamily,"font-size":`${n.fontSize}`,"font-weight":`${n.fontWeight}`,fill:`${n.color}`}),l.innerHTML=t.textContent,i.appendChild(l),i.setAttribute("href",t.href),i}function uo(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:s}=L(e.nodes,t),i=document.createElementNS(k,"image");return _(i,{x:o+"",y:s+"",width:n.width+"",height:n.height+"",href:t.src}),i}const ae=100,po='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',go=(e,t=!1)=>{const n=e.nodes,o=n.offsetHeight+ae*2,s=n.offsetWidth+ae*2,i=ro(o+"px",s+"px"),l=document.createElementNS(k,"svg"),c=document.createElementNS(k,"rect");_(c,{x:"0",y:"0",width:`${s}`,height:`${o}`,fill:e.theme.cssVar["--bgcolor"]}),i.appendChild(c),n.querySelectorAll(".subLines").forEach(h=>{const u=h.cloneNode(!0),{offsetLeft:p,offsetTop:v}=L(n,h.parentElement);u.setAttribute("x",`${p}`),u.setAttribute("y",`${v}`),l.appendChild(u)});const r=n.querySelector(".lines")?.cloneNode(!0);r&&l.appendChild(r);const a=n.querySelector(".topiclinks")?.cloneNode(!0);a&&l.appendChild(a);const d=n.querySelector(".summary")?.cloneNode(!0);return d&&l.appendChild(d),n.querySelectorAll("me-tpc").forEach(h=>{h.nodeObj.dangerouslySetInnerHTML?l.appendChild(ce(e,h,!t)):(l.appendChild(ho(e,h)),l.appendChild(ce(e,h.text,!t)))}),n.querySelectorAll(".tags > span").forEach(h=>{l.appendChild(ce(e,h))}),n.querySelectorAll(".icons > span").forEach(h=>{l.appendChild(ce(e,h))}),n.querySelectorAll(".hyper-link").forEach(h=>{l.appendChild(fo(e,h))}),n.querySelectorAll("img").forEach(h=>{l.appendChild(uo(e,h))}),_(l,{x:ae+"",y:ae+"",overflow:"visible"}),i.appendChild(l),i},mo=(e,t)=>(t&&e.insertAdjacentHTML("afterbegin","<style>"+t+"</style>"),po+e.outerHTML);function yo(e){return new Promise((t,n)=>{const o=new FileReader;o.onload=s=>{t(s.target.result)},o.onerror=s=>{n(s)},o.readAsDataURL(e)})}const bo=Object.freeze(Object.defineProperty({__proto__:null,exportPng:async function(e=!1,t){const n=this.exportSvg(e,t),o=await yo(n);return new Promise((s,i)=>{const l=new Image;l.setAttribute("crossOrigin","anonymous"),l.onload=()=>{const c=document.createElement("canvas");c.width=l.width,c.height=l.height,c.getContext("2d").drawImage(l,0,0),c.toBlob(s,"image/png",1)},l.src=o,l.onerror=i})},exportSvg:function(e=!1,t){const n=go(this,e),o=mo(n,t);return new Blob([o],{type:"image/svg+xml"})}},Symbol.toStringTag,{value:"Module"}));function vo(e,t){return async function(...n){const o=this.before[t];o&&!await o.apply(this,n)||e.apply(this,n)}}const ut=Object.keys(Be),pt={};for(let e=0;e<ut.length;e++){const t=ut[e];pt[t]=vo(Be[t],t)}const xo={getObjById:ee,generateNewObj:bt,layout:_t,linkDiv:Nn,editTopic:Ot,createWrapper:Lt,createParent:At,createChildren:Mt,createTopic:Pt,findEle:He,changeTheme:Wn,changeCompact:Yn,...hn,...pt,...eo,...io,...bo,init(e){if(e=JSON.parse(JSON.stringify(e)),!e||!e.nodeData)return new Error("MindElixir: `data` is required");e.direction!==void 0&&(this.direction=e.direction),e.compact!==void 0&&(this.compact=e.compact),this.changeTheme(e.theme||this.theme,!1),e.meta&&(this.meta=e.meta),this.nodeData=e.nodeData,R(this.nodeData),this.arrows=e.arrows||[],this.summaries=e.summaries||[],this.tidyArrow(),this.toolBar&&Pn(this),this.keypress&&wn(this,this.keypress),Bn(this),this.disposable.push(Tt()),this.contextMenu&&this.disposable.push(_n(this,this.contextMenu)),this.allowUndo&&this.disposable.push(Dn(this)),this.layout(),this.linkDiv(),this.toCenter()},destroy(){this.disposable.forEach(e=>e()),this.el&&(this.el.innerHTML=""),this.el=void 0,this.nodeData=void 0,this.arrows=void 0,this.summaries=void 0,this.currentArrow=void 0,this.currentNodes=void 0,this.currentSummary=void 0,this.theme=void 0,this.direction=void 0,this.bus=void 0,this.container=void 0,this.map=void 0,this.lines=void 0,this.linkController=void 0,this.arrowSvg=void 0,this.P2=void 0,this.P3=void 0,this.line1=void 0,this.line2=void 0,this.nodes=void 0,this.selection?.destroy(),this.selection=void 0},enableMobileMultiSelect(e){this.mobileMultiSelect=e}},wo="5.14.0-beta.1";function Eo(e){return{x:0,y:0,moved:!1,mousedown:!1,handlePointerDown(t){this.moved=!1;const n=t.target,o=e.mouseSelectionButton===0?2:0,s=e.spacePressed&&t.button===0&&t.pointerType==="mouse",i=!e.editable||t.button===o&&t.pointerType==="mouse"||t.pointerType==="touch";!s&&!i||(this.x=t.clientX,this.y=t.clientY,n.className!=="circle"&&n.contentEditable!=="plaintext-only"&&(this.mousedown=!0,n.setPointerCapture(t.pointerId)))},handlePointerMove(t){if(!this.mousedown||t.target.contentEditable==="plaintext-only"&&!e.spacePressed)return!1;const n=t.clientX-this.x,o=t.clientY-this.y;return this.x=t.clientX,this.y=t.clientY,this.moved=!0,e.move(n,o),!0},handlePointerUp(t){if(!this.mousedown)return;const n=t.target;n.hasPointerCapture&&n.hasPointerCapture(t.pointerId)&&n.releasePointerCapture(t.pointerId),this.mousedown=!1},clear(){this.mousedown=!1,this.moved=!1}}}function A({el:e,direction:t,editable:n,contextMenu:o,toolBar:s,keypress:i,mouseSelectionButton:l,selectionContainer:c,before:r,newTopicName:a,allowUndo:d,generateMainBranch:h,generateSubBranch:u,overflowHidden:p,compact:v,theme:m,alignment:y,scaleSensitivity:g,scaleMax:x,scaleMin:E,handleWheel:N,markdown:f,imageProxy:b,pasteHandler:w,mobileMultiSelect:S}){let C=null;const T=Object.prototype.toString.call(e);if(T==="[object HTMLDivElement]"?C=e:T==="[object String]"&&(C=document.querySelector(e)),!C)throw new Error("MindElixir: el is not a valid element");C.style.position="relative",C.innerHTML="",this.el=C,this.disposable=[],this.before=r||{},this.newTopicName=a||"New Node",this.contextMenu=o??!0,this.toolBar=s??!0,this.keypress=i??!0,this.mouseSelectionButton=l??0,this.direction=t??1,this.editable=n??!0,this.allowUndo=d??!0,this.scaleSensitivity=g??.1,this.scaleMax=x??1.4,this.scaleMin=E??.2,this.generateMainBranch=h||st,this.generateSubBranch=u||it,this.overflowHidden=p??!1,this.compact=v??!1,this.alignment=y??"root",this.handleWheel=N??!0,this.markdown=f||void 0,this.imageProxy=b||void 0,this.currentNodes=[],this.currentArrow=null,this.scaleVal=1,this.tempDirection=null,this.mobileMultiSelect=S??!1,this.panHelper=Eo(this),this.bus=Cn(),this.container=document.createElement("div"),this.selectionContainer=c||this.container,this.container.className="map-container";const D=window.matchMedia("(prefers-color-scheme: dark)");this.theme=m||(D.matches?Q:Z);const M=document.createElement("div");M.className="map-canvas",this.map=M,this.container.setAttribute("tabindex","0"),this.container.appendChild(this.map),this.el.appendChild(this.container),this.nodes=document.createElement("me-nodes"),this.lines=U("lines"),this.summarySvg=U("summary"),this.linkController=U("linkcontroller"),this.P2=document.createElement("div"),this.P3=document.createElement("div"),this.P2.className=this.P3.className="circle",this.P2.style.display=this.P3.style.display="none",this.line1=Ve(),this.line2=Ve(),this.linkController.appendChild(this.line1),this.linkController.appendChild(this.line2),this.arrowSvg=U("topiclinks"),this.labelContainer=document.createElement("div"),this.labelContainer.className="label-container",this.map.appendChild(this.nodes),this.overflowHidden?this.container.style.overflow="hidden":this.disposable.push(En(this)),w&&(this.pasteHandler=w)}return A.prototype=xo,Object.defineProperty(A.prototype,"currentNode",{get(){return this.currentNodes[this.currentNodes.length-1]},enumerable:!0}),A.LEFT=0,A.RIGHT=1,A.SIDE=2,A.THEME=Z,A.DARK_THEME=Q,A.version=wo,A.E=He,A.new=e=>({nodeData:{id:B(),topic:e||"new topic",children:[]}}),$.DARK_THEME=Q,$.LEFT=0,$.RIGHT=1,$.SIDE=2,$.THEME=Z,$.default=A,Object.defineProperties($,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),$})({});
16
+ `).forEach((c,r)=>{const a=document.createElementNS(k,"text");_(a,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+lo(t.lineHeight,t.fontSize)*(r+1)+parseFloat(t.fontSize)*(r+1)+"","text-anchor":"start","font-family":t.fontFamily,"font-size":`${t.fontSize}`,"font-weight":`${t.fontWeight}`,fill:`${t.color}`}),a.innerHTML=c,s.appendChild(a)}),s}function ao(e,t,n,o){let s="";e.nodeObj?.dangerouslySetInnerHTML?s=e.nodeObj.dangerouslySetInnerHTML:e.text?s=e.text.textContent:s=e.childNodes[0].textContent;const i=document.createElementNS(k,"foreignObject");_(i,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+"",width:t.width,height:t.height});const l=document.createElement("div");return _(l,{xmlns:"http://www.w3.org/1999/xhtml",style:`font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`}),l.innerHTML=s,i.appendChild(l),i}function ho(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:s}=L(e.nodes,t),i=document.createElementNS(k,"rect");return _(i,{x:o+"",y:s+"",rx:n.borderRadius,ry:n.borderRadius,width:n.width,height:n.height,fill:n.backgroundColor,stroke:n.borderColor,"stroke-width":n.borderWidth}),i}function ce(e,t,n=!1){const o=getComputedStyle(t),{offsetLeft:s,offsetTop:i}=L(e.nodes,t),l=document.createElementNS(k,"rect");_(l,{x:s+"",y:i+"",rx:o.borderRadius,ry:o.borderRadius,width:o.width,height:o.height,fill:o.backgroundColor,stroke:o.borderColor,"stroke-width":o.borderWidth});const c=document.createElementNS(k,"g");c.appendChild(l);let r;return n?r=ao(t,o,s,i):r=co(t,o,s,i),c.appendChild(r),c}function fo(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:s}=L(e.nodes,t),i=document.createElementNS(k,"a"),l=document.createElementNS(k,"text");return _(l,{x:o+"",y:s+parseInt(n.fontSize)+"","text-anchor":"start","font-family":n.fontFamily,"font-size":`${n.fontSize}`,"font-weight":`${n.fontWeight}`,fill:`${n.color}`}),l.innerHTML=t.textContent,i.appendChild(l),i.setAttribute("href",t.href),i}function uo(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:s}=L(e.nodes,t),i=document.createElementNS(k,"image");return _(i,{x:o+"",y:s+"",width:n.width+"",height:n.height+"",href:t.src}),i}const ae=100,po='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',go=(e,t=!1)=>{const n=e.nodes,o=n.offsetHeight+ae*2,s=n.offsetWidth+ae*2,i=ro(o+"px",s+"px"),l=document.createElementNS(k,"svg"),c=document.createElementNS(k,"rect");_(c,{x:"0",y:"0",width:`${s}`,height:`${o}`,fill:e.theme.cssVar["--bgcolor"]}),i.appendChild(c),n.querySelectorAll(".subLines").forEach(h=>{const u=h.cloneNode(!0),{offsetLeft:p,offsetTop:v}=L(n,h.parentElement);u.setAttribute("x",`${p}`),u.setAttribute("y",`${v}`),l.appendChild(u)});const r=n.querySelector(".lines")?.cloneNode(!0);r&&l.appendChild(r);const a=n.querySelector(".topiclinks")?.cloneNode(!0);a&&l.appendChild(a);const d=n.querySelector(".summary")?.cloneNode(!0);return d&&l.appendChild(d),n.querySelectorAll("me-tpc").forEach(h=>{h.nodeObj.dangerouslySetInnerHTML?l.appendChild(ce(e,h,!t)):(l.appendChild(ho(e,h)),l.appendChild(ce(e,h.text,!t)))}),n.querySelectorAll(".tags > span").forEach(h=>{l.appendChild(ce(e,h))}),n.querySelectorAll(".icons > span").forEach(h=>{l.appendChild(ce(e,h))}),n.querySelectorAll(".hyper-link").forEach(h=>{l.appendChild(fo(e,h))}),n.querySelectorAll("img").forEach(h=>{l.appendChild(uo(e,h))}),_(l,{x:ae+"",y:ae+"",overflow:"visible"}),i.appendChild(l),i},mo=(e,t)=>(t&&e.insertAdjacentHTML("afterbegin","<style>"+t+"</style>"),po+e.outerHTML);function yo(e){return new Promise((t,n)=>{const o=new FileReader;o.onload=s=>{t(s.target.result)},o.onerror=s=>{n(s)},o.readAsDataURL(e)})}const bo=Object.freeze(Object.defineProperty({__proto__:null,exportPng:async function(e=!1,t){const n=this.exportSvg(e,t),o=await yo(n);return new Promise((s,i)=>{const l=new Image;l.setAttribute("crossOrigin","anonymous"),l.onload=()=>{const c=document.createElement("canvas");c.width=l.width,c.height=l.height,c.getContext("2d").drawImage(l,0,0),c.toBlob(s,"image/png",1)},l.src=o,l.onerror=i})},exportSvg:function(e=!1,t){const n=go(this,e),o=mo(n,t);return new Blob([o],{type:"image/svg+xml"})}},Symbol.toStringTag,{value:"Module"}));function vo(e,t){return async function(...n){const o=this.before[t];o&&!await o.apply(this,n)||e.apply(this,n)}}const ut=Object.keys(Be),pt={};for(let e=0;e<ut.length;e++){const t=ut[e];pt[t]=vo(Be[t],t)}const xo={getObjById:ee,generateNewObj:bt,layout:_t,linkDiv:Nn,editTopic:Ot,createWrapper:Lt,createParent:At,createChildren:Mt,createTopic:Pt,findEle:He,changeTheme:Wn,changeCompact:Yn,...hn,...pt,...eo,...io,...bo,init(e){if(e=JSON.parse(JSON.stringify(e)),!e||!e.nodeData)return new Error("MindElixir: `data` is required");e.direction!==void 0&&(this.direction=e.direction),e.compact!==void 0&&(this.compact=e.compact),this.changeTheme(e.theme||this.theme,!1),e.meta&&(this.meta=e.meta),this.nodeData=e.nodeData,R(this.nodeData),this.arrows=e.arrows||[],this.summaries=e.summaries||[],this.tidyArrow(),this.toolBar&&Pn(this),this.keypress&&wn(this,this.keypress),Bn(this),this.disposable.push(Tt()),this.contextMenu&&this.disposable.push(_n(this,this.contextMenu)),this.allowUndo&&this.disposable.push(Dn(this)),this.layout(),this.linkDiv(),this.toCenter()},destroy(){this.disposable.forEach(e=>e()),this.el&&(this.el.innerHTML=""),this.el=void 0,this.nodeData=void 0,this.arrows=void 0,this.summaries=void 0,this.currentArrow=void 0,this.currentNodes=void 0,this.currentSummary=void 0,this.theme=void 0,this.direction=void 0,this.bus=void 0,this.container=void 0,this.map=void 0,this.lines=void 0,this.linkController=void 0,this.arrowSvg=void 0,this.P2=void 0,this.P3=void 0,this.line1=void 0,this.line2=void 0,this.nodes=void 0,this.selection?.destroy(),this.selection=void 0},enableMobileMultiSelect(e){this.mobileMultiSelect=e}},wo="5.14.0";function Eo(e){return{x:0,y:0,moved:!1,mousedown:!1,handlePointerDown(t){this.moved=!1;const n=t.target,o=e.mouseSelectionButton===0?2:0,s=e.spacePressed&&t.button===0&&t.pointerType==="mouse",i=!e.editable||t.button===o&&t.pointerType==="mouse"||t.pointerType==="touch";!s&&!i||(this.x=t.clientX,this.y=t.clientY,n.className!=="circle"&&n.contentEditable!=="plaintext-only"&&(this.mousedown=!0,n.setPointerCapture(t.pointerId)))},handlePointerMove(t){if(!this.mousedown||t.target.contentEditable==="plaintext-only"&&!e.spacePressed)return!1;const n=t.clientX-this.x,o=t.clientY-this.y;return this.x=t.clientX,this.y=t.clientY,this.moved=!0,e.move(n,o),!0},handlePointerUp(t){if(!this.mousedown)return;const n=t.target;n.hasPointerCapture&&n.hasPointerCapture(t.pointerId)&&n.releasePointerCapture(t.pointerId),this.mousedown=!1},clear(){this.mousedown=!1,this.moved=!1}}}function A({el:e,direction:t,editable:n,contextMenu:o,toolBar:s,keypress:i,mouseSelectionButton:l,selectionContainer:c,before:r,newTopicName:a,allowUndo:d,generateMainBranch:h,generateSubBranch:u,overflowHidden:p,compact:v,theme:m,alignment:y,scaleSensitivity:g,scaleMax:x,scaleMin:E,handleWheel:N,markdown:f,imageProxy:b,pasteHandler:w,mobileMultiSelect:S}){let C=null;const T=Object.prototype.toString.call(e);if(T==="[object HTMLDivElement]"?C=e:T==="[object String]"&&(C=document.querySelector(e)),!C)throw new Error("MindElixir: el is not a valid element");C.style.position="relative",C.innerHTML="",this.el=C,this.disposable=[],this.before=r||{},this.newTopicName=a||"New Node",this.contextMenu=o??!0,this.toolBar=s??!0,this.keypress=i??!0,this.mouseSelectionButton=l??0,this.direction=t??1,this.editable=n??!0,this.allowUndo=d??!0,this.scaleSensitivity=g??.1,this.scaleMax=x??1.4,this.scaleMin=E??.2,this.generateMainBranch=h||st,this.generateSubBranch=u||it,this.overflowHidden=p??!1,this.compact=v??!1,this.alignment=y??"root",this.handleWheel=N??!0,this.markdown=f||void 0,this.imageProxy=b||void 0,this.currentNodes=[],this.currentArrow=null,this.scaleVal=1,this.tempDirection=null,this.mobileMultiSelect=S??!1,this.panHelper=Eo(this),this.bus=Cn(),this.container=document.createElement("div"),this.selectionContainer=c||this.container,this.container.className="map-container";const D=window.matchMedia("(prefers-color-scheme: dark)");this.theme=m||(D.matches?Q:Z);const M=document.createElement("div");M.className="map-canvas",this.map=M,this.container.setAttribute("tabindex","0"),this.container.appendChild(this.map),this.el.appendChild(this.container),this.nodes=document.createElement("me-nodes"),this.lines=U("lines"),this.summarySvg=U("summary"),this.linkController=U("linkcontroller"),this.P2=document.createElement("div"),this.P3=document.createElement("div"),this.P2.className=this.P3.className="circle",this.P2.style.display=this.P3.style.display="none",this.line1=Ve(),this.line2=Ve(),this.linkController.appendChild(this.line1),this.linkController.appendChild(this.line2),this.arrowSvg=U("topiclinks"),this.labelContainer=document.createElement("div"),this.labelContainer.className="label-container",this.map.appendChild(this.nodes),this.overflowHidden?this.container.style.overflow="hidden":this.disposable.push(En(this)),w&&(this.pasteHandler=w)}return A.prototype=xo,Object.defineProperty(A.prototype,"currentNode",{get(){return this.currentNodes[this.currentNodes.length-1]},enumerable:!0}),A.LEFT=0,A.RIGHT=1,A.SIDE=2,A.THEME=Z,A.DARK_THEME=Q,A.version=wo,A.E=He,A.new=e=>({nodeData:{id:B(),topic:e||"new topic",children:[]}}),$.DARK_THEME=Q,$.LEFT=0,$.RIGHT=1,$.SIDE=2,$.THEME=Z,$.default=A,Object.defineProperties($,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),$})({});
@@ -432,11 +432,11 @@ function Ht(e, t, n) {
432
432
  const { siblings: o, index: s } = z(n);
433
433
  o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
434
434
  }
435
- function It(e, t) {
435
+ function jt(e, t) {
436
436
  const { siblings: n, index: o } = z(e);
437
437
  n !== void 0 && (n[o] = t, t.children = [e]);
438
438
  }
439
- function jt(e, t, n) {
439
+ function It(e, t, n) {
440
440
  if (et(t), n.parent?.parent || (t.direction = n.direction), e === "in")
441
441
  n.children ? n.children.push(t) : n.children = [t];
442
442
  else {
@@ -532,7 +532,7 @@ const Rt = function({ map: e, direction: t }, n) {
532
532
  if (!o.parent)
533
533
  return;
534
534
  const s = t || this.generateNewObj();
535
- It(o, s), B(this.nodeData);
535
+ jt(o, s), B(this.nodeData);
536
536
  const i = n.parentElement.parentElement, { grp: l, top: c } = this.createWrapper(s, !0);
537
537
  c.appendChild(xe(!0)), i.insertAdjacentElement("afterend", l);
538
538
  const r = this.createChildren([i]);
@@ -612,7 +612,7 @@ const Rt = function({ map: e, direction: t }, n) {
612
612
  const i = [];
613
613
  for (const c of e) {
614
614
  const r = c.nodeObj;
615
- if (jt(t, r, s), B(o.nodeData), t === "in") {
615
+ if (It(t, r, s), B(o.nodeData), t === "in") {
616
616
  const a = c.parentElement;
617
617
  tt(o, n, a.parentElement);
618
618
  } else {
@@ -840,7 +840,7 @@ const nn = function(e, t = !1) {
840
840
  if (!n || !n.nodeObj.parent) return;
841
841
  const s = t + "Sibling", i = n.parentElement.parentElement[s];
842
842
  i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
843
- }, Ie = function(e, t, n) {
843
+ }, je = function(e, t, n) {
844
844
  const o = t === "in" ? e.scaleSensitivity : -e.scaleSensitivity;
845
845
  st(e, o, n);
846
846
  }, On = (e, t) => {
@@ -910,10 +910,10 @@ function $n(e, t) {
910
910
  e.moveDownNode();
911
911
  },
912
912
  "=": (r) => {
913
- (r.metaKey || r.ctrlKey) && Ie(e, "in");
913
+ (r.metaKey || r.ctrlKey) && je(e, "in");
914
914
  },
915
915
  "-": (r) => {
916
- (r.metaKey || r.ctrlKey) && Ie(e, "out");
916
+ (r.metaKey || r.ctrlKey) && je(e, "out");
917
917
  },
918
918
  0: (r) => {
919
919
  if (r.metaKey || r.ctrlKey) {
@@ -1103,7 +1103,7 @@ function Hn(e) {
1103
1103
  l.handlePointerMove(f);
1104
1104
  break;
1105
1105
  case i.DragWait:
1106
- r.handleMove(f), r.timer === null && (e.ptState = i.Idle);
1106
+ r.handleMove(f), r.timer === null && (e.ptState = i.Pan, t.handlePointerMove(f));
1107
1107
  break;
1108
1108
  case i.Drag:
1109
1109
  Ct(e, c, f);
@@ -1157,7 +1157,7 @@ function Hn(e) {
1157
1157
  { dom: n, evt: "keyup", func: E }
1158
1158
  ]);
1159
1159
  }
1160
- function In() {
1160
+ function jn() {
1161
1161
  return {
1162
1162
  handlers: {},
1163
1163
  addListener: function(e, t) {
@@ -1201,10 +1201,10 @@ const M = "http://www.w3.org/2000/svg", le = function(e) {
1201
1201
  }, q = function(e) {
1202
1202
  const t = document.createElementNS(M, "svg");
1203
1203
  return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
1204
- }, je = function() {
1204
+ }, Ie = function() {
1205
1205
  const e = document.createElementNS(M, "line");
1206
1206
  return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
1207
- }, jn = function(e, t, n, o) {
1207
+ }, In = function(e, t, n, o) {
1208
1208
  const s = document.createElementNS(M, "g");
1209
1209
  return [
1210
1210
  {
@@ -1560,7 +1560,7 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e },
1560
1560
  case "shift":
1561
1561
  return e.shiftKey;
1562
1562
  }
1563
- }) : !1), { abs: j, max: Ye, min: Xe, ceil: Fe } = Math, Ke = (e = []) => ({
1563
+ }) : !1), { abs: I, max: Ye, min: Xe, ceil: Fe } = Math, Ke = (e = []) => ({
1564
1564
  stored: e,
1565
1565
  selected: [],
1566
1566
  touched: [],
@@ -1712,8 +1712,8 @@ class ro extends to {
1712
1712
  } = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } = Q(t);
1713
1713
  if (
1714
1714
  // Single number for both coordinates
1715
- typeof s == "number" && j(c + r - (i + l)) >= s || // Different x and y threshold
1716
- typeof s == "object" && j(c - i) >= s.x || j(r - l) >= s.y
1715
+ typeof s == "number" && I(c + r - (i + l)) >= s || // Different x and y threshold
1716
+ typeof s == "object" && I(c - i) >= s.x || I(r - l) >= s.y
1717
1717
  ) {
1718
1718
  if (O(o, ["pointermove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
1719
1719
  O(o, ["pointerup", "pointercancel"], this._onTapStop);
@@ -1786,7 +1786,7 @@ class ro extends to {
1786
1786
  scrolling: { startScrollMargins: d }
1787
1787
  }
1788
1788
  } = s;
1789
- r < i.left + d.x ? (t.x = -j(i.left - r + d.x), r = r < i.left ? i.left : r) : r > i.right - d.x ? (t.x = j(i.left + i.width - r - d.x), r = r > i.right ? i.right : r) : t.x = 0, a < i.top + d.y ? (t.y = -j(i.top - a + d.y), a = a < i.top ? i.top : a) : a > i.bottom - d.y ? (t.y = j(i.top + i.height - a - d.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
1789
+ r < i.left + d.x ? (t.x = -I(i.left - r + d.x), r = r < i.left ? i.left : r) : r > i.right - d.x ? (t.x = I(i.left + i.width - r - d.x), r = r > i.right ? i.right : r) : t.x = 0, a < i.top + d.y ? (t.y = -I(i.top - a + d.y), a = a < i.top ? i.top : a) : a > i.bottom - d.y ? (t.y = I(i.top + i.height - a - d.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
1790
1790
  const h = Xe(l, r), u = Xe(c, a), p = Ye(l, r), v = Ye(c, a);
1791
1791
  this._areaRect = Be(h, u, p - h, v - u);
1792
1792
  }
@@ -2142,7 +2142,7 @@ function V(e, t, n) {
2142
2142
  ctrlY: d
2143
2143
  };
2144
2144
  }
2145
- function I(e) {
2145
+ function j(e) {
2146
2146
  let t, n;
2147
2147
  const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
2148
2148
  return o > e.h / e.w || o < -e.h / e.w ? e.cy - e.ctrlY < 0 ? (t = e.cx - e.h / 2 / o, n = e.cy + e.h / 2) : (t = e.cx + e.h / 2 / o, n = e.cy - e.h / 2) : e.cx - e.ctrlX < 0 ? (t = e.cx + e.w / 2, n = e.cy - e.w * o / 2) : (t = e.cx - e.w / 2, n = e.cy + e.w * o / 2), {
@@ -2177,7 +2177,7 @@ const ut = function(e, t, n) {
2177
2177
  const C = ut(e, t, n);
2178
2178
  o.delta1 = C.delta1, o.delta2 = C.delta2;
2179
2179
  }
2180
- const i = V(e, t, o.delta1), l = V(e, n, o.delta2), { x: c, y: r } = I(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: p, y: v } = I(l), m = se(h, u, p, v);
2180
+ const i = V(e, t, o.delta1), l = V(e, n, o.delta2), { x: c, y: r } = j(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: p, y: v } = j(l), m = se(h, u, p, v);
2181
2181
  if (!m) return;
2182
2182
  const y = `M ${m.x1} ${m.y1} L ${p} ${v} L ${m.x2} ${m.y2}`;
2183
2183
  let g = "";
@@ -2186,7 +2186,7 @@ const ut = function(e, t, n) {
2186
2186
  if (!C) return;
2187
2187
  g = `M ${C.x1} ${C.y1} L ${c} ${r} L ${C.x2} ${C.y2}`;
2188
2188
  }
2189
- const x = jn(`M ${c} ${r} C ${a} ${d} ${h} ${u} ${p} ${v}`, y, g, o.style), { x: E, y: N } = ft(c, r, a, d, h, u, p, v), f = o.style?.labelColor || "rgb(235, 95, 82)", b = "a-" + o.id;
2189
+ const x = In(`M ${c} ${r} C ${a} ${d} ${h} ${u} ${p} ${v}`, y, g, o.style), { x: E, y: N } = ft(c, r, a, d, h, u, p, v), f = o.style?.labelColor || "rgb(235, 95, 82)", b = "a-" + o.id;
2190
2190
  x.id = b;
2191
2191
  const w = e.markdown ? e.markdown(o.label, o) : o.label, S = he(w, E, N, {
2192
2192
  anchor: "middle",
@@ -2266,14 +2266,14 @@ const ut = function(e, t, n) {
2266
2266
  const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map: d, currentArrow: h, bus: u } = e;
2267
2267
  if (!h) return;
2268
2268
  s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), pt(h, ht);
2269
- let { x: p, y: v } = I(n), { ctrlX: m, ctrlY: y } = n, { ctrlX: g, ctrlY: x } = o, { x: E, y: N } = I(o);
2269
+ let { x: p, y: v } = j(n), { ctrlX: m, ctrlY: y } = n, { ctrlX: g, ctrlY: x } = o, { x: E, y: N } = j(o);
2270
2270
  i.style.cssText = `top:${y}px;left:${m}px;`, l.style.cssText = `top:${x}px;left:${g}px;`, F(c, p, v, m, y), F(r, g, x, E, N), e.helper1 = Ve.create(i), e.helper2 = Ve.create(l), e.helper1.init(d, (f, b) => {
2271
2271
  m = m + f / e.scaleVal, y = y + b / e.scaleVal;
2272
- const w = I({ ...n, ctrlX: m, ctrlY: y });
2272
+ const w = j({ ...n, ctrlX: m, ctrlY: y });
2273
2273
  p = w.x, v = w.y, i.style.top = y + "px", i.style.left = m + "px", ue(h, p, v, m, y, g, x, E, N, t), F(c, p, v, m, y), t.delta1.x = Math.round(m - n.cx), t.delta1.y = Math.round(y - n.cy), u.fire("updateArrowDelta", t);
2274
2274
  }), e.helper2.init(d, (f, b) => {
2275
2275
  g = g + f / e.scaleVal, x = x + b / e.scaleVal;
2276
- const w = I({ ...o, ctrlX: g, ctrlY: x });
2276
+ const w = j({ ...o, ctrlX: g, ctrlY: x });
2277
2277
  E = w.x, N = w.y, l.style.top = x + "px", l.style.left = g + "px", ue(h, p, v, m, y, g, x, E, N, t), F(r, g, x, E, N), t.delta2.x = Math.round(g - o.cx), t.delta2.y = Math.round(x - o.cy), u.fire("updateArrowDelta", t);
2278
2278
  });
2279
2279
  };
@@ -2309,7 +2309,7 @@ const Co = function(e, t) {
2309
2309
  const y = ut(this, s, i);
2310
2310
  e.delta1 = e.delta1 || y.delta1, e.delta2 = e.delta2 || y.delta2;
2311
2311
  }
2312
- const l = V(this, s, e.delta1), c = V(this, i, e.delta2), { x: r, y: a } = I(l), { ctrlX: d, ctrlY: h } = l, { ctrlX: u, ctrlY: p } = c, { x: v, y: m } = I(c);
2312
+ const l = V(this, s, e.delta1), c = V(this, i, e.delta2), { x: r, y: a } = j(l), { ctrlX: d, ctrlY: h } = l, { ctrlX: u, ctrlY: p } = c, { x: v, y: m } = j(c);
2313
2313
  ue(o, r, a, d, h, u, p, v, m, e), this.currentArrow?.arrowObj?.id === e.id && (this.P2.style.cssText = `top:${h}px;left:${d}px;`, this.P3.style.cssText = `top:${p}px;left:${u}px;`, F(this.line1, r, a, d, h), F(this.line2, u, p, v, m));
2314
2314
  }
2315
2315
  }
@@ -2440,7 +2440,7 @@ const Co = function(e, t) {
2440
2440
  selectSummary: Mo,
2441
2441
  unselectSummary: Po
2442
2442
  }, Symbol.toStringTag, { value: "Module" })), _ = "http://www.w3.org/2000/svg";
2443
- function Io(e, t) {
2443
+ function jo(e, t) {
2444
2444
  const n = document.createElementNS(_, "svg");
2445
2445
  return k(n, {
2446
2446
  version: "1.1",
@@ -2449,7 +2449,7 @@ function Io(e, t) {
2449
2449
  width: t
2450
2450
  }), n;
2451
2451
  }
2452
- function jo(e, t) {
2452
+ function Io(e, t) {
2453
2453
  return (parseInt(e) - parseInt(t)) / 2;
2454
2454
  }
2455
2455
  function Ro(e, t, n, o) {
@@ -2460,7 +2460,7 @@ function Ro(e, t, n, o) {
2460
2460
  const a = document.createElementNS(_, "text");
2461
2461
  k(a, {
2462
2462
  x: n + parseInt(t.paddingLeft) + "",
2463
- y: o + parseInt(t.paddingTop) + jo(t.lineHeight, t.fontSize) * (r + 1) + parseFloat(t.fontSize) * (r + 1) + "",
2463
+ y: o + parseInt(t.paddingTop) + Io(t.lineHeight, t.fontSize) * (r + 1) + parseFloat(t.fontSize) * (r + 1) + "",
2464
2464
  "text-anchor": "start",
2465
2465
  "font-family": t.fontFamily,
2466
2466
  "font-size": `${t.fontSize}`,
@@ -2540,7 +2540,7 @@ function Xo(e, t) {
2540
2540
  }), i;
2541
2541
  }
2542
2542
  const te = 100, Fo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">', Ko = (e, t = !1) => {
2543
- const n = e.nodes, o = n.offsetHeight + te * 2, s = n.offsetWidth + te * 2, i = Io(o + "px", s + "px"), l = document.createElementNS(_, "svg"), c = document.createElementNS(_, "rect");
2543
+ const n = e.nodes, o = n.offsetHeight + te * 2, s = n.offsetWidth + te * 2, i = jo(o + "px", s + "px"), l = document.createElementNS(_, "svg"), c = document.createElementNS(_, "rect");
2544
2544
  k(c, {
2545
2545
  x: "0",
2546
2546
  y: "0",
@@ -2642,7 +2642,7 @@ const Zo = {
2642
2642
  enableMobileMultiSelect(e) {
2643
2643
  this.mobileMultiSelect = e;
2644
2644
  }
2645
- }, Qo = "5.14.0-beta.1";
2645
+ }, Qo = "5.14.0";
2646
2646
  function es(e) {
2647
2647
  return {
2648
2648
  x: 0,
@@ -2700,11 +2700,11 @@ function P({
2700
2700
  let C = null;
2701
2701
  const T = Object.prototype.toString.call(e);
2702
2702
  if (T === "[object HTMLDivElement]" ? C = e : T === "[object String]" && (C = document.querySelector(e)), !C) throw new Error("MindElixir: el is not a valid element");
2703
- C.style.position = "relative", C.innerHTML = "", this.el = C, this.disposable = [], this.before = r || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = l ?? 0, this.direction = t ?? 1, this.editable = n ?? !0, this.allowUndo = d ?? !0, this.scaleSensitivity = g ?? 0.1, this.scaleMax = x ?? 1.4, this.scaleMin = E ?? 0.2, this.generateMainBranch = h || at, this.generateSubBranch = u || dt, this.overflowHidden = p ?? !1, this.compact = v ?? !1, this.alignment = y ?? "root", this.handleWheel = N ?? !0, this.markdown = f || void 0, this.imageProxy = b || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.mobileMultiSelect = S ?? !1, this.panHelper = es(this), this.bus = In(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
2703
+ C.style.position = "relative", C.innerHTML = "", this.el = C, this.disposable = [], this.before = r || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = l ?? 0, this.direction = t ?? 1, this.editable = n ?? !0, this.allowUndo = d ?? !0, this.scaleSensitivity = g ?? 0.1, this.scaleMax = x ?? 1.4, this.scaleMin = E ?? 0.2, this.generateMainBranch = h || at, this.generateSubBranch = u || dt, this.overflowHidden = p ?? !1, this.compact = v ?? !1, this.alignment = y ?? "root", this.handleWheel = N ?? !0, this.markdown = f || void 0, this.imageProxy = b || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.mobileMultiSelect = S ?? !1, this.panHelper = es(this), this.bus = jn(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
2704
2704
  const D = window.matchMedia("(prefers-color-scheme: dark)");
2705
2705
  this.theme = m || (D.matches ? ge : pe);
2706
2706
  const L = document.createElement("div");
2707
- L.className = "map-canvas", this.map = L, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = q("lines"), this.summarySvg = q("summary"), this.linkController = q("linkcontroller"), this.P2 = document.createElement("div"), this.P3 = document.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = je(), this.line2 = je(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.arrowSvg = q("topiclinks"), this.labelContainer = document.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Hn(this)), w && (this.pasteHandler = w);
2707
+ L.className = "map-canvas", this.map = L, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = q("lines"), this.summarySvg = q("summary"), this.linkController = q("linkcontroller"), this.P2 = document.createElement("div"), this.P3 = document.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Ie(), this.line2 = Ie(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.arrowSvg = q("topiclinks"), this.labelContainer = document.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Hn(this)), w && (this.pasteHandler = w);
2708
2708
  }
2709
2709
  P.prototype = Zo;
2710
2710
  Object.defineProperty(P.prototype, "currentNode", {