UNPKG

mind-elixir

Version:

Mind elixir is a free open source mind map core.

1,408 lines 117 kB
const os = 0, ss = 1, is = 2, Se = { name: "Latte", type: "light", palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"], cssVar: { "--node-gap-x": "30px", "--node-gap-y": "10px", "--main-gap-x": "65px", "--main-gap-y": "45px", "--root-radius": "30px", "--main-radius": "20px", "--root-color": "#ffffff", "--root-bgcolor": "#4c4f69", "--root-border-color": "rgba(0, 0, 0, 0)", "--main-color": "#444446", "--main-bgcolor": "#ffffff", "--main-bgcolor-transparent": "rgba(255, 255, 255, 0.8)", "--topic-padding": "3px", "--color": "#777777", "--bgcolor": "#f6f6f6", "--selected": "#4dc4ff", "--accent-color": "#e64553", "--panel-color": "#444446", "--panel-bgcolor": "#ffffff", "--panel-border-color": "#eaeaea", "--map-padding": "50px 80px" } }, Ne = { name: "Dark", type: "dark", palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"], cssVar: { "--node-gap-x": "30px", "--node-gap-y": "10px", "--main-gap-x": "65px", "--main-gap-y": "45px", "--root-radius": "30px", "--main-radius": "20px", "--root-color": "#ffffff", "--root-bgcolor": "#2d3748", "--root-border-color": "rgba(255, 255, 255, 0.1)", "--main-color": "#ffffff", "--main-bgcolor": "#4c4f69", "--main-bgcolor-transparent": "rgba(76, 79, 105, 0.8)", "--topic-padding": "3px", "--color": "#cccccc", "--bgcolor": "#252526", "--selected": "#4dc4ff", "--accent-color": "#789AFA", "--panel-color": "#ffffff", "--panel-bgcolor": "#2d3748", "--panel-border-color": "#696969", "--map-padding": "50px 80px" } }; function we(e) { return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/"/g, "&quot;"); } const he = function(e, t) { if (t.id === e) return t; if (t.children && t.children.length) { for (let n = 0; n < t.children.length; n++) { const o = he(e, t.children[n]); if (o) return o; } return null; } else return null; }, q = (e, t) => { if (e.parent = t, e.children) for (let n = 0; n < e.children.length; n++) q(e.children[n], e); }, Q = (e, t, n) => { if (e.expanded = t, e.children) if (n === void 0 || n > 0) { const o = n !== void 0 ? n - 1 : void 0; e.children.forEach((s) => { Q(s, t, o); }); } else e.children.forEach((o) => { Q(o, !1); }); }; function ke(e) { if (e.id = V(), e.children) for (let t = 0; t < e.children.length; t++) ke(e.children[t]); } function fe(e, t, n, o) { const s = n - e, i = o - t, c = Math.atan2(i, s) * 180 / Math.PI, r = 12, a = 30, d = (c + 180 - a) * Math.PI / 180, h = (c + 180 + a) * Math.PI / 180; return { x1: n + Math.cos(d) * r, y1: o + Math.sin(d) * r, x2: n + Math.cos(h) * r, y2: o + Math.sin(h) * r }; } function V() { return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16); } const wt = function() { const e = V(); return { topic: this.newTopicName, id: e }; }; function Te(e) { return JSON.parse( JSON.stringify(e, (n, o) => { if (n !== "parent") return o; }) ); } const H = (e, t) => { let n = 0, o = 0; for (; t && t !== e; ) n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent; return { offsetLeft: n, offsetTop: o }; }, A = (e, t) => { for (const n in t) e.setAttribute(n, t[n]); }, de = (e) => e ? e.tagName === "ME-TPC" : !1, _e = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => { for (let s = 0; s < o.length; s++) { if (t === o[s]) continue; const { parent: i } = t.nodeObj; if (i === o[s].nodeObj) return !1; } return !0; }), Le = (e) => { const t = /translate3d\(([^,]+),\s*([^,]+)/, n = e.match(t); return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 }; }, st = function(e) { for (let t = 0; t < e.length; t++) { const { dom: n, evt: o, func: s } = e[t]; n.addEventListener(o, s); } return function() { for (let n = 0; n < e.length; n++) { const { dom: o, evt: s, func: i } = e[n]; o.removeEventListener(s, i); } }; }, Re = (e, t) => { const n = e.x - t.x, o = e.y - t.y; return Math.sqrt(n * n + o * o); }, I = { LHS: "lhs", RHS: "rhs" }, ue = document, xt = function() { this.nodes.innerHTML = ""; const e = this.createTopic(this.nodeData); Ae.call(this, e, this.nodeData), e.draggable = !1; const t = ue.createElement("me-root"); t.appendChild(e); const n = this.nodeData.children || []; if (this.direction === 2) { let o = 0, s = 0; n.map((i) => { i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1); }); } Ct(this, n, t); }, Ct = function(e, t, n) { const o = ue.createElement("me-main"); o.className = I.LHS; const s = ue.createElement("me-main"); s.className = I.RHS; for (let i = 0; i < t.length; i++) { const l = t[i], { grp: c } = e.createWrapper(l); e.direction === 2 ? l.direction === 0 ? o.appendChild(c) : s.appendChild(c) : e.direction === 0 ? o.appendChild(c) : s.appendChild(c); } e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer); }, Et = function(e, t) { const n = ue.createElement("me-children"); for (let o = 0; o < t.length; o++) { const s = t[o], { grp: i } = e.createWrapper(s); n.appendChild(i); } return n; }, P = document, it = function(e, t) { const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`); if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`); return o; }, Ae = function(e, t) { if (e.innerHTML = "", t.style) { const n = t.style; for (const o in n) e.style[o] = n[o]; } if (t.dangerouslySetInnerHTML) { e.innerHTML = t.dangerouslySetInnerHTML; return; } if (t.image) { const n = t.image; if (n.url && n.width && n.height) { const o = P.createElement("img"); o.src = this.imageProxy ? this.imageProxy(n.url) : n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), e.appendChild(o), e.image = o; } } else e.image && (e.image = void 0); { const n = P.createElement("span"); n.className = "text", this.markdown ? n.innerHTML = this.markdown(t.topic, t) : n.textContent = t.topic, e.appendChild(n), e.text = n; } if (t.hyperLink) { const n = P.createElement("a"); n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.link = n; } else e.link && (e.link = void 0); if (t.icons && t.icons.length) { const n = P.createElement("span"); n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${we(o)}</span>`).join(""), e.appendChild(n), e.icons = n; } else e.icons && (e.icons = void 0); if (t.tags && t.tags.length) { const n = P.createElement("div"); n.className = "tags", t.tags.forEach((o) => { const s = P.createElement("span"); typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s); }), e.appendChild(n), e.tags = n; } else e.tags && (e.tags = void 0); }, St = function(e, t) { const n = P.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e); if (n.appendChild(o), !t && e.children && e.children.length > 0) { const i = De(e.expanded); if (o.appendChild(i), e.expanded !== !1) { const l = Et(this, e.children); n.appendChild(l); } } return { grp: n, top: o, tpc: s }; }, Nt = function(e) { const t = P.createElement("me-parent"), n = this.createTopic(e); return Ae.call(this, n, e), t.appendChild(n), { p: t, tpc: n }; }, kt = function(e) { const t = P.createElement("me-children"); return t.append(...e), t; }, Tt = function(e) { const t = P.createElement("me-tpc"); return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t; }; function rt(e) { const t = P.createRange(); t.selectNodeContents(e); const n = window.getSelection(); n && (n.removeAllRanges(), n.addRange(t)); } const _t = function(e) { if (!e) return; const t = P.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = H(this.nodes, e); this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1; const l = getComputedStyle(e); t.style.cssText = ` left: ${s}px; top: ${i}px; min-width:${e.offsetWidth - 8}px; color:${l.color}; font-size:${l.fontSize}; padding:${l.padding}; margin:${l.margin}; background-color:${l.backgroundColor !== "rgba(0, 0, 0, 0)" && l.backgroundColor}; border: ${l.border}; border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"), rt(t), this.bus.fire("operation", { name: "beginEdit", obj: e.nodeObj }), t.addEventListener("keydown", (c) => { c.stopPropagation(); const r = c.key; if (r === "Enter" || r === "Tab") { if (c.shiftKey) return; c.preventDefault(), t.blur(), this.container.focus(); } }), t.addEventListener("blur", () => { if (!t) return; t.remove(); const c = t.textContent?.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 })); }); }, De = function(e) { const t = P.createElement("me-epd"); return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t; }, te = (e) => { const t = e.parent?.children, n = t?.indexOf(e) ?? 0; return { siblings: t, index: n }; }; function Lt(e) { const { siblings: t, index: n } = te(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 At(e) { const { siblings: t, index: n } = te(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 lt(e) { const { siblings: t, index: n } = te(e); return t === void 0 ? 0 : (t.splice(n, 1), t.length); } function Dt(e, t, n) { const { siblings: o, index: s } = te(n); o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e)); } function Mt(e, t) { const { siblings: n, index: o } = te(e); n !== void 0 && (n[o] = t, t.children = [e]); } function Pt(e, t, n) { if (lt(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 } = te(n); if (o === void 0) return; e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t); } } const Ot = 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); } }, ct = function(e, t, n) { const o = n.children[0].children[0], s = t.parentElement; if (s.tagName === "ME-PARENT") { if (se(o), s.children[1]) s.nextSibling.appendChild(n); else { const i = e.createChildren([n]); s.appendChild(De(!0)), s.insertAdjacentElement("afterend", i); } e.linkDiv(n.offsetParent); } else s.tagName === "ME-ROOT" && (Ot(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv()); }, $t = 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(); }, at = { before: "beforebegin", after: "afterend" }, se = function(e) { const n = e.parentElement.parentElement.lastElementChild; n?.tagName === "svg" && n?.remove(); }, jt = function(e, t) { const n = e.nodeObj, o = Te(n); o.style && t.style && (t.style = Object.assign(o.style, t.style)); const s = Object.assign(n, t); Ae.call(this, e, s), this.linkDiv(), this.bus.fire("operation", { name: "reshapeNode", obj: s, origin: o }); }, Me = 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], q(e.nodeData); const { grp: i, top: l } = e.createWrapper(s); return ct(e, t, i), { newTop: l, newNodeObj: s }; }, Ht = 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 === I.LHS ? 0 : 1; i.direction = a; } Dt(i, e, s), q(this.nodeData); const l = o.parentElement, { grp: c, top: r } = this.createWrapper(i); l.parentElement.insertAdjacentElement(at[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); }, Rt = function(e, t) { const n = e || this.currentNode; if (!n) return; se(n); const o = n.nodeObj; if (!o.parent) return; const s = t || this.generateNewObj(); Mt(o, s), q(this.nodeData); const i = n.parentElement.parentElement, { grp: l, top: c } = this.createWrapper(s, !0); c.appendChild(De(!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 }); }, It = function(e, t) { const n = e || this.currentNode; if (!n) return; const o = Me(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); }, Bt = function(e, t) { const n = Te(e.nodeObj); ke(n); const o = Me(this, t, n); if (!o) return; const { newNodeObj: s } = o; this.selectNode(this.findEle(s.id)), this.bus.fire("operation", { name: "copyNode", obj: s }); }, Ft = function(e, t) { const n = []; for (let o = 0; o < e.length; o++) { const s = e[o], i = Te(s.nodeObj); ke(i); const l = Me(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 }); }, Yt = function(e) { const t = e || this.currentNode; if (!t) return; const n = t.nodeObj; Lt(n); const o = t.parentNode.parentNode; o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", { name: "moveUpNode", obj: n }); }, Wt = function(e) { const t = e || this.currentNode; if (!t) return; const n = t.nodeObj; At(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 }); }, Xt = function(e) { if (e.length === 0) return; e = _e(e); for (const n of e) { const o = n.nodeObj, s = lt(o); $t(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) }); }, Pe = (e, t, n, o) => { e = _e(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 (Pt(t, r, s), q(o.nodeData), t === "in") { const a = c.parentElement; ct(o, n, a.parentElement); } else { se(c); const a = c.parentElement.parentNode; i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(at[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 }); }, zt = function(e, t) { Pe(e, "in", t, this); }, Gt = function(e, t) { Pe(e, "before", t, this); }, qt = function(e, t) { Pe(e, "after", t, this); }, Vt = function(e) { const t = e || this.currentNode; t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t)); }, Kt = function(e, t) { e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv(); }, dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, addChild: It, beginEdit: Vt, copyNode: Bt, copyNodes: Ft, insertParent: Rt, insertSibling: Ht, moveDownNode: Wt, moveNodeAfter: qt, moveNodeBefore: Gt, moveNodeIn: zt, moveUpNode: Yt, removeNodes: Xt, reshapeNode: jt, rmSubline: se, setNodeTopic: Kt }, Symbol.toStringTag, { value: "Module" })); function Ut(e) { return { nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData, arrows: e.arrows, summaries: e.summaries, direction: e.direction, theme: e.theme }; } const Jt = function(e) { const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect(); if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) { const i = n.left + n.width / 2, l = n.top + n.height / 2, c = o.left + o.width / 2, r = o.top + o.height / 2, a = i - c, d = l - r; this.move(-a, -d, !0); } }, Zt = function(e, t, n) { this.clearSelection(), this.scrollIntoView(e), this.selection?.select(e), t && this.bus.fire("selectNewNode", e.nodeObj); }, Qt = function(e) { this.selection?.select(e); }, en = function(e) { this.selection?.deselect(e); }, tn = function() { this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow(); }, Oe = function(e) { return JSON.stringify(e, (t, n) => { if (!(t === "parent" && typeof n != "string")) return n; }); }, nn = function() { const e = Ut(this); return Oe(e); }, on = function() { return JSON.parse(this.getDataString()); }, sn = function() { this.editable = !0; }, rn = function() { this.editable = !1; }, ln = 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 } = $e(this), c = this.map.style.transform, { x: r, y: a } = Le(c), d = r - i, h = a - l, u = this.scaleVal, y = (-o + d) * (1 - e / u), v = (-s + h) * (1 - e / u); this.map.style.transform = `translate3d(${r - y}px, ${a - v}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e); }, cn = 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 } = $e(this, !0); this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n); }, an = 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 } = Le(r); const h = l.getBoundingClientRect(), u = c.getBoundingClientRect(), y = u.left < h.right && u.right > h.left, v = u.top < h.bottom && u.bottom > h.top; if (y) { const p = u.left + e, g = u.right + e; (p >= h.right || g <= h.left) && (e = 0); } if (v) { const p = u.top + t, g = u.bottom + t; (p >= h.bottom || g <= 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 }); }, $e = (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 }; }, dn = function() { const { map: e, container: t } = this, { dx: n, dy: o } = $e(this); t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`; }, hn = function(e) { e(this); }, fn = 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()); }, un = function() { this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter()); }, pn = function() { this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction); }, gn = function() { this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction); }, mn = function() { this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction); }, yn = function(e) { this.locale = e, this.refresh(); }, vn = 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" : "", se(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); }, bn = function(e, t) { const n = e.nodeObj, o = e.getBoundingClientRect(), s = { x: o.left, y: o.top }; Q(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); }, wn = function(e) { this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), q(this.nodeData), this.layout(), this.linkDiv(); }, xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, cancelFocus: un, clearSelection: tn, disableEdit: rn, enableEdit: sn, expandNode: vn, expandNodeAll: bn, focusNode: fn, getData: on, getDataString: nn, initLeft: pn, initRight: gn, initSide: mn, install: hn, move: an, refresh: wn, scale: ln, scaleFit: cn, scrollIntoView: Jt, selectNode: Zt, selectNodes: Qt, setLocale: yn, stringifyData: Oe, toCenter: dn, unselectNodes: en }, Symbol.toStringTag, { value: "Module" })), Ie = "MIND-ELIXIR-WAIT-COPY", Cn = (e) => { const t = e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc"); e.selectNode(t[Math.ceil(t.length / 2) - 1]); }, En = (e) => { const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc"); e.selectNode(t[Math.ceil(t.length / 2) - 1]); }, Sn = (e) => { e.selectNode(e.map.querySelector("me-root>me-tpc")); }, Nn = function(e, t) { const n = t.parentElement.parentElement.parentElement.previousSibling; if (n) { const o = n.firstChild; e.selectNode(o); } }, kn = function(e, t) { const n = t.parentElement.nextSibling; if (n && n.firstChild) { const o = n.firstChild.firstChild.firstChild; e.selectNode(o); } }, Be = 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 ? kn(e, n) : o.parent?.parent ? Nn(e, n) : Sn(e) : t === I.LHS ? Cn(e) : En(e); }, Fe = 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); }, J = function(e, t, n) { const { scaleVal: o, scaleSensitivity: s } = e; switch (t) { case "in": e.scale(o + s, n); break; case "out": e.scale(o - s, n); } }; function Tn(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) Q(d, !1); if (r.key === "=") for (const d of a.children) Q(d, !0); if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key)) for (const d of a.children) Q(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(); Fe(e, "previous"); } }, ArrowDown: (r) => { r.altKey ? e.moveDownNode() : Fe(e, "next"); }, ArrowLeft: (r) => { if (r.metaKey || r.ctrlKey) return e.initLeft(); Be(e, I.LHS); }, ArrowRight: (r) => { if (r.metaKey || r.ctrlKey) return e.initRight(); Be(e, I.RHS); }, PageUp: () => e.moveUpNode(), PageDown: () => { e.moveDownNode(); }, "=": (r) => { (r.metaKey || r.ctrlKey) && J(e, "in"); }, "-": (r) => { (r.metaKey || r.ctrlKey) && J(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 = _e(e.currentNodes).map((h) => h.nodeObj), d = Oe({ magic: Ie, 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 === Ie && Array.isArray(d.data)) { const h = d.data, u = h.map((y) => ({ nodeObj: y })); h.length > 0 && e.currentNode && (e.copyNodes(u, e.currentNode), r.preventDefault()); return; } } catch { } e.pasteHandler && e.pasteHandler(r); }); } const xe = document, _n = function(e, t) { if (!t) return ge(e), e; let n = e.querySelector(".insert-preview"); const o = `insert-preview ${t} show`; return n || (n = xe.createElement("div"), e.appendChild(n)), n.className = o, e; }, ge = function(e) { if (!e) return; const t = e.querySelectorAll(".insert-preview"); for (const n of t || []) n.remove(); }, Ye = function(e, t) { for (const n of t) { const o = n.parentElement.parentElement.contains(e); if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1; } return !0; }, Ln = function(e) { const t = document.createElement("div"); return t.className = "mind-elixir-ghost", e.container.appendChild(t), t; }; class An { mind; isMoving = !1; interval = null; speed = 20; constructor(t) { this.mind = t; } move(t, n) { this.isMoving || (this.isMoving = !0, this.interval = setInterval(() => { this.mind.move(t * this.speed * this.mind.scaleVal, n * this.speed * this.mind.scaleVal); }, 100)); } stop() { this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null); } } function Dn(e) { return { isDragging: !1, insertType: null, meet: null, ghost: Ln(e), edgeMoveController: new An(e), startX: 0, startY: 0, pointerId: null }; } const Mn = 5; function We(e, t, n, o = !1) { if (e.spacePressed) return !1; const s = n.target; if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1; t.startX = n.clientX, t.startY = n.clientY, t.pointerId = n.pointerId, e.selection?.cancel(); let i = e.currentNodes; return i?.includes(s) || (e.selectNode(s), i = e.currentNodes), e.dragged = i, o && ft(e, t), !0; } function ht(e, t, n) { e.style.transform = `translate(${t + 10}px, ${n + 10}px)`, e.style.display = "block"; } function ft(e, t) { const { dragged: n } = e; if (!n) return; const o = document.activeElement; o && o.isContentEditable && o.blur(), t.isDragging = !0, n.length > 1 ? t.ghost.innerHTML = n.length + "" : t.ghost.innerHTML = n[0].innerHTML; for (const s of n) s.parentElement.parentElement.style.opacity = "0.5"; e.dragMoveHelper.clear(); } function Pn(e, t, n) { const { dragged: o } = e; if (!o || t.pointerId !== n.pointerId) return; const s = n.clientX - t.startX, i = n.clientY - t.startY, l = Math.sqrt(s * s + i * i); if (!t.isDragging && l > Mn && ft(e, t), !t.isDragging) return; ht(t.ghost, n.clientX, n.clientY); const c = e.container.getBoundingClientRect(); n.clientX < c.x + 50 ? t.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? t.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? t.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? t.edgeMoveController.move(0, -1) : t.edgeMoveController.stop(), ge(t.meet); const r = 12 * e.scaleVal, a = xe.elementFromPoint(n.clientX, n.clientY - r); if (Ye(a, o)) { t.meet = a; const d = a.getBoundingClientRect(), h = d.y; n.clientY > h + d.height ? t.insertType = "after" : t.insertType = "in"; } else { const d = xe.elementFromPoint(n.clientX, n.clientY + r); if (Ye(d, o)) { t.meet = d; const u = d.getBoundingClientRect().y; n.clientY < u ? t.insertType = "before" : t.insertType = "in"; } else t.insertType = null, t.meet = null; } t.meet && _n(t.meet, t.insertType); } function On(e, t, n) { const { dragged: o } = e; if (!(!o || t.pointerId !== n.pointerId)) { t.edgeMoveController.stop(); for (const s of o) s.parentElement.parentElement.style.opacity = "1"; t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (ge(t.meet), t.insertType === "before" ? e.moveNodeBefore(o, t.meet) : t.insertType === "after" ? e.moveNodeAfter(o, t.meet) : t.insertType === "in" && e.moveNodeIn(o, t.meet)), e.dragged = null, t.isDragging = !1, t.insertType = null, t.meet = null, t.pointerId = null; } } function ve(e, t) { const { dragged: n } = e; if (n) { t.edgeMoveController.stop(); for (const o of n) o.parentElement.parentElement.style.opacity = "1"; t.meet && ge(t.meet), t.ghost.style.display = "none", t.ghost.innerHTML = "", e.dragged = null, t.isDragging = !1, t.insertType = null, t.meet = null, t.pointerId = null; } } function $n(e) { return () => { }; } function jn(e) { const { dragMoveHelper: t } = e; let n = 0; e.spacePressed = !1; let o = null; const s = /* @__PURE__ */ new Map(), i = e.editable ? Dn(e) : null; let l = null, c = null, r = null, a = null; const d = 500, h = 10, u = () => { l !== null && (clearTimeout(l), l = null, c = null, r = null, a = null); }, y = (f, w) => { f.hasPointerCapture && f.hasPointerCapture(w) && f.releasePointerCapture(w); }, v = (f, w) => { const k = f.closest(".svg-label"); if (k) { const D = k.dataset.svgId, ie = k.dataset.type, ne = document.getElementById(D); if (ne) { if (ie === "arrow") return w ? e.editArrowLabel(ne) : e.selectArrow(ne), !0; if (ie === "summary") return w ? e.editSummary(ne) : e.selectSummary(ne), !0; } } if (f.closest(".topiclinks")) { const D = f.closest("g"); if (D) return w ? e.editArrowLabel(D) : e.selectArrow(D), !0; } if (f.closest(".summary")) { const D = f.closest("g"); if (D) return w ? e.editSummary(D) : e.selectSummary(D), !0; } return !1; }, p = (f) => { if (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 (i?.isDragging) return; const w = f.target; if (w.tagName === "ME-EPD") f.ctrlKey || f.metaKey ? e.expandNodeAll(w.previousSibling) : e.expandNode(w.previousSibling); else if (w.tagName === "ME-TPC" && e.currentNodes.length > 1) e.selectNode(w); else if (!e.editable) return; v(w, !1); }, g = (f) => { if (!e.editable) return; const w = f.target; de(w) && e.beginEdit(w), v(w, !0); }, m = (f) => { if (f.pointerType === "mouse" || s.size > 1) return; const w = (/* @__PURE__ */ new Date()).getTime(), k = w - n; k < 300 && k > 0 && g(f), n = w; }, b = (f) => { f.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed")); }, x = (f) => { f.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed")); }, L = (f) => { if (f.pointerType === "touch" && (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), s.size === 2)) { const [D, ie] = Array.from(s.values()); o = Re(D, ie), u(); } t.moved = !1; const w = f.target, k = e.mouseSelectionButton === 0 ? 2 : 0; if (i && (f.button === 0 || f.pointerType === "touch")) { if (f.pointerType === "touch" && s.size > 1) (i.isDragging || i.pointerId !== null) && ve(e, i); else if (f.pointerType === "touch" && s.size === 1) (de(w) || w.closest("me-tpc")) && (c = { x: f.clientX, y: f.clientY }, r = w, a = f.pointerId, l = window.setTimeout(() => { We(e, i, f, !0) && (r && r.setPointerCapture(f.pointerId), ht(i.ghost, f.clientX, f.clientY)), l = null, c = null, r = null, a = null; }, d)); else if (f.pointerType === "mouse" && We(e, i, f, !1)) { w.setPointerCapture(f.pointerId); return; } } const $ = e.spacePressed && f.button === 0 && f.pointerType === "mouse", Y = f.button === k && f.pointerType === "mouse" || f.pointerType === "touch"; !$ && !Y || (t.x = f.clientX, t.y = f.clientY, w.className !== "circle" && w.contentEditable !== "plaintext-only" && (t.mousedown = !0, w.setPointerCapture(f.pointerId))); }, T = (f) => { if (f.pointerType === "touch" && s.has(f.pointerId)) { if (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), l !== null && c !== null && f.pointerId === a) { const w = f.clientX - c.x, k = f.clientY - c.y; Math.sqrt(w * w + k * k) > h && u(); } if (s.size >= 2) { const [w, k] = Array.from(s.values()), $ = Re(w, k); if (o == null) o = $; else { const Y = $ - o; Math.abs(Y) > 8 && (Y > 0 ? J(e, "in", { x: (w.x + k.x) / 2, y: (w.y + k.y) / 2 }) : J(e, "out", { x: (w.x + k.x) / 2, y: (w.y + k.y) / 2 }), o = $); } return; } } if (!(i && i.pointerId !== null && (Pn(e, i, f), i.isDragging))) { if (f.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) { const w = f.clientX - t.x, k = f.clientY - t.y; t.onMove(w, k); } t.x = f.clientX, t.y = f.clientY; } }, E = (f) => { if (f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId !== null) { const w = i.isDragging; if (On(e, i, f), y(f.target, f.pointerId), w) return; } t.mousedown && (y(f.target, f.pointerId), t.clear()); }, C = () => { u(), t.mousedown && t.clear(), i && (i.isDragging || i.pointerId !== null) && ve(e, i); }, S = (f) => { f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === f.pointerId && ve(e, i), E(f); }, N = (f) => { if (f.preventDefault(), f.button !== 2 || !e.editable) return; const w = f.target; de(w) && !w.classList.contains("selected") && e.selectNode(w), setTimeout(() => { e.dragMoveHelper.moved || e.bus.fire("showContextMenu", f); }, 200); }, M = (f) => { f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey ? f.deltaY < 0 ? J(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && J(e, "out", e.dragMoveHelper) : f.shiftKey ? e.move(-f.deltaY, 0) : e.move(-f.deltaX, -f.deltaY); }, { container: _ } = e; return st([ { dom: _, evt: "pointerdown", func: L }, { dom: _, evt: "pointermove", func: T }, { dom: _, evt: "pointerup", func: E }, { dom: _, evt: "pointercancel", func: S }, { dom: _, evt: "pointerdown", func: m }, { dom: _, evt: "click", func: p }, { dom: _, evt: "dblclick", func: g }, { dom: _, evt: "contextmenu", func: N }, { dom: _, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : M }, { dom: _, evt: "blur", func: C }, { dom: _, evt: "keydown", func: b }, { dom: _, evt: "keyup", func: x } ]); } function Hn() { 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 ee = document, R = "http://www.w3.org/2000/svg", me = 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"; }, Ce = 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; }, ut = function(e, t, n) { const o = ee.createElementNS(R, "path"); return A(o, { d: e, stroke: t || "#666", fill: "none", "stroke-width": n }), o; }, oe = function(e) { const t = ee.createElementNS(R, "svg"); return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t; }, Xe = function() { const e = ee.createElementNS(R, "line"); return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e; }, Rn = function(e, t, n, o) { const s = ee.createElementNS(R, "g"); return [ { name: "line", d: e }, { name: "arrow1", d: t }, { name: "arrow2", d: n } ].forEach((l, c) => { const r = l.d, a = ee.createElementNS(R, "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(a, d), c === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2"); const h = ee.createElementNS(R, "path"); A(h, { d: r, stroke: "transparent", fill: "none", "stroke-width": "15" }), s.appendChild(h), s.appendChild(a), s[l.name] = a; }), s; }, pt = function(e, t, n) { if (!t) return; const o = n.label, 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 = ` left:${t.style.left}; top:${t.style.top}; max-width: 200px; `, rt(s), e.scrollIntoView(s), s.addEventListener("keydown", (i) => { i.stopPropagation(); 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.textContent?.trim() || ""; i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (e.markdown ? t.innerHTML = e.markdown(n.label, n) : t.textContent = n.label, me(t), "parent" in n ? e.bus.fire("operation", { name: "finishEditSummary", obj: n }) : e.bus.fire("operation", { name: "finishEditArrowLabel", obj: n })); }); }, In = 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 } = H(this.nodes, a), u = a.offsetWidth, y = a.offsetHeight, v = r.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: h, cL: d, cW: u, cH: y, direction: v, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, m = a.nodeObj.branchColor || g[c % g.length]; if (a.style.borderColor = m, this.lines.appendChild(ut(p, m, "3")), e && e !== r) continue; const b = oe("subLines"), x = r.lastChild; x.tagName === "svg" && x.remove(), r.appendChild(b), gt(this, b, m, r, v, !0); } this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv"); }, gt = 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 y = c[u], v = y.firstChild, p = v.offsetTop, g = v.offsetLeft, m = v.offsetWidth, b = v.offsetHeight, x = v.firstChild.nodeObj.branchColor || n, L = e.generateSubBranch({ pT: r, pL: a, pW: d, pH: h, cT: p, cL: g, cW: m, cH: b, direction: s, isFirst: i }); t.appendChild(ut(L, x, "2")); const T = v.children[1]; if (T) { if (!T.expanded) continue; } else continue; gt(e, t, x, y, s); } }, ze = { addChild: "插入子节点", addParent: "插入父节点", addSibling: "插入同级节点", removeNode: "删除节点", focus: "专注", cancelFocus: "取消专注", moveUp: "上移", moveDown: "下移", link: "连接", linkBidirectional: "双向连接", clickTips: "请点击目标节点", summary: "摘要" }, Ge = { cn: ze, zh_CN: ze, zh_TW: { addChild: "插入子節點", addParent: "插入父節點", addSibling: "插入同級節點", removeNode: "刪除節點", focus: "專注", cancelFocus: "取消專注", moveUp: "上移", moveDown: "下移", link: "連接", linkBidirectional: "雙向連接", clickTips: "請點擊目標節點", summary: "摘要" }, en: { 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" }, ru: { addChild: "Добавить дочерний элемент", addParent: "Добавить родительский элемент", addSibling: "Добавить на этом уровне", removeNode: "Удалить узел", focus: "Режим фокусировки", cancelFocus: "Отменить режим фокусировки", moveUp: "Поднять выше", moveDown: "Опустить ниже", link: "Ссылка", linkBidirectional: "Двунаправленная ссылка", clickTips: "Пожалуйста, нажмите на целевой узел", summary: "Описание" }, ja: { addChild: "子ノードを追加する", addParent: "親ノードを追加します", addSibling: "兄弟ノードを追加する", removeNode: "ノードを削除", focus: "集中", cancelFocus: "集中解除", moveUp: "上へ移動", moveDown: "下へ移動", link: "コネクト", linkBidirectional: "双方向リンク", clickTips: "ターゲットノードをクリックしてください", summary: "概要" }, pt: { addChild: "Adicionar item filho", addParent: "Adicionar item pai", addSibling: "Adicionar item irmao", removeNode: "Remover item", focus: "Modo Foco", cancelFocus: "Cancelar Modo Foco", moveUp: "Mover para cima", moveDown: "Mover para baixo", link: "Link", linkBidirectional: "Link bidirecional", clickTips: "Favor clicar no item alvo", summary: "Resumo" }, it: { addChild: "Aggiungi figlio", addParent: "Aggiungi genitore", addSibling: "Aggiungi fratello", removeNode: "Rimuovi nodo", focus: "Modalità Focus", cancelFocus: "Annulla Modalità Focus", moveUp: "Sposta su", moveDown: "Sposta giù", link: "Collega", linkBidirectional: "Collegamento bidirezionale", clickTips: "Si prega di fare clic sul nodo di destinazione", summary: "Unisci nodi" }, es: { addChild: "Agregar hijo", addParent: "Agregar padre", addSibling: "Agregar hermano", removeNode: "Eliminar nodo", focus: "Modo Enfoque", cancelFocus: "Cancelar Modo Enfoque", moveUp: "Mover hacia arriba", moveDown: "Mover hacia abajo", link: "Enlace", linkBidirectional: "Enlace bidireccional", clickTips: "Por favor haga clic en el nodo de destino", summary: "Resumen" }, fr: { addChild: "Ajout enfant", addParent: "Ajout parent", addSibling: "Ajout voisin", removeNode: "Supprimer", focus: "Cibler", cancelFocus: "Retour", moveUp: "Monter", moveDown: "Descendre", link: "Lier", linkBidirectional: "Lien bidirectionnel", clickTips: "Cliquer sur le noeud cible", summary: "Annoter" }, ko: { addChild: "자식 추가", addParent: "부모 추가", addSibling: "형제 추가", removeNode: "노드 삭제", focus: "포커스 모드", cancelFocus: "포커스 모드 취소", moveUp: "위로 이동", moveDown: "아래로 이동", link: "연결", linkBidirectional: "양방향 연결", clickTips: "대상 노드를 클릭하십시오", summary: "요약" }, ro: { addChild: "Adaugă sub-nod", addParent: "Adaugă nod părinte", addSibling: "Adaugă nod la același nivel", removeNode: "Șterge nodul", focus: "Focalizare", cancelFocus: "Anulează focalizarea", moveUp: "Mută în sus", moveDown: "Mută în jos", link: "Creează legătură", linkBidirectional: "Creează legătură bidirecțională", clickTips: "Click pe nodul țintă", summary: "Rezumat" } }; function Bn(e, t) { t = t === !0 ? { focus: !0, link: !0 } : t; const n = (E) => { const C = document.createElement("div"); return C.inn