@next-bricks/diagram 0.34.7 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bricks.json +3 -3
- package/dist/chunks/2440.39d44dc0.js +2 -0
- package/dist/chunks/2440.39d44dc0.js.map +1 -0
- package/dist/chunks/4937.2424a99b.js +3 -0
- package/dist/chunks/4937.2424a99b.js.map +1 -0
- package/dist/chunks/eo-display-canvas.2df8cf09.js +2 -0
- package/dist/chunks/eo-display-canvas.2df8cf09.js.map +1 -0
- package/dist/chunks/eo-draw-canvas.5dd909c2.js +2 -0
- package/dist/chunks/eo-draw-canvas.5dd909c2.js.map +1 -0
- package/dist/chunks/{main.81fec9b8.js → main.62361111.js} +2 -2
- package/dist/chunks/{main.81fec9b8.js.map → main.62361111.js.map} +1 -1
- package/dist/examples.json +5 -5
- package/dist/index.f01848d6.js +2 -0
- package/dist/{index.9a09558d.js.map → index.f01848d6.js.map} +1 -1
- package/dist/manifest.json +117 -100
- package/dist/types.json +2763 -2580
- package/dist-types/draw-canvas/CellComponent.d.ts +4 -4
- package/dist-types/draw-canvas/decorators/DecoratorArea.d.ts +1 -1
- package/dist-types/draw-canvas/decorators/index.d.ts +1 -1
- package/dist-types/draw-canvas/index.d.ts +7 -2
- package/dist-types/draw-canvas/interfaces.d.ts +11 -4
- package/dist-types/draw-canvas/processors/asserts.d.ts +1 -0
- package/dist-types/draw-canvas/processors/cellToTarget.d.ts +2 -2
- package/dist-types/draw-canvas/processors/findNodeOrAreaDecorator.d.ts +2 -0
- package/dist-types/draw-canvas/processors/getUnrelatedCells.d.ts +1 -1
- package/dist-types/draw-canvas/processors/handleKeyboard.d.ts +4 -4
- package/dist-types/draw-canvas/processors/handleLasso.d.ts +9 -0
- package/dist-types/draw-canvas/processors/handleLasso.spec.d.ts +1 -0
- package/dist-types/draw-canvas/processors/handleMouseDown.d.ts +5 -3
- package/dist-types/draw-canvas/processors/targetIsActive.d.ts +2 -0
- package/dist-types/draw-canvas/reducers/interfaces.d.ts +4 -4
- package/docs/eo-draw-canvas.md +15 -10
- package/package.json +2 -2
- package/dist/chunks/5030.6f1895e1.js +0 -2
- package/dist/chunks/5030.6f1895e1.js.map +0 -1
- package/dist/chunks/9074.5793d8db.js +0 -3
- package/dist/chunks/9074.5793d8db.js.map +0 -1
- package/dist/chunks/eo-display-canvas.e13c2deb.js +0 -2
- package/dist/chunks/eo-display-canvas.e13c2deb.js.map +0 -1
- package/dist/chunks/eo-draw-canvas.4b7d730e.js +0 -2
- package/dist/chunks/eo-draw-canvas.4b7d730e.js.map +0 -1
- package/dist/index.9a09558d.js +0 -2
- /package/dist/chunks/{9074.5793d8db.js.LICENSE.txt → 4937.2424a99b.js.LICENSE.txt} +0 -0
package/dist/bricks.json
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
],
|
|
7
7
|
"elements": [
|
|
8
8
|
"eo-diagram",
|
|
9
|
-
"eo-
|
|
10
|
-
"eo-
|
|
9
|
+
"eo-display-canvas",
|
|
10
|
+
"eo-draw-canvas"
|
|
11
11
|
],
|
|
12
12
|
"processors": [],
|
|
13
13
|
"dependencies": {
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"basic.lock-body-scroll"
|
|
16
16
|
]
|
|
17
17
|
},
|
|
18
|
-
"filePath": "bricks/diagram/dist/index.
|
|
18
|
+
"filePath": "bricks/diagram/dist/index.f01848d6.js"
|
|
19
19
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_next_bricks_diagram=self.webpackChunk_next_bricks_diagram||[]).push([[2440],{3739:(e,t,r)=>{r.d(t,{c:()=>o});var a=r(8769),n=r.n(a);function o(e){var t,{id:r,type:a,strokeColor:o}=e;switch(a){case"0..1":t=l;break;case"0..N":t=d;break;default:t=i}return n().createElement(t,{id:r,strokeColor:o})}function i(e){var{id:t,strokeColor:r}=e;return n().createElement("marker",{id:t,viewBox:"0 0 6 6",refX:5,refY:3,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",strokeLinejoin:"round"},n().createElement("path",{d:"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z",stroke:r,strokeWidth:1,fill:r}))}function l(e){var{id:t,strokeColor:r}=e;return n().createElement("marker",{id:t,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},n().createElement("path",{d:"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5",stroke:r,strokeWidth:1,fill:"none"}))}function d(e){var{id:t,strokeColor:r}=e;return n().createElement("marker",{id:t,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},n().createElement("path",{d:"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5",stroke:r,strokeWidth:1,fill:"none"}))}},3188:(e,t,r)=>{r.d(t,{h:()=>n});var a=r(733);function n(e,t,r){if(e===t||(0,a.w)(e,t,0,0))return null;var n,i,l=0,d=0;if(r){var s=t.x-e.x,c=t.y-e.y,u=Math.atan2(c,s);l=r/2*Math.cos(u+Math.PI/2),d=r/2*Math.sin(u+Math.PI/2)}var v=[[e.x+l,e.y+d],[t.x+l,t.y+d]],h=o(e,v),f=o(t,v);return n=h.length>0?h[0]:[e.x,e.y],i=f.length>0?f[0]:[t.x,t.y],[{x:n[0],y:n[1]},{x:i[0],y:i[1]}]}function o(e,t){for(var r=[[e.x-e.width/2,e.y-e.height/2],[e.x+e.width/2,e.y-e.height/2],[e.x+e.width/2,e.y+e.height/2],[e.x-e.width/2,e.y+e.height/2]],a=[],n=0;n<4;n++)a.push([r[n],r[(n+1)%4]]);var o=[];for(var l of a){var d=i(t[0],t[1],l[0],l[1]);d&&o.push(d)}return o}function i(e,t,r,a){var[n,o]=e,[i,l]=t,[d,s]=r,[c,u]=a;if(n===i&&o===l||d===c&&s===u)return null;var v=(u-s)*(i-n)-(c-d)*(l-o);if(0===v)return null;var h=((c-d)*(o-s)-(u-s)*(n-d))/v,f=((i-n)*(o-s)-(l-o)*(n-d))/v;return h<0||h>1||f<0||f>1?null:[n+h*(i-n),o+h*(l-o)]}},733:(e,t,r)=>{function a(e,t,r,a){var o=r?n(e,r):e,i=a?n(t,a):t,l=Math.min(o.x-o.width/2,i.x-i.width/2),d=Math.max(o.x+o.width/2,i.x+i.width/2),s=Math.min(o.y-o.height/2,i.y-i.height/2),c=Math.max(o.y+o.height/2,i.y+i.height/2);return d-l<o.width+i.width&&c-s<o.height+i.height}function n(e,t){return{x:e.x-e.width/2-t,y:e.y-e.height/2-t,width:e.width+2*t,height:e.height+2*t}}r.d(t,{w:()=>a})},8802:(e,t,r)=>{function a(e){if(Array.isArray(e)){var t=e[0],r=e.length>1?e[1]:t;return[t,r,e.length>2?e[2]:t,e.length>3?e[3]:r]}return new Array(4).fill(e)}r.d(t,{D:()=>a})},908:(e,t,r)=>{r.d(t,{m:()=>A});var a=r(8769),n=r.n(a),o=r(3373),i=r.n(o),l=r(531),d=r(3188),s=r(3033);function c(e,t){return e.find((e=>(0,l.o6)(e)&&e.id===t))}function u(e){var t,r,o,{edge:u,cells:h,lineConfMap:f}=e,g=(0,a.useRef)(null),m=(0,a.useMemo)((()=>c(h,u.source)),[h,u.source]),p=(0,a.useMemo)((()=>c(h,u.target)),[h,u.target]),w=(0,a.useMemo)((()=>f.get(u)),[u,f]),y=(0,a.useMemo)((()=>h.some((e=>(0,l.WW)(e)&&e.source===u.target&&e.target===u.source))?w.parallelGap:0),[h,u,w.parallelGap]),x=(0,a.useMemo)((()=>m&&p&&null!=m.view.x&&null!=p.view.x?(0,d.h)(v(m.view,5),v(p.view,5),y):null),[y,m,p]);if(!x)return null;var k="M".concat(x[0].x," ").concat(x[0].y,"L").concat(x[1].x," ").concat(x[1].y);return n().createElement(n().Fragment,null,n().createElement("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:w.interactStrokeWidth}),n().createElement("path",{ref:g,className:i()("line",{dashed:w.dashed,["".concat(w.dashed?"dashed":"solid","-animation")]:w.animate.useAnimate}),style:{"--time":"".concat(null!==(t=w.animate.duration)&&void 0!==t?t:s.Be,"s"),"--solid-length":null===(r=g.current)||void 0===r||null===(o=r.getTotalLength)||void 0===o?void 0:o.call(r)},d:k,fill:"none",stroke:w.strokeColor,strokeWidth:w.strokeWidth,markerStart:w.showStartArrow?w.markerArrow:"",markerEnd:w.showEndArrow?w.markerArrow:""}),n().createElement("path",{className:"line-active-bg",d:k,fill:"none"}))}function v(e,t){return{x:e.x+e.width/2,y:e.y+e.height/2,width:e.width+t,height:e.height+t}}var h=r(7382),f=r(9924),g=r(1030),m=r(9126);function p(e){var{node:t,degraded:r,degradedNodeLabel:o,defaultNodeBricks:i,onResize:l}=e,d=function(e){var[t,r]=(0,a.useState)(e);return(0,a.useEffect)((()=>{r((t=>(0,g.isEqual)(t,e)?t:e))}),[e]),t}({node:{id:t.id,data:t.data}}),s=t.useBrick,c=(0,a.useRef)(null),u=(0,a.useMemo)((()=>{var e;return r?null:null!=s?s:null==i||null===(e=i.find((e=>(0,f.checkIfByTransform)(e,d))))||void 0===e?void 0:e.useBrick}),[r,s,i,d]),v=(0,a.useMemo)((()=>r?String(f.__secret_internals.legacyDoTransform(d,null!=o?o:"<% DATA.node.id %>")):""),[r,o,d]),p=(0,a.useCallback)((e=>{var r=c.current;r&&(r.disconnect(),c.current=null),e?setTimeout((()=>{var r=new m.A((()=>{l(t.id,[e.offsetWidth,e.offsetHeight])}));r.observe(e),c.current=r})):l(t.id,null)}),[t.id,l]),w=(0,a.useCallback)((e=>{if(e){var r=e.getBBox();l(t.id,[r.width,r.height])}else l(t.id,null)}),[t.id,l]);return u?n().createElement("foreignObject",{width:9999,height:9999,className:"node"},u&&n().createElement(h.ReactUseBrick,{useBrick:u,data:d,refCallback:p})):r?n().createElement("g",{className:"degraded",ref:w},n().createElement("circle",{cx:8,cy:8,r:8}),n().createElement("text",{x:8,y:32},v)):null}var w=r(9386),y=r(4197);function x(e,t){var{action:r,cell:a,scale:n,layout:o,activeTarget:i,cells:d,onCellsMoving:s,onCellsMoved:c,onCellResizing:u,onCellResized:v,onSwitchActiveTarget:h}=t;e.stopPropagation(),"resize"!==r&&(0,y.Q)(a,i)||null==h||h((0,w.P)(a));var f="force"===o||"dagre"===o;if(!(0,l.WW)(a)){var g=("multi"===(null==i?void 0:i.type)&&"move"===r?d.filter((e=>(0,y.Q)(e,i))):[a]).filter((e=>(0,l.N)(e)&&!f||(0,l.mH)(e)));if(0!==g.length){var m=[e.clientX,e.clientY],p=g.map((e=>({cell:e,position:"move"===r?[e.view.x,e.view.y]:[e.view.width,e.view.height]}))),x=!1,k=(e,t)=>{var o=function(e){return[(e.clientX-m[0])/n,(e.clientY-m[1])/n]}(e);if(x||(x=o[0]**2+o[1]**2>=9),x)if("move"===r){var i,l=p.map((e=>{var{cell:t,position:r}=e;return{type:t.type,id:t.id,x:r[0]+o[0],y:r[1]+o[1]}}));null===(i=t?c:s)||void 0===i||i(l)}else{var d;null===(d=t?v:u)||void 0===d||d({type:a.type,id:a.id,width:p[0].position[0]+o[0],height:p[0].position[1]+o[1]})}},b=e=>{k(e)},C=e=>{k(e,!0),x=!1,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",C)};document.addEventListener("mousemove",b),document.addEventListener("mouseup",C)}}}function k(e){var{cell:t,transform:r,readOnly:o,activeTarget:i,cells:l,onCellResizing:d,onCellResized:s,onSwitchActiveTarget:c}=e,u=n().useRef(null);return(0,a.useEffect)((()=>{var e=u.current;if(e&&!o){var a=e=>{x(e,{action:"resize",cell:t,scale:r.k,activeTarget:i,cells:l,onCellResizing:d,onCellResized:s,onSwitchActiveTarget:c})};return e.addEventListener("mousedown",a),()=>{e.removeEventListener("mousedown",a)}}}),[i,t,l,s,d,c,o,r.k]),n().createElement("g",{className:"decorator-area"},n().createElement("rect",{width:t.view.width,height:t.view.height,className:"area"}),!o&&n().createElement("g",{ref:u,className:"resize-handle",transform:"translate(".concat(t.view.width-20," ").concat(t.view.height-20,")")},n().createElement("rect",{width:20,height:20}),n().createElement("path",{d:"M10 18L18 10 M15 18L18 15"})))}var b=r(9740);function C(e){var t,{cell:r,readOnly:o,onDecoratorTextEditing:l,onDecoratorTextChange:d}=e,s=null!==(t=r.view.text)&&void 0!==t?t:"",[c,u]=(0,a.useState)(s),[v,h]=(0,a.useState)(!1),f=(0,a.useRef)(!1),[g,m]=(0,a.useState)(!1),p=(0,a.useRef)(null),w=(0,a.useCallback)((e=>{o||(e.preventDefault(),e.stopPropagation(),h(!0))}),[o]);(0,a.useEffect)((()=>{var e=p.current;e&&e.textContent!==c&&(e.textContent=c)}),[c]),(0,a.useEffect)((()=>{v&&p.current&&(p.current.focus(),function(e){var t=document.createRange();t.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(t)}(p.current)),null==l||l({id:r.id,editing:v})}),[r.id,v,l]),(0,a.useEffect)((()=>{f.current?null==l||l({id:r.id,editing:v}):f.current=!0}),[r.id,v,l]);var y=(0,a.useCallback)((e=>{o||u(e.target.textContent)}),[o]),x=(0,a.useCallback)((()=>{o||(h(!1),m(!0))}),[o]);return(0,a.useEffect)((()=>{g&&(null==d||d({id:r.id,view:(0,b.A)((0,b.A)({},r.view),{},{text:c})}),m(!1))}),[r,c,d,g]),n().createElement("foreignObject",{className:"decorator-text"},n().createElement("div",{className:i()("text-container",{editing:v}),onDoubleClick:w},n().createElement("div",{className:"text",contentEditable:v,ref:p,onInput:y,onBlur:x})))}function E(e){var t,{cell:r,transform:a,readOnly:o,activeTarget:i,cells:l,onCellResizing:d,onCellResized:s,onSwitchActiveTarget:c,onDecoratorTextEditing:u,onDecoratorTextChange:v}=e;switch(r.decorator){case"area":t=k;break;case"text":t=C;break;default:return console.error("Unknown decorator: ".concat(r.decorator)),null}return n().createElement(t,{cell:r,transform:a,readOnly:o,activeTarget:i,cells:l,onCellResizing:d,onCellResized:s,onSwitchActiveTarget:c,onDecoratorTextEditing:u,onDecoratorTextChange:v})}var z=r(8185);function A(e){var{layout:t,cell:r,cells:o,degraded:d,degradedNodeLabel:s,defaultNodeBricks:c,lineConfMap:v,activeTarget:h,readOnly:f,transform:g,unrelatedCells:m,onCellsMoving:k,onCellsMoved:b,onCellResizing:C,onCellResized:A,onSwitchActiveTarget:M,onCellContextMenu:N,onCellClick:R,onDecoratorTextEditing:S,onDecoratorTextChange:T,onNodeBrickResize:W,onCellMouseEnter:L,onCellMouseLeave:D}=e,P=(0,a.useRef)(null),B=(0,a.useMemo)((()=>m.some((e=>(0,z.c)(e,r)))),[r,m]);(0,a.useEffect)((()=>{var e=P.current;if(e){var a=e=>{f?e.stopPropagation():x(e,{layout:t,action:"move",cell:r,scale:g.k,activeTarget:h,cells:o,onCellsMoving:k,onCellsMoved:b,onSwitchActiveTarget:M})};return e.addEventListener("mousedown",a),()=>{e.removeEventListener("mousedown",a)}}}),[t,r,h,o,b,k,M,f,g.k]);var V=(0,a.useCallback)((e=>{f&&"decorator"===r.type||(e.preventDefault(),M((0,w.P)(r)),N({cell:r,clientX:e.clientX,clientY:e.clientY}))}),[r,N,M,f]),H=(0,a.useCallback)((e=>{R&&"decorator"!==r.type&&R({cell:r,clientX:e.clientX,clientY:e.clientY})}),[r,R]),O=(0,a.useCallback)((()=>{null==L||L(r)}),[r,L]),I=(0,a.useCallback)((()=>{null==D||D(r)}),[r,D]);return n().createElement("g",{className:i()("cell",{active:(0,y.Q)(r,h),faded:B,"read-only":f}),ref:P,transform:"edge"===r.type||null==r.view.x?void 0:"translate(".concat(r.view.x," ").concat(r.view.y,")"),onContextMenu:V,onClick:H,onMouseEnter:O,onMouseLeave:I},(0,l.N)(r)?n().createElement(p,{node:r,degraded:d,degradedNodeLabel:s,defaultNodeBricks:c,onResize:W}):(0,l.WW)(r)?n().createElement(u,{edge:r,cells:o,lineConfMap:v}):(0,l.mH)(r)?n().createElement(E,{cell:r,transform:g,readOnly:f,activeTarget:h,cells:o,onCellResizing:C,onCellResized:A,onSwitchActiveTarget:M,onDecoratorTextEditing:S,onDecoratorTextChange:T}):null)}},3033:(e,t,r)=>{r.d(t,{Be:()=>m,CV:()=>a,HP:()=>o,Ie:()=>h,N8:()=>l,Ub:()=>g,VO:()=>v,XV:()=>f,Yt:()=>c,mF:()=>u,pC:()=>p,sS:()=>s,sz:()=>i,w1:()=>d,xc:()=>n});var a=Symbol.for("size-initialized"),n=Symbol.for("layout-initialized"),o=20,i=36,l=100,d=60,s=.5,c=2,u="gray",v=1,h=15,f=!1,g=!0,m=1,p=500},531:(e,t,r)=>{function a(e){return"node"===e.type}function n(e){return"decorator"===e.type}function o(e){return"node"===e.type}function i(e){return"edge"===e.type}function l(e){return"node"===e.type||"edge"===e.type}function d(e){return"node"===e.type||"decorator"===e.type&&"area"===e.decorator}r.d(t,{N:()=>a,WW:()=>i,mH:()=>n,nv:()=>l,o6:()=>d,vC:()=>o})},9386:(e,t,r)=>{r.d(t,{P:()=>n});var a=r(1030);function n(e){return"edge"===e.type?(0,a.pick)(e,["type","source","target","data"]):(0,a.pick)(e,["type","id","data"])}},227:(e,t,r)=>{r.d(t,{Y:()=>n});var a=r(4197);function n(e,t,r,n){var o=[];if(t){var i=new Set;for(var l of e)"edge"===l.type&&l.source===t.source.id&&i.add(l.target);for(var d of e)switch(d.type){case"node":i.has(d.id)&&o.push(d);break;case"decorator":n&&"text"!=d.decorator&&!i.has(d.id)||o.push(d);break;default:o.push(d)}}else switch(null==r?void 0:r.type){case"multi":var s=new Map,c=new Set,u=new Set;for(var v of r.targets)"node"===v.type&&(c.add(v.id),u.add(v.id));for(var h of e)"node"===h.type?s.set(h.id,h):"edge"===h.type?c.has(h.source)?u.add(h.target):c.has(h.target)?u.add(h.source):(0,a.Q)(h,r)||o.push(h):(0,a.Q)(h,r)||o.push(h);for(var[f,g]of s)u.has(f)||o.push(g);break;case"node":var m=new Map,p=new Set([r.id]);for(var w of e)"node"===w.type?m.set(w.id,w):"edge"===w.type?w.source===r.id?p.add(w.target):w.target===r.id?p.add(w.source):o.push(w):o.push(w);for(var[y,x]of m)p.has(y)||o.push(x);break;case"edge":for(var k of e)("edge"===k.type?(0,a.Q)(k,r):"node"===k.type&&(k.id===r.source||k.id===r.target))||o.push(k)}return o}},3783:(e,t,r)=>{r.d(t,{C:()=>o});var a=r(9740),n=r(531);function o(e,t){var{defaultNodeSize:r}=t;return(null!=e?e:[]).map((e=>{var t,o;return!(0,n.vC)(e)||void 0!==(null===(t=e.view)||void 0===t?void 0:t.width)&&void 0!==(null===(o=e.view)||void 0===o?void 0:o.height)?e:(0,a.A)((0,a.A)({},e),{},{view:(0,a.A)({width:r[0],height:r[1]},e.view)})}))}},8185:(e,t,r)=>{function a(e,t){return e?!!t&&e.type===t.type&&("multi"===e.type?e.targets.length===t.targets.length&&e.targets.every((e=>t.targets.some((t=>a(e,t))))):"node"===e.type||"decorator"===e.type?e.id===t.id:e.source===t.source&&e.target===t.target):!t}r.d(t,{c:()=>a})},4197:(e,t,r)=>{r.d(t,{Q:()=>n});var a=r(8185);function n(e,t){return!!t&&("multi"===t.type?t.targets:[t]).some((t=>(0,a.c)(t,e)))}},8527:(e,t,r)=>{r.d(t,{r:()=>n});var a=r(531);function n(e,t){var{canvasWidth:r,canvasHeight:n,scaleRange:o}=t,i=1/0,l=1/0,d=-1/0,s=-1/0,c=!0;for(var u of e)if(!(0,a.WW)(u)){c=!1;var{view:v}=u,h=v.x+v.width,f=v.y+v.height;v.x<i&&(i=v.x),h>d&&(d=h),v.y<l&&(l=v.y),f>s&&(s=f)}var g=d-i,m=s-l,p=o&&!c&&(g>r||m>n)?Math.max(Math.min(r/g,n/m,o[1]),o[0]):1;return{x:c?0:(r-g*p)/2-i*p,y:c?0:(n-m*p)/2-l*p,k:p}}},2098:(e,t,r)=>{r.d(t,{L:()=>u});var a=r(1030),n=r(3033),o=r(531),i=r(3783),l=r(8527),d=r(6170),s=r(9127),c=r(8185);function u(e){var{cells:t,layout:r,previousCells:u,defaultNodeSize:v,canvasWidth:h,canvasHeight:f,scaleRange:g,transform:m,reason:p,parent:w}=e,y="force"!==r&&"dagre"!==r,x=(0,i.C)(t,{defaultNodeSize:v}),k=[],b=!1,C=new Map,E=!1;for(var z of u)(0,o.mH)(z)?E=!0:(0,o.N)(z)&&(E=!0,z[n.CV]&&C.set(z.id,z));var A=new Map;for(var M of x)if((0,o.N)(M)){A.set(M.id,M);var N=C.get(M.id);N&&(M.view.width=N.view.width,M.view.height=N.view.height,M[n.CV]=!0)}var R=!1;if("add-related-nodes"===p&&w){var S=new Set;for(var T of x)(0,o.WW)(T)&&T.source===w&&T.target!==w&&S.add(T.target);var W=A.get(w);if(void 0!==(null==W?void 0:W.view.x)&&void 0!==W.view.y){R=!0;var L=[...S].map((e=>A.get(e))).filter(Boolean),D=void 0;for(var P of L)void 0!==P.view.x&&void 0!==P.view.y?(!D||P.view.x>D.view.x)&&P.view.y>W.view.y&&(D=P):k.push(P);if(k.length>0&&y){var B,V;if(D)B=D.view.x+D.view.width+n.sz,V=D.view.y;else{var H=k.reduce(((e,t)=>e+t.view.width+n.sz),-n.sz);B=W.view.x-H/2+W.view.width/2,V=W.view.y+W.view.height+n.sz}for(var O of k)O.view.x=B,O.view.y=V,B+=O.view.width+n.sz}}}if(!R){var I,Y=v[0],_=v[1],X=[],Q=!1;for(var U of x)(0,o.N)(U)?(U.view.width>Y&&(Y=U.view.width),U.view.height>_&&(_=U.view.height),void 0===U.view.x||void 0===U.view.y?k.push(U):X.push(U)):(0,o.mH)(U)&&(Q=!0);if(y)for(var j of(E||(m=(0,l.r)((0,a.without)(x,...k),{canvasWidth:h,canvasHeight:f,scaleRange:g})),0===X.length||1===X.length&&!Q?(k.push(...X),({getNodeView:I}=(0,s.C)({cells:x})),b=0===u.length||u.length===x.length&&u.every(((e,t)=>(0,c.c)(e,x[t])))):({getNodeView:I}=(0,d.k)({cells:x,fixedPosition:!0,center:[(h/2-m.x)/m.k,(f/2-m.y)/m.k]})),x))if((0,o.N)(j)){var G=I(j.id);j.view.x=G.x,j.view.y=G.y}}return{cells:x,updated:k,shouldReCenter:b}}},5748:(e,t,r)=>{r.d(t,{d:()=>d});var a=r(9740),n=r(531),o=r(3033);function i(e,t,r){var a=e.findLastIndex(r)+1;return[...e.slice(0,a),t,...e.slice(a)]}var l,d=(l={cells:(e,t)=>{switch(t.type){case"drop-node":return i(e,t.payload,(e=>!("decorator"===e.type&&"text"===e.decorator)));case"drop-decorator":return"text"===t.payload.decorator?[...e,t.payload]:i(e,t.payload,(e=>"decorator"===e.type&&"area"===e.decorator));case"add-nodes":var r=e.findLastIndex((e=>!("decorator"===e.type&&"text"===e.decorator)))+1;return[...e.slice(0,r),...t.payload,...e.slice(r)];case"add-edge":return i(e,t.payload,(e=>"edge"===e.type||"decorator"===e.type&&"area"===e.decorator));case"move-cells":var l=!1,d=e.map((e=>{var r=t.payload.find((t=>e.type===t.type&&e.id===t.id));return r?(l=!0,(0,a.A)((0,a.A)({},e),{},{view:(0,a.A)((0,a.A)({},e.view),{},{x:r.x,y:r.y})})):e}));return l?d:e;case"resize-cell":var{type:s,id:c,width:u,height:v}=t.payload,h=e.findIndex((e=>e.type===s&&e.id===c));if(-1!==h){var f=e[h];return[...e.slice(0,h),(0,a.A)((0,a.A)({},f),{},{view:(0,a.A)((0,a.A)({},f.view),{},{width:u,height:v})}),...e.slice(h+1)]}return e;case"update-cells":return t.payload;case"update-node-size":return e.map((e=>(0,n.N)(e)&&e.id===t.payload.id?(0,a.A)((0,a.A)({},e),{},{[o.CV]:!0,view:t.payload.size?(0,a.A)((0,a.A)({},e.view),{},{width:t.payload.size[0],height:t.payload.size[1]}):e.view}):e))}return e},layoutKey:(e,t)=>"update-node-size"===t.type?t.layoutKey:e},(e,t)=>Object.fromEntries(Object.entries(l).map((r=>{var[a,n]=r;return[a,n(e[a],t)]}))))},7099:(e,t,r)=>{r.d(t,{Y:()=>f});var a=r(8769),n=r.n(a),o=r(2657),i=r(6768),l=r(198),d=r(8621),s=r(7382),c=r(9575);const u=e=>a.createElement("svg",(0,c.A)({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24"},e),a.createElement("path",{d:"M12 0a.5.5 0 0 1 .5.5v2.013a9.5 9.5 0 0 1 8.987 8.988L23.5 11.5a.5.5 0 0 1 0 1h-2.013a9.5 9.5 0 0 1-8.987 8.987V23.5a.5.5 0 0 1-1 0v-2.013A9.5 9.5 0 0 1 2.514 12.5H.5a.5.5 0 0 1 0-1h2.013A9.5 9.5 0 0 1 11.5 2.514V.5A.5.5 0 0 1 12 0M3.514 11.5H7.5a.5.5 0 0 1 0 1H3.514a8.5 8.5 0 0 0 7.987 7.986L11.5 16.5a.5.5 0 0 1 1 0v3.986a8.5 8.5 0 0 0 7.986-7.986H16.5a.5.5 0 0 1 0-1h3.986A8.5 8.5 0 0 0 12.5 3.515V7.5a.5.5 0 0 1-1 0V3.514a8.5 8.5 0 0 0-7.986 7.987zm8.486-1a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3"})),v=e=>a.createElement("svg",(0,c.A)({xmlns:"http://www.w3.org/2000/svg",width:128,height:128,className:"icon",viewBox:"0 0 1024 1024"},e),a.createElement("path",{d:"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384"}),a.createElement("path",{d:"M744.448 486.4h-204.8V281.6a25.6 25.6 0 1 0-51.2 0v204.8h-204.8a25.6 25.6 0 0 0 0 51.2h204.8v204.8a25.6 25.6 0 0 0 51.2 0V537.6h204.8a25.6 25.6 0 0 0 0-51.2"})),h=e=>a.createElement("svg",(0,c.A)({xmlns:"http://www.w3.org/2000/svg",width:128,height:128,className:"icon",viewBox:"0 0 1024 1024"},e),a.createElement("path",{d:"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384"}),a.createElement("path",{d:"M744.448 486.4H280.064a25.6 25.6 0 1 0 0 51.2h464.384a25.6 25.6 0 0 0 0-51.2"}));function f(e){var{shadowRoot:t,scale:r,scaleRange:c,onZoomChange:f,onReCenter:g}=e,m=(0,s.useCurrentTheme)(),p=(0,a.useMemo)((()=>(0,d.VC)()),[]),w=(0,a.useRef)(null),y=100*c[0],x=100*c[1],k=100*r,b=(0,a.useMemo)((()=>({formatter:e=>"".concat(e,"%"),placement:"left",getPopupContainer:()=>w.current})),[]),C=(0,a.useCallback)((()=>{f(Math.min(k+5,x))}),[x,f,k]),E=(0,a.useCallback)((()=>{f(Math.max(k-5,y))}),[y,f,k]);return n().createElement(o.Ay,{theme:{algorithm:"dark-v2"===m?i.A.darkAlgorithm:i.A.defaultAlgorithm}},n().createElement(d.N7,{container:t,autoClear:!0,cache:p,hashPriority:"high"},n().createElement("div",{className:"zoom-bar",ref:w},n().createElement("div",{className:"center-button",onClick:g,role:"button"},n().createElement(u,null)),n().createElement("div",{className:"zoom-slider"},n().createElement("div",{className:"zoom-button",role:"button",onClick:C},n().createElement(v,null)),n().createElement(l.A,{min:y,max:x,value:k,step:5,vertical:!0,included:!1,tooltip:b,onChange:f}),n().createElement("div",{className:"zoom-button",role:"button",onClick:E},n().createElement(h,null))))))}},9127:(e,t,r)=>{r.d(t,{C:()=>u});var a=r(9740),n=r(4223),o=r(1030),i=r(7586),l=r.n(i),d=r(8802),s=r(531),c=["nodePadding"];function u(e){var{cells:t,layoutOptions:r}=e,i=(0,a.A)({nodePadding:0,rankdir:"TB",ranksep:50,edgesep:10,nodesep:50},(0,o.pick)(r,["nodePadding","rankdir","ranksep","edgesep","nodesep","align"])),{nodePadding:u}=i,v=(0,n.A)(i,c),h=(0,d.D)(u);if(!t.some(s.N))return{getNodeView:()=>null,nodePaddings:h};var f=new(l().graphlib.Graph);for(var g of(f.setGraph(v),f.setDefaultEdgeLabel((function(){return{}})),t))(0,s.N)(g)?f.setNode(g.id,{id:g.id,width:g.view.width+h[1]+h[3],height:g.view.height+h[0]+h[2]}):(0,s.WW)(g)&&f.setEdge(g.source,g.target);return l().layout(f),{getNodeView:e=>f.node(e),nodePaddings:h}}},6170:(e,t,r)=>{r.d(t,{k:()=>h});var a=r(9740),n=r(1030),o=r(6149),i=r(4842),l=r(1945),d=r(9418),s=r(3854),c=r(7931),u=r(531),v=r(8802);function h(e){var{cells:t,layoutOptions:r,center:h,fixedPosition:f}=e,{nodePadding:g,collide:m}=(0,a.A)((0,a.A)({nodePadding:0},(0,n.pick)(r,["nodePadding"])),{},{collide:!1!==(null==r?void 0:r.collide)&&(0,a.A)({radiusDiff:18,strength:1,iterations:1},!0===(null==r?void 0:r.collide)?null:null==r?void 0:r.collide)}),p=(0,v.D)(g),w=[],y=[],x=new Map;for(var k of t)if((0,u.N)(k)){var b=(0,a.A)({id:k.id,width:k.view.width+p[1]+p[3],height:k.view.height+p[0]+p[2]},f?{fx:k.view.x,fy:k.view.y}:null);w.push(b),x.set(b.id,b)}else(0,u.WW)(k)&&y.push({source:k.source,target:k.target});var C=(0,o.A)(y).id((e=>e.id)),E=(0,i.A)(w).force("link",C).force("x",(0,l.A)(null==h?void 0:h[0])).force("y",(0,d.A)(null==h?void 0:h[1])).force("charge",(0,s.A)());return m&&E.force("collide",(0,c.A)().radius((e=>Math.sqrt(e.width**2+e.height**2)/2+m.radiusDiff)).strength(m.strength).iterations(m.iterations)),E.stop(),function(e){e.tick(Math.ceil(Math.log(e.alphaMin())/Math.log(1-e.alphaDecay())))}(E),{getNodeView:e=>x.get(e),nodePaddings:p}}},1819:(e,t,r)=>{r.d(t,{J:()=>o});var a=r(8769),n=r(8185);function o(e){var{cellsRef:t,activeTarget:r,onActiveTargetChange:o}=e,i=null!=r?r:null,[l,d]=(0,a.useState)(i);(0,a.useEffect)((()=>{d((e=>(0,n.c)(e,i)?e:i))}),[i]);var s=(0,a.useRef)(!1);return(0,a.useEffect)((()=>{s.current?o(l):s.current=!0}),[l,o]),(0,a.useEffect)((()=>{if(l){var e=e=>{e.composedPath().indexOf(t.current)<=0&&d(null)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}}),[l,t]),l}},1484:(e,t,r)=>{r.d(t,{g:()=>f});var a=r(9740),n=r(8769),o=r(7566),i=r(1517),l=r(3033),d=r(531),s=r(8527),c=r(6170),u=r(9127),v=new Map([["center",.5],["left",0],["right",1],["top",0],["bottom",1]]);function h(e,t){if("string"==typeof e){var r=v.get(e);if(void 0!==r)return r;var a=e.match(/^(-?\d+(?:\.\d+)?)%$/);if(a)return Number(a[1])/100;console.error("Unexpected align origin %s:",t,e)}else{if("number"==typeof e)return e;console.error("Unexpected align origin %s, expected %s, received %s:",t,"string | number",typeof e,e)}return.5}function f(e){var{layout:t,layoutOptions:r,rootRef:v,cells:f,zoomable:g,zoomer:m,scaleRange:p,layoutKey:w,dispatch:y}=e,[x,k]=(0,n.useState)("force"!==t&&"dagre"!==t),b=(0,n.useRef)(w),C=(0,n.useCallback)((()=>++b.current),[]),[E,z]=function(e){var{rootRef:t,cells:r,layoutInitialized:a,zoomable:c,zoomer:u,scaleRange:v}=e,[h,f]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{var e=t.current;if(e&&a&&!h&&r.some((e=>(0,d.N)(e)||(0,d.mH)(e)))&&!r.some((e=>(0,d.N)(e)&&!e[l.CV]))){var{k:n,x:g,y:m}=(0,s.r)(r,{canvasWidth:e.clientWidth,canvasHeight:e.clientHeight,scaleRange:c?v:void 0});u.transform((0,o.A)(e),new i.uV(n,g,m)),f(!0)}}),[r,h,a,t,v,c,u]),(0,n.useEffect)((()=>{r.some((e=>(0,d.N)(e)||(0,d.mH)(e)))||f(!1)}),[r]),[h,f]}({rootRef:v,layoutInitialized:x,cells:f,zoomable:g,zoomer:m,scaleRange:p}),A=(0,n.useRef)(null);return(0,n.useEffect)((()=>{if(!f.some((e=>(0,d.N)(e)&&!e[l.CV]))&&0!==f.length)if("force"===t||"dagre"===t){if(b.current===w&&(e=A.current,n=f.filter(d.nv),(null==e?void 0:e.length)!==n.length||!e.every(((e,t)=>e===n[t])))){var e,n,o,i;({getNodeView:o,nodePaddings:i}="force"===t?(0,c.k)({cells:f,layoutOptions:r}):(0,u.C)({cells:f,layoutOptions:r}));var s=function(e){var t=null!=e?e:[.5,.5];return[h(t[0],"x"),h(t[1],"y")]}(null==r?void 0:r.alignOrigin),v=f.map((e=>{if((0,d.N)(e)){var t=o(e.id);return(0,a.A)((0,a.A)({},e),{},{view:(0,a.A)((0,a.A)({},e.view),{},{x:t.x-t.width*s[0]+i[3],y:t.y-t.height*s[1]+i[0]}),[l.xc]:!0})}return e}));A.current=v.filter(d.nv),y({type:"update-cells",payload:v}),k(!0)}}else k(!0)}),[f,y,t,w,r]),{centered:E,setCentered:z,getNextLayoutKey:C}}},7531:(e,t,r)=>{r.d(t,{d:()=>s});var a=r(9740),n=r(8769),o=r(9924),i=r(1030),l=r(531),d=r(3033);function s(e){var{cells:t,defaultEdgeLines:r,markerPrefix:s}=e;return(0,n.useMemo)((()=>{var e=[{strokeColor:d.mF}],n=new WeakMap,c=function(t){if((0,l.WW)(t)){var c,u=null!==(c=o.__secret_internals.legacyDoTransform({edge:t},null==r?void 0:r.find((e=>(0,o.checkIfByTransform)(e,{edge:t})))))&&void 0!==c?c:{},v=(0,a.A)({dashed:!1,strokeColor:d.mF,strokeWidth:d.VO,interactStrokeWidth:d.Ie,showStartArrow:d.XV,showEndArrow:d.Ub,animate:{useAnimate:!1,duration:d.Be}},(0,i.omitBy)(u,i.isUndefined));void 0===v.parallelGap&&(v.parallelGap=v.interactStrokeWidth);var h=function(e,t){var r=(0,i.findIndex)(t,e);return-1===r&&(r=t.push(e)-1),r}({strokeColor:v.strokeColor},e);v.markerArrow="url(#".concat(s).concat(h,")"),n.set(t,v)}};for(var u of t)c(u);return[n,e]}),[t,r,s])}},8197:(e,t,r)=>{r.d(t,{H:()=>i});var a=r(8769),n=r(531),o=r(3033);function i(e){var{cells:t,layout:r,centered:i}=e;return(0,a.useMemo)((()=>i&&t.every((e=>!(0,n.N)(e)||e[o.CV]&&("force"!==r&&"dagre"!==r||e[o.xc])))),[t,i,r])}},8091:(e,t,r)=>{r.d(t,{f:()=>l});var a=r(8769),n=r(7566),o=r(1517),i=r(3033);function l(e){var{rootRef:t,zoomable:r,scrollable:l,pannable:d,draggable:s,scaleRange:c,onSwitchActiveTarget:u}=e,[v,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)({k:1,x:0,y:0}),m=(0,a.useMemo)((()=>null!=c?c:[i.sS,i.Yt]),[c]),p=(0,a.useMemo)((()=>(0,o.s_)()),[]);return(0,a.useEffect)((()=>{var e=!1;p.scaleExtent(r?m:[1,1]).on("start",(()=>{e=!1,h(!0)})).on("zoom",(t=>{e=!0,g(t.transform)})).on("end",(()=>{h(!1),e||null==u||u(null)}))}),[u,m,r,p]),(0,a.useEffect)((()=>{var e=t.current;if(e){var a=(0,n.A)(e),o=()=>{a.on(".zoom",null).on(".zoom.custom",null).on("wheel",null)};if(r||l||d)return(r||l)&&a.on("wheel.zoom.custom",(e=>{e.ctrlKey||(e.stopImmediatePropagation(),l&&(e.preventDefault(),p.translateBy(a,e.wheelDeltaX/5,e.wheelDeltaY/5)))})),a.call(p).on("wheel",(e=>e.preventDefault())).on("dblclick.zoom",null),s&&d||a.on("mousedown.zoom",null),d||a.on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),o;o()}}),[s,d,t,l,r,p]),{grabbing:v,transform:f,zoomer:p,scaleRange:m}}},8618:(e,t,r)=>{r.d(t,{A:()=>l});var a=r(6758),n=r.n(a),o=r(935),i=r.n(o)()(n());i.push([e.id,'.zoom-bar{position:absolute;bottom:20px;right:20px;width:40px}.zoom-slider,\n.center-button{width:100%;display:flex;align-items:center;border:1px solid var(--antd-background-color-base);border-radius:var(--larger-border-radius);box-shadow:var(--connected-overlay-shadow);background-color:var(--color-fill-bg-container-4)}.zoom-slider{height:140px;padding:8px 0;flex-direction:column}[role="button"]{cursor:pointer}.center-button{justify-content:center;margin-bottom:8px;height:40px}.center-button:hover{border-color:var(--antd-btn-default-hover-border-color)}.center-button path{fill:var(--antd-link-hover-color)}.center-button:hover path{fill:var(--palette-blue-7)}.zoom-button{font-size:16px;line-height:0}.zoom-button svg{width:1em;height:1em;fill:var(--antd-link-hover-color)}.zoom-slider .ant-slider-vertical{padding-inline:5px}.zoom-slider .ant-slider-vertical .ant-slider-rail{width:2px}.zoom-slider .ant-slider-vertical .ant-slider-handle{width:6px;height:6px;inset-inline-start:3px}.zoom-slider .ant-slider .ant-slider-handle:hover::before,\n.zoom-slider .ant-slider .ant-slider-handle:focus::before,\n.zoom-slider .ant-slider .ant-slider-handle::before{width:10px;height:10px;inset-inline-start:-2px}.zoom-slider .ant-slider .ant-slider-handle:hover::after,\n.zoom-slider .ant-slider .ant-slider-handle:focus::after,\n.zoom-slider .ant-slider .ant-slider-handle::after{width:6px;height:6px;inset-block-start:0;inset-inline-start:0}',""]);const l=i.toString()},3012:(e,t,r)=>{r.d(t,{A:()=>l});var a=r(6758),n=r.n(a),o=r(935),i=r.n(o)()(n());i.push([e.id,"*{box-sizing:border-box}:host{display:block;position:relative;overflow:hidden;--animation-dasharray:48;--stroke-dashoffset:96;--dasharray:4}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}@keyframes dashedAnimation{0%{stroke-dashoffset:var(--stroke-dashoffset)}to{stroke-dashoffset:0}}@keyframes solidAnimation{to{stroke-dashoffset:0}}.solid-animation{stroke-dasharray:var(--solid-length);stroke-dashoffset:var(--solid-length);animation:solidAnimation var(--time) linear infinite}.dashed-animation{animation:dashedAnimation var(--time) linear infinite}.decorator-area .area{fill:rgba(119,141,195,0.1);stroke:none;stroke-width:0}.node,\n.decorator-text{overflow:visible}.cell.active .decorator-area .area,\n.allowEdgeToArea:hover .decorator-area .area,\n.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:var(--dasharray);stroke-width:1}.cell:not(.read-only){-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-handle{cursor:nwse-resize;opacity:0}.resize-handle rect{fill:transparent;stroke:none}.resize-handle path{fill:none;stroke:var(--palette-gray-5);stroke-width:1.5}.cell.active .decorator-area .resize-handle,\n.decorator-area:hover .resize-handle{opacity:1}.connect-line{pointer-events:none}.connect-line:not(.connecting){display:none}.line.dashed{stroke-dasharray:var(--dasharray)}.cell.active .decorator-text .text-container{outline:1px dashed var(--palette-blue-5)}.decorator-text .text-container{width:-webkit-max-content;width:-moz-max-content;width:max-content;padding:0.5em}.decorator-text .text:focus{outline:none}.cell.faded{opacity:0.3}.cell .node{pointer-events:none}.cell .node > *{pointer-events:auto}.degraded{pointer-events:bounding-box}.degraded circle{fill:rgb(119,141,195)}.degraded text{text-anchor:middle;fill:var(--antd-text-color)}.cell.active .degraded circle,\n.cell.active .degraded text,\n.degraded:hover circle,\n.degraded:hover text{fill:var(--color-brand)}",""]);const l=i.toString()}}]);
|
|
2
|
+
//# sourceMappingURL=2440.39d44dc0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunks/2440.39d44dc0.js","mappings":"oKAYO,SAASA,EAAeC,GAIO,IAChCC,GAL0B,GAC9BC,EAAE,KACFC,EAAI,YACJC,GACqBJ,EAGrB,OAAQG,GACN,IAAK,OACHF,EAAYI,EACZ,MACF,IAAK,OACHJ,EAAYK,EACZ,MACF,QACEL,EAAYM,EAGhB,OAAOC,IAAAA,cAACP,EAAS,CAACC,GAAIA,EAAIE,YAAaA,GACzC,CAEA,SAASG,EAAWE,GAGsB,IAHrB,GACnBP,EAAE,YACFE,GACyBK,EACzB,OACED,IAAAA,cAAA,UACEN,GAAIA,EACJQ,QAAQ,UACRC,KAAM,EACNC,KAAM,EACNC,YAAa,EACbC,aAAc,EACdC,OAAO,qBACPC,eAAe,SAEfR,IAAAA,cAAA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BA,GAAG,gBAAiB,MAGlBE,EA5CLA,GAZF,CAwDgB,GACf,CAACT,EAAWD,EAAUvC,EAASsC,EAAYrC,EAAUC,IAEjD,CAAEwC,WAAUhT,YAAWwQ,SAAQ5J,aACxC,C,kECvIIiN,E,MAA0B,GAA4B,KAE1DA,EAAwB5d,KAAK,CAAC6d,EAAOhhB,GAAI,o6CAK2E,KAEpH,QAAe+gB,EAAwBE,U,kECTnCF,E,MAA0B,GAA4B,KAE1DA,EAAwB5d,KAAK,CAAC6d,EAAOhhB,GAAI,o+DAQO,KAEhD,QAAe+gB,EAAwBE,U","sources":["webpack:///./src/diagram/MarkerComponent.tsx","webpack:///./src/diagram/lines/getDirectLinePoints.ts","webpack:///./src/diagram/processors/doTwoNodesOverlap.ts","webpack:///./src/diagram/processors/extractPartialRectTuple.ts","webpack:///./src/draw-canvas/processors/findNodeOrAreaDecorator.ts","webpack:///./src/draw-canvas/EdgeComponent.tsx","webpack:///./src/draw-canvas/NodeComponent.tsx","webpack:///./src/draw-canvas/processors/handleMouseDown.ts","webpack:///./src/draw-canvas/decorators/DecoratorArea.tsx","webpack:///./src/draw-canvas/decorators/DecoratorText.tsx","webpack:///./src/draw-canvas/decorators/index.tsx","webpack:///./src/draw-canvas/CellComponent.tsx","webpack:///./src/draw-canvas/constants.ts","webpack:///./src/draw-canvas/processors/asserts.ts","webpack:///./src/draw-canvas/processors/cellToTarget.ts","webpack:///./src/draw-canvas/processors/getUnrelatedCells.ts","webpack:///./src/draw-canvas/processors/initializeCells.ts","webpack:///./src/draw-canvas/processors/sameTarget.ts","webpack:///./src/draw-canvas/processors/targetIsActive.ts","webpack:///./src/draw-canvas/processors/transformToCenter.ts","webpack:///./src/draw-canvas/processors/updateCells.ts","webpack:///./src/draw-canvas/reducers/cells.ts","webpack:///./src/draw-canvas/reducers/index.ts","webpack:///./src/draw-canvas/reducers/layoutKey.ts","webpack:///./src/shared/canvas/icons/center.svg","webpack:///./src/shared/canvas/icons/zoom-in.svg","webpack:///./src/shared/canvas/icons/zoom-out.svg","webpack:///./src/shared/canvas/ZoomBarComponent.tsx","webpack:///./src/shared/canvas/dagreLayout.ts","webpack:///./src/shared/canvas/forceLayout.ts","webpack:///./src/shared/canvas/useActiveTarget.ts","webpack:///./src/draw-canvas/processors/normalizeAlignOrigin.ts","webpack:///./src/shared/canvas/useLayout.ts","webpack:///./src/shared/canvas/useAutoCenter.ts","webpack:///./src/shared/canvas/useLineMarkers.ts","webpack:///./src/shared/canvas/useReady.ts","webpack:///./src/shared/canvas/useZoom.ts","webpack:///./src/shared/canvas/ZoomBarComponent.shadow.css","webpack:///./src/shared/canvas/styles.shadow.css"],"sourcesContent":["import React from \"react\";\nimport type { LineMarkerType } from \"./interfaces\";\n\nexport interface MarkerComponentProps extends BaseMarkerComponentProps {\n type: LineMarkerType;\n}\n\nexport interface BaseMarkerComponentProps {\n id: string;\n strokeColor?: string;\n}\n\nexport function MarkerComponent({\n id,\n type,\n strokeColor,\n}: MarkerComponentProps): JSX.Element {\n let Component: (props: BaseMarkerComponentProps) => JSX.Element;\n\n switch (type) {\n case \"0..1\":\n Component = EntityRelationZeroOrOneMarker;\n break;\n case \"0..N\":\n Component = EntityRelationZeroOrManyMarker;\n break;\n default:\n Component = ArrowMarker;\n }\n\n return <Component id={id} strokeColor={strokeColor} />;\n}\n\nfunction ArrowMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 6 6\"\n refX={5}\n refY={3}\n markerWidth={6}\n markerHeight={6}\n orient=\"auto-start-reverse\"\n strokeLinejoin=\"round\"\n >\n <path\n d=\"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z\"\n stroke={strokeColor}\n strokeWidth={1}\n fill={strokeColor}\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrOneMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrManyMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n","import type { NodePosition, NodeRect, PositionTuple } from \"../interfaces\";\nimport { doTwoNodesOverlap } from \"../processors/doTwoNodesOverlap\";\n\ntype LineTuple = [start: PositionTuple, end: PositionTuple];\n\nexport function getDirectLinePoints(\n source: NodeRect,\n target: NodeRect,\n parallelGap?: number\n): NodePosition[] | null {\n // Ignore if two nodes are the same.\n // Ignore if two nodes overlap.\n if (source === target || doTwoNodesOverlap(source, target, 0, 0)) {\n return null;\n }\n\n let p0: PositionTuple;\n let p1: PositionTuple;\n\n let xDiff = 0;\n let yDiff = 0;\n\n if (parallelGap) {\n const dx = target.x - source.x;\n const dy = target.y - source.y;\n const angle = Math.atan2(dy, dx);\n xDiff = (parallelGap / 2) * Math.cos(angle + Math.PI / 2);\n yDiff = (parallelGap / 2) * Math.sin(angle + Math.PI / 2);\n }\n\n const line: LineTuple = [\n [source.x + xDiff, source.y + yDiff],\n [target.x + xDiff, target.y + yDiff],\n ];\n const sourceIntersections = getIntersections(source, line);\n const targetIntersections = getIntersections(target, line);\n\n // Todo: handle when more than one intersection\n if (sourceIntersections.length > 0) {\n p0 = sourceIntersections[0];\n } else {\n p0 = [source.x, source.y];\n }\n if (targetIntersections.length > 0) {\n p1 = targetIntersections[0];\n } else {\n p1 = [target.x, target.y];\n }\n\n return [\n { x: p0[0], y: p0[1] },\n { x: p1[0], y: p1[1] },\n ];\n}\n\nfunction getIntersections(rect: NodeRect, line: LineTuple) {\n const vertices: PositionTuple[] = [\n [rect.x - rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y + rect.height / 2],\n [rect.x - rect.width / 2, rect.y + rect.height / 2],\n ];\n const possibleLines: [start: PositionTuple, end: PositionTuple][] = [];\n for (let i = 0; i < 4; i++) {\n possibleLines.push([vertices[i], vertices[(i + 1) % 4]]);\n }\n const intersections: PositionTuple[] = [];\n for (const item of possibleLines) {\n const intersection = intersect(line[0], line[1], item[0], item[1]);\n if (intersection) {\n intersections.push(intersection);\n }\n }\n return intersections;\n}\n\n// https://paulbourke.net/geometry/pointlineplane/javascript.txt\nfunction intersect(\n [x1, y1]: PositionTuple,\n [x2, y2]: PositionTuple,\n [x3, y3]: PositionTuple,\n [x4, y4]: PositionTuple\n): null | PositionTuple {\n // Check if none of the lines are of length 0\n if ((x1 === x2 && y1 === y2) || (x3 === x4 && y3 === y4)) {\n return null;\n }\n\n const denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);\n\n // Lines are parallel\n if (denominator === 0) {\n return null;\n }\n\n const ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;\n const ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denominator;\n\n // is the intersection along the segments\n if (ua < 0 || ua > 1 || ub < 0 || ub > 1) {\n return null;\n }\n\n // Return a object with the x and y coordinates of the intersection\n const x = x1 + ua * (x2 - x1);\n const y = y1 + ua * (y2 - y1);\n\n return [x, y];\n}\n","import type { NodeRect } from \"../interfaces\";\n\nexport function doTwoNodesOverlap(\n a: NodeRect,\n b: NodeRect,\n paddingA: number,\n paddingB: number\n): boolean {\n const A = paddingA ? getNodesWithPadding(a, paddingA) : a;\n const B = paddingB ? getNodesWithPadding(b, paddingB) : b;\n const left = Math.min(A.x - A.width / 2, B.x - B.width / 2);\n const right = Math.max(A.x + A.width / 2, B.x + B.width / 2);\n const top = Math.min(A.y - A.height / 2, B.y - B.height / 2);\n const bottom = Math.max(A.y + A.height / 2, B.y + B.height / 2);\n return right - left < A.width + B.width && bottom - top < A.height + B.height;\n}\n\nfunction getNodesWithPadding(node: NodeRect, padding: number) {\n return {\n x: node.x - node.width / 2 - padding,\n y: node.y - node.height / 2 - padding,\n width: node.width + padding * 2,\n height: node.height + padding * 2,\n };\n}\n","import type { FullRectTuple, PartialRectTuple } from \"../interfaces\";\n\nexport function extractPartialRectTuple(\n value: PartialRectTuple\n): FullRectTuple {\n if (Array.isArray(value)) {\n const v0 = value[0];\n const v1 = value.length > 1 ? value[1]! : v0;\n const v2 = value.length > 2 ? value[2]! : v0;\n const v3 = value.length > 3 ? value[3]! : v1;\n return [v0, v1, v2, v3];\n }\n return new Array(4).fill(value) as FullRectTuple;\n}\n","import type { Cell, NodeCell, DecoratorCell, NodeId } from \"../interfaces\";\nimport { isNodeOrAreaDecoratorCell } from \"./asserts\";\n\nexport function findNodeOrAreaDecorator(\n cells: Cell[],\n id: NodeId\n): NodeCell | DecoratorCell | undefined {\n return cells.find(\n (cell) => isNodeOrAreaDecoratorCell(cell) && cell.id === id\n ) as NodeCell | DecoratorCell | undefined;\n}\n","import React, { useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n EdgeCell,\n NodeView,\n} from \"./interfaces\";\nimport { getDirectLinePoints } from \"../diagram/lines/getDirectLinePoints\";\nimport type { NodeRect } from \"../diagram/interfaces\";\nimport { isEdgeCell } from \"./processors/asserts\";\nimport { DEFAULT_LINE_INTERACT_ANIMATE_DURATION } from \"./constants\";\nimport { findNodeOrAreaDecorator } from \"./processors/findNodeOrAreaDecorator\";\n\nexport interface EdgeComponentProps {\n edge: EdgeCell;\n cells: Cell[];\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n}\n\nexport function EdgeComponent({\n edge,\n cells,\n lineConfMap,\n}: EdgeComponentProps): JSX.Element | null {\n const pathRef = useRef<SVGPathElement>(null);\n const sourceNode = useMemo(\n () => findNodeOrAreaDecorator(cells, edge.source),\n [cells, edge.source]\n );\n const targetNode = useMemo(\n () => findNodeOrAreaDecorator(cells, edge.target),\n [cells, edge.target]\n );\n const lineConf = useMemo(() => lineConfMap.get(edge)!, [edge, lineConfMap]);\n\n const parallelGap = useMemo(() => {\n const hasOppositeEdge = cells.some(\n (cell) =>\n isEdgeCell(cell) &&\n cell.source === edge.target &&\n cell.target === edge.source\n );\n return hasOppositeEdge ? lineConf.parallelGap : 0;\n }, [cells, edge, lineConf.parallelGap]);\n\n const padding = 5;\n const line = useMemo(\n () =>\n sourceNode &&\n targetNode &&\n sourceNode.view.x != null &&\n targetNode.view.x != null\n ? getDirectLinePoints(\n nodeViewToNodeRect(sourceNode.view, padding),\n nodeViewToNodeRect(targetNode.view, padding),\n parallelGap\n )\n : null,\n [parallelGap, sourceNode, targetNode]\n );\n\n if (!line) {\n // This happens when source or target is not found,\n // or when source or target has not been positioned yet.\n return null;\n }\n const d = `M${line[0].x} ${line[0].y}L${line[1].x} ${line[1].y}`;\n return (\n <>\n <path\n // This `path` is made for expanding interaction area of graph lines.\n d={d}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={lineConf.interactStrokeWidth}\n />\n <path\n ref={pathRef}\n className={classNames(\"line\", {\n dashed: lineConf.dashed,\n [`${lineConf.dashed ? \"dashed\" : \"solid\"}-animation`]:\n lineConf.animate.useAnimate,\n })}\n style={\n {\n \"--time\": `${lineConf.animate.duration ?? DEFAULT_LINE_INTERACT_ANIMATE_DURATION}s`,\n \"--solid-length\": pathRef.current?.getTotalLength?.(),\n } as React.CSSProperties\n }\n d={d}\n fill=\"none\"\n stroke={lineConf.strokeColor}\n strokeWidth={lineConf.strokeWidth}\n markerStart={lineConf.showStartArrow ? lineConf.markerArrow : \"\"}\n markerEnd={lineConf.showEndArrow ? lineConf.markerArrow : \"\"}\n />\n <path className=\"line-active-bg\" d={d} fill=\"none\" />\n </>\n );\n}\n\nfunction nodeViewToNodeRect(view: NodeView, padding: number): NodeRect {\n return {\n x: view.x + view.width / 2,\n y: view.y + view.height / 2,\n width: view.width + padding,\n height: view.height + padding,\n };\n}\n","import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { ReactUseBrick } from \"@next-core/react-runtime\";\nimport { __secret_internals, checkIfByTransform } from \"@next-core/runtime\";\nimport { isEqual } from \"lodash\";\nimport ResizeObserver from \"resize-observer-polyfill\";\nimport type { NodeBrickCell, NodeBrickConf, NodeCell } from \"./interfaces\";\nimport type { SizeTuple } from \"../diagram/interfaces\";\n\nexport interface NodeComponentProps {\n node: NodeCell;\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n onResize(id: string, size: SizeTuple | null): void;\n}\n\nexport function NodeComponent({\n node,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n onResize,\n}: NodeComponentProps): JSX.Element | null {\n const memoizedData = useDeepMemo({ node: { id: node.id, data: node.data } });\n const specifiedUseBrick = (node as NodeBrickCell).useBrick;\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const useBrick = useMemo(() => {\n return degraded\n ? null\n : specifiedUseBrick ??\n defaultNodeBricks?.find((item) =>\n checkIfByTransform(item, memoizedData)\n )?.useBrick;\n }, [degraded, specifiedUseBrick, defaultNodeBricks, memoizedData]);\n\n const label = useMemo<string>(\n () =>\n degraded\n ? String(\n __secret_internals.legacyDoTransform(\n memoizedData,\n degradedNodeLabel ?? \"<% DATA.node.id %>\"\n )\n )\n : \"\",\n [degraded, degradedNodeLabel, memoizedData]\n );\n\n const refCallback = useCallback(\n (element: HTMLElement | null) => {\n const prevObserver = observerRef.current;\n if (prevObserver) {\n prevObserver.disconnect();\n observerRef.current = null;\n }\n if (element) {\n // Todo: correctly wait for `useBrick` in v3 to be rendered (after layout)\n // Wait a macro task to let `useBrick` to be rendered.\n setTimeout(() => {\n const observer = new ResizeObserver(() => {\n onResize(node.id, [element.offsetWidth, element.offsetHeight]);\n });\n observer.observe(element);\n observerRef.current = observer;\n });\n } else {\n onResize(node.id, null);\n }\n },\n [node.id, onResize]\n );\n\n const degradedRefCallBack = useCallback(\n (g: SVGGElement | null) => {\n if (g) {\n // istanbul ignore next\n const size =\n process.env.NODE_ENV === \"test\"\n ? { width: 60, height: 60 }\n : g.getBBox();\n onResize(node.id, [size.width, size.height]);\n } else {\n onResize(node.id, null);\n }\n },\n [node.id, onResize]\n );\n\n return useBrick ? (\n <foreignObject\n // Make a large size to avoid the brick inside to be clipped by the foreignObject.\n width={9999}\n height={9999}\n className=\"node\"\n >\n {useBrick && (\n <ReactUseBrick\n useBrick={useBrick}\n data={memoizedData}\n refCallback={refCallback}\n />\n )}\n </foreignObject>\n ) : degraded ? (\n <g className=\"degraded\" ref={degradedRefCallBack}>\n <circle cx={8} cy={8} r={8} />\n <text x={8} y={32}>\n {label}\n </text>\n </g>\n ) : null;\n}\n\nfunction useDeepMemo<T>(value: T): T {\n const [memoizedValue, setMemoizedValue] = useState(value);\n\n useEffect(() => {\n setMemoizedValue((prev) => (isEqual(prev, value) ? prev : value));\n }, [value]);\n\n return memoizedValue;\n}\n","import type { PositionTuple } from \"../../diagram/interfaces\";\nimport type {\n ActiveTarget,\n Cell,\n DecoratorCell,\n LayoutType,\n NodeCell,\n} from \"../interfaces\";\nimport type {\n MoveCellPayload,\n ResizeCellPayload,\n} from \"../reducers/interfaces\";\nimport { isDecoratorCell, isEdgeCell, isNodeCell } from \"./asserts\";\nimport { cellToTarget } from \"./cellToTarget\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nexport function handleMouseDown(\n event: MouseEvent,\n {\n action,\n cell,\n scale,\n layout,\n activeTarget,\n cells,\n onCellsMoving,\n onCellsMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n }: {\n action: \"move\" | \"resize\";\n cell: Cell;\n scale: number;\n layout?: LayoutType;\n activeTarget: ActiveTarget | null | undefined;\n cells: Cell[];\n onCellsMoving?(info: MoveCellPayload[]): void;\n onCellsMoved?(info: MoveCellPayload[]): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget?(activeTarget: ActiveTarget | null): void;\n }\n) {\n event.stopPropagation();\n // Drag node\n if (action === \"resize\" || !targetIsActive(cell, activeTarget)) {\n onSwitchActiveTarget?.(cellToTarget(cell));\n }\n\n const isAutoLayout = layout === \"force\" || layout === \"dagre\";\n if (isEdgeCell(cell)) {\n return;\n }\n\n const activeCells =\n activeTarget?.type === \"multi\" && action === \"move\"\n ? cells.filter((c) => targetIsActive(c, activeTarget))\n : [cell];\n\n const movableActiveCells = activeCells.filter(\n (c) => (isNodeCell(c) && !isAutoLayout) || isDecoratorCell(c)\n ) as (NodeCell | DecoratorCell)[];\n\n if (movableActiveCells.length === 0) {\n return;\n }\n\n const from: PositionTuple = [event.clientX, event.clientY];\n const originals = movableActiveCells.map((c) => ({\n cell: c,\n position:\n action === \"move\" ? [c.view.x, c.view.y] : [c.view.width, c.view.height],\n }));\n\n function getMovement(e: MouseEvent): PositionTuple {\n return [(e.clientX - from[0]) / scale, (e.clientY - from[1]) / scale];\n }\n\n let moved = false;\n\n const handleMove = (e: MouseEvent, finished?: boolean) => {\n // Respect the scale\n const movement = getMovement(e);\n if (!moved) {\n moved = movement[0] ** 2 + movement[1] ** 2 >= 9;\n }\n if (moved) {\n if (action === \"move\") {\n const payloads = originals.map(({ cell, position }) => ({\n type: cell.type,\n id: cell.id,\n x: position[0] + movement[0],\n y: position[1] + movement[1],\n }));\n (finished ? onCellsMoved : onCellsMoving)?.(payloads);\n } else {\n (finished ? onCellResized : onCellResizing)?.({\n type: cell.type,\n id: cell.id,\n width: originals[0].position[0] + movement[0],\n height: originals[0].position[1] + movement[1],\n });\n }\n }\n };\n\n const onMouseMove = (e: MouseEvent) => {\n handleMove(e);\n };\n const onMouseUp = (e: MouseEvent) => {\n handleMove(e, true);\n moved = false;\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n}\n","import React, { useEffect } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\n\nexport function DecoratorArea({\n cell,\n transform,\n readOnly,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n}: BasicDecoratorProps): JSX.Element {\n const resizeHandleRef = React.useRef<SVGGElement>(null);\n\n useEffect(() => {\n const resizeHandle = resizeHandleRef.current;\n if (!resizeHandle || readOnly) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n action: \"resize\",\n cell,\n scale: transform.k,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n activeTarget,\n cell,\n cells,\n onCellResized,\n onCellResizing,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n return (\n <g className=\"decorator-area\">\n <rect\n width={cell.view.width}\n height={cell.view.height}\n className=\"area\"\n />\n {!readOnly && (\n <g\n ref={resizeHandleRef}\n className=\"resize-handle\"\n transform={`translate(${cell.view.width - 20} ${cell.view.height - 20})`}\n >\n <rect width={20} height={20} />\n <path d=\"M10 18L18 10 M15 18L18 15\" />\n </g>\n )}\n </g>\n );\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport classNames from \"classnames\";\n\nexport type DecoratorTextProps = Pick<\n BasicDecoratorProps,\n \"cell\" | \"readOnly\" | \"onDecoratorTextEditing\" | \"onDecoratorTextChange\"\n>;\n\nexport function DecoratorText({\n cell,\n readOnly,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: DecoratorTextProps): JSX.Element {\n const label = cell.view.text ?? \"\";\n const [currentLabel, setCurrentLabel] = useState<string>(label);\n const [editingLabel, setEditingLabel] = useState(false);\n const editingLabelInitialized = useRef(false);\n const [shouldEmitLabelChange, setShouldEmitLabelChange] = useState(false);\n const ref = useRef<HTMLDivElement>(null);\n\n const handleEnableEdit = useCallback(\n (e: React.MouseEvent) => {\n if (readOnly) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n },\n [readOnly]\n );\n\n useEffect(() => {\n const element = ref.current;\n if (element && element.textContent !== currentLabel) {\n element.textContent = currentLabel;\n }\n }, [currentLabel]);\n\n useEffect(() => {\n if (editingLabel && ref.current) {\n ref.current.focus();\n selectAllText(ref.current);\n }\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n useEffect(() => {\n if (editingLabelInitialized.current) {\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n } else {\n editingLabelInitialized.current = true;\n }\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n const handleInput = useCallback(\n (event: React.FormEvent<HTMLDivElement>) => {\n if (readOnly) {\n return;\n }\n setCurrentLabel((event.target as HTMLDivElement).textContent!);\n },\n [readOnly]\n );\n\n const handleBlur = useCallback(() => {\n if (readOnly) {\n return;\n }\n setEditingLabel(false);\n setShouldEmitLabelChange(true);\n }, [readOnly]);\n\n useEffect(() => {\n if (shouldEmitLabelChange) {\n onDecoratorTextChange?.({\n id: cell.id,\n view: { ...cell.view, text: currentLabel },\n });\n setShouldEmitLabelChange(false);\n }\n }, [cell, currentLabel, onDecoratorTextChange, shouldEmitLabelChange]);\n\n return (\n <foreignObject className=\"decorator-text\">\n <div\n className={classNames(\"text-container\", { editing: editingLabel })}\n onDoubleClick={handleEnableEdit}\n >\n <div\n className=\"text\"\n contentEditable={editingLabel}\n ref={ref}\n onInput={handleInput}\n onBlur={handleBlur}\n />\n </div>\n </foreignObject>\n );\n}\n\nfunction selectAllText(element: HTMLElement) {\n const range = document.createRange();\n range.selectNodeContents(element);\n const selection = window.getSelection()!;\n selection.removeAllRanges();\n selection.addRange(range);\n}\n","import React from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { DecoratorArea } from \"./DecoratorArea\";\nimport { DecoratorText } from \"./DecoratorText\";\n\nexport function DecoratorComponent({\n cell,\n transform,\n readOnly,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: BasicDecoratorProps): JSX.Element | null {\n let SpecifiedComponent: (props: BasicDecoratorProps) => JSX.Element | null;\n\n switch (cell.decorator) {\n case \"area\":\n SpecifiedComponent = DecoratorArea;\n break;\n case \"text\":\n SpecifiedComponent = DecoratorText;\n break;\n // istanbul ignore next\n default:\n // eslint-disable-next-line no-console\n console.error(`Unknown decorator: ${cell.decorator}`);\n return null;\n }\n\n return (\n <SpecifiedComponent\n cell={cell}\n transform={transform}\n readOnly={readOnly}\n activeTarget={activeTarget}\n cells={cells}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n );\n}\n","import React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n ActiveTarget,\n Cell,\n CellContextMenuDetail,\n ComputedEdgeLineConf,\n DecoratorTextChangeDetail,\n EdgeCell,\n LayoutType,\n NodeBrickConf,\n} from \"./interfaces\";\nimport { isDecoratorCell, isEdgeCell, isNodeCell } from \"./processors/asserts\";\nimport { EdgeComponent } from \"./EdgeComponent\";\nimport { NodeComponent } from \"./NodeComponent\";\nimport { handleMouseDown } from \"./processors/handleMouseDown\";\nimport type { MoveCellPayload, ResizeCellPayload } from \"./reducers/interfaces\";\nimport { DecoratorComponent } from \"./decorators\";\nimport { cellToTarget } from \"./processors/cellToTarget\";\nimport type { SizeTuple, TransformLiteral } from \"../diagram/interfaces\";\nimport { sameTarget } from \"./processors/sameTarget\";\nimport { targetIsActive } from \"./processors/targetIsActive\";\n\nexport interface CellComponentProps {\n layout: LayoutType;\n cell: Cell;\n cells: Cell[];\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n transform: TransformLiteral;\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n activeTarget: ActiveTarget | null | undefined;\n readOnly?: boolean;\n unrelatedCells: Cell[];\n onCellsMoving?(info: MoveCellPayload[]): void;\n onCellsMoved?(info: MoveCellPayload[]): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget(target: ActiveTarget | null): void;\n onCellContextMenu(detail: CellContextMenuDetail): void;\n onCellClick?(detail: CellContextMenuDetail): void;\n onDecoratorTextEditing?(detail: { id: string; editing: boolean }): void;\n onDecoratorTextChange?(detail: DecoratorTextChangeDetail): void;\n onNodeBrickResize(id: string, size: SizeTuple | null): void;\n onCellMouseEnter?(cell: Cell): void;\n onCellMouseLeave?(cell: Cell): void;\n}\n\nexport function CellComponent({\n layout,\n cell,\n cells,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n lineConfMap,\n activeTarget,\n readOnly,\n transform,\n unrelatedCells,\n onCellsMoving,\n onCellsMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onCellContextMenu,\n onCellClick,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n onNodeBrickResize,\n onCellMouseEnter,\n onCellMouseLeave,\n}: CellComponentProps): JSX.Element | null {\n const gRef = useRef<SVGGElement>(null);\n\n const unrelated = useMemo(\n () => unrelatedCells.some((item) => sameTarget(item, cell)),\n [cell, unrelatedCells]\n );\n\n useEffect(() => {\n const g = gRef.current;\n if (!g) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n if (readOnly) {\n event.stopPropagation();\n } else {\n handleMouseDown(event, {\n layout,\n action: \"move\",\n cell,\n scale: transform.k,\n activeTarget,\n cells,\n onCellsMoving,\n onCellsMoved,\n onSwitchActiveTarget,\n });\n }\n };\n g.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n g.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n layout,\n cell,\n activeTarget,\n cells,\n onCellsMoved,\n onCellsMoving,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n const handleContextMenu = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n if (readOnly && cell.type === \"decorator\") {\n return;\n }\n event.preventDefault();\n onSwitchActiveTarget(cellToTarget(cell));\n onCellContextMenu({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n });\n },\n [cell, onCellContextMenu, onSwitchActiveTarget, readOnly]\n );\n\n const handleCellClick = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n if (!onCellClick || cell.type === \"decorator\") {\n return;\n }\n onCellClick({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n });\n },\n [cell, onCellClick]\n );\n\n const handleMouseEnter = useCallback(() => {\n onCellMouseEnter?.(cell);\n }, [cell, onCellMouseEnter]);\n\n const handleMouseLeave = useCallback(() => {\n onCellMouseLeave?.(cell);\n }, [cell, onCellMouseLeave]);\n\n return (\n <g\n className={classNames(\"cell\", {\n active: targetIsActive(cell, activeTarget),\n faded: unrelated,\n \"read-only\": readOnly,\n })}\n ref={gRef}\n transform={\n cell.type === \"edge\" || cell.view.x == null\n ? undefined\n : `translate(${cell.view.x} ${cell.view.y})`\n }\n onContextMenu={handleContextMenu}\n onClick={handleCellClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {isNodeCell(cell) ? (\n <NodeComponent\n node={cell}\n degraded={degraded}\n degradedNodeLabel={degradedNodeLabel}\n defaultNodeBricks={defaultNodeBricks}\n onResize={onNodeBrickResize}\n />\n ) : isEdgeCell(cell) ? (\n <EdgeComponent edge={cell} cells={cells} lineConfMap={lineConfMap} />\n ) : isDecoratorCell(cell) ? (\n <DecoratorComponent\n cell={cell}\n transform={transform}\n readOnly={readOnly}\n activeTarget={activeTarget}\n cells={cells}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n ) : null}\n </g>\n );\n}\n","export const SYMBOL_FOR_SIZE_INITIALIZED = Symbol.for(\"size-initialized\");\nexport const SYMBOL_FOR_LAYOUT_INITIALIZED = Symbol.for(\"layout-initialized\");\nexport const DEFAULT_NODE_SIZE = 20;\nexport const DEFAULT_NODE_GAP = 36;\nexport const DEFAULT_AREA_WIDTH = 100;\nexport const DEFAULT_AREA_HEIGHT = 60;\nexport const DEFAULT_SCALE_RANGE_MIN = 0.5;\nexport const DEFAULT_SCALE_RANGE_MAX = 2;\nexport const DEFAULT_LINE_STROKE_COLOR = \"gray\";\nexport const DEFAULT_LINE_STROKE_WIDTH = 1;\nexport const DEFAULT_LINE_INTERACT_STROKE_WIDTH = 15;\nexport const DEFAULT_LINE_INTERACT_SHOW_START_ARROW = false;\nexport const DEFAULT_LINE_INTERACT_SHOW_END_ARROW = true;\nexport const DEFAULT_LINE_INTERACT_ANIMATE_DURATION = 1;\nexport const DEFAULT_DEGRADED_THRESHOLD = 500;\n","import type {\n Cell,\n DecoratorCell,\n EdgeCell,\n InitialCell,\n InitialNodeCell,\n NodeCell,\n} from \"../interfaces\";\n\nexport function isNodeCell(cell: Cell): cell is NodeCell {\n return cell.type === \"node\";\n}\n\nexport function isDecoratorCell(cell: Cell): cell is DecoratorCell {\n return cell.type === \"decorator\";\n}\n\nexport function isInitialNodeCell(cell: InitialCell): cell is InitialNodeCell {\n return cell.type === \"node\";\n}\n\nexport function isEdgeCell(cell: Cell): cell is EdgeCell {\n return cell.type === \"edge\";\n}\n\nexport function isNodeOrEdgeCell(cell: Cell): cell is NodeCell | EdgeCell {\n return cell.type === \"node\" || cell.type === \"edge\";\n}\n\nexport function isNodeOrAreaDecoratorCell(\n cell: Cell\n): cell is NodeCell | DecoratorCell {\n return (\n cell.type === \"node\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\n}\n","import { pick } from \"lodash\";\nimport type { ActiveTargetOfSingular, Cell } from \"../interfaces\";\n\nexport function cellToTarget(cell: Cell): ActiveTargetOfSingular {\n return cell.type === \"edge\"\n ? pick(cell, [\"type\", \"source\", \"target\", \"data\"])\n : pick(cell, [\"type\", \"id\", \"data\"]);\n}\n","import type { ActiveTarget, Cell, ConnectLineState } from \"../interfaces\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nexport function getUnrelatedCells(\n cells: Cell[],\n connectLineState: ConnectLineState | null,\n activeTarget: ActiveTarget | null,\n allowEdgeToArea?: boolean\n): Cell[] {\n const unrelated: Cell[] = [];\n if (connectLineState) {\n const existedTargets = new Set<string>();\n for (const cell of cells) {\n if (cell.type === \"edge\" && cell.source === connectLineState.source.id) {\n existedTargets.add(cell.target);\n }\n }\n for (const cell of cells) {\n switch (cell.type) {\n case \"node\":\n if (existedTargets.has(cell.id)) {\n unrelated.push(cell);\n }\n break;\n case \"decorator\":\n if (\n !allowEdgeToArea ||\n cell.decorator == \"text\" ||\n existedTargets.has(cell.id)\n ) {\n unrelated.push(cell);\n }\n break;\n default:\n unrelated.push(cell);\n }\n }\n } else {\n switch (activeTarget?.type) {\n case \"multi\": {\n const nodesMap = new Map<string, Cell>();\n const activeNodeIds = new Set<string>();\n const relatedNodeIds = new Set<string>();\n for (const active of activeTarget.targets) {\n if (active.type === \"node\") {\n activeNodeIds.add(active.id);\n relatedNodeIds.add(active.id);\n }\n }\n for (const cell of cells) {\n if (cell.type === \"node\") {\n nodesMap.set(cell.id, cell);\n } else if (cell.type === \"edge\") {\n if (activeNodeIds.has(cell.source)) {\n relatedNodeIds.add(cell.target);\n } else if (activeNodeIds.has(cell.target)) {\n relatedNodeIds.add(cell.source);\n } else if (!targetIsActive(cell, activeTarget)) {\n unrelated.push(cell);\n }\n } else if (!targetIsActive(cell, activeTarget)) {\n unrelated.push(cell);\n }\n }\n for (const [id, cell] of nodesMap) {\n if (!relatedNodeIds.has(id)) {\n unrelated.push(cell);\n }\n }\n break;\n }\n\n case \"node\": {\n const nodesMap = new Map<string, Cell>();\n const relatedNodeIds = new Set<string>([activeTarget.id]);\n for (const cell of cells) {\n if (cell.type === \"node\") {\n nodesMap.set(cell.id, cell);\n } else if (cell.type === \"edge\") {\n if (cell.source === activeTarget.id) {\n relatedNodeIds.add(cell.target);\n } else if (cell.target === activeTarget.id) {\n relatedNodeIds.add(cell.source);\n } else {\n unrelated.push(cell);\n }\n } else {\n unrelated.push(cell);\n }\n }\n for (const [id, cell] of nodesMap) {\n if (!relatedNodeIds.has(id)) {\n unrelated.push(cell);\n }\n }\n break;\n }\n\n case \"edge\":\n for (const cell of cells) {\n if (\n !(cell.type === \"edge\"\n ? targetIsActive(cell, activeTarget)\n : cell.type === \"node\" &&\n (cell.id === activeTarget.source ||\n cell.id === activeTarget.target))\n ) {\n unrelated.push(cell);\n }\n }\n break;\n }\n }\n\n return unrelated;\n}\n","import type { SizeTuple } from \"../../diagram/interfaces\";\nimport type { Cell, InitialCell, NodeCell } from \"../interfaces\";\nimport { isInitialNodeCell } from \"./asserts\";\n\nexport function initializeCells(\n initialCells: InitialCell[] | undefined,\n {\n defaultNodeSize,\n }: {\n defaultNodeSize: SizeTuple;\n }\n): Cell[] {\n const originalCells = initialCells ?? [];\n const finalCells: Cell[] = originalCells.map<Cell>((cell) => {\n if (\n !isInitialNodeCell(cell) ||\n (cell.view?.width !== undefined && cell.view?.height !== undefined)\n ) {\n return cell as NodeCell;\n }\n return {\n ...cell,\n view: {\n width: defaultNodeSize[0],\n height: defaultNodeSize[1],\n ...cell.view,\n },\n } as NodeCell;\n });\n return finalCells;\n}\n","import type {\n ActiveTarget,\n ActiveTargetOfEdge,\n ActiveTargetOfMulti,\n ActiveTargetOfNode,\n} from \"../interfaces\";\n\nexport function sameTarget(\n a: ActiveTarget | null | undefined,\n b: ActiveTarget | null | undefined\n): boolean {\n return a\n ? !!b &&\n a.type === b.type &&\n (a.type === \"multi\"\n ? a.targets.length === (b as ActiveTargetOfMulti).targets.length &&\n a.targets.every((targetA) =>\n (b as ActiveTargetOfMulti).targets.some((targetB) =>\n sameTarget(targetA, targetB)\n )\n )\n : a.type === \"node\" || a.type === \"decorator\"\n ? a.id === (b as ActiveTargetOfNode).id\n : a.source === (b as ActiveTargetOfEdge).source &&\n a.target === (b as ActiveTargetOfEdge).target)\n : !b;\n}\n","import type { ActiveTarget, ActiveTargetOfSingular } from \"../interfaces\";\nimport { sameTarget } from \"./sameTarget\";\n\nexport function targetIsActive(\n target: ActiveTargetOfSingular,\n activeTarget: ActiveTarget | null | undefined\n): boolean {\n return (\n !!activeTarget &&\n (activeTarget.type === \"multi\"\n ? activeTarget.targets\n : [activeTarget]\n ).some((active) => sameTarget(active, target))\n );\n}\n","import type { TransformLiteral } from \"../../diagram/interfaces\";\nimport type { Cell } from \"../interfaces\";\nimport { isEdgeCell } from \"./asserts\";\n\nexport interface TransformToCenterOptions {\n canvasWidth: number;\n canvasHeight: number;\n scaleRange?: [min: number, max: number];\n}\n\nexport function transformToCenter(\n cells: Cell[],\n { canvasWidth, canvasHeight, scaleRange }: TransformToCenterOptions\n): TransformLiteral {\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n let empty = true;\n for (const cell of cells) {\n if (!isEdgeCell(cell)) {\n empty = false;\n const { view } = cell;\n const r = view.x + view.width;\n const b = view.y + view.height;\n if (view.x < left) {\n left = view.x;\n }\n if (r > right) {\n right = r;\n }\n if (view.y < top) {\n top = view.y;\n }\n if (b > bottom) {\n bottom = b;\n }\n }\n }\n\n const width = right - left;\n const height = bottom - top;\n\n const scale =\n scaleRange && !empty && (width > canvasWidth || height > canvasHeight)\n ? Math.max(\n Math.min(canvasWidth / width, canvasHeight / height, scaleRange[1]),\n scaleRange[0]\n )\n : 1;\n\n const x = empty ? 0 : (canvasWidth - width * scale) / 2 - left * scale;\n const y = empty ? 0 : (canvasHeight - height * scale) / 2 - top * scale;\n\n return { x, y, k: scale };\n}\n","import { without } from \"lodash\";\nimport type {\n RangeTuple,\n SizeTuple,\n TransformLiteral,\n} from \"../../diagram/interfaces\";\nimport { DEFAULT_NODE_GAP, SYMBOL_FOR_SIZE_INITIALIZED } from \"../constants\";\nimport type {\n Cell,\n InitialCell,\n LayoutType,\n NodeCell,\n NodeId,\n NodeView,\n} from \"../interfaces\";\nimport { isDecoratorCell, isEdgeCell, isNodeCell } from \"./asserts\";\nimport { initializeCells } from \"./initializeCells\";\nimport { transformToCenter } from \"./transformToCenter\";\nimport { forceLayout } from \"../../shared/canvas/forceLayout\";\nimport { dagreLayout } from \"../../shared/canvas/dagreLayout\";\nimport { sameTarget } from \"./sameTarget\";\n\nexport function updateCells({\n cells,\n layout,\n previousCells,\n defaultNodeSize,\n canvasWidth,\n canvasHeight,\n scaleRange,\n transform,\n reason,\n parent,\n}: {\n cells: InitialCell[] | undefined;\n layout?: LayoutType;\n previousCells: Cell[];\n defaultNodeSize: SizeTuple;\n canvasWidth: number;\n canvasHeight: number;\n scaleRange: RangeTuple;\n transform: TransformLiteral;\n reason?: \"add-related-nodes\";\n parent?: NodeId;\n}): {\n cells: Cell[];\n updated: Cell[];\n shouldReCenter: boolean;\n} {\n const isManualLayout = layout !== \"force\" && layout !== \"dagre\";\n const newCells = initializeCells(cells, { defaultNodeSize });\n const updateCandidates: NodeCell[] = [];\n let shouldReCenter = false;\n\n const previousSizeInitializedNodes = new Map<string, NodeCell>();\n let previousShouldCentered = false;\n for (const cell of previousCells) {\n if (isDecoratorCell(cell)) {\n previousShouldCentered = true;\n } else if (isNodeCell(cell)) {\n previousShouldCentered = true;\n if (cell[SYMBOL_FOR_SIZE_INITIALIZED]) {\n previousSizeInitializedNodes.set(cell.id, cell);\n }\n }\n }\n\n const nodesMap = new Map<string, NodeCell>();\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n nodesMap.set(cell.id, cell);\n const previousNode = previousSizeInitializedNodes.get(cell.id);\n if (previousNode) {\n cell.view.width = previousNode.view.width;\n cell.view.height = previousNode.view.height;\n cell[SYMBOL_FOR_SIZE_INITIALIZED] = true;\n }\n }\n }\n\n let handled = false;\n\n if (reason === \"add-related-nodes\" && parent) {\n // Place these unpositioned downstream nodes below the parent node, and\n // on the right side of the positioned siblings.\n const downstreamNodeIds = new Set<string>();\n for (const cell of newCells) {\n if (\n isEdgeCell(cell) &&\n cell.source === parent &&\n cell.target !== parent\n ) {\n downstreamNodeIds.add(cell.target);\n }\n }\n const parentNode = nodesMap.get(parent);\n if (parentNode?.view.x !== undefined && parentNode.view.y !== undefined) {\n handled = true;\n const downstreamNodes = [...downstreamNodeIds]\n .map((id) => nodesMap.get(id))\n .filter(Boolean) as NodeCell[];\n let rightMostNode: NodeCell | undefined = undefined;\n for (const node of downstreamNodes) {\n if (node.view.x !== undefined && node.view.y !== undefined) {\n // Find the rightmost node that is below the parent node.\n if (\n (!rightMostNode || node.view.x > rightMostNode.view.x) &&\n node.view.y > parentNode.view.y\n ) {\n rightMostNode = node;\n }\n } else {\n // Unpositioned nodes\n updateCandidates.push(node);\n }\n }\n if (updateCandidates.length > 0 && isManualLayout) {\n let nextX: number;\n let nextY: number;\n if (rightMostNode) {\n // Place unpositioned nodes on the right side of the rightmost positioned siblings.\n nextX =\n rightMostNode.view.x + rightMostNode.view.width + DEFAULT_NODE_GAP;\n nextY = rightMostNode.view.y;\n } else {\n // If there are no positioned siblings, just place them below the parent.\n const totalWidth = updateCandidates.reduce(\n (acc, node) => acc + node.view.width + DEFAULT_NODE_GAP,\n -DEFAULT_NODE_GAP\n );\n nextX =\n parentNode.view.x - totalWidth / 2 + parentNode.view.width / 2;\n nextY = parentNode.view.y + parentNode.view.height + DEFAULT_NODE_GAP;\n }\n for (const node of updateCandidates) {\n node.view.x = nextX;\n node.view.y = nextY;\n nextX += node.view.width + DEFAULT_NODE_GAP;\n }\n }\n }\n }\n\n if (!handled) {\n // By default, place unpositioned nodes in a grid.\n let maxWidth = defaultNodeSize[0];\n let maxHeight = defaultNodeSize[1];\n const positionedNodes: NodeCell[] = [];\n let hasDecorators = false;\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n if (cell.view.width > maxWidth) {\n maxWidth = cell.view.width;\n }\n if (cell.view.height > maxHeight) {\n maxHeight = cell.view.height;\n }\n if (cell.view.x === undefined || cell.view.y === undefined) {\n updateCandidates.push(cell);\n } else {\n positionedNodes.push(cell);\n }\n } else if (isDecoratorCell(cell)) {\n hasDecorators = true;\n }\n }\n\n if (isManualLayout) {\n if (!previousShouldCentered) {\n // If the previous cells are not centered, use the centered transform instead.\n transform = transformToCenter(without(newCells, ...updateCandidates), {\n canvasWidth,\n canvasHeight,\n scaleRange,\n });\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n\n // If there is no positioned nodes, or only one while without decorators,\n // then there is no relative positions, we can place the nodes with dagre layout.\n // Otherwise, use the force layout.\n if (\n positionedNodes.length === 0 ||\n (positionedNodes.length === 1 && !hasDecorators)\n ) {\n // The positioned node (if exists) will be updated.\n updateCandidates.push(...positionedNodes);\n ({ getNodeView } = dagreLayout({ cells: newCells }));\n // Only re-center when there is no cells previous,\n // or the cell ids are not changed (this happens when updateCells called by backend right after dropNode).\n shouldReCenter =\n previousCells.length === 0 ||\n (previousCells.length === newCells.length &&\n previousCells.every((cell, index) =>\n sameTarget(cell, newCells[index])\n ));\n } else {\n ({ getNodeView } = forceLayout({\n cells: newCells,\n fixedPosition: true,\n center: [\n (canvasWidth / 2 - transform.x) / transform.k,\n (canvasHeight / 2 - transform.y) / transform.k,\n ],\n }));\n }\n\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n const view = getNodeView(cell.id);\n cell.view.x = view.x;\n cell.view.y = view.y;\n }\n }\n }\n }\n\n return { cells: newCells, updated: updateCandidates, shouldReCenter };\n}\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\nimport type { Cell, NodeCell } from \"../interfaces\";\nimport { isNodeCell } from \"../processors/asserts\";\nimport { SYMBOL_FOR_SIZE_INITIALIZED } from \"../constants\";\n\nexport const cells: Reducer<Cell[], DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"drop-node\":\n return insertCellAfter(\n state,\n action.payload,\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n );\n case \"drop-decorator\": {\n if (action.payload.decorator === \"text\") {\n return [...state, action.payload];\n }\n return insertCellAfter(\n state,\n action.payload,\n (cell) => cell.type === \"decorator\" && cell.decorator === \"area\"\n );\n }\n case \"add-nodes\": {\n const index =\n state.findLastIndex(\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n ) + 1;\n return [\n ...state.slice(0, index),\n ...action.payload,\n ...state.slice(index),\n ];\n }\n case \"add-edge\":\n // Add the edge to just next to the previous last edge or area decorator.\n // If not found, append to the start.\n return insertCellAfter(\n state,\n action.payload,\n (cell) =>\n cell.type === \"edge\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\n case \"move-cells\": {\n let matched = false;\n const newState = state.map((cell) => {\n const newCell = action.payload.find(\n (move) => cell.type === move.type && cell.id === move.id\n );\n if (newCell) {\n matched = true;\n return {\n ...cell,\n view: { ...(cell as NodeCell).view, x: newCell.x, y: newCell.y },\n };\n }\n return cell;\n });\n return matched ? newState : state;\n }\n case \"resize-cell\": {\n const { type, id, width, height } = action.payload;\n const index = state.findIndex(\n (cell) => cell.type === type && cell.id === id\n );\n if (index !== -1) {\n const node = state[index] as NodeCell;\n return [\n ...state.slice(0, index),\n { ...node, view: { ...node.view, width, height } },\n ...state.slice(index + 1),\n ];\n }\n return state;\n }\n case \"update-cells\":\n return action.payload;\n case \"update-node-size\":\n return state.map((cell) =>\n isNodeCell(cell) && cell.id === action.payload.id\n ? {\n ...cell,\n [SYMBOL_FOR_SIZE_INITIALIZED]: true,\n view: action.payload.size\n ? {\n ...cell.view,\n width: action.payload.size[0],\n height: action.payload.size[1],\n }\n : cell.view,\n }\n : cell\n );\n }\n return state;\n};\n\nfunction insertCellAfter(\n cells: Cell[],\n newCell: Cell,\n after: (cell: Cell) => boolean\n) {\n const index = cells.findLastIndex(after) + 1;\n return [...cells.slice(0, index), newCell, ...cells.slice(index)];\n}\n","import { Reducer } from \"react\";\nimport type { DrawCanvasAction, DrawCanvasState } from \"./interfaces\";\nimport { cells } from \"./cells\";\nimport { layoutKey } from \"./layoutKey\";\n\ntype ReducersMapObject<S, A> = {\n [K in keyof S]: Reducer<S[K], A>;\n};\n\nfunction combineReducers<S, A>(\n reducers: ReducersMapObject<S, A>\n): Reducer<S, A> {\n return ((state, action) =>\n Object.fromEntries(\n Object.entries<Reducer<any, A>>(reducers).map(([key, value]) => [\n key,\n value(state[key as keyof S], action),\n ])\n )) as Reducer<S, A>;\n}\n\nexport const rootReducer = combineReducers<DrawCanvasState, DrawCanvasAction>({\n cells,\n layoutKey,\n});\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\n\nexport const layoutKey: Reducer<number, DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"update-node-size\":\n return action.layoutKey;\n default:\n return state;\n }\n};\n","import * as React from \"react\";\nconst SvgCenter = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={24} height={24} viewBox=\"0 0 24 24\" {...props}><path d=\"M12 0a.5.5 0 0 1 .5.5v2.013a9.5 9.5 0 0 1 8.987 8.988L23.5 11.5a.5.5 0 0 1 0 1h-2.013a9.5 9.5 0 0 1-8.987 8.987V23.5a.5.5 0 0 1-1 0v-2.013A9.5 9.5 0 0 1 2.514 12.5H.5a.5.5 0 0 1 0-1h2.013A9.5 9.5 0 0 1 11.5 2.514V.5A.5.5 0 0 1 12 0M3.514 11.5H7.5a.5.5 0 0 1 0 1H3.514a8.5 8.5 0 0 0 7.987 7.986L11.5 16.5a.5.5 0 0 1 1 0v3.986a8.5 8.5 0 0 0 7.986-7.986H16.5a.5.5 0 0 1 0-1h3.986A8.5 8.5 0 0 0 12.5 3.515V7.5a.5.5 0 0 1-1 0V3.514a8.5 8.5 0 0 0-7.986 7.987zm8.486-1a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3\" /></svg>;\nexport default SvgCenter;","import * as React from \"react\";\nconst SvgZoomIn = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={128} height={128} className=\"icon\" viewBox=\"0 0 1024 1024\" {...props}><path d=\"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384\" /><path d=\"M744.448 486.4h-204.8V281.6a25.6 25.6 0 1 0-51.2 0v204.8h-204.8a25.6 25.6 0 0 0 0 51.2h204.8v204.8a25.6 25.6 0 0 0 51.2 0V537.6h204.8a25.6 25.6 0 0 0 0-51.2\" /></svg>;\nexport default SvgZoomIn;","import * as React from \"react\";\nconst SvgZoomOut = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={128} height={128} className=\"icon\" viewBox=\"0 0 1024 1024\" {...props}><path d=\"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384\" /><path d=\"M744.448 486.4H280.064a25.6 25.6 0 1 0 0 51.2h464.384a25.6 25.6 0 0 0 0-51.2\" /></svg>;\nexport default SvgZoomOut;","import React, { useCallback, useMemo, useRef } from \"react\";\nimport { ConfigProvider, Slider, theme } from \"antd\";\nimport { StyleProvider, createCache } from \"@ant-design/cssinjs\";\nimport { useCurrentTheme } from \"@next-core/react-runtime\";\nimport type { RangeTuple } from \"../../diagram/interfaces\";\nimport CenterSVG from \"./icons/center.svg\";\nimport ZoomInSVG from \"./icons/zoom-in.svg\";\nimport ZoomOutSVG from \"./icons/zoom-out.svg\";\n\nexport interface ZoomBarComponentProps {\n shadowRoot: ShadowRoot;\n scale: number;\n scaleRange: RangeTuple;\n onZoomChange(value: number): void;\n onReCenter(): void;\n}\n\nexport function ZoomBarComponent({\n shadowRoot,\n scale,\n scaleRange,\n onZoomChange,\n onReCenter,\n}: ZoomBarComponentProps): JSX.Element | null {\n const currentTheme = useCurrentTheme();\n const cache = useMemo(() => createCache(), []);\n const zoomBarRef = useRef<HTMLDivElement | null>(null);\n const min = scaleRange[0] * 100;\n const max = scaleRange[1] * 100;\n const value = scale * 100;\n const step = 5;\n\n const tooltip = useMemo(() => {\n return {\n formatter: (value: number | undefined) => `${value}%`,\n placement: \"left\" as const,\n getPopupContainer: () => zoomBarRef.current!,\n };\n }, []);\n\n const onZoomIn = useCallback(() => {\n onZoomChange(Math.min(value + step, max));\n }, [max, onZoomChange, value]);\n\n const onZoomOut = useCallback(() => {\n onZoomChange(Math.max(value - step, min));\n }, [min, onZoomChange, value]);\n\n return (\n <ConfigProvider\n theme={{\n algorithm:\n currentTheme === \"dark-v2\"\n ? theme.darkAlgorithm\n : theme.defaultAlgorithm,\n }}\n >\n <StyleProvider\n container={shadowRoot}\n // Auto clear injected styles after unmount\n autoClear\n cache={cache}\n // Set hashPriority to \"high\" to disable `:where()` usage for compatibility\n hashPriority=\"high\"\n >\n <div className=\"zoom-bar\" ref={zoomBarRef}>\n <div className=\"center-button\" onClick={onReCenter} role=\"button\">\n <CenterSVG />\n </div>\n <div className=\"zoom-slider\">\n <div className=\"zoom-button\" role=\"button\" onClick={onZoomIn}>\n <ZoomInSVG />\n </div>\n <Slider\n min={min}\n max={max}\n value={value}\n step={step}\n vertical\n included={false}\n tooltip={tooltip}\n onChange={onZoomChange}\n />\n <div className=\"zoom-button\" role=\"button\" onClick={onZoomOut}>\n <ZoomOutSVG />\n </div>\n </div>\n </div>\n </StyleProvider>\n </ConfigProvider>\n );\n}\n","import { pick } from \"lodash\";\nimport dagre from \"@dagrejs/dagre\";\nimport { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\nimport type {\n Cell,\n ForceNode,\n LayoutOptionsDagre,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport { isEdgeCell, isNodeCell } from \"../../draw-canvas/processors/asserts\";\nimport type { FullRectTuple } from \"../../diagram/interfaces\";\n\nexport interface DagreLayoutOptions {\n cells: Cell[];\n layoutOptions?: LayoutOptionsDagre;\n}\n\nexport function dagreLayout({ cells, layoutOptions }: DagreLayoutOptions): {\n getNodeView: (id: NodeId) => NodeView;\n nodePaddings: FullRectTuple;\n} {\n const { nodePadding, ...dagreGraphOptions } = {\n nodePadding: 0,\n rankdir: \"TB\",\n ranksep: 50,\n edgesep: 10,\n nodesep: 50,\n // align: undefined,\n ...pick(layoutOptions, [\n \"nodePadding\",\n \"rankdir\",\n \"ranksep\",\n \"edgesep\",\n \"nodesep\",\n \"align\",\n ]),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n\n if (!cells.some(isNodeCell)) {\n // Dagre cannot render empty nodes\n return {\n getNodeView: () => null!,\n nodePaddings,\n };\n }\n\n const graph = new dagre.graphlib.Graph<ForceNode>();\n graph.setGraph(dagreGraphOptions);\n // Default to assigning a new object as a label for each new edge.\n graph.setDefaultEdgeLabel(function () {\n return {};\n });\n for (const cell of cells) {\n if (isNodeCell(cell)) {\n graph.setNode(cell.id, {\n id: cell.id,\n width: cell.view.width + nodePaddings[1] + nodePaddings[3],\n height: cell.view.height + nodePaddings[0] + nodePaddings[2],\n });\n } else if (isEdgeCell(cell)) {\n graph.setEdge(cell.source, cell.target);\n }\n }\n dagre.layout(graph);\n\n return {\n getNodeView: (id: NodeId) => graph.node(id),\n nodePaddings,\n };\n}\n","import { pick } from \"lodash\";\nimport {\n forceCollide,\n forceLink,\n forceManyBody,\n forceSimulation,\n forceX,\n forceY,\n type Simulation,\n} from \"d3-force\";\nimport type {\n Cell,\n ForceCollideOptions,\n ForceLink,\n ForceNode,\n LayoutOptionsForce,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport { isEdgeCell, isNodeCell } from \"../../draw-canvas/processors/asserts\";\nimport { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\nimport type { FullRectTuple, PositionTuple } from \"../../diagram/interfaces\";\n\nexport interface ForceLayoutOptions {\n cells: Cell[];\n layoutOptions?: LayoutOptionsForce;\n center?: PositionTuple;\n fixedPosition?: boolean;\n}\n\nexport function forceLayout({\n cells,\n layoutOptions,\n center,\n fixedPosition,\n}: ForceLayoutOptions): {\n getNodeView: (id: NodeId) => NodeView;\n nodePaddings: FullRectTuple;\n} {\n const { nodePadding, collide } = {\n nodePadding: 0,\n ...pick(layoutOptions, [\"nodePadding\"]),\n collide:\n layoutOptions?.collide !== false\n ? ({\n radiusDiff: 18,\n strength: 1,\n iterations: 1,\n ...(layoutOptions?.collide === true\n ? null\n : (layoutOptions?.collide as ForceCollideOptions)),\n } as Required<ForceCollideOptions>)\n : (false as const),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n const forceNodes: ForceNode[] = [];\n const forceLinks: ForceLink[] = [];\n const nodesMap = new Map<NodeId, ForceNode>();\n for (const cell of cells) {\n if (isNodeCell(cell)) {\n const node: ForceNode = {\n id: cell.id,\n width: cell.view.width + nodePaddings[1] + nodePaddings[3],\n height: cell.view.height + nodePaddings[0] + nodePaddings[2],\n ...(fixedPosition ? { fx: cell.view.x, fy: cell.view.y } : null),\n };\n forceNodes.push(node);\n nodesMap.set(node.id, node);\n } else if (isEdgeCell(cell)) {\n forceLinks.push({ source: cell.source, target: cell.target });\n }\n }\n\n const linkSimulation = forceLink<ForceNode, ForceLink>(forceLinks).id(\n (d) => d.id\n );\n const simulation = forceSimulation<ForceNode, ForceLink>(forceNodes)\n .force(\"link\", linkSimulation)\n .force(\"x\", forceX(center?.[0]))\n .force(\"y\", forceY(center?.[1]))\n .force(\"charge\", forceManyBody());\n\n if (collide) {\n simulation.force(\n \"collide\",\n forceCollide<ForceNode>()\n .radius(\n (d) =>\n Math.sqrt(d.width ** 2 + d.height ** 2) / 2 + collide.radiusDiff\n )\n .strength(collide.strength)\n .iterations(collide.iterations)\n );\n }\n\n simulation.stop();\n manuallyTickToTheEnd(simulation);\n\n return {\n getNodeView: (id: NodeId) => nodesMap.get(id) as NodeView,\n nodePaddings,\n };\n}\n\nfunction manuallyTickToTheEnd(\n simulation: Simulation<ForceNode, ForceLink>\n): void {\n // Manually tick to the end.\n simulation.tick(\n Math.ceil(\n Math.log(simulation.alphaMin()) / Math.log(1 - simulation.alphaDecay())\n )\n );\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport type { ActiveTarget } from \"../../draw-canvas/interfaces\";\nimport { sameTarget } from \"../../draw-canvas/processors/sameTarget\";\n\nexport interface UseActiveTargetOptions {\n cellsRef: React.RefObject<SVGGElement>;\n activeTarget?: ActiveTarget | null;\n onActiveTargetChange(target: ActiveTarget | null): void;\n}\n\nexport type UseActiveTargetResult = ActiveTarget | null;\n\nexport function useActiveTarget({\n cellsRef,\n activeTarget: _activeTarget,\n onActiveTargetChange,\n}: UseActiveTargetOptions): UseActiveTargetResult {\n const newActiveTarget = _activeTarget ?? null;\n const [activeTarget, setActiveTarget] = useState<ActiveTarget | null>(\n newActiveTarget\n );\n\n useEffect(() => {\n setActiveTarget((previous) =>\n sameTarget(previous, newActiveTarget) ? previous : newActiveTarget\n );\n }, [newActiveTarget]);\n\n const activeTargetChangeInitialized = useRef(false);\n useEffect(() => {\n if (!activeTargetChangeInitialized.current) {\n activeTargetChangeInitialized.current = true;\n return;\n }\n onActiveTargetChange(activeTarget);\n }, [activeTarget, onActiveTargetChange]);\n\n useEffect(() => {\n if (!activeTarget) {\n return;\n }\n const resetActiveTarget = (e: MouseEvent) => {\n const path = e.composedPath();\n const cellsContainerIndex = path.indexOf(cellsRef.current!);\n // Reset active target to null when clicking outside of the cells container,\n // Or inside the cells container but not on any cell.\n if (cellsContainerIndex <= 0) {\n setActiveTarget(null);\n }\n };\n document.addEventListener(\"click\", resetActiveTarget);\n return () => {\n document.removeEventListener(\"click\", resetActiveTarget);\n };\n }, [activeTarget, cellsRef]);\n\n return activeTarget;\n}\n","import type { AlignOrigin, NormalizedAlignOrigin } from \"../interfaces\";\n\nconst KeywordMap = new Map([\n [\"center\", 0.5],\n [\"left\", 0],\n [\"right\", 1],\n [\"top\", 0],\n [\"bottom\", 1],\n]);\n\nexport function normalizeAlignOrigin(\n alignOrigin: AlignOrigin | undefined\n): NormalizedAlignOrigin {\n const origin = alignOrigin ?? [0.5, 0.5];\n return [\n normalizeAlignAxis(origin[0], \"x\"),\n normalizeAlignAxis(origin[1], \"y\"),\n ];\n}\n\nfunction normalizeAlignAxis(value: string | number, axis: \"x\" | \"y\"): number {\n if (typeof value === \"string\") {\n const newX = KeywordMap.get(value);\n if (newX !== undefined) {\n return newX;\n }\n const matches = value.match(/^(-?\\d+(?:\\.\\d+)?)%$/);\n if (matches) {\n return Number(matches[1]) / 100;\n }\n // eslint-disable-next-line no-console\n console.error(\"Unexpected align origin %s:\", axis, value);\n } else if (typeof value === \"number\") {\n return value;\n } else {\n // eslint-disable-next-line no-console\n console.error(\n \"Unexpected align origin %s, expected %s, received %s:\",\n axis,\n \"string | number\",\n typeof value,\n value\n );\n }\n\n return 0.5;\n}\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { ZoomBehavior } from \"d3-zoom\";\nimport type {\n Cell,\n LayoutOptions,\n LayoutOptionsForce,\n LayoutOptionsDagre,\n LayoutType,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport type { FullRectTuple, RangeTuple } from \"../../diagram/interfaces\";\nimport { useAutoCenter } from \"./useAutoCenter\";\nimport {\n isNodeCell,\n isNodeOrEdgeCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport {\n SYMBOL_FOR_LAYOUT_INITIALIZED,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../../draw-canvas/constants\";\nimport type { DrawCanvasAction } from \"../../draw-canvas/reducers/interfaces\";\nimport { forceLayout } from \"./forceLayout\";\nimport { dagreLayout } from \"./dagreLayout\";\nimport { normalizeAlignOrigin } from \"../../draw-canvas/processors/normalizeAlignOrigin\";\n\nexport interface UseLayoutOptions {\n layout: LayoutType;\n layoutOptions?: LayoutOptions;\n rootRef: React.RefObject<SVGSVGElement>;\n cells: Cell[];\n zoomable?: boolean;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n scaleRange: RangeTuple;\n layoutKey: number;\n dispatch: (value: DrawCanvasAction) => void;\n}\n\nexport function useLayout({\n layout,\n layoutOptions,\n rootRef,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n layoutKey,\n dispatch,\n}: UseLayoutOptions) {\n const [layoutInitialized, setLayoutInitialized] = useState(\n layout !== \"force\" && layout !== \"dagre\"\n );\n\n const layoutKeyRef = useRef(layoutKey);\n\n const getNextLayoutKey = useCallback(() => {\n return ++layoutKeyRef.current;\n }, []);\n\n const [centered, setCentered] = useAutoCenter({\n rootRef,\n layoutInitialized,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n });\n\n const previousLayoutRef = useRef<Cell[] | null>(null);\n\n useEffect(() => {\n // Wait for all nodes to be size-initialized before layout.\n if (\n cells.some(\n (cell) => isNodeCell(cell) && !cell[SYMBOL_FOR_SIZE_INITIALIZED]\n ) ||\n // Skip layout if no cells.\n cells.length === 0\n ) {\n return;\n }\n\n if (layout !== \"force\" && layout !== \"dagre\") {\n setLayoutInitialized(true);\n return;\n }\n\n // DO NOT re-layout if layout key mismatched.\n // DO NOT re-layout if nodes and edges not changed.\n if (\n layoutKeyRef.current !== layoutKey ||\n isSameArray(previousLayoutRef.current, cells.filter(isNodeOrEdgeCell))\n ) {\n // Layout key mismatch happens when this effect is performed after\n // update-node-size dispatched but not yet applied.\n // If didn't ignore mismatched layout, it will cause the update-cells\n // action overwrites those update-node-size actions.\n return;\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n let nodePaddings: FullRectTuple;\n\n if (layout === \"force\") {\n ({ getNodeView, nodePaddings } = forceLayout({\n cells,\n layoutOptions: layoutOptions as LayoutOptionsForce,\n }));\n } else {\n ({ getNodeView, nodePaddings } = dagreLayout({\n cells,\n layoutOptions: layoutOptions as LayoutOptionsDagre,\n }));\n }\n\n const alignOrigin = normalizeAlignOrigin(layoutOptions?.alignOrigin);\n\n const newCells: Cell[] = cells.map((cell) => {\n if (isNodeCell(cell)) {\n const nodeView = getNodeView(cell.id);\n return {\n ...cell,\n view: {\n ...cell.view,\n x: nodeView.x! - nodeView.width * alignOrigin[0] + nodePaddings[3],\n y: nodeView.y! - nodeView.height * alignOrigin[1] + nodePaddings[0],\n },\n [SYMBOL_FOR_LAYOUT_INITIALIZED]: true,\n };\n }\n return cell;\n });\n previousLayoutRef.current = newCells.filter(isNodeOrEdgeCell);\n\n dispatch({ type: \"update-cells\", payload: newCells });\n // setCentered(false);\n setLayoutInitialized(true);\n }, [cells, dispatch, layout, layoutKey, layoutOptions /* , setCentered */]);\n\n return { centered, setCentered, getNextLayoutKey };\n}\n\nfunction isSameArray<T = unknown>(a: T[] | null, b: T[]): boolean {\n return a?.length === b.length && a.every((v, i) => v === b[i]);\n}\n","import React, { useEffect, useState } from \"react\";\nimport { select } from \"d3-selection\";\nimport { ZoomTransform, type ZoomBehavior } from \"d3-zoom\";\nimport type { RangeTuple } from \"../../diagram/interfaces\";\nimport { SYMBOL_FOR_SIZE_INITIALIZED } from \"../../draw-canvas/constants\";\nimport type { Cell } from \"../../draw-canvas/interfaces\";\nimport {\n isDecoratorCell,\n isNodeCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport { transformToCenter } from \"../../draw-canvas/processors/transformToCenter\";\n\nexport interface UseAutoCenterOptions {\n rootRef: React.RefObject<SVGSVGElement>;\n cells: Cell[];\n layoutInitialized: boolean;\n zoomable?: boolean;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n scaleRange: RangeTuple;\n}\n\nexport type UseAutoCenterResult = [\n centered: boolean,\n setCentered: React.Dispatch<React.SetStateAction<boolean>>,\n];\n\nexport function useAutoCenter({\n rootRef,\n cells,\n layoutInitialized,\n zoomable,\n zoomer,\n scaleRange,\n}: UseAutoCenterOptions): UseAutoCenterResult {\n const [centered, setCentered] = useState(false);\n\n useEffect(() => {\n const root = rootRef.current;\n if (\n !root ||\n !layoutInitialized ||\n centered ||\n !cells.some((cell) => isNodeCell(cell) || isDecoratorCell(cell)) ||\n cells.some(\n (cell) => isNodeCell(cell) && !cell[SYMBOL_FOR_SIZE_INITIALIZED]\n )\n ) {\n return;\n }\n const { k, x, y } = transformToCenter(cells, {\n canvasWidth: root.clientWidth,\n canvasHeight: root.clientHeight,\n scaleRange: zoomable ? scaleRange : undefined,\n });\n // istanbul ignore next\n if (process.env.NODE_ENV !== \"test\") {\n // jsdom doesn't support svg baseVal yet.\n // https://github.com/jsdom/jsdom/issues/2531\n zoomer.transform(select(root), new ZoomTransform(k, x, y));\n }\n setCentered(true);\n }, [\n cells,\n centered,\n layoutInitialized,\n rootRef,\n scaleRange,\n zoomable,\n zoomer,\n ]);\n\n useEffect(() => {\n // Reset auto centering when nodes and decorators are all removed.\n if (!cells.some((cell) => isNodeCell(cell) || isDecoratorCell(cell))) {\n setCentered(false);\n }\n }, [cells]);\n\n return [centered, setCentered];\n}\n","import { useMemo } from \"react\";\nimport { __secret_internals, checkIfByTransform } from \"@next-core/runtime\";\nimport { findIndex, isUndefined, omitBy } from \"lodash\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n EdgeCell,\n EdgeLineConf,\n LineMarker,\n} from \"../../draw-canvas/interfaces\";\nimport { isEdgeCell } from \"../../draw-canvas/processors/asserts\";\nimport {\n DEFAULT_LINE_STROKE_COLOR,\n DEFAULT_LINE_STROKE_WIDTH,\n DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n DEFAULT_LINE_INTERACT_SHOW_START_ARROW,\n DEFAULT_LINE_INTERACT_SHOW_END_ARROW,\n DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n} from \"../../draw-canvas/constants\";\n\nexport interface UseLineMarkersOptions {\n cells: Cell[];\n defaultEdgeLines: EdgeLineConf[] | undefined;\n markerPrefix: string;\n}\n\nexport function useLineMarkers({\n cells,\n defaultEdgeLines,\n markerPrefix,\n}: UseLineMarkersOptions): [\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>,\n markers: LineMarker[],\n] {\n return useMemo(() => {\n // Always put the default stroke marker at the first position,\n // since the connecting line will use it.\n const markers: LineMarker[] = [{ strokeColor: DEFAULT_LINE_STROKE_COLOR }];\n const map = new WeakMap<EdgeCell, ComputedEdgeLineConf>();\n for (const cell of cells) {\n if (isEdgeCell(cell)) {\n const computedLineConf =\n __secret_internals.legacyDoTransform(\n { edge: cell },\n defaultEdgeLines?.find((item) =>\n checkIfByTransform(item, { edge: cell })\n )\n ) ?? {};\n const lineConf = {\n dashed: false,\n strokeColor: DEFAULT_LINE_STROKE_COLOR,\n strokeWidth: DEFAULT_LINE_STROKE_WIDTH,\n interactStrokeWidth: DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n showStartArrow: DEFAULT_LINE_INTERACT_SHOW_START_ARROW,\n showEndArrow: DEFAULT_LINE_INTERACT_SHOW_END_ARROW,\n animate: {\n useAnimate: false,\n duration: DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n },\n ...omitBy(computedLineConf, isUndefined),\n } as ComputedEdgeLineConf;\n if (lineConf.parallelGap === undefined) {\n lineConf.parallelGap = lineConf.interactStrokeWidth;\n }\n const markerEndIndex = addMarker(\n { strokeColor: lineConf.strokeColor },\n markers\n );\n lineConf.markerArrow = `url(#${markerPrefix}${markerEndIndex})`;\n map.set(cell, lineConf);\n }\n }\n return [map, markers];\n }, [cells, defaultEdgeLines, markerPrefix]);\n}\n\nfunction addMarker(marker: LineMarker, markers: LineMarker[]): number {\n let markerIndex = findIndex(markers, marker);\n if (markerIndex === -1) {\n markerIndex = markers.push(marker) - 1;\n }\n return markerIndex;\n}\n","import { useMemo } from \"react\";\nimport type { Cell, LayoutType } from \"../../draw-canvas/interfaces\";\nimport { isNodeCell } from \"../../draw-canvas/processors/asserts\";\nimport {\n SYMBOL_FOR_LAYOUT_INITIALIZED,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../../draw-canvas/constants\";\n\nexport interface UseReadyOptions {\n cells: Cell[];\n layout: LayoutType;\n centered: boolean;\n}\n\nexport function useReady({ cells, layout, centered }: UseReadyOptions) {\n const ready = useMemo(\n () =>\n centered &&\n cells.every(\n (cell) =>\n !isNodeCell(cell) ||\n (cell[SYMBOL_FOR_SIZE_INITIALIZED] &&\n ((layout !== \"force\" && layout !== \"dagre\") ||\n cell[SYMBOL_FOR_LAYOUT_INITIALIZED]))\n ),\n [cells, centered, layout]\n );\n return ready;\n}\n","import React, { useEffect, useMemo, useState } from \"react\";\nimport { select } from \"d3-selection\";\nimport { zoom, type ZoomBehavior } from \"d3-zoom\";\nimport type { RangeTuple, TransformLiteral } from \"../../diagram/interfaces\";\nimport {\n DEFAULT_SCALE_RANGE_MIN,\n DEFAULT_SCALE_RANGE_MAX,\n} from \"../../draw-canvas/constants\";\nimport type { ActiveTarget } from \"../../draw-canvas/interfaces\";\n\nexport interface UseZoomOptions {\n rootRef: React.RefObject<SVGSVGElement>;\n zoomable?: boolean;\n scrollable?: boolean;\n pannable?: boolean;\n draggable?: boolean;\n scaleRange?: RangeTuple;\n onSwitchActiveTarget?(target: ActiveTarget | null): void;\n}\n\nexport interface UseZoomResult {\n grabbing: boolean;\n transform: TransformLiteral;\n scaleRange: RangeTuple;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n}\n\nexport function useZoom({\n rootRef,\n zoomable,\n scrollable,\n pannable,\n draggable,\n scaleRange: _scaleRange,\n onSwitchActiveTarget,\n}: UseZoomOptions): UseZoomResult {\n const [grabbing, setGrabbing] = useState(false);\n const [transform, setTransform] = useState<TransformLiteral>({\n k: 1,\n x: 0,\n y: 0,\n });\n\n const scaleRange = useMemo(\n () =>\n _scaleRange ??\n ([DEFAULT_SCALE_RANGE_MIN, DEFAULT_SCALE_RANGE_MAX] as RangeTuple),\n [_scaleRange]\n );\n\n const zoomer = useMemo(() => zoom<SVGSVGElement, unknown>(), []);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n let moved = false;\n zoomer\n .scaleExtent(zoomable ? scaleRange : [1, 1])\n .on(\"start\", () => {\n moved = false;\n setGrabbing(true);\n })\n .on(\"zoom\", (e: { transform: TransformLiteral }) => {\n moved = true;\n setTransform(e.transform);\n })\n .on(\"end\", () => {\n setGrabbing(false);\n if (!moved) {\n onSwitchActiveTarget?.(null);\n }\n });\n }, [onSwitchActiveTarget, scaleRange, zoomable, zoomer]);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n const root = rootRef.current;\n if (!root) {\n return;\n }\n\n const rootSelection = select(root);\n\n const unsetZoom = () => {\n rootSelection\n .on(\".zoom\", null)\n .on(\".zoom.custom\", null)\n .on(\"wheel\", null);\n };\n\n if (!(zoomable || scrollable || pannable)) {\n unsetZoom();\n return;\n }\n\n if (zoomable || scrollable) {\n // Do not override default d3 zoom handler.\n // Only handles *panning*\n rootSelection.on(\n \"wheel.zoom.custom\",\n (e: WheelEvent & { wheelDeltaX: number; wheelDeltaY: number }) => {\n // Mac OS trackpad pinch event is emitted as a wheel.zoom and d3.event.ctrlKey set to true\n if (!e.ctrlKey) {\n // Stop immediate propagation for default d3 zoom handler\n e.stopImmediatePropagation();\n if (scrollable) {\n e.preventDefault();\n zoomer.translateBy(\n rootSelection,\n e.wheelDeltaX / 5,\n e.wheelDeltaY / 5\n );\n }\n }\n // zoomer.scaleBy(rootSelection, Math.pow(2, defaultWheelDelta(e)))\n }\n );\n }\n\n rootSelection\n .call(zoomer)\n .on(\"wheel\", (e: WheelEvent) => e.preventDefault())\n .on(\"dblclick.zoom\", null);\n\n if (!draggable || !pannable) {\n rootSelection.on(\"mousedown.zoom\", null);\n }\n\n if (!pannable) {\n rootSelection\n .on(\"touchstart.zoom\", null)\n .on(\"touchmove.zoom\", null)\n .on(\"touchend.zoom\", null);\n }\n\n return unsetZoom;\n }, [draggable, pannable, rootRef, scrollable, zoomable, zoomer]);\n\n return { grabbing, transform, zoomer, scaleRange };\n}\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.zoom-bar{position:absolute;bottom:20px;right:20px;width:40px}.zoom-slider,\n.center-button{width:100%;display:flex;align-items:center;border:1px solid var(--antd-background-color-base);border-radius:var(--larger-border-radius);box-shadow:var(--connected-overlay-shadow);background-color:var(--color-fill-bg-container-4)}.zoom-slider{height:140px;padding:8px 0;flex-direction:column}[role=\"button\"]{cursor:pointer}.center-button{justify-content:center;margin-bottom:8px;height:40px}.center-button:hover{border-color:var(--antd-btn-default-hover-border-color)}.center-button path{fill:var(--antd-link-hover-color)}.center-button:hover path{fill:var(--palette-blue-7)}.zoom-button{font-size:16px;line-height:0}.zoom-button svg{width:1em;height:1em;fill:var(--antd-link-hover-color)}.zoom-slider .ant-slider-vertical{padding-inline:5px}.zoom-slider .ant-slider-vertical .ant-slider-rail{width:2px}.zoom-slider .ant-slider-vertical .ant-slider-handle{width:6px;height:6px;inset-inline-start:3px}.zoom-slider .ant-slider .ant-slider-handle:hover::before,\n.zoom-slider .ant-slider .ant-slider-handle:focus::before,\n.zoom-slider .ant-slider .ant-slider-handle::before{width:10px;height:10px;inset-inline-start:-2px}.zoom-slider .ant-slider .ant-slider-handle:hover::after,\n.zoom-slider .ant-slider .ant-slider-handle:focus::after,\n.zoom-slider .ant-slider .ant-slider-handle::after{width:6px;height:6px;inset-block-start:0;inset-inline-start:0}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `*{box-sizing:border-box}:host{display:block;position:relative;overflow:hidden;--animation-dasharray:48;--stroke-dashoffset:96;--dasharray:4}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}@keyframes dashedAnimation{0%{stroke-dashoffset:var(--stroke-dashoffset)}to{stroke-dashoffset:0}}@keyframes solidAnimation{to{stroke-dashoffset:0}}.solid-animation{stroke-dasharray:var(--solid-length);stroke-dashoffset:var(--solid-length);animation:solidAnimation var(--time) linear infinite}.dashed-animation{animation:dashedAnimation var(--time) linear infinite}.decorator-area .area{fill:rgba(119,141,195,0.1);stroke:none;stroke-width:0}.node,\n.decorator-text{overflow:visible}.cell.active .decorator-area .area,\n.allowEdgeToArea:hover .decorator-area .area,\n.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:var(--dasharray);stroke-width:1}.cell:not(.read-only){-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-handle{cursor:nwse-resize;opacity:0}.resize-handle rect{fill:transparent;stroke:none}.resize-handle path{fill:none;stroke:var(--palette-gray-5);stroke-width:1.5}.cell.active .decorator-area .resize-handle,\n.decorator-area:hover .resize-handle{opacity:1}.connect-line{pointer-events:none}.connect-line:not(.connecting){display:none}.line.dashed{stroke-dasharray:var(--dasharray)}.cell.active .decorator-text .text-container{outline:1px dashed var(--palette-blue-5)}.decorator-text .text-container{width:-webkit-max-content;width:-moz-max-content;width:max-content;padding:0.5em}.decorator-text .text:focus{outline:none}.cell.faded{opacity:0.3}.cell .node{pointer-events:none}.cell .node > *{pointer-events:auto}.degraded{pointer-events:bounding-box}.degraded circle{fill:rgb(119,141,195)}.degraded text{text-anchor:middle;fill:var(--antd-text-color)}.cell.active .degraded circle,\n.cell.active .degraded text,\n.degraded:hover circle,\n.degraded:hover text{fill:var(--color-brand)}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n"],"names":["MarkerComponent","_ref","Component","id","type","strokeColor","EntityRelationZeroOrOneMarker","EntityRelationZeroOrManyMarker","ArrowMarker","React","_ref2","viewBox","refX","refY","markerWidth","markerHeight","orient","strokeLinejoin","d","stroke","strokeWidth","fill","_ref3","_ref4","getDirectLinePoints","source","target","parallelGap","doTwoNodesOverlap","p0","p1","xDiff","yDiff","dx","x","dy","y","angle","Math","atan2","cos","PI","sin","line","sourceIntersections","getIntersections","targetIntersections","length","rect","vertices","width","height","possibleLines","i","push","intersections","item","intersection","intersect","x1","y1","x2","y2","x3","y3","x4","y4","denominator","ua","ub","a","b","paddingA","paddingB","A","getNodesWithPadding","B","left","min","right","max","top","bottom","node","padding","extractPartialRectTuple","value","Array","isArray","v0","v1","findNodeOrAreaDecorator","cells","find","cell","isNodeOrAreaDecoratorCell","EdgeComponent","_lineConf$animate$dur","_pathRef$current","_pathRef$current$getT","edge","lineConfMap","pathRef","useRef","sourceNode","useMemo","targetNode","lineConf","get","some","isEdgeCell","view","nodeViewToNodeRect","concat","interactStrokeWidth","ref","className","classNames","dashed","animate","useAnimate","style","duration","DEFAULT_LINE_INTERACT_ANIMATE_DURATION","current","getTotalLength","call","markerStart","showStartArrow","markerArrow","markerEnd","showEndArrow","NodeComponent","degraded","degradedNodeLabel","defaultNodeBricks","onResize","memoizedData","memoizedValue","setMemoizedValue","useState","useEffect","prev","isEqual","useDeepMemo","data","specifiedUseBrick","useBrick","observerRef","_defaultNodeBricks$fi","checkIfByTransform","label","String","__secret_internals","legacyDoTransform","refCallback","useCallback","element","prevObserver","disconnect","setTimeout","observer","ResizeObserver","offsetWidth","offsetHeight","observe","degradedRefCallBack","g","size","getBBox","ReactUseBrick","cx","cy","r","handleMouseDown","event","action","scale","layout","activeTarget","onCellsMoving","onCellsMoved","onCellResizing","onCellResized","onSwitchActiveTarget","stopPropagation","targetIsActive","cellToTarget","isAutoLayout","movableActiveCells","filter","c","isNodeCell","isDecoratorCell","from","clientX","clientY","originals","map","position","moved","handleMove","e","finished","movement","getMovement","payloads","onMouseMove","onMouseUp","document","removeEventListener","addEventListener","DecoratorArea","transform","readOnly","resizeHandleRef","resizeHandle","onMouseDown","k","DecoratorText","_cell$view$text","onDecoratorTextEditing","onDecoratorTextChange","text","currentLabel","setCurrentLabel","editingLabel","setEditingLabel","editingLabelInitialized","shouldEmitLabelChange","setShouldEmitLabelChange","handleEnableEdit","preventDefault","textContent","focus","range","createRange","selectNodeContents","selection","window","getSelection","removeAllRanges","addRange","selectAllText","editing","handleInput","handleBlur","_objectSpread","onDoubleClick","contentEditable","onInput","onBlur","DecoratorComponent","SpecifiedComponent","decorator","console","error","CellComponent","unrelatedCells","onCellContextMenu","onCellClick","onNodeBrickResize","onCellMouseEnter","onCellMouseLeave","gRef","unrelated","sameTarget","handleContextMenu","handleCellClick","handleMouseEnter","handleMouseLeave","active","faded","undefined","onContextMenu","onClick","onMouseEnter","onMouseLeave","SYMBOL_FOR_SIZE_INITIALIZED","Symbol","for","SYMBOL_FOR_LAYOUT_INITIALIZED","DEFAULT_NODE_SIZE","DEFAULT_NODE_GAP","DEFAULT_AREA_WIDTH","DEFAULT_AREA_HEIGHT","DEFAULT_SCALE_RANGE_MIN","DEFAULT_SCALE_RANGE_MAX","DEFAULT_LINE_STROKE_COLOR","DEFAULT_LINE_STROKE_WIDTH","DEFAULT_LINE_INTERACT_STROKE_WIDTH","DEFAULT_LINE_INTERACT_SHOW_START_ARROW","DEFAULT_LINE_INTERACT_SHOW_END_ARROW","DEFAULT_DEGRADED_THRESHOLD","isInitialNodeCell","isNodeOrEdgeCell","pick","getUnrelatedCells","connectLineState","allowEdgeToArea","existedTargets","Set","add","has","nodesMap","Map","activeNodeIds","relatedNodeIds","targets","set","initializeCells","initialCells","defaultNodeSize","_cell$view","_cell$view2","every","targetA","targetB","transformToCenter","canvasWidth","canvasHeight","scaleRange","Infinity","empty","updateCells","previousCells","reason","parent","isManualLayout","newCells","updateCandidates","shouldReCenter","previousSizeInitializedNodes","previousShouldCentered","previousNode","handled","downstreamNodeIds","parentNode","downstreamNodes","Boolean","rightMostNode","nextX","nextY","totalWidth","reduce","acc","getNodeView","maxWidth","maxHeight","positionedNodes","hasDecorators","without","dagreLayout","index","forceLayout","fixedPosition","center","updated","insertCellAfter","newCell","after","findLastIndex","slice","reducers","rootReducer","state","payload","matched","newState","move","findIndex","layoutKey","Object","fromEntries","entries","key","props","_extends","xmlns","ZoomBarComponent","shadowRoot","onZoomChange","onReCenter","currentTheme","useCurrentTheme","cache","createCache","zoomBarRef","tooltip","formatter","placement","getPopupContainer","onZoomIn","onZoomOut","ConfigProvider","theme","algorithm","darkAlgorithm","defaultAlgorithm","StyleProvider","container","autoClear","hashPriority","role","CenterSVG","ZoomInSVG","Slider","step","vertical","included","onChange","ZoomOutSVG","layoutOptions","_nodePadding$rankdir$","nodePadding","rankdir","ranksep","edgesep","nodesep","dagreGraphOptions","_objectWithoutProperties","_excluded","nodePaddings","graph","dagre","Graph","setGraph","setDefaultEdgeLabel","setNode","setEdge","collide","radiusDiff","strength","iterations","forceNodes","forceLinks","fx","fy","linkSimulation","forceLink","simulation","forceSimulation","force","forceX","forceY","forceManyBody","forceCollide","radius","sqrt","stop","tick","ceil","log","alphaMin","alphaDecay","manuallyTickToTheEnd","useActiveTarget","cellsRef","_activeTarget","onActiveTargetChange","newActiveTarget","setActiveTarget","previous","activeTargetChangeInitialized","resetActiveTarget","composedPath","indexOf","KeywordMap","normalizeAlignAxis","axis","newX","matches","match","Number","useLayout","rootRef","zoomable","zoomer","dispatch","layoutInitialized","setLayoutInitialized","layoutKeyRef","getNextLayoutKey","centered","setCentered","root","clientWidth","clientHeight","select","ZoomTransform","useAutoCenter","previousLayoutRef","v","alignOrigin","origin","normalizeAlignOrigin","nodeView","useLineMarkers","defaultEdgeLines","markerPrefix","markers","WeakMap","_loop","_secret_internals$le","computedLineConf","omitBy","isUndefined","markerEndIndex","marker","markerIndex","addMarker","useReady","useZoom","scrollable","pannable","draggable","_scaleRange","grabbing","setGrabbing","setTransform","zoom","scaleExtent","on","rootSelection","unsetZoom","ctrlKey","stopImmediatePropagation","translateBy","wheelDeltaX","wheelDeltaY","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! For license information please see 4937.2424a99b.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.webpackChunk_next_bricks_diagram=self.webpackChunk_next_bricks_diagram||[]).push([[4937],{6663:(e,t,a)=>{a.r(t);var n,i,s,l,o,r,h,c,d,u,p,g,f,A,v,y,m,b,k,w,x,_,M,E,C,N,W,T,R,L,S,z,B,$,D,P,O,H,I,K,Y,U,X,j,V,q,Z,F,J,G,Q,ee,te,ae,ne,ie,se=a(4635),le=a(918),oe=a(6902),re=a(5536),he=a(6121),ce=a(829),de=a(2740),ue=a(8769),pe=a.n(ue),ge=a(7122),fe=a(6227),Ae=(a(6329),a(7566)),ve=a(1517),ye=a(3373),me=a.n(ye),be=a(1030),ke=a(9126),we=a(8892),xe=a(5157),_e=a(8308),Me=a(9576),Ee=a(9137),Ce=a(2547),Ne=a(1803),We=a(3739),Te=a(9191),Re=a(6671),Le=a(8060),Se=a(2448),ze=a(8657),Be=a(8069),$e=a(1324),De=a(821),Pe=a(9741),Oe=a(2673),He=a(5987),{defineElement:Ie,property:Ke,event:Ye,method:Ue}=(0,ge.createDecorators)(),Xe=(0,ue.forwardRef)(wt),je=new WeakMap,Ve=new WeakMap,qe=new WeakMap,Ze=new WeakMap,Fe=new WeakMap,Je=new WeakMap,Ge=new WeakMap,Qe=new WeakMap,et=new WeakMap,tt=new WeakMap,at=new WeakMap,nt=new WeakMap,it=new WeakMap,st=new WeakMap,lt=new WeakMap,ot=new WeakSet,rt=new WeakMap,ht=new WeakMap,ct=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,gt=new WeakMap,ft=new WeakMap,At=new WeakMap,vt=new WeakMap,yt=new WeakMap,mt=new WeakMap,bt=new WeakMap;class kt extends fe.ReactNextElement{constructor(){super(...arguments),(0,se.A)(this,ot),(0,le.A)(this,je,(i(this),l(this))),(0,le.A)(this,Ve,(o(this),r(this))),(0,le.A)(this,qe,(h(this),c(this))),(0,le.A)(this,Ze,(d(this),u(this))),(0,le.A)(this,Fe,(p(this),g(this))),(0,le.A)(this,Je,(f(this),A(this))),(0,le.A)(this,Ge,(v(this),y(this))),(0,le.A)(this,Qe,(m(this),b(this))),(0,le.A)(this,et,(k(this),w(this))),(0,le.A)(this,tt,(x(this),_(this))),(0,le.A)(this,at,(M(this),E(this,!0))),(0,le.A)(this,nt,(C(this),N(this,!0))),(0,le.A)(this,it,(W(this),T(this,!0))),(0,le.A)(this,st,(R(this),L(this))),(0,le.A)(this,lt,(S(this),z(this))),(0,le.A)(this,rt,(D(this),e=>{(0,re.A)(ot,this,B).emit(e)})),(0,le.A)(this,ht,P(this)),(0,le.A)(this,ct,(I(this),e=>{(0,re.A)(ot,this,O).emit(e)})),(0,le.A)(this,dt,K(this)),(0,le.A)(this,ut,(X(this),e=>{(0,re.A)(ot,this,Y).emit(e)})),(0,le.A)(this,pt,j(this)),(0,le.A)(this,gt,(Z(this),e=>{(0,re.A)(ot,this,V).emit(e)})),(0,le.A)(this,ft,F(this)),(0,le.A)(this,At,(Q(this),e=>{(0,re.A)(ot,this,J).emit(e)})),(0,le.A)(this,vt,ee(this)),(0,le.A)(this,yt,(ne(this),e=>{(0,re.A)(ot,this,te).emit(e)})),(0,le.A)(this,mt,(e=>{(0,Oe.c)(e,this.activeTarget)||(this.activeTarget=e)})),(0,le.A)(this,bt,(0,ue.createRef)())}get layout(){return(0,ce.A)(je,this)}set layout(e){(0,he.A)(je,this,e)}get nodes(){return(0,ce.A)(Ve,this)}set nodes(e){(0,he.A)(Ve,this,e)}get edges(){return(0,ce.A)(qe,this)}set edges(e){(0,he.A)(qe,this,e)}get nodeBricks(){return(0,ce.A)(Ze,this)}set nodeBricks(e){(0,he.A)(Ze,this,e)}get lines(){return(0,ce.A)(Fe,this)}set lines(e){(0,he.A)(Fe,this,e)}get layoutOptions(){return(0,ce.A)(Je,this)}set layoutOptions(e){(0,he.A)(Je,this,e)}get activeTarget(){return(0,ce.A)(Ge,this)}set activeTarget(e){(0,he.A)(Ge,this,e)}get disableKeyboardAction(){return(0,ce.A)(Qe,this)}set disableKeyboardAction(e){(0,he.A)(Qe,this,e)}get connectNodes(){return(0,ce.A)(et,this)}set connectNodes(e){(0,he.A)(et,this,e)}get dragNodes(){return(0,ce.A)(tt,this)}set dragNodes(e){(0,he.A)(tt,this,e)}get zoomable(){return(0,ce.A)(at,this)}set zoomable(e){(0,he.A)(at,this,e)}get scrollable(){return(0,ce.A)(nt,this)}set scrollable(e){(0,he.A)(nt,this,e)}get pannable(){return(0,ce.A)(it,this)}set pannable(e){(0,he.A)(it,this,e)}get scaleRange(){return(0,ce.A)(st,this)}set scaleRange(e){(0,he.A)(st,this,e)}callOnLineLabel(e,t){for(var a,n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];null===(a=(0,ce.A)(bt,this).current)||void 0===a||a.callOnLineLabel(e,t,...i)}render(){return pe().createElement(Xe,{ref:(0,ce.A)(bt,this),layout:this.layout,nodes:this.nodes,edges:this.edges,nodeBricks:this.nodeBricks,lines:this.lines,layoutOptions:this.layoutOptions,connectNodes:this.connectNodes,dragNodes:this.dragNodes,activeTarget:this.activeTarget,disableKeyboardAction:this.disableKeyboardAction,zoomable:this.zoomable,scrollable:this.scrollable,pannable:this.pannable,scaleRange:this.scaleRange,onActiveTargetChange:(0,ce.A)(rt,this),onSwitchActiveTarget:(0,ce.A)(mt,this),onNodeDelete:(0,ce.A)(ct,this),onEdgeDelete:(0,ce.A)(ut,this),onLineClick:(0,ce.A)(gt,this),onLineDoubleClick:(0,ce.A)(At,this),onNodesConnect:(0,ce.A)(yt,this)})}}function wt(e,t){var{layout:a,nodes:n,edges:i,nodeBricks:s,lines:l,layoutOptions:o,connectNodes:r,dragNodes:h,activeTarget:c,disableKeyboardAction:d,zoomable:u,scrollable:p,pannable:g,scaleRange:f,onActiveTargetChange:A,onSwitchActiveTarget:v,onNodeDelete:y,onEdgeDelete:m,onLineClick:b,onLineDoubleClick:k,onNodesConnect:w}=e,[x,_]=(0,ue.useState)(!1),[M,E]=(0,ue.useState)(0),[C,N]=(0,ue.useState)(null),[W,T]=(0,ue.useState)(!1),[R,L]=(0,ue.useState)(0),[S,z]=(0,ue.useState)(null),[B,$]=(0,ue.useState)([]),[D,P]=(0,ue.useState)(!1),[O,H]=(0,ue.useState)({k:1,x:0,y:0}),I=(0,ue.useRef)(new Map),K=(0,ue.useRef)(null),Y=(0,ue.useRef)(null),[U,X]=(0,ue.useState)(!1),{userViewReady:j,userViewNodesMap:V,saveUserView:q}=(0,Pe._)(null==h?void 0:h.save),[Z,F]=(0,ue.useState)([0,0]),[J,G]=(0,ue.useState)(null),[Q,ee]=(0,ue.useState)("initial"),[te,ae]=(0,ue.useState)(null);(0,ue.useImperativeHandle)(t,(()=>({callOnLineLabel(e,t){for(var a,n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];null==S||null===(a=S.get(e))||void 0===a||null===(a=a.firstElementChild)||void 0===a||a[t](...i)}}))),(0,ue.useEffect)((()=>{var e=e=>{(0,Se.P)(e,{nodes:n,nodesRefRepository:C,connectNodes:r,dragNodes:h,scale:O.k,setConnectLineState:G,setConnectLineTo:F,setManualLayoutStatus:ee,setNodeMovement:ae,onSwitchActiveTarget:v,onNodesConnect:w})},t=Y.current;return null==t||t.addEventListener("mousedown",e),()=>{null==t||t.removeEventListener("mousedown",e)}}),[n,r,h,O.k,C,w,v]);var{normalizedLines:ne,normalizedLinesMap:ie,markers:se}=(0,ue.useMemo)((()=>(0,Ee.t)(i,l)),[i,l]),le=(0,ue.useMemo)((()=>ne.flatMap((e=>{var t,a,{line:{text:n,label:i,$id:s},edge:l}=e;return n||i?(i?(t="label",a=[].concat(i)):(t="text",a=[].concat(n)),a.map((e=>{var a;return{[t]:e,id:"".concat(s,"-").concat(null!==(a=e.placement)&&void 0!==a?a:"center"),edge:l}}))):[]}))),[ne]),{nodes:oe,edges:re}=(0,Be.o)({layout:a,nodes:n,edges:i,manualLayoutStatus:Q,userViewReady:j,userViewNodesMap:V,nodeMovement:te,nodesRefRepository:C,lineLabelsRefRepository:S,normalizedLinesMap:ie,layoutOptions:o,nodesRenderId:M,lineLabelsRenderId:R});(0,ue.useEffect)((()=>{"finished"===Q&&q(oe.map((e=>({id:e.id,x:e.x,y:e.y}))))}),[Q]);var he=(0,ue.useMemo)((()=>(0,Me.R)(re,oe,ne)),[ne,oe,re]),ce=null!=c?c:null,[de,ge]=(0,ue.useState)(ce);(0,ue.useEffect)((()=>{ge((e=>(0,Oe.c)(e,ce)?e:ce))}),[ce]);var fe=(0,ue.useRef)(!1);(0,ue.useEffect)((()=>{fe.current?null==A||A(de):fe.current=!0}),[de,A]),(0,ue.useEffect)((()=>{var e=K.current;if(e&&!d){var t=e=>{var t=(0,xe.a)(e,{renderedNodes:oe,activeTarget:de});"delete-node"===(null==t?void 0:t.action)?null==y||y(t.node):"delete-edge"===(null==t?void 0:t.action)?null==m||m(t.edge):"switch-active-node"===(null==t?void 0:t.action)&&t.node&&(null==v||v({type:"node",nodeId:t.node.id}))};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}}),[de,oe,d,v,y,m]);var ye=(0,ue.useCallback)((e=>{e&&(E((e=>e+1)),N(e)),_((t=>t||!!e))}),[]),De=(0,ue.useCallback)((e=>{e&&(L((e=>e+1)),z(e)),T((t=>t||!!e))}),[]),Ie=(0,ue.useMemo)((()=>null!=f?f:[ze.sS,ze.Yt]),[f]),Ke=(0,ue.useMemo)((()=>(0,ve.s_)()),[]);(0,ue.useEffect)((()=>{var e=!1;Ke.scaleExtent(u?Ie:[1,1]).on("start",(()=>{e=!1,P(!0)})).on("zoom",(t=>{e=!0,H(t.transform)})).on("end",(()=>{P(!1),e||null==v||v(null)}))}),[v,Ie,u,Ke]),(0,ue.useEffect)((()=>{var e=K.current;if(e){var t=(0,Ae.A)(e),a=()=>{t.on(".zoom",null).on(".zoom.custom",null).on("wheel",null)};if(u||p||g)return(u||p)&&t.on("wheel.zoom.custom",(e=>{e.ctrlKey||(e.stopImmediatePropagation(),p&&(e.preventDefault(),Ke.translateBy(t,e.wheelDeltaX/5,e.wheelDeltaY/5)))})),t.call(Ke).on("wheel",(e=>e.preventDefault())).on("dblclick.zoom",null),g||t.on("mousedown.zoom",null).on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),a;a()}}),[g,p,u,Ke]),(0,ue.useEffect)((()=>{var e=K.current;if(0!==oe.length&&e&&!U){var{k:t,x:a,y:n}=(0,_e.r)(oe,{canvasWidth:e.clientWidth,canvasHeight:e.clientHeight,scaleRange:u?Ie:void 0});Ke.transform((0,Ae.A)(e),new ve.uV(t,a,n)),X(!0)}}),[U,oe,Ie,u,Ke]);var Ye=(0,ue.useMemo)((()=>"".concat((0,be.uniqueId)("diagram-"),"-")),[]),Ue="".concat(Ye,"line-arrow-"),Xe="".concat(Ye,"mask-"),je="".concat(Ye,"active-line-");(0,ue.useEffect)((()=>{$((e=>(0,Le.z)(e,he,I.current)))}),[he]);var[Ve,qe]=pe().useState(new Map);return(0,ue.useEffect)((()=>{if(S){(0,$e.F)(B,S);var e=new ke.A((()=>{qe((0,He.G)(B,S))}));for(var t of S.values())e.observe(t);return()=>{e.disconnect()}}}),[R,S,B]),"dagre"!==a&&"force"!==a?pe().createElement("div",null,'Diagram layout not supported: "'.concat(a,'"')):pe().createElement("div",{className:me()("diagram",{ready:x&&U,grabbing:D,pannable:g}),tabIndex:-1,ref:K},pe().createElement("svg",{width:"100%",height:"100%",className:"lines"},pe().createElement("defs",null,se.map(((e,t)=>{var{type:a,strokeColor:n}=e;return pe().createElement(We.c,{key:t,id:"".concat(Ue).concat(t),type:a,strokeColor:n})})),[...Ve].map((e=>{var[t,a]=e;return pe().createElement(Te.y,{key:t,lineId:t,rects:a,maskPrefix:Xe,renderedLineLabels:B})})),pe().createElement("marker",{id:"".concat(je,"start"),viewBox:"0 0 8 8",refX:4,refY:4,markerWidth:8,markerHeight:8,orient:"auto"},pe().createElement("path",{d:"M 0.5 0.5 H 7.5 V 7.5 H 0.5 Z",stroke:"var(--palette-gray-7)",strokeWidth:1,fill:"var(--palette-gray-1)"})),pe().createElement("marker",{id:"".concat(je,"end"),viewBox:"0 0 14 8",refX:3,refY:4,markerWidth:14,markerHeight:8,orient:"auto"},pe().createElement("path",{d:"M 0.5 1.5 L 5.5 4 L 0.5 6.5 z",stroke:"var(--palette-blue-3)",strokeWidth:1,fill:"var(--palette-blue-3)"}),pe().createElement("path",{d:"M 6.5 0.5 H 13.5 V 7.5 H 6.5 Z",stroke:"var(--palette-gray-7)",strokeWidth:1,fill:"var(--palette-gray-1)"}))),pe().createElement("g",{transform:"translate(".concat(O.x," ").concat(O.y,") scale(").concat(O.k,")")},he.map((e=>pe().createElement(Ne.m,{key:e.line.$id,line:e,linePaths:I.current,lineMaskRects:Ve,maskPrefix:Xe,markerPrefix:Ue,activeLineMarkerPrefix:je,active:"edge"===(null==de?void 0:de.type)&&de.edge.source===e.edge.source&&de.edge.target===e.edge.target,activeRelated:"node"===(null==de?void 0:de.type)&&(e.edge.source===de.nodeId||e.edge.target===de.nodeId),onLineClick:b,onLineDoubleClick:k}))))),pe().createElement("div",{className:me()("line-labels",{ready:W}),style:{left:O.x,top:O.y,transform:"scale(".concat(O.k,")")}},pe().createElement(Ce.d2,{labels:le,onRendered:De})),pe().createElement("div",{className:"nodes",ref:Y,style:{left:O.x,top:O.y,transform:"scale(".concat(O.k,")")}},pe().createElement(we.p,{nodes:n,nodeBricks:s,onRendered:ye})),pe().createElement(Re.w,{connectLineState:J,connectLineTo:Z,markerPrefix:Ue}))}n=kt,({e:[l,o,r,h,c,d,u,p,g,f,A,v,y,m,b,k,w,x,_,M,E,C,N,W,T,R,L,S,z,B,$,D,P,O,H,I,K,Y,U,X,j,V,q,Z,F,J,G,Q,ee,te,ae,ne,i],c:[ie,s]}=(0,de.A)(n,[Ie("eo-diagram",{styleTexts:[De.A]})],[[Ke({type:String}),1,"layout"],[Ke({attribute:!1}),1,"nodes"],[Ke({attribute:!1}),1,"edges"],[Ke({attribute:!1}),1,"nodeBricks"],[Ke({attribute:!1}),1,"lines"],[Ke({attribute:!1}),1,"layoutOptions"],[Ke({attribute:!1}),1,"activeTarget"],[Ke({type:Boolean}),1,"disableKeyboardAction"],[Ke({attribute:!1}),1,"connectNodes"],[Ke({attribute:!1}),1,"dragNodes"],[Ke({type:Boolean}),1,"zoomable"],[Ke({type:Boolean}),1,"scrollable"],[Ke({type:Boolean}),1,"pannable"],[Ke({attribute:!1}),1,"scaleRange"],[Ye({type:"activeTarget.change"}),1,"activeTargetChangeEvent",e=>(0,ce.A)(lt,e),(e,t)=>(0,he.A)(lt,e,t)],[Ye({type:"node.delete"}),1,"nodeDelete",e=>(0,ce.A)(ht,e),(e,t)=>(0,he.A)(ht,e,t)],[Ye({type:"edge.delete"}),1,"edgeDelete",e=>(0,ce.A)(dt,e),(e,t)=>(0,he.A)(dt,e,t)],[Ye({type:"line.click"}),1,"lineClick",e=>(0,ce.A)(pt,e),(e,t)=>(0,he.A)(pt,e,t)],[Ye({type:"line.dblclick"}),1,"lineDoubleClick",e=>(0,ce.A)(ft,e),(e,t)=>(0,he.A)(ft,e,t)],[Ye({type:"nodes.connect"}),1,"connectNodes",e=>(0,ce.A)(vt,e),(e,t)=>(0,he.A)(vt,e,t)],[Ue(),2,"callOnLineLabel"]],0,(e=>bt.has((0,oe.A)(e))),fe.ReactNextElement)),s();var xt,_t,Mt,Et,Ct,Nt,Wt,Tt,Rt,Lt,St,zt,Bt,$t,Dt,Pt,Ot=a(3971),{defineElement:Ht,property:It,event:Kt,method:Yt}=(0,ge.createDecorators)(),Ut=(0,ue.forwardRef)(ea),Xt=new WeakMap,jt=new WeakMap,Vt=new WeakMap,qt=new WeakSet,Zt=new WeakMap,Ft=new WeakMap,Jt=new WeakMap,Gt=new WeakMap;class Qt extends fe.ReactNextElement{constructor(){super(...arguments),(0,se.A)(this,qt),(0,le.A)(this,Xt,(_t(this),Et(this))),(0,le.A)(this,jt,(Ct(this),Nt(this))),(0,le.A)(this,Vt,(Wt(this),Tt(this))),(0,le.A)(this,Zt,(St(this),e=>{(0,re.A)(qt,this,Rt).emit(e)})),(0,le.A)(this,Ft,zt(this)),(0,le.A)(this,Jt,(Dt(this),e=>{(0,re.A)(qt,this,Bt).emit(e)})),(0,le.A)(this,Gt,(0,ue.createRef)())}get label(){return(0,ce.A)(Xt,this)}set label(e){(0,he.A)(Xt,this,e)}get type(){return(0,ce.A)(jt,this)}set type(e){(0,he.A)(jt,this,e)}enableEditing(){var e;null===(e=(0,ce.A)(Gt,this).current)||void 0===e||e.enableEditing()}render(){return pe().createElement(Ut,{ref:(0,ce.A)(Gt,this),label:this.label,onLabelEditingChange:(0,ce.A)(Zt,this),onLabelChange:(0,ce.A)(Jt,this)})}}function ea(e,t){var{label:a,onLabelChange:n,onLabelEditingChange:i}=e,s=null!=a?a:"",[l,o]=(0,ue.useState)(s),[r,h]=(0,ue.useState)(!1),c=(0,ue.useRef)(!1),[d,u]=(0,ue.useState)(!1),p=(0,ue.useRef)(null);(0,ue.useImperativeHandle)(t,(()=>({enableEditing(){h(!0)}}))),(0,ue.useEffect)((()=>{o(s)}),[s]);var g=(0,ue.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),h(!0)}),[]);(0,ue.useEffect)((()=>{var e,t;r&&(null===(e=p.current)||void 0===e||e.focus({preventScroll:!0}),null===(t=p.current)||void 0===t||t.select())}),[r]),(0,ue.useEffect)((()=>{c.current?null==i||i(r):c.current=!0}),[r,i]);var f=(0,ue.useCallback)((e=>{o(e.target.value)}),[]),A=(0,ue.useCallback)((e=>{var t,a=e.key||e.keyCode||e.which;"Enter"!==a&&13!==a||null===(t=p.current)||void 0===t||t.blur()}),[]),v=(0,ue.useCallback)((()=>{h(!1),u(!0)}),[]);(0,ue.useEffect)((()=>{d&&(null==n||n(l),u(!1))}),[l,n,d]);var y=(0,ue.useCallback)((e=>{e.stopPropagation()}),[]);return pe().createElement("div",{className:me()("label",{editing:r,empty:!l}),onDoubleClick:y,onMouseDown:y},pe().createElement("input",{className:"label-input",value:l,ref:p,onChange:f,onKeyDown:A,onBlur:v}),pe().createElement("div",{className:"label-text",onDoubleClick:g},l))}xt=Qt,({e:[Et,Ct,Nt,Wt,Tt,Rt,Lt,St,zt,Bt,$t,Dt,_t],c:[Pt,Mt]}=(0,de.A)(xt,[Ht("diagram.editable-label",{styleTexts:[Ot.A]})],[[It(),1,"label"],[It({render:!1}),1,"type"],[Kt({type:"label.editing.change"}),1,"labelEditingChange",e=>(0,ce.A)(Vt,e),(e,t)=>(0,he.A)(Vt,e,t)],[Kt({type:"label.change"}),1,"labelChange",e=>(0,ce.A)(Ft,e),(e,t)=>(0,he.A)(Ft,e,t)],[Yt(),2,"enableEditing"]],0,(e=>Gt.has((0,oe.A)(e))),fe.ReactNextElement)),Mt();var ta=a(4223),aa=a(9740),na=a(6330),ia=a(2559),sa=a(244),la=a(5748),oa=a(531),ra=a(8185),ha=a(4197),ca=a(908);function da(e){var{connectLineState:t,transform:a,markerEnd:n,onConnect:i}=e,[s,l]=(0,ue.useState)(null);return(0,ue.useEffect)((()=>{t&&l(t.from)}),[t]),(0,ue.useEffect)((()=>{if(t){var e=e=>{l([(e.clientX-a.x-t.offset[0])/a.k,(e.clientY-a.y-t.offset[1])/a.k])},n=e=>{e.stopPropagation()},s=e=>{e.stopPropagation(),o(),i(t,[(e.clientX-a.x-t.offset[0])/a.k,(e.clientY-a.y-t.offset[1])/a.k])},o=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mousedown",n,{capture:!0}),document.removeEventListener("click",s,{capture:!0}),l(null)};return document.addEventListener("mousemove",e),document.addEventListener("mousedown",n,{capture:!0}),document.addEventListener("click",s,{capture:!0}),o}}),[t,i,a]),pe().createElement("path",{className:me()("connect-line",{connecting:!!t&&s&&(s[0]-t.from[0])**2+(s[1]-t.from[1])**2>25}),d:t&&s?"M".concat(t.from.join(" "),"L").concat(s.join(" ")):"",fill:"none",stroke:"gray",strokeWidth:1,markerEnd:"url(#".concat(n,")")})}var ua=a(3783),pa=a(2098),ga=a(227),fa=a(3033),Aa=a(8091),va=a(1819),ya=a(7099),ma=a(1484),ba=a(8197),ka=a(7531);var wa,xa,_a,Ma,Ea,Ca,Na,Wa,Ta,Ra,La,Sa,za,Ba,$a,Da,Pa,Oa,Ha,Ia,Ka,Ya,Ua,Xa,ja,Va,qa,Za,Fa,Ja,Ga,Qa,en,tn,an,nn,sn,ln,on,rn,hn,cn,dn,un,pn,gn,fn,An,vn,yn,mn,bn,kn,wn,xn,_n,Mn,En,Cn,Nn,Wn,Tn,Rn,Ln,Sn,zn,Bn,$n,Dn,Pn,On,Hn,In,Kn,Yn,Un,Xn,jn,Vn,qn,Zn,Fn,Jn=a(3012),Gn=a(8618),Qn=a(9386),ei=["shouldReCenter"],ti=(0,sa.unwrapProvider)("basic.lock-body-scroll"),{defineElement:ai,property:ni,method:ii,event:si}=(0,ge.createDecorators)(),li=pe().forwardRef(Zi),oi=new WeakMap,ri=new WeakMap,hi=new WeakMap,ci=new WeakMap,di=new WeakMap,ui=new WeakMap,pi=new WeakMap,gi=new WeakMap,fi=new WeakMap,Ai=new WeakMap,vi=new WeakMap,yi=new WeakMap,mi=new WeakMap,bi=new WeakMap,ki=new WeakMap,wi=new WeakMap,xi=new WeakMap,_i=new WeakMap,Mi=new WeakSet,Ei=new WeakMap,Ci=new WeakMap,Ni=new WeakMap,Wi=new WeakMap,Ti=new WeakMap,Ri=new WeakMap,Li=new WeakMap,Si=new WeakMap,zi=new WeakMap,Bi=new WeakMap,$i=new WeakMap,Di=new WeakMap,Pi=new WeakMap,Oi=new WeakMap,Hi=new WeakMap,Ii=new WeakMap,Ki=new WeakMap,Yi=new WeakMap,Ui=new WeakMap,Xi=new WeakMap,ji=new WeakMap;class Vi extends fe.ReactNextElement{constructor(){super(...arguments),(0,se.A)(this,Mi),(0,le.A)(this,oi,(xa(this),Ma(this))),(0,le.A)(this,ri,(Ea(this),Ca(this))),(0,le.A)(this,hi,(Na(this),Wa(this))),(0,le.A)(this,ci,(Ta(this),Ra(this,[fa.HP,fa.HP]))),(0,le.A)(this,di,(La(this),Sa(this))),(0,le.A)(this,ui,(za(this),Ba(this))),(0,le.A)(this,pi,($a(this),Da(this))),(0,le.A)(this,gi,(Pa(this),Oa(this))),(0,le.A)(this,fi,(Ha(this),Ia(this))),(0,le.A)(this,Ai,(Ka(this),Ya(this))),(0,le.A)(this,vi,(Ua(this),Xa(this,!0))),(0,le.A)(this,yi,(ja(this),Va(this,!0))),(0,le.A)(this,mi,(qa(this),Za(this,!0))),(0,le.A)(this,bi,(Fa(this),Ja(this,!0))),(0,le.A)(this,ki,(Ga(this),Qa(this,!1))),(0,le.A)(this,wi,(en(this),tn(this))),(0,le.A)(this,xi,(an(this),nn(this))),(0,le.A)(this,_i,(sn(this),ln(this))),(0,le.A)(this,Ei,(hn(this),e=>{(0,re.A)(Mi,this,on).emit(e)})),(0,le.A)(this,Ci,(e=>{(0,ra.c)(e,this.activeTarget)||(this.activeTarget=e)})),(0,le.A)(this,Ni,cn(this)),(0,le.A)(this,Wi,(pn(this),gn(this))),(0,le.A)(this,Ti,(vn(this),e=>{(0,re.A)(Mi,this,fn).emit(e),"node"===e.type&&(0,re.A)(Mi,this,dn).emit(e)})),(0,le.A)(this,Ri,yn(this)),(0,le.A)(this,Li,(kn(this),e=>{(0,re.A)(Mi,this,mn).emit(e)})),(0,le.A)(this,Si,wn(this)),(0,le.A)(this,zi,(Mn(this),e=>{(0,re.A)(Mi,this,xn).emit(e)})),(0,le.A)(this,Bi,En(this)),(0,le.A)(this,$i,(Wn(this),Tn(this))),(0,le.A)(this,Di,(Sn(this),e=>{(0,re.A)(Mi,this,Rn).emit(e),"node"===e.type&&(0,re.A)(Mi,this,Cn).emit(e)})),(0,le.A)(this,Pi,zn(this)),(0,le.A)(this,Oi,(Dn(this),e=>{(0,re.A)(Mi,this,Bn).emit(e)})),(0,le.A)(this,Hi,Pn(this)),(0,le.A)(this,Ii,(In(this),e=>{(0,re.A)(Mi,this,On).emit(e)})),(0,le.A)(this,Ki,Kn(this)),(0,le.A)(this,Yi,(Xn(this),e=>{(0,re.A)(Mi,this,Yn).emit(e)})),(0,le.A)(this,Ui,jn(this)),(0,le.A)(this,Xi,(Zn(this),e=>{(0,re.A)(Mi,this,Vn).emit(e)})),(0,le.A)(this,ji,(0,ue.createRef)())}get cells(){return(0,ce.A)(oi,this)}set cells(e){(0,he.A)(oi,this,e)}get layout(){return(0,ce.A)(ri,this)}set layout(e){(0,he.A)(ri,this,e)}get layoutOptions(){return(0,ce.A)(hi,this)}set layoutOptions(e){(0,he.A)(hi,this,e)}get defaultNodeSize(){return(0,ce.A)(ci,this)}set defaultNodeSize(e){(0,he.A)(ci,this,e)}get defaultNodeBricks(){return(0,ce.A)(di,this)}set defaultNodeBricks(e){(0,he.A)(di,this,e)}get degradedThreshold(){return(0,ce.A)(ui,this)}set degradedThreshold(e){(0,he.A)(ui,this,e)}get degradedNodeLabel(){return(0,ce.A)(pi,this)}set degradedNodeLabel(e){(0,he.A)(pi,this,e)}get defaultEdgeLines(){return(0,ce.A)(gi,this)}set defaultEdgeLines(e){(0,he.A)(gi,this,e)}get activeTarget(){return(0,ce.A)(fi,this)}set activeTarget(e){(0,he.A)(fi,this,e)}get fadeUnrelatedCells(){return(0,ce.A)(Ai,this)}set fadeUnrelatedCells(e){(0,he.A)(Ai,this,e)}get zoomable(){return(0,ce.A)(vi,this)}set zoomable(e){(0,he.A)(vi,this,e)}get scrollable(){return(0,ce.A)(yi,this)}set scrollable(e){(0,he.A)(yi,this,e)}get pannable(){return(0,ce.A)(mi,this)}set pannable(e){(0,he.A)(mi,this,e)}get selectable(){return(0,ce.A)(bi,this)}set selectable(e){(0,he.A)(bi,this,e)}get allowEdgeToArea(){return(0,ce.A)(ki,this)}set allowEdgeToArea(e){(0,he.A)(ki,this,e)}get dragBehavior(){return(0,ce.A)(wi,this)}set dragBehavior(e){(0,he.A)(wi,this,e)}get scaleRange(){return(0,ce.A)(xi,this)}set scaleRange(e){(0,he.A)(xi,this,e)}dropNode(e){var t=this;return(0,na.A)((function*(){var a,n,{id:i,position:s,size:l,data:o,useBrick:r}=e;if(null===(a=(n=document).elementsFromPoint)||void 0===a||null===(a=a.call(n,s[0],s[1]))||void 0===a?void 0:a.includes(t)){var h,c,d,u=t.getBoundingClientRect(),p=(0,ce.A)(ji,t).current.getTransform(),g={type:"node",id:i,view:(0,aa.A)((0,aa.A)({},"force"===t.layout||"dagre"===t.layout?null:{x:(s[0]-u.left-p.x)/p.k,y:(s[1]-u.top-p.y)/p.k}),{},{width:null!==(h=null==l?void 0:l[0])&&void 0!==h?h:t.defaultNodeSize[0],height:null!==(c=null==l?void 0:l[1])&&void 0!==c?c:t.defaultNodeSize[0]}),data:o,useBrick:r};return null===(d=(0,ce.A)(ji,t).current)||void 0===d||d.dropNode(g),g}return null}))()}dropDecorator(e){var t=this;return(0,na.A)((function*(){var a,n,{position:i,decorator:s,text:l}=e;if(null===(a=(n=document).elementsFromPoint)||void 0===a||null===(a=a.call(n,i[0],i[1]))||void 0===a?void 0:a.includes(t)){var o,r=t.getBoundingClientRect(),h=(0,ce.A)(ji,t).current.getTransform(),c={type:"decorator",decorator:s,id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),view:{x:(i[0]-r.left-h.x)/h.k,y:(i[1]-r.top-h.y)/h.k,width:fa.N8,height:fa.w1,text:l}};return null===(o=(0,ce.A)(ji,t).current)||void 0===o||o.dropDecorator(c),c}return null}))()}addNodes(e){var t=this;return(0,na.A)((function*(){if(0===e.length)return[];var a=e.map((e=>{var a,n,{size:i,useBrick:s,id:l,data:o}=e;return{type:"node",id:l,data:o,view:{width:null!==(a=null==i?void 0:i[0])&&void 0!==a?a:t.defaultNodeSize[0],height:null!==(n=null==i?void 0:i[1])&&void 0!==n?n:t.defaultNodeSize[0]},useBrick:s}}));return(0,ce.A)(ji,t).current.addNodes(a,{defaultNodeSize:t.defaultNodeSize,canvasWidth:t.clientWidth,canvasHeight:t.clientHeight})}))()}addEdge(e){var t=this;return(0,na.A)((function*(){var a,{source:n,target:i,data:s}=e,l={type:"edge",source:n,target:i,data:s};return null===(a=(0,ce.A)(ji,t).current)||void 0===a||a.addEdge(l),l}))()}manuallyConnectNodes(e){return(0,ce.A)(ji,this).current.manuallyConnectNodes(e)}updateCells(e,t){var a=this;return(0,na.A)((function*(){yield(0,ia.A)(Mi,a,qi).call(a);var{updated:n}=(0,ce.A)(ji,a).current.updateCells(e,(0,aa.A)((0,aa.A)({},t),{},{defaultNodeSize:a.defaultNodeSize,canvasWidth:a.clientWidth,canvasHeight:a.clientHeight}));return{updated:n}}))()}disconnectedCallback(){super.disconnectedCallback(),ti(this,!1)}render(){return pe().createElement(li,{host:this,ref:(0,ce.A)(ji,this),layout:this.layout,layoutOptions:this.layoutOptions,cells:this.cells,defaultNodeSize:this.defaultNodeSize,defaultNodeBricks:this.defaultNodeBricks,defaultEdgeLines:this.defaultEdgeLines,degradedThreshold:this.degradedThreshold,degradedNodeLabel:this.degradedNodeLabel,activeTarget:this.activeTarget,fadeUnrelatedCells:this.fadeUnrelatedCells,zoomable:this.zoomable,scrollable:this.scrollable,pannable:this.pannable,dragBehavior:this.dragBehavior,scaleRange:this.scaleRange,allowEdgeToArea:this.allowEdgeToArea,onActiveTargetChange:(0,ce.A)(Ei,this),onSwitchActiveTarget:(0,ce.A)(Ci,this),onCellMove:(0,ce.A)(Ti,this),onCellsMove:(0,ce.A)(Li,this),onCellResize:(0,ce.A)(zi,this),onCellDelete:(0,ce.A)(Di,this),onCellsDelete:(0,ce.A)(Oi,this),onCellContextMenu:(0,ce.A)(Ii,this),onDecoratorTextChange:(0,ce.A)(Yi,this),onScaleChange:(0,ce.A)(Xi,this)})}}function qi(){return new Promise((e=>{var t=()=>{(0,ce.A)(ji,this).current?e():setTimeout(t,10)};t()}))}function Zi(e,t){var{host:a,layout:n,layoutOptions:i,cells:s,defaultNodeSize:l,defaultNodeBricks:o,defaultEdgeLines:r,degradedThreshold:h,degradedNodeLabel:c,activeTarget:d,fadeUnrelatedCells:u,zoomable:p,scrollable:g,pannable:f,dragBehavior:A,scaleRange:v,allowEdgeToArea:y,onActiveTargetChange:m,onSwitchActiveTarget:b,onCellMove:k,onCellResize:w,onCellDelete:x,onCellsMove:_,onCellsDelete:M,onCellContextMenu:E,onDecoratorTextChange:C,onScaleChange:N}=e,[{cells:W,layoutKey:T},R]=(0,ue.useReducer)(la.d,s,(e=>({cells:(0,ua.C)(e,{defaultNodeSize:l}),layoutKey:0}))),L=(0,ue.useMemo)((()=>W.filter(oa.N).length>=(null!=h?h:fa.pC)),[W,h]),S=(0,ue.useRef)(null),z=(0,ue.useRef)(null),B=(0,ue.useRef)(null),[$,D]=(0,ue.useState)([]),{grabbing:P,transform:O,zoomer:H,scaleRange:I}=(0,Aa.f)({rootRef:S,zoomable:p,scrollable:g,pannable:f,draggable:"grab"===A,scaleRange:v,onSwitchActiveTarget:b});(0,ue.useEffect)((()=>{N(O.k)}),[N,O.k]);var[K,Y]=(0,ue.useState)(null),[U,X]=(0,ue.useState)(null),{centered:j,setCentered:V,getNextLayoutKey:q}=(0,ma.g)({layout:n,layoutOptions:i,rootRef:S,cells:W,zoomable:p,zoomer:H,scaleRange:I,layoutKey:T,dispatch:R});(0,ue.useImperativeHandle)(t,(()=>({dropNode(e){"dagre"!==n&&"force"!==n&&V(!0),R({type:"drop-node",payload:e})},dropDecorator(e){"dagre"!==n&&"force"!==n&&V(!0),R({type:"drop-decorator",payload:e})},addNodes(e,t){var{defaultNodeSize:a,canvasWidth:i,canvasHeight:s}=t,l=W.findLastIndex((e=>!("decorator"===e.type&&"text"===e.decorator)))+1,o=[...W.slice(0,l),...e,...W.slice(l)],{cells:r,updated:h,shouldReCenter:c}=(0,pa.L)({cells:o,layout:n,previousCells:W,defaultNodeSize:a,canvasWidth:i,canvasHeight:s,scaleRange:I,transform:O});return c&&V(!1),R({type:"update-cells",payload:r}),h.filter((t=>e.includes(t)))},addEdge(e){R({type:"add-edge",payload:e})},updateCells(e,t){var a=(0,pa.L)((0,aa.A)((0,aa.A)({},t),{},{layout:n,previousCells:W,cells:e,scaleRange:I,transform:O})),{shouldReCenter:i}=a,s=(0,ta.A)(a,ei);return i&&V(!1),R({type:"update-cells",payload:s.cells}),s},getTransform:()=>O,manuallyConnectNodes(e){var t=W.find((t=>y?(0,oa.o6)(t)&&t.id===e:(0,oa.N)(t)&&t.id===e));if(t){var a=S.current.getBoundingClientRect();return X({source:t,from:[t.view.x+t.view.width/2,t.view.y+t.view.height/2],offset:[a.left,a.top]}),new Promise(((e,t)=>{B.current={resolve:e,reject:t}}))}return Promise.reject(null)}})),[W,n,I,V,O,y]);var Z=(0,ue.useCallback)(((e,t)=>{for(var a,n=0;n<W.length;n++){var i=W[n];if((0,oa.o6)(i)&&i.id!==e.source.id&&i.view.x<t[0]&&i.view.x+i.view.width>t[0]&&i.view.y<t[1]&&i.view.y+i.view.height>t[1]){var s;null===(s=B.current)||void 0===s||s.resolve({source:e.source,target:i});break}}null===(a=B.current)||void 0===a||a.reject(null),X(null)}),[W]);(0,ue.useEffect)((()=>{ti(a,!(!U&&!K))}),[U,a,K]);var F=(0,va.J)({cellsRef:z,activeTarget:d,onActiveTargetChange:m}),[J,G]=(0,ue.useState)([]);(0,ue.useEffect)((()=>{var e=u?(0,ga.Y)(W,U,F,y):[];G((t=>0===t.length&&0===e.length?t:e))}),[F,W,U,u,y]),(0,ue.useEffect)((()=>{var e=S.current;if(e&&!($.length>0)){var t=e=>{var t=function(e,t){var{cells:a,activeTarget:n}=t,i=a.filter((e=>(0,ha.Q)(e,n)));if(0!==i.length)switch(e.key||e.keyCode||e.which){case"Backspace":case 8:case"Delete":case 46:return e.preventDefault(),e.stopPropagation(),{action:"delete-cells",cells:i}}}(e,{cells:W,activeTarget:F});"delete-cells"===(null==t?void 0:t.action)&&(M(t.cells),1===t.cells.length&&x(t.cells[0]))};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}}),[F,W,$.length,x,M]);var Q=(0,ue.useMemo)((()=>"".concat((0,be.uniqueId)("diagram-"),"-")),[]),ee="".concat(Q,"line-arrow-"),te=(0,ue.useCallback)((e=>{R({type:"move-cells",payload:e})}),[]),ae=(0,ue.useCallback)((e=>{R({type:"move-cells",payload:e}),_(e),1===e.length&&k(e[0])}),[k,_]),ne=(0,ue.useCallback)((e=>{R({type:"resize-cell",payload:e})}),[]),ie=(0,ue.useCallback)((e=>{R({type:"resize-cell",payload:e}),w(e)}),[w]),se=(0,ue.useCallback)((e=>{var{id:t,editing:a}=e;D(a?e=>e.includes(t)?e:[...e,t]:e=>e.filter((e=>e!==t)))}),[]),le=(0,ue.useCallback)(((e,t)=>{var a=q();R({type:"update-node-size",payload:{id:e,size:t},layoutKey:a})}),[q]),oe=(0,ue.useCallback)((e=>{H.scaleTo((0,Ae.A)(S.current),e/100)}),[H]),re=(0,ue.useCallback)((()=>{V(!1)}),[V]),[he,ce]=(0,ka.d)({cells:W,defaultEdgeLines:r,markerPrefix:ee}),de=(0,ba.H)({cells:W,layout:n,centered:j});return(0,ue.useEffect)((()=>{var e=S.current;if(e&&"lasso"===A){var t=e.getBoundingClientRect(),a=e=>{!function(e,t){var{transform:a,offset:n,onLassoing:i,onLassoed:s}=t;e.stopPropagation();var l=[e.clientX,e.clientY],o=(e.clientX-n[0]-a.x)/a.k,r=(e.clientY-n[1]-a.y)/a.k,h=!1,c=(e,t)=>{var n=function(e){return[(e.clientX-l[0])/a.k,(e.clientY-l[1])/a.k]}(e);if(h||(h=n[0]**2+n[1]**2>=9),h){var[c,d]=n,u=o,p=r;c<0&&(u=o+c,c=-c),d<0&&(p=r+d,d=-d),(t?s:i)({x:u,y:p,width:c,height:d})}},d=e=>{c(e)},u=e=>{c(e,!0),h=!1,document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}(e,{transform:O,offset:[t.left,t.top],onLassoing(e){Y(e)},onLassoed(e){Y(null);var t=[];for(var a of W)if((0,oa.o6)(a)){var n=a.view.x,i=a.view.y;n>=e.x&&n+a.view.width<=e.x+e.width&&i>=e.y&&i+a.view.height<=e.y+e.height&&t.push(a)}null==b||b(t.length>1?{type:"multi",targets:t.map(Qn.P)}:1===t.length?(0,Qn.P)(t[0]):null)}})};return e.addEventListener("mousedown",a),()=>{e.removeEventListener("mousedown",a)}}}),[O,W,A,b]),pe().createElement(pe().Fragment,null,pe().createElement("svg",{width:"100%",height:"100%",ref:S,className:me()("root",{grabbing:P,pannable:f,ready:de}),tabIndex:-1},pe().createElement("defs",null,ce.map(((e,t)=>pe().createElement(We.c,{key:t,id:"".concat(ee).concat(t),type:"arrow",strokeColor:e.strokeColor})))),pe().createElement("g",{transform:"translate(".concat(O.x," ").concat(O.y,") scale(").concat(O.k,")")},pe().createElement("g",{className:me()("cells",{allowEdgeToArea:y}),ref:z},W.map((e=>pe().createElement(ca.m,{key:"".concat(e.type,":").concat("edge"===e.type?"".concat(e.source,"~").concat(e.target):e.id),layout:n,cell:e,cells:W,degraded:L,degradedNodeLabel:c,defaultNodeBricks:o,transform:O,lineConfMap:he,activeTarget:F,unrelatedCells:J,onCellsMoving:te,onCellsMoved:ae,onCellResizing:ne,onCellResized:ie,onSwitchActiveTarget:b,onCellContextMenu:E,onDecoratorTextChange:C,onDecoratorTextEditing:se,onNodeBrickResize:le})))),pe().createElement(da,{connectLineState:U,transform:O,markerEnd:"".concat(ee,"0"),onConnect:Z}),K&&pe().createElement("rect",{x:K.x,y:K.y,width:K.width,height:K.height,fill:"var(--palette-gray-5)",fillOpacity:.3,stroke:"var(--palette-gray-5)",strokeDasharray:2}))),pe().createElement(ya.Y,{shadowRoot:a.shadowRoot,scale:O.k,scaleRange:I,onZoomChange:oe,onReCenter:re}))}wa=Vi,({e:[Ma,Ea,Ca,Na,Wa,Ta,Ra,La,Sa,za,Ba,$a,Da,Pa,Oa,Ha,Ia,Ka,Ya,Ua,Xa,ja,Va,qa,Za,Fa,Ja,Ga,Qa,en,tn,an,nn,sn,ln,on,rn,hn,cn,dn,un,pn,gn,fn,An,vn,yn,mn,bn,kn,wn,xn,_n,Mn,En,Cn,Nn,Wn,Tn,Rn,Ln,Sn,zn,Bn,$n,Dn,Pn,On,Hn,In,Kn,Yn,Un,Xn,jn,Vn,qn,Zn,xa],c:[Fn,_a]}=(0,de.A)(wa,[ai("eo-draw-canvas",{styleTexts:[Jn.A,Gn.A]})],[[ni({attribute:!1}),1,"cells"],[ni({type:String}),1,"layout"],[ni({attribute:!1}),1,"layoutOptions"],[ni({attribute:!1}),1,"defaultNodeSize"],[ni({attribute:!1}),1,"defaultNodeBricks"],[ni({type:Number}),1,"degradedThreshold"],[ni({attribute:!1}),1,"degradedNodeLabel"],[ni({attribute:!1}),1,"defaultEdgeLines"],[ni({attribute:!1}),1,"activeTarget"],[ni({type:Boolean}),1,"fadeUnrelatedCells"],[ni({type:Boolean}),1,"zoomable"],[ni({type:Boolean}),1,"scrollable"],[ni({type:Boolean}),1,"pannable"],[ni({type:Boolean}),1,"selectable"],[ni({type:Boolean}),1,"allowEdgeToArea"],[ni(),1,"dragBehavior"],[ni({attribute:!1}),1,"scaleRange"],[si({type:"activeTarget.change"}),1,"activeTargetChangeEvent",e=>(0,ce.A)(_i,e),(e,t)=>(0,he.A)(_i,e,t)],[si({type:"node.move"}),1,"nodeMoveEvent",e=>(0,ce.A)(Ni,e),(e,t)=>(0,he.A)(Ni,e,t)],[si({type:"cell.move"}),1,"cellMoveEvent",e=>(0,ce.A)(Wi,e),(e,t)=>(0,he.A)(Wi,e,t)],[si({type:"cells.move"}),1,"cellsMoveEvent",e=>(0,ce.A)(Ri,e),(e,t)=>(0,he.A)(Ri,e,t)],[si({type:"cell.resize"}),1,"cellResizeEvent",e=>(0,ce.A)(Si,e),(e,t)=>(0,he.A)(Si,e,t)],[si({type:"node.delete"}),1,"nodeDelete",e=>(0,ce.A)(Bi,e),(e,t)=>(0,he.A)(Bi,e,t)],[si({type:"cell.delete"}),1,"cellDelete",e=>(0,ce.A)($i,e),(e,t)=>(0,he.A)($i,e,t)],[si({type:"cells.delete"}),1,"cellsDelete",e=>(0,ce.A)(Pi,e),(e,t)=>(0,he.A)(Pi,e,t)],[si({type:"cell.contextmenu"}),1,"cellContextMenu",e=>(0,ce.A)(Hi,e),(e,t)=>(0,he.A)(Hi,e,t)],[si({type:"decorator.text.change"}),1,"decoratorTextChange",e=>(0,ce.A)(Ki,e),(e,t)=>(0,he.A)(Ki,e,t)],[si({type:"scale.change"}),1,"scaleChange",e=>(0,ce.A)(Ui,e),(e,t)=>(0,he.A)(Ui,e,t)],[ii(),2,"dropNode"],[ii(),2,"dropDecorator"],[ii(),2,"addNodes"],[ii(),2,"addEdge"],[ii(),2,"manuallyConnectNodes"],[ii(),2,"updateCells"]],0,(e=>ji.has((0,oe.A)(e))),fe.ReactNextElement)),_a();var Fi,Ji,Gi,Qi,es,ts,as,ns,is,ss,ls,os,rs,hs,cs,ds,us,ps,gs,fs,As,vs,ys,ms,bs,ks,ws,xs,_s,Ms,Es,Cs,Ns,Ws,Ts,Rs,Ls,Ss,zs,Bs,$s,Ds,Ps,Os,Hs,Is,Ks,Ys,Us,Xs,js,Vs,qs,Zs,Fs,Js,Gs,Qs,el,tl,al,nl,il,sl=a(497),{defineElement:ll,property:ol,event:rl}=(0,ge.createDecorators)(),hl=new WeakMap,cl=new WeakMap,dl=new WeakMap,ul=new WeakMap,pl=new WeakSet,gl=new WeakMap,fl=new WeakMap,Al=new WeakMap,vl=new WeakMap,yl=new WeakMap;class ml extends fe.ReactNextElement{constructor(){super(...arguments),(0,se.A)(this,pl),(0,le.A)(this,hl,Gi(this)),(0,le.A)(this,cl,(Qi(this),es(this))),(0,le.A)(this,dl,(ts(this),as(this))),(0,le.A)(this,ul,(ns(this),is(this))),(0,le.A)(this,gl,(os(this),e=>{(0,re.A)(pl,this,ss).emit(e)})),(0,le.A)(this,fl,rs(this)),(0,le.A)(this,Al,(ds(this),e=>{(0,re.A)(pl,this,hs).emit(e)})),(0,le.A)(this,vl,us(this)),(0,le.A)(this,yl,(fs(this),e=>{(0,re.A)(pl,this,ps).emit(e)}))}get usage(){return(0,ce.A)(hl,this)}set usage(e){(0,he.A)(hl,this,e)}get status(){return(0,ce.A)(cl,this)}set status(e){(0,he.A)(cl,this,e)}get decorator(){return(0,ce.A)(dl,this)}set decorator(e){(0,he.A)(dl,this,e)}render(){return pe().createElement(bl,{usage:this.usage,onDragStart:(0,ce.A)(gl,this),onDragMove:(0,ce.A)(Al,this),onDragEnd:(0,ce.A)(yl,this)})}}function bl(e){var{usage:t,onDragStart:a,onDragMove:n,onDragEnd:i}=e,s=(0,ue.useCallback)((e=>{if("library"===t){e.stopPropagation(),e.preventDefault();var s=[e.clientX,e.clientY],l=!1,o=e=>{l||(l=(e.clientX-s[0])**2+(e.clientY-s[1])**2>=9)&&(null==a||a([e.clientX,e.clientY])),l&&(null==n||n([e.clientX,e.clientY]))},r=e=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),l&&(null==i||i([e.clientX,e.clientY]))};document.addEventListener("mousemove",o),document.addEventListener("mouseup",r)}}),[i,n,a,t]);return pe().createElement("div",{onMouseDown:s},pe().createElement("slot",null))}Fi=ml,({e:[Gi,Qi,es,ts,as,ns,is,ss,ls,os,rs,hs,cs,ds,us,ps,gs,fs],c:[As,Ji]}=(0,de.A)(Fi,[ll("diagram.experimental-node",{styleTexts:[sl.A]})],[[ol(),1,"usage"],[ol({type:String,render:!1}),1,"status"],[ol({type:String}),1,"decorator"],[rl({type:"drag.start"}),1,"dragStartEvent",e=>(0,ce.A)(ul,e),(e,t)=>(0,he.A)(ul,e,t)],[rl({type:"drag.move"}),1,"dragMoveEvent",e=>(0,ce.A)(fl,e),(e,t)=>(0,he.A)(fl,e,t)],[rl({type:"drag.end"}),1,"dragEndEvent",e=>(0,ce.A)(vl,e),(e,t)=>(0,he.A)(vl,e,t)]],0,(e=>yl.has((0,oe.A)(e))),fe.ReactNextElement)),Ji();var kl,{defineElement:wl,property:xl,event:_l}=(0,ge.createDecorators)(),Ml=new WeakMap,El=new WeakMap,Cl=new WeakMap,Nl=new WeakMap,Wl=new WeakMap,Tl=new WeakMap,Rl=new WeakMap,Ll=new WeakMap,Sl=new WeakMap,zl=new WeakMap,Bl=new WeakMap,$l=new WeakMap,Dl=new WeakMap,Pl=new WeakMap,Ol=new WeakMap,Hl=new WeakSet,Il=new WeakMap,Kl=new WeakMap,Yl=new WeakMap,Ul=new WeakMap,Xl=new WeakMap,jl=new WeakMap;class Vl extends fe.ReactNextElement{constructor(){super(...arguments),(0,se.A)(this,Hl),(0,le.A)(this,Ml,ms(this)),(0,le.A)(this,El,(bs(this),ks(this))),(0,le.A)(this,Cl,(ws(this),xs(this))),(0,le.A)(this,Nl,(_s(this),Ms(this,[fa.HP,fa.HP]))),(0,le.A)(this,Wl,(Es(this),Cs(this))),(0,le.A)(this,Tl,(Ns(this),Ws(this))),(0,le.A)(this,Rl,(Ts(this),Rs(this))),(0,le.A)(this,Ll,(Ls(this),Ss(this))),(0,le.A)(this,Sl,(zs(this),Bs(this))),(0,le.A)(this,zl,($s(this),Ds(this))),(0,le.A)(this,Bl,(Ps(this),Os(this,!0))),(0,le.A)(this,$l,(Hs(this),Is(this,!0))),(0,le.A)(this,Dl,(Ks(this),Ys(this,!0))),(0,le.A)(this,Pl,(Us(this),Xs(this))),(0,le.A)(this,Ol,(js(this),Vs(this))),(0,le.A)(this,Il,(Fs(this),e=>{(0,re.A)(Hl,this,qs).emit(e)})),(0,le.A)(this,Kl,(e=>{(0,ra.c)(e,this.activeTarget)||(this.activeTarget=e)})),(0,le.A)(this,Yl,Js(this)),(0,le.A)(this,Ul,(el(this),e=>{(0,re.A)(Hl,this,Gs).emit(e)})),(0,le.A)(this,Xl,tl(this)),(0,le.A)(this,jl,(il(this),e=>{(0,re.A)(Hl,this,al).emit(e)}))}get cells(){return(0,ce.A)(Ml,this)}set cells(e){(0,he.A)(Ml,this,e)}get layout(){return(0,ce.A)(El,this)}set layout(e){(0,he.A)(El,this,e)}get layoutOptions(){return(0,ce.A)(Cl,this)}set layoutOptions(e){(0,he.A)(Cl,this,e)}get defaultNodeSize(){return(0,ce.A)(Nl,this)}set defaultNodeSize(e){(0,he.A)(Nl,this,e)}get defaultNodeBricks(){return(0,ce.A)(Wl,this)}set defaultNodeBricks(e){(0,he.A)(Wl,this,e)}get degradedThreshold(){return(0,ce.A)(Tl,this)}set degradedThreshold(e){(0,he.A)(Tl,this,e)}get degradedNodeLabel(){return(0,ce.A)(Rl,this)}set degradedNodeLabel(e){(0,he.A)(Rl,this,e)}get defaultEdgeLines(){return(0,ce.A)(Ll,this)}set defaultEdgeLines(e){(0,he.A)(Ll,this,e)}get activeTarget(){return(0,ce.A)(Sl,this)}set activeTarget(e){(0,he.A)(Sl,this,e)}get fadeUnrelatedCells(){return(0,ce.A)(zl,this)}set fadeUnrelatedCells(e){(0,he.A)(zl,this,e)}get zoomable(){return(0,ce.A)(Bl,this)}set zoomable(e){(0,he.A)(Bl,this,e)}get scrollable(){return(0,ce.A)($l,this)}set scrollable(e){(0,he.A)($l,this,e)}get pannable(){return(0,ce.A)(Dl,this)}set pannable(e){(0,he.A)(Dl,this,e)}get scaleRange(){return(0,ce.A)(Pl,this)}set scaleRange(e){(0,he.A)(Pl,this,e)}render(){return pe().createElement(ql,{shadowRoot:this.shadowRoot,cells:this.cells,layout:this.layout,layoutOptions:this.layoutOptions,defaultNodeSize:this.defaultNodeSize,defaultNodeBricks:this.defaultNodeBricks,defaultEdgeLines:this.defaultEdgeLines,degradedThreshold:this.degradedThreshold,degradedNodeLabel:this.degradedNodeLabel,activeTarget:this.activeTarget,fadeUnrelatedCells:this.fadeUnrelatedCells,zoomable:this.zoomable,scrollable:this.scrollable,pannable:this.pannable,scaleRange:this.scaleRange,onActiveTargetChange:(0,ce.A)(Il,this),onSwitchActiveTarget:(0,ce.A)(Kl,this),onCellContextMenu:(0,ce.A)(Ul,this),onCellClick:(0,ce.A)(jl,this)})}}function ql(e){var{shadowRoot:t,cells:a,layout:n,layoutOptions:i,defaultNodeSize:s,defaultNodeBricks:l,defaultEdgeLines:o,degradedThreshold:r,degradedNodeLabel:h,activeTarget:c,fadeUnrelatedCells:d,zoomable:u,scrollable:p,pannable:g,scaleRange:f,onActiveTargetChange:A,onSwitchActiveTarget:v,onCellContextMenu:y,onCellClick:m}=e,[{cells:b,layoutKey:k},w]=(0,ue.useReducer)(la.d,a,(e=>({cells:(0,ua.C)(e,{defaultNodeSize:s}),layoutKey:1}))),x=(0,ue.useMemo)((()=>b.filter(oa.N).length>=(null!=r?r:fa.pC)),[b,r]),_=(0,ue.useRef)(null),M=(0,ue.useRef)(null),{grabbing:E,transform:C,zoomer:N,scaleRange:W}=(0,Aa.f)({rootRef:_,zoomable:u,scrollable:p,pannable:g,draggable:!0,scaleRange:f,onSwitchActiveTarget:v}),{centered:T,setCentered:R,getNextLayoutKey:L}=(0,ma.g)({layout:n,layoutOptions:i,rootRef:_,cells:b,zoomable:u,zoomer:N,scaleRange:W,layoutKey:k,dispatch:w}),S=(0,ue.useCallback)((()=>{R(!1)}),[R]),z=(0,ue.useRef)(a);(0,ue.useEffect)((()=>{if(a!==z.current){z.current=a;var e=(0,pa.L)({canvasWidth:t.host.clientWidth,canvasHeight:t.host.clientHeight,defaultNodeSize:s,layout:n,previousCells:b,cells:a,scaleRange:W,transform:C});w({type:"update-cells",payload:e.cells})}}),[b,s,a,n,W,t,C]);var B=(0,va.J)({cellsRef:M,activeTarget:c,onActiveTargetChange:A}),$=(0,ue.useMemo)((()=>"".concat((0,be.uniqueId)("diagram-"),"-")),[]),D="".concat($,"line-arrow-"),P=(0,ue.useCallback)(((e,t)=>{w({type:"update-node-size",payload:{id:e,size:t},layoutKey:L()})}),[L]),[O,H]=(0,ue.useState)(null),I=(0,ue.useCallback)((e=>{H(e)}),[]),K=(0,ue.useCallback)((e=>{H((t=>t===e?null:t))}),[]),[Y,U]=(0,ue.useState)([]);(0,ue.useEffect)((()=>{var e=d?(0,ga.Y)(b,null,O):[];U((t=>0===t.length&&0===e.length?t:e))}),[b,d,O]);var X=(0,ue.useCallback)((e=>{N.scaleTo((0,Ae.A)(_.current),e/100)}),[N]),[j,V]=(0,ka.d)({cells:b,defaultEdgeLines:o,markerPrefix:D}),q=(0,ba.H)({cells:b,layout:n,centered:T});return pe().createElement(pe().Fragment,null,pe().createElement("svg",{width:"100%",height:"100%",ref:_,className:me()("root",{grabbing:E,pannable:g,ready:q}),tabIndex:-1},pe().createElement("defs",null,V.map(((e,t)=>pe().createElement(We.c,{key:t,id:"".concat(D).concat(t),type:"arrow",strokeColor:e.strokeColor})))),pe().createElement("g",{transform:"translate(".concat(C.x," ").concat(C.y,") scale(").concat(C.k,")")},pe().createElement("g",{className:"cells",ref:M},b.map((e=>pe().createElement(ca.m,{key:"".concat(e.type,":").concat((0,oa.WW)(e)?"".concat(e.source,"~").concat(e.target):e.id),layout:void 0,cell:e,cells:b,degraded:x,degradedNodeLabel:h,defaultNodeBricks:l,lineConfMap:j,transform:C,activeTarget:B,readOnly:!0,unrelatedCells:Y,onSwitchActiveTarget:v,onCellContextMenu:y,onCellClick:m,onNodeBrickResize:P,onCellMouseEnter:d&&(0,oa.N)(e)?I:void 0,onCellMouseLeave:d&&(0,oa.N)(e)?K:void 0})))))),pe().createElement(ya.Y,{shadowRoot:t,scale:C.k,scaleRange:W,onZoomChange:X,onReCenter:S}))}vs=Vl,({e:[ms,bs,ks,ws,xs,_s,Ms,Es,Cs,Ns,Ws,Ts,Rs,Ls,Ss,zs,Bs,$s,Ds,Ps,Os,Hs,Is,Ks,Ys,Us,Xs,js,Vs,qs,Zs,Fs,Js,Gs,Qs,el,tl,al,nl,il],c:[kl,ys]}=(0,de.A)(vs,[wl("eo-display-canvas",{styleTexts:[Jn.A,Gn.A]})],[[xl({attribute:!1}),1,"cells"],[xl({type:String}),1,"layout"],[xl({attribute:!1}),1,"layoutOptions"],[xl({attribute:!1}),1,"defaultNodeSize"],[xl({attribute:!1}),1,"defaultNodeBricks"],[xl({type:Number}),1,"degradedThreshold"],[xl({attribute:!1}),1,"degradedNodeLabel"],[xl({attribute:!1}),1,"defaultEdgeLines"],[xl({attribute:!1}),1,"activeTarget"],[xl({type:Boolean}),1,"fadeUnrelatedCells"],[xl({type:Boolean}),1,"zoomable"],[xl({type:Boolean}),1,"scrollable"],[xl({type:Boolean}),1,"pannable"],[xl({attribute:!1}),1,"scaleRange"],[_l({type:"activeTarget.change"}),1,"activeTargetChangeEvent",e=>(0,ce.A)(Ol,e),(e,t)=>(0,he.A)(Ol,e,t)],[_l({type:"cell.contextmenu"}),1,"cellContextMenu",e=>(0,ce.A)(Yl,e),(e,t)=>(0,he.A)(Yl,e,t)],[_l({type:"cell.click"}),1,"cellClick",e=>(0,ce.A)(Xl,e),(e,t)=>(0,he.A)(Xl,e,t)]],0,(e=>jl.has((0,oe.A)(e))),fe.ReactNextElement)),ys()},3971:(e,t,a)=>{a.d(t,{A:()=>o});var n=a(6758),i=a.n(n),s=a(935),l=a.n(s)()(i());l.push([e.id,':host{display:block;--local-label-line-height:inherit;--local-label-font-size:inherit;--local-label-color:inherit;--local-label-font-weight:inherit}:host([hidden]){display:none}:host([type="line"]){--local-label-line-height:18px;--local-label-font-size:11px;--local-label-color:var(--color-secondary-text);--local-label-font-weight:400}*{box-sizing:border-box}.label{max-width:168px;margin:-3px}.label-text,\n.label-input{width:100%;height:24px;padding:3px;border:none;line-height:var(--local-label-line-height);font-size:var(--local-label-font-size);color:var(--local-label-color);font-weight:var(--local-label-font-weight);text-align:center;font-family:inherit;cursor:text;-webkit-user-select:text;-moz-user-select:text;user-select:text}.label-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.label.editing .label-text,\n.label.empty:not(.editing) .label-text,\n.label:not(.editing) .label-input{display:none}',""]);const o=l.toString()},497:(e,t,a)=>{a.d(t,{A:()=>o});var n=a(6758),i=a.n(n),s=a(935),l=a.n(s)()(i());l.push([e.id,'*{box-sizing:border-box}:host{display:block;border:1px solid var(--palette-gray-5);cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([hidden]){display:none}:host([usage="dragging"]){opacity:0.75;position:fixed}:host(:not([usage="library"])){background:var(--palette-gray-3);width:60px;height:60px}:host([usage="library"]){width:180px;height:30px;margin-bottom:10px}div{width:100%;height:100%;display:flex;align-items:center;justify-content:center}:host(:not([usage="dragging"]):not([usage="library"]):hover),\n:host([status="highlighted"]){color:var(--palette-blue-5);background:var(--palette-blue-1);border-color:1px solid var(--palette-blue-4)}:host([status="faded"]){opacity:0.3}:host([decorator="area"]){width:100px;height:60px;background:rgba(119,141,195,0.1);border:none}:host([decorator="text"]){width:auto;height:auto;background:none;border:none}',""]);const o=l.toString()},6330:(e,t,a)=>{function n(e,t,a,n,i,s,l){try{var o=e[s](l),r=o.value}catch(e){return void a(e)}o.done?t(r):Promise.resolve(r).then(n,i)}function i(e){return function(){var t=this,a=arguments;return new Promise((function(i,s){var l=e.apply(t,a);function o(e){n(l,i,s,o,r,"next",e)}function r(e){n(l,i,s,o,r,"throw",e)}o(void 0)}))}}a.d(t,{A:()=>i})},780:(e,t,a)=>{a.d(t,{_:()=>s});var n=a(6330),i=a(3496),s=function(){var e=(0,n.A)((function*(e,t,a){return(yield i.http.post("api/gateway/cmdb.instance.CreateInstance/v2/object/".concat(e,"/instance"),t,a)).data}));return function(t,a,n){return e.apply(this,arguments)}}()},8406:(e,t,a)=>{a.d(t,{y:()=>s});var n=a(6330),i=a(3496),s=function(){var e=(0,n.A)((function*(e,t,a){return(yield i.http.post("api/gateway/cmdb.instance.PostSearchV3/v3/object/".concat(e,"/instance/_search"),t,a)).data}));return function(t,a,n){return e.apply(this,arguments)}}()},6841:(e,t,a)=>{a.d(t,{x:()=>s});var n=a(6330),i=a(3496),s=function(){var e=(0,n.A)((function*(e,t,a,n){return(yield i.http.put("api/gateway/cmdb.instance.UpdateInstanceV2/v2/object/".concat(e,"/instance/").concat(t),a,n)).data}));return function(t,a,n,i){return e.apply(this,arguments)}}()},4993:(e,t,a)=>{function n(e,t,a){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+a)/6)}function i(e){this._context=e}function s(e){return new i(e)}a.d(t,{Ay:()=>s}),i.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:n(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:n(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}},4643:(e,t,a)=>{a.d(t,{dJ:()=>i,kl:()=>s});class n{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}function i(e){return new n(e,!0)}function s(e){return new n(e,!1)}},482:(e,t,a)=>{function n(e){this._context=e}function i(e){return new n(e)}a.d(t,{A:()=>i}),n.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}}},3488:(e,t,a)=>{function n(e){return e<0?-1:1}function i(e,t,a){var i=e._x1-e._x0,s=t-e._x1,l=(e._y1-e._y0)/(i||s<0&&-0),o=(a-e._y1)/(s||i<0&&-0),r=(l*s+o*i)/(i+s);return(n(l)+n(o))*Math.min(Math.abs(l),Math.abs(o),.5*Math.abs(r))||0}function s(e,t){var a=e._x1-e._x0;return a?(3*(e._y1-e._y0)/a-t)/2:t}function l(e,t,a){var n=e._x0,i=e._y0,s=e._x1,l=e._y1,o=(s-n)/3;e._context.bezierCurveTo(n+o,i+o*t,s-o,l-o*a,s,l)}function o(e){this._context=e}function r(e){this._context=new h(e)}function h(e){this._context=e}function c(e){return new o(e)}function d(e){return new r(e)}a.d(t,{G:()=>c,N:()=>d}),o.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:l(this,this._t0,s(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var a=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,l(this,s(this,a=i(this,e,t)),a);break;default:l(this,this._t0,a=i(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=a}}},(r.prototype=Object.create(o.prototype)).point=function(e,t){o.prototype.point.call(this,t,e)},h.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,a,n,i,s){this._context.bezierCurveTo(t,e,n,a,s,i)}}},6066:(e,t,a)=>{function n(e){this._context=e}function i(e){var t,a,n=e.length-1,i=new Array(n),s=new Array(n),l=new Array(n);for(i[0]=0,s[0]=2,l[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,s[t]=4,l[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,s[n-1]=7,l[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)a=i[t]/s[t-1],s[t]-=a,l[t]-=a*l[t-1];for(i[n-1]=l[n-1]/s[n-1],t=n-2;t>=0;--t)i[t]=(l[t]-i[t+1])/s[t];for(s[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)s[t]=2*e[t+1]-i[t+1];return[i,s]}function s(e){return new n(e)}a.d(t,{A:()=>s}),n.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,a=e.length;if(a)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===a)this._context.lineTo(e[1],t[1]);else for(var n=i(e),s=i(t),l=0,o=1;o<a;++l,++o)this._context.bezierCurveTo(n[0][l],s[0][l],n[1][l],s[1][l],e[o],t[o]);(this._line||0!==this._line&&1===a)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}}},3269:(e,t,a)=>{function n(e){return function(){return e}}a.d(t,{A:()=>p}),Array.prototype.slice;var i=a(482);const s=Math.PI,l=2*s,o=1e-6,r=l-o;function h(e){this._+=e[0];for(let t=1,a=e.length;t<a;++t)this._+=arguments[t]+e[t]}class c{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?h:function(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return h;const a=10**t;return function(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=Math.round(arguments[t]*a)/a+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,a,n){this._append`Q${+e},${+t},${this._x1=+a},${this._y1=+n}`}bezierCurveTo(e,t,a,n,i,s){this._append`C${+e},${+t},${+a},${+n},${this._x1=+i},${this._y1=+s}`}arcTo(e,t,a,n,i){if(e=+e,t=+t,a=+a,n=+n,(i=+i)<0)throw new Error(`negative radius: ${i}`);let l=this._x1,r=this._y1,h=a-e,c=n-t,d=l-e,u=r-t,p=d*d+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(p>o)if(Math.abs(u*h-c*d)>o&&i){let g=a-l,f=n-r,A=h*h+c*c,v=g*g+f*f,y=Math.sqrt(A),m=Math.sqrt(p),b=i*Math.tan((s-Math.acos((A+p-v)/(2*y*m)))/2),k=b/m,w=b/y;Math.abs(k-1)>o&&this._append`L${e+k*d},${t+k*u}`,this._append`A${i},${i},0,0,${+(u*g>d*f)},${this._x1=e+w*h},${this._y1=t+w*c}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,a,n,i,h){if(e=+e,t=+t,h=!!h,(a=+a)<0)throw new Error(`negative radius: ${a}`);let c=a*Math.cos(n),d=a*Math.sin(n),u=e+c,p=t+d,g=1^h,f=h?n-i:i-n;null===this._x1?this._append`M${u},${p}`:(Math.abs(this._x1-u)>o||Math.abs(this._y1-p)>o)&&this._append`L${u},${p}`,a&&(f<0&&(f=f%l+l),f>r?this._append`A${a},${a},0,1,${g},${e-c},${t-d}A${a},${a},0,1,${g},${this._x1=u},${this._y1=p}`:f>o&&this._append`A${a},${a},0,${+(f>=s)},${g},${this._x1=e+a*Math.cos(i)},${this._y1=t+a*Math.sin(i)}`)}rect(e,t,a,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${a=+a}v${+n}h${-a}Z`}toString(){return this._}}function d(e){return e[0]}function u(e){return e[1]}function p(e,t){var a=n(!0),s=null,l=i.A,o=null,r=function(e){let t=3;return e.digits=function(a){if(!arguments.length)return t;if(null==a)t=null;else{const e=Math.floor(a);if(!(e>=0))throw new RangeError(`invalid digits: ${a}`);t=e}return e},()=>new c(t)}(h);function h(n){var i,h,c,d=(n=function(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(n)).length,u=!1;for(null==s&&(o=l(c=r())),i=0;i<=d;++i)!(i<d&&a(h=n[i],i,n))===u&&((u=!u)?o.lineStart():o.lineEnd()),u&&o.point(+e(h,i,n),+t(h,i,n));if(c)return o=null,c+""||null}return e="function"==typeof e?e:void 0===e?d:n(e),t="function"==typeof t?t:void 0===t?u:n(t),h.x=function(t){return arguments.length?(e="function"==typeof t?t:n(+t),h):e},h.y=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),h):t},h.defined=function(e){return arguments.length?(a="function"==typeof e?e:n(!!e),h):a},h.curve=function(e){return arguments.length?(l=e,null!=s&&(o=l(s)),h):l},h.context=function(e){return arguments.length?(null==e?s=o=null:o=l(s=e),h):s},h}c.prototype}}]);
|
|
3
|
+
//# sourceMappingURL=4937.2424a99b.js.map
|