PageSourceSearch

https://xiaodaozhi.com/_nuxt/bIYXCFKf.js

js xiaodaozhi.com collected 2026-10-06 15:18:50 UTC 74,432 bytes, 1 lines download raw bytes

1import{i as T,K as Re,m as M,l as V,o as dt,ay as qt,bn as Ke,d as we,C as D,D as I,R as ye,F as Xe,a7 as X,a2 as pe,a3 as ke,E as C,bd as Ce,V as De,G as Ye,a4 as _e,bj as ut,an as Ln,bW as En,aM as Tt,H as Qt,b$ as en,bY as Bt,bh as Sn,bJ as mt,L as $n,N as An,ad as Fn,c as Tn,af as Bn}from"./Cm6O8OIL.js";import{_ as Se}from"./DlAUqK2U.js";import{d as Yt}from"./egs18G3o.js";import"./C1QGnB9O.js";const Yn=40,Xn=30,Xt=.1,_t=10,Pe=15,_n=15;let On="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Rn=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=On[n[e]&63];return t};function Oe(){return Rn(10)}function ce(e){return JSON.parse(JSON.stringify(e))}function zn(e,t){const n=T(ce(e.value));Re(e,N=>{n.value=ce(N)},{deep:!0});function o(N){n.value=N,t("update:modelValue",ce(N))}function s(N,E,S,O,H){const te={id:Oe(),type:N,x:E,y:S,width:O,height:H,label:"",style:{}},j=ce(n.value);return j.nodes.push(te),o(j),te.id}function i(N,E){const S=ce(n.value),O=S.nodes.findIndex(H=>H.id===N);O!==-1&&(S.nodes[O]={...S.nodes[O],...E},o(S))}function a(N){const E=ce(n.value);E.nodes=E.nodes.filter(S=>S.id!==N),E.edges=E.edges.filter(S=>S.sourceNodeId!==N&&S.targetNodeId!==N),o(E)}function c(N,E,S,O){const H=ce(n.value);if(N===S||H.edges.some(q=>q.sourceNodeId===N&&q.sourceAnchor===E&&q.targetNodeId===S&&q.targetAnchor===O))return null;const j={id:Oe(),sourceNodeId:N,sourceAnchor:E,targetNodeId:S,targetAnchor:O};return H.edges.push(j),o(H),j.id}function y(N){const E=ce(n.value);E.edges=E.edges.filter(S=>S.id!==N),o(E)}function x(N,E,S){const O=ce(n.value),H=O.nodes.find(te=>te.id===N);H&&(H.x+=E,H.y+=S,o(O))}function v(N,E,S){const O=ce(n.value),H=O.nodes.find(te=>te.id===N);H&&(H.x=E,H.y=S,o(O))}function l(N,E,S,O,H){const te=ce(n.value),j=te.nodes.find(q=>q.id===N);j&&(j.x=E,j.y=S,j.width=O,j.height=H,o(te))}function u(N,E){i(N,{label:E})}function p(N,E){i(N,{style:{...n.value.nodes.find(S=>S.id===N)?.style,...E}})}function k(N,E){const S=ce(n.value),O=S.edges.find(H=>H.id===N);O&&(O.label=E,o(S))}function P(N,E){const S=ce(n.value),O=S.edges.find(H=>H.id===N);O&&(O.style={...O.style,...E},o(S))}function w(N){return n.value.nodes.find(E=>E.id===N)}function L(N){return n.value.edges.find(E=>E.id===N)}function _(N,E,S,O){const H=ce(n.value),te=H.freeLines??[],j={id:Oe(),x1:N,y1:E,x2:S,y2:O};return H.freeLines=[...te,j],o(H),j.id}function oe(N){const E=ce(n.value);E.freeLines&&(E.freeLines=E.freeLines.filter(S=>S.id!==N)),o(E)}function Q(N,E){const S=ce(n.value);if(S.freeLines){const O=S.freeLines.find(H=>H.id===N);O&&(O.style={...O.style,...E})}o(S)}function re(N){return n.value.freeLines?.find(E=>E.id===N)}function J(N,E,S,O,H){const te=ce(n.value);if(te.freeLines){const j=te.freeLines.find(q=>q.id===N);j&&(j.x1=E,j.y1=S,j.x2=O,j.y2=H)}o(te)}return{internalData:n,addNode:s,updateNode:i,removeNode:a,addEdge:c,removeEdge:y,moveNode:x,setNodePosition:v,resizeNode:l,updateNodeLabel:u,updateNodeStyle:p,updateEdgeLabel:k,updateEdgeStyle:P,getNode:w,getEdge:L,addFreeLine:_,removeFreeLine:oe,updateFreeLineStyle:Q,getFreeLine:re,moveFreeLine:J}}function Hn(){const e=T(null),t=T(null),n=T(null);function o(c){e.value=c,t.value=null,n.value=null}function s(c){t.value=c,e.value=null,n.value=null}function i(c){n.value=c,e.value=null,t.value=null}function a(){e.value=null,t.value=null,n.value=null}return{selectedNodeId:e,selectedEdgeId:t,selectedFreeLineId:n,selectNode:o,selectEdge:s,selectFreeLine:i,clearSelection:a}}function Ot(e,t,n){return Math.max(t,Math.min(n,e))}function z(e,t){return Math.round(e/t)*t}function Wn(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function Gn(e,t){const n=M(()=>{const a=t?.value;return[{type:"rectangle",label:a?.t("template.rectangle")??"矩形",defaultWidth:160,defaultHeight:80},{type:"diamond",label:a?.t("template.diamond")??"菱形",defaultWidth:120,defaultHeight:120},{type:"ellipse",label:a?.t("template.ellipse")??"椭圆",defaultWidth:160,defaultHeight:100},{type:"parallelogram",label:a?.t("template.parallelogram")??"平行四边形",defaultWidth:160,defaultHeight:80},{type:"text",label:a?.t("template.text")??"文字",defaultWidth:200,defaultHeight:40}]});function o(a){return n.value.find(c=>c.type===a)}function s(a,c,y,x){if(!a)return null;const v=o(a);if(!v)return null;const l=x??_n,u=z(c-v.defaultWidth/2,l),p=z(y-v.defaultHeight/2,l),k=z(v.defaultWidth,l),P=z(v.defaultHeight,l);return e(a,u,p,k,P)}function i(a,c,y,x){const v=a.dataTransfer?.getData("application/x-flowchart-node-type");return v?s(v,c,y,x):null}return{templates:n,createNodeAt:s,handleDrop:i}}function Kn(e){const t=T(null);function n(c,y,x,v){t.value={active:!0,sourceNodeId:c,sourceAnchor:y,currentMouseX:x,currentMouseY:v}}function o(c,y){t.value&&(t.value.currentMouseX=c,t.value.currentMouseY=y)}function s(c,y){if(!t.value)return null;if(t.value.sourceNodeId===c)return i(),null;const x=e(t.value.sourceNodeId,t.value.sourceAnchor,c,y);return i(),x}function i(){t.value=null}function a(){return t.value?.active??!1}return{drawingState:t,startDrawing:n,updateDrawing:o,finishDrawing:s,cancelDrawing:i,isDrawing:a}}const Rt=1.08,lt=100;function Un(e){const t=T({panX:0,panY:0,zoom:1});function n(y,x,v){let l;try{l=V(e)??[]}catch{return}if(l.length===0)return;let u=1/0,p=1/0,k=-1/0,P=-1/0;for(const J of l)J.x<u&&(u=J.x),J.y<p&&(p=J.y),J.x+J.width>k&&(k=J.x+J.width),J.y+J.height>P&&(P=J.y+J.height);const w=u-lt,L=k+lt,_=p-lt,oe=P+lt,Q=(L-w)*y,re=(oe-_)*y;if(Q>x){const J=w*y+t.value.panX,N=L*y+t.value.panX;J>0?t.value.panX=-w*y:N<x&&(t.value.panX=x-L*y)}if(re>v){const J=_*y+t.value.panY,N=oe*y+t.value.panY;J>0?t.value.panY=-_*y:N<v&&(t.value.panY=v-oe*y)}}function o(y,x,v){const l=(y-v.left-t.value.panX)/t.value.zoom,u=(x-v.top-t.value.panY)/t.value.zoom;return{x:l,y:u}}function s(y,x){y.preventDefault();const v=y.deltaY>0?1/Rt:Rt,l=Ot(t.value.zoom*v,Xt,_t),u=y.clientX-x.left,p=y.clientY-x.top,k=l/t.value.zoom;t.value.panX=u-(u-t.value.panX)*k,t.value.panY=p-(p-t.value.panY)*k,t.value.zoom=l,n(l,x.width,x.height)}function i(y,x){let v;try{v=V(e)??[]}catch{t.value={panX:0,panY:0,zoom:1};return}if(v.length===0){t.value={panX:0,panY:0,zoom:1};return}let l=1/0,u=1/0,p=-1/0,k=-1/0;for(const _ of v)_.x<l&&(l=_.x),_.y<u&&(u=_.y),_.x+_.width>p&&(p=_.x+_.width),_.y+_.height>k&&(k=_.y+_.height);const P=(l+p)/2,w=(u+k)/2,L=1;t.value={panX:y/2-P*L,panY:x/2-w*L,zoom:L}}function a(y,x,v){const l=Ot(t.value.zoom*y,Xt,_t),u=x/2,p=v/2,k=l/t.value.zoom;t.value.panX=u-(u-t.value.panX)*k,t.value.panY=p-(p-t.value.panY)*k,t.value.zoom=l,n(l,x,v)}function c(y,x){n(t.value.zoom,y,x)}return{viewport:t,screenToCanvas:o,handleWheel:s,zoomAtCenter:a,clampPan:c,resetView:i}}function Vn(e){function t(n){const o=e[n.key];o&&o(n)}dt(()=>{window.addEventListener("keydown",t)}),qt(()=>{window.removeEventListener("keydown",t)})}const tn=Symbol("theme"),It=Symbol("locale"),Pt=Symbol("mobile");function ft(){const e=Ke(tn),t=Ke(It),n=Ke(Pt);return{theme:M(()=>e?.value??"light"),locale:M(()=>t?.value??"zh-CN"),mobile:M(()=>n?.value??!1)}}const Jn=["#FFFFFF","#F8BBD0","#E1BEE7","#D1C4E9","#C5CAE9","#BBDEFB","#B2EBF2","#B2DFDB","#C8E6C9","#F0F4C3","#FFF9C4","#FFECB3","#FFE0B2","#FFCCBC","#D7CCC8","#CFD8DC","#E0E0E0","#B0BEC5"],jn={"#FFFFFF":"color.white","#F8BBD0":"color.lightPink","#E1BEE7":"color.lightPurple","#D1C4E9":"color.lavender","#C5CAE9":"color.periwinkle","#BBDEFB":"color.lightBlue","#B2EBF2":"color.lightCyan","#B2DFDB":"color.lightTeal","#C8E6C9":"color.lightGreen","#F0F4C3":"color.lightLime","#FFF9C4":"color.lightYellow","#FFECB3":"color.lightAmber","#FFE0B2":"color.lightOrange","#FFCCBC":"color.lightRed","#D7CCC8":"color.lightBrown","#CFD8DC":"color.lightBlueGrey","#E0E0E0":"color.lightGrey","#B0BEC5":"color.blueGrey"},st="#FFFFFF",Zn=["#555555","#E53935","#1E88E5","#43A047","#FB8C00","#8E24AA","#00ACC1","#6D4C41","#546E7A","#FFB300","#3949AB","#C62828","#2E7D32","#F4511E","#5E35B1"],qn={"#555555":"
1color.darkGrey","#E53935":"color.red","#1E88E5":"color.blue","#43A047":"color.green","#FB8C00":"color.orange","#8E24AA":"color.purple","#00ACC1":"color.cyan","#6D4C41":"color.brown","#546E7A":"color.blueGrey","#FFB300":"color.amber","#3949AB":"color.darkBlue","#C62828":"color.darkRed","#2E7D32":"color.darkGreen","#F4511E":"color.darkOrange","#5E35B1":"color.darkPurple"},be="#555555";function Qn(e){const t=e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e,n=parseInt(t.slice(1,3),16),o=parseInt(t.slice(3,5),16),s=parseInt(t.slice(5,7),16);return(.299*n+.587*o+.114*s)/255>.55?"#000000":"#FFFFFF"}const zt={"zh-CN":{"sidebar.title":"节点","toolbar.undo":"撤销","toolbar.redo":"重做","toolbar.zoomIn":"放大","toolbar.zoomOut":"缩小","toolbar.resetView":"重置视图","toolbar.delete":"删除","sidebar.freeLine":"直线","node.defaultColor":"默认颜色","node.delete":"删除节点","edge.defaultColor":"默认颜色","edge.delete":"删除连线","template.rectangle":"矩形","template.diamond":"菱形","template.ellipse":"椭圆","template.parallelogram":"平行四边形","template.text":"文字","color.white":"白色","color.lightPink":"浅粉","color.lightPurple":"浅紫","color.lavender":"薰衣草","color.periwinkle":"长春花","color.lightBlue":"浅蓝","color.lightCyan":"浅青","color.lightTeal":"浅蓝绿","color.lightGreen":"浅绿","color.lightLime":"浅黄绿","color.lightYellow":"浅黄","color.lightAmber":"浅琥珀","color.lightOrange":"浅橙","color.lightRed":"浅红","color.lightBrown":"浅棕","color.lightBlueGrey":"浅蓝灰","color.lightGrey":"浅灰","color.blueGrey":"蓝灰","color.darkGrey":"深灰","color.red":"红色","color.blue":"蓝色","color.green":"绿色","color.orange":"橙色","color.purple":"紫色","color.cyan":"青色","color.brown":"棕色","color.amber":"琥珀","color.darkBlue":"深蓝","color.darkRed":"深红","color.darkGreen":"深绿","color.darkOrange":"深橙","color.darkPurple":"深紫"},"en-US":{"sidebar.title":"Nodes","toolbar.undo":"Undo","toolbar.redo":"Redo","toolbar.zoomIn":"Zoom in","toolbar.zoomOut":"Zoom out","toolbar.resetView":"Reset view","toolbar.delete":"Delete","sidebar.freeLine":"Line","node.defaultColor":"Default color","node.delete":"Delete node","edge.defaultColor":"Default color","edge.delete":"Delete edge","template.rectangle":"Rectangle","template.diamond":"Diamond","template.ellipse":"Ellipse","template.parallelogram":"Parallelogram","template.text":"Text","color.white":"White","color.lightPink":"Light Pink","color.lightPurple":"Light Purple","color.lavender":"Lavender","color.periwinkle":"Periwinkle","color.lightBlue":"Light Blue","color.lightCyan":"Light Cyan","color.lightTeal":"Light Teal","color.lightGreen":"Light Green","color.lightLime":"Light Lime","color.lightYellow":"Light Yellow","color.lightAmber":"Light Amber","color.lightOrange":"Light Orange","color.lightRed":"Light Red","color.lightBrown":"Light Brown","color.lightBlueGrey":"Light Blue Grey","color.lightGrey":"Light Grey","color.blueGrey":"Blue Grey","color.darkGrey":"Dark Grey","color.red":"Red","color.blue":"Blue","color.green":"Green","color.orange":"Orange","color.purple":"Purple","color.cyan":"Cyan","color.brown":"Brown","color.amber":"Amber","color.darkBlue":"Dark Blue","color.darkRed":"Dark Red","color.darkGreen":"Dark Green","color.darkOrange":"Dark Orange","color.darkPurple":"Dark Purple"}};function Ve(e){return{t(t){return zt[e]?.[t]??t},colorName(t,n){if(n)return this.t("node.defaultColor");const o=jn[t]??qn[t];return o?zt[e]?.[o]??t:t}}}const eo=.15,it=10;function Me(e,t){const n=e.type==="parallelogram"?Math.min(15,e.width*eo):0;switch(t){case"top":return{x:e.x+e.width/2+n/2,y:e.y};case"right":return{x:e.x+e.width,y:e.y+e.height/2};case"bottom":return{x:e.x+e.width/2-n/2,y:e.y+e.height};case"left":return{x:e.x,y:e.y+e.height/2}}}function Ue(e,t){const n=Me(e,t);switch(t){case"top":return{x:n.x,y:n.y-it};case"right":return{x:n.x+it,y:n.y};case"bottom":return{x:n.x,y:n.y+it};case"left":return{x:n.x-it,y:n.y}}}const to={key:0,class:"sidebar-title"},no=["onDragstart","onClick","onPointerdown"],oo={width:32,height:24,class:"sidebar-icon"},ro={key:0,x:"2",y:"2",width:"28",height:"20",rx:"3",fill:"var(--fc-sidebar-icon-fill)",stroke:"var(--fc-sidebar-icon-stroke)","stroke-width":"1.5"},lo={key:1,points:"16,1 30,12 16,23 2,12",fill:"var(--fc-sidebar-icon-fill)",stroke:"var(--fc-sidebar-icon-stroke)","stroke-width":"1.5"},io={key:2,cx:"16",cy:"12",rx:"14",ry:"10",fill:"var(--fc-sidebar-icon-fill)",stroke:"var(--fc-sidebar-icon-stroke)","stroke-width":"1.5"},ao={key:3,points:"6,2 30,2 26,22 2,22",fill:"var(--fc-sidebar-icon-fill)",stroke:"var(--fc-sidebar-icon-stroke)","stroke-width":"1.5"},so={key:4},co={key:0,class:"sidebar-label"},uo={width:"32",height:"24",class:"sidebar-icon"},fo=["stroke"],ho=["fill"],yo=["fill"],vo={key:0,class:"sidebar-label"},Ht=4,go=we({__name:"NodeSidebar",props:{templates:{},lineToolActive:{type:Boolean},selectedNodeTool:{}},emits:["toggleLineTool","toggleNodeTool","nodePointerDragStart","nodePointerDragMove","nodePointerDragEnd","nodePointerDragCancel","linePointerDragStart","linePointerDragMove","linePointerDragEnd","linePointerDragCancel"],setup(e,{emit:t}){const n=t,o=Ke(It),s=Ke(Pt),i=M(()=>s?.value??!1),a=M(()=>Ve(o?.value??"zh-CN")),c=M(()=>a.value.t("sidebar.title")),y=M(()=>a.value.t("sidebar.freeLine"));let x=null,v=null,l=0,u=0,p=!1,k=!1,P=null,w=0,L=0,_=!1,oe=!1;function Q(m,G){m.dataTransfer?.setData("application/x-flowchart-node-type",G),m.dataTransfer.effectAllowed="copy"}function re(m){return i.value||m.pointerType==="touch"||m.pointerType==="pen"}function J(m,G){re(m)&&(x=m.pointerId,v=G,l=m.clientX,u=m.clientY,p=!1,m.currentTarget.setPointerCapture(m.pointerId),m.preventDefault(),m.stopPropagation())}function N(m){if(m.pointerId!==x)return;Math.hypot(m.clientX-l,m.clientY-u)>=Ht&&!p&&v&&(p=!0,n("nodePointerDragStart",v,l,u)),p&&n("nodePointerDragMove",m.clientX,m.clientY),m.preventDefault(),m.stopPropagation()}function E(m){if(m.pointerId!==x)return;x=null;const G=v;v=null,k=!0;const ee=m.currentTarget;ee.hasPointerCapture(m.pointerId)&&ee.releasePointerCapture(m.pointerId),p?n("nodePointerDragEnd",m.clientX,m.clientY):G&&n("toggleNodeTool",G),m.preventDefault(),m.stopPropagation()}function S(m){if(m.pointerId!==x)return;x=null,v=null,p=!1;const G=m.currentTarget;G.hasPointerCapture(m.pointerId)&&G.releasePointerCapture(m.pointerId),n("nodePointerDragCancel")}function O(m){if(k){k=!1;return}x===null&&n("toggleNodeTool",m)}function H(){if(oe){oe=!1;return}P===null&&n("toggleLineTool")}function te(m){m.dataTransfer?.setData("application/x-flowchart-freeline","1"),m.dataTransfer.effectAllowed="copy"}function j(m){re(m)&&(P=m.pointerId,w=m.clientX,L=m.clientY,_=!1,m.currentTarget.setPointerCapture(m.pointerId),m.preventDefault(),m.stopPropagation())}function q(m){if(m.pointerId!==P)return;Math.hypot(m.clientX-w,m.clientY-L)>=Ht&&!_&&(_=!0,n("linePointerDragStart",w,L)),_&&n("linePointerDragMove",m.clientX,m.clientY),m.preventDefault(),m.stopPropagation()}function ve(m){if(m.pointerId!==P)return;P=null,oe=!0;const G=m.currentTarget;G.hasPointerCapture(m.pointerId)&&G.releasePointerCapture(m.pointerId),_?n("linePointerDragEnd",m.clientX,m.clientY):n("toggleLineTool"),m.preventDefault(),m.stopPropagation()}function he(m){if(m.pointerId!==P)return;P=null,_=!1;const G=m.currentTarget;G.hasPointerCapture(m.pointerId)&&G.releasePointerCapture(m.pointerId),n("linePointerDragCancel")}return(m,G)=>(D(),I("div",{class:ye(["node-sidebar",{"sidebar-collapsed":i.value}])},[i.value?X("",!0):(D(),I("div",to,Xe(c.value),1)),(D(!0),I(pe,null,ke(e.templates,ee=>(D(),I("div",{key:ee.type,class:ye(["sidebar-item",{"tool-active":e.selectedNodeTool===ee.type}]),draggable:"true",onDragstart:me=>Q(me,ee.type),onClick:me=>O(ee.type),onPointerdown:me=>J(me,ee.type),onPointermove:N,onPointerup:E,onPointercancel:S},[(D(),I("svg",oo,[ee.type==="rectangle"?(D(),I("rect",ro)):X("",!0),ee.type==="diamond"?(D(),I("polygon",lo)):X("",!0),ee.type==="ellipse"?(D(),I("ellipse",i
1o)):X("",!0),ee.type==="parallelogram"?(D(),I("polygon",ao)):X("",!0),ee.type==="text"?(D(),I("g",so,[...G[0]||(G[0]=[C("rect",{x:"2",y:"3",width:"28",height:"18",rx:"2",fill:"var(--fc-sidebar-icon-fill)",stroke:"var(--fc-sidebar-icon-stroke)","stroke-width":"1.5","stroke-dasharray":"3,2"},null,-1),C("text",{x:"16",y:"16","text-anchor":"middle","font-size":"12",fill:"var(--fc-sidebar-icon-stroke)","font-weight":"bold","font-family":"serif"},"T",-1)])])):X("",!0)])),i.value?X("",!0):(D(),I("span",co,Xe(ee.label),1))],42,no))),128)),G[1]||(G[1]=C("div",{class:"sidebar-divider"},null,-1)),C("div",{class:ye(["sidebar-item",{"tool-active":e.lineToolActive}]),draggable:"true",onDragstart:te,onClick:H,onPointerdown:j,onPointermove:q,onPointerup:ve,onPointercancel:he},[(D(),I("svg",uo,[C("line",{x1:"4",y1:"20",x2:"28",y2:"4",stroke:e.lineToolActive?"currentColor":"var(--fc-sidebar-icon-stroke)","stroke-width":"2","stroke-linecap":"round"},null,8,fo),C("circle",{cx:"4",cy:"20",r:"2",fill:e.lineToolActive?"currentColor":"var(--fc-sidebar-icon-stroke)"},null,8,ho),C("circle",{cx:"28",cy:"4",r:"2",fill:e.lineToolActive?"currentColor":"var(--fc-sidebar-icon-stroke)"},null,8,yo)])),i.value?X("",!0):(D(),I("span",vo,Xe(y.value),1))],34)],2))}}),po=Object.assign(Se(go,[["__scopeId","data-v-366499d0"]]),{__name:"AdminKnowledgeNotebookFlowchartNodeSidebar"}),fe=40,Ee=15,xo=80,wo=20;function kt(e,t,n,o,s,i,a,c){const y=bo(e,t,n,o,a,c);return s&&s.length>0?No(y,s,i??[],t,o):y}function Wt(e){return e?{xMin:e.x-Ee,xMax:e.x+e.width+Ee,yMin:e.y-Ee,yMax:e.y+e.height+Ee,empty:!1}:{xMin:1/0,xMax:-1/0,yMin:1/0,yMax:-1/0,empty:!0}}function mo(e,t){return{src:Wt(e),tgt:Wt(t)}}function Gt(e,t,n){if(n.empty)return!1;if(Je(e,t)){const o=e.y;if(o<=n.yMin||o>=n.yMax)return!1;const s=Math.min(e.x,t.x);return Math.max(e.x,t.x)>n.xMin&&s<n.xMax}if(je(e,t)){const o=e.x;if(o<=n.xMin||o>=n.xMax)return!1;const s=Math.min(e.y,t.y);return Math.max(e.y,t.y)>n.yMin&&s<n.yMax}return!1}function bt(e,t,n){return Gt(e,t,n.src)||Gt(e,t,n.tgt)}function xe(e,t,n,o){return!bt(t,e,o)&&!bt(e,n,o)}function ko(e,t){for(let n=1;n<e.length;n++)if(bt(e[n-1],e[n],t))return!1;return!0}function Kt(e){let t=0;for(let n=1;n<e.length;n++){const o=e[n-1],s=e[n];t+=Math.abs(o.x-s.x)+Math.abs(o.y-s.y)}return t}function Mt(e,t,n,o){if(o.src.empty&&o.tgt.empty)return(t+n)/2;const s=Math.min(t,n),i=Math.max(t,n),a=[];for(const l of[o.src,o.tgt])if(!l.empty){const u=e==="y"?l.yMin:l.xMin,p=e==="y"?l.yMax:l.xMax;p>s&&u<i&&a.push({min:u,max:p})}if(a.length===0)return(t+n)/2;a.sort((l,u)=>l.min-u.min);const c=(t+n)/2;let y=!1;for(const l of a)if(c>=l.min&&c<=l.max){y=!0;break}if(!y)return c;const x=a[0],v=a[a.length-1];if(s<x.min){const l=Math.max(s+fe,(s+x.min)/2);if(l<x.min)return l}if(i>v.max){const l=Math.min(i-fe,(i+v.max)/2);if(l>v.max)return l}for(let l=1;l<a.length;l++){const u=a[l-1].max,p=a[l].min;if(p-u>fe*2)return(u+p)/2}return c-x.min<=v.max-c?x.min:v.max}function bo(e,t,n,o,s,i){const a=[e],c=Dt(t),y=Dt(o),x=mo(s,i);if($o(t,o)&&Ao(e,t,n))return a.push(n),a;const v={x:e.x+c.x*fe,y:e.y+c.y*fe};a.push(v);const l={x:n.x+y.x*fe,y:n.y+y.y*fe},u=t==="left"||t==="right",p=o==="left"||o==="right";return t===o?Co(a,v,l,t,c,x):u&&p?Do(a,v,l,c,x):!u&&!p?Io(a,v,l,c,x):u?Po(a,v,l,c,x):Mo(a,v,l,c,x),a.push(l),a.push(n),a}function Co(e,t,n,o,s,i){const a=o==="left"||o==="right",c=a?"x":"y",y=a?"y":"x",x=a?{x:t.x,y:n.y}:{x:n.x,y:t.y};if(xe(x,t,n,i)){e.push(x);return}const v=a?{x:n.x,y:t.y}:{x:t.x,y:n.y};if(xe(v,t,n,i)){e.push(v);return}const l=s[c]>0;let u;l?u=Math.max(i.src.empty?-1/0:i.src[c+"Max"],i.tgt.empty?-1/0:i.tgt[c+"Max"],t[c],n[c]):u=Math.min(i.src.empty?1/0:i.src[c+"Min"],i.tgt.empty?1/0:i.tgt[c+"Min"],t[c],n[c]);const p=u+s[c]*fe,k=Mt(y,t[y],n[y],i);a?(e.push({x:p,y:t.y}),e.push({x:p,y:k}),e.push({x:n.x,y:k})):(e.push({x:t.x,y:p}),e.push({x:k,y:p}),e.push({x:k,y:n.y}))}function Do(e,t,n,o,s){const i=o.x>0&&n.x<t.x||o.x<0&&n.x>t.x;if(!i){const c={x:t.x,y:n.y};if(xe(c,t,n,s)){e.push(c);return}const y={x:n.x,y:t.y};if(xe(y,t,n,s)){e.push(y);return}}const a=Mt("y",t.y,n.y,s);if(i){const c=t.x+o.x*fe;e.push({x:c,y:t.y}),e.push({x:c,y:a})}else e.push({x:t.x,y:a});e.push({x:n.x,y:a})}function Io(e,t,n,o,s){const i=o.y>0&&n.y<t.y||o.y<0&&n.y>t.y;if(!i){const c={x:n.x,y:t.y};if(xe(c,t,n,s)){e.push(c);return}const y={x:t.x,y:n.y};if(xe(y,t,n,s)){e.push(y);return}}const a=Mt("x",t.x,n.x,s);if(i){const c=t.y+o.y*fe;e.push({x:t.x,y:c}),e.push({x:a,y:c})}else e.push({x:a,y:t.y});e.push({x:a,y:n.y})}function Po(e,t,n,o,s){const i={x:n.x,y:t.y};if(xe(i,t,n,s)){e.push(i);return}const a={x:t.x,y:n.y};if(xe(a,t,n,s)){e.push(a);return}const c=t.x+o.x*fe,y={x:c,y:n.y};if(xe(y,{x:c,y:t.y},n,s)){e.push({x:c,y:t.y}),e.push(y);return}nn(e,t,n,"h",s)}function Mo(e,t,n,o,s){const i={x:t.x,y:n.y};if(xe(i,t,n,s)){e.push(i);return}const a={x:n.x,y:t.y};if(xe(a,t,n,s)){e.push(a);return}const c=t.y+o.y*fe,y={x:n.x,y:c};if(xe(y,{x:t.x,y:c},n,s)){e.push({x:t.x,y:c}),e.push(y);return}nn(e,t,n,"v",s)}function nn(e,t,n,o,s){const i=o==="h"?"y":"x",a=Math.min(s.src.empty?1/0:s.src[i+"Min"],s.tgt.empty?1/0:s.tgt[i+"Min"]),c=Math.max(s.src.empty?-1/0:s.src[i+"Max"],s.tgt.empty?-1/0:s.tgt[i+"Max"]),x=[a-fe,c+fe].map(u=>o==="h"?[{x:t.x,y:u},{x:n.x,y:u}]:[{x:u,y:t.y},{x:u,y:n.y}]),v=x.filter(u=>ko([t,...u,n],s)),[l]=(v.length>0?v:x).sort((u,p)=>Kt([t,...u,n])-Kt([t,...p,n]));e.push(...l)}function No(e,t,n,o,s){const i=t.filter(y=>y.type!=="text"&&!n.includes(y.id));if(i.length===0||!jt(e,i))return e;const a=Lo(e,i,o,s);if(a)return a;let c=ct(e);for(let y=0;y<xo;y++){const x=jt(c,i);if(!x)return c;const v=c[x.segmentEndIndex-1],l=c[x.segmentEndIndex],u=So(v,l,x.node);
1c=ct([...c.slice(0,x.segmentEndIndex),...u,...c.slice(x.segmentEndIndex+1)])}return c}function Lo(e,t,n,o){const s=e[0],i=e[e.length-1],a=Ut(s,e[1],n,t,"source"),c=Ut(i,e[e.length-2],o,t,"target"),y=a===s?[]:[s],x=c===i?[]:[i],l=Vt(a,c,e,t,c===i?null:o==="left"||o==="right"?"v":"h")??Vt(a,c,e,t,null);return l?ct([...y,...l,...x]):null}function Ut(e,t,n,o,s){const i=[];t&&i.push(t);const a=Dt(n);i.push({x:e.x+a.x*fe,y:e.y+a.y*fe});for(const c of i){const y=s==="source"?e:c,x=s==="source"?c:e;if(!rn(c,o)&&ln(y,x,o))return c}return e}function Vt(e,t,n,o,s){const i=Le([e.x,t.x,...n.map(u=>u.x)]),a=Le([e.y,t.y,...n.map(u=>u.y)]);for(const u of o){const p=ht(u);i.push(p.left,p.right),a.push(p.top,p.bottom)}i.sort((u,p)=>u-p),a.sort((u,p)=>u-p);const c=new Set,y=new Map;for(const u of Le(i))for(const p of Le(a)){const k={x:u,y:p};if(rn(k,o))continue;const P=Ae(k);c.add(P),y.set(P,k)}const x=Ae(e),v=Ae(t);if(!c.has(x)||!c.has(v))return null;const l=new Map;for(const u of Le(a)){const p=Le(i).map(k=>({x:k,y:u})).filter(k=>c.has(Ae(k)));for(let k=1;k<p.length;k++)Jt(p[k-1],p[k],"h",o,l)}for(const u of Le(i)){const p=Le(a).map(k=>({x:u,y:k})).filter(k=>c.has(Ae(k)));for(let k=1;k<p.length;k++)Jt(p[k-1],p[k],"v",o,l)}return Eo(x,v,y,l,s)}function Jt(e,t,n,o,s){if(!ln(e,t,o))return;const i=Ae(e),a=Ae(t),c=Math.abs(e.x-t.x)+Math.abs(e.y-t.y);s.has(i)||s.set(i,[]),s.has(a)||s.set(a,[]),s.get(i).push({key:a,dir:n,cost:c}),s.get(a).push({key:i,dir:n,cost:c})}function Eo(e,t,n,o,s){const i=l=>`${l.key}|${l.dir}`,a=new Map,c=new Map,y=[{state:{key:e,dir:"start"},cost:0}];a.set(i(y[0].state),0);let x=null;for(;y.length>0;){y.sort((p,k)=>p.cost-k.cost);const l=y.shift(),u=i(l.state);if(l.cost===a.get(u)){if(l.state.key===t&&(!s||l.state.dir===s||l.state.dir==="start")){x=u;break}for(const p of o.get(l.state.key)??[]){const k=l.state.dir!=="start"&&l.state.dir!==p.dir?wo:0,P={key:p.key,dir:p.dir},w=i(P),L=l.cost+p.cost+k;L>=(a.get(w)??1/0)||(a.set(w,L),c.set(w,u),y.push({state:P,cost:L}))}}}if(!x)return null;const v=[];for(let l=x;l;l=c.get(l))v.push(l.split("|")[0]);return v.reverse(),ct(v.map(l=>n.get(l)))}function jt(e,t){for(let n=1;n<e.length;n++){const o=e[n-1],s=e[n];let i=null;for(const a of t){const c=on(o,s,a);c!==null&&(!i||c<i.distance)&&(i={node:a,segmentEndIndex:n,distance:c})}if(i)return i}return null}function on(e,t,n){const o=ht(n);if(Je(e,t)){if(e.y<=o.top||e.y>=o.bottom)return null;const s=Math.min(e.x,t.x);
1if(Math.max(e.x,t.x)<=o.left||s>=o.right)return null;const a=t.x>=e.x?Math.max(e.x,o.left):Math.min(e.x,o.right);return Math.abs(a-e.x)}if(je(e,t)){if(e.x<=o.left||e.x>=o.right)return null;const s=Math.min(e.y,t.y);if(Math.max(e.y,t.y)<=o.top||s>=o.bottom)return null;const a=t.y>=e.y?Math.max(e.y,o.top):Math.min(e.y,o.bottom);return Math.abs(a-e.y)}return null}function So(e,t,n){const o=ht(n);if(Je(e,t)){const s=t.x>=e.x,i=s?o.left:o.right,a=s?o.right:o.left,y=e.y-o.top<=o.bottom-e.y?o.top:o.bottom;return[{x:i,y:e.y},{x:i,y},{x:a,y},{x:a,y:e.y},t]}if(je(e,t)){const s=t.y>=e.y,i=s?o.top:o.bottom,a=s?o.bottom:o.top,y=e.x-o.left<=o.right-e.x?o.left:o.right;return[{x:e.x,y:i},{x:y,y:i},{x:y,y:a},{x:e.x,y:a},t]}return[t]}function ht(e){return{left:e.x-Ee,right:e.x+e.width+Ee,top:e.y-Ee,bottom:e.y+e.height+Ee}}function rn(e,t){return t.some(n=>{const o=ht(n);return e.x>o.left&&e.x<o.right&&e.y>o.top&&e.y<o.bottom})}function ln(e,t,n){return!n.some(o=>on(e,t,o)!==null)}function ct(e){const t=[];for(const o of e){const s=t[t.length-1];(!s||s.x!==o.x||s.y!==o.y)&&t.push(o)}const n=[];for(const o of t)for(n.push(o);n.length>=3;){const s=n[n.length-3],i=n[n.length-2],a=n[n.length-1];if(Je(s,i)&&Je(i,a)||je(s,i)&&je(i,a))n.splice(n.length-2,1);else break}return n}function Ae(e){return`${e.x},${e.y}`}function Le(e){return Array.from(new Set(e)).sort((t,n)=>t-n)}function Je(e,t){return Math.abs(e.y-t.y)<.5}function je(e,t){return Math.abs(e.x-t.x)<.5}function Ct(e,t){if(e.length===0)return"";const n=[e[0]];for(let s=1;s<e.length;s++){const i=n[n.length-1];(e[s].x!==i.x||e[s].y!==i.y)&&n.push(e[s])}if(n.length<2)return"";let o=`M ${n[0].x} ${n[0].y}`;for(let s=1;s<n.length;s++)o+=` L ${n[s].x} ${n[s].y}`;return o}function Dt(e){switch(e){case"top":return{x:0,y:-1};case"right":return{x:1,y:0};case"bottom":return{x:0,y:1};case"left":return{x:-1,y:0}}}function $o(e,t){return e==="top"&&t==="bottom"||e==="bottom"&&t==="top"||e==="left"&&t==="right"||e==="right"&&t==="left"}function Ao(e,t,n){return t==="left"||t==="right"?Math.abs(e.y-n.y)<2:Math.abs(e.x-n.x)<2}const Fo=["data-edge-id"],To=["d","stroke-width"],Bo=["d","stroke","stroke-width","marker-end"],Yo=["x","y"],Xo=we({__name:"FlowchartEdge",props:{edge:{},sourceNode:{},targetNode:{},isSelected:{type:Boolean},allNodes:{}},emits:["click","dblClick"],setup(e){const t=e,n=M(()=>t.edge.style?.strokeColor??"#555555"),o=M(()=>`url(#arrowhead-${n.value.replace("#","")})`),s=M(()=>t.edge.style?.cornerRadius??8),i=M(()=>t.edge.style?.strokeWidth??2),a=M(()=>Math.max(i.value+8,14)),c=M(()=>Me(t.sourceNode,t.edge.sourceAnchor)),y=M(()=>Me(t.targetNode,t.edge.targetAnchor)),x=M(()=>{const l=[t.edge.sourceNodeId,t.edge.targetNodeId],u={x:t.sourceNode.x,y:t.sourceNode.y,width:t.sourceNode.width,height:t.sourceNode.height},p={x:t.targetNode.x,y:t.targetNode.y,width:t.targetNode.width,height:t.targetNode.height},k=kt(c.value,t.edge.sourceAnchor,y.value,t.edge.targetAnchor,t.allNodes,l,u,p);return Ct(k,s.value)}),v=M(()=>Wn(c.value,y.value));return(l,u)=>(D(),I("g",{"data-edge-id":e.edge.id,class:ye(["flowchart-edge",{selected:e.isSelected}]),onClick:u[0]||(u[0]=Ce(p=>l.$emit("click",e.edge.id),["stop"])),onDblclick:u[1]||(u[1]=Ce(p=>l.$emit("dblClick",e.edge.id),["stop"]))},[C("path",{d:x.value,fill:"none",stroke:"transparent","stroke-width":a.value,style:{cursor:"pointer"}},null,8,To),C("path",{d:x.value,fill:"none",stroke:n.value,"stroke-width":e.edge.style?.strokeWidth??2,"stroke-linecap":"round","marker-end":o.value,class:"edge-path"},null,8,Bo),e.edge.label?(D(),I("text",{key:0,x:v.value.x,y:v.value.y,"text-anchor":"middle","dominant-baseline":"central","font-size":"12",fill:"var(--fc-edge-label-fill)",style:{"pointer-events":"none"}},Xe(e.edge.label),9,Yo)):X("",!0)],42,Fo))}}),_o=Object.assign(Se(Xo,[["__scopeId","data-v-ff6c9e83"]]),{__name:"AdminKnowledgeNotebookFlowchartEdge"}),Oo={key:0,class:"anchor-points"},Ro=["data-anchor","cx","cy","r"],zo=we({__name:"AnchorPoints",props:{node:{},visible:{type:Boolean},viewport:{},hoveredAnchor:{},hoveredNodeId:{}},setup(e){const t=e,n=M(()=>Math.max(5/t.viewport.zoom,3)),o=M(()=>["top","right","bottom","left"].map(a=>({position:a,...Ue(t.node,a)})));function s(i){return t.hoveredNodeId===t.node.id&&t.hoveredAnchor===i}return(i,a)=>e.visible?(D(),I("g",Oo,[(D(!0),I(pe,null,ke(o.value,c=>(D(),I("circle",{key:c.position,"data-anchor":c.position,cx:c.x,cy:c.y,r:s(c.position)?n.value*1.5:n.value,fill:"#fff",stroke:"#4A90D9","stroke-width":"1.5",style:{cursor:"crosshair",transition:"r 0.15s"}},null,8,Ro))),128))])):X("",!0)}}),Ho=Object.assign(zo,{__name:"AdminKnowledgeNotebookFlowchartAnchorPoints"}),Wo={class:"resize-handles"},Go=["data-handle-id","x","y","width","height"],Ko=we({__name:"ResizeHandles",props:{node:{},viewport:{}},setup(e){const t=e,n=M(()=>Math.max(8/t.viewport.zoom,4)),o=M(()=>{const{x:s,y:i,width:a,height:c}=t.node;return[{id:"top-left",x:s,y:i,cursor:"nwse-resize"},{id:"top-center",x:s+a/2,y:i,cursor:"ns-resize"},{id:"top-right",x:s+a,y:i,cursor:"nesw-resize"},{id:"middle-left",x:s,y:i+c/2,cursor:"ew-resize"},{id:"middle-right",x:s+a,y:i+c/2,cursor:"ew-resize"},{id:"bottom-left",x:s,y:i+c,cursor:"nesw-resize"},{id:"bottom-center",x:s+a/2,y:i+c,cursor:"ns-resize"},{id:"bottom-right",x:s+a,y:i+c,cursor:"nwse-resize"}]});return(s,i)=>(D(),I("g",Wo,[(D(!0),I(pe,null,ke(o.value,a=>(D(),I("rect",{key:a.id,"data-handle-id":a.id,x:a.x-n.value/2,y:a.y-n.value/2,width:n.value,height:n.value,fill:"#fff",stroke:"#4A90D9","stroke-width":"1.5",style:De({cursor:a.cursor}),rx:"1"},null,12,Go))),128))]))}}),Uo=Object.assign(Ko,{__name:"AdminKnowledgeNotebookFlowchartResizeHandles"}),Vo=["data-node-id"],Jo=["x","y","width","height","rx","fill","stroke","stroke-width","opacity"],jo=["points","fill","stroke","stroke-width","opacity"],Zo=["cx","cy","rx","ry","fill","stroke","stroke-width","opacity"],qo=["points","fill","stroke","stroke-width","opacity"],Qo={key:4},er=["x","y","width","height","fill","stroke"],tr=["x","y","width","height"],nr="#fff",or="#3a3a3a",rr=we({__name:"FlowchartNode",props:{node:{},isSelected:{type:Boolean},viewport:{},isEditing:{type:Boolean},showAnchors:{type:Boolean},hoveredAnchor:{},hoveredNodeId:{}},emits:["dblClick"],setup(e){const t=e,{theme:n}=ft(),o=M(()=>t.node.style?.backgroundColor?t.node.style.backgroundColor:n.value==="dark"?or:nr),s=M(()=>Qn(o.value)),i=M(()=>Math.min(15,t.node.width*.15)),a=M(()=>t.node.x+t.node.width/2),c=M(()=>t.node.y+t.node.height/2),y=M(()=>t.node.type==="text"?4:8),x=M(()=>{const{x:l,y:u,width:p,height:k}=t.node;return`${l+p/2},${u} ${l+p},${u+k/2} ${l+p/2},${u+k} ${l},${u+k/2}`}),v=M(()=>{const{x:l,y:u,width:p,height:k}=t.node,P=i.value;return`${l+P},${u} ${l+p},${u} ${l+p-P},${u+k} ${l},${u+k}`});return(l,u)=>(D(),I("g",{"data-node-id":e.node.id,class:ye(["flowchart-node",{selected:e.isSelected}]),onDblclick:u[0]||(u[0]=Ce(p=>l.$emit("dblClick",e.node.id),["stop"]))}
1,[e.node.type==="rectangle"?(D(),I("rect",{key:0,x:e.node.x,y:e.node.y,width:e.node.width,height:e.node.height,rx:e.node.style?.borderRadius??4,fill:o.value,stroke:e.node.style?.borderColor??"var(--fc-node-default-stroke)","stroke-width":e.node.style?.borderWidth??2,opacity:e.node.style?.opacity??1},null,8,Jo)):X("",!0),e.node.type==="diamond"?(D(),I("polygon",{key:1,points:x.value,fill:o.value,stroke:e.node.style?.borderColor??"var(--fc-node-default-stroke)","stroke-width":e.node.style?.borderWidth??2,opacity:e.node.style?.opacity??1},null,8,jo)):X("",!0),e.node.type==="ellipse"?(D(),I("ellipse",{key:2,cx:a.value,cy:c.value,rx:e.node.width/2,ry:e.node.height/2,fill:o.value,stroke:e.node.style?.borderColor??"var(--fc-node-default-stroke)","stroke-width":e.node.style?.borderWidth??2,opacity:e.node.style?.opacity??1},null,8,Zo)):X("",!0),e.node.type==="parallelogram"?(D(),I("polygon",{key:3,points:v.value,fill:o.value,stroke:e.node.style?.borderColor??"var(--fc-node-default-stroke)","stroke-width":e.node.style?.borderWidth??2,opacity:e.node.style?.opacity??1},null,8,qo)):X("",!0),e.node.type==="text"?(D(),I("g",Qo,[C("rect",{x:e.node.x,y:e.node.y,width:e.node.width,height:e.node.height,fill:e.isSelected?"var(--fc-text-node-selected-fill)":"var(--fc-text-node-fill)",stroke:e.isSelected?"var(--fc-text-node-selected-stroke)":"var(--fc-text-node-stroke)","stroke-width":1,"stroke-dasharray":"4,3",rx:"2"},null,8,er)])):X("",!0),(D(),I("foreignObject",{x:e.node.x+y.value,y:e.node.y+y.value,width:Math.max(0,e.node.width-y.value*2),height:Math.max(0,e.node.height-y.value*2),style:{overflow:"visible","pointer-events":"none"}},[C("div",{xmlns:"http://www.w3.org/1999/xhtml",style:De({width:"100%",height:"100%",display:"flex",alignItems:e.node.type==="text"?"flex-start":"center",justifyContent:"center",textAlign:"center",fontSize:(e.node.style?.fontSize??14)+"px",color:s.value,opacity:e.node.style?.opacity??1,lineHeight:(e.node.style?.fontSize??14)+4+"px",wordBreak:"break-word",whiteSpace:"pre-wrap",userSelect:"none",overflow:"hidden"})},Xe(e.node.label),5)],8,tr)),Ye(Ho,{node:e.node,visible:e.showAnchors,viewport:e.viewport,"hovered-anchor":e.hoveredAnchor,"hovered-node-id":e.hoveredNodeId},null,8,["node","visible","viewport","hovered-anchor","hovered-node-id"]),e.isSelected?(D(),_e(Uo,{key:5,node:e.node,viewport:e.viewport},null,8,["node","viewport"])):X("",!0)],42,Vo))}}),lr=Object.assign(Se(rr,[["__scopeId","data-v-27579a99"]]),{__name:"AdminKnowledgeNotebookFlowchartNode"}),ir=["rows","onKeydown"],ar=we({__name:"TextNodeEditor",props:{cx:{},cy:{},width:{},text:{},fontSize:{},viewport:{}},emits:["commit","cancel"],setup(e,{emit:t}){const n=e,o=t,s=T(n.text),i=T(null),a=M(()=>{const{panX:v,panY:l,zoom:u}=n.viewport,p=Math.max(n.width*u,80);return{left:`${n.cx*u+v}px`,top:`${n.cy*u+l}px`,width:`${p}px`,transform:"translate(-50%, -50%)"}}),c=M(()=>({fontSize:`${(n.fontSize??14)*n.viewport.zoom}px`})),y=M(()=>Math.max(1,(s.value.match(/\n/g)||[]).length+1));function x(){s.value!==n.text?o("commit",s.value):o("cancel")}return dt(async()=>{await ut(),i.value?.focus(),i.value?.select()}),(v,l)=>(D(),I("div",{class:"text-editor-overlay",style:De(a.value)},[Ln(C("textarea",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":l[0]||(l[0]=u=>s.value=u),class:"editor-input",style:De(c.value),rows:y.value,onKeydown:[Tt(Ce(x,["exact"]),["enter"]),l[1]||(l[1]=Tt(()=>v.$emit("cancel"),["escape"]))],onBlur:x},null,44,ir),[[En,s.value]])],4))}}),sr=Object.assign(Se(ar,[["__scopeId","data-v-eb9ca862"]]),{__name:"AdminKnowledgeNotebookFlowchartTextNodeEditor"}),cr=["width","height","x","y"],dr=["fill"],ur=["width","height","x","y"],fr=["fill"],hr=["width","height","x","y"],yr=["fill"],vr=["width","height","x","y"],gr=["fill"],pr=["id"],xr=["fill"],wr={key:0,width:"100%",height:"100%",fill:"url(#sub2)"},mr={key:1,width:"100%",height:"100%",fill:"url(#sub5)"},kr={key:2,width:"100%",height:"100%",fill:"url(#sub10)"},br=["transform"],Cr={class:"edges-layer"},Dr=["data-freeline-id"],Ir=["x1","y1","x2","y2","stroke-width"],Pr=["x1","y1","x2","y2","stroke","stroke-width"],Mr=["data-freeline-id","cx","cy"],Nr=["data-freeline-id","cx","cy"],Lr=["data-freeline-id","cx","cy"],Er=["data-freeline-id","cx","cy"],Sr={key:0,class:"drawing-layer"},$r=["d"],Ar=["points"],Fr={class:"nodes-layer"},Tr={class:"edge-handles-layer"},Br={key:0}
1,Yr=["data-edge-id","cx","cy"],Xr=["data-edge-id","cx","cy"],_r=["d"],Or=["x1","y1","x2","y2"],Rr={key:3,class:"node-tool-preview"},zr=["x","y","width","height"],Hr=["points"],Wr=["cx","cy","rx","ry"],Gr=["points"],Kr={key:4},Ur=["x","y","width","height"],Vr=["x","y"],Ge=15,at=3,Jr=400,jr=we({__name:"FlowchartCanvas",props:{nodes:{},edges:{},freeLines:{},viewport:{},selectedNodeId:{},selectedEdgeId:{},selectedFreeLineId:{},lineToolActive:{type:Boolean},activeNodeTool:{},drawingState:{},editingNodeId:{},editingInfo:{},editingKey:{}},emits:["canvasClick","nodeClick","nodeDblClick","edgeClick","freeLineClick","freeLineDraw","freeLineMove","nodeToolDraw","panMove","nodeDragMove","nodeResize","anchorMouseDown","anchorMouseUp","drawingUpdate","drawingCancel","canvasDrop","canvasWheel","labelCommit","labelCancel","edgeReroute"],setup(e,{emit:t}){const{theme:n}=ft(),o=e,s=M(()=>{const d=o.viewport.zoom;return d<=.1?8:d<=.25?4:d<=.5?2:1}),i=M(()=>Ge*s.value*o.viewport.zoom),a=M(()=>o.viewport.panX%i.value),c=M(()=>o.viewport.panY%i.value),y=M(()=>o.viewport.zoom>=2),x=M(()=>o.viewport.zoom>=5),v=M(()=>o.viewport.zoom>=10),l=M(()=>{const d=o.viewport.zoom;return d>=10?Ge/10:d>=5?Ge/5:d>=2?Ge/2:Ge*s.value}),u=M(()=>n.value==="dark"?"#555":"#B0B0B0"),p=M(()=>n.value==="dark"?"#444":"#D0D0D0"),k=M(()=>{const d=new Set([be]);for(const b of o.edges){const f=b.style?.strokeColor??be;d.add(f)}return Array.from(d)});function P(d){return`arrowhead-${d.replace("#","")}`}const w=t,L=T(null),_=T(null),oe=T(null),Q=T(null),re=T(""),J=T(!1),N=T(null),E=T(""),S=T(0),O=T(0),H=T(0),te=T(0),j=T(null),q=T(0),ve=T(0),he=T(0),m=T(0),G=M(()=>h.type==="pan"?"grabbing":h.type==="node"||h.type==="clickPending"?"move":h.type==="resize"?"default":o.lineToolActive||o.activeNodeTool?"crosshair":"default"),ee=M(()=>`translate(${o.viewport.panX}, ${o.viewport.panY}) scale(${o.viewport.zoom})`),me=M(()=>o.edges.filter(d=>de(d.sourceNodeId)&&de(d.targetNodeId))),Ze=M(()=>o.nodes.map(d=>({id:d.id,type:d.type,x:d.x,y:d.y,width:d.width,height:d.height}))),yt=M(()=>{const d=q.value,b=ve.value,f=he.value,$=m.value;return`${d+f/2},${b} ${d+f},${b+$/2} ${d+f/2},${b+$} ${d},${b+$/2}`}),Fe=M(()=>{const d=q.value,b=ve.value,f=he.value,$=m.value,F=Math.min(15,f*.15);return`${d+F},${b} ${d+f},${b} ${d+f-F},${b+$} ${d},${b+$}`});function de(d){return o.nodes.find(b=>b.id===d)}function Te(d){const b=de(d.sourceNodeId);return b?Me(b,d.sourceAnchor):{x:0,y:0}}function qe(d){const b=de(d.targetNodeId);return b?Me(b,d.targetAnchor):{x:0,y:0}}function vt(d){return!!(d===o.selectedNodeId||o.drawingState?.active&&d!==o.drawingState.sourceNodeId||J.value)}const gt=M(()=>{const d=o.drawingState;if(!d?.active)return"";const b=de(d.sourceNodeId);if(!b)return"";const f=Me(b,d.sourceAnchor),$=d.sourceAnchor==="top"?"bottom":d.sourceAnchor==="bottom"?"top":d.sourceAnchor==="left"?"right":"left";return Ct(kt(f,d.sourceAnchor,{x:d.currentMouseX,y:d.currentMouseY},$))}),pt=M(()=>{const d=o.drawingState;if(!d?.active)return"";const b=de(d.sourceNodeId);if(!b)return"";const f=Me(b,d.sourceAnchor),$=d.currentMouseX,F=d.currentMouseY,B=Math.atan2(F-f.y,$-f.x),K=$-10*Math.cos(B-.4),W=F-10*Math.sin(B-.4),ne=$-10*Math.cos(B+.4),Z=F-10*Math.sin(B+.4);return`${$},${F} ${K},${W} ${ne},${Z}`});let h={type:"none"},Be=null,ze=0;function $e(d,b){const f=_.value?.getBoundingClientRect();return f?{x:(d-f.left-o.viewport.panX)/o.viewport.zoom,y:(b-f.top-o.viewport.panY)/o.viewport.zoom}:{x:0,y:0}}function Qe(d,b,f){const $=de(d);if(!$)return null;for(const F of["top","right","bottom","left"]){const B=Ue($,F);if(Math.hypot(b-B.x,f-B.y)<20)return F}return null}function He(d,b,f,$){const F=z(d,l.value),B=z(b,l.value),K=z(f,l.value),W=z($,l.value);q.value=Math.min(F,K),ve.value=Math.min(B,W),he.value=Math.max(Math.abs(K-F),Yn),m.value=Math.max(Math.abs(W-B),Xn)}function Ie(){j.value=null,he.value=0,m.value=0}function ge(d){if(d.button===1){h={type:"pan",startPX:d.clientX,startPY:d.clientY,startPanX:o.viewport.panX,startPanY:o.viewport.panY},L.value.setPointerCapture(d.pointerId),d.preventDefault();return}if(d.button!==0)return;const b=d.target,f=$e(d.clientX,d.clientY);if(o.drawingState?.active){for(const R of o.nodes){if(R.id===o.drawingState.sourceNodeId)continue;const U=Qe(R.id,f.x,f.y);if(U){w("anchorMouseUp",R.id,U),h={type:"none"},oe.value=null,Q.value=null;return}}w("drawingCancel"),h={type:"none"},oe.value=null,Q.value=null;return}const $=b.closest("[data-edge-handle]");if($){const R=$.getAttribute("data-edge-id"),U=$.getAttribute("data-edge-handle");h={type:"edgeHandle",edgeId:R,handle:U,startPX:d.clientX,startPY:d.clientY},J.value=!0,N.value=R,L.value.setPointerCapture(d.pointerId),d.preventDefault();return}const F=b.closest("[data-edge-id]");if(F){const R=F.getAttribute("data-edge-id");w("edgeClick",R),d.preventDefault();return}const B=b.closest("[data-freeline-handle]");if(B){const R=B.getAttribute("data-freeline-id"),U=B.getAttribute("data-freeline-handle"),ae=o.freeLines.find(We=>We.id===R);ae&&(w("freeLineClick",R),h={type:"freeLineEndpoint",freeLineId:R,handle:U,startX1:ae.x1,startY1:ae.y1,startX2:ae.x2,startY2:ae.y2},L.value.setPointerCapture(d.pointerId)),d.preventDefault();return}const K=b.closest("[data-freeline-id]");if(K){const R=K.getAttribute("data-freeline-id"),U=o.freeLines.find(ae=>ae.id===R);if(U){w("freeLineClick",R);const ae=z(f.x,l.value),We=z(f.y,l.value);h={type:"freeLineMove",freeLineId:R,startX1:U.x1,startY1:U.y1,startX2:U.x2,startY2:U.y2,startPX:ae,startPY:We},L.value.setPointerCapture(d.pointerId)}d.preventDefault();return}const W=b.closest("[data-handle-id]");if(W){const R=W.getAttribute("data-handle-id"),U=b.closest("[data-node-id]").getAttribute("data-node-id"),ae=de(U);h={type:"resize",nodeId:U,handle:R,pnx:f.x,pny:f.y,nx:ae.x,ny:ae.y,nw:ae.width,nh:ae.height},L.value.setPointerCapture(d.pointerId),d.preventDefault();return}const ne=b.closest("[data-anchor]");if(ne){const R=ne.getAttribute("data-anchor"),U=b.closest("[data-node-id]").getAttribute("data-node-id");w("anchorMouseDown",U,R),h={type:"drawing",sourceNodeId:U,sourceAnchor:R},L.value.setPointerCapture(d.pointerId),d.preventDefault();return}const Z=b.closest("[data-node-id]");if(Z){const R=Z.getAttribute("data-node-id"),U=Date.now();if(Be===R&&U-ze<Jr){w("nodeDblClick",R),Be=null,ze=0,d.preventDefault();return}Be=R,ze=U,w("nodeClick",R),h={type:"clickPending",nodeId:R,startPX:d.clientX,startPY:d.clientY},d.preventDefault();return}if(Be=null,w("canvasClick"),o.activeNodeTool){He(f.x,f.y,f.x,f.y),j.value=o.activeNodeTool,h={type:"nodeTool",nodeType:o.activeNodeTool,startX:f.x,startY:f.y,startPX:d.clientX,startPY:d.clientY},L.value.setPointerCapture(d.pointerId),d.preventDefault();return}
1if(d.shiftKey||o.lineToolActive){const R=z(f.x,l.value),U=z(f.y,l.value);S.value=R,O.value=U,H.value=R,te.value=U,E.value=`M${R},${U} L${R},${U}`,h={type:"freeLine",startX:R,startY:U},L.value.setPointerCapture(d.pointerId),d.preventDefault();return}h={type:"pan",startPX:d.clientX,startPY:d.clientY,startPanX:o.viewport.panX,startPanY:o.viewport.panY},L.value.setPointerCapture(d.pointerId),d.preventDefault()}function et(d){const b=$e(d.clientX,d.clientY);if((h.type!=="none"||o.drawingState?.active)&&d.preventDefault(),h.type==="freeLine"){const f=z(b.x,l.value),$=z(b.y,l.value);H.value=f,te.value=$,E.value=`M${S.value},${O.value} L${f},${$}`;return}if(h.type==="nodeTool"){He(h.startX,h.startY,b.x,b.y);return}if(h.type==="freeLineMove"){const f=z(b.x,l.value),$=z(b.y,l.value),F=f-h.startPX,B=$-h.startPY;w("freeLineMove",h.freeLineId,z(h.startX1+F,l.value),z(h.startY1+B,l.value),z(h.startX2+F,l.value),z(h.startY2+B,l.value));return}if(h.type==="freeLineEndpoint"){const f=z(b.x,l.value),$=z(b.y,l.value);h.handle==="start"?w("freeLineMove",h.freeLineId,f,$,h.startX2,h.startY2):w("freeLineMove",h.freeLineId,h.startX1,h.startY1,f,$);return}if(h.type==="pan"){w("panMove",d.clientX-h.startPX+h.startPanX,d.clientY-h.startPY+h.startPanY);return}if(h.type==="edgeHandle"){const f=h.edgeId,$=h.handle;let F=null,B=null,K=1/0;for(const ne of o.nodes){o.edges.find(Z=>Z.id===f)&&(ne.id===o.edges.find(Z=>Z.id===f).sourceNodeId||(ne.id,o.edges.find(Z=>Z.id===f).targetNodeId));for(const Z of["top","right","bottom","left"]){const R=Ue(ne,Z),U=Math.hypot(b.x-R.x,b.y-R.y);U<25&&U<K&&(K=U,F=ne.id,B=Z)}}oe.value=F,Q.value=B;const W=o.edges.find(ne=>ne.id===f);if(W){const ne=de($==="source"?W.targetNodeId:W.sourceNodeId),Z=$==="source"?W.targetAnchor:W.sourceAnchor;if(ne){const R=Me(ne,Z),U=F&&B?B:Z==="top"?"bottom":Z==="bottom"?"top":Z==="left"?"right":"left",ae=F&&B?Me(de(F),B):b;re.value=Ct(kt(R,Z,ae,U))}}return}if(h.type==="clickPending"){if(Math.abs(d.clientX-h.startPX)<at&&Math.abs(d.clientY-h.startPY)<at)return;const f=de(h.nodeId);h={type:"node",nodeId:h.nodeId,startNX:f.x,startNY:f.y,startPX:h.startPX,startPY:h.startPY},L.value.setPointerCapture(d.pointerId)}if(o.drawingState?.active||h.type==="drawing"){w("drawingUpdate",b.x,b.y);const f=o.drawingState?.sourceNodeId??(h.type==="drawing"?h.sourceNodeId:null);let $=null,F=null,B=1/0;for(const K of o.nodes)if(K.id!==f)for(const W of["top","right","bottom","left"]){const ne=Ue(K,W),Z=Math.hypot(b.x-ne.x,b.y-ne.y);Z<25&&Z<B&&(B=Z,$=K.id,F=W)}oe.value=$,Q.value=F;return}if(h.type!=="none"){if(h.type==="node"){const f=(d.clientX-h.startPX)/o.viewport.zoom,$=(d.clientY-h.startPY)/o.viewport.zoom;w("nodeDragMove",h.nodeId,z(h.startNX+f,l.value),z(h.startNY+$,l.value));return}if(h.type==="resize"){const f=b.x-h.pnx,$=b.y-h.pny;let F=h.nx,B=h.ny,K=h.nw,W=h.nh;const ne=40,Z=30;switch(h.handle){case"top-left":F=h.nx+f,B=h.ny+$,K=h.nw-f,W=h.nh-$;break;case"top-center":B=h.ny+$,W=h.nh-$;break;case"top-right":B=h.ny+$,K=h.nw+f,W=h.nh-$;break;case"middle-left":F=h.nx+f,K=h.nw-f;break;case"middle-right":K=h.nw+f;break;case"bottom-left":F=h.nx+f,K=h.nw-f,W=h.nh+$;break;case"bottom-center":W=h.nh+$;break;case"bottom-right":K=h.nw+f,W=h.nh+$;break}K<ne&&(h.handle.includes("left")&&(F=h.nx+h.nw-ne),K=ne),W<Z&&(h.handle.includes("top")&&(B=h.ny+h.nh-Z),W=Z),h.handle==="top-left"||h.handle==="top-right"||h.handle==="bottom-left"||h.handle==="bottom-right"?(F=z(F,l.value),B=z(B,l.value),K=z(K,l.value),W=z(W,l.value)):h.handle==="top-center"||h.handle==="bottom-center"?(B=z(B,l.value),W=z(W,l.value)):(F=z(F,l.value),K=z(K,l.value)),K<ne&&(K=ne),W<Z&&(W=Z),w("nodeResize",h.nodeId,F,B,K,W)}}}function xt(d){if(h.type!=="none"){if(h.type==="freeLine"){const b=S.value,f=O.value,$=H.value,F=te.value;E.value="",h={type:"none"},L.value?.releasePointerCapture(d.pointerId),(b!==$||f!==F)&&w("freeLineDraw",b,f,$,F);return}if(h.type==="nodeTool"){(Math.abs(d.clientX-h.startPX)>=at||Math.abs(d.clientY-h.startPY)>=at)&&w("nodeToolDraw",h.nodeType,q.value,ve.value,he.value,m.value),Ie(),h={type:"none"},L.value?.releasePointerCapture(d.pointerId);return}if(h.type==="freeLineMove"){h={type:"none"},L.value?.releasePointerCapture(d.pointerId);return}if(h.type==="freeLineEndpoint"){h={type:"none"},L.value?.releasePointerCapture(d.pointerId);return}if(h.type==="edgeHandle"){oe.value&&Q.value&&w("edgeReroute",h.edgeId,h.handle,oe.value,Q.value),re.value="",oe.value=null,Q.value=null,J.value=!1,N.value=null,h={type:"none"},L.value?.releasePointerCapture(d.pointerId);return}if(h.type==="pan"||h.type==="clickPending"){h={type:"none"},L.value?.releasePointerCapture(d.pointerId);return}if(h.type==="drawing"){const b=$e(d.clientX,d.clientY);for(const f of o.nodes){if(f.id===h.sourceNodeId)continue;const $=Qe(f.id,b.x,b.y);if($){w("anchorMouseUp",f.id,$),h={type:"none"},oe.value=null,Q.value=null,L.value?.releasePointerCapture(d.pointerId);return}}w("drawingCancel"),h={type:"none"},oe.value=null,Q.value=null,L.value?.releasePointerCapture(d.pointerId);return}h={type:"none"},L.value?.releasePointerCapture(d.pointerId)}}function tt(d){h.type==="freeLine"&&(E.value=""),h.type==="nodeTool"&&Ie(),h.type==="drawing"&&w("drawingCancel"),re.value="",oe.value=null,Q.value=null,J.value=!1,N.value=null,h={type:"none"},L.value?.hasPointerCapture(d.pointerId)&&L.value.releasePointerCapture(d.pointerId)}function Ne(d){const b=_.value?.getBoundingClientRect();b&&w("canvasWheel",d,b)}
1function nt(d){if(d.dataTransfer?.getData("application/x-flowchart-freeline")){const F=$e(d.clientX,d.clientY),B=z(F.x,l.value),K=z(F.y,l.value),W=z(120,l.value);w("freeLineDraw",B-W/2,K,B+W/2,K);return}const f=d.dataTransfer?.getData("application/x-flowchart-node-type");if(!f)return;const $=$e(d.clientX,d.clientY);w("canvasDrop",f,z($.x,l.value),z($.y,l.value),l.value)}return(d,b)=>(D(),I("div",{ref_key:"wrapperRef",ref:_,class:"canvas-wrapper",style:De({cursor:G.value}),onDrop:Ce(nt,["prevent"]),onDragover:b[4]||(b[4]=Ce(()=>{},["prevent"]))},[(D(),I("svg",{ref_key:"svgRef",ref:L,class:"flowchart-svg",onPointerdown:ge,onPointermove:et,onPointerup:xt,onPointercancel:tt,onWheel:Ce(Ne,["prevent"]),onContextmenu:b[1]||(b[1]=Ce(()=>{},["prevent"]))},[C("defs",null,[C("pattern",{id:"mainGrid",width:i.value,height:i.value,patternUnits:"userSpaceOnUse",x:a.value,y:c.value},[C("circle",{cx:"0",cy:"0",r:"1.5",fill:u.value},null,8,dr)],8,cr),C("pattern",{id:"sub2",width:i.value/2,height:i.value/2,patternUnits:"userSpaceOnUse",x:a.value,y:c.value},[C("circle",{cx:"0",cy:"0",r:"1.0",fill:p.value},null,8,fr)],8,ur),C("pattern",{id:"sub5",width:i.value/5,height:i.value/5,patternUnits:"userSpaceOnUse",x:a.value,y:c.value},[C("circle",{cx:"0",cy:"0",r:"1.0",fill:p.value},null,8,yr)],8,hr),C("pattern",{id:"sub10",width:i.value/10,height:i.value/10,patternUnits:"userSpaceOnUse",x:a.value,y:c.value},[C("circle",{cx:"0",cy:"0",r:"1.0",fill:p.value},null,8,gr)],8,vr),(D(!0),I(pe,null,ke(k.value,f=>(D(),I("marker",{id:P(f),key:f,markerWidth:"10",markerHeight:"7",refX:"9",refY:"3.5",orient:"auto",markerUnits:"strokeWidth"},[C("polygon",{points:"0 0, 10 3.5, 0 7",fill:f},null,8,xr)],8,pr))),128))]),b[5]||(b[5]=C("rect",{width:"100%",height:"100%",fill:"url(#mainGrid)"},null,-1)),y.value?(D(),I("rect",wr)):X("",!0),x.value?(D(),I("rect",mr)):X("",!0),v.value?(D(),I("rect",kr)):X("",!0),C("g",{transform:ee.value},[C("g",Cr,[(D(!0),I(pe,null,ke(me.value,f=>(D(),_e(_o,{key:f.id,edge:f,"source-node":de(f.sourceNodeId),"target-node":de(f.targetNodeId),"is-selected":f.id===e.selectedEdgeId,"all-nodes":Ze.value,onClick:b[0]||(b[0]=$=>w("edgeClick",$))},null,8,["edge","source-node","target-node","is-selected","all-nodes"]))),128)),(D(!0),I(pe,null,ke(e.freeLines,f=>(D(),I("g",{key:f.id,"data-freeline-id":f.id},[C("line",{x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,stroke:"transparent","stroke-width":(f.style?.strokeWidth??2)+8,"stroke-linecap":"round",style:{cursor:"pointer"}},null,8,Ir),C("line",{x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,stroke:f.style?.strokeColor??"#555","stroke-width":f.id===e.selectedFreeLineId?(f.style?.strokeWidth??2)*1.5:f.style?.strokeWidth??2,"stroke-linecap":"round",style:{cursor:"pointer",transition:"stroke-width 0.1s"}},null,8,Pr),f.id===e.selectedFreeLineId?(D(),I(pe,{key:0},[C("circle",{"data-freeline-handle":"start","data-freeline-id":f.id,cx:f.x1,cy:f.y1,r:"12",fill:"transparent",style:{cursor:"grab"}},null,8,Mr),C("circle",{"data-freeline-handle":"start","data-freeline-id":f.id,cx:f.x1,cy:f.y1,r:"5",fill:"#4A90D9",stroke:"#fff","stroke-width":"2",style:{"pointer-events":"none"}},null,8,Nr),C("circle",{"data-freeline-handle":"end","data-freeline-id":f.id,cx:f.x2,cy:f.y2,r:"12",fill:"transparent",style:{cursor:"grab"}},null,8,Lr),C("circle",{"data-freeline-handle":"end","data-freeline-id":f.id,cx:f.x2,cy:f.y2,r:"5",fill:"#4A90D9",stroke:"#fff","stroke-width":"2",style:{"pointer-events":"none"}},null,8,Er)],64)):X("",!0)],8,Dr))),128))]),e.drawingState?.active?(D(),I("g",Sr,[C("path",{d:gt.value,fill:"none",stroke:"#4A90D9","stroke-width":"2","stroke-linecap":"round","stroke-dasharray":"6,3"},null,8,$r),e.drawingState?.active?(D(),I("polygon",{key:0,points:pt.value,fill:"#4A90D9"},null,8,Ar)):X("",!0)])):X("",!0),C("g",Fr,[(D(!0),I(pe,null,ke(e.nodes,f=>(D(),_e(lr,{key:f.id,node:f,"is-selected":f.id===e.selectedNodeId,viewport:e.viewport,"show-anchors":vt(f.id),"is-editing":!1,"hovered-anchor":Q.value,"hovered-node-id":oe.value},null,8,["node","is-selected","viewport","show-anchors","hovered-anchor","hovered-node-id"]))),128))]),C("g",Tr,[(D(!0),I(pe,null,ke(me.value,f=>(D(),I(pe,{key:f.id+"-handles"},[f.id===e.selectedEdgeId?(D(),I("g",Br,[C("circle",{"data-edge-handle":"source","data-edge-id":f.id,cx:Te(f).x,cy:Te(f).y,r:"6",fill:"#4A90D9",stroke:"#fff","stroke-width":"2",style:{cursor:"grab"}},null,8,Yr),C("circle",{"data-edge-handle":"target","data-edge-id":f.id,cx:qe(f).x,cy:qe(f).y,r:"6",fill:"#4A90D9",stroke:"#fff","stroke-width":"2",style:{cursor:"grab"}},null,8,Xr)])):X("",!0)],64))),128))]),re.value?(D(),I("path",{key:1,d:re.value,fill:"none",stroke:"#4A90D9","stroke-width":"2","stroke-linecap":"round","stroke-dasharray":"6,3"},null,8,_r)):X("",!0),E.value?(D(),I("line",{key:2,x1:S.value,y1:O.value,x2:H.value,y2:te.value,stroke:"#4A90D9","stroke-width":"2","stroke-linecap":"round","stroke-dasharray":"6,3"},null,8,Or)):X("",!0),j.value?(D(),I("g",Rr,[j.value==="rectangle"?(D(),I("rect",{key:0,x:q.value,y:ve.value,width:he.value,height:m.value,rx:"4"},null,8,zr)):X("",!0),j.value==="diamond"?(D(),I("polygon",{key:1,points:yt.value},null,8,Hr)):X("",!0),j.value==="ellipse"?(D(),I("ellipse",{key:2,cx:q.value+he.value/2,cy:ve.value+m.value/2,rx:he.value/2,ry:m.value/2},null,8,Wr)):X("",!0),j.value==="parallelogram"?(D(),I("polygon",{key:3,points:Fe.value},null,8,Gr)):X("",!0),j.value==="text"?(D(),I("g",Kr,[C("rect",{x:q.value,y:ve.value,width:he.value,height:m.value,rx:"2","stroke-dasharray":"6,4"},null,8,Ur),C("text",{x:q.value+he.value/2,y:ve.value+m.value/2,"text-anchor":"middle","dominant-baseline":"central","font-size":"18","font-weight":"700"},"T",8,Vr)])):X("",!0)])):X("",!0)],8,br)],544)),e.editingInfo?(D(),_e(sr,{key:e.editingKey,cx:e.editingInfo.cx,cy:e.editingInfo.cy,width:e.editingInfo.width,text:e.editingInfo.text,"font-size":e.editingInfo.fontSize,viewport:e.viewport,onCommit:b[2]||(b[2]=f=>w("labelCommit",f)),onCancel:b[3]||(b[3]=()=>w("labelCancel"))},null,8,["cx","cy","width","text","font-size","viewport"])):X("",!0)],36))}}),Zr=Object.assign(Se(jr,[["__scopeId","data-v-22735b90"]]),{__name:"AdminKnowledgeNotebookFlowchartCanvas"}),qr={key:0,class:"node-action-bar"},Qr={class:"color-row"},el=["title","onClick"],tl=we({__name:"NodeActionBar",props:{visible:{type:Boolean},currentColor:{}},emits:["pickColor"],setup(e){const t=e,{locale:n,mobile:o}=ft(),s=M(()=>Ve(n.value)),i=Jn,a=st,c=M(()=>{const P=t.currentColor;return!P||P===a?a:P}),y=T(null),x=T(null),v=T(!1),l=T(!1);function u(){const P=y.value;if(!P){v.value=!1,l.value=!1;return}v.value=P.scrollLeft>1,l.value=P.scrollLeft+P.clientWidth<P.scrollWidth-1}function p(P){const w=y.value;w&&w.scrollBy({left:w.clientWidth*.8*P,behavior:"smooth"})}let k=null;return Re(()=>t.visible,async P=>{if(P){await ut(),u();const w=y.value;w&&(w.addEventListener("scroll",u,{passive:!0}),k=new ResizeObserver(u),k.observe(w),x.value&&k.observe(x.value))}else{const w=y.value;w&&w.removeEventListener("scroll",u),k&&(k.disconnect(),k=null)}}),(P,w)=>(D(),_e(en,{name:"bar"},{default:Qt(()=>[e.visible?(D(),I("div",qr,[C("div",{ref_key:"barRef",ref:x,class:ye(["bar-inner",{"bar-inner-mobile":V(o)}])},[C("button",{class:ye(["scroll-arrow scroll-left",{invisible:!v.value}]),onClick:w[0]||(w[0]=L=>p(-1))},[...w[2]||(w[2]=[C("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round"},[C("polyline",{points:"15 18 9 12 15 6"})],-1)])],2),C("div",{ref_key:"scrollRef",ref:y,class:"color-scroll"},[C("div",Qr,[(D(!0),I(pe,null,ke(V(i),L=>(D(),I("button",{key:L,class:ye(["color-btn",{active:L===c.value,"is-default":L===V(a)}]),style:De({backgroundColor:L}),title:L===V(a)?s.value.colorName(L,!0):s.value.colorName(L,!1),onClick:_=>P.$emit("pickColor",L)},null,14,el))),128))])],512),C("button",{class:ye(["scroll-arrow scroll-right",{invisible:!l.value}]),onClick:w[1]||(w[1]=L=>p(1))},[...w[3]||(w[3]=[C("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round"},[C("polyline",{points:"9 18 15 12 9 6"}
1)],-1)])],2)],2)])):X("",!0)]),_:1}))}}),nl=Object.assign(Se(tl,[["__scopeId","data-v-5b871b53"]]),{__name:"AdminKnowledgeNotebookFlowchartNodeActionBar"}),ol={key:0,class:"edge-action-bar"},rl={class:"color-row"},ll=["title","onClick"],il=we({__name:"EdgeActionBar",props:{visible:{type:Boolean},currentColor:{}},emits:["pickColor"],setup(e){const t=e,{locale:n,mobile:o}=ft(),s=M(()=>Ve(n.value)),i=Zn,a=be,c=M(()=>{const P=t.currentColor;return!P||P===be?be:P}),y=T(null),x=T(null),v=T(!1),l=T(!1);function u(){const P=y.value;if(!P){v.value=!1,l.value=!1;return}v.value=P.scrollLeft>1,l.value=P.scrollLeft+P.clientWidth<P.scrollWidth-1}function p(P){const w=y.value;w&&w.scrollBy({left:w.clientWidth*.8*P,behavior:"smooth"})}let k=null;return Re(()=>t.visible,async P=>{if(P){await ut(),u();const w=y.value;w&&(w.addEventListener("scroll",u,{passive:!0}),k=new ResizeObserver(u),k.observe(w),x.value&&k.observe(x.value))}else{const w=y.value;w&&w.removeEventListener("scroll",u),k&&(k.disconnect(),k=null)}}),(P,w)=>(D(),_e(en,{name:"bar"},{default:Qt(()=>[e.visible?(D(),I("div",ol,[C("div",{ref_key:"barRef",ref:x,class:ye(["bar-inner",{"bar-inner-mobile":V(o)}])},[C("button",{class:ye(["scroll-arrow scroll-left",{invisible:!v.value}]),onClick:w[0]||(w[0]=L=>p(-1))},[...w[2]||(w[2]=[C("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round"},[C("polyline",{points:"15 18 9 12 15 6"})],-1)])],2),C("div",{ref_key:"scrollRef",ref:y,class:"color-scroll"},[C("div",rl,[(D(!0),I(pe,null,ke(V(i),L=>(D(),I("button",{key:L,class:ye(["color-btn",{active:L===c.value,"is-default":L===V(a)}]),style:De({backgroundColor:L}),title:L===V(a)?s.value.colorName(L,!0):s.value.colorName(L,!1),onClick:_=>P.$emit("pickColor",L)},null,14,ll))),128))])],512),C("button",{class:ye(["scroll-arrow scroll-right",{invisible:!l.value}]),onClick:w[1]||(w[1]=L=>p(1))},[...w[3]||(w[3]=[C("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round"},[C("polyline",{points:"9 18 15 12 9 6"})],-1)])],2)],2)])):X("",!0)]),_:1}))}}),al=Object.assign(Se(il,[["__scopeId","data-v-fb2adce8"]]),{__name:"AdminKnowledgeNotebookFlowchartEdgeActionBar"}),sl={width:32,height:24,class:"sidebar-drag-ghost-icon"},cl={key:0,x:"2",y:"2",width:"28",height:"20",rx:"3",fill:"var(--fc-sidebar-icon-fill)",stroke:"var(--fc-sidebar-icon-stroke)","stroke-width":"1.5"},dl={key:1,points:"16,1 30,12 16,23 2,12",fill:"var(--fc-sidebar-icon-fill)",stroke:"var(--fc-sidebar-icon-stroke)","stroke-width":"1.5"},ul={key:2,cx:"16",cy:"12",rx:"14",ry:"10",fill:"var(--fc-sidebar-icon-fill)",stroke:"var(--fc-sidebar-icon-stroke)","stroke-width":"1.5"},fl={key:3,points:"6,2 30,2 26,22 2,22",fill:"var(--fc-sidebar-icon-fill)",stroke:"var(--fc-sidebar-icon-stroke)","stroke-width":"1.5"},hl={key:4},yl={key:5},vl={key:0,class:"sidebar-drag-ghost-label"},gl={class:"canvas-toolbar"},pl=["disabled","title"],xl=["disabled","title"],wl=["title"],ml=["title"],kl=["title"],bl=["title"],Cl=50,Zt=1.08,Dl=30,Il=we({__name:"FlowchartContainer",props:{modelValue:{},theme:{},locale:{},mobile:{type:Boolean},width:{},height:{}},emits:["update:modelValue","nodeSelect","nodeDblClick","edgeSelect"],setup(e,{emit:t}){const n=e,o=M(()=>n.theme??"light"),s=M(()=>n.locale??"zh-CN"),i=M(()=>n.mobile??!1),a=M(()=>{const r=n.width;if(r!=null)return typeof r=="number"?`${r}px`:r}),c=M(()=>{const r=n.height;if(r!=null)return typeof r=="number"?`${r}px`:r});mt(tn,o),mt(It,s),mt(Pt,i);const y=t,x=Sn(n,"modelValue"),v=zn(x,(r,g)=>{y("update:modelValue",g)}),{internalData:l}=v,u=Hn(),{selectedNodeId:p,selectedEdgeId:k,selectedFreeLineId:P}=u,w=Gn(v.addNode,M(()=>Ve(s.value))),{templates:L}=w,_=M(()=>Ve(s.value)),oe=M(()=>p.value?_.value.t("node.delete"):k.value?_.value.t("edge.delete"):_.value.t("toolbar.delete")),Q=T(!1),re=T(null),J=T(null),N=T(null),E=T(null),S=M(()=>{const r=N.value;if(r)return{kind:"node",nodeType:r.nodeType,label:L.value.find(A=>A.type===r.nodeType)?.label??"",clientX:r.clientX,clientY:r.clientY};const g=E.value;return g?{kind:"line",label:_.value.t("sidebar.freeLine"),clientX:g.clientX,clientY:g.clientY}:null}),O=M(()=>{const r=S.value;return r?{left:`${r.clientX}px`,top:`${r.clientY}px`}:{}});function H(){Q.value=!Q.value,Q.value&&(re.value=null)}function te(r){re.value=re.value===r?null:r,re.value&&(Q.value=!1)}const j=Un(M(()=>l.value.nodes)),{viewport:q,handleWheel:ve,zoomAtCenter:he,resetView:m}=j,G=T([]),ee=T(-1),me=M(()=>ee.value>0),Ze=M(()=>ee.value<G.value.length-1);function yt(r){const g=JSON.parse(JSON.stringify(r));ee.value<G.value.length-1&&(G.value=G.value.slice(0,ee.value+1)),G.value.push(g),G.value.length>Cl?G.value.shift():ee.value++}let Fe=!1;function de(){me.value&&(Fe=!0,ee.value--,y("update:modelValue",JSON.parse(JSON.stringify(G.value[ee.value]))))}function Te(){Ze.value&&(Fe=!0,ee.value++,y("update:modelValue",JSON.parse(JSON.stringify(G.value[ee.value]))))}function qe(){const r=J.value;r&&he(Zt,r.clientWidth,r.clientHeight)}function vt(){const r=J.value;r&&he(1/Zt,r.clientWidth,r.clientHeight)}function gt(){const r=J.value;r?m(r.clientWidth,r.clientHeight):m(0,0)}Re(x,r=>{if(Fe){Fe=!1;return}JSON.stringify(r)!==JSON.stringify(G.value[ee.value]??null)&&yt(r)},{immediate:!0,deep:!0});function pt(r,g,A,Y){const le=JSON.parse(JSON.stringify(l.value)),ue=le.edges.find(ie=>ie.id===r);if(ue){const ie=g==="source"?ue.targetNodeId:ue.sourceNodeId;if(A===ie)return;g==="source"?(ue.sourceNodeId=A,ue.sourceAnchor=Y):(ue.targetNodeId=A,ue.targetAnchor=Y),y("update:modelValue",le)}}const h=Kn(v.addEdge),{drawingState:Be,startDrawing:ze,updateDrawing:$e,finishDrawing:Qe,cancelDrawing:He,isDrawing:Ie}=h,ge=T(null),et=T(0),xt=M(()=>{const r=ge.value;if(!r)return null;const g=v.getNode(r);return g?{cx:g.x+g.width/2,cy:g.y+g.height/2,width:g.width,text:g.label,fontSize:g.style?.fontSize??14}:null});Vn({Delete:F,Backspace:F,Escape:()=>{He(),Q.value=!1,re.value=null,u.clearSelection(),ot()},ArrowUp:r=>B(r,0,-1),ArrowDown:r=>B(r,0,1),ArrowLeft:r=>B(r,-1,0),ArrowRight:r=>B(r,1,0)}),dt(()=>{window.addEventListener("keydown",tt),window.addEventListener("paste",$),ut(()=>{const r=J.value;r&&m(r.clientWidth,r.clientHeight)})}),qt(()=>{window.removeEventListener("keydown",tt),window.removeEventListener("paste",$)});
1function tt(r){(r.metaKey||r.ctrlKey)&&(r.key==="z"||r.key==="Z"?r.shiftKey?(r.preventDefault(),Te()):(r.preventDefault(),de()):r.key==="y"||r.key==="Y"?(r.preventDefault(),Te()):r.key==="x"||r.key==="X"?(r.preventDefault(),d()):(r.key==="c"||r.key==="C")&&(r.preventDefault(),nt()))}const Ne=T(null);function nt(){if(ge.value)return;const r=u.selectedNodeId.value,g=u.selectedEdgeId.value,A=u.selectedFreeLineId.value;if(!(!r&&!g&&!A)){if(r){const Y=v.getNode(r);Y&&(Ne.value={nodes:[JSON.parse(JSON.stringify(Y))],edges:[]})}else if(g){const Y=v.getEdge(g);Y&&(Ne.value={nodes:[],edges:[JSON.parse(JSON.stringify(Y))]})}else if(A){const Y=v.getFreeLine(A);Y&&(Ne.value={nodes:[],edges:[],freeLines:[JSON.parse(JSON.stringify(Y))]})}}}function d(){nt(),F()}let b=0;function f(){if(!Ne.value)return;b++;const r=Dl*b,g=Ne.value,A=new Map,Y=(g.nodes??[]).map(se=>{const rt=Oe();return A.set(se.id,rt),{...se,id:rt,x:se.x+r,y:se.y+r}}),le=(g.edges??[]).map(se=>({...se,id:Oe(),sourceNodeId:A.get(se.sourceNodeId)??se.sourceNodeId,targetNodeId:A.get(se.targetNodeId)??se.targetNodeId})),ue=(g.freeLines??[]).map(se=>({...se,id:Oe(),x1:se.x1+r,y1:se.y1+r,x2:se.x2+r,y2:se.y2+r})),ie=JSON.parse(JSON.stringify(l.value));ie.nodes.push(...Y),ie.edges.push(...le),ie.freeLines=[...ie.freeLines??[],...ue],y("update:modelValue",ie)}function $(r){if(Ne.value){r.preventDefault(),f();return}if(ge.value)return;const g=r.clipboardData?.getData("text/plain")?.trim();if(!g||g.length===0)return;r.preventDefault();const A=g.length>100?g.slice(0,100):g,Y=document.querySelector(".flowchart-container");if(!Y)return;const le=Y.clientWidth,ue=Y.clientHeight,ie=q.value,se=(le/2-ie.panX)/ie.zoom,rt=(ue/2-ie.panY)/ie.zoom,$t=200,At=40;v.addNode("text",se-$t/2,rt-At/2,$t,At);const wt=JSON.parse(JSON.stringify(l.value)),Ft=wt.nodes[wt.nodes.length-1];Ft&&(Ft.label=A,y("update:modelValue",wt))}function F(){ge.value||(u.selectedNodeId.value?(v.removeNode(u.selectedNodeId.value),u.clearSelection()):u.selectedEdgeId.value?(v.removeEdge(u.selectedEdgeId.value),u.clearSelection()):u.selectedFreeLineId.value&&(v.removeFreeLine(u.selectedFreeLineId.value),u.clearSelection()))}function B(r,g,A){if(!u.selectedNodeId.value)return;r.preventDefault();const Y=v.getNode(u.selectedNodeId.value);if(Y){const le=r.shiftKey?Pe*4:Pe;v.setNodePosition(Y.id,Y.x+g*le,Y.y+A*le)}}function K(){Ie()||(St(),u.clearSelection())}function W(r){Ie()||(St(),u.selectNode(r),y("nodeSelect",r))}function ne(r){ot(),ge.value=r,et.value++,y("nodeDblClick",r)}function Z(r){Ie()||(u.selectEdge(r),y("edgeSelect",r))}function R(r){Ie()||u.selectFreeLine(r)}function U(r,g,A,Y){v.addFreeLine(r,g,A,Y),Q.value&&(Q.value=!1)}function ae(r,g,A,Y,le){v.addNode(r,g,A,Y,le),re.value===r&&(re.value=null)}function We(r,g,A,Y,le){v.moveFreeLine(r,g,A,Y,le)}function an(r,g){const A=v.getNode(r);if(A){const Y=Ue(A,g);ze(r,g,Y.x,Y.y)}}function sn(r,g){Ie()&&Qe(r,g)}function cn(){He()}function dn(r,g){Ie()&&$e(r,g)}function un(r,g,A,Y){w.createNodeAt(r,g,A,Y)}function Nt(r,g){const A=J.value?.getBoundingClientRect();return A?{x:(r-A.left-q.value.panX)/q.value.zoom,y:(g-A.top-q.value.panY)/q.value.zoom}:null}function Lt(r,g){const A=J.value?.getBoundingClientRect();return A?r>=A.left&&r<=A.right&&g>=A.top&&g<=A.bottom:!1}function Et(){const r=q.value.zoom;return r>=10?Pe/10:r>=5?Pe/5:r>=2?Pe/2:r<=.1?Pe*8:r<=.25?Pe*4:r<=.5?Pe*2:Pe}function fn(r,g,A){N.value={nodeType:r,clientX:g,clientY:A}}function hn(r,g){N.value&&(N.value={...N.value,clientX:r,clientY:g})}function yn(r,g){const A=N.value;if(N.value=null,!A||!Lt(r,g))return;const Y=Nt(r,g);Y&&w.createNodeAt(A.nodeType,Y.x,Y.y,Et())}function vn(){N.value=null}function gn(r,g){if(!Lt(r,g))return;const A=Nt(r,g);if(!A)return;const Y=Et(),le=z(A.x,Y),ue=z(A.y,Y),ie=z(120,Y);v.addFreeLine(le-ie/2,ue,le+ie/2,ue)}function pn(r,g){E.value={clientX:r,clientY:g}}function xn(r,g){E.value&&(E.value={clientX:r,clientY:g})}function wn(r,g){const A=E.value;E.value=null,A&&gn(r,g)}function mn(){E.value=null}function kn(r,g){ve(r,g)}function bn(r,g){q.value.panX=r,q.value.panY=g}function Cn(r){ge.value&&v.updateNodeLabel(ge.value,r),ot()}function ot(){ge.value=null}function St(){ge.value&&document.activeElement?.blur()}const Dn=M(()=>{const r=p.value;return r?v.getNode(r)?.style?.backgroundColor??st:st});function In(r){const g=p.value;g&&(r===st?v.updateNode(g,{style:{...v.getNode(g)?.style,backgroundColor:void 0,textColor:void 0}}):v.updateNode(g,{style:{...v.getNode(g)?.style,backgroundColor:r,textColor:void 0}}))}function Pn(r){v.removeEdge(r)}const Mn=M(()=>
1{if(P.value)return v.getFreeLine(P.value)?.style?.strokeColor??be;const r=k.value;return r?v.getEdge(r)?.style?.strokeColor??be:be});function Nn(r){if(P.value){r===be?v.updateFreeLineStyle(P.value,{strokeColor:void 0}):v.updateFreeLineStyle(P.value,{strokeColor:r});return}const g=k.value;g&&(r===be?v.updateEdgeStyle(g,{strokeColor:void 0}):v.updateEdgeStyle(g,{strokeColor:r}))}return(r,g)=>(D(),I("div",{class:ye(["flowchart-container",{"theme-dark":o.value==="dark"}]),style:De({width:a.value,height:c.value}),tabindex:"0",onDrop:g[3]||(g[3]=Ce(()=>{},["prevent"])),onDragover:g[4]||(g[4]=Ce(()=>{},["prevent"]))},[Ye(po,{templates:V(L),"line-tool-active":Q.value,"selected-node-tool":re.value,onToggleLineTool:H,onToggleNodeTool:te,onNodePointerDragStart:fn,onNodePointerDragMove:hn,onNodePointerDragEnd:yn,onNodePointerDragCancel:vn,onLinePointerDragStart:pn,onLinePointerDragMove:xn,onLinePointerDragEnd:wn,onLinePointerDragCancel:mn},null,8,["templates","line-tool-active","selected-node-tool"]),S.value?(D(),I("div",{key:0,class:"sidebar-drag-ghost",style:De(O.value)},[(D(),I("svg",sl,[S.value.kind==="node"&&S.value.nodeType==="rectangle"?(D(),I("rect",cl)):X("",!0),S.value.kind==="node"&&S.value.nodeType==="diamond"?(D(),I("polygon",dl)):X("",!0),S.value.kind==="node"&&S.value.nodeType==="ellipse"?(D(),I("ellipse",ul)):X("",!0),S.value.kind==="node"&&S.value.nodeType==="parallelogram"?(D(),I("polygon",fl)):X("",!0),S.value.kind==="node"&&S.value.nodeType==="text"?(D(),I("g",hl,[...g[5]||(g[5]=[C("rect",{x:"2",y:"3",width:"28",height:"18",rx:"2",fill:"var(--fc-sidebar-icon-fill)",stroke:"var(--fc-sidebar-icon-stroke)","stroke-width":"1.5","stroke-dasharray":"3,2"},null,-1),C("text",{x:"16",y:"16","text-anchor":"middle","font-size":"12",fill:"var(--fc-sidebar-icon-stroke)","font-weight":"bold","font-family":"serif"},"T",-1)])])):X("",!0),S.value.kind==="line"?(D(),I("g",yl,[...g[6]||(g[6]=[C("line",{x1:"4",y1:"20",x2:"28",y2:"4",stroke:"var(--fc-sidebar-icon-stroke)","stroke-width":"2","stroke-linecap":"round"},null,-1),C("circle",{cx:"4",cy:"20",r:"2",fill:"var(--fc-sidebar-icon-stroke)"},null,-1),C("circle",{cx:"28",cy:"4",r:"2",fill:"var(--fc-sidebar-icon-stroke)"},null,-1)])])):X("",!0)])),i.value?X("",!0):(D(),I("span",vl,Xe(S.value.label),1))],4)):X("",!0),C("div",{ref_key:"canvasAreaRef",ref:J,class:"canvas-area"},[Ye(Zr,{nodes:V(l).nodes,edges:V(l).edges,"free-lines":V(l).freeLines??[],viewport:V(q),"selected-node-id":V(p),"selected-edge-id":V(k),"selected-free-line-id":V(P),"line-tool-active":Q.value,"active-node-tool":re.value,"drawing-state":V(Be),"editing-node-id":ge.value,"editing-info":xt.value,"editing-key":et.value,onCanvasClick:K,onNodeClick:W,onNodeDblClick:ne,onEdgeClick:Z,onFreeLineClick:R,onFreeLineDraw:U,onFreeLineMove:We,onNodeToolDraw:ae,onNodeDragMove:g[0]||(g[0]=(A,Y,le)=>V(v).setNodePosition(A,Y,le)),onNodeResize:g[1]||(g[1]=(A,Y,le,ue,ie)=>V(v).resizeNode(A,Y,le,ue,ie)),onAnchorMouseDown:an,onAnchorMouseUp:sn,onDrawingCancel:cn,onDrawingUpdate:dn,onCanvasDrop:un,onCanvasWheel:kn,onPanMove:bn,onLabelCommit:Cn,onLabelCancel:ot,onEdgeRemove:Pn,onEdgeReroute:pt},null,8,["nodes","edges","free-lines","viewport","selected-node-id","selected-edge-id","selected-free-line-id","line-tool-active","active-node-tool","drawing-state","editing-node-id","editing-info","editing-key"]),C("div",gl,[C("button",{class:"canvas-tb-btn",disabled:!me.value,title:_.value.t("toolbar.undo"),onClick:de},[...g[7]||(g[7]=[C("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[C("path",{d:"M3 10h10a5 5 0 0 1 0 10H9"}),C("polyline",{points:"7 6 3 10 7 14"})],-1)])],8,pl),C("button",{class:"canvas-tb-btn",disabled:!Ze.value,title:_.value.t("toolbar.redo"),onClick:Te},[...g[8]||(g[8]=[C("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[C("path",{d:"M21 10H11a5 5 0 0 0 0 10h4"}),C("polyline",{points:"17 6 21 10 17 14"}
1)],-1)])],8,xl),C("button",{class:"canvas-tb-btn",title:_.value.t("toolbar.zoomIn"),onClick:qe},[...g[9]||(g[9]=[Bt('<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-da924448><circle cx="11" cy="11" r="8" data-v-da924448></circle><line x1="21" y1="21" x2="16.65" y2="16.65" data-v-da924448></line><line x1="11" y1="8" x2="11" y2="14" data-v-da924448></line><line x1="8" y1="11" x2="14" y2="11" data-v-da924448></line></svg>',1)])],8,wl),C("button",{class:"canvas-tb-btn",title:_.value.t("toolbar.zoomOut"),onClick:vt},[...g[10]||(g[10]=[C("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[C("circle",{cx:"11",cy:"11",r:"8"}),C("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),C("line",{x1:"8",y1:"11",x2:"14",y2:"11"})],-1)])],8,ml),C("button",{class:"canvas-tb-btn",title:_.value.t("toolbar.resetView"),onClick:gt},[...g[11]||(g[11]=[C("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[C("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})],-1)])],8,kl),V(p)!==null||V(k)!==null||V(P)!==null?(D(),I("button",{key:0,class:"canvas-tb-btn canvas-tb-delete",title:oe.value,onClick:g[2]||(g[2]=A=>F())},[...g[12]||(g[12]=[Bt('<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" data-v-da924448><polyline points="3 6 5 6 21 6" data-v-da924448></polyline><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" data-v-da924448></path><path d="M10 11v6" data-v-da924448></path><path d="M14 11v6" data-v-da924448></path><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" data-v-da924448></path></svg>',1)])],8,bl)):X("",!0)]),Ye(nl,{visible:V(p)!==null,"current-color":Dn.value,onPickColor:In},null,8,["visible","current-color"]),Ye(al,{visible:V(k)!==null||V(P)!==null,"current-color":Mn.value,onPickColor:Nn},null,8,["visible","current-color"])],512)],38))}}),Pl=Object.assign(Se(Il,[["__scopeId","data-v-da924448"]]),{__name:"AdminKnowledgeNotebookFlowchartContainer"}),Ml={class:ye(["editor-container"])},Nl=we({__name:"flowchart-area.client",props:{editable:{type:Boolean},noteId:{},loading:{type:Boolean},noteInfo:{}},emits:["edit:loaded","content:change","upload:content"],setup(e,{emit:t}){const n=e,o=t,{locale:s}=$n(),i=An(),a=T(0),c=T(0),y=T({nodes:[],edges:[]});try{const p=n.noteInfo.content?JSON.parse(n.noteInfo.content):{nodes:[],edges:[]};y.value=p}catch(p){Fn.error("[flowchart] Parse flowchart info error:",p)}Re(()=>n.editable,p=>{});const x=Yt(()=>{o("upload:content",!1)},2e3);Re(()=>y.value,p=>{o("content:change",JSON.stringify(p)),x()},{deep:!0});const v=()=>{a.value=(document.getElementById("layout-content")?.clientWidth||0)-14,c.value=(document.getElementById("layout-content")?.clientHeight||0)-61},l=Yt(v,200);let u=null;return dt(async()=>{v();const p=document.getElementById("layout-content");p&&(u=new ResizeObserver(l),u.observe(p)),o("edit:loaded")}),Tn(()=>{u?.disconnect(),u=null}),(p,k)=>(D(),I("div",Ml,[Ye(Pl,{modelValue:V(y),"onUpdate:modelValue":k[0]||(k[0]=P=>Bn(y)?y.value=P:null),width:V(a),height:V(c),theme:V(i).theme==="light"?"light":"dark",locale:V(s),mobile:V(i).appDevice==="mobile",style:De({position:"absolute",left:"-10px",top:"-10px",opacity:V(c)>0&&V(a)>0?1:0})},null,8,["modelValue","width","height","theme","locale","mobile","style"])])
1)}}),Al=Object.assign(Nl,{__name:"AdminKnowledgeNotebookFlowchartArea"});export{Al as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.