import{o as yo}from"./mobx-preact@3.0.0_mobx@5.15.7_preact@10.25.4-SwmSNyX5.js";import{u as x,x as K,g as Wn,b as Gr,n as Zr}from"./preact@10.25.4-CrjB-ZC0.js";import{a as k,c as C,m as Fr,g as Zn,n as sr,p as Kt,f as W,t as bt,b as St,d as Ht,i as Qt,e as ht,s as go,h as _o,j as Vr,k as gr,l as mo,o as Vn,q as xo,r as Eo,u as Kr,v as Mo,w as Kn,x as Oo,y as So}from"./lodash-es@4.17.21-UVJw7vmf.js";import{c as wo,t as mt,i as qn,s as Ao,o as E,a as F,b as m,r as Po}from"./mobx@5.15.7-DLDjekon.js";import{v as To}from"./uuid@9.0.1-CtRu48qb.js";import{c as Do}from"./classnames@2.5.1-8E8W9FZl.js";import{M as No}from"./mousetrap@1.6.5-CGKHClW8.js";import{d as bo}from"./mobx-utils@5.6.2_mobx@5.15.7-CmgHUCcI.js";var Co=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(n);ov.step||Math.abs(v.sumDeltaY)>v.step)){var O=v.sumDeltaX%v.step,w=v.sumDeltaY%v.step,A=v.sumDeltaX-O,b=v.sumDeltaY-w;v.sumDeltaX=O,v.sumDeltaY=w;var R=(M=v.model)===null||M===void 0?void 0:M.getData();v.isDragging||((S=v.eventCenter)===null||S===void 0||S.emit(T["".concat(v.eventType,"_DRAGSTART")],{e:_,data:v.data||R}),v.onDragStart({event:_})),v.isDragging=!0,Promise.resolve().then(function(){var L,z;v.onDragging({deltaX:A,deltaY:b,event:_}),(L=v.eventCenter)===null||L===void 0||L.emit(T["".concat(v.eventType,"_MOUSEMOVE")],{deltaX:A,deltaY:b,e:_,data:v.data||R}),(z=v.eventCenter)===null||z===void 0||z.emit(T["".concat(v.eventType,"_DRAG")],{e:_,data:v.data||R})})}},this.handleMouseUp=function(_){var M=window.document;v.isStartDragging=!1,v.isStopPropagation&&_.stopPropagation(),Promise.resolve().then(function(){var S,O,w;M.removeEventListener("mousemove",v.handleMouseMove,!1),M.removeEventListener("mouseup",v.handleMouseUp,!1);var A=(S=v.model)===null||S===void 0?void 0:S.getData();(O=v.eventCenter)===null||O===void 0||O.emit(T["".concat(v.eventType,"_MOUSEUP")],{e:_,data:v.data||A}),v.isDragging&&(v.isDragging=!1,v.onDragEnd({event:_}),(w=v.eventCenter)===null||w===void 0||w.emit(T["".concat(v.eventType,"_DROP")],{e:_,data:v.data||A}))})},this.cancelDrag=function(){var _=window==null?void 0:window.document;_.removeEventListener("mousemove",v.handleMouseMove,!1),_.removeEventListener("mouseup",v.handleMouseUp,!1),v.onDragEnd({event:void 0}),v.isDragging=!1},this.destroy=function(){v.isStartDragging&&v.cancelDrag()},this.onDragStart=r,this.onDragging=i,this.onDragEnd=s,this.step=c,this.isStopPropagation=y,this.eventType=d,this.eventCenter=u,this.model=p,this.data=g}return n.prototype.setStep=function(e){this.step=e},n.prototype.setModel=function(e){this.model=e},n}(),Yo=function(n){var e=n.x,t=n.y,r=n.width,o=n.height;return{x:e-r/2,y:t-o/2,x1:e+r/2,y1:t+o/2}},Ho=function(n){var e=n.startPoint,t=n.endPoint,r=(e.x+t.x)/2,o=(e.y+t.y)/2,i=Math.abs(e.x-t.x)+10,a=Math.abs(e.y-t.y)+10;return{x:r-i/2,y:o-a/2,x1:r+i/2,y1:o+a/2}},ko=function(n){var e=n.points,t=kt(e),r=Ee(t,8),o=r.x,i=r.y,a=r.width,s=r.height;return{x:o-a/2,y:i-s/2,x1:o+a/2,y1:i+s/2}},zo=function(n){var e=n.path,t=$r(e),r=Ee(t,8),o=r.x,i=r.y,a=r.width,s=r.height;return{x:o-a/2,y:i-s/2,x1:o+a/2,y1:i+s/2}},Go=function(n){if(n.modelType===j.LINE_EDGE)return Ho(n);if(n.modelType===j.POLYLINE_EDGE)return ko(n);if(n.modelType===j.BEZIER_EDGE)return zo(n)},Fo=function(n,e,t,r){var o=(e.y-n.y)*(r.x-t.x)-(n.x-e.x)*(t.y-r.y);if(o===0)return!1;var i=((e.x-n.x)*(r.x-t.x)*(t.y-n.y)+(e.y-n.y)*(r.x-t.x)*n.x-(r.y-t.y)*(e.x-n.x)*t.x)/o,a=-((e.y-n.y)*(r.y-t.y)*(t.x-n.x)+(e.x-n.x)*(r.y-t.y)*n.y-(r.x-t.x)*(e.y-n.y)*t.y)/o;return(i-n.x)*(i-e.x)<=0&&(a-n.y)*(a-e.y)<=0&&(i-t.x)*(i-r.x)<=0&&(a-t.y)*(a-r.y)<=0?{x:i,y:a}:!1},me=function(n,e,t){var r=n.x,o=n.y,i=e.x,a=e.y,s=t.x,l=t.y,d=(l-a)/(s-i),u=a-d*i;return(r>=i&&r<=s||r<=i&&r>=s)&&(o>=a&&o<=l||o<=a&&o>=l)&&Math.abs(o-d*r-u)=e.x?(a.leftX=e.x+d*Math.sin(s+l),a.leftY=e.y-d*Math.cos(s+l),a.rightX=e.x-d*Math.sin(s-l),a.rightY=e.y+d*Math.cos(s-l)):(a.leftX=e.x-d*Math.sin(s+l),a.leftY=e.y+d*Math.cos(s+l),a.rightX=e.x+d*Math.sin(s-l),a.rightY=e.y-d*Math.cos(s-l)):i==="end"&&(t.x>=e.x?(a.leftX=t.x+d*Math.sin(s-l),a.leftY=t.y-d*Math.cos(s-l),a.rightX=t.x-d*Math.sin(s+l),a.rightY=t.y+d*Math.cos(s+l)):(a.leftX=t.x-d*Math.sin(s-l),a.leftY=t.y+d*Math.cos(s-l),a.rightX=t.x+d*Math.sin(s+l),a.rightY=t.y-d*Math.cos(s+l))),a},qt=function(){return qt=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Dt=function(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;rr/e.height?G.HORIZONTAL:G.VERTICAL},Fe=function(n,e,t){var r=Uo(t,e);return r===G.HORIZONTAL?{x:t.x>n.centerX?n.maxX:n.minX,y:t.y}:{x:t.x,y:t.y>n.centerY?n.maxY:n.minY}},Qr=function(n,e){var t=Math.min(n.minX,e.minX),r=Math.min(n.minY,e.minY),o=Math.max(n.maxX,e.maxX),i=Math.max(n.maxY,e.maxY);return{x:(t+o)/2,y:(r+i)/2,centerX:(t+o)/2,centerY:(r+i)/2,minX:t,minY:r,maxX:o,maxY:i,height:i-r,width:o-t}},Ee=function(n,e){n===void 0&&(n=[]);var t=[],r=[];n.forEach(function(u){t.push(u.x),r.push(u.y)});var o=Math.min.apply(Math,Dt([],at(t),!1)),i=Math.max.apply(Math,Dt([],at(t),!1)),a=Math.min.apply(Math,Dt([],at(r),!1)),s=Math.max.apply(Math,Dt([],at(r),!1)),l=i-o,d=s-a;return e&&(l+=e,d+=e),{centerX:(o+i)/2,centerY:(a+s)/2,maxX:i,maxY:s,minX:o,minY:a,x:(o+i)/2,y:(a+s)/2,height:d,width:l}},$e=function(n){var e=n.minX,t=n.minY,r=n.maxX,o=n.maxY;return[{x:e,y:t},{x:r,y:t},{x:r,y:o},{x:e,y:o}]},Ne=function(n,e){var t=n.x,r=n.y;return te.maxX||re.maxY},Wo=function(n,e){return en.maxX?[]:[{x:e,y:n.minY},{x:e,y:n.maxY}]},Zo=function(n,e){return en.maxY?[]:[{x:n.minX,y:e},{x:n.maxX,y:e}]},Vo=function(n,e){return Dt(Dt([],at(Wo(n,e.x)),!1),at(Zo(n,e.y)),!1)},mr=function(n,e){return Math.abs(n.x-e.x)+Math.abs(n.y-e.y)},Ko=function(n,e){var t=-2,r=0;return e.forEach(function(o){o&&(n.x===o.x&&(r+=t),n.y===o.y&&(r+=t))}),r},tn=function(n,e,t,r,o){return mr(n,e)+mr(n,t)+Ko(n,[e,t,r,o])},Jn=function(n,e,t,r,o){o||(o=0),n.unshift(e[r]),t[r]&&t[r]!==r&&o<=100&&Jn(n,e,t,t[r],o+1)},qo=function(n,e){var t=n.indexOf(e);t>-1&&n.splice(t,1)},ie=function(n,e,t,r){var o=e.x-n.x,i=e.y-n.y,a=r.x-t.x,s=r.y-t.y,l=(-i*(n.x-t.x)+o*(n.y-t.y))/(-a*i+o*s),d=(a*(n.y-t.y)-s*(n.x-t.x))/(-a*i+o*s);return l>=0&&l<=1&&d>=0&&d<=1},en=function(n,e,t){if(t.width===0&&t.height===0)return!1;var r=at($e(t),4),o=r[0],i=r[1],a=r[2],s=r[3];return ie(n,e,o,i)||ie(n,e,o,s)||ie(n,e,i,a)||ie(n,e,a,s)},Jo=function(n,e,t,r){var o=[];return n.forEach(function(i){i!==e&&(i.x===e.x||i.y===e.y)&&!en(i,e,t)&&!en(i,e,r)&&o.push(i)}),_r(o)},Qo=function(n,e,t,r,o,i,a){var s=[],l=[e],d={},u={},f={};e.id&&(u[e.id]=0,f[e.id]=tn(e,t,e));var c={};n.forEach(function(p){p.id&&(c[p.id]=p)});for(var h=function(){var p,g=1/0;if(l.forEach(function(_){_.id&&f[_.id]=u[_.id])return;d[_.id]=p.id,u[_.id]=M,f[_.id]=u[_.id]+tn(_,t,e,i,a)}})};l.length;){var y=h();if(typeof y=="object")return y.value}return[e,t]},rn=function(n){return rt(n)},Qn=function(n){for(var e=1;e2&&(v=Qn(v)),_r(v)},ti=function(n){if(n.length===1){var e=at(n,1),t=e[0];return[t,t]}else{for(var r=n[0],o=n[1],i=vt(r.x,r.y,o.x,o.y),a=1;ai&&(i=d,r=s,o=l)}return[r,o]}},on=function(n,e,t){var r=Nt(n,t),o=Nt(e,t);return r&&o},an=function(n,e,t){var r=Nt(n,t),o=Nt(e,t),i=r&&o,a=r||o;return!i&&a},sn=function(n,e,t){for(var r=void 0,o=rt(t),i=$e(o),a=0;a=1&&r<=126||r>=65376&&r<=65439?e+=1:e+=2}return e},ri=function(n){var e=n.start,t=n.end,r;if(e.x===t.x&&e.y===t.y)r="";else{var o={start:e,end:t,offset:10,verticalLength:5},i=xe(qt(qt({},o),{type:"start"})),a=xe(qt(qt({},o),{type:"end"}));r="M".concat(i.leftX," ").concat(i.leftY,` L`).concat(i.rightX," ").concat(i.rightY,` L`).concat(a.rightX," ").concat(a.rightY,` L`).concat(a.leftX," ").concat(a.leftY," z")}return{d:r,fill:"transparent",stroke:"transparent",strokeWidth:1,strokeDasharray:"4, 4"}},dn=function(n){var e=n.start,t=n.end,r=n.sourceNode,o=n.targetNode,i=n.offset,a=rt(r),s=rt(o),l=Ge(a,i),d=Ge(s,i),u=Fe(l,a,e),f=Fe(d,s,t);return{sNext:u,ePre:f}},$r=function(n){var e=n.replace(/M/g,"").replace(/C/g,",").split(","),t=be(e[0]),r=be(e[1]),o=be(e[2]),i=be(e[3]);return[t,r,o,i]},be=function(n){var e=at(n.replace(/(^\s*)/g,"").split(" "),2),t=e[0],r=e[1];return{x:+t,y:+r}},un=function(n,e){var t=at(n,4),r=t[0],o=t[1],i=t[2],a=t[3],s=Hi(r,o,i,a,e);return[s,n[3]]},eo=function(n,e){for(var t=n.x,r=n.y,o=kt(e),i=Number.MAX_SAFE_INTEGER,a,s=[],l=0;lo?a:o}),{width:Math.ceil(o/2)*r+r/4,height:t*(r+2)+r/4}},$t=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Ce=function(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;r0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},dr=function(n,e,t){var r=lr(n,2),o=r[0],i=r[1],a=lr(e,2),s=a[0],l=a[1],d=lr(t,2),u=d[0],f=d[1];return o>s&&ol&&i=0?o:-o},e}(no),xr=function(n){Ur(e,n);function e(t,r){var o=n.call(this,t,r,1)||this;return Object.setPrototypeOf(o,e.prototype),o}return e.prototype.toString=function(){return"Point"},e}(no),tr=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Ut=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},ur=function(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;r=0;o--){var i=t[o],a=fi(n,i);if(a){var s=i.getTargetAnchor(n);if(s){var l={node:i,anchorIndex:s.index,anchor:s.anchor};(!r||di(i,r.node,e))&&(r=l)}}}return r},di=function(n,e,t){return n.zIndex>e.zIndex?!0:t.nodesMap[n.id].index>t.nodesMap[e.id].index},ui=function(n,e){for(var t=Er(e),r,o=Number.MAX_SAFE_INTEGER,i=0;i=o.minX-r&&n.x<=o.maxX+r&&n.y>=o.minY-r&&n.y<=o.maxY+r&&(t=!0),t},fi=function(n,e){var t=!1,r=5,o=rt(e);return n.x>=o.minX-r&&n.x<=o.maxX+r&&n.y>=o.minY-r&&n.y<=o.maxY+r&&(t=!0),t},rt=function(n){var e=n.x,t=n.y,r=n.width,o=n.height;return{minX:e-r/2,minY:t-o/2,maxX:e+r/2,maxY:t+o/2,x:e,y:t,width:r,height:o,centerX:e,centerY:t}},ci=function(n){var e=n,t=e.x,r=e.y,o=e.width,i=e.height,a=e.radius;return[{x:t-o/2+a,y:r-i/2+a,r:a},{x:t+o/2-a,y:r-i/2+a,r:a},{x:t-o/2+a,y:r+i/2-a,r:a},{x:t+o/2-a,y:r+i/2-a,r:a}]},pn=function(n,e,t){var r=ci(t),o,i=Number.MAX_SAFE_INTEGER;return r.forEach(function(a){var s=vt(n.x,n.y,a.x,a.y);sd.minX&&n.xd.minY&&n.yu.x&&(f=u,c=d);var h={x:n.x,y:n.y};if(f.x===c.x&&e===G.HORIZONTAL&&(h={x:f.x,y:n.y}),f.y===c.y&&e===G.VERTICAL&&(h={x:n.x,y:f.y}),f.x!==c.x&&f.y!==c.y){var y=(c.y-f.y)/(c.x-f.x),p=(f.x*c.y-c.x*f.y)/(f.x-c.x);e===G.HORIZONTAL?h={x:(n.y-p)/y,y:n.y}:e===G.VERTICAL&&(h={x:n.x,y:y*n.x+p})}var g=me(h,d,u);if(g){var v=vt(h.x,h.y,n.x,n.y);vn.x?o=n.x+t/2:e.xn.y?i=n.y+r/2:e.y1?e.forEach(function(s){var l=document.createElement("div");l.textContent=s,i.appendChild(l)}):i.textContent=e[0],document.body.appendChild(i);var a=i.clientHeight;return document.body.removeChild(i),a},gn=function(n){var e=n.rows,t=n.rowsLength,r=n.fontSize,o=0;return e&&e.forEach(function(i){var a=to(i);o=a>o?a:o}),{width:Math.ceil(o/2)*r+r/4,height:t*(r+2)+r/4}},Ve=function(n){return typeof n!="object"?{isAllPass:!!n,msg:n?"":"不允许连接"}:n},Yt=function(){return To()},se=new Map,io=function(n){var e=Yt();function t(){n();var o=se.get(e);if(o){var i=window.requestAnimationFrame(t);se.set(e,i)}}var r=window.requestAnimationFrame(t);return se.set(e,r),e},Ke=function(n){var e=se.get(n);e&&(window.cancelAnimationFrame(e),se.delete(n))},Me=function(){return Me=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i};function ao(n){var e=n.x,t=e===void 0?0:e,r=n.y,o=r===void 0?0:r,i=n.value,a=n.fontSize,s=a===void 0?12:a,l=n.fill,d=l===void 0?"currentColor":l,u=n.overflowMode,f=u===void 0?"default":u,c=n.textWidth,h=c===void 0?void 0:c,y=n.model,p={x:t,y:o,fill:d,fontSize:s,textAnchor:"middle",dominantBaseline:"central"};if(W(bt(n),function(O){var w=hi(O,2),A=w[0],b=w[1];typeof b!="object"&&(p[A]=b)}),i){var g=String(i).split(/[\r\n]/g),v=g.length;if(f!=="default"){var _=y.BaseType,M=y.modelType;if(_===$.NODE&&M!==j.TEXT_NODE||_===$.EDGE&&h)return vi(n)}if(v>1){var S=g.map(function(O,w){var A=s+2,b=(w-(v-1)/2)*A;return x("tspan",{className:"lf-text-tspan",x:t,y:o+b,children:O})});return x("text",Me({},p,{children:S}))}return x("text",Me({},p,{children:i}))}return null}function vi(n){var e=n.x,t=n.y,r=n.value,o=n.model,i=n.textWidth,a=n.fontSize,s=a===void 0?12:a,l=n.lineHeight,d=n.fontFamily,u=d===void 0?"":d,f=n.wrapPadding,c=f===void 0?"0, 0":f,h=n.overflowMode,y=o.width,p=o.height,g=o.textHeight,v=i||y,_=String(r).split(/[\r\n]/g),M=_.length,S=oo({rows:_,style:{fontSize:"".concat(s,"px"),width:"".concat(v,"px"),fontFamily:u,lineHeight:l,padding:c},rowsLength:M,className:"lf-get-text-height"}),O=p>S?p:S;g&&(O=g);var w=h==="ellipsis";return w&&(O=s+2),x("g",{children:x("foreignObject",{width:v,height:O,x:e-v/2,y:t-O/2,style:{overflow:"visible",textAlign:"left"},children:x("div",{className:"lf-node-text-auto-wrap",style:{minHeight:O,width:v,padding:c},children:x("div",{className:w?"lf-node-text-ellipsis-content":"lf-node-text-auto-wrap-content",title:w?_.join(""):"",style:Me({},n),children:_.map(function(A){return x("div",{className:"lf-node-text--auto-wrap-inner",children:A})})})})})})}var Or=function(){return Or=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i};function ee(n){var e={x1:10,y1:10,x2:20,y2:20,stroke:"black"};return W(bt(n),function(t){var r=yi(t,2),o=r[0],i=r[1];(o==="style"||typeof i!="object")&&(e[o]=i)}),x("line",Or({},e))}var Sr=function(){return Sr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i};function Et(n){var e=n.x,t=n.y,r=n.width,o=n.height,i=n.className,a=n.strokeWidth,s=n.radius,l=s===void 0?0:s,d=e-r/2,u=t-o/2,f={};return f["stroke-width"]=a,W(bt(n),function(c){var h=gi(c,2),y=h[0],p=h[1];typeof p!="object"&&(f[y]=p)}),i?f.className="lf-basic-shape ".concat(i):f.className="lf-basic-shape",l&&(f.rx=l,f.ry=l),f.x=d,f.y=u,x("rect",Sr({},f))}var wr=function(){return wr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i};function Oe(n){var e={d:""};return W(bt(n),function(t){var r=_i(t,2),o=r[0],i=r[1];(o==="style"||typeof i!="object")&&(e[o]=i)}),x("path",wr({},e))}var Ar=function(){return Ar=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i};function re(n){var e=n.x,t=e===void 0?0:e,r=n.y,o=r===void 0?0:r,i=n.r,a=i===void 0?4:i,s=n.className,l={cx:t,cy:o,r:a,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return W(bt(n),function(d){var u=mi(d,2),f=u[0],c=u[1];typeof c!="object"&&(l[f]=c)}),s?l.className="lf-basic-shape ".concat(s):l.className="lf-basic-shape",x("circle",Ar({},l))}var Pr=function(){return Pr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i};function Ei(n){var e=n.x,t=e===void 0?0:e,r=n.y,o=r===void 0?0:r,i=n.rx,a=i===void 0?4:i,s=n.ry,l=s===void 0?4:s,d=n.className,u={cx:t,cy:o,rx:a,ry:l,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return W(bt(n),function(f){var c=xi(f,2),h=c[0],y=c[1];typeof y!="object"&&(u[h]=y)}),d?u.className="lf-basic-shape ".concat(d):u.className="lf-basic-shape",x("ellipse",Pr({},u))}var Tr=function(){return Tr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i};function so(n){var e=n.points,t=e===void 0?[]:e,r=n.className,o={fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1,points:""};return W(bt(n),function(i){var a=Mi(i,2),s=a[0],l=a[1];typeof l!="object"&&(o[s]=l)}),r?o.classNmae="lf-basic-shape ".concat(r):o.className="lf-basic-shape",o.points=t.map(function(i){return i.join(",")}).join(" "),x("polygon",Tr({},o))}var Dr=function(){return Dr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i};function Si(n){var e=n.className,t={points:"",fill:"none"};return W(bt(n),function(r){var o=Oi(r,2),i=o[0],a=o[1];(i==="style"||typeof a!="object")&&(t[i]=a)}),e&&(t.className="".concat(e)),x("polyline",Dr({},t))}var lo=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Se=function(){return Se=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},H;(function(n){n[n.LEFT_TOP=0]="LEFT_TOP",n[n.RIGHT_TOP=1]="RIGHT_TOP",n[n.RIGHT_BOTTOM=2]="RIGHT_BOTTOM",n[n.LEFT_BOTTOM=3]="LEFT_BOTTOM"})(H||(H={}));var Pi=function(n){lo(e,n);function e(t){var r=n.call(this)||this;r.updateEdgePointByAnchors=function(){var s=r.nodeModel,l=s.id,d=s.anchors,u=r.graphModel.getNodeEdges(l);W(u,function(f){if(f.sourceNodeId===l){var c=Ht(d,function(h){return h.id===f.sourceAnchorId});c&&f.updateStartPoint({x:c.x,y:c.y})}else if(f.targetNodeId===l){var c=Ht(d,function(y){return y.id===f.targetAnchorId});c&&f.updateEndPoint({x:c.x,y:c.y})}})},r.triggerResizeEvent=function(s,l,d,u,f,c){r.graphModel.eventCenter.emit(T.NODE_RESIZE,{preData:s,data:l,deltaX:d,deltaY:u,index:f,model:c})},r.recalcResizeInfo=function(s,l,d,u,f){d===void 0&&(d=1),u===void 0&&(u=!1),f===void 0&&(f=!1);var c=C(l),h=c.deltaX,y=c.deltaY,p=c.width,g=c.height,v=c.PCTResizeInfo;if(v){var _=4,M=0,S=0;switch(s){case H.LEFT_TOP:S=(h*-1-y)/_;break;case H.RIGHT_TOP:S=(h-y)/_;break;case H.RIGHT_BOTTOM:S=(h+y)/_;break;case H.LEFT_BOTTOM:S=(h*-1+y)/_;break}S!==0&&(M=Math.round(S/v.ResizeBasis.basisHeight*1e5)/1e3),v.ResizePCT.widthPCT=Math.max(Math.min(v.ResizePCT.widthPCT+M,v.ScaleLimit.maxScaleLimit),v.ScaleLimit.minScaleLimit),v.ResizePCT.heightPCT=Math.max(Math.min(v.ResizePCT.heightPCT+M,v.ScaleLimit.maxScaleLimit),v.ScaleLimit.minScaleLimit);var O=Math.round(v.ResizePCT.widthPCT*v.ResizeBasis.basisWidth/100),w=Math.round(v.ResizePCT.heightPCT*v.ResizeBasis.basisHeight/100);switch(s){case H.LEFT_TOP:h=p-O,y=g-w;break;case H.RIGHT_TOP:h=O-p,y=g-w;break;case H.RIGHT_BOTTOM:h=O-p,y=w-g;break;case H.LEFT_BOTTOM:h=p-O,y=w-g;break}return c}switch(s){case H.LEFT_TOP:c.width=u?p:p-h*d,c.height=f?g:g-y*d;break;case H.RIGHT_TOP:c.width=u?p:p+h*d,c.height=f?g:g-y*d;break;case H.RIGHT_BOTTOM:c.width=u?p:p+h*d,c.height=f?g:g+y*d;break;case H.LEFT_BOTTOM:c.width=u?p:p-h*d,c.height=f?g:g+y*d;break}return c},r.resizeNode=function(s){var l=s.deltaX,d=s.deltaY,u=r.index,f=r.props,c=f.model,h=f.graphModel,y=f.x,p=f.y;Ii({x:y,y:p,deltaX:l,deltaY:d,index:u,nodeModel:c,graphModel:h,cancelCallback:function(){r.dragHandler.cancelDrag()}})},r.onDragging=function(s){var l=s.deltaX,d=s.deltaY,u=r.graphModel.transformModel,f=Ai(u.fixDeltaXY(l,d),2),c=f[0],h=f[1];r.resizeNode({deltaX:c,deltaY:h})},r.onDragEnd=function(){var s=r.nodeModel.x,l=r.nodeModel.y;r.nodeModel.moveTo(s,l),r.updateEdgePointByAnchors()};var o=t.index,i=t.model,a=t.graphModel;return r.index=o,r.nodeModel=i,r.graphModel=a,r.dragHandler=new Mt({onDragging:r.onDragging,onDragEnd:r.onDragEnd,step:a.gridSize}),r}return e.prototype.componentWillUnmount=function(){this.dragHandler.destroy()},e.prototype.render=function(){var t=this.props,r=t.x,o=t.y,i=t.direction,a=t.model,s=a.getResizeControlStyle(),l=s.width,d=s.height,u=wi(s,["width","height"]);return x("g",{className:"lf-resize-control lf-resize-control-".concat(i),children:[x(Et,Se({className:"lf-resize-control-content",x:r,y:o,width:l??7,height:d??7},u)),x(Et,{className:"lf-resize-control-content",x:r,y:o,width:25,height:25,fill:"transparent",stroke:"transparent",onMouseDown:this.dragHandler.handleMouseDown})]})},e}(K),Ti=function(n){lo(e,n);function e(){return n.call(this)||this}return e.prototype.getResizeControl=function(){var t=this.props,r=t.model,o=t.graphModel,i=rt(r),a=i.minX,s=i.minY,l=i.maxX,d=i.maxY,u=[{index:H.LEFT_TOP,direction:"nw",x:a,y:s},{index:H.RIGHT_TOP,direction:"ne",x:l,y:s},{index:H.RIGHT_BOTTOM,direction:"se",x:l,y:d},{index:H.LEFT_BOTTOM,direction:"sw",x:a,y:d}];return St(u,function(f){return x(Pi,Se({},f,{model:r,graphModel:o}))})},e.prototype.getResizeOutline=function(){var t=this.props.model,r=t.x,o=t.y,i=t.width,a=t.height,s=t.getResizeOutlineStyle();return x(Et,Se({},s,{x:r,y:o,width:i,height:a}))},e.prototype.render=function(){return x("g",{className:"lf-resize-control-group",children:[this.getResizeOutline(),this.getResizeControl()]})},e}(K);function Di(n,e){var t=n.x,r=n.y,o=e.x,i=e.y,a={x:t+(o-t)/2,y:r+(i-r)/2};return a}function ae(n,e,t){var r=Ni(t),o=n.x-e.x,i=n.y-e.y,a=o*Math.cos(r)-i*Math.sin(r)+e.x,s=o*Math.sin(r)+i*Math.cos(r)+e.y;return{x:a,y:s}}function Ni(n){return n*Math.PI/180}function bi(n){return n/Math.PI*180}function Ci(n,e,t,r,o,i,a,s,l){s===void 0&&(s=!1),l===void 0&&(l=!1);var d=e.deltaX,u=e.deltaY,f=e.width,c=e.height,h=bi(t),y={x:r,y:o},p={x:i,y:a},g=ae(y,p,h),v={x:g.x+d,y:g.y+u},_=Bi(g,v,p,h,s,l,f,c),M=_.width,S=_.height,O=_.center;return e.width=M*n,e.height=S*n,e.deltaX=(O.x-p.x)*2,e.deltaY=(O.y-p.y)*2,e}var Li=function(n,e,t,r,o,i,a,s,l,d){t===void 0&&(t=1),r===void 0&&(r=!1),o===void 0&&(o=!1),i===void 0&&(i=0);var u=C(e),f=u.deltaX,c=u.deltaY,h=u.width,y=u.height,p=u.PCTResizeInfo;if(p){var g=4,v=0,_=0;switch(n){case H.LEFT_TOP:_=(f*-1-c)/g;break;case H.RIGHT_TOP:_=(f-c)/g;break;case H.RIGHT_BOTTOM:_=(f+c)/g;break;case H.LEFT_BOTTOM:_=(f*-1+c)/g;break}_!==0&&(v=Math.round(_/p.ResizeBasis.basisHeight*1e5)/1e3),p.ResizePCT.widthPCT=Math.max(Math.min(p.ResizePCT.widthPCT+v,p.ScaleLimit.maxScaleLimit),p.ScaleLimit.minScaleLimit),p.ResizePCT.heightPCT=Math.max(Math.min(p.ResizePCT.heightPCT+v,p.ScaleLimit.maxScaleLimit),p.ScaleLimit.minScaleLimit);var M=Math.round(p.ResizePCT.widthPCT*p.ResizeBasis.basisWidth/100),S=Math.round(p.ResizePCT.heightPCT*p.ResizeBasis.basisHeight/100);switch(n){case H.LEFT_TOP:f=h-M,c=y-S;break;case H.RIGHT_TOP:f=M-h,c=y-S;break;case H.RIGHT_BOTTOM:f=M-h,c=S-y;break;case H.LEFT_BOTTOM:f=h-M,c=S-y;break}return u}if(i%(2*Math.PI)!==0&&a!==void 0&&s!==void 0)return Ci(t,u,i,a,s,l,d,r,o);switch(n){case H.LEFT_TOP:u.width=r?h:h-f*t,u.height=o?y:y-c*t;break;case H.RIGHT_TOP:u.width=r?h:h+f*t,u.height=o?y:y-c*t;break;case H.RIGHT_BOTTOM:u.width=r?h:h+f*t,u.height=o?y:y+c*t;break;case H.LEFT_BOTTOM:u.width=r?h:h-f*t,u.height=o?y:y+c*t;break}return u},ji=function(n,e){var t=n.id,r=n.anchors,o=e.getNodeEdges(t);W(o,function(i){if(i.sourceNodeId===t){var a=Ht(r,function(s){return s.id===i.sourceAnchorId});a&&i.updateStartPoint({x:a.x,y:a.y})}else if(i.targetNodeId===t){var a=Ht(r,function(l){return l.id===i.targetAnchorId});a&&i.updateEndPoint({x:a.x,y:a.y})}})},Ri=function(n,e,t,r,o,i,a){a.eventCenter.emit(T.NODE_RESIZE,{preData:n,data:e,deltaX:t,deltaY:r,index:o,model:i})},Ii=function(n){var e=n.x,t=n.y,r=n.deltaX,o=n.deltaY,i=n.index,a=n.nodeModel,s=n.graphModel,l=n.cancelCallback,d=a.r,u=a.rx,f=a.ry,c=a.width,h=a.height,y=a.PCTResizeInfo,p=a.minWidth,g=a.minHeight,v=a.maxWidth,_=a.maxHeight,M=a.rotate,S=a.x,O=a.y,w=p===v,A=g===_,b={width:d||u||c,height:d||f||h,deltaX:r,deltaY:o,PCTResizeInfo:y},R=d||u&&f?1/2:1,L=e,z=t,I=Li(i,b,R,w,A,M,L,z,S,O);if(I.widthv||I.height_){l==null||l();return}(M%(2*Math.PI)==0||y||L===void 0||z===void 0)&&(I.deltaX=w?0:I.deltaX,I.deltaY=A?0:I.deltaY);var U=a.getData(),Y=a.resize(I);U.x===Y.x&&U.y===Y.y||(ji(a,s),Ri(U,Y,r,o,i,a,s))};function Bi(n,e,t,r,o,i,a,s){o===void 0&&(o=!1),i===void 0&&(i=!1);var l={x:t.x-(n.x-t.x),y:t.y-(n.y-t.y)},d=Di(l,e),u=ae(e,d,-r),f=ae(l,d,-r);if(o){var c=Math.abs(u.x-f.x),h=c-a;d.x>u.x?d.x=d.x+h/2:d.x=d.x-h/2}if(i){var y=Math.abs(u.y-f.y),p=y-s;d.y>u.y?d.y=d.y+p/2:d.y=d.y-p/2}if(o||i){var g=ae(f,d,r),v=g.x-l.x,_=g.y-l.y;d.x=d.x-v,d.y=d.y-_,f=ae(l,d,-r),u={x:d.x-(f.x-d.x),y:d.y-(f.y-d.y)}}var M=Math.abs(u.x-f.x),S=Math.abs(u.y-f.y);return o&&(M=a),i&&(S=s),{width:M,height:S,center:d}}var Xi=100,Yi={x:1,y:0};function Hi(n,e,t,r,o){for(var i=function(h){if(h<0||h>1)throw new RangeError('The value range of parameter "t" is [0,1]');return{x:n.x*Math.pow(1-h,3)+3*e.x*h*Math.pow(1-h,2)+3*t.x*Math.pow(h,2)*(1-h)+r.x*Math.pow(h,3),y:n.y*Math.pow(1-h,3)+3*e.y*h*Math.pow(1-h,2)+3*t.y*Math.pow(h,2)*(1-h)+r.y*Math.pow(h,3)}},a=0,s=2,l=r.x,d=r.y,u=r;a=0?r:-r}function _n(n){var e=Math.hypot(n.x,n.y);return{x:n.x/e,y:n.y/e,z:0}}function Fi(n){return Gi(Yi,n)}function $i(n){return n*(180/Math.PI)}var Ui={baseNode:{fill:"#fff",stroke:"#000",strokeWidth:2},baseEdge:{stroke:"#000",strokeWidth:2},rect:{},circle:{},diamond:{},ellipse:{},polygon:{},text:{color:"#000",stroke:"none",fontSize:12,background:{fill:"transparent"}},anchor:{stroke:"#000",fill:"#fff",r:4,hover:{r:10,fill:"#949494",fillOpacity:.5,stroke:"#949494"}},anchorLine:{stroke:"#000",strokeWidth:2,strokeDasharray:"3,2"},nodeText:{color:"#000",overflowMode:"default",fontSize:12,lineHeight:1.2},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"#fff"}},line:{},polyline:{},bezier:{fill:"none",adjustLine:{stroke:"#949494"},adjustAnchor:{r:4,fill:"#949494",fillOpacity:1,stroke:"#949494"}},arrow:{offset:10,verticalLength:5},snapline:{stroke:"#949494",strokeWidth:1},edgeAdjust:{r:4,fill:"#fff",stroke:"#949494",strokeWidth:2},outline:{fill:"transparent",stroke:"#949494",strokeDasharray:"3,3",hover:{stroke:"#949494"}},edgeAnimation:{stroke:"red",strokeDasharray:"10,10",strokeDashoffset:"100%",animationName:"lf_animate_dash",animationDuration:"20s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"normal"},rotateControl:{stroke:"#000",fill:"#fff",strokeWidth:1.5},resizeControl:{width:7,height:7,fill:"#fff",stroke:"#000"},resizeOutline:{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},uo=function(n){var e=C(Ui);return n&&(e=Fr(e,n)),e},Wi=uo,Zi=1e3,Vi=999,Wr=function(){return++Zi},Ki=function(){return--Vi},V=function(){return V=Object.assign||function(n){for(var e,t=1,r=arguments.length;t=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},nr=function(){function n(e,t){var r;this.BaseType=$.EDGE,this.id="",this.type="",this.sourceNodeId="",this.targetNodeId="",this.textMode=st.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this.points="",this.pointsList=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.isAnimation=!1,this.isShowAdjustPoint=!1,this.zIndex=0,this.state=X.DEFAULT,this.modelType=j.EDGE,this.customTextPosition=!1,this.style={},this.arrowConfig={markerEnd:"url(#marker-end-".concat(this.id,")"),markerStart:"url(#marker-start-".concat(this.id,")")},this.graphModel=t,this.properties=(r=e.properties)!==null&&r!==void 0?r:{},this.initEdgeData(e),this.setAttributes()}return n.prototype.initEdgeData=function(e){if(e.properties||(e.properties={}),!e.id){var t=this.graphModel.idGenerator,r=t&&t(e.type),o=this.createId();e.id=o||r||Yt()}this.arrowConfig.markerEnd="url(#marker-end-".concat(e.id,")"),this.arrowConfig.markerStart="url(#marker-start-".concat(e.id,")");var i=this.graphModel.editConfigModel.adjustEdgeStartAndEnd;this.isShowAdjustPoint=i,k(this,ni(e));var a=this.graphModel.overlapMode;a===pt.INCREASE&&(this.zIndex=e.zIndex||Wr()),this.setAnchors(),this.initPoints(),this.formatText(e)},n.prototype.setAttributes=function(){},n.prototype.createId=function(){return null},n.prototype.getEdgeStyle=function(){return V(V({},this.graphModel.theme.baseEdge),this.style)},n.prototype.getAdjustPointStyle=function(){return V({},this.graphModel.theme.edgeAdjust)},n.prototype.getTextStyle=function(){var e=this.graphModel.theme.edgeText;return C(e)},n.prototype.getEdgeAnimationStyle=function(){var e=this.graphModel.theme.edgeAnimation;return C(e)},n.prototype.getArrowStyle=function(){var e=this.getEdgeStyle(),t=this.getEdgeAnimationStyle(),r=this.graphModel.theme.arrow,o=this.isAnimation?t.stroke:e.stroke;return V(V(V({},e),{fill:o,stroke:o}),r)},n.prototype.getOutlineStyle=function(){var e=this.graphModel,t=e.theme.outline;return C(t)},n.prototype.getTextPosition=function(){return{x:0,y:0}},Object.defineProperty(n.prototype,"sourceNode",{get:function(){var e,t;return(t=(e=this.graphModel)===null||e===void 0?void 0:e.nodesMap[this.sourceNodeId])===null||t===void 0?void 0:t.model},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetNode",{get:function(){var e,t;return(t=(e=this.graphModel)===null||e===void 0?void 0:e.nodesMap[this.targetNodeId])===null||t===void 0?void 0:t.model},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"textPosition",{get:function(){return this.getTextPosition()},enumerable:!1,configurable:!0}),n.prototype.getBeginAnchor=function(e,t,r){var o,i,a=Er(e);if(r){if(o=Ht(a,function(s){return s.id===r}),o)return o;console.warn("未在节点上找到指定的起点锚点".concat(r,",已使用默认锚点作为起点"))}return a.forEach(function(s){var l=fn(s,t);(i===void 0||l=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},fr=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},mn=function(n){qi(e,n);function e(t,r){var o=n.call(this,t,r)||this;return o.modelType=j.BEZIER_EDGE,o.path="",o.initEdgeData(t),o.setAttributes(),o}return e.prototype.initEdgeData=function(t){this.offset=100,n.prototype.initEdgeData.call(this,t)},e.prototype.getEdgeStyle=function(){var t=this.graphModel.theme.bezier,r=n.prototype.getEdgeStyle.call(this),o=this.properties.style,i=o===void 0?{}:o;return It(It(It({},r),C(t)),C(i))},e.prototype.getTextPosition=function(){if(this.pointsList&&this.pointsList.length>0){var t=0,r=0;return this.pointsList.forEach(function(o){var i=o.x,a=o.y;t+=i,r+=a}),{x:t/this.pointsList.length,y:r/this.pointsList.length}}return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}},e.prototype.getData=function(){var t=n.prototype.getData.call(this),r=this.pointsList.map(function(o){var i=o.x,a=o.y;return{x:i,y:a}});return It(It({},t),{pointsList:r})},e.prototype.getControls=function(){var t=this.startPoint,r=this.endPoint,o=dn({start:t,end:r,sourceNode:this.sourceNode,targetNode:this.targetNode,offset:this.offset});return o},e.prototype.getPath=function(t){var r=fr(t,4),o=r[0],i=r[1],a=r[2],s=r[3];return"M ".concat(o.x," ").concat(o.y,` C `).concat(i.x," ").concat(i.y,`, `).concat(a.x," ").concat(a.y,`, `).concat(s.x," ").concat(s.y)},e.prototype.initPoints=function(){this.pointsList.length>0?this.path=this.getPath(this.pointsList):this.updatePoints()},e.prototype.updatePoints=function(){var t=this.getControls(),r=t.sNext,o=t.ePre;this.updatePath(r,o)},e.prototype.updatePath=function(t,r){t=C(t),r=C(r);var o={x:this.startPoint.x,y:this.startPoint.y},i={x:this.endPoint.x,y:this.endPoint.y};if(!t||!r){var a=this.getControls();t=a.sNext,r=a.ePre}this.pointsList=[o,t,r,i],this.path=this.getPath(this.pointsList)},e.prototype.updateStartPoint=function(t){this.startPoint=Object.assign({},t),this.updatePoints()},e.prototype.updateEndPoint=function(t){this.endPoint=Object.assign({},t),this.updatePoints()},e.prototype.moveStartPoint=function(t,r){this.startPoint.x+=t,this.startPoint.y+=r;var o=fr(this.pointsList,3),i=o[1],a=o[2];i.x+=t,i.y+=r,this.updatePath(i,a)},e.prototype.moveEndPoint=function(t,r){this.endPoint.x+=t,this.endPoint.y+=r;var o=fr(this.pointsList,3),i=o[1],a=o[2];a.x+=t,a.y+=r,this.updatePath(i,a)},e.prototype.updateAdjustAnchor=function(t,r){var o;r==="sNext"?this.pointsList[1]=t:r==="ePre"&&(this.pointsList[2]=t),this.path=this.getPath(this.pointsList),!((o=this.text)===null||o===void 0)&&o.value&&this.setText(k({},this.text,this.textPosition))},e.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},e.prototype.getAdjustEnd=function(){var t=this.pointsList;return t[t.length-1]||this.endPoint},e.prototype.updateAfterAdjustStartAndEnd=function(t){var r=t.startPoint,o=t.endPoint,i=t.sourceNode,a=t.targetNode,s=dn({start:r,end:o,sourceNode:i,targetNode:a,offset:this.offset}),l=s.sNext,d=s.ePre;this.pointsList=[r,l,d,o],this.initPoints()},dt([E],e.prototype,"path",void 0),dt([m],e.prototype,"initPoints",null),dt([m],e.prototype,"updatePoints",null),dt([m],e.prototype,"updateStartPoint",null),dt([m],e.prototype,"updateEndPoint",null),dt([m],e.prototype,"moveStartPoint",null),dt([m],e.prototype,"moveEndPoint",null),dt([m],e.prototype,"updateAdjustAnchor",null),dt([m],e.prototype,"getAdjustStart",null),dt([m],e.prototype,"getAdjustEnd",null),dt([m],e.prototype,"updateAfterAdjustStartAndEnd",null),e}(nr),Ji=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),le=function(){return le=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Qi=function(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;r=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Mn=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},ea=function(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;rl)&&(a=l,i=s)}),i},e.prototype.getCrossPoint=function(t,r,o){var i;return t===G.HORIZONTAL?i={x:o.x,y:r.y}:t===G.VERTICAL&&(i={x:r.x,y:o.y}),i},e.prototype.removeCrossPoints=function(t,r,o){var i=o.map(function(v){return v});if(t===1){var a=i[t],s=i[r],l=i[t-1],d=on(l,a,this.sourceNode);if(d){var u=an(a,s,this.sourceNode);if(u){var f=sn(a,s,this.sourceNode);f&&(i[t]=f,i.splice(t-1,1),t--,r--)}}else{var c=this.sourceNode.anchors;c.forEach(function(v){if(v.x===l.x&&v.x===a.x||v.y===l.y&&v.y===a.y){var _=vt(v.x,v.y,a.x,a.y),M=vt(l.x,l.y,a.x,a.y);_0?this.points=this.getPath(this.pointsList):this.updatePoints()},e.prototype.updatePoints=function(){var t=nn({x:this.startPoint.x,y:this.startPoint.y},{x:this.endPoint.x,y:this.endPoint.y},this.sourceNode,this.targetNode,this.offset||0);this.pointsList=t,this.points=t.map(function(r){return"".concat(r.x,",").concat(r.y)}).join(" ")},e.prototype.updateStartPoint=function(t){this.startPoint=Object.assign({},t),this.updatePoints()},e.prototype.moveStartPoint=function(t,r){this.startPoint.x+=t,this.startPoint.y+=r,this.updatePoints()},e.prototype.updateEndPoint=function(t){this.endPoint=Object.assign({},t),this.updatePoints()},e.prototype.moveEndPoint=function(t,r){this.endPoint.x+=t,this.endPoint.y+=r,this.updatePoints()},e.prototype.updatePointsList=function(t,r){this.pointsList.forEach(function(a){a.x+=t,a.y+=r});var o=this.pointsList[0];this.startPoint=Object.assign({},o);var i=this.pointsList[this.pointsList.length-1];this.endPoint=Object.assign({},i),this.initPoints()},e.prototype.dragAppendStart=function(){this.draggingPointList=this.pointsList.map(function(t){return t})},e.prototype.dragAppendSimple=function(t,r){var o;this.isDragging=!0;var i=t.start,a=t.end,s=t.startIndex,l=t.endIndex,d=t.direction,u=this.pointsList,f=u;return d===G.HORIZONTAL?(u[s]={x:i.x,y:i.y+r.y},u[l]={x:a.x,y:a.y+r.y},f=this.pointsList.map(function(c){return c})):d===G.VERTICAL&&(u[s]={x:i.x+r.x,y:i.y},u[l]={x:a.x+r.x,y:a.y},f=this.pointsList.map(function(c){return c})),this.updatePointsAfterDrag(f),this.draggingPointList=f,!((o=this.text)===null||o===void 0)&&o.value&&this.setText(k({},this.text,this.textPosition)),{start:k({},u[s]),end:k({},u[l]),startIndex:s,endIndex:l,direction:d}},e.prototype.dragAppend=function(t,r){var o;this.isDragging=!0;var i=t.start,a=t.end,s=t.startIndex,l=t.endIndex,d=t.direction,u=this.pointsList;if(d===G.HORIZONTAL){u[s]={x:i.x,y:i.y+r.y},u[l]={x:a.x,y:a.y+r.y};var f=this.pointsList.map(function(g){return g});if(s!==0&&l!==this.pointsList.length-1&&(f=this.removeCrossPoints(s,l,f)),s===0){var c={x:i.x,y:i.y+r.y},h=Nt(c,this.sourceNode);if(!h){var y=this.sourceNode.anchors;f=this.getDraggingPoints(d,"start",c,y,f)}}if(l===this.pointsList.length-1){var p={x:a.x,y:a.y+r.y},h=Nt(p,this.targetNode);if(!h){var y=this.targetNode.anchors;f=this.getDraggingPoints(d,"end",p,y,f)}}this.updatePointsAfterDrag(f),this.draggingPointList=f}else if(d===G.VERTICAL){u[s]={x:i.x+r.x,y:i.y},u[l]={x:a.x+r.x,y:a.y};var f=this.pointsList.map(function(v){return v});if(s!==0&&l!==this.pointsList.length-1&&(f=this.removeCrossPoints(s,l,f)),s===0){var c={x:i.x+r.x,y:i.y},h=Nt(c,this.sourceNode);if(!h){var y=this.sourceNode.anchors;f=this.getDraggingPoints(d,"start",c,y,f)}}if(l===this.pointsList.length-1){var p={x:a.x+r.x,y:a.y},h=Nt(p,this.targetNode);if(!h){var y=this.targetNode.anchors;f=this.getDraggingPoints(d,"end",p,y,f)}}this.updatePointsAfterDrag(f),this.draggingPointList=f}return!((o=this.text)===null||o===void 0)&&o.value&&this.setText(k({},this.text,this.textPosition)),{start:k({},u[s]),end:k({},u[l]),startIndex:s,endIndex:l,direction:d}},e.prototype.dragAppendEnd=function(){if(this.draggingPointList){var t=Qn(kt(this.points));this.pointsList=t.map(function(i){return i}),this.draggingPointList=[];var r=t[0];this.startPoint=k({},r);var o=t[t.length-1];this.endPoint=k({},o)}this.isDragging=!1},e.prototype.updatePointsAfterDrag=function(t){var r=this.updateCrossPoints(t);this.points=r.map(function(o){return"".concat(o.x,",").concat(o.y)}).join(" ")},e.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},e.prototype.getAdjustEnd=function(){var t=this.pointsList;return t[t.length-1]||this.endPoint},e.prototype.updateAfterAdjustStartAndEnd=function(t){var r=t.startPoint,o=t.endPoint,i=t.sourceNode,a=t.targetNode;this.pointsList=nn({x:r.x,y:r.y},{x:o.x,y:o.y},i,a,this.offset||0),this.initPoints()},tt([E],e.prototype,"dbClickPosition",void 0),tt([m],e.prototype,"initPoints",null),tt([m],e.prototype,"updatePoints",null),tt([m],e.prototype,"updateStartPoint",null),tt([m],e.prototype,"moveStartPoint",null),tt([m],e.prototype,"updateEndPoint",null),tt([m],e.prototype,"moveEndPoint",null),tt([m],e.prototype,"updatePointsList",null),tt([m],e.prototype,"dragAppendStart",null),tt([m],e.prototype,"dragAppendSimple",null),tt([m],e.prototype,"dragAppend",null),tt([m],e.prototype,"dragAppendEnd",null),tt([m],e.prototype,"updatePointsAfterDrag",null),tt([m],e.prototype,"getAdjustStart",null),tt([m],e.prototype,"getAdjustEnd",null),tt([m],e.prototype,"updateAfterAdjustStartAndEnd",null),e}(nr),q=function(){return q=Object.assign||function(n){for(var e,t=1,r=arguments.length;t=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Sn=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ra=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Ct=function(){function n(e,t){var r;this.BaseType=$.NODE,this.id="",this.type="",this.x=0,this.y=0,this.textMode=st.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this._width=100,this._height=80,this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.anchorsOffset=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isShowAnchor=!1,this.isDragging=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.rotatable=!0,this.resizable=!0,this.zIndex=1,this.state=X.DEFAULT,this.autoToFront=!0,this.style={},this._rotate=0,this.modelType=j.NODE,this.additionStateData={},this.targetRules=[],this.sourceRules=[],this.moveRules=[],this.resizeRules=[],this.hasSetTargetRules=!1,this.hasSetSourceRules=!1,this.graphModel=t,this.properties=(r=e.properties)!==null&&r!==void 0?r:{},this.initNodeData(e),this.setAttributes()}return Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e;var t=this,r=t.x,o=r===void 0?0:r,i=t.y,a=i===void 0?0:i;this.transform=new rr(-o,-a).rotate(e).translate(o,a).toString()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"incoming",{get:function(){return{nodes:this.graphModel.getNodeIncomingNode(this.id),edges:this.graphModel.getNodeIncomingEdge(this.id)}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outgoing",{get:function(){return{nodes:this.graphModel.getNodeOutgoingNode(this.id),edges:this.graphModel.getNodeOutgoingEdge(this.id)}},enumerable:!1,configurable:!0}),n.prototype.initNodeData=function(e){if(e.properties||(e.properties={}),!e.id){var t=this.graphModel.idGenerator,r=t&&t(e.type),o=this.createId();e.id=o||r||Yt()}this.formatText(e),k(this,pi(e));var i=this.graphModel.overlapMode;i===pt.INCREASE&&(this.zIndex=e.zIndex||Wr())},n.prototype.setAttributes=function(){},n.prototype.createId=function(){return null},n.prototype.setTextMode=function(e){this.textMode=e},n.prototype.formatText=function(e){var t,r,o,i=this.graphModel.editConfigModel,a=i.nodeTextDraggable,s=i.nodeTextEdit,l=e.x,d=e.y,u=e.text,f={value:"",x:l,y:d,draggable:a,editable:s};u&&(typeof u=="string"?f.value=u:(f=q(q({},f),{x:(t=u.x)!==null&&t!==void 0?t:l,y:(r=u.y)!==null&&r!==void 0?r:d,value:(o=u.value)!==null&&o!==void 0?o:""}),Qt(u.draggable)||(f.draggable=u.draggable),Qt(u.editable)||(f.editable=u.editable))),e.text=f},n.prototype.resize=function(e){var t=e.width,r=e.height,o=e.deltaX,i=e.deltaY,a=this.isAllowResizeNode(o,i,t,r);return a?(this.move(o/2,i/2),this.width=t,this.height=r,this.setProperties({width:t,height:r}),this.getData()):this.getData()},n.prototype.proportionalResize=function(){},n.prototype.getData=function(){var e=this.text,t=e.x,r=e.y,o=e.value,i=this.properties;qn(i)&&(i=mt(i)),ht(i.width)&&(i.width=this.width),ht(i.height)&&(i.height=this.height);var a={id:this.id,type:this.type,x:this.x,y:this.y,properties:i};return this.rotate&&(a.rotate=this.rotate),this.graphModel.overlapMode===pt.INCREASE&&(a.zIndex=this.zIndex),o&&(a.text={x:t,y:r,value:o}),a},n.prototype.getHistoryData=function(){return this.getData()},n.prototype.getProperties=function(){return mt(this.properties)},n.prototype.getOuterGAttributes=function(){return{className:""}},n.prototype.getNodeStyle=function(){return q(q({},this.graphModel.theme.baseNode),this.style)},n.prototype.getTextStyle=function(){var e=this.graphModel.theme.nodeText,t=this.properties.textStyle,r=t===void 0?{}:t;return q(q({},C(e)),C(r))},n.prototype.getRotateControlStyle=function(){var e=this.graphModel.theme.rotateControl;return C(e)},n.prototype.getResizeControlStyle=function(){var e=this.graphModel.theme.resizeControl;return C(e)},n.prototype.getResizeOutlineStyle=function(){var e=this.graphModel.theme.resizeOutline;return C(e)},n.prototype.getAnchorStyle=function(e){var t=this.graphModel.theme.anchor;return C(t)},n.prototype.getAnchorLineStyle=function(e){var t=this.graphModel.theme.anchorLine;return C(t)},n.prototype.getOutlineStyle=function(){var e=this.graphModel.theme.outline;return C(e)},n.prototype.isAllowConnectedAsSource=function(e,t,r,o){var i=this.hasSetSourceRules?this.sourceRules:this.getConnectedSourceRules();this.hasSetSourceRules=!0;for(var a=!0,s="",l=0;l0?t.map(function(a,s){return a.length?(a=a,{id:"".concat(r,"_").concat(s),x:o+a[0],y:i+a[1]}):(a=a,q(q({},a),{x:o+a.x,y:i+a.y,id:a.id||"".concat(r,"_").concat(s)}))}):this.getDefaultAnchor()},n.prototype.getDefaultAnchor=function(){return[]},n.prototype.getTargetAnchor=function(e){return ui(e,this)},n.prototype.getBounds=function(){return{minX:this.x-this.width/2,minY:this.y-this.height/2,maxX:this.x+this.width/2,maxY:this.y+this.height/2}},Object.defineProperty(n.prototype,"anchors",{get:function(){var e=this.getAnchorsByOffset(),t=this,r=t.x,o=t.y,i=t.rotate;return e.forEach(function(a){var s=a.x,l=a.y,d=ra(new er([s,l,1]).translate(-r,-o).rotate(i).translate(r,o)[0],2),u=d[0],f=d[1];a.x=u,a.y=f}),e},enumerable:!1,configurable:!0}),n.prototype.getAnchorInfo=function(e){if(!ht(e))for(var t=0;t=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},wn=function(n){na(e,n);function e(t,r){var o=n.call(this,t,r)||this;return o.modelType=j.CIRCLE_NODE,o.r=50,o.initNodeData(t),o.setAttributes(),o}return Object.defineProperty(e.prototype,"width",{get:function(){return this.r*2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.r*2},enumerable:!1,configurable:!0}),e.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var t=this.properties.r;t&&(this.r=t)},e.prototype.getNodeStyle=function(){var t=n.prototype.getNodeStyle.call(this),r=this.graphModel.theme.circle,o=this.properties.style,i=o===void 0?{}:o;return ue(ue(ue({},t),C(r)),C(i))},e.prototype.getDefaultAnchor=function(){var t=this,r=t.x,o=t.y,i=t.r;return[{x:r,y:o-i,id:"".concat(this.id,"_0")},{x:r+i,y:o,id:"".concat(this.id,"_1")},{x:r,y:o+i,id:"".concat(this.id,"_2")},{x:r-i,y:o,id:"".concat(this.id,"_3")}]},e.prototype.resize=function(t){var r=t.width,o=t.deltaX,i=t.deltaY;return this.move(o/2,i/2),this.r=r,this.setProperties({r}),this.getData()},cr([E],e.prototype,"r",void 0),cr([F],e.prototype,"width",null),cr([F],e.prototype,"height",null),e}(Ct),oa=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),fe=function(){return fe=Object.assign||function(n){for(var e,t=1,r=arguments.length;t=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},je=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},An=function(n){oa(e,n);function e(t,r){var o=n.call(this,t,r)||this;return o.modelType=j.DIAMOND_NODE,o.rx=30,o.ry=50,o.initNodeData(t),o.setAttributes(),o}return e.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var t=this.properties,r=t.rx,o=t.ry;r&&(this.rx=r),o&&(this.ry=o)},e.prototype.getNodeStyle=function(){var t=n.prototype.getNodeStyle.call(this),r=this.graphModel.theme.diamond,o=this.properties.style,i=o===void 0?{}:o;return fe(fe(fe({},t),C(r)),C(i))},Object.defineProperty(e.prototype,"points",{get:function(){var t=this,r=t.x,o=t.y,i=t.rx,a=t.ry;return[[r,o-a],[r+i,o],[r,o+a],[r-i,o]]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pointsPosition",{get:function(){return St(this.points,function(t){var r=je(t,2),o=r[0],i=r[1];return{x:o,y:i}})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){var t=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;return W(this.points,function(o){var i=je(o,1),a=i[0];ar&&(r=a)}),r-t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){var t=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;return W(this.points,function(o){var i=je(o,2),a=i[1];ar&&(r=a)}),r-t},enumerable:!1,configurable:!0}),e.prototype.getDefaultAnchor=function(){var t=this;return St(this.points,function(r,o){var i=je(r,2),a=i[0],s=i[1];return{x:a,y:s,id:"".concat(t.id,"_").concat(o)}})},e.prototype.resize=function(t){var r=t.width,o=t.height,i=t.deltaX,a=t.deltaY;return this.move(i/2,a/2),this.rx=r,this.ry=o,this.setProperties({rx:r,ry:o}),this.getData()},Wt([E],e.prototype,"rx",void 0),Wt([E],e.prototype,"ry",void 0),Wt([F],e.prototype,"points",null),Wt([F],e.prototype,"pointsPosition",null),Wt([F],e.prototype,"width",null),Wt([F],e.prototype,"height",null),e}(Ct),ia=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),ce=function(){return ce=Object.assign||function(n){for(var e,t=1,r=arguments.length;t=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Pn=function(n){ia(e,n);function e(t,r){var o=n.call(this,t,r)||this;return o.modelType=j.ELLIPSE_NODE,o.rx=30,o.ry=45,o.initNodeData(t),o.setAttributes(),o}return e.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var t=this.properties,r=t.rx,o=t.ry;r&&(this.rx=r),o&&(this.ry=o)},e.prototype.getNodeStyle=function(){var t=n.prototype.getNodeStyle.call(this),r=this.graphModel.theme.ellipse,o=this.properties.style,i=o===void 0?{}:o;return ce(ce(ce({},t),C(r)),C(i))},Object.defineProperty(e.prototype,"width",{get:function(){return this.rx*2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.ry*2},enumerable:!1,configurable:!0}),e.prototype.getDefaultAnchor=function(){var t=this,r=t.x,o=t.y,i=t.rx,a=t.ry;return[{x:r,y:o-a,id:"".concat(this.id,"_0")},{x:r+i,y:o,id:"".concat(this.id,"_1")},{x:r,y:o+a,id:"".concat(this.id,"_2")},{x:r-i,y:o,id:"".concat(this.id,"_3")}]},e.prototype.resize=function(t){var r=t.width,o=t.height,i=t.deltaX,a=t.deltaY;return this.move(i/2,a/2),this.rx=r,this.ry=o,this.setProperties({rx:r,ry:o}),this.getData()},Re([E],e.prototype,"rx",void 0),Re([E],e.prototype,"ry",void 0),Re([F],e.prototype,"width",null),Re([F],e.prototype,"height",null),e}(Ct),aa=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),pe=function(){return pe=Object.assign||function(n){for(var e,t=1,r=arguments.length;t=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Be=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Tn=function(n){aa(e,n);function e(t,r){var o=n.call(this,t,r)||this;return o.modelType=j.POLYGON_NODE,o.points=[[50,0],[100,50],[50,100],[0,50]],o.initNodeData(t),o.setAttributes(),o}return e.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var t=this.properties,r=t.points,o=t.width,i=t.height,a=r||this.points;this.points=ai(a,o,i)},e.prototype.getNodeStyle=function(){var t=n.prototype.getNodeStyle.call(this),r=this.graphModel.theme.polygon,o=this.properties.style,i=o===void 0?{}:o;return pe(pe(pe({},t),C(r)),C(i))},Object.defineProperty(e.prototype,"pointsPosition",{get:function(){var t=this,r=t.x,o=t.y,i=t.width,a=t.height;return this.points.map(function(s){return{x:s[0]+r-i/2,y:s[1]+o-a/2}})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){var t=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;return this.points.forEach(function(o){var i=Be(o,1),a=i[0];ar&&(r=a)}),r-t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){var t=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;return this.points.forEach(function(o){var i=Be(o,2),a=i[1];ar&&(r=a)}),r-t},enumerable:!1,configurable:!0}),e.prototype.getDefaultAnchor=function(){var t=this,r=this,o=r.x,i=r.y,a=r.width,s=r.height,l=r.points;return l.map(function(d,u){var f=Be(d,2),c=f[0],h=f[1];return{x:o+c-a/2,y:i+h-s/2,id:"".concat(t.id,"_").concat(u)}})},e.prototype.resize=function(t){var r=this,o=t.width,i=t.height,a=t.deltaX,s=t.deltaY;this.move(a/2,s/2);var l=St(this.points,function(d){var u=Be(d,2),f=u[0],c=u[1];return[f*o/r.width,c*i/r.height]});return this.points=l,this.properties.points=l,this.getData()},Ie([E],e.prototype,"points",void 0),Ie([F],e.prototype,"pointsPosition",null),Ie([F],e.prototype,"width",null),Ie([F],e.prototype,"height",null),e}(Ct),sa=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),he=function(){return he=Object.assign||function(n){for(var e,t=1,r=arguments.length;t=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Dn=function(n){sa(e,n);function e(t,r){var o=n.call(this,t,r)||this;return o.modelType=j.RECT_NODE,o.radius=0,o.initNodeData(t),o.setAttributes(),o}return e.prototype.setAttributes=function(){n.prototype.setAttributes.call(this);var t=this.properties,r=t.width,o=t.height,i=t.radius;ht(r)||(this.width=r),ht(o)||(this.height=o),ht(i)||(this.radius=i)},e.prototype.getDefaultAnchor=function(){var t=this,r=t.x,o=t.y,i=t.width,a=t.height;return[{x:r,y:o-a/2,id:"".concat(this.id,"_0")},{x:r+i/2,y:o,id:"".concat(this.id,"_1")},{x:r,y:o+a/2,id:"".concat(this.id,"_2")},{x:r-i/2,y:o,id:"".concat(this.id,"_3")}]},e.prototype.getNodeStyle=function(){var t=n.prototype.getNodeStyle.call(this),r=this.graphModel.theme.rect,o=this.properties.style,i=o===void 0?{}:o;return he(he(he({},t),C(r)),C(i))},la([E],e.prototype,"radius",void 0),e}(Ct),da=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),ve=function(){return ve=Object.assign||function(n){for(var e,t=1,r=arguments.length;t=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},ua=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},fa=function(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;r=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},pa={stopZoomGraph:!1,stopScrollGraph:!1,stopMoveGraph:!1,adjustEdge:!1,adjustEdgeStartAndEnd:!1,adjustNodePosition:!1,hideAnchors:!0,allowRotate:!1,allowResize:!1,nodeSelectedOutline:!0,textEdit:!1,nodeTextEdit:!1,edgeTextEdit:!1,textDraggable:!1,nodeTextDraggable:!1,edgeTextDraggable:!1},Xe=["isSilentMode","stopZoomGraph","stopScrollGraph","stopMoveGraph","snapGrid","adjustEdge","adjustEdgeMiddle","adjustEdgeStartAndEnd","adjustEdgeStart","adjustEdgeEnd","adjustNodePosition","hideAnchors","allowRotate","allowResize","autoExpand","hoverOutline","nodeSelectedOutline","edgeSelectedOutline","textEdit","nodeTextEdit","edgeTextEdit","textDraggable","nodeTextDraggable","edgeTextDraggable","multipleSelectKey","textMode","nodeTextMode","edgeTextMode","nodeTextMultiple","edgeTextMultiple","nodeTextVertical","edgeTextVertical"],ha=function(){function n(e){this.isSilentMode=!1,this.stopZoomGraph=!1,this.stopMoveGraph=!1,this.stopScrollGraph=!1,this.snapGrid=!1,this.textMode=st.TEXT,this.textEdit=!0,this.textDraggable=!1,this.nodeTextEdit=!0,this.nodeTextDraggable=!1,this.nodeTextMultiple=!1,this.nodeTextVertical=!1,this.nodeTextMode=st.TEXT,this.edgeTextMode=st.TEXT,this.edgeTextEdit=!0,this.edgeTextDraggable=!1,this.edgeTextMultiple=!1,this.edgeTextVertical=!1,this.hideAnchors=!1,this.allowRotate=!1,this.allowResize=!1,this.hoverOutline=!0,this.nodeSelectedOutline=!0,this.adjustNodePosition=!0,this.autoExpand=!1,this.adjustEdge=!0,this.adjustEdgeMiddle=!1,this.adjustEdgeStartAndEnd=!1,this.adjustEdgeStart=!1,this.adjustEdgeEnd=!1,this.edgeSelectedOutline=!0,this.multipleSelectKey="",k(this,this.computeConfig(e))}return n.prototype.updateEditConfig=function(e){var t=this.computeConfig(e);k(this,t)},n.prototype.computeConfig=function(e){var t=e.isSilentMode,r=e.textDraggable,o=e.textMode,i=e.textEdit,a=e.adjustEdgeStartAndEnd,s={};if(t===!1&&k(s,this.stagedConfig),t===!0&&t!==this.isSilentMode){var l=Kt(pa,Xe);this.stagedConfig=Kt(this,Xe),k(s,l)}Qt(i)||k(s,{nodeTextEdit:i,edgeTextEdit:i}),Qt(r)||k(s,{nodeTextDraggable:r,edgeTextDraggable:r}),o&&k(s,{nodeTextMode:o,edgeTextMode:o}),gr(a)&&k(s,{adjustEdgeStart:a,adjustEdgeEnd:a});var d=Kt(e,Xe);return k(s,d)},n.prototype.updateTextMode=function(e){this.textMode=e,this.edgeTextMode=e,this.nodeTextMode=e},n.prototype.getConfig=function(){return Kt(this,Xe)},B([E],n.prototype,"isSilentMode",void 0),B([E],n.prototype,"stopZoomGraph",void 0),B([E],n.prototype,"stopMoveGraph",void 0),B([E],n.prototype,"stopScrollGraph",void 0),B([E],n.prototype,"snapGrid",void 0),B([E],n.prototype,"textMode",void 0),B([E],n.prototype,"textEdit",void 0),B([E],n.prototype,"textDraggable",void 0),B([E],n.prototype,"nodeTextEdit",void 0),B([E],n.prototype,"nodeTextDraggable",void 0),B([E],n.prototype,"nodeTextMultiple",void 0),B([E],n.prototype,"nodeTextVertical",void 0),B([E],n.prototype,"nodeTextMode",void 0),B([E],n.prototype,"edgeTextMode",void 0),B([E],n.prototype,"edgeTextEdit",void 0),B([E],n.prototype,"edgeTextDraggable",void 0),B([E],n.prototype,"edgeTextMultiple",void 0),B([E],n.prototype,"edgeTextVertical",void 0),B([E],n.prototype,"hideAnchors",void 0),B([E],n.prototype,"allowRotate",void 0),B([E],n.prototype,"allowResize",void 0),B([E],n.prototype,"hoverOutline",void 0),B([E],n.prototype,"nodeSelectedOutline",void 0),B([E],n.prototype,"adjustNodePosition",void 0),B([E],n.prototype,"autoExpand",void 0),B([E],n.prototype,"adjustEdge",void 0),B([E],n.prototype,"adjustEdgeMiddle",void 0),B([E],n.prototype,"adjustEdgeStartAndEnd",void 0),B([E],n.prototype,"adjustEdgeStart",void 0),B([E],n.prototype,"adjustEdgeEnd",void 0),B([E],n.prototype,"edgeSelectedOutline",void 0),B([m],n.prototype,"updateEditConfig",null),B([m],n.prototype,"updateTextMode",null),n}(),va="*",ya=function(){function n(){this._events={}}return n.prototype.on=function(e,t,r){var o=this;e==null||e.split(",").forEach(function(i){i=i.trim(),o._events[i]||(o._events[i]=[]),o._events[i].push({callback:t,once:!!r})})},n.prototype.once=function(e,t){var r=this;e==null||e.split(",").forEach(function(o){o=o.trim(),r.on(o,t,!0)})},n.prototype.emit=function(e,t){var r=this;e==null||e.split(",").forEach(function(o){var i=r._events[o]||[],a=r._events[va]||[],s=function(l){for(var d=l.length,u=0;u=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},ma=function(n){ga(e,n);function e(t){var r=n.call(this)||this;r.stepScrollX=0,r.stepScrollY=0,r.onDragging=function(s){var l=s.deltaX,d=s.deltaY;r.setState({isDragging:!0});var u=r.props.graphModel,f=u.transformModel,c=u.editConfigModel;c.stopMoveGraph!==!0&&f.translate(l,d)},r.onDragEnd=function(){r.setState({isDragging:!1})},r.zoomHandler=function(s){var l=r.props,d=l.graphModel,u=d.editConfigModel,f=d.transformModel,c=d.gridSize,h=l.graphModel,y=s.deltaX,p=s.deltaY,g=u.stopScrollGraph,v=u.stopZoomGraph;if(!g&&!s.ctrlKey&&!s.metaKey){if(s.preventDefault(),r.stepScrollX+=y,r.stepScrollY+=p,Math.abs(r.stepScrollX)>=c){var _=r.stepScrollX%c,M=r.stepScrollX-_;f.translate(-M*f.SCALE_X,0),r.stepScrollX=_}if(Math.abs(r.stepScrollY)>=c){var S=r.stepScrollY%c,O=r.stepScrollY-S;f.translate(0,-O*f.SCALE_Y),r.stepScrollY=S}return}if(!v){s.preventDefault();var w=h.getPointByClient({x:s.clientX,y:s.clientY}),A=w.canvasOverlayPosition,b=A.x,R=A.y;f.zoom(s.deltaY<0,[b,R])}},r.clickHandler=function(s){var l=s.target;if(l.getAttribute("name")==="canvas-overlay"){var d=r.props.graphModel,u=d.selectElements;u.size>0&&d.clearSelectElements(),d.eventCenter.emit(T.BLANK_CLICK,{e:s})}},r.handleContextMenu=function(s){var l=s.target;if(l.getAttribute("name")==="canvas-overlay"){s.preventDefault();var d=r.props.graphModel,u=d.getPointByClient({x:s.clientX,y:s.clientY});d.eventCenter.emit(T.BLANK_CONTEXTMENU,{e:s,position:u})}},r.mouseDownHandler=function(s){var l=r.props.graphModel,d=l.eventCenter,u=l.editConfigModel,f=l.transformModel.SCALE_X,c=l.gridSize,h=u.adjustEdge,y=u.adjustNodePosition,p=u.stopMoveGraph,g=s.target,v=!h&&!y;(g.getAttribute("name")==="canvas-overlay"||v)&&(p!==!0?(r.stepDrag.setStep(c*f),r.stepDrag.handleMouseDown(s)):d.emit(T.BLANK_MOUSEDOWN,{e:s}),r.clickHandler(s))};var o=t.graphModel,i=o.gridSize,a=o.eventCenter;return r.stepDrag=new Mt({onDragging:r.onDragging,onDragEnd:r.onDragEnd,step:i,eventType:"BLANK",isStopPropagation:!1,eventCenter:a,model:void 0}),r.state={isDragging:!1},r}return e.prototype.render=function(){var t=this.props.graphModel.transformModel,r=t.getTransformStyle().transform,o=this.props,i=o.children,a=o.dnd,s=this.state.isDragging;return x("svg",Nr({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",name:"canvas-overlay",onWheel:this.zoomHandler,onMouseDown:this.mouseDownHandler,onContextMenu:this.handleContextMenu,className:s?"lf-canvas-overlay lf-dragging":"lf-canvas-overlay lf-drag-able"},a.eventMap(),{children:x("g",{transform:r,children:i})}))},e=_a([ot],e),e}(K),fo=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),we=function(){return we=Object.assign||function(n){for(var e,t=1,r=arguments.length;t=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Ea=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Ln=function(n){fo(e,n);function e(){var t=n.call(this)||this;return t.onDragging=function(r){var o=r.event,i=t.props,a=i.graphModel,s=i.bezierModel,l=i.type,d=a.getPointByClient({x:o.clientX,y:o.clientY}).canvasOverlayPosition,u=d.x,f=d.y;s.updateAdjustAnchor({x:u,y:f},l),a.eventCenter.emit(T.EDGE_ADJUST,{data:s.getData()})},t.onDragEnd=function(){var r=t.props.bezierModel;r.isDragging=!1},t.dragHandler=new Mt({onDragging:t.onDragging,onDragEnd:t.onDragEnd}),t}return e.prototype.render=function(){var t=this,r=this.props.position,o=r.x,i=r.y,a=this.props.bezierModel,s=a.getEdgeStyle().adjustAnchor;return x(re,we({className:"lf-bezier-adjust-anchor",x:o,y:i},s,{onMouseDown:function(l){t.dragHandler.handleMouseDown(l)}}))},e}(K),Ma=function(n){fo(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.getBezierAdjust=function(t,r){var o=t.path,i=t.id,a=$r(o),s=Ea(a,4),l=s[0],d=s[1],u=s[2],f=s[3],c=t.getEdgeStyle().adjustLine,h=[];return h.push(x(ee,we({x1:l.x,y1:l.y,x2:d.x,y2:d.y},c))),h.push(x(Ln,{position:d,bezierModel:t,graphModel:r,type:"sNext"},"".concat(i,"_ePre"))),h.push(x(ee,we({x1:f.x,y1:f.y,x2:u.x,y2:u.y},c))),h.push(x(Ln,{position:u,bezierModel:t,graphModel:r,type:"ePre"},"".concat(i,"_sNext"))),h},e.prototype.selectedBezierEdge=function(){for(var t=this.props.graphModel,r=t.edges,o=[],i=0;i=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},wa=function(n){Oa(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.render=function(){var t=this.props.background;return x("div",{className:"lf-background",children:x("div",{style:mo(t)?t:{},className:"lf-background-area"})})},e=Sa([ot],e),e}(K),Aa=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Pa=function(n,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,r);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},qe=function(n){Aa(e,n);function e(t){var r=n.call(this,t)||this;return r.id=Yt(),r.gridOptions=r.props.graphModel.grid,r}return e.prototype.renderDot=function(){var t=this.gridOptions,r=t.config,o=t.size,i=o===void 0?1:o,a=t.visible,s=r??{},l=s.color,d=s.thickness,u=d===void 0?2:d,f=Math.min(Math.max(2,u),i/4),c=a?1:0;return x("g",{fill:l,opacity:c,children:[x("circle",{cx:0,cy:0,r:f/2}),x("circle",{cx:0,cy:i,r:f/2}),x("circle",{cx:i,cy:0,r:f/2}),x("circle",{cx:i,cy:i,r:f/2})]})},e.prototype.renderMesh=function(){var t=this.gridOptions,r=t.config,o=t.size,i=o===void 0?1:o,a=t.visible,s=r??{},l=s.color,d=s.thickness,u=d===void 0?1:d,f=Math.min(Math.max(1,u),i/2),c="M 0 0 H ".concat(i," V ").concat(i," H 0 Z"),h=a?1:0;return x("path",{d:c,stroke:l,strokeWidth:f/2,opacity:h,fill:"transparent"})},e.prototype.render=function(){var t=this.props.graphModel.transformModel,r=this.gridOptions,o=r.type,i=r.size,a=i===void 0?1:i,s=t.SCALE_X,l=t.SKEW_Y,d=t.SKEW_X,u=t.SCALE_Y,f=t.TRANSLATE_X,c=t.TRANSLATE_Y,h=[s,l,d,u,f,c].join(","),y="matrix(".concat(h,")");return x("div",{className:"lf-grid",children:x("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",children:[x("defs",{children:x("pattern",{id:this.id,patternUnits:"userSpaceOnUse",patternTransform:y,x:"0",y:"0",width:a,height:a,children:[o==="dot"&&this.renderDot(),o==="mesh"&&this.renderMesh()]})}),x("rect",{width:"100%",height:"100%",fill:"url(#".concat(this.id,")")})]})})},e=Pa([ot],e),e}(K);(function(n){n.defaultProps={size:Bo,visible:!0,type:"dot",config:{color:"#ababab",thickness:1}};function e(t){var r=C(n.defaultProps);return typeof t=="number"?k(r,{size:t}):typeof t=="boolean"?k(r,{visible:t}):k(r,t)}n.getGridOptions=e})(qe||(qe={}));var Ta=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Da=function(n,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,r);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Na=function(n){Ta(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.render=function(){var t=this.props.graphModel.transformModel,r=t.getTransformStyle().transform,o=this.props.children;return x("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",className:"modification-overlay",children:x("g",{transform:r,children:o})})},e=Da([ot],e),e}(K),ba=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),wt=function(){return wt=Object.assign||function(n){for(var e,t=1,r=arguments.length;t=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},La=function(n){ba(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.getNodesOutline=function(){var t=this.props.graphModel,r=t.nodes,o=t.editConfigModel,i=o.hoverOutline,a=o.nodeSelectedOutline,s=[];return r.forEach(function(l){if(l.isHovered||l.isSelected){var d=l.isHovered,u=l.isSelected,f=l.x,c=l.y,h=l.width,y=l.height;if(a&&u||i&&d){var p=l.getOutlineStyle(),g={};if(Object.keys(p).forEach(function(_){_!=="hover"&&(g[_]=p[_])}),d){var v=p.hover;g=wt(wt({},g),v)}s.push(x(Et,wt({transform:l.transform,className:"lf-outline-node",x:f,y:c,width:h+10,height:y+10},g)))}}}),s},e.prototype.getEdgeOutline=function(){for(var t=this.props.graphModel,r=t.edges,o=t.editConfigModel,i=o.edgeSelectedOutline,a=o.hoverOutline,s=[],l=0;l=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Ia=function(n){ja(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.render=function(){var t=this.props.snaplineModel,r=t??{},o=r.position,i=r.isShowHorizontal,a=r.isShowVertical,s=t==null?void 0:t.getStyle(),l=o??{},d=l.x,u=d===void 0?0:d,f=l.y,c=f===void 0?0:f,h=At(At({x1:-1e5,y1:c,x2:1e5,y2:c},s),{stroke:i?s==null?void 0:s.stroke:"none"}),y=At(At({x1:u,y1:-1e5,x2:u,y2:1e5},s),{stroke:a?s==null?void 0:s.stroke:"none"});return x("g",{className:"lf-snapline",children:[x(ee,At({},h)),x(ee,At({},y))]})},e=Ra([ot],e),e}(K),Ba=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Xa=function(n,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,r);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Ya=function(n){Ba(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.componentDidMount=function(){this.triggerToolRender()},e.prototype.componentDidUpdate=function(){this.triggerToolRender()},e.prototype.getTools=function(){var t=this.props,r=t.tool,o=t.graphModel,i=o.textEditElement,a=r.getTools(),s=a.map(function(l){return Wn(l,{textEditElement:i,graphModel:o,lf:r.instance})});return r.components=s,s},e.prototype.triggerToolRender=function(){var t=this.props,r=t.tool,o=t.graphModel,i=document.querySelector("#ToolOverlay_".concat(o.flowId)),a=r.getInstance();a.components.forEach(function(s){return s(a,i)}),a.components=[]},e.prototype.render=function(){var t=this.props.graphModel;return x("div",{className:"lf-tool-overlay",id:"ToolOverlay_".concat(t.flowId),children:this.getTools()})},e=Xa([ot],e),e}(K),Pt=function(){return Pt=Object.assign||function(n){for(var e,t=1,r=arguments.length;t=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Ha=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},J=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},it=function(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;r=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},za=function(){function n(e){this.isShowHorizontal=!1,this.isShowVertical=!1,this.position={x:0,y:0},this.graphModel=e}return n.prototype.getStyle=function(){return Bt({},this.graphModel.theme.snapline)},n.prototype.getCenterSnapLine=function(e,t){for(var r=e.x,o=e.y,i=!1,a=!1,s=0;s=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Zt=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Ga={false:[-1/0,-1/0,1/0,1/0],true:[-1/0,-1/0,1/0,1/0],vertical:[-1/0,0,1/0,0],horizontal:[0,-1/0,0,1/0]},Fa=function(){function n(e,t){this.MINI_SCALE_SIZE=.2,this.MAX_SCALE_SIZE=16,this.SCALE_X=1,this.SKEW_Y=0,this.SKEW_X=0,this.SCALE_Y=1,this.TRANSLATE_X=0,this.TRANSLATE_Y=0,this.ZOOM_SIZE=.04,this.translateLimitMinX=-1/0,this.translateLimitMinY=-1/0,this.translateLimitMaxX=1/0,this.translateLimitMaxY=1/0,this.eventCenter=e;var r=t.stopMoveGraph,o=r===void 0?!1:r;this.updateTranslateLimits(o)}return n.prototype.setZoomMiniSize=function(e){this.MINI_SCALE_SIZE=e},n.prototype.setZoomMaxSize=function(e){this.MAX_SCALE_SIZE=e},n.prototype.HtmlPointToCanvasPoint=function(e){var t=Zt(e,2),r=t[0],o=t[1];return[(r-this.TRANSLATE_X)/this.SCALE_X,(o-this.TRANSLATE_Y)/this.SCALE_Y]},n.prototype.CanvasPointToHtmlPoint=function(e){var t=Zt(e,2),r=t[0],o=t[1];return[r*this.SCALE_X+this.TRANSLATE_X,o*this.SCALE_Y+this.TRANSLATE_Y]},n.prototype.moveCanvasPointByHtml=function(e,t,r){var o=Zt(e,2),i=o[0],a=o[1];return[i+t/this.SCALE_X,a+r/this.SCALE_Y]},n.prototype.fixDeltaXY=function(e,t){return[e/this.SCALE_X,t/this.SCALE_Y]},n.prototype.getTransformStyle=function(){var e=[this.SCALE_X,this.SKEW_Y,this.SKEW_X,this.SCALE_Y,this.TRANSLATE_X,this.TRANSLATE_Y].join(",");return{transform:"matrix(".concat(e,")")}},n.prototype.zoom=function(e,t){e===void 0&&(e=!1);var r=this.SCALE_X,o=this.SCALE_Y;return typeof e=="number"?(r=e,o=e):e?(r+=this.ZOOM_SIZE,o+=this.ZOOM_SIZE):(r-=this.ZOOM_SIZE,o-=this.ZOOM_SIZE),rthis.MAX_SCALE_SIZE?"".concat(this.SCALE_X*100,"%"):(t&&(this.TRANSLATE_X-=(r-this.SCALE_X)*t[0],this.TRANSLATE_Y-=(o-this.SCALE_Y)*t[1]),this.SCALE_X=r,this.SCALE_Y=o,this.emitGraphTransform("zoom"),"".concat(this.SCALE_X*100,"%"))},n.prototype.emitGraphTransform=function(e){this.eventCenter.emit(T.GRAPH_TRANSFORM,{type:e,transform:{SCALE_X:this.SCALE_X,SKEW_Y:this.SKEW_Y,SKEW_X:this.SKEW_X,SCALE_Y:this.SCALE_Y,TRANSLATE_X:this.TRANSLATE_X,TRANSLATE_Y:this.TRANSLATE_Y}})},n.prototype.resetZoom=function(){this.SCALE_X=1,this.SCALE_Y=1,this.emitGraphTransform("resetZoom")},n.prototype.translate=function(e,t){this.TRANSLATE_X+e<=this.translateLimitMaxX&&this.TRANSLATE_X+e>=this.translateLimitMinX&&(this.TRANSLATE_X+=e),this.TRANSLATE_Y+t<=this.translateLimitMaxY&&this.TRANSLATE_Y+t>=this.translateLimitMinY&&(this.TRANSLATE_Y+=t),this.emitGraphTransform("translate")},n.prototype.focusOn=function(e,t,r,o){var i=Zt(this.CanvasPointToHtmlPoint([e,t]),2),a=i[0],s=i[1],l=Zt([r/2-a,o/2-s],2),d=l[0],u=l[1];this.TRANSLATE_X+=d,this.TRANSLATE_Y+=u,this.emitGraphTransform("focusOn")},n.prototype.updateTranslateLimits=function(e){var t;t=Zt(Array.isArray(e)&&e.length===4?e:Ga[e.toString()],4),this.translateLimitMinX=t[0],this.translateLimitMinY=t[1],this.translateLimitMaxX=t[2],this.translateLimitMaxY=t[3]},ut([E],n.prototype,"SCALE_X",void 0),ut([E],n.prototype,"SKEW_Y",void 0),ut([E],n.prototype,"SKEW_X",void 0),ut([E],n.prototype,"SCALE_Y",void 0),ut([E],n.prototype,"TRANSLATE_X",void 0),ut([E],n.prototype,"TRANSLATE_Y",void 0),ut([E],n.prototype,"ZOOM_SIZE",void 0),ut([m],n.prototype,"zoom",null),ut([m],n.prototype,"resetZoom",null),ut([m],n.prototype,"translate",null),ut([m],n.prototype,"focusOn",null),n}(),$a=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Ua=function(n,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,r);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Wa=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Za=function(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;r0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Ja=function(n){Ka(e,n);function e(){var t=n.call(this)||this;return t.onDragStart=function(r){var o=r.event,i=t.props,a=i.anchorData,s=i.nodeModel,l=i.graphModel;l.selectNodeById(s.id),s.autoToFront&&l.toFront(s.id),l.eventCenter.emit(T.ANCHOR_DRAGSTART,{data:a,e:o,nodeModel:s}),t.setState({startX:a.x,startY:a.y,endX:a.x,endY:a.y})},t.onDragging=function(r){var o=r.event,i=t.props,a=i.graphModel,s=i.nodeModel,l=i.anchorData,d=a.transformModel,u=a.eventCenter,f=a.width,c=a.height,h=a.editConfigModel,y=h.autoExpand,p=h.stopMoveGraph;if(o){var g=o.clientX,v=o.clientY,_=a.getPointByClient({x:g,y:v}),M=_.domOverlayPosition,S=M.x,O=M.y,w=_.canvasOverlayPosition,A=w.x,b=w.y;t.t&&Ke(t.t);var R=[],L=10;S<10?R=[L,0]:S+10>f?R=[-10,0]:O<10?R=[0,L]:O+10>c&&(R=[0,-10]),t.setState({endX:A,endY:b,dragging:!0}),t.moveAnchorEnd(A,b),R.length>0&&!p&&y&&(t.t=io(function(){var z=qa(R,2),I=z[0],U=z[1];d.translate(I,U);var Y=t.state,Z=Y.endX,lt=Y.endY;t.setState({endX:Z-I,endY:lt-U}),t.moveAnchorEnd(Z-I,lt-U)})),u.emit(T.ANCHOR_DRAG,{data:l,e:o,nodeModel:s})}},t.onDragEnd=function(r){var o=r.event;t.t&&Ke(t.t);var i=t.checkEnd(o);t.setState({startX:0,startY:0,endX:0,endY:0,dragging:!1}),t.sourceRuleResults.clear(),t.targetRuleResults.clear();var a=t.props,s=a.graphModel,l=a.nodeModel,d=a.anchorData;s.eventCenter.emit(T.ANCHOR_DRAGEND,{data:d,e:o,nodeModel:l,edgeModel:i??void 0})},t.checkEnd=function(r){var o,i=t.props,a=i.graphModel,s=i.nodeModel,l=i.anchorData,d=l.x,u=l.y,f=l.id,c=t.state,h=c.endX,y=c.endY,p=c.dragging,g=Ze({x:h,y},a);if(t.preTargetNode&&t.preTargetNode.state!==X.DEFAULT&&t.preTargetNode.setElementState(X.DEFAULT),!!p&&g&&g.node){var v=g.node,_=g.anchor.id,M="".concat(s.id,"_").concat(v.id,"_").concat(_,"_").concat(f),S=t.sourceRuleResults.get(M)||{},O=S.isAllPass,w=S.msg,A=t.targetRuleResults.get(M)||{},b=A.isAllPass,R=A.msg;if(O&&b){v.setElementState(X.DEFAULT);var L=a.getNodeModelById(g.node.id),z=(o=a.edgeGenerator)===null||o===void 0?void 0:o.call(a,s.getData(),L==null?void 0:L.getData()),I=a.addEdge(_t(_t({},z),{sourceNodeId:s.id,sourceAnchorId:f,startPoint:{x:d,y:u},targetNodeId:g.node.id,targetAnchorId:g.anchor.id,endPoint:{x:g.anchor.x,y:g.anchor.y}})),U=t.props.anchorData;return a.eventCenter.emit(T.ANCHOR_DROP,{data:U,e:r,nodeModel:s,edgeModel:I}),I}var Y=v.getData();return a.eventCenter.emit(T.CONNECTION_NOT_ALLOWED,{data:Y,msg:R||w||"不允许添加连线"}),null}},t.sourceRuleResults=new Map,t.targetRuleResults=new Map,t.state={startX:0,startY:0,endX:0,endY:0,dragging:!1},t.dragHandler=new Mt({onDragStart:t.onDragStart,onDragging:t.onDragging,onDragEnd:t.onDragEnd}),t}return e.prototype.getAnchorShape=function(){var t=this.props,r=t.anchorData,o=t.style,i=t.node,a=i.getAnchorShape(r);if(a)return a;var s=r.x,l=r.y,d=_t(_t({},o),o==null?void 0:o.hover);return x("g",{children:[x(re,_t({className:"lf-node-anchor-hover"},d,{x:s,y:l})),x(re,_t({className:"lf-node-anchor"},o,{x:s,y:l}))]})},Object.defineProperty(e.prototype,"customTrajectory",{get:function(){var t=this.props.graphModel.customTrajectory;return t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"relateEdges",{get:function(){var t=this.props,r=t.graphModel,o=r.getAnchorIncomingEdge,i=r.getAnchorOutgoingEdge,a=t.anchorData.id;return{incomingEdgeList:o(a),outgoingEdgeList:i(a)}},enumerable:!1,configurable:!0}),e.prototype.moveAnchorEnd=function(t,r){var o,i,a=this.props,s=a.graphModel,l=a.nodeModel,d=a.anchorData,u=Ze({x:t,y:r},s);if(u){var f=u.node,c=u.anchor.id;if(this.preTargetNode&&this.preTargetNode!==u.node&&this.preTargetNode.setElementState(X.DEFAULT),d.id===c)return;this.preTargetNode=f;var h="".concat(l.id,"_").concat(f.id,"_").concat(c,"_").concat(d.id);if(!this.targetRuleResults.has(h)){var y=u.anchor,p=l.isAllowConnectedAsSource(f,d,y),g=f.isAllowConnectedAsTarget(l,d,y);this.sourceRuleResults.set(h,Ve(p)),this.targetRuleResults.set(h,Ve(g))}var v=((o=this.sourceRuleResults.get(h))!==null&&o!==void 0?o:{}).isAllPass,_=((i=this.targetRuleResults.get(h))!==null&&i!==void 0?i:{}).isAllPass;v&&_?f.setElementState(X.ALLOW_CONNECT):f.setElementState(X.NOT_ALLOW_CONNECT)}else this.preTargetNode&&this.preTargetNode.state!==X.DEFAULT&&this.preTargetNode.setElementState(X.DEFAULT)},e.prototype.isShowLine=function(){var t=this.state,r=t.startX,o=t.startY,i=t.endX,a=t.endY,s=vt(r,o,i,a);return s>10},e.prototype.render=function(){var t=this,r=this.state,o=r.startX,i=r.startY,a=r.endX,s=r.endY,l=this.props,d=l.anchorData.edgeAddable,u=l.edgeStyle;return x("g",{className:"lf-anchor",children:[x("g",{onMouseDown:function(f){d!==!1&&t.dragHandler.handleMouseDown(f)},children:this.getAnchorShape()}),this.isShowLine()&&(this.customTrajectory?this.customTrajectory(_t({sourcePoint:{x:o,y:i},targetPoint:{x:a,y:s}},u)):x(ee,_t({x1:o,y1:i,x2:a,y2:s},u,{"pointer-events":"none"})))]})},e}(K),Qa=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),br=function(){return br=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},co=function(n){es(e,n);function e(t){var r=n.call(this)||this;r.mouseDownHandler=function(i){var a=r.props,s=a.draggable,l=a.model,d=a.graphModel,u=d.editConfigModel.nodeTextDraggable;(s??u)&&(i.stopPropagation(),r.stepperDrag.model=l,r.stepperDrag.handleMouseDown(i))},r.onDragging=function(i){var a=i.deltaX,s=i.deltaY,l=r.props,d=l.model,u=l.graphModel.transformModel;if(a||s){var f=rs(u.fixDeltaXY(a,s),2),c=f[0],h=f[1];d.moveText(c,h)}},r.dbClickHandler=function(){var i=r.props,a=i.editable,s=i.graphModel.eventCenter,l=i.model;a&&l.setElementState(X.TEXT_EDIT),s.emit(T.TEXT_DBCLICK,{data:l.text,model:l})};var o=t.draggable;return r.stepperDrag=new Mt({onDragging:r.onDragging,step:1,eventType:"TEXT",isStopPropagation:o}),r}return e.prototype.getShape=function(){var t=this.props,r=t.model,o=t.graphModel,i=o.editConfigModel,a=r.text,s=a.value,l=a.x,d=a.y,u=a.editable,f=a.draggable,c={x:l,y:d,className:"",value:s},h=r.getTextStyle(),y=i.nodeTextDraggable||f;return x(ao,Cr({},c,h,{className:Do({"lf-element-text":u,"lf-text-draggable":!u&&y,"lf-text-disabled":!u&&!y}),model:r}))},e.prototype.render=function(){var t=this.props.model.text;if(t)return x("g",{onMouseDown:this.mouseDownHandler,onDblClick:this.dbClickHandler,children:this.getShape()})},e}(K),ns=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),ft=function(){return ft=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},os=function(n){ns(e,n);function e(t){var r=n.call(this,t)||this;return r.setHoverOn=function(){r.setState({isHovered:!0})},r.setHoverOff=function(){r.setState({isHovered:!1})},r.state={isHovered:!1},r}return e.prototype.getBackground=function(){var t=this.state.isHovered,r=this.props.model,o=r.text,i=r.getTextStyle(),a=i.background||{};if(t&&i.hover&&i.hover.background&&(a=ft(ft({},a),i.hover.background)),o!=null&&o.value&&(a==null?void 0:a.fill)!=="transparent"){var s=i.fontSize,l=i.textWidth,d=i.lineHeight,u=i.overflowMode,f=a.wrapPadding,c=o==null?void 0:o.value.split(/[\r\n]/g),h=c.length,y=o.x,p=o.y,g={};if(u==="autoWrap"&&l){var v=oo({rows:c,style:{fontSize:"".concat(s,"px"),width:"".concat(l,"px"),lineHeight:d,padding:f},rowsLength:h,className:"lf-get-text-height"});g=ft(ft({},a),{x:y,y:p,width:l,height:v})}else{var _=ii({rows:c,rowsLength:h,fontSize:s}),M=_.width,S=_.height;if(u==="ellipsis"&&(M=l,S=s+2),typeof a.wrapPadding=="string"){var O=a.wrapPadding.split(",").filter(function(nt){return nt.trim()}).map(function(nt){return parseFloat(nt.trim())});if(O.length>0&&O.length<=4){if(O.length===1){var w=Ye(O,1),A=w[0];O=[A,A,A,A]}else if(O.length===2){var b=Ye(O,2),R=b[0],L=b[1];O=[R,L,R,L]}else if(O.length===3){var z=Ye(O,3),I=z[0],L=z[1],U=z[2];O=[I,L,U,L]}var Y=Ye(O,4),Z=Y[0],lt=Y[1],jt=Y[2],Rt=Y[3];M+=lt+Rt,S+=Z+jt,y=y+(lt-Rt)/2,p=p+(jt-Z)/2}}g=ft(ft({},a),{x:y-1,y:p-1,width:M,height:S})}return x(Et,ft({},g))}return null},e.prototype.getShape=function(){var t=this.props.model,r=t.text,o=r.x,i=r.y,a=r.value;if(!a)return null;var s=t.getTextStyle(),l=ft({x:o,y:i,value:a,model:t,className:"lf-element-text"},s);return x("g",{className:"lf-line-text",onMouseEnter:this.setHoverOn,onMouseLeave:this.setHoverOff,children:[this.getBackground(),x(ao,ft({},l))]})},e}(co),is=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Je=function(){return Je=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Lt=function(n){is(e,n);function e(t){var r=n.call(this)||this;r.onDragStart=function(l){var d=l.event,u=r.props,f=u.model,c=u.graphModel;if(d){var h=c.getPointByClient({x:d.clientX,y:d.clientY}).canvasOverlayPosition,y=h.x,p=h.y;r.moveOffset={dx:f.x-y,dy:f.y-p}}},r.onDragging=function(l){var d,u,f,c,h=l.event,y=r.props,p=y.model,g=y.graphModel,v=g.editConfigModel,_=v.stopMoveGraph,M=v.autoExpand,S=v.snapGrid,O=g.transformModel,w=g.selectNodes,A=g.width,b=g.height,R=g.gridSize;p.isDragging=!0;var L=h,z=L.clientX,I=L.clientY,U=g.getPointByClient({x:z,y:I}).canvasOverlayPosition,Y=U.x,Z=U.y,lt=He(O.CanvasPointToHtmlPoint([Y,Z]),2),jt=lt[0],Rt=lt[1];if(Y=Y+((u=(d=r.moveOffset)===null||d===void 0?void 0:d.dx)!==null&&u!==void 0?u:0),Z=Z+((c=(f=r.moveOffset)===null||f===void 0?void 0:f.dy)!==null&&c!==void 0?c:0),Y=te(Y,R,S),Z=te(Z,R,S),!A||!b){g.moveNode2Coordinate(p.id,Y,Z);return}var nt=jt<0||Rt<0||jt>A||Rt>b;if(!(M&&!_&&nt)){var yt=He(O.CanvasPointToHtmlPoint([Y-p.width/2,Z-p.height/2]),2),ne=yt[0],ir=yt[1],Ae=He(O.CanvasPointToHtmlPoint([Y+p.width/2,Z+p.height/2]),2),ar=Ae[0],po=Ae[1],Pe=Math.max(R,20),zt=[];ne<0?zt=[Pe,0]:ar>g.width?zt=[-Pe,0]:ir<0?zt=[0,Pe]:po>g.height&&(zt=[0,-Pe]),r.t&&Ke(r.t),p.transform=new rr(-Y,-Z).rotate(p.rotate).translate(Y,Z).toString();var Te=w.map(function(De){return De.id});Te.indexOf(p.id)===-1&&(Te=[p.id]),zt.length>0&&!_&&M?r.t=io(function(){var De=He(zt,2),Gt=De[0],Ft=De[1];O.translate(Gt??0,Ft??0);var ho=-(Gt??0)/O.SCALE_X,vo=-(Ft??0)/O.SCALE_X;g.moveNodes(Te,ho,vo)}):g.moveNodes(Te,Y-p.x,Z-p.y)}},r.onDragEnd=function(){r.t&&Ke(r.t);var l=r.props.model;l.isDragging=!1},r.onMouseOut=function(l){Ro()&&r.setHoverOff(l)},r.handleMouseUp=function(){var l=r.props.model;r.mouseUpDrag=l.isDragging},r.handleClick=function(l){var d=r.mouseUpDrag===!1;if(r.startTime){var u=r.props,f=u.model,c=u.graphModel;if(d){var h=f.getData(),y=c.getPointByClient({x:l.clientX,y:l.clientY}),p={data:h,e:l,position:y,isSelected:!1,isMultiple:!1},g=l.button===2,v=l.detail===2;if(!g){var _=c.editConfigModel,M=ro(l,_);p.isMultiple=M,f.isSelected&&!v&&M?(p.isSelected=!1,f.setSelected(!1)):(c.selectNodeById(f.id,M),p.isSelected=!0,_.isSilentMode||r.toFront()),v?(_.nodeTextEdit&&f.text.editable&&_.textMode===st.TEXT&&(f.setSelected(!1),c.setElementStateById(f.id,X.TEXT_EDIT)),c.eventCenter.emit(T.NODE_DBCLICK,p)):(c.eventCenter.emit(T.ELEMENT_CLICK,p),c.eventCenter.emit(T.NODE_CLICK,p))}}}},r.handleContextMenu=function(l){l.preventDefault();var d=r.props,u=d.model,f=d.graphModel,c=f.editConfigModel,h=u.getData(),y=f.getPointByClient({x:l.clientX,y:l.clientY});f.setElementStateById(u.id,X.SHOW_MENU,y.domOverlayPosition),u.isSelected||f.selectNodeById(u.id),f.eventCenter.emit(T.NODE_CONTEXTMENU,{data:h,e:l,position:y}),c.isSilentMode||r.toFront()},r.handleMouseDown=function(l){var d=r.props,u=d.model,f=d.graphModel;r.startTime=new Date().getTime();var c=f.editConfigModel;c.adjustNodePosition&&u.draggable&&r.stepDrag&&r.stepDrag.handleMouseDown(l)},r.handleFocus=function(){var l=r.props,d=l.model,u=l.graphModel;u.eventCenter.emit(T.NODE_FOCUS,{data:d.getData()})},r.handleBlur=function(){var l=r.props,d=l.model,u=l.graphModel;u.eventCenter.emit(T.NODE_BLUR,{data:d.getData()})},r.setHoverOn=function(l){var d=r.props,u=d.model,f=d.graphModel;if(!u.isHovered){var c=u.getData();u.setHovered(!0),f.eventCenter.emit(T.NODE_MOUSEENTER,{data:c,e:l})}},r.setHoverOff=function(l){var d=r.props,u=d.model,f=d.graphModel,c=u.getData();u.isHovered&&(u.setHovered(!1),f.eventCenter.emit(T.NODE_MOUSELEAVE,{data:c,e:l}))};var o=t.graphModel,i=o.gridSize,a=o.eventCenter,s=t.model;return r.stepDrag=new Mt({onDragStart:r.onDragStart,onDragging:r.onDragging,onDragEnd:r.onDragEnd,step:i,eventType:"NODE",isStopPropagation:!1,eventCenter:a,model:s}),r.modelDisposer=Po(function(){return r.props},function(l){l&&l.model&&r.stepDrag.setModel(l.model)}),r}return e.prototype.componentWillUnmount=function(){this.modelDisposer&&this.modelDisposer(),this.render.$mobx&&this.render.$mobx.dispose()},e.prototype.componentDidMount=function(){},e.prototype.componentDidUpdate=function(){},e.prototype.getAnchorShape=function(t){return null},e.prototype.getAnchors=function(){var t=this,r=this.props,o=r.model,i=r.graphModel,a=o.isSelected,s=o.isHitable,l=o.isDragging,d=o.isShowAnchor;return s&&(a||d)&&!l?St(o.anchors,function(u,f){var c=o.getAnchorLineStyle(u),h=o.getAnchorStyle(u);return x(Ja,{anchorData:u,node:t,style:h,edgeStyle:c,anchorIndex:f,nodeModel:o,graphModel:i,setHoverOff:t.setHoverOff})}):[]},e.prototype.getRotateControl=function(){var t=this.props,r=t.model,o=t.graphModel,i=o.editConfigModel,a=i.isSilentMode,s=i.allowRotate,l=r.isSelected,d=r.isHitable,u=r.rotatable,f=r.isHovered,c=s&&u,h=r.getRotateControlStyle();if(!a&&d&&(l||f)&&c)return x(ts,{graphModel:o,nodeModel:r,eventCenter:o.eventCenter,style:h})},e.prototype.getResizeControl=function(){var t=this.props,r=t.model,o=t.graphModel,i=o.editConfigModel,a=i.isSilentMode,s=i.allowResize,l=r.isSelected,d=r.isHitable,u=r.resizable,f=r.isHovered,c=s&&u,h=r.getResizeControlStyle();return!a&&d&&(l||f)&&c?x(Ti,{style:h,model:r,graphModel:o}):null},e.prototype.getText=function(){var t,r=this.props,o=r.model,i=r.graphModel,a=i.editConfigModel;if(a.nodeTextMode!==st.TEXT||o.state===X.TEXT_EDIT)return null;if(o.text){var s=!1;return a.nodeTextDraggable&&o.text.draggable&&(s=!0),x(co,{editable:a.nodeTextEdit&&((t=o.text.editable)!==null&&t!==void 0?t:!0),model:o,graphModel:i,draggable:s})}return null},e.prototype.getStateClassName=function(){var t=this.props.model,r=t.state,o=t.isDragging,i=t.isSelected,a="lf-node";switch(r){case X.ALLOW_CONNECT:a+=" lf-node-allow";break;case X.NOT_ALLOW_CONNECT:a+=" lf-node-not-allow";break;default:a+=" lf-node-default";break}return o&&(a+=" lf-dragging"),i&&(a+=" lf-node-selected"),a},e.prototype.toFront=function(){var t=this.props,r=t.model,o=t.graphModel;r.autoToFront&&o.toFront(r.id)},e.prototype.render=function(){var t=this.props,r=t.model,o=t.graphModel,i=o.editConfigModel,a=i.hideAnchors,s=i.adjustNodePosition,l=i.allowRotate,d=i.allowResize,u=o.gridSize,f=o.transformModel.SCALE_X,c=r.isHitable,h=r.draggable,y=r.transform,p=r.getOuterGAttributes(),g=p.className,v=g===void 0?"":g,_=as(p,["className"]),M=x("g",{className:"lf-node-content",children:[x("g",{transform:y,children:[this.getShape(),this.getText(),l&&this.getRotateControl(),d&&this.getResizeControl()]}),!a&&this.getAnchors()]}),S;return c?(s&&h&&this.stepDrag.setStep(u*f),S=x("g",Je({className:"".concat(this.getStateClassName()," ").concat(v),onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onClick:this.handleClick,onMouseEnter:this.setHoverOn,onMouseOver:this.setHoverOn,onMouseLeave:this.setHoverOff,onMouseOut:this.onMouseOut,onContextMenu:this.handleContextMenu,onFocus:this.handleFocus,onBlur:this.handleBlur},_,{children:M}))):S=x("g",Je({className:"".concat(this.getStateClassName()," ").concat(v)},_,{children:M})),S},e.isObserved=!1,e}(K),ss=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Lr=function(){return Lr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},vs=function(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;r0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},xt;(function(n){n.SOURCE="SOURCE",n.TARGET="TARGET"})(xt||(xt={}));var kn=function(n){ys(e,n);function e(t){var r=n.call(this)||this;r.handleMouseDown=function(l){r.stepDrag&&r.stepDrag.handleMouseDown(l)},r.onDragStart=function(){var l=r.props,d=l.x,u=l.y,f=l.edgeModel,c=f.startPoint,h=f.endPoint,y=f.pointsList;r.oldEdge={startPoint:c,endPoint:h,pointsList:y},r.setState({endX:d,endY:u,dragging:!0})},r.onDragging=function(l){var d=l.deltaX,u=l.deltaY,f=r.state,c=f.endX,h=f.endY,y=r.props,p=y.graphModel,g=y.type,v=p.transformModel,_=p.editConfigModel,M=_s(v.moveCanvasPointByHtml([c,h],d,u),2),S=M[0],O=M[1];r.setState({endX:S,endY:O,dragging:!0});var w=r.props.edgeModel,A=Ze({x:c,y:h},p);if(A&&A.node&&r.isAllowAdjust(A).pass){var b=w.startPoint,R=w.endPoint,L=w.sourceNode,z=w.targetNode,I=g===xt.SOURCE?{startPoint:{x:A.anchor.x,y:A.anchor.y},endPoint:{x:R.x,y:R.y},sourceNode:A.node,targetNode:z}:{startPoint:{x:b.x,y:b.y},endPoint:{x:A.anchor.x,y:A.anchor.y},sourceNode:L,targetNode:A.node};w.updateAfterAdjustStartAndEnd(I)}else g===xt.SOURCE?w.updateStartPoint({x:S,y:O}):w.updateEndPoint({x:S,y:O});w.text.value&&_.adjustEdge&&w.setText(Object.assign({},w.text,w.textPosition))},r.onDragEnd=function(l){var d,u,f,c=l.event;try{r.setState({dragging:!1});var h=r.props,y=h.graphModel,p=h.edgeModel,g=h.type,v=r.state,_=v.endX,M=v.endY,S=v.dragging,O=Ze({x:_,y:M},y);if(!S)return;var w=!1,A=void 0;if(O&&O.node){var b=r.isAllowAdjust(O),R=b.pass,L=b.msg,z=b.newTargetNode;if(R){var I=p.getData(),U=I.text,Y=I.sourceAnchorId,Z=Y===void 0?"":Y,lt=I.targetAnchorId,jt=lt===void 0?"":lt,Rt=gs(I,["text","sourceAnchorId","targetAnchorId"]);if(A=ct(ct({sourceAnchorId:Z,targetAnchorId:jt},Rt),{text:(U==null?void 0:U.value)||""}),g===xt.SOURCE){var nt=y.getNodeModelById(O.node.id),yt=y.getNodeModelById(p.targetNodeId),ne=(d=y.edgeGenerator)===null||d===void 0?void 0:d.call(y,nt==null?void 0:nt.getData(),yt==null?void 0:yt.getData(),A);A=ct(ct({},ne),{sourceNodeId:O.node.id,sourceAnchorId:O.anchor.id,startPoint:{x:O.anchor.x,y:O.anchor.y},targetNodeId:p.targetNodeId,endPoint:ct({},p.endPoint)}),p.sourceNodeId===O.node.id&&p.sourceAnchorId===O.anchor.id&&(w=!0)}else if(g===xt.TARGET){var nt=y.getNodeModelById(p.sourceNodeId),yt=y.getNodeModelById(O.node.id),ne=(u=y.edgeGenerator)===null||u===void 0?void 0:u.call(y,nt==null?void 0:nt.getData(),yt==null?void 0:yt.getData(),A);A=ct(ct({},ne),{sourceNodeId:p.sourceNodeId,startPoint:ct({},p.startPoint),targetNodeId:O.node.id,targetAnchorId:O.anchor.id,endPoint:{x:O.anchor.x,y:O.anchor.y}}),p.targetNodeId===O.node.id&&p.targetAnchorId===O.anchor.id&&(w=!0)}}else{w=!0;var ir=z.getData();y.eventCenter.emit(T.CONNECTION_NOT_ALLOWED,{data:ir,msg:L})}}else w=!0;if(w)r.recoveryEdge();else{var Ae=p.getData();y.deleteEdgeById(p.id);var ar=y.addEdge(ct({},A));y.eventCenter.emit(T.EDGE_EXCHANGE_NODE,{data:{newEdge:ar.getData(),oldEdge:Ae}})}(f=r.preTargetNode)===null||f===void 0||f.setElementState(X.DEFAULT)}finally{var y=r.props.graphModel;y.eventCenter.emit(T.ADJUST_POINT_DRAGEND,{e:c,data:r.stepDragData})}},r.recoveryEdge=function(){var l=r.props.edgeModel,d=r.oldEdge,u=d.startPoint,f=d.endPoint,c=d.pointsList;l.updateStartPoint(u),l.updateEndPoint(f),l.modelType!==j.LINE_EDGE&&(l.pointsList=c??[],l.initPoints())},r.getAdjustPointStyle=function(){var l=r.props.graphModel.theme,d=l.edgeAdjust;return d},r.state={dragging:!1,endX:0,endY:0},r.targetRuleResults=new Map,r.sourceRuleResults=new Map;var o=t.type,i=t.edgeModel,a=t.graphModel,s=a.eventCenter;return r.stepDragData={type:o,edgeData:i.getData()},r.stepDrag=new Mt({onDragStart:r.onDragStart,onDragging:r.onDragging,onDragEnd:r.onDragEnd,eventType:"ADJUST_POINT",isStopPropagation:!1,eventCenter:s,data:r.stepDragData}),r}return e.prototype.isAllowAdjust=function(t){var r=this.props,o=r.edgeModel,i=o.id,a=o.sourceNode,s=o.targetNode,l=o.sourceAnchorId,d=o.targetAnchorId,u=r.type,f,c,h,y;if(u===xt.SOURCE?(f=t.node,c=s,h=t.anchor,y=s.getAnchorInfo(d)):(f=a,c=t.node,y=t.anchor,h=a.getAnchorInfo(l)),this.preTargetNode&&this.preTargetNode!==t.node&&this.preTargetNode.setElementState(X.DEFAULT),this.preTargetNode=t.node,y.id===h.id)return{pass:!1,msg:"",newTargetNode:c};var p="".concat(f.id,"_").concat(c.id,"_").concat(h.id,"_").concat(y.id);if(!this.targetRuleResults.has(p)){var g=f.isAllowConnectedAsSource(c,h,y,i),v=c.isAllowConnectedAsTarget(f,h,y,i);this.sourceRuleResults.set(p,Ve(g)),this.targetRuleResults.set(p,Ve(v))}var _=this.sourceRuleResults.get(p),M=_.isAllPass,S=_.msg,O=this.targetRuleResults.get(p),w=O.isAllPass,A=O.msg,b=M&&w?X.ALLOW_CONNECT:X.NOT_ALLOW_CONNECT;return u===xt.SOURCE?f.setElementState(b):c.setElementState(b),{pass:M&&w,msg:A||S,newTargetNode:c}},e.prototype.render=function(){var t=this.props,r=t.x,o=t.y,i=t.getAdjustPointShape,a=t.edgeModel,s=this.state.dragging;return x("g",{pointerEvents:s?"none":"",onMouseDown:this.handleMouseDown,children:s?"":i(r,o,a)})},e}(K),ms=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Xr=function(){return Xr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},or=function(n){xs(e,n);function e(){var t=n.call(this)||this;return t.textRef=Gr(),t.handleHover=function(r,o){var i=t.props,a=i.model,s=i.graphModel.eventCenter;a.setHovered(r);var l=r?T.EDGE_MOUSEENTER:T.EDGE_MOUSELEAVE,d=a.getData();s.emit(l,{data:d,e:o})},t.setHoverOn=function(r){var o=t.props.model.isHovered;o||(t.textRef&&t.textRef.current&&t.textRef.current.setHoverOn(),t.handleHover(!0,r))},t.setHoverOff=function(r){var o=t.props.model.isHovered;o&&(t.textRef&&t.textRef.current&&t.textRef.current.setHoverOff(),t.handleHover(!1,r))},t.handleContextMenu=function(r){r.preventDefault(),t.contextMenuTime=new Date().getTime(),t.clickTimer&&clearTimeout(t.clickTimer);var o=t.props,i=o.model,a=o.graphModel,s=a.editConfigModel,l=a.getPointByClient({x:r.clientX,y:r.clientY});a.setElementStateById(i.id,X.SHOW_MENU,l.domOverlayPosition),s.isSilentMode||t.toFront(),i.isSelected||a.selectEdgeById(i.id);var d=i==null?void 0:i.getData();a.eventCenter.emit(T.EDGE_CONTEXTMENU,{data:d,e:r,position:l})},t.handleMouseDown=function(r){r.stopPropagation(),t.startTime=new Date().getTime()},t.handleMouseUp=function(){var r=t.props.model;t.mouseUpDrag=r.isDragging},t.handleClick=function(r){if(t.startTime&&!t.mouseUpDrag){var o=r.button===2;if(!o){var i=r.detail===2,a=t.props,s=a.model,l=a.graphModel,d=s==null?void 0:s.getData(),u=l.getPointByClient({x:r.clientX,y:r.clientY});if(i){var f=l.editConfigModel,c=l.textEditElement,h=s.id,y=s.text,p=s.modelType;if(c&&c.id===h&&l.setElementStateById(h,X.DEFAULT),f.edgeTextEdit&&y.editable&&(s.setSelected(!1),l.setElementStateById(h,X.TEXT_EDIT)),p===j.POLYLINE_EDGE){var g=s,v=l.getPointByClient({x:r.x,y:r.y}).canvasOverlayPosition,_=v.x,M=v.y;g.dbClickPosition=eo({x:_,y:M},g.points)}l.eventCenter.emit(T.EDGE_DBCLICK,{data:d,e:r,position:u})}else l.eventCenter.emit(T.ELEMENT_CLICK,{data:d,e:r,position:u}),l.eventCenter.emit(T.EDGE_CLICK,{data:d,e:r,position:u});var S=l.editConfigModel;l.selectEdgeById(s.id,ro(r,S)),S.isSilentMode||t.toFront()}}},t.handleFocus=function(){var r=t.props,o=r.model,i=r.graphModel;i.eventCenter.emit(T.EDGE_FOCUS,{data:o.getData()})},t.handleBlur=function(){var r=t.props,o=r.model,i=r.graphModel;i.eventCenter.emit(T.EDGE_BLUR,{data:o.getData()})},t}return e.prototype.getShape=function(){return x("g",{children:this.getEdge()})},e.prototype.getTextStyle=function(){},e.prototype.getText=function(){var t,r=this.props,o=r.model,i=r.graphModel,a=i.editConfigModel;if(a.edgeTextMode!==st.TEXT||o.state===X.TEXT_EDIT)return null;if(o.text){var s=!1;return a.edgeTextDraggable&&o.text.draggable&&(s=!0),x(os,{ref:this.textRef,editable:a.edgeTextEdit&&((t=o.text.editable)!==null&&t!==void 0?t:!0),model:o,graphModel:i,draggable:s})}return null},e.prototype.getArrowInfo=function(){var t=this.props.model,r=t.startPoint,o=t.endPoint,i=t.isSelected,a=this.state.hover;return{start:r,end:o,hover:a,isSelected:i}},e.prototype.getLastTwoPoints=function(){var t=this.props.model,r=t.startPoint,o=t.endPoint;return[r,o]},e.prototype.getArrowStyle=function(){return console.error("getArrowStyle is deprecated in 1.2.0, please use model.getArrowStyle"),null},e.prototype.getArrow=function(){var t=this.props.model,r=t.id,o=t.getArrowStyle(),i=o.refY,a=i===void 0?0:i,s=o.refX,l=s===void 0?2:s,d=Es(this.getLastTwoPoints(),2),u=d[0],f=d[1],c="auto";return u!==null&&f!==null&&(c=$i(Fi({x:f.x-u.x,y:f.y-u.y}))),x("g",{children:x("defs",{children:[x("marker",{id:"marker-start-".concat(r),refX:-l,refY:a,overflow:"visible",orient:"auto",markerUnits:"userSpaceOnUse",children:this.getStartArrow()}),x("marker",{id:"marker-end-".concat(r),refX:l,refY:a,overflow:"visible",orient:c,markerUnits:"userSpaceOnUse",children:this.getEndArrow()})]})})},e.prototype.getStartArrow=function(){return x("path",{})},e.prototype.getEndArrow=function(){var t=this.props.model,r=t.getArrowStyle(),o=r.stroke,i=r.strokeWidth,a=r.offset,s=r.verticalLength;return x("path",{stroke:o,fill:o,strokeWidth:i,transform:"rotate(180)",d:"M 0 0 L ".concat(a," -").concat(s," L ").concat(a," ").concat(s," Z")})},e.prototype.getAdjustPointShape=function(t,r,o){var i=o.getAdjustPointStyle();return x(re,ge({className:"lf-edge-adjust-point"},i,{x:t,y:r}))},e.prototype.getAdjustPoints=function(){var t=this.props,r=t.model,o=t.graphModel,i=o.editConfigModel,a=i.adjustEdgeStartAndEnd,s=i.adjustEdgeStart,l=i.adjustEdgeEnd,d=r.getAdjustStart(),u=r.getAdjustEnd();return x("g",{children:[a&&s&&x(kn,ge({type:xt.SOURCE},d,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:r,graphModel:o})),a&&l&&x(kn,ge({type:xt.TARGET},u,{getAdjustPointShape:this.getAdjustPointShape,edgeModel:r,graphModel:o}))]})},e.prototype.getAnimation=function(){console.error("getAnimation is deprecated in 1.2.0, please use model.getEdgeAnimationStyle")},e.prototype.getAppendWidth=function(){return x("g",{})},e.prototype.getAppend=function(){return x("g",{className:"lf-edge-append",children:this.getAppendWidth()})},e.prototype.getEdge=function(){return null},e.prototype.toFront=function(){var t=this.props,r=t.graphModel,o=t.model;r.toFront(o.id)},e.prototype.render=function(){var t=this.props.model,r=t.isSelected,o=t.isHitable,i=t.isShowAdjustPoint;return x("g",{children:[x("g",{className:["lf-edge",!o&&"pointer-none",r&&"lf-edge-selected"].filter(Boolean).join(" "),onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onClick:this.handleClick,onContextMenu:this.handleContextMenu,onMouseOver:this.setHoverOn,onMouseEnter:this.setHoverOn,onMouseLeave:this.setHoverOff,onFocus:this.handleFocus,onBlur:this.handleBlur,children:[this.getShape(),this.getAppend(),this.getText(),this.getArrow()]}),i&&r?this.getAdjustPoints():""]})},e.isObserved=!1,e}(K),Ms=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Yr=function(){return Yr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},zn=function(n){Ms(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.getEdge=function(){var t=this.props.model,r=t.getEdgeStyle(),o=t,i=o.path,a=o.isAnimation,s=o.arrowConfig,l=t.getEdgeAnimationStyle(),d=l.strokeDasharray,u=l.stroke,f=l.strokeDashoffset,c=l.animationName,h=l.animationDuration,y=l.animationIterationCount,p=l.animationTimingFunction,g=l.animationDirection;return x(Oe,Yr({d:i},r,s,a?{strokeDasharray:d,stroke:u,style:{strokeDashoffset:f,animationName:c,animationDuration:h,animationIterationCount:y,animationTimingFunction:p,animationDirection:g}}:{}))},e.prototype.getAppendWidth=function(){var t=this.props.model.path;return x(Oe,{d:t,strokeWidth:10,stroke:"transparent",fill:"none"})},e.prototype.getArrowInfo=function(){var t=this.props.model,r=this.state.hover,o=t.isSelected,i=t.getArrowStyle().offset,a=t.pointsList.map(function(f){return{x:f.x,y:f.y}}),s=Os(un(a,i),2),l=s[0],d=s[1],u={start:l,end:d,hover:r,isSelected:o};return u},e.prototype.getLastTwoPoints=function(){var t=this.props.model,r=t.getArrowStyle().offset,o=t.pointsList.map(function(i){return{x:i.x,y:i.y}});return un(o,r)},e}(or),Ss=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Hr=function(){return Hr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Fn=function(n){ws(e,n);function e(){var t=n.call(this)||this;return t.onDragStart=function(){var r=t.props.model;r.dragAppendStart(),t.isShowAdjustPointTemp=r.isShowAdjustPoint,r.isShowAdjustPoint=!1},t.onDragging=function(r){var o=r.deltaX,i=r.deltaY,a=t.props,s=a.model,l=a.graphModel;t.isDragging=!0;var d=l.transformModel,u=l.editConfigModel,f=As(d.fixDeltaXY(o,i),2),c=f[0],h=f[1],y=s,p=u.adjustEdgeMiddle;p?t.appendInfo=y.dragAppendSimple(t.appendInfo,{x:c,y:h}):t.appendInfo=y.dragAppend(t.appendInfo,{x:c,y:h})},t.onDragEnd=function(){var r,o=t.props,i=o.model,a=o.graphModel.eventCenter,s=i;s.dragAppendEnd(),t.isDragging=!1,s.isShowAdjustPoint=(r=t.isShowAdjustPointTemp)!==null&&r!==void 0?r:!1,t.appendInfo=void 0,a.emit(T.EDGE_ADJUST,{data:s.getData()})},t.beforeDragStart=function(r,o){o.draggable&&t.drag.handleMouseDown(r),t.appendInfo=o},t.drag=new Mt({onDragStart:t.onDragStart,onDragging:t.onDragging,onDragEnd:t.onDragEnd,isStopPropagation:!1}),t}return e.prototype.getEdge=function(){var t=this.props.model,r=t.points,o=t.isAnimation,i=t.arrowConfig,a=t.getEdgeStyle(),s=t.getEdgeAnimationStyle(),l=s.strokeDasharray,d=s.stroke,u=s.strokeDashoffset,f=s.animationName,c=s.animationDuration,h=s.animationIterationCount,y=s.animationTimingFunction,p=s.animationDirection;return x(Si,Xt({points:r},a,i,o?{strokeDasharray:l,stroke:d,style:{strokeDashoffset:u,animationName:f,animationDuration:c,animationIterationCount:h,animationTimingFunction:y,animationDirection:p}}:{}))},e.prototype.getArrowInfo=function(){var t=this.props.model,r=t.points,o=t.isSelected,i=this.state.hover,a=kt(r),s=a[0],l=a[0];return a.length>=2&&(s=a[a.length-2],l=a[a.length-1]),{start:s,end:l,hover:i,isSelected:o}},e.prototype.getLastTwoPoints=function(){var t=this.props.model,r=t.points,o=kt(r),i=o[0],a=o[0];return o.length>=2&&(i=o[o.length-2],a=o[o.length-1]),[i,a]},e.prototype.getAppendAttributes=function(t){var r=t.start,o=t.end,i;if(r.x===o.x&&r.y===o.y)i="";else{var a={start:r,end:o,offset:10,verticalLength:5},s=xe(Xt(Xt({},a),{type:"start"})),l=xe(Xt(Xt({},a),{type:"end"}));i="M".concat(s.leftX," ").concat(s.leftY,` L`).concat(s.rightX," ").concat(s.rightY,` L`).concat(l.rightX," ").concat(l.rightY,` L`).concat(l.leftX," ").concat(l.leftY," z")}return{d:i,fill:"transparent",stroke:"transparent",strokeWidth:1,strokeDasharray:"4, 4"}},e.prototype.getAppendShape=function(t){var r=this.getAppendAttributes(t),o=r.d,i=r.strokeWidth,a=r.fill,s=r.strokeDasharray,l=r.stroke;return x(Oe,{d:o,fill:a,strokeWidth:i,stroke:l,strokeDasharray:s})},e.prototype.getAppendWidth=function(){for(var t=this,r=this.props,o=r.model,i=r.graphModel,a=o.pointsList,s=o.draggable,l=[],d=a.length,u=function(h){var y="lf-polyline-append",p={start:{x:a[h].x,y:a[h].y},end:{x:a[h+1].x,y:a[h+1].y},startIndex:h,endIndex:h+1,direction:G.HORIZONTAL,draggable:!0},g=x("g",{className:y,children:f.getAppendShape(p)}),v=i.editConfigModel,_=v.adjustEdge,M=v.adjustEdgeMiddle;if(_&&s){var S=p.startIndex,O=p.endIndex,w=M&&(S===0||O===d-1);p.draggable=!w,p.start.x===p.end.x?(p.draggable&&(y+="-ew-resize"),p.direction=G.VERTICAL):p.start.y===p.end.y&&(p.draggable&&(y+="-ns-resize"),p.direction=G.HORIZONTAL),g=x("g",{className:f.isDragging?"lf-dragging":"lf-drag-able",onMouseDown:function(A){return t.beforeDragStart(A,p)},children:x("g",{className:y,children:f.getAppendShape(p)})})}l.push(g)},f=this,c=0;c=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},bs=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Cs=function(n){Ds(e,n);function e(t){var r=n.call(this,t)||this;return r.ref=Gr(),r.__prevText={type:"",text:"",id:""},r.keyupHandler=function(o){var i=r.props.graphModel.textEditElement;o.key==="Enter"&&o.altKey&&(i==null||i.setElementState(X.DEFAULT))},r.inputHandler=function(o){var i=o.target.innerText,a=r.props.graphModel.textEditElement;a&&(r.__prevText={type:a.type,text:i.replace(/(\r\n)+$|(\n)+$/,""),id:a.id})},r.keydownHandler=function(o){o.stopPropagation()},r.state={style:{left:0,top:0}},r}return e.getDerivedStateFromProps=function(t){var r,o=t.textEditElement,i=t.graphModel,a=i.transformModel,s=i.theme,l=s.inputText,d;if(o){if(!(!((r=o.text)===null||r===void 0)&&r.value)&&o.BaseType===$.EDGE){var u=o.text,f=o.textPosition,c=f.x,h=f.y;u.x=c,u.y=h,o.setText(u)}var y={resize:"auto",whiteSpace:"normal",wordBreak:"break-all"};if(o.BaseType===$.EDGE){var p=s.edgeText,g=p.overflowMode,v=p.lineHeight,_=p.wrapPadding,M=p.textWidth;M&&g==="autoWrap"&&(d=Ot(Ot({},y),{width:M,minWidth:M,lineHeight:v,padding:_}))}else if(o.BaseType===$.NODE){var S=s.nodeText,g=S.overflowMode,v=S.lineHeight,_=S.wrapPadding,M=S.textWidth,O=o.width,w=o.modelType,A=o.textWidth,b=A||M||O;(w!==j.TEXT_NODE&&g==="autoWrap"||w===j.TEXT_NODE&&M)&&(d=Ot(Ot({},y),{width:b,minWidth:b,lineHeight:v,padding:_}))}var R=o.text,L=R.x,z=R.y,I=bs(a.CanvasPointToHtmlPoint([L,z]),2),U=I[0],Y=I[1];return{style:Ot(Ot({left:U,top:Y},d),l)}}return null},e.prototype.componentDidUpdate=function(){var t=this.props.graphModel;if(this.ref.current&&(this.ref.current.focus(),this.placeCaretAtEnd(this.ref.current)),this.__prevText.id!==""){var r=this.__prevText,o=r.text,i=r.id;t.updateText(i,o),t.eventCenter.emit(T.TEXT_UPDATE,{data:Ot({},this.__prevText)}),this.__prevText.id="",this.__prevText.text="",this.__prevText.type=""}},e.prototype.placeCaretAtEnd=function(t){if(window.getSelection!==void 0&&document.createRange!==void 0){var r=document.createRange();r.selectNodeContents(t),r.collapse(!1);var o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(r)}},e.prototype.render=function(){var t,r=this.props.graphModel.textEditElement,o=this.state.style;return r?x("div",{contentEditable:!0,className:"lf-text-input",style:o,ref:this.ref,onKeyUp:this.keyupHandler,onKeyDown:this.keydownHandler,onKeyPress:this.keydownHandler,onInput:this.inputHandler,children:(t=r.text)===null||t===void 0?void 0:t.value},r.id):null},e.toolName="text-edit-tool",e=Ns([ot],e),e}(K),Ls=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),js=function(n,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,r);else for(var s=n.length-1;s>=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},pr=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},Rs=function(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;r=0;s--)(a=n[s])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Bs=[Cs,Is],Xs=function(){function n(e){var t=this;this.toolMap=new Map,this.disabledToolMap=new Map,this.instance=e,W(Bs,function(i){t.isDisabled(i.toolName)||t.registerTool(i.toolName,i)});var r=e.graphModel,o=r.eventCenter;o.on("".concat(T.GRAPH_TRANSFORM,",").concat(T.NODE_CLICK,",").concat(T.BLANK_CLICK," "),function(){var i,a=r.textEditElement,s=r.editConfigModel,l=s.edgeTextEdit,d=s.nodeTextEdit;(l||d)&&a&&((i=r.textEditElement)===null||i===void 0||i.setElementState(X.DEFAULT))})}return n.prototype.isDisabled=function(e){var t;return((t=this.instance.options.disabledTools)===null||t===void 0?void 0:t.indexOf(e))!==-1},n.prototype.registerTool=function(e,t){this.toolMap.set(e,t)},n.prototype.disableTool=function(e){var t=this.toolMap.get(e);if(t)return this.disabledToolMap.set(e,t),this.toolMap.delete(e),!0;throw new Error("禁用失败,不存在名为 ${tool} 的工具")},n.prototype.enableTool=function(e){var t=this.disabledToolMap.get(e);if(t)return this.toolMap.set(e,t),this.disabledToolMap.delete(e),!0;throw new Error("不存在名为 ${tool} 的工具")},n.prototype.getTools=function(){return Array.from(this.toolMap.values())},n.prototype.getInstance=function(){return this.instance},n.prototype.destroy=function(){this.toolMap.clear(),this.disabledToolMap.clear()},hr([E],n.prototype,"toolMap",void 0),hr([m],n.prototype,"disableTool",null),hr([m],n.prototype,"enableTool",null),n}(),kr=function(){return kr=Object.assign||function(n){for(var e,t=1,r=arguments.length;tthis.maxSize&&this.undos.shift())},n.prototype.undoAble=function(){return this.undos.length>1},n.prototype.undo=function(){if(this.undoAble()){var e=this.undos.pop();this.redos.push(e);var t=this.undos.pop();return this.curData=C(t),t}},n.prototype.redoAble=function(){return this.redos.length>0},n.prototype.redo=function(){if(this.redoAble()){var e=this.redos.pop();return this.curData=C(e),e}},n.prototype.watch=function(e){var t=this;this.stopWatch&&this.stopWatch(),this.undos.push(e.modelToGraphData()),this.stopWatch=bo(e,Vn(function(){var r=e.modelToHistoryData();r&&t.add(kr({},r))},this.waitTime))},n.prototype.destroy=function(){this.undos=[],this.redos=[],this.curData=null,this.stopWatch&&this.stopWatch()},n}();var gt=null;function $n(n,e){return n.x+=e,n.y+=e,Kn(n.text)||(n.text.x+=e,n.text.y+=e),n}function Un(n,e){return n.startPoint&&(n.startPoint.x+=e,n.startPoint.y+=e),n.endPoint&&(n.endPoint.x+=e,n.endPoint.y+=e),n.pointsList&&n.pointsList.length>0&&n.pointsList.forEach(function(t){t.x+=e,t.y+=e}),Kn(n.text)||(n.text.x+=e,n.text.y+=e),n}var Vt=40,ke=40;function Hs(n,e){var t=n.keyboard,r=t.options.keyboard;t.on(["cmd + c","ctrl + c"],function(){if(ke=Vt,!(r!=null&&r.enabled)||e.textEditElement)return!0;var o=n.options.guards,i=e.getSelectElements(!1),a=o&&o.beforeClone?o.beforeClone(i):!0;return!a||i.nodes.length===0&&i.edges.length===0?(gt=null,!0):(gt=i,gt.nodes.forEach(function(s){return $n(s,Vt)}),gt.edges.forEach(function(s){return Un(s,Vt)}),!1)}),t.on(["cmd + v","ctrl + v"],function(){if(!(r!=null&&r.enabled)||e.textEditElement)return!0;if(gt&&(gt.nodes||gt.edges)){n.clearSelectElements();var o=n.addElements(gt,ke);if(!o)return!0;o.nodes.forEach(function(i){return n.selectElementById(i.id,!0)}),o.edges.forEach(function(i){return n.selectElementById(i.id,!0)}),gt.nodes.forEach(function(i){return $n(i,Vt)}),gt.edges.forEach(function(i){return Un(i,Vt)}),ke=ke+Vt}return!1}),t.on(["cmd + z","ctrl + z"],function(){return!(r!=null&&r.enabled)||e.textEditElement?!0:(n.undo(),!1)}),t.on(["cmd + y","ctrl + y"],function(){return!(r!=null&&r.enabled)||e.textEditElement?!0:(n.redo(),!1)}),t.on(["backspace"],function(){if(!(r!=null&&r.enabled)||e.textEditElement)return!0;var o=e.getSelectElements(!0);return n.clearSelectElements(),o.edges.forEach(function(i){return i.id&&n.deleteEdge(i.id)}),o.nodes.forEach(function(i){return i.id&&n.deleteNode(i.id)}),!1})}var ks=function(){function n(e){e.keyboard||(e.keyboard={enabled:!1}),this.options=e;var t=e.lf;this.target=t.container,this.mousetrap=new No(this.target),e.keyboard.enabled&&!t.options.isSilentMode&&this.enable(!0)}return n.prototype.initShortcuts=function(){var e=this,t,r=((t=this.options.keyboard)!==null&&t!==void 0?t:{}).shortcuts;if(r)if(Oo(r))r.forEach(function(s){var l=s.keys,d=s.callback,u=s.action;return e.on(l,d,u)});else{var o=r.keys,i=r.callback,a=r.action;this.on(o,i,a)}},n.prototype.on=function(e,t,r){this.mousetrap.bind(this.getKeys(e),t,r)},Object.defineProperty(n.prototype,"disabled",{get:function(){var e,t;return((t=(e=this.options)===null||e===void 0?void 0:e.keyboard)===null||t===void 0?void 0:t.enabled)!==!0},enumerable:!1,configurable:!0}),n.prototype.off=function(e,t){this.mousetrap.unbind(this.getKeys(e),t)},n.prototype.enable=function(e){(this.disabled||e)&&(this.options.keyboard&&(this.options.keyboard.enabled=!0),this.target instanceof HTMLElement&&(this.target.setAttribute("tabindex","-1"),this.target.style.outline="none"))},n.prototype.disable=function(){this.disabled||(this.options.keyboard&&(this.options.keyboard.enabled=!1),this.target instanceof HTMLElement&&this.target.removeAttribute("tabindex"))},n.prototype.destroy=function(){this.mousetrap.reset()},n.prototype.getKeys=function(e){var t=this;return(Array.isArray(e)?e:[e]).map(function(r){return t.formatKey(r)})},n.prototype.formatKey=function(e){return e.toLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command")},n}(),Tt=function(){return Tt=Object.assign||function(n){for(var e,t=1,r=arguments.length;t0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i},vr=function(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;r