@next-bricks/diagram 0.30.0 → 0.30.1

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 CHANGED
@@ -6,8 +6,8 @@
6
6
  ],
7
7
  "elements": [
8
8
  "eo-diagram",
9
- "eo-display-canvas",
10
- "eo-draw-canvas"
9
+ "eo-draw-canvas",
10
+ "eo-display-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.439a5d8f.js"
18
+ "filePath": "bricks/diagram/dist/index.183d18fe.js"
19
19
  }
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunk_next_bricks_diagram=self.webpackChunk_next_bricks_diagram||[]).push([[709],{3739:(e,t,r)=>{r.d(t,{c:()=>o});var n=r(8769),a=r.n(n);function o(e){var t,{id:r,type:n,strokeColor:o}=e;switch(n){case"0..1":t=l;break;case"0..N":t=d;break;default:t=i}return a().createElement(t,{id:r,strokeColor:o})}function i(e){var{id:t,strokeColor:r}=e;return a().createElement("marker",{id:t,viewBox:"0 0 6 6",refX:5,refY:3,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",strokeLinejoin:"round"},a().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 a().createElement("marker",{id:t,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},a().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 a().createElement("marker",{id:t,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},a().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:()=>a});var n=r(733);function a(e,t){if(e===t||(0,n.w)(e,t,0,0))return null;var r,a,o,i,l=t.x-e.x,d=t.y-e.y,c=l>0?1:-1;if(0!==d){var s=Math.abs(l/d),u=d>0?1:-1;s<e.width/e.height?(r=e.x+s*e.height/2*c,a=e.y+e.height/2*u):(r=e.x+e.width/2*c,a=e.y+e.width/2/s*u),s<t.width/t.height?(o=t.x-s*t.height/2*c,i=t.y-t.height/2*u):(o=t.x-t.width/2*c,i=t.y-t.width/2/s*u)}else r=e.x+e.width/2*c,o=t.x-t.width/2*c,a=i=e.y;return[{x:r,y:a},{x:o,y:i}]}},733:(e,t,r)=>{function n(e,t,r,n){var o=r?a(e,r):e,i=n?a(t,n):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),c=Math.min(o.y-o.height/2,i.y-i.height/2),s=Math.max(o.y+o.height/2,i.y+i.height/2);return d-l<o.width+i.width&&s-c<o.height+i.height}function a(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:()=>n})},8802:(e,t,r)=>{function n(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:()=>n})},2830:(e,t,r)=>{r.d(t,{m:()=>C});var n=r(8769),a=r.n(n),o=r(3373),i=r.n(o),l=r(531),d=r(3188);function c(e,t){return e.find((e=>(0,l.N)(e)&&e.id===t))}function s(e){var{edge:t,cells:r,lineConfMap:o}=e,l=(0,n.useMemo)((()=>c(r,t.source)),[r,t.source]),s=(0,n.useMemo)((()=>c(r,t.target)),[r,t.target]),h=(0,n.useMemo)((()=>o.get(t)),[t,o]),v=(0,n.useMemo)((()=>l&&s&&null!=l.view.x&&null!=s.view.x?(0,d.h)(u(l.view,5),u(s.view,5)):null),[l,s]);if(!v)return null;var f="M".concat(v[0].x," ").concat(v[0].y,"L").concat(v[1].x," ").concat(v[1].y);return a().createElement(a().Fragment,null,a().createElement("path",{d:f,fill:"none",stroke:"transparent",strokeWidth:h.interactStrokeWidth}),a().createElement("path",{className:i()("line",{dashed:h.dashed}),d:f,fill:"none",stroke:h.strokeColor,strokeWidth:h.strokeWidth,markerEnd:h.markerEnd}),a().createElement("path",{className:"line-active-bg",d:f,fill:"none"}))}function u(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(4993),v=r(7410),f=r(1030),m=r(9126);function g(e){var{node:t,defaultNodeBricks:r,onResize:o}=e,i=function(e){var[t,r]=(0,n.useState)(e);return(0,n.useEffect)((()=>{r((t=>(0,f.isEqual)(t,e)?t:e))}),[e]),t}({node:{id:t.id,data:t.data}}),l=t.useBrick,d=(0,n.useRef)(null),c=(0,n.useMemo)((()=>{var e;return null!=l?l:null==r||null===(e=r.find((e=>(0,v.checkIfByTransform)(e,i))))||void 0===e?void 0:e.useBrick}),[r,l,i]),s=(0,n.useCallback)((e=>{var r=d.current;r&&(r.disconnect(),d.current=null),e?setTimeout((()=>{var r=new m.A((()=>{o(t.id,[e.offsetWidth,e.offsetHeight])}));r.observe(e),d.current=r})):o(t.id,null)}),[t.id,o]);return c?a().createElement("foreignObject",{width:9999,height:9999,className:"node"},c&&a().createElement(h.ReactUseBrick,{useBrick:c,data:i,refCallback:s})):null}function p(e){return"edge"===e.type?(0,f.pick)(e,["type","source","target","data"]):(0,f.pick)(e,["type","id","data"])}function w(e,t){var{action:r,cell:n,scale:a,layout:o,onCellMoving:i,onCellMoved:d,onCellResizing:c,onCellResized:s,onSwitchActiveTarget:u}=t;if(e.stopPropagation(),null==u||u(p(n)),!(0,l.WW)(n)&&("force"!==o&&"dagre"!==o||!(0,l.N)(n))){var h=[e.clientX,e.clientY],v="move"===r?[n.view.x,n.view.y]:[n.view.width,n.view.height],f=!1,m=(e,t)=>{var o,l,u=function(e){return[(e.clientX-h[0])/a,(e.clientY-h[1])/a]}(e);f||(f=u[0]**2+u[1]**2>=9),f&&("move"===r?null===(o=t?d:i)||void 0===o||o({type:n.type,id:n.id,x:v[0]+u[0],y:v[1]+u[1]}):null===(l=t?s:c)||void 0===l||l({type:n.type,id:n.id,width:v[0]+u[0],height:v[1]+u[1]}))},g=e=>{m(e)},w=e=>{m(e,!0),f=!1,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",w)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",w)}}function y(e){var{cell:t,transform:r,readOnly:o,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d}=e,c=a().useRef(null);return(0,n.useEffect)((()=>{var e=c.current;if(e&&!o){var n=e=>{w(e,{action:"resize",cell:t,scale:r.k,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d})};return e.addEventListener("mousedown",n),()=>{e.removeEventListener("mousedown",n)}}}),[t,l,i,d,o,r.k]),a().createElement("g",{className:"decorator-area"},a().createElement("rect",{width:t.view.width,height:t.view.height,className:"area"}),!o&&a().createElement("g",{ref:c,className:"resize-handle",transform:"translate(".concat(t.view.width-20," ").concat(t.view.height-20,")")},a().createElement("rect",{width:20,height:20}),a().createElement("path",{d:"M10 18L18 10 M15 18L18 15"})))}var x=r(9740);function k(e){var t,{cell:r,readOnly:o,onDecoratorTextEditing:l,onDecoratorTextChange:d}=e,c=null!==(t=r.view.text)&&void 0!==t?t:"",[s,u]=(0,n.useState)(c),[h,v]=(0,n.useState)(!1),f=(0,n.useRef)(!1),[m,g]=(0,n.useState)(!1),p=(0,n.useRef)(null),w=(0,n.useCallback)((e=>{o||(e.preventDefault(),e.stopPropagation(),v(!0))}),[o]);(0,n.useEffect)((()=>{var e=p.current;e&&e.textContent!==s&&(e.textContent=s)}),[s]),(0,n.useEffect)((()=>{h&&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:h})}),[r.id,h,l]),(0,n.useEffect)((()=>{f.current?null==l||l({id:r.id,editing:h}):f.current=!0}),[r.id,h,l]);var y=(0,n.useCallback)((e=>{o||u(e.target.textContent)}),[o]),k=(0,n.useCallback)((()=>{o||(v(!1),g(!0))}),[o]);return(0,n.useEffect)((()=>{m&&(null==d||d({id:r.id,view:(0,x.A)((0,x.A)({},r.view),{},{text:s})}),g(!1))}),[r,s,d,m]),a().createElement("foreignObject",{className:"decorator-text"},a().createElement("div",{className:i()("text-container",{editing:h}),onDoubleClick:w},a().createElement("div",{className:"text",contentEditable:h,ref:p,onInput:y,onBlur:k})))}function b(e){var t,{cell:r,transform:n,readOnly:o,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d,onDecoratorTextEditing:c,onDecoratorTextChange:s}=e;switch(r.decorator){case"area":t=y;break;case"text":t=k;break;default:return console.error("Unknown decorator: ".concat(r.decorator)),null}return a().createElement(t,{cell:r,transform:n,readOnly:o,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d,onDecoratorTextEditing:c,onDecoratorTextChange:s})}var E=r(8185);function C(e){var{layout:t,cell:r,cells:o,defaultNodeBricks:d,lineConfMap:c,active:u,readOnly:h,transform:v,unrelatedCells:f,onCellMoving:m,onCellMoved:y,onCellResizing:x,onCellResized:k,onSwitchActiveTarget:C,onCellContextMenu:z,onDecoratorTextEditing:A,onDecoratorTextChange:M,onNodeBrickResize:R,onCellMouseEnter:N,onCellMouseLeave:W}=e,S=(0,n.useRef)(null),L=(0,n.useMemo)((()=>f.some((e=>(0,E.c)(e,r)))),[r,f]);(0,n.useEffect)((()=>{var e=S.current;if(e&&!h){var n=e=>{w(e,{layout:t,action:"move",cell:r,scale:v.k,onCellMoving:m,onCellMoved:y,onSwitchActiveTarget:C})};return e.addEventListener("mousedown",n),()=>{e.removeEventListener("mousedown",n)}}}),[t,r,y,m,C,h,v.k]);var T=(0,n.useCallback)((e=>{h&&"decorator"===r.type||(e.preventDefault(),C(p(r)),z({cell:r,clientX:e.clientX,clientY:e.clientY}))}),[r,z,C,h]),D=(0,n.useCallback)((()=>{null==N||N(r)}),[r,N]),H=(0,n.useCallback)((()=>{null==W||W(r)}),[r,W]);return a().createElement("g",{className:i()("cell",{active:u,faded:L,"read-only":h}),ref:S,transform:"edge"===r.type||null==r.view.x?void 0:"translate(".concat(r.view.x," ").concat(r.view.y,")"),onContextMenu:T,onMouseEnter:D,onMouseLeave:H},(0,l.N)(r)?a().createElement(g,{node:r,defaultNodeBricks:d,onResize:R}):(0,l.WW)(r)?a().createElement(s,{edge:r,cells:o,lineConfMap:c}):(0,l.mH)(r)?a().createElement(b,{cell:r,transform:v,readOnly:h,onCellResizing:x,onCellResized:k,onSwitchActiveTarget:C,onDecoratorTextEditing:A,onDecoratorTextChange:M}):null)}},3033:(e,t,r)=>{r.d(t,{CV:()=>n,HP:()=>o,Ie:()=>v,N8:()=>l,VO:()=>h,Yt:()=>s,mF:()=>u,sS:()=>c,sz:()=>i,w1:()=>d,xc:()=>a});var n=Symbol.for("size-initialized"),a=Symbol.for("layout-initialized"),o=20,i=36,l=100,d=60,c=.5,s=2,u="gray",h=1,v=15},531:(e,t,r)=>{function n(e){return"node"===e.type}function a(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}r.d(t,{N:()=>n,WW:()=>i,mH:()=>a,nv:()=>l,vC:()=>o})},227:(e,t,r)=>{r.d(t,{Y:()=>a});var n=r(8185);function a(e,t,r){var a=[];if(t){var o=new Set;for(var i of e)"edge"===i.type&&i.source===t.source.id&&o.add(i.target);for(var l of e)"node"===l.type?o.has(l.id)&&a.push(l):a.push(l)}else switch(null==r?void 0:r.type){case"node":var d=new Map,c=new Set([r.id]);for(var s of e)"node"===s.type?d.set(s.id,s):"edge"===s.type?s.source===r.id?c.add(s.target):s.target===r.id?c.add(s.source):a.push(s):a.push(s);for(var[u,h]of d)c.has(u)||a.push(h);break;case"edge":for(var v of e)("edge"===v.type?(0,n.c)(v,r):"node"===v.type&&(v.id===r.source||v.id===r.target))||a.push(v);break;case"decorator":for(var f of e)"decorator"===f.type&&f.id===r.id||a.push(f)}return a}},3783:(e,t,r)=>{r.d(t,{C:()=>o});var n=r(9740),a=r(531);function o(e,t){var{defaultNodeSize:r}=t;return(null!=e?e:[]).map((e=>{var t,o;return!(0,a.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,n.A)((0,n.A)({},e),{},{view:(0,n.A)({width:r[0],height:r[1]},e.view)})}))}},8185:(e,t,r)=>{function n(e,t){return e?!!t&&e.type===t.type&&("node"===e.type||"decorator"===e.type?e.id===t.id:e.source===t.source&&e.target===t.target):!t}r.d(t,{c:()=>n})},908:(e,t,r)=>{r.d(t,{r:()=>a});var n=r(531);function a(e,t){var{canvasWidth:r,canvasHeight:a,scaleRange:o}=t,i=1/0,l=1/0,d=-1/0,c=-1/0,s=!0;for(var u of e)if(!(0,n.WW)(u)){s=!1;var{view:h}=u,v=h.x+h.width,f=h.y+h.height;h.x<i&&(i=h.x),v>d&&(d=v),h.y<l&&(l=h.y),f>c&&(c=f)}var m=d-i,g=c-l,p=o&&!s&&(m>r||g>a)?Math.max(Math.min(r/m,a/g,o[1]),o[0]):1;return{x:s?0:(r-m*p)/2-i*p,y:s?0:(a-g*p)/2-l*p,k:p}}},1083:(e,t,r)=>{r.d(t,{d:()=>d});var n=r(9740),a=r(531),o=r(3033);function i(e,t,r){var n=e.findLastIndex(r)+1;return[...e.slice(0,n),t,...e.slice(n)]}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-cell":var{type:l,id:d,x:c,y:s}=t.payload,u=e.findIndex((e=>e.type===l&&e.id===d));if(-1!==u){var h=e[u];return[...e.slice(0,u),(0,n.A)((0,n.A)({},h),{},{view:(0,n.A)((0,n.A)({},h.view),{},{x:c,y:s})}),...e.slice(u+1)]}return e;case"resize-cell":var{type:v,id:f,width:m,height:g}=t.payload,p=e.findIndex((e=>e.type===v&&e.id===f));if(-1!==p){var w=e[p];return[...e.slice(0,p),(0,n.A)((0,n.A)({},w),{},{view:(0,n.A)((0,n.A)({},w.view),{},{width:m,height:g})}),...e.slice(p+1)]}return e;case"update-cells":return t.payload;case"update-node-size":return e.map((e=>(0,a.N)(e)&&e.id===t.payload.id?(0,n.A)((0,n.A)({},e),{},{[o.CV]:!0,view:t.payload.size?(0,n.A)((0,n.A)({},e.view),{},{width:t.payload.size[0],height:t.payload.size[1]}):e.view}):e))}return e}},(e,t)=>Object.fromEntries(Object.entries(l).map((r=>{var[n,a]=r;return[n,a(e[n],t)]}))))},7099:(e,t,r)=>{r.d(t,{Y:()=>f});var n=r(8769),a=r.n(n),o=r(2657),i=r(6768),l=r(198),d=r(8621),c=r(4993),s=r(9575);const u=e=>n.createElement("svg",(0,s.A)({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24"},e),n.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"})),h=e=>n.createElement("svg",(0,s.A)({xmlns:"http://www.w3.org/2000/svg",width:128,height:128,className:"icon",viewBox:"0 0 1024 1024"},e),n.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"}),n.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"})),v=e=>n.createElement("svg",(0,s.A)({xmlns:"http://www.w3.org/2000/svg",width:128,height:128,className:"icon",viewBox:"0 0 1024 1024"},e),n.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"}),n.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:s,onZoomChange:f,onReCenter:m}=e,g=(0,c.useCurrentTheme)(),p=(0,n.useMemo)((()=>(0,d.VC)()),[]),w=(0,n.useRef)(null),y=100*s[0],x=100*s[1],k=100*r,b=(0,n.useMemo)((()=>({formatter:e=>"".concat(e,"%"),placement:"left",getPopupContainer:()=>w.current})),[]),E=(0,n.useCallback)((()=>{f(Math.min(k+5,x))}),[x,f,k]),C=(0,n.useCallback)((()=>{f(Math.max(k-5,y))}),[y,f,k]);return a().createElement(o.Ay,{theme:{algorithm:"dark-v2"===g?i.A.darkAlgorithm:i.A.defaultAlgorithm}},a().createElement(d.N7,{container:t,autoClear:!0,cache:p,hashPriority:"high"},a().createElement("div",{className:"zoom-bar",ref:w},a().createElement("div",{className:"center-button",onClick:m,role:"button"},a().createElement(u,null)),a().createElement("div",{className:"zoom-slider"},a().createElement("div",{className:"zoom-button",role:"button",onClick:E},a().createElement(h,null)),a().createElement(l.A,{min:y,max:x,value:k,step:5,vertical:!0,included:!1,tooltip:b,onChange:f}),a().createElement("div",{className:"zoom-button",role:"button",onClick:C},a().createElement(v,null))))))}},1819:(e,t,r)=>{r.d(t,{J:()=>o});var n=r(8769),a=r(8185);function o(e){var{cellsRef:t,activeTarget:r,onActiveTargetChange:o}=e,i=null!=r?r:null,[l,d]=(0,n.useState)(i);(0,n.useEffect)((()=>{d((e=>(0,a.c)(e,i)?e:i))}),[i]);var c=(0,n.useRef)(!1);return(0,n.useEffect)((()=>{c.current?o(l):c.current=!0}),[l,o]),(0,n.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}},2361:(e,t,r)=>{r.d(t,{g:()=>b});var n=r(4223),a=r(9740),o=r(8769),i=r(6149),l=r(4842),d=r(1945),c=r(9418),s=r(3854),u=r(7931),h=r(7586),v=r.n(h),f=r(1030),m=r(7566),g=r(1517),p=r(3033),w=r(531),y=r(908),x=r(8802),k=["nodePadding"];function b(e){var{layout:t,layoutOptions:r,rootRef:h,cells:b,zoomable:E,zoomer:C,scaleRange:z,dispatch:A}=e,[M,R]=(0,o.useState)("force"!==t&&"dagre"!==t),[N,W]=function(e){var{rootRef:t,cells:r,layoutInitialized:n,zoomable:a,zoomer:i,scaleRange:l}=e,[d,c]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{var e=t.current;if(e&&n&&!d&&r.some((e=>(0,w.N)(e)||(0,w.mH)(e)))&&!r.some((e=>(0,w.N)(e)&&!e[p.CV]))){var{k:o,x:s,y:u}=(0,y.r)(r,{canvasWidth:e.clientWidth,canvasHeight:e.clientHeight,scaleRange:a?l:void 0});i.transform((0,m.A)(e),new g.uV(o,s,u)),c(!0)}}),[r,d,n,t,l,a,i]),(0,o.useEffect)((()=>{r.some((e=>(0,w.N)(e)||(0,w.mH)(e)))||c(!1)}),[r]),[d,c]}({rootRef:h,layoutInitialized:M,cells:b,zoomable:E,zoomer:C,scaleRange:z}),S=(0,o.useRef)(null);return(0,o.useEffect)((()=>{if(!b.some((e=>(0,w.N)(e)&&!e[p.CV])))if("force"===t||"dagre"===t){if(e=S.current,o=b.filter(w.nv),(null==e?void 0:e.length)!==o.length||!e.every(((e,t)=>e===o[t]))){var e,o,h,m;if("force"===t){var g=r,{nodePadding:y,collide:E}=(0,a.A)((0,a.A)({nodePadding:0},(0,f.pick)(g,["nodePadding"])),{},{collide:!1!==(null==g?void 0:g.collide)&&(0,a.A)({radiusDiff:18,strength:1,iterations:1},!0===(null==g?void 0:g.collide)?null:null==g?void 0:g.collide)});m=(0,x.D)(y);var C=[],z=[],M=new Map;for(var N of b)if((0,w.N)(N)){var L={id:N.id,width:N.view.width+m[1]+m[3],height:N.view.height+m[0]+m[2]};C.push(L),M.set(L.id,L)}else(0,w.WW)(N)&&z.push({source:N.source,target:N.target});var T=(0,i.A)(z).id((e=>e.id)),D=(0,l.A)(C).force("link",T).force("x",(0,d.A)()).force("y",(0,c.A)()).force("charge",(0,s.A)());E&&D.force("collide",(0,u.A)().radius((e=>Math.sqrt(e.width**2+e.height**2)/2+E.radiusDiff)).strength(E.strength).iterations(E.iterations)),D.stop(),function(e){e.tick(Math.ceil(Math.log(e.alphaMin())/Math.log(1-e.alphaDecay())))}(D),h=e=>M.get(e)}else{var H=r,B=(0,a.A)({nodePadding:0,rankdir:"TB",ranksep:50,edgesep:10,nodesep:50},(0,f.pick)(H,["nodePadding","rankdir","ranksep","edgesep","nodesep","align"])),{nodePadding:V}=B,P=(0,n.A)(B,k);m=(0,x.D)(V);var O=new(v().graphlib.Graph);for(var I of(O.setGraph(P),O.setDefaultEdgeLabel((function(){return{}})),b))(0,w.N)(I)?O.setNode(I.id,{id:I.id,width:I.view.width+m[1]+m[3],height:I.view.height+m[0]+m[2]}):(0,w.WW)(I)&&O.setEdge(I.source,I.target);v().layout(O),h=e=>O.node(e)}var Y=b.map((e=>{if((0,w.N)(e)){var t=h(e.id);return(0,a.A)((0,a.A)({},e),{},{view:(0,a.A)((0,a.A)({},e.view),{},{x:t.x-t.width/2+m[3],y:t.y-t.height/2+m[0]}),[p.xc]:!0})}return e}));S.current=Y.filter(w.nv),A({type:"update-cells",payload:Y}),W(!1),R(!0)}}else R(!0)}),[b,A,t,r,W]),{centered:N,setCentered:W}}},7531:(e,t,r)=>{r.d(t,{d:()=>c});var n=r(9740),a=r(8769),o=r(7410),i=r(1030),l=r(531),d=r(3033);function c(e){var{cells:t,defaultEdgeLines:r,markerPrefix:c}=e;return(0,a.useMemo)((()=>{var e=[],a=new WeakMap,s=function(t){if((0,l.WW)(t)){var s=(0,n.A)({dashed:!1,strokeColor:d.mF,strokeWidth:d.VO,interactStrokeWidth:d.Ie},null==r?void 0:r.find((e=>(0,o.checkIfByTransform)(e,{edge:t})))),u=function(e,t){var r=(0,i.findIndex)(t,e);return-1===r&&(r=t.push(e)-1),r}({strokeColor:s.strokeColor},e);s.markerEnd="url(#".concat(c).concat(u,")"),a.set(t,s)}};for(var u of t)s(u);return[a,e]}),[t,r,c])}},8197:(e,t,r)=>{r.d(t,{H:()=>i});var n=r(8769),a=r(531),o=r(3033);function i(e){var{cells:t,layout:r,centered:i}=e;return(0,n.useMemo)((()=>i&&t.every((e=>!(0,a.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 n=r(8769),a=r(7566),o=r(1517),i=r(3033);function l(e){var{rootRef:t,zoomable:r,scrollable:l,pannable:d,scaleRange:c,onSwitchActiveTarget:s}=e,[u,h]=(0,n.useState)(!1),[v,f]=(0,n.useState)({k:1,x:0,y:0}),m=(0,n.useMemo)((()=>null!=c?c:[i.sS,i.Yt]),[c]),g=(0,n.useMemo)((()=>(0,o.s_)()),[]);return(0,n.useEffect)((()=>{var e=!1;g.scaleExtent(r?m:[1,1]).on("start",(()=>{e=!1,h(!0)})).on("zoom",(t=>{e=!0,f(t.transform)})).on("end",(()=>{h(!1),e||null==s||s(null)}))}),[s,m,r,g]),(0,n.useEffect)((()=>{var e=t.current;if(e){var n=(0,a.A)(e),o=()=>{n.on(".zoom",null).on(".zoom.custom",null).on("wheel",null)};if(r||l||d)return(r||l)&&n.on("wheel.zoom.custom",(e=>{e.ctrlKey||(e.stopImmediatePropagation(),l&&(e.preventDefault(),g.translateBy(n,e.wheelDeltaX/5,e.wheelDeltaY/5)))})),n.call(g).on("wheel",(e=>e.preventDefault())).on("dblclick.zoom",null).on("mousedown.zoom",null),d||n.on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),o;o()}}),[d,t,l,r,g]),{grabbing:u,transform:v,zoomer:g,scaleRange:m}}},8618:(e,t,r)=>{r.d(t,{A:()=>l});var n=r(6758),a=r.n(n),o=r(935),i=r.n(o)()(a());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 n=r(6758),a=r.n(n),o=r(935),i=r.n(o)()(a());i.push([e.id,"*{box-sizing:border-box}:host{display:block;position:relative;overflow:hidden}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}.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.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:4;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:4}.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}",""]);const l=i.toString()}}]);
2
- //# sourceMappingURL=709.bc74a999.js.map
1
+ "use strict";(self.webpackChunk_next_bricks_diagram=self.webpackChunk_next_bricks_diagram||[]).push([[709],{3739:(e,t,r)=>{r.d(t,{c:()=>o});var n=r(8769),a=r.n(n);function o(e){var t,{id:r,type:n,strokeColor:o}=e;switch(n){case"0..1":t=l;break;case"0..N":t=d;break;default:t=i}return a().createElement(t,{id:r,strokeColor:o})}function i(e){var{id:t,strokeColor:r}=e;return a().createElement("marker",{id:t,viewBox:"0 0 6 6",refX:5,refY:3,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",strokeLinejoin:"round"},a().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 a().createElement("marker",{id:t,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},a().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 a().createElement("marker",{id:t,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},a().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:()=>a});var n=r(733);function a(e,t,r){if(e===t||(0,n.w)(e,t,0,0))return null;var a,i,l=0,d=0;if(r){var c=t.x-e.x,s=t.y-e.y,u=Math.atan2(s,c);l=r/2*Math.cos(u+Math.PI/2),d=r/2*Math.sin(u+Math.PI/2)}var h=[[e.x+l,e.y+d],[t.x+l,t.y+d]],v=o(e,h),f=o(t,h);return a=v.length>0?v[0]:[e.x,e.y],i=f.length>0?f[0]:[t.x,t.y],[{x:a[0],y:a[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]],n=[],a=0;a<4;a++)n.push([r[a],r[(a+1)%4]]);var o=[];for(var l of n){var d=i(t[0],t[1],l[0],l[1]);d&&o.push(d)}return o}function i(e,t,r,n){var[a,o]=e,[i,l]=t,[d,c]=r,[s,u]=n;if(a===i&&o===l||d===s&&c===u)return null;var h=(u-c)*(i-a)-(s-d)*(l-o);if(0===h)return null;var v=((s-d)*(o-c)-(u-c)*(a-d))/h,f=((i-a)*(o-c)-(l-o)*(a-d))/h;return v<0||v>1||f<0||f>1?null:[a+v*(i-a),o+v*(l-o)]}},733:(e,t,r)=>{function n(e,t,r,n){var o=r?a(e,r):e,i=n?a(t,n):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),c=Math.min(o.y-o.height/2,i.y-i.height/2),s=Math.max(o.y+o.height/2,i.y+i.height/2);return d-l<o.width+i.width&&s-c<o.height+i.height}function a(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:()=>n})},8802:(e,t,r)=>{function n(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:()=>n})},2830:(e,t,r)=>{r.d(t,{m:()=>C});var n=r(8769),a=r.n(n),o=r(3373),i=r.n(o),l=r(531),d=r(3188);function c(e,t){return e.find((e=>(0,l.N)(e)&&e.id===t))}function s(e){var{edge:t,cells:r,lineConfMap:o}=e,s=(0,n.useMemo)((()=>c(r,t.source)),[r,t.source]),h=(0,n.useMemo)((()=>c(r,t.target)),[r,t.target]),v=(0,n.useMemo)((()=>o.get(t)),[t,o]),f=(0,n.useMemo)((()=>r.some((e=>(0,l.WW)(e)&&e.source===t.target&&e.target===t.source))?v.parallelGap:0),[r,t,v.parallelGap]),m=(0,n.useMemo)((()=>s&&h&&null!=s.view.x&&null!=h.view.x?(0,d.h)(u(s.view,5),u(h.view,5),f):null),[f,s,h]);if(!m)return null;var g="M".concat(m[0].x," ").concat(m[0].y,"L").concat(m[1].x," ").concat(m[1].y);return a().createElement(a().Fragment,null,a().createElement("path",{d:g,fill:"none",stroke:"transparent",strokeWidth:v.interactStrokeWidth}),a().createElement("path",{className:i()("line",{dashed:v.dashed}),d:g,fill:"none",stroke:v.strokeColor,strokeWidth:v.strokeWidth,markerEnd:v.markerEnd}),a().createElement("path",{className:"line-active-bg",d:g,fill:"none"}))}function u(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(4993),v=r(7410),f=r(1030),m=r(9126);function g(e){var{node:t,defaultNodeBricks:r,onResize:o}=e,i=function(e){var[t,r]=(0,n.useState)(e);return(0,n.useEffect)((()=>{r((t=>(0,f.isEqual)(t,e)?t:e))}),[e]),t}({node:{id:t.id,data:t.data}}),l=t.useBrick,d=(0,n.useRef)(null),c=(0,n.useMemo)((()=>{var e;return null!=l?l:null==r||null===(e=r.find((e=>(0,v.checkIfByTransform)(e,i))))||void 0===e?void 0:e.useBrick}),[r,l,i]),s=(0,n.useCallback)((e=>{var r=d.current;r&&(r.disconnect(),d.current=null),e?setTimeout((()=>{var r=new m.A((()=>{o(t.id,[e.offsetWidth,e.offsetHeight])}));r.observe(e),d.current=r})):o(t.id,null)}),[t.id,o]);return c?a().createElement("foreignObject",{width:9999,height:9999,className:"node"},c&&a().createElement(h.ReactUseBrick,{useBrick:c,data:i,refCallback:s})):null}function p(e){return"edge"===e.type?(0,f.pick)(e,["type","source","target","data"]):(0,f.pick)(e,["type","id","data"])}function w(e,t){var{action:r,cell:n,scale:a,layout:o,onCellMoving:i,onCellMoved:d,onCellResizing:c,onCellResized:s,onSwitchActiveTarget:u}=t;if(e.stopPropagation(),null==u||u(p(n)),!(0,l.WW)(n)&&("force"!==o&&"dagre"!==o||!(0,l.N)(n))){var h=[e.clientX,e.clientY],v="move"===r?[n.view.x,n.view.y]:[n.view.width,n.view.height],f=!1,m=(e,t)=>{var o,l,u=function(e){return[(e.clientX-h[0])/a,(e.clientY-h[1])/a]}(e);f||(f=u[0]**2+u[1]**2>=9),f&&("move"===r?null===(o=t?d:i)||void 0===o||o({type:n.type,id:n.id,x:v[0]+u[0],y:v[1]+u[1]}):null===(l=t?s:c)||void 0===l||l({type:n.type,id:n.id,width:v[0]+u[0],height:v[1]+u[1]}))},g=e=>{m(e)},w=e=>{m(e,!0),f=!1,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",w)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",w)}}function y(e){var{cell:t,transform:r,readOnly:o,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d}=e,c=a().useRef(null);return(0,n.useEffect)((()=>{var e=c.current;if(e&&!o){var n=e=>{w(e,{action:"resize",cell:t,scale:r.k,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d})};return e.addEventListener("mousedown",n),()=>{e.removeEventListener("mousedown",n)}}}),[t,l,i,d,o,r.k]),a().createElement("g",{className:"decorator-area"},a().createElement("rect",{width:t.view.width,height:t.view.height,className:"area"}),!o&&a().createElement("g",{ref:c,className:"resize-handle",transform:"translate(".concat(t.view.width-20," ").concat(t.view.height-20,")")},a().createElement("rect",{width:20,height:20}),a().createElement("path",{d:"M10 18L18 10 M15 18L18 15"})))}var x=r(9740);function k(e){var t,{cell:r,readOnly:o,onDecoratorTextEditing:l,onDecoratorTextChange:d}=e,c=null!==(t=r.view.text)&&void 0!==t?t:"",[s,u]=(0,n.useState)(c),[h,v]=(0,n.useState)(!1),f=(0,n.useRef)(!1),[m,g]=(0,n.useState)(!1),p=(0,n.useRef)(null),w=(0,n.useCallback)((e=>{o||(e.preventDefault(),e.stopPropagation(),v(!0))}),[o]);(0,n.useEffect)((()=>{var e=p.current;e&&e.textContent!==s&&(e.textContent=s)}),[s]),(0,n.useEffect)((()=>{h&&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:h})}),[r.id,h,l]),(0,n.useEffect)((()=>{f.current?null==l||l({id:r.id,editing:h}):f.current=!0}),[r.id,h,l]);var y=(0,n.useCallback)((e=>{o||u(e.target.textContent)}),[o]),k=(0,n.useCallback)((()=>{o||(v(!1),g(!0))}),[o]);return(0,n.useEffect)((()=>{m&&(null==d||d({id:r.id,view:(0,x.A)((0,x.A)({},r.view),{},{text:s})}),g(!1))}),[r,s,d,m]),a().createElement("foreignObject",{className:"decorator-text"},a().createElement("div",{className:i()("text-container",{editing:h}),onDoubleClick:w},a().createElement("div",{className:"text",contentEditable:h,ref:p,onInput:y,onBlur:k})))}function b(e){var t,{cell:r,transform:n,readOnly:o,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d,onDecoratorTextEditing:c,onDecoratorTextChange:s}=e;switch(r.decorator){case"area":t=y;break;case"text":t=k;break;default:return console.error("Unknown decorator: ".concat(r.decorator)),null}return a().createElement(t,{cell:r,transform:n,readOnly:o,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d,onDecoratorTextEditing:c,onDecoratorTextChange:s})}var E=r(8185);function C(e){var{layout:t,cell:r,cells:o,defaultNodeBricks:d,lineConfMap:c,active:u,readOnly:h,transform:v,unrelatedCells:f,onCellMoving:m,onCellMoved:y,onCellResizing:x,onCellResized:k,onSwitchActiveTarget:C,onCellContextMenu:z,onDecoratorTextEditing:A,onDecoratorTextChange:M,onNodeBrickResize:R,onCellMouseEnter:N,onCellMouseLeave:W}=e,S=(0,n.useRef)(null),L=(0,n.useMemo)((()=>f.some((e=>(0,E.c)(e,r)))),[r,f]);(0,n.useEffect)((()=>{var e=S.current;if(e&&!h){var n=e=>{w(e,{layout:t,action:"move",cell:r,scale:v.k,onCellMoving:m,onCellMoved:y,onSwitchActiveTarget:C})};return e.addEventListener("mousedown",n),()=>{e.removeEventListener("mousedown",n)}}}),[t,r,y,m,C,h,v.k]);var T=(0,n.useCallback)((e=>{h&&"decorator"===r.type||(e.preventDefault(),C(p(r)),z({cell:r,clientX:e.clientX,clientY:e.clientY}))}),[r,z,C,h]),D=(0,n.useCallback)((()=>{null==N||N(r)}),[r,N]),H=(0,n.useCallback)((()=>{null==W||W(r)}),[r,W]);return a().createElement("g",{className:i()("cell",{active:u,faded:L,"read-only":h}),ref:S,transform:"edge"===r.type||null==r.view.x?void 0:"translate(".concat(r.view.x," ").concat(r.view.y,")"),onContextMenu:T,onMouseEnter:D,onMouseLeave:H},(0,l.N)(r)?a().createElement(g,{node:r,defaultNodeBricks:d,onResize:R}):(0,l.WW)(r)?a().createElement(s,{edge:r,cells:o,lineConfMap:c}):(0,l.mH)(r)?a().createElement(b,{cell:r,transform:v,readOnly:h,onCellResizing:x,onCellResized:k,onSwitchActiveTarget:C,onDecoratorTextEditing:A,onDecoratorTextChange:M}):null)}},3033:(e,t,r)=>{r.d(t,{CV:()=>n,HP:()=>o,Ie:()=>v,N8:()=>l,VO:()=>h,Yt:()=>s,mF:()=>u,sS:()=>c,sz:()=>i,w1:()=>d,xc:()=>a});var n=Symbol.for("size-initialized"),a=Symbol.for("layout-initialized"),o=20,i=36,l=100,d=60,c=.5,s=2,u="gray",h=1,v=15},531:(e,t,r)=>{function n(e){return"node"===e.type}function a(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}r.d(t,{N:()=>n,WW:()=>i,mH:()=>a,nv:()=>l,vC:()=>o})},227:(e,t,r)=>{r.d(t,{Y:()=>a});var n=r(8185);function a(e,t,r){var a=[];if(t){var o=new Set;for(var i of e)"edge"===i.type&&i.source===t.source.id&&o.add(i.target);for(var l of e)"node"===l.type?o.has(l.id)&&a.push(l):a.push(l)}else switch(null==r?void 0:r.type){case"node":var d=new Map,c=new Set([r.id]);for(var s of e)"node"===s.type?d.set(s.id,s):"edge"===s.type?s.source===r.id?c.add(s.target):s.target===r.id?c.add(s.source):a.push(s):a.push(s);for(var[u,h]of d)c.has(u)||a.push(h);break;case"edge":for(var v of e)("edge"===v.type?(0,n.c)(v,r):"node"===v.type&&(v.id===r.source||v.id===r.target))||a.push(v);break;case"decorator":for(var f of e)"decorator"===f.type&&f.id===r.id||a.push(f)}return a}},3783:(e,t,r)=>{r.d(t,{C:()=>o});var n=r(9740),a=r(531);function o(e,t){var{defaultNodeSize:r}=t;return(null!=e?e:[]).map((e=>{var t,o;return!(0,a.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,n.A)((0,n.A)({},e),{},{view:(0,n.A)({width:r[0],height:r[1]},e.view)})}))}},8185:(e,t,r)=>{function n(e,t){return e?!!t&&e.type===t.type&&("node"===e.type||"decorator"===e.type?e.id===t.id:e.source===t.source&&e.target===t.target):!t}r.d(t,{c:()=>n})},908:(e,t,r)=>{r.d(t,{r:()=>a});var n=r(531);function a(e,t){var{canvasWidth:r,canvasHeight:a,scaleRange:o}=t,i=1/0,l=1/0,d=-1/0,c=-1/0,s=!0;for(var u of e)if(!(0,n.WW)(u)){s=!1;var{view:h}=u,v=h.x+h.width,f=h.y+h.height;h.x<i&&(i=h.x),v>d&&(d=v),h.y<l&&(l=h.y),f>c&&(c=f)}var m=d-i,g=c-l,p=o&&!s&&(m>r||g>a)?Math.max(Math.min(r/m,a/g,o[1]),o[0]):1;return{x:s?0:(r-m*p)/2-i*p,y:s?0:(a-g*p)/2-l*p,k:p}}},1083:(e,t,r)=>{r.d(t,{d:()=>d});var n=r(9740),a=r(531),o=r(3033);function i(e,t,r){var n=e.findLastIndex(r)+1;return[...e.slice(0,n),t,...e.slice(n)]}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-cell":var{type:l,id:d,x:c,y:s}=t.payload,u=e.findIndex((e=>e.type===l&&e.id===d));if(-1!==u){var h=e[u];return[...e.slice(0,u),(0,n.A)((0,n.A)({},h),{},{view:(0,n.A)((0,n.A)({},h.view),{},{x:c,y:s})}),...e.slice(u+1)]}return e;case"resize-cell":var{type:v,id:f,width:m,height:g}=t.payload,p=e.findIndex((e=>e.type===v&&e.id===f));if(-1!==p){var w=e[p];return[...e.slice(0,p),(0,n.A)((0,n.A)({},w),{},{view:(0,n.A)((0,n.A)({},w.view),{},{width:m,height:g})}),...e.slice(p+1)]}return e;case"update-cells":return t.payload;case"update-node-size":return e.map((e=>(0,a.N)(e)&&e.id===t.payload.id?(0,n.A)((0,n.A)({},e),{},{[o.CV]:!0,view:t.payload.size?(0,n.A)((0,n.A)({},e.view),{},{width:t.payload.size[0],height:t.payload.size[1]}):e.view}):e))}return e}},(e,t)=>Object.fromEntries(Object.entries(l).map((r=>{var[n,a]=r;return[n,a(e[n],t)]}))))},7099:(e,t,r)=>{r.d(t,{Y:()=>f});var n=r(8769),a=r.n(n),o=r(2657),i=r(6768),l=r(198),d=r(8621),c=r(4993),s=r(9575);const u=e=>n.createElement("svg",(0,s.A)({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24"},e),n.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"})),h=e=>n.createElement("svg",(0,s.A)({xmlns:"http://www.w3.org/2000/svg",width:128,height:128,className:"icon",viewBox:"0 0 1024 1024"},e),n.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"}),n.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"})),v=e=>n.createElement("svg",(0,s.A)({xmlns:"http://www.w3.org/2000/svg",width:128,height:128,className:"icon",viewBox:"0 0 1024 1024"},e),n.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"}),n.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:s,onZoomChange:f,onReCenter:m}=e,g=(0,c.useCurrentTheme)(),p=(0,n.useMemo)((()=>(0,d.VC)()),[]),w=(0,n.useRef)(null),y=100*s[0],x=100*s[1],k=100*r,b=(0,n.useMemo)((()=>({formatter:e=>"".concat(e,"%"),placement:"left",getPopupContainer:()=>w.current})),[]),E=(0,n.useCallback)((()=>{f(Math.min(k+5,x))}),[x,f,k]),C=(0,n.useCallback)((()=>{f(Math.max(k-5,y))}),[y,f,k]);return a().createElement(o.Ay,{theme:{algorithm:"dark-v2"===g?i.A.darkAlgorithm:i.A.defaultAlgorithm}},a().createElement(d.N7,{container:t,autoClear:!0,cache:p,hashPriority:"high"},a().createElement("div",{className:"zoom-bar",ref:w},a().createElement("div",{className:"center-button",onClick:m,role:"button"},a().createElement(u,null)),a().createElement("div",{className:"zoom-slider"},a().createElement("div",{className:"zoom-button",role:"button",onClick:E},a().createElement(h,null)),a().createElement(l.A,{min:y,max:x,value:k,step:5,vertical:!0,included:!1,tooltip:b,onChange:f}),a().createElement("div",{className:"zoom-button",role:"button",onClick:C},a().createElement(v,null))))))}},1819:(e,t,r)=>{r.d(t,{J:()=>o});var n=r(8769),a=r(8185);function o(e){var{cellsRef:t,activeTarget:r,onActiveTargetChange:o}=e,i=null!=r?r:null,[l,d]=(0,n.useState)(i);(0,n.useEffect)((()=>{d((e=>(0,a.c)(e,i)?e:i))}),[i]);var c=(0,n.useRef)(!1);return(0,n.useEffect)((()=>{c.current?o(l):c.current=!0}),[l,o]),(0,n.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}},2361:(e,t,r)=>{r.d(t,{g:()=>b});var n=r(4223),a=r(9740),o=r(8769),i=r(6149),l=r(4842),d=r(1945),c=r(9418),s=r(3854),u=r(7931),h=r(7586),v=r.n(h),f=r(1030),m=r(7566),g=r(1517),p=r(3033),w=r(531),y=r(908),x=r(8802),k=["nodePadding"];function b(e){var{layout:t,layoutOptions:r,rootRef:h,cells:b,zoomable:E,zoomer:C,scaleRange:z,dispatch:A}=e,[M,R]=(0,o.useState)("force"!==t&&"dagre"!==t),[N,W]=function(e){var{rootRef:t,cells:r,layoutInitialized:n,zoomable:a,zoomer:i,scaleRange:l}=e,[d,c]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{var e=t.current;if(e&&n&&!d&&r.some((e=>(0,w.N)(e)||(0,w.mH)(e)))&&!r.some((e=>(0,w.N)(e)&&!e[p.CV]))){var{k:o,x:s,y:u}=(0,y.r)(r,{canvasWidth:e.clientWidth,canvasHeight:e.clientHeight,scaleRange:a?l:void 0});i.transform((0,m.A)(e),new g.uV(o,s,u)),c(!0)}}),[r,d,n,t,l,a,i]),(0,o.useEffect)((()=>{r.some((e=>(0,w.N)(e)||(0,w.mH)(e)))||c(!1)}),[r]),[d,c]}({rootRef:h,layoutInitialized:M,cells:b,zoomable:E,zoomer:C,scaleRange:z}),S=(0,o.useRef)(null);return(0,o.useEffect)((()=>{if(!b.some((e=>(0,w.N)(e)&&!e[p.CV])))if("force"===t||"dagre"===t){if(e=S.current,o=b.filter(w.nv),(null==e?void 0:e.length)!==o.length||!e.every(((e,t)=>e===o[t]))){var e,o,h,m;if("force"===t){var g=r,{nodePadding:y,collide:E}=(0,a.A)((0,a.A)({nodePadding:0},(0,f.pick)(g,["nodePadding"])),{},{collide:!1!==(null==g?void 0:g.collide)&&(0,a.A)({radiusDiff:18,strength:1,iterations:1},!0===(null==g?void 0:g.collide)?null:null==g?void 0:g.collide)});m=(0,x.D)(y);var C=[],z=[],M=new Map;for(var N of b)if((0,w.N)(N)){var L={id:N.id,width:N.view.width+m[1]+m[3],height:N.view.height+m[0]+m[2]};C.push(L),M.set(L.id,L)}else(0,w.WW)(N)&&z.push({source:N.source,target:N.target});var T=(0,i.A)(z).id((e=>e.id)),D=(0,l.A)(C).force("link",T).force("x",(0,d.A)()).force("y",(0,c.A)()).force("charge",(0,s.A)());E&&D.force("collide",(0,u.A)().radius((e=>Math.sqrt(e.width**2+e.height**2)/2+E.radiusDiff)).strength(E.strength).iterations(E.iterations)),D.stop(),function(e){e.tick(Math.ceil(Math.log(e.alphaMin())/Math.log(1-e.alphaDecay())))}(D),h=e=>M.get(e)}else{var H=r,B=(0,a.A)({nodePadding:0,rankdir:"TB",ranksep:50,edgesep:10,nodesep:50},(0,f.pick)(H,["nodePadding","rankdir","ranksep","edgesep","nodesep","align"])),{nodePadding:P}=B,V=(0,n.A)(B,k);m=(0,x.D)(P);var I=new(v().graphlib.Graph);for(var O of(I.setGraph(V),I.setDefaultEdgeLabel((function(){return{}})),b))(0,w.N)(O)?I.setNode(O.id,{id:O.id,width:O.view.width+m[1]+m[3],height:O.view.height+m[0]+m[2]}):(0,w.WW)(O)&&I.setEdge(O.source,O.target);v().layout(I),h=e=>I.node(e)}var Y=b.map((e=>{if((0,w.N)(e)){var t=h(e.id);return(0,a.A)((0,a.A)({},e),{},{view:(0,a.A)((0,a.A)({},e.view),{},{x:t.x-t.width/2+m[3],y:t.y-t.height/2+m[0]}),[p.xc]:!0})}return e}));S.current=Y.filter(w.nv),A({type:"update-cells",payload:Y}),W(!1),R(!0)}}else R(!0)}),[b,A,t,r,W]),{centered:N,setCentered:W}}},7531:(e,t,r)=>{r.d(t,{d:()=>c});var n=r(9740),a=r(8769),o=r(7410),i=r(1030),l=r(531),d=r(3033);function c(e){var{cells:t,defaultEdgeLines:r,markerPrefix:c}=e;return(0,a.useMemo)((()=>{var e=[{strokeColor:d.mF}],a=new WeakMap,s=function(t){if((0,l.WW)(t)){var s=(0,n.A)({dashed:!1,strokeColor:d.mF,strokeWidth:d.VO,interactStrokeWidth:d.Ie},null==r?void 0:r.find((e=>(0,o.checkIfByTransform)(e,{edge:t}))));void 0===s.parallelGap&&(s.parallelGap=s.interactStrokeWidth);var u=function(e,t){var r=(0,i.findIndex)(t,e);return-1===r&&(r=t.push(e)-1),r}({strokeColor:s.strokeColor},e);s.markerEnd="url(#".concat(c).concat(u,")"),a.set(t,s)}};for(var u of t)s(u);return[a,e]}),[t,r,c])}},8197:(e,t,r)=>{r.d(t,{H:()=>i});var n=r(8769),a=r(531),o=r(3033);function i(e){var{cells:t,layout:r,centered:i}=e;return(0,n.useMemo)((()=>i&&t.every((e=>!(0,a.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 n=r(8769),a=r(7566),o=r(1517),i=r(3033);function l(e){var{rootRef:t,zoomable:r,scrollable:l,pannable:d,scaleRange:c,onSwitchActiveTarget:s}=e,[u,h]=(0,n.useState)(!1),[v,f]=(0,n.useState)({k:1,x:0,y:0}),m=(0,n.useMemo)((()=>null!=c?c:[i.sS,i.Yt]),[c]),g=(0,n.useMemo)((()=>(0,o.s_)()),[]);return(0,n.useEffect)((()=>{var e=!1;g.scaleExtent(r?m:[1,1]).on("start",(()=>{e=!1,h(!0)})).on("zoom",(t=>{e=!0,f(t.transform)})).on("end",(()=>{h(!1),e||null==s||s(null)}))}),[s,m,r,g]),(0,n.useEffect)((()=>{var e=t.current;if(e){var n=(0,a.A)(e),o=()=>{n.on(".zoom",null).on(".zoom.custom",null).on("wheel",null)};if(r||l||d)return(r||l)&&n.on("wheel.zoom.custom",(e=>{e.ctrlKey||(e.stopImmediatePropagation(),l&&(e.preventDefault(),g.translateBy(n,e.wheelDeltaX/5,e.wheelDeltaY/5)))})),n.call(g).on("wheel",(e=>e.preventDefault())).on("dblclick.zoom",null).on("mousedown.zoom",null),d||n.on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),o;o()}}),[d,t,l,r,g]),{grabbing:u,transform:v,zoomer:g,scaleRange:m}}},8618:(e,t,r)=>{r.d(t,{A:()=>l});var n=r(6758),a=r.n(n),o=r(935),i=r.n(o)()(a());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 n=r(6758),a=r.n(n),o=r(935),i=r.n(o)()(a());i.push([e.id,"*{box-sizing:border-box}:host{display:block;position:relative;overflow:hidden}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}.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.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:4;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:4}.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}",""]);const l=i.toString()}}]);
2
+ //# sourceMappingURL=709.80fe5899.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunks/709.80fe5899.js","mappings":"mKAYO,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,QACES,EAAE,gCACFC,OAAQd,EACRe,YAAa,EACbC,KAAMhB,IAId,CAEA,SAASC,EAA6BgB,GAGI,IAHH,GACrCnB,EAAE,YACFE,GACyBiB,EACzB,OACEb,IAAAA,cAAA,UACEN,GAAIA,EACJQ,QAAQ,YACRC,KAAM,GACNC,KAAM,IACNC,YAAa,GACbC,aAAc,GACdC,OAAO,sBAEPP,IAAAA,cAAA,QACES,EAAE,yFACFC,OAAQd,EACRe,YAAa,EACbC,KAAK,SAIb,CAEA,SAASd,EAA8BgB,GAGG,IAHF,GACtCpB,EAAE,YACFE,GACyBkB,EACzB,OACEd,IAAAA,cAA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GAAQ,EACRwQ,EAAatQ,EAAEU,UAAU,IAE1B+P,GAAG,OAAO,KACTJ,GAAY,GACPvQ,GACHN,SAAAA,EAAuB,KACzB,GACA,GACH,CAACA,EAAsBuH,EAAYuE,EAAUC,KAGhDlO,EAAAA,EAAAA,YAAU,KACR,IAAMwO,EAAOR,EAAQjN,QACrB,GAAKyN,EAAL,CAIA,IAAM6E,GAAgB1E,EAAAA,EAAAA,GAAOH,GAEvB8E,EAAYA,KAChBD,EACGD,GAAG,QAAS,MACZA,GAAG,eAAgB,MACnBA,GAAG,QAAS,KAAK,EAGtB,GAAMnF,GAAY2E,GAAcC,EA0ChC,OArCI5E,GAAY2E,IAGdS,EAAcD,GACZ,qBACCzQ,IAEMA,EAAE4Q,UAEL5Q,EAAE6Q,2BACEZ,IACFjQ,EAAE+B,iBACFwJ,EAAOuF,YACLJ,EACA1Q,EAAE+Q,YAAc,EAChB/Q,EAAEgR,YAAc,IAGtB,IAMNN,EACGO,KAAK1F,GACLkF,GAAG,SAAUzQ,GAAkBA,EAAE+B,mBACjC0O,GAAG,gBAAiB,MACpBA,GAAG,iBAAkB,MAEnBP,GACHQ,EACGD,GAAG,kBAAmB,MACtBA,GAAG,iBAAkB,MACrBA,GAAG,gBAAiB,MAGlBE,EAzCLA,GAZF,CAqDgB,GACf,CAACT,EAAU7E,EAAS4E,EAAY3E,EAAUC,IAEtC,CAAE6E,WAAU1P,YAAW6K,SAAQxE,aACxC,C,kEClIImK,E,MAA0B,GAA4B,KAE1DA,EAAwBhY,KAAK,CAACiY,EAAOpb,GAAI,o6CAK2E,KAEpH,QAAemb,EAAwBE,U,kECTnCF,E,MAA0B,GAA4B,KAE1DA,EAAwBhY,KAAK,CAACiY,EAAOpb,GAAI,8tCAImc,KAE5e,QAAemb,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/findNode.ts","webpack:///./src/draw-canvas/EdgeComponent.tsx","webpack:///./src/draw-canvas/NodeComponent.tsx","webpack:///./src/draw-canvas/processors/cellToTarget.ts","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/getUnrelatedCells.ts","webpack:///./src/draw-canvas/processors/initializeCells.ts","webpack:///./src/draw-canvas/processors/sameTarget.ts","webpack:///./src/draw-canvas/processors/transformToCenter.ts","webpack:///./src/draw-canvas/reducers/cells.ts","webpack:///./src/draw-canvas/reducers/index.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/useActiveTarget.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, NodeId } from \"../interfaces\";\nimport { isNodeCell } from \"./asserts\";\n\nexport function findNode(cells: Cell[], id: NodeId): NodeCell | undefined {\n return cells.find((cell) => isNodeCell(cell) && cell.id === id) as\n | NodeCell\n | undefined;\n}\n","import React, { useMemo } 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 { findNode } from \"./processors/findNode\";\nimport { isEdgeCell } from \"./processors/asserts\";\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 sourceNode = useMemo(\n () => findNode(cells, edge.source),\n [cells, edge.source]\n );\n const targetNode = useMemo(\n () => findNode(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\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\n const d = `M${line[0].x} ${line[0].y}L${line[1].x} ${line[1].y}`;\n\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 className={classNames(\"line\", { dashed: lineConf.dashed })}\n d={d}\n fill=\"none\"\n stroke={lineConf.strokeColor}\n strokeWidth={lineConf.strokeWidth}\n markerEnd={lineConf.markerEnd}\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 { 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 defaultNodeBricks?: NodeBrickConf[];\n onResize(id: string, size: SizeTuple | null): void;\n}\n\nexport function NodeComponent({\n node,\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 (\n specifiedUseBrick ??\n defaultNodeBricks?.find((item) => checkIfByTransform(item, memoizedData))\n ?.useBrick\n );\n }, [defaultNodeBricks, specifiedUseBrick, memoizedData]);\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 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 ) : 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 { pick } from \"lodash\";\nimport type { ActiveTarget, Cell } from \"../interfaces\";\n\nexport function cellToTarget(cell: Cell): ActiveTarget {\n return cell.type === \"edge\"\n ? pick(cell, [\"type\", \"source\", \"target\", \"data\"])\n : pick(cell, [\"type\", \"id\", \"data\"]);\n}\n","import type { PositionTuple } from \"../../diagram/interfaces\";\nimport type { ActiveTarget, Cell, LayoutType } from \"../interfaces\";\nimport type {\n MoveCellPayload,\n ResizeCellPayload,\n} from \"../reducers/interfaces\";\nimport { isEdgeCell, isNodeCell } from \"./asserts\";\nimport { cellToTarget } from \"./cellToTarget\";\n\nexport function handleMouseDown(\n event: MouseEvent,\n {\n action,\n cell,\n scale,\n layout,\n onCellMoving,\n onCellMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n }: {\n action: \"move\" | \"resize\";\n cell: Cell;\n scale: number;\n layout?: LayoutType;\n onCellMoving?(info: MoveCellPayload): void;\n onCellMoved?(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 onSwitchActiveTarget?.(cellToTarget(cell));\n\n if (\n isEdgeCell(cell) ||\n ((layout === \"force\" || layout === \"dagre\") && isNodeCell(cell))\n ) {\n return;\n }\n\n const from: PositionTuple = [event.clientX, event.clientY];\n const original =\n action === \"move\"\n ? [cell.view.x, cell.view.y]\n : [cell.view.width, cell.view.height];\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 // const [x, y] = getNewPosition(movement);\n // adjustCellPosition(x, y);\n if (moved) {\n if (action === \"move\") {\n (finished ? onCellMoved : onCellMoving)?.({\n type: cell.type,\n id: cell.id,\n x: original[0] + movement[0],\n y: original[1] + movement[1],\n });\n } else {\n (finished ? onCellResized : onCellResizing)?.({\n type: cell.type,\n id: cell.id,\n width: original[0] + movement[0],\n height: original[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 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 onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n cell,\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 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 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\";\n\nexport interface CellComponentProps {\n layout: LayoutType;\n cell: Cell;\n cells: Cell[];\n defaultNodeBricks?: NodeBrickConf[];\n transform: TransformLiteral;\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n active: boolean;\n readOnly?: boolean;\n unrelatedCells: Cell[];\n onCellMoving?(info: MoveCellPayload): void;\n onCellMoved?(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 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 defaultNodeBricks,\n lineConfMap,\n active,\n readOnly,\n transform,\n unrelatedCells,\n onCellMoving,\n onCellMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onCellContextMenu,\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 || readOnly) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n layout,\n action: \"move\",\n cell,\n scale: transform.k,\n onCellMoving,\n onCellMoved,\n onSwitchActiveTarget,\n });\n };\n g.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n g.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n layout,\n cell,\n onCellMoved,\n onCellMoving,\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 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,\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 onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {isNodeCell(cell) ? (\n <NodeComponent\n node={cell}\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 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;\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","import type { ActiveTarget, Cell, ConnectLineState } from \"../interfaces\";\nimport { sameTarget } from \"./sameTarget\";\n\nexport function getUnrelatedCells(\n cells: Cell[],\n connectLineState: ConnectLineState | null,\n activeTarget: ActiveTarget | null\n): Cell[] {\n const unrelated: Cell[] = [];\n\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 default:\n unrelated.push(cell);\n }\n }\n } else {\n switch (activeTarget?.type) {\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 ? sameTarget(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 case \"decorator\":\n for (const cell of cells) {\n if (cell.type !== \"decorator\" || cell.id !== activeTarget.id) {\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 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 === \"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 { 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 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-cell\": {\n const { type, id, x, y } = 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, x, y } },\n ...state.slice(index + 1),\n ];\n }\n return 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\";\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});\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 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 { useEffect, useRef, useState } from \"react\";\nimport type { ZoomBehavior } from \"d3-zoom\";\nimport {\n forceCollide,\n forceLink,\n forceManyBody,\n forceSimulation,\n forceX,\n forceY,\n type Simulation,\n} from \"d3-force\";\nimport dagre from \"@dagrejs/dagre\";\nimport { pick } from \"lodash\";\nimport type {\n Cell,\n ForceCollideOptions,\n ForceLink,\n ForceNode,\n LayoutOptions,\n LayoutOptionsForce,\n LayoutType,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport type { FullRectTuple, RangeTuple } from \"../../diagram/interfaces\";\nimport { useAutoCenter } from \"./useAutoCenter\";\nimport {\n isEdgeCell,\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 { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\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 dispatch: (value: DrawCanvasAction) => void;\n}\n\nexport function useLayout({\n layout,\n layoutOptions,\n rootRef,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n dispatch,\n}: UseLayoutOptions) {\n const [layoutInitialized, setLayoutInitialized] = useState(\n layout !== \"force\" && layout !== \"dagre\"\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 ) {\n return;\n }\n\n if (layout !== \"force\" && layout !== \"dagre\") {\n setLayoutInitialized(true);\n return;\n }\n\n // Do not re-layout if nodes and edges not changed.\n if (\n isSameArray(previousLayoutRef.current, cells.filter(isNodeOrEdgeCell))\n ) {\n return;\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n let nodePaddings: FullRectTuple;\n\n if (layout === \"force\") {\n const forceLayoutOptions = layoutOptions as LayoutOptionsForce;\n const { nodePadding, collide } = {\n nodePadding: 0,\n ...pick(forceLayoutOptions, [\"nodePadding\"]),\n collide:\n forceLayoutOptions?.collide !== false\n ? ({\n radiusDiff: 18,\n strength: 1,\n iterations: 1,\n ...(forceLayoutOptions?.collide === true\n ? null\n : (forceLayoutOptions?.collide as ForceCollideOptions)),\n } as Required<ForceCollideOptions>)\n : (false as const),\n };\n 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 };\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())\n .force(\"y\", forceY())\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 getNodeView = (id: NodeId) => nodesMap.get(id) as NodeView;\n } else {\n const dagreLayoutOptions = layoutOptions as LayoutOptionsForce;\n const { nodePadding, ...dagreGraphOptions } = {\n nodePadding: 0,\n rankdir: \"TB\",\n ranksep: 50,\n edgesep: 10,\n nodesep: 50,\n // align: undefined,\n ...pick(dagreLayoutOptions, [\n \"nodePadding\",\n \"rankdir\",\n \"ranksep\",\n \"edgesep\",\n \"nodesep\",\n \"align\",\n ]),\n };\n nodePaddings = extractPartialRectTuple(nodePadding);\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 getNodeView = (id: NodeId) => graph.node(id);\n }\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 / 2 + nodePaddings[3],\n y: nodeView.y! - nodeView.height / 2 + nodePaddings[0],\n },\n [SYMBOL_FOR_LAYOUT_INITIALIZED]: true,\n };\n }\n return cell;\n });\n previousLayoutRef.current = newCells.filter(isNodeOrEdgeCell);\n dispatch({ type: \"update-cells\", payload: newCells });\n\n setCentered(false);\n setLayoutInitialized(true);\n }, [cells, dispatch, layout, layoutOptions, setCentered]);\n\n return { centered, setCentered };\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\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 { checkIfByTransform } from \"@next-core/runtime\";\nimport { findIndex } 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} 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 lineConf = {\n dashed: false,\n strokeColor: DEFAULT_LINE_STROKE_COLOR,\n strokeWidth: DEFAULT_LINE_STROKE_WIDTH,\n interactStrokeWidth: DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n ...defaultEdgeLines?.find((item) =>\n checkIfByTransform(item, { edge: cell })\n ),\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.markerEnd = `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 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 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 .on(\"mousedown.zoom\", null);\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 }, [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}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}.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.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:4;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:4}.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}`, \"\"]);\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","findNode","cells","find","cell","isNodeCell","EdgeComponent","edge","lineConfMap","sourceNode","useMemo","targetNode","lineConf","get","some","isEdgeCell","view","nodeViewToNodeRect","concat","interactStrokeWidth","className","classNames","dashed","markerEnd","NodeComponent","defaultNodeBricks","onResize","memoizedData","memoizedValue","setMemoizedValue","useState","useEffect","prev","isEqual","useDeepMemo","data","specifiedUseBrick","useBrick","observerRef","useRef","_defaultNodeBricks$fi","checkIfByTransform","refCallback","useCallback","element","prevObserver","current","disconnect","setTimeout","observer","ResizeObserver","offsetWidth","offsetHeight","observe","ReactUseBrick","cellToTarget","pick","handleMouseDown","event","action","scale","layout","onCellMoving","onCellMoved","onCellResizing","onCellResized","onSwitchActiveTarget","stopPropagation","from","clientX","clientY","original","moved","handleMove","e","finished","movement","getMovement","onMouseMove","onMouseUp","document","removeEventListener","addEventListener","DecoratorArea","transform","readOnly","resizeHandleRef","resizeHandle","onMouseDown","k","ref","DecoratorText","_cell$view$text","onDecoratorTextEditing","onDecoratorTextChange","label","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","active","unrelatedCells","onCellContextMenu","onNodeBrickResize","onCellMouseEnter","onCellMouseLeave","gRef","unrelated","sameTarget","g","handleContextMenu","handleMouseEnter","handleMouseLeave","faded","undefined","onContextMenu","onMouseEnter","onMouseLeave","isDecoratorCell","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","isInitialNodeCell","isNodeOrEdgeCell","getUnrelatedCells","connectLineState","activeTarget","existedTargets","Set","add","has","nodesMap","Map","relatedNodeIds","set","initializeCells","initialCells","defaultNodeSize","map","_cell$view","_cell$view2","transformToCenter","canvasWidth","canvasHeight","scaleRange","Infinity","empty","r","insertCellAfter","newCell","after","index","findLastIndex","slice","reducers","rootReducer","state","payload","findIndex","size","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","onClick","role","CenterSVG","ZoomInSVG","Slider","step","vertical","included","onChange","ZoomOutSVG","useActiveTarget","cellsRef","_activeTarget","onActiveTargetChange","newActiveTarget","setActiveTarget","previous","activeTargetChangeInitialized","resetActiveTarget","composedPath","indexOf","useLayout","layoutOptions","rootRef","zoomable","zoomer","dispatch","layoutInitialized","setLayoutInitialized","centered","setCentered","root","clientWidth","clientHeight","select","ZoomTransform","useAutoCenter","previousLayoutRef","filter","every","v","getNodeView","nodePaddings","forceLayoutOptions","nodePadding","collide","radiusDiff","strength","iterations","forceNodes","forceLinks","linkSimulation","forceLink","simulation","forceSimulation","force","forceX","forceY","forceManyBody","forceCollide","radius","sqrt","stop","tick","ceil","log","alphaMin","alphaDecay","manuallyTickToTheEnd","dagreLayoutOptions","_nodePadding$rankdir$","rankdir","ranksep","edgesep","nodesep","dagreGraphOptions","_objectWithoutProperties","_excluded","graph","dagre","Graph","setGraph","setDefaultEdgeLabel","setNode","setEdge","newCells","nodeView","useLineMarkers","defaultEdgeLines","markerPrefix","markers","WeakMap","_loop","markerEndIndex","marker","markerIndex","addMarker","useReady","useZoom","scrollable","pannable","_scaleRange","grabbing","setGrabbing","setTransform","zoom","scaleExtent","on","rootSelection","unsetZoom","ctrlKey","stopImmediatePropagation","translateBy","wheelDeltaX","wheelDeltaY","call","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
@@ -0,0 +1,3 @@
1
+ /*! For license information please see editable-label.8e6f528c.js.LICENSE.txt */
2
+ (self.webpackChunk_next_bricks_diagram=self.webpackChunk_next_bricks_diagram||[]).push([[6006,2052],{3328:(e,t,n)=>{"use strict";n.r(t),n.d(t,{EditableLabel:()=>T,EditableLabelComponent:()=>I,LegacyEditableLabelComponent:()=>V});var r,i,a,o,l,c,s,u,f,h,p,d,b,g,v,m=n(4635),y=n(918),w=n(1369),A=n(8449),x=n(6902),E=n(8769),k=n.n(E),S=n(9929),C=n(9938),j=(n(330),n(3373)),z=n.n(j),P=n(3971);function D(e,t,n){return n(O(e,t))}function L(e,t,n){return e.set(O(e,t),n),n}function M(e,t){return e.get(O(e,t))}function O(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var T,{defineElement:W,property:R,event:_,method:N}=(0,S.createDecorators)(),I=(0,E.forwardRef)(V),B=new WeakMap,H=new WeakMap,K=new WeakMap,q=new WeakSet,F=new WeakMap,G=new WeakMap,J=new WeakMap,Q=new WeakMap;class U extends C.ReactNextElement{constructor(){super(...arguments),(0,m.A)(this,q),(0,y.A)(this,B,(r(this),a(this))),(0,y.A)(this,H,(o(this),l(this))),(0,y.A)(this,K,(c(this),s(this))),(0,y.A)(this,F,(h(this),e=>{D(q,this,u).emit(e)})),(0,y.A)(this,G,p(this)),(0,y.A)(this,J,(g(this),e=>{D(q,this,d).emit(e)})),(0,y.A)(this,Q,(0,E.createRef)())}get label(){return M(B,this)}set label(e){L(B,this,e)}get type(){return M(H,this)}set type(e){L(H,this,e)}enableEditing(){var e;null===(e=M(Q,this).current)||void 0===e||e.enableEditing()}render(){return k().createElement(I,{ref:M(Q,this),label:this.label,onLabelEditingChange:M(F,this),onLabelChange:M(J,this)})}}function V(e,t){var{label:n,onLabelChange:r,onLabelEditingChange:i}=e,a=null!=n?n:"",[o,l]=(0,E.useState)(a),[c,s]=(0,E.useState)(!1),u=(0,E.useRef)(!1),[f,h]=(0,E.useState)(!1),p=(0,E.useRef)(null);(0,E.useImperativeHandle)(t,(()=>({enableEditing(){s(!0)}}))),(0,E.useEffect)((()=>{l(a)}),[a]);var d=(0,E.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),s(!0)}),[]);(0,E.useEffect)((()=>{var e,t;c&&(null===(e=p.current)||void 0===e||e.focus({preventScroll:!0}),null===(t=p.current)||void 0===t||t.select())}),[c]),(0,E.useEffect)((()=>{u.current?null==i||i(c):u.current=!0}),[c,i]);var b=(0,E.useCallback)((e=>{l(e.target.value)}),[]),g=(0,E.useCallback)((e=>{var t,n=e.key||e.keyCode||e.which;"Enter"!==n&&13!==n||null===(t=p.current)||void 0===t||t.blur()}),[]),v=(0,E.useCallback)((()=>{s(!1),h(!0)}),[]);(0,E.useEffect)((()=>{f&&(null==r||r(o),h(!1))}),[o,r,f]);var m=(0,E.useCallback)((e=>{e.stopPropagation()}),[]);return k().createElement("div",{className:z()("label",{editing:c,empty:!o}),onDoubleClick:m,onMouseDown:m},k().createElement("input",{className:"label-input",value:o,ref:p,onChange:b,onKeyDown:g,onBlur:v}),k().createElement("div",{className:"label-text",onDoubleClick:d},o))}v=U,({e:[a,o,l,c,s,u,f,h,p,d,b,g,r],c:[T,i]}=function(e,t,n,r,i,a){var o,l,c,s,u,f,h,p=Symbol.metadata||Symbol.for("Symbol.metadata"),d=Object.defineProperty,b=Object.create,g=[b(null),b(null)],v=t.length;function m(t,n,r){return function(i,a){n&&(a=i,i=e);for(var o=0;o<t.length;o++)a=t[o].apply(i,r?[a]:[]);return r?a:i}}function y(e,t,n,r){if("function"!=typeof e&&(r||void 0!==e))throw new TypeError(t+" must "+(n||"be")+" a function"+(r?"":" or undefined"));return e}function E(e,t,n,r,i,a,c,s,u,f,h){function p(e){if(!h(e))throw new TypeError("Attempted to access private element on non-instance")}var b=[].concat(t[0]),v=t[3],w=!c,x=1===i,E=3===i,k=4===i,S=2===i;function C(t,n,r){return function(i,a){return n&&(a=i,i=e),r&&r(i),j[t].call(i,a)}}if(!w){var j={},z=[],P=E?"get":k||x?"set":"value";if(u?(f||x?j={get:(0,A.A)((function(){return v(this)}),r,"get"),set:function(e){t[4](this,e)}}:j[P]=v,f||(0,A.A)(j[P],r,S?"":P)):f||(j=Object.getOwnPropertyDescriptor(e,r)),!f&&!u){if((l=g[+s][r])&&7!=(l^i))throw new Error("Decorating two elements with the same name ("+j[P].name+") is not supported yet");g[+s][r]=i<3?1:i}}for(var D=e,L=b.length-1;L>=0;L-=n?2:1){var M=b[L],O=n?b[L-1]:void 0,T={},W={kind:["field","accessor","method","getter","setter","class"][i],name:r,metadata:o,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");y(t,"An initializer","be",!0),a.push(t)}.bind(null,T)};if(w)l=M.call(O,D,W),T.v=1,y(l,"class decorators","return")&&(D=l);else if(W.static=s,W.private=u,l=W.access={has:u?h.bind():function(e){return r in e}},k||(l.get=u?S?function(e){return p(e),j.value}:C("get",0,p):function(e){return e[r]}),S||E||(l.set=u?C("set",0,p):function(e,t){e[r]=t}),D=M.call(O,x?{get:j.get,set:j.set}:j[P],W),T.v=1,x){if("object"==typeof D&&D)(l=y(D.get,"accessor.get"))&&(j.get=l),(l=y(D.set,"accessor.set"))&&(j.set=l),(l=y(D.init,"accessor.init"))&&z.unshift(l);else if(void 0!==D)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else y(D,(f?"field":"method")+" decorators","return")&&(f?z.unshift(D):j[P]=D)}return i<2&&c.push(m(z,s,1),m(a,s,0)),f||w||(u?x?c.splice(-1,0,C("get",s),C("set",s)):c.push(S?j[P]:y.call.bind(j[P])):d(e,r,j)),D}function k(e){return d(e,p,{configurable:!0,enumerable:!0,value:o})}return void 0!==a&&(o=a[p]),o=b(null==o?null:o),u=[],f=function(e){e&&u.push(m(e))},(h=function(t,r){for(var a=0;a<n.length;a++){var o=n[a],l=o[1],f=7&l;if((8&l)==t&&!f==r){var h=o[2],p=!!o[3],d=16&l;E(t?e:e.prototype,o,d,p?"#"+h:(0,w.A)(h),f,f<2?[]:t?s=s||[]:c=c||[],u,!!t,p,r,t&&p?function(t){return(0,x.A)(t)===e}:i)}}})(8,0),h(0,0),h(8,1),h(0,1),f(c),f(s),l=u,v||k(e),{e:l,get c(){var n=[];return v&&[k(e=E(e,[t],0,e.name,5,n)),m(n,1)]}}}(v,[W("diagram.editable-label",{styleTexts:[P.A]})],[[R(),1,"label"],[R({render:!1}),1,"type"],[_({type:"label.editing.change"}),1,"labelEditingChange",e=>M(K,e),(e,t)=>L(K,e,t)],[_({type:"label.change"}),1,"labelChange",e=>M(G,e),(e,t)=>L(G,e,t)],[N(),2,"enableEditing"]],0,(e=>Q.has((0,x.A)(e))),C.ReactNextElement)),i()},3971:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var r=n(6758),i=n.n(r),a=n(935),o=n.n(a)()(i());o.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 l=o.toString()},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,i,a){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(r)for(var l=0;l<this.length;l++){var c=this[l][0];null!=c&&(o[c]=!0)}for(var s=0;s<e.length;s++){var u=[].concat(e[s]);r&&o[u[0]]||(void 0!==a&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=a),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},6758:e=>{"use strict";e.exports=function(e){return e[1]}},3373:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,a(n)))}return e}function a(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return i.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)r.call(e,n)&&e[n]&&(t=o(t,n));return t}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(i.default=i,e.exports=i):void 0===(n=function(){return i}.apply(t,[]))||(e.exports=n)}()},6902:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(7545);function i(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(null!==e?(0,r.A)(e):"null"));return e}},2016:(e,t,n)=>{"use strict";function r(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}n.d(t,{A:()=>r})},918:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(2016);function i(e,t,n){(0,r.A)(e,t),t.set(e,n)}},4635:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(2016);function i(e,t){(0,r.A)(e,t),t.add(e)}},8449:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(7545);function i(e,t,n){"symbol"==(0,r.A)(t)&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:n?n+" "+t:t})}catch(e){}return e}},1369:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(7545);function i(e){var t=function(e,t){if("object"!=(0,r.A)(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=(0,r.A)(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==(0,r.A)(t)?t:String(t)}},7545:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}n.d(t,{A:()=>r})}}]);
3
+ //# sourceMappingURL=editable-label.8e6f528c.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunks/editable-label.e37e189e.js","mappings":";mpBAeA,IAeAA,GAfM,cAAEC,EAAa,SAAEC,EAAQ,MAAEC,EAAK,OAAEC,IAAWC,EAAAA,EAAAA,oBAatCC,GAAyBC,EAAAA,EAAAA,YAAWC,GAEjDC,EAAA,IAAAC,QAAAC,EAAA,IAAAD,QAAAE,EAAA,IAAAF,QAAAG,EAAA,IAAAC,QAAAC,EAAA,IAAAL,QAAAM,EAAA,IAAAN,QAAAO,EAAA,IA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IF,UAAU,iEAExB,6ECHe,SAAS5H,EAA2B8H,EAAKE,EAAYxH,IAClE,OAA0BsH,EAAKE,GAC/BA,EAAWC,IAAIH,EAAKtH,EACtB,8DCHe,SAAST,EAA4B+H,EAAKI,IACvD,OAA0BJ,EAAKI,GAC/BA,EAAWC,IAAIL,EACjB,8DCHe,SAASM,EAAgBtF,EAAGuF,EAAGC,GAC5C,WAAY,OAAQD,KAAOA,GAAKA,EAAIA,EAAEE,aAAe,IAAMF,EAAI,IAAM,IACrE,IACEf,OAAOkB,eAAe1F,EAAG,OAAQ,CAC/B2F,cAAc,EACdjI,MAAO8H,EAAIA,EAAI,IAAMD,EAAIA,GAE7B,CAAE,MAAOvF,GAAI,CACb,OAAOA,CACT,8DCRe,SAAS4F,EAAcL,GACpC,IAAIlC,ECFS,SAAqBkC,EAAGM,GACrC,GAAI,WAAY,OAAQN,KAAOA,EAAG,OAAOA,EACzC,IAAIvF,EAAIuF,EAAEO,OAAOC,aACjB,QAAI,IAAW/F,EAAG,CAChB,IAAIqD,EAAIrD,EAAE2E,KAAKY,EAAGM,UAClB,GAAI,WAAY,OAAQxC,GAAI,OAAOA,EACnC,MAAM,IAAIyB,UAAU,+CACtB,CACA,OAAyBkB,OAAiBT,EAC5C,CDPUQ,CAAYR,GACpB,MAAO,WAAY,OAAQlC,GAAKA,EAAI2C,OAAO3C,EAC7C,+BELe,SAAS4C,EAAQ/D,GAG9B,OAAO+D,EAAU,mBAAqBH,QAAU,iBAAmBA,OAAOI,SAAW,SAAUhE,GAC7F,cAAcA,CAChB,EAAI,SAAUA,GACZ,OAAOA,GAAK,mBAAqB4D,QAAU5D,EAAEnF,cAAgB+I,QAAU5D,IAAM4D,OAAOrB,UAAY,gBAAkBvC,CACpH,EAAG+D,EAAQ/D,EACb","sources":["webpack:///./src/editable-label/index.tsx","webpack:///./src/editable-label/styles.shadow.css","webpack:///../../node_modules/css-loader/dist/runtime/api.js","webpack:///../../node_modules/css-loader/dist/runtime/noSourceMaps.js","webpack:///../../node_modules/classnames/index.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/checkInRHS.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/setFunctionName.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/typeof.js"],"sourcesContent":["import React, {\n createRef,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\nimport { EventEmitter, createDecorators } from \"@next-core/element\";\nimport { ReactNextElement } from \"@next-core/react-element\";\nimport \"@next-core/theme\";\nimport classNames from \"classnames\";\nimport styleText from \"./styles.shadow.css\";\n\nconst { defineElement, property, event, method } = createDecorators();\n\nexport interface EditableLabelProps {\n label?: string;\n type?: LabelType;\n}\n\nexport type LabelType = \"line\" | \"default\";\n\nexport interface EditableLabelRef {\n enableEditing(): void;\n}\n\nexport const EditableLabelComponent = forwardRef(LegacyEditableLabelComponent);\n\n/**\n * 构件 `diagram.editable-label`\n */\nexport\n@defineElement(\"diagram.editable-label\", {\n styleTexts: [styleText],\n})\nclass EditableLabel extends ReactNextElement implements EditableLabelProps {\n @property()\n accessor label: string | undefined;\n\n @property({ render: false })\n accessor type: LabelType | undefined;\n\n @event({ type: \"label.editing.change\" })\n accessor #labelEditingChange!: EventEmitter<boolean>;\n\n #handleLabelEditingChange = (value: boolean) => {\n this.#labelEditingChange.emit(value);\n };\n\n @event({ type: \"label.change\" })\n accessor #labelChange!: EventEmitter<string>;\n\n #handleLabelChange = (value: string) => {\n this.#labelChange.emit(value);\n };\n\n @method()\n enableEditing() {\n this.#editableLabelRef.current?.enableEditing();\n }\n\n #editableLabelRef = createRef<EditableLabelRef>();\n\n render() {\n return (\n <EditableLabelComponent\n ref={this.#editableLabelRef}\n label={this.label}\n onLabelEditingChange={this.#handleLabelEditingChange}\n onLabelChange={this.#handleLabelChange}\n />\n );\n }\n}\n\nexport interface EditableLabelComponentProps extends EditableLabelProps {\n onLabelEditingChange?(value: boolean): void;\n onLabelChange?(value: string): void;\n}\n\nexport function LegacyEditableLabelComponent(\n {\n label: _label,\n onLabelChange,\n onLabelEditingChange,\n }: EditableLabelComponentProps,\n ref: React.Ref<EditableLabelRef>\n) {\n const label = _label ?? \"\";\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 labelInputRef = useRef<HTMLInputElement>(null);\n\n useImperativeHandle(ref, () => ({\n enableEditing() {\n setEditingLabel(true);\n },\n }));\n\n useEffect(() => {\n setCurrentLabel(label);\n }, [label]);\n\n const handleEditLabel = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n }, []);\n\n useEffect(() => {\n if (editingLabel) {\n // Prevent scroll when focusing.\n // Otherwise the diagram svg may be clipped in Chrome.\n labelInputRef.current?.focus({ preventScroll: true });\n labelInputRef.current?.select();\n }\n }, [editingLabel]);\n\n useEffect(() => {\n if (editingLabelInitialized.current) {\n onLabelEditingChange?.(editingLabel);\n } else {\n editingLabelInitialized.current = true;\n }\n }, [editingLabel, onLabelEditingChange]);\n\n const handleInputChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setCurrentLabel(event.target.value);\n },\n []\n );\n\n const handleInputKeydown = useCallback((event: React.KeyboardEvent) => {\n const key =\n event.key ||\n /* istanbul ignore next: compatibility */ event.keyCode ||\n /* istanbul ignore next: compatibility */ event.which;\n if (key === \"Enter\" || key === 13) {\n labelInputRef.current?.blur();\n }\n }, []);\n\n const handleInputBlur = useCallback(() => {\n setEditingLabel(false);\n setShouldEmitLabelChange(true);\n }, []);\n\n useEffect(() => {\n if (shouldEmitLabelChange) {\n onLabelChange?.(currentLabel);\n setShouldEmitLabelChange(false);\n }\n }, [currentLabel, onLabelChange, shouldEmitLabelChange]);\n\n const stopPropagation = useCallback((e: React.MouseEvent) => {\n e.stopPropagation();\n }, []);\n\n return (\n <div\n className={classNames(\"label\", {\n editing: editingLabel,\n empty: !currentLabel,\n })}\n onDoubleClick={stopPropagation}\n onMouseDown={stopPropagation}\n >\n <input\n className=\"label-input\"\n value={currentLabel}\n ref={labelInputRef}\n onChange={handleInputChange}\n onKeyDown={handleInputKeydown}\n onBlur={handleInputBlur}\n />\n <div className=\"label-text\" onDoubleClick={handleEditLabel}>\n {currentLabel}\n </div>\n </div>\n );\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, `: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}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","\"use strict\";\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\nmodule.exports = function (cssWithMappingToString) {\n var list = [];\n\n // return the list of modules as css string\n list.toString = function toString() {\n return this.map(function (item) {\n var content = \"\";\n var needLayer = typeof item[5] !== \"undefined\";\n if (item[4]) {\n content += \"@supports (\".concat(item[4], \") {\");\n }\n if (item[2]) {\n content += \"@media \".concat(item[2], \" {\");\n }\n if (needLayer) {\n content += \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\");\n }\n content += cssWithMappingToString(item);\n if (needLayer) {\n content += \"}\";\n }\n if (item[2]) {\n content += \"}\";\n }\n if (item[4]) {\n content += \"}\";\n }\n return content;\n }).join(\"\");\n };\n\n // import a list of modules into the list\n list.i = function i(modules, media, dedupe, supports, layer) {\n if (typeof modules === \"string\") {\n modules = [[null, modules, undefined]];\n }\n var alreadyImportedModules = {};\n if (dedupe) {\n for (var k = 0; k < this.length; k++) {\n var id = this[k][0];\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n for (var _k = 0; _k < modules.length; _k++) {\n var item = [].concat(modules[_k]);\n if (dedupe && alreadyImportedModules[item[0]]) {\n continue;\n }\n if (typeof layer !== \"undefined\") {\n if (typeof item[5] === \"undefined\") {\n item[5] = layer;\n } else {\n item[1] = \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\").concat(item[1], \"}\");\n item[5] = layer;\n }\n }\n if (media) {\n if (!item[2]) {\n item[2] = media;\n } else {\n item[1] = \"@media \".concat(item[2], \" {\").concat(item[1], \"}\");\n item[2] = media;\n }\n }\n if (supports) {\n if (!item[4]) {\n item[4] = \"\".concat(supports);\n } else {\n item[1] = \"@supports (\".concat(item[4], \") {\").concat(item[1], \"}\");\n item[4] = supports;\n }\n }\n list.push(item);\n }\n };\n return list;\n};","\"use strict\";\n\nmodule.exports = function (i) {\n return i[1];\n};","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import _typeof from \"./typeof.js\";\nexport default function _checkInRHS(e) {\n if (Object(e) !== e) throw TypeError(\"right-hand side of 'in' should be an object, got \" + (null !== e ? _typeof(e) : \"null\"));\n return e;\n}","export default function _checkPrivateRedeclaration(obj, privateCollection) {\n if (privateCollection.has(obj)) {\n throw new TypeError(\"Cannot initialize the same private elements twice on an object\");\n }\n}","import checkPrivateRedeclaration from \"./checkPrivateRedeclaration.js\";\nexport default function _classPrivateFieldInitSpec(obj, privateMap, value) {\n checkPrivateRedeclaration(obj, privateMap);\n privateMap.set(obj, value);\n}","import checkPrivateRedeclaration from \"./checkPrivateRedeclaration.js\";\nexport default function _classPrivateMethodInitSpec(obj, privateSet) {\n checkPrivateRedeclaration(obj, privateSet);\n privateSet.add(obj);\n}","import _typeof from \"./typeof.js\";\nexport default function setFunctionName(e, t, n) {\n \"symbol\" == _typeof(t) && (t = (t = t.description) ? \"[\" + t + \"]\" : \"\");\n try {\n Object.defineProperty(e, \"name\", {\n configurable: !0,\n value: n ? n + \" \" + t : t\n });\n } catch (e) {}\n return e;\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : String(i);\n}","import _typeof from \"./typeof.js\";\nexport default function toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}","export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}"],"names":["_EditableLabel","defineElement","property","event","method","createDecorators","EditableLabelComponent","forwardRef","LegacyEditableLabelComponent","_A","WeakMap","_B","_C","_EditableLabel_brand","WeakSet","_handleLabelEditingChange","_D","_handleLabelChange","_editableLabelRef","EditableLabel","ReactNextElement","constructor","arguments","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","_initProto","_init_label","_init_extra_label","_init_type","_init_extra_type","_init_labelEditingChange","_init_extra_labelEditingChange","value","_classPrivateGetter","this","_get_labelEditingChange","emit","_init_labelChange","_init_extra_labelChange","_get_labelChange","createRef","label","_classPrivateFieldGet","v","_classPrivateFieldSet","type","enableEditing","_classPrivateFieldGet2","current","render","React","ref","onLabelEditingChange","onLabelChange","_ref","_label","currentLabel","setCurrentLabel","useState","editingLabel","setEditingLabel","editingLabelInitialized","useRef","shouldEmitLabelChange","setShouldEmitLabelChange","labelInputRef","useImperativeHandle","useEffect","handleEditLabel","useCallback","e","preventDefault","stopPropagation","_labelInputRef$curren","_labelInputRef$curren2","focus","preventScroll","select","handleInputChange","target","handleInputKeydown","_labelInputRef$curren3","key","keyCode","which","blur","handleInputBlur","className","classNames","editing","empty","onDoubleClick","onMouseDown","onChange","onKeyDown","onBlur","_EditableLabel2","_set_labelEditingChange","_set_labelChange","c","_initClass","_applyDecs","styleTexts","styleText","o","_","has","_checkInRHS","___CSS_LOADER_EXPORT___","push","module","id","toString","exports","cssWithMappingToString","list","map","item","content","needLayer","concat","length","join","i","modules","media","dedupe","supports","layer","undefined","alreadyImportedModules","k","_k","hasOwn","hasOwnProperty","classes","arg","appendClass","parseValue","Array","isArray","apply","Object","prototype","includes","call","newClass","default","TypeError","_checkPrivateRedeclaration","obj","privateCollection","privateMap","set","privateSet","add","setFunctionName","t","n","description","defineProperty","configurable","toPropertyKey","r","Symbol","toPrimitive","String","_typeof","iterator"],"sourceRoot":""}
1
+ {"version":3,"file":"chunks/editable-label.8e6f528c.js","mappings":";opBAeA,IAeAA,GAfM,cAAEC,EAAa,SAAEC,EAAQ,MAAEC,EAAK,OAAEC,IAAWC,EAAAA,EAAAA,oBAatCC,GAAyBC,EAAAA,EAAAA,YAAWC,G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Q/D,EACb","sources":["webpack:///./src/editable-label/index.tsx","webpack:///./src/editable-label/styles.shadow.css","webpack:///../../node_modules/css-loader/dist/runtime/api.js","webpack:///../../node_modules/css-loader/dist/runtime/noSourceMaps.js","webpack:///../../node_modules/classnames/index.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/checkInRHS.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/setFunctionName.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/typeof.js"],"sourcesContent":["import React, {\n createRef,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\nimport { EventEmitter, createDecorators } from \"@next-core/element\";\nimport { ReactNextElement } from \"@next-core/react-element\";\nimport \"@next-core/theme\";\nimport classNames from \"classnames\";\nimport styleText from \"./styles.shadow.css\";\n\nconst { defineElement, property, event, method } = createDecorators();\n\nexport interface EditableLabelProps {\n label?: string;\n type?: LabelType;\n}\n\nexport type LabelType = \"line\" | \"default\";\n\nexport interface EditableLabelRef {\n enableEditing(): void;\n}\n\nexport const EditableLabelComponent = forwardRef(LegacyEditableLabelComponent);\n\n/**\n * 构件 `diagram.editable-label`\n */\nexport\n@defineElement(\"diagram.editable-label\", {\n styleTexts: [styleText],\n})\nclass EditableLabel extends ReactNextElement implements EditableLabelProps {\n @property()\n accessor label: string | undefined;\n\n @property({ render: false })\n accessor type: LabelType | undefined;\n\n @event({ type: \"label.editing.change\" })\n accessor #labelEditingChange!: EventEmitter<boolean>;\n\n #handleLabelEditingChange = (value: boolean) => {\n this.#labelEditingChange.emit(value);\n };\n\n @event({ type: \"label.change\" })\n accessor #labelChange!: EventEmitter<string>;\n\n #handleLabelChange = (value: string) => {\n this.#labelChange.emit(value);\n };\n\n @method()\n enableEditing() {\n this.#editableLabelRef.current?.enableEditing();\n }\n\n #editableLabelRef = createRef<EditableLabelRef>();\n\n render() {\n return (\n <EditableLabelComponent\n ref={this.#editableLabelRef}\n label={this.label}\n onLabelEditingChange={this.#handleLabelEditingChange}\n onLabelChange={this.#handleLabelChange}\n />\n );\n }\n}\n\nexport interface EditableLabelComponentProps extends EditableLabelProps {\n onLabelEditingChange?(value: boolean): void;\n onLabelChange?(value: string): void;\n}\n\nexport function LegacyEditableLabelComponent(\n {\n label: _label,\n onLabelChange,\n onLabelEditingChange,\n }: EditableLabelComponentProps,\n ref: React.Ref<EditableLabelRef>\n) {\n const label = _label ?? \"\";\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 labelInputRef = useRef<HTMLInputElement>(null);\n\n useImperativeHandle(ref, () => ({\n enableEditing() {\n setEditingLabel(true);\n },\n }));\n\n useEffect(() => {\n setCurrentLabel(label);\n }, [label]);\n\n const handleEditLabel = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n }, []);\n\n useEffect(() => {\n if (editingLabel) {\n // Prevent scroll when focusing.\n // Otherwise the diagram svg may be clipped in Chrome.\n labelInputRef.current?.focus({ preventScroll: true });\n labelInputRef.current?.select();\n }\n }, [editingLabel]);\n\n useEffect(() => {\n if (editingLabelInitialized.current) {\n onLabelEditingChange?.(editingLabel);\n } else {\n editingLabelInitialized.current = true;\n }\n }, [editingLabel, onLabelEditingChange]);\n\n const handleInputChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setCurrentLabel(event.target.value);\n },\n []\n );\n\n const handleInputKeydown = useCallback((event: React.KeyboardEvent) => {\n const key =\n event.key ||\n /* istanbul ignore next: compatibility */ event.keyCode ||\n /* istanbul ignore next: compatibility */ event.which;\n if (key === \"Enter\" || key === 13) {\n labelInputRef.current?.blur();\n }\n }, []);\n\n const handleInputBlur = useCallback(() => {\n setEditingLabel(false);\n setShouldEmitLabelChange(true);\n }, []);\n\n useEffect(() => {\n if (shouldEmitLabelChange) {\n onLabelChange?.(currentLabel);\n setShouldEmitLabelChange(false);\n }\n }, [currentLabel, onLabelChange, shouldEmitLabelChange]);\n\n const stopPropagation = useCallback((e: React.MouseEvent) => {\n e.stopPropagation();\n }, []);\n\n return (\n <div\n className={classNames(\"label\", {\n editing: editingLabel,\n empty: !currentLabel,\n })}\n onDoubleClick={stopPropagation}\n onMouseDown={stopPropagation}\n >\n <input\n className=\"label-input\"\n value={currentLabel}\n ref={labelInputRef}\n onChange={handleInputChange}\n onKeyDown={handleInputKeydown}\n onBlur={handleInputBlur}\n />\n <div className=\"label-text\" onDoubleClick={handleEditLabel}>\n {currentLabel}\n </div>\n </div>\n );\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, `: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}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","\"use strict\";\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\nmodule.exports = function (cssWithMappingToString) {\n var list = [];\n\n // return the list of modules as css string\n list.toString = function toString() {\n return this.map(function (item) {\n var content = \"\";\n var needLayer = typeof item[5] !== \"undefined\";\n if (item[4]) {\n content += \"@supports (\".concat(item[4], \") {\");\n }\n if (item[2]) {\n content += \"@media \".concat(item[2], \" {\");\n }\n if (needLayer) {\n content += \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\");\n }\n content += cssWithMappingToString(item);\n if (needLayer) {\n content += \"}\";\n }\n if (item[2]) {\n content += \"}\";\n }\n if (item[4]) {\n content += \"}\";\n }\n return content;\n }).join(\"\");\n };\n\n // import a list of modules into the list\n list.i = function i(modules, media, dedupe, supports, layer) {\n if (typeof modules === \"string\") {\n modules = [[null, modules, undefined]];\n }\n var alreadyImportedModules = {};\n if (dedupe) {\n for (var k = 0; k < this.length; k++) {\n var id = this[k][0];\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n for (var _k = 0; _k < modules.length; _k++) {\n var item = [].concat(modules[_k]);\n if (dedupe && alreadyImportedModules[item[0]]) {\n continue;\n }\n if (typeof layer !== \"undefined\") {\n if (typeof item[5] === \"undefined\") {\n item[5] = layer;\n } else {\n item[1] = \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\").concat(item[1], \"}\");\n item[5] = layer;\n }\n }\n if (media) {\n if (!item[2]) {\n item[2] = media;\n } else {\n item[1] = \"@media \".concat(item[2], \" {\").concat(item[1], \"}\");\n item[2] = media;\n }\n }\n if (supports) {\n if (!item[4]) {\n item[4] = \"\".concat(supports);\n } else {\n item[1] = \"@supports (\".concat(item[4], \") {\").concat(item[1], \"}\");\n item[4] = supports;\n }\n }\n list.push(item);\n }\n };\n return list;\n};","\"use strict\";\n\nmodule.exports = function (i) {\n return i[1];\n};","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import _typeof from \"./typeof.js\";\nexport default function _checkInRHS(e) {\n if (Object(e) !== e) throw TypeError(\"right-hand side of 'in' should be an object, got \" + (null !== e ? _typeof(e) : \"null\"));\n return e;\n}","export default function _checkPrivateRedeclaration(obj, privateCollection) {\n if (privateCollection.has(obj)) {\n throw new TypeError(\"Cannot initialize the same private elements twice on an object\");\n }\n}","import checkPrivateRedeclaration from \"./checkPrivateRedeclaration.js\";\nexport default function _classPrivateFieldInitSpec(obj, privateMap, value) {\n checkPrivateRedeclaration(obj, privateMap);\n privateMap.set(obj, value);\n}","import checkPrivateRedeclaration from \"./checkPrivateRedeclaration.js\";\nexport default function _classPrivateMethodInitSpec(obj, privateSet) {\n checkPrivateRedeclaration(obj, privateSet);\n privateSet.add(obj);\n}","import _typeof from \"./typeof.js\";\nexport default function setFunctionName(e, t, n) {\n \"symbol\" == _typeof(t) && (t = (t = t.description) ? \"[\" + t + \"]\" : \"\");\n try {\n Object.defineProperty(e, \"name\", {\n configurable: !0,\n value: n ? n + \" \" + t : t\n });\n } catch (e) {}\n return e;\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : String(i);\n}","import _typeof from \"./typeof.js\";\nexport default function toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}","export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}"],"names":["_EditableLabel","defineElement","property","event","method","createDecorators","EditableLabelComponent","forwardRef","LegacyEditableLabelComponent","_A","WeakMap","_B","_C","_EditableLabel_brand","WeakSet","_handleLabelEditingChange","_D","_handleLabelChange","_editableLabelRef","EditableLabel","ReactNextElement","constructor","arguments","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","_initProto","_init_label","_init_extra_label","_init_type","_init_extra_type","_init_labelEditingChange","_init_extra_labelEditingChange","value","_classPrivateGetter","this","_get_labelEditingChange","emit","_init_labelChange","_init_extra_labelChange","_get_labelChange","createRef","label","_classPrivateFieldGet","v","_classPrivateFieldSet","type","enableEditing","_classPrivateFieldGet2","current","render","React","ref","onLabelEditingChange","onLabelChange","_ref","_label","currentLabel","setCurrentLabel","useState","editingLabel","setEditingLabel","editingLabelInitialized","useRef","shouldEmitLabelChange","setShouldEmitLabelChange","labelInputRef","useImperativeHandle","useEffect","handleEditLabel","useCallback","e","preventDefault","stopPropagation","_labelInputRef$curren","_labelInputRef$curren2","focus","preventScroll","select","handleInputChange","target","handleInputKeydown","_labelInputRef$curren3","key","keyCode","which","blur","handleInputBlur","className","classNames","editing","empty","onDoubleClick","onMouseDown","onChange","onKeyDown","onBlur","_EditableLabel2","_set_labelEditingChange","_set_labelChange","c","_initClass","_applyDecs","styleTexts","styleText","o","_","has","_checkInRHS","___CSS_LOADER_EXPORT___","push","module","id","toString","exports","cssWithMappingToString","list","map","item","content","needLayer","concat","length","join","i","modules","media","dedupe","supports","layer","undefined","alreadyImportedModules","k","_k","hasOwn","hasOwnProperty","classes","arg","appendClass","parseValue","Array","isArray","apply","Object","prototype","includes","call","newClass","default","TypeError","_checkPrivateRedeclaration","obj","privateCollection","privateMap","set","privateSet","add","setFunctionName","t","n","description","defineProperty","configurable","toPropertyKey","r","Symbol","toPrimitive","String","_typeof","iterator"],"sourceRoot":""}